diff --git a/client/galaxy/scripts/mvc/library/library-dataset-view.js b/client/galaxy/scripts/mvc/library/library-dataset-view.js index f88690931b8b..f3ec6b0399dc 100644 --- a/client/galaxy/scripts/mvc/library/library-dataset-view.js +++ b/client/galaxy/scripts/mvc/library/library-dataset-view.js @@ -266,11 +266,13 @@ var LibraryDatasetView = Backbone.View.extend({ var template = this.templateDatasetPermissions(); this.$el.html(template({item: this.model, is_admin: is_admin})); var self = this; - $.get( Galaxy.root + "api/libraries/datasets/" + self.id + "/permissions?scope=current").done(function(fetched_permissions) { - self.prepareSelectBoxes({fetched_permissions: fetched_permissions, is_admin: is_admin}); - }).fail(function(){ - mod_toastr.error('An error occurred while attempting to fetch dataset permissions.'); - }); + $.get(Galaxy.root + "api/libraries/datasets/" + self.id + "/permissions?scope=current") + .done(function(fetched_permissions) { + self.prepareSelectBoxes({fetched_permissions: fetched_permissions, is_admin: is_admin}); + }) + .fail(function(){ + mod_toastr.error('An error occurred while attempting to fetch dataset permissions.'); + }); $("#center [data-toggle]").tooltip(); $("#center").css('overflow','auto'); }, diff --git a/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js b/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js index 5018e3cb2484..85cf39eb73d3 100644 --- a/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js +++ b/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js @@ -942,8 +942,8 @@ var FolderToolbarView = Backbone.View.extend({ chainCallDeletingItems: function( items_to_delete ){ var self = this; this.deleted_items = new mod_library_model.Folder(); - var popped_item = items_to_delete.pop(); - if ( typeof popped_item === "undefined" ) { + var item_to_delete = items_to_delete.pop(); + if ( typeof item_to_delete === "undefined" ) { if ( this.options.chain_call_control.failed_number === 0 ){ mod_toastr.success( 'Selected items were deleted.' ); } else if ( this.options.chain_call_control.failed_number === this.options.chain_call_control.total_number ){ @@ -954,10 +954,9 @@ var FolderToolbarView = Backbone.View.extend({ Galaxy.modal.hide(); return this.deleted_items; } - var promise = $.when( popped_item.destroy() ); - - promise.done( function( item ){ - Galaxy.libraries.folderListView.collection.remove( popped_item.id ); + item_to_delete.destroy() + .done( function( item ){ + Galaxy.libraries.folderListView.collection.remove( item_to_delete.id ); self.updateProgress(); // add the deleted item to collection, triggers rendering if ( Galaxy.libraries.folderListView.options.include_deleted ){ @@ -974,11 +973,11 @@ var FolderToolbarView = Backbone.View.extend({ } self.chainCallDeletingItems( items_to_delete ); }) - .fail( function(){ - self.options.chain_call_control.failed_number += 1; - self.updateProgress(); - self.chainCallDeletingItems( items_to_delete ); - }); + .fail( function(){ + self.options.chain_call_control.failed_number += 1; + self.updateProgress(); + self.chainCallDeletingItems( items_to_delete ); + }); }, /** @@ -996,8 +995,10 @@ var FolderToolbarView = Backbone.View.extend({ * Delete the selected items. Atomic. One by one. */ deleteSelectedItems: function(){ - var checkedValues = $('#folder_table').find(':checked'); - if(checkedValues.length === 0){ + var dataset_ids = []; + var folder_ids = []; + var $checkedValues = $('#folder_table').find(':checked'); + if($checkedValues.length === 0){ mod_toastr.info('You must select at least one item for deletion.'); } else { var template = this.templateDeletingItemsProgressBar(); @@ -1013,10 +1014,7 @@ var FolderToolbarView = Backbone.View.extend({ // init the control counters this.options.chain_call_control.total_number = 0; this.options.chain_call_control.failed_number = 0; - - var dataset_ids = []; - var folder_ids = []; - checkedValues.each(function(){ + $checkedValues.each(function(){ var row_id = $(this).closest('tr').data('id'); if (row_id !== undefined) { if (row_id.substring(0,1) == 'F'){ diff --git a/static/maps/mvc/library/library-dataset-view.js.map b/static/maps/mvc/library/library-dataset-view.js.map index 26eeb1f6034b..16d0127e872f 100644 --- a/static/maps/mvc/library/library-dataset-view.js.map +++ b/static/maps/mvc/library/library-dataset-view.js.map @@ -1 +1 @@ -{"version":3,"file":"library-dataset-view.js","sources":["../../../src/mvc/library/library-dataset-view.js"],"names":["define","mod_toastr","mod_library_model","mod_utils","mod_select","LibraryDatasetView","Backbone","View","extend","el","model","options","defaults","edit_mode","events","click .toolbtn_modify_dataset","click .toolbtn_cancel_modifications","click .toolbtn-download-dataset","click .toolbtn-import-dataset","click .btn-copy-link-to-clipboard","click .btn-make-private","click .btn-remove-restrictions","click .toolbtn_save_permissions","click .toolbtn_save_modifications","select_genome","select_extension","list_extensions","auto","id","text","description","list_genomes","initialize","this","_","fetchExtAndGenomes","fetchDataset","Item","that","fetch","success","show_permissions","showPermissions","show_version","fetchVersion","render","error","response","responseJSON","err_msg","onclick","Galaxy","libraries","library_router","back","$","remove","template","templateDataset","$el","html","item","get","tooltip","ldda_id","ldda","Ldda","url","urlRoot","renderVersion","templateVersion","enableModification","templateModifyDataset","renderSelectBoxes","genome_build","file_ext","downloadDataset","root","data","ld_ids","processDownload","method","param","inputs","each","split","pair","appendTo","submit","info","importIntoHistory","refreshUserHistoriesList","self","templateBulkImportInModal","modal","show","closing_events","title","body","histories","models","buttons","Import","importCurrentIntoHistory","Close","hide","callback","GalaxyHistories","length","warning","window","location","disableButton","new_history_name","val","post","name","done","new_history","processImportToHistory","fail","always","enableButton","history_id","find","historyItem","HistoryItem","jQuery","getJSON","save","content","source","undefined","fetched_permissions","set","access_dataset_roles","is_unrestricted","is_admin","user","isAdmin","templateDatasetPermissions","prepareSelectBoxes","css","_serializeRoles","role_list","selected_roles","i","push","selected_access_dataset_roles","selected_modify_item_roles","selected_manage_dataset_roles","modify_item_roles","manage_dataset_roles","access_select_options","minimumInputLength","multiple","placeholder","container","ajax","dataType","quietMillis","term","page","q","page_limit","results","more","total","roles","formatResult","role","type","formatSelection","initSelection","element","initialData","join","dropdownCssClass","modify_select_options","manage_select_options","accessSelectObject","modifySelectObject","manageSelectObject","templateAccessSelect","select2","saveModifications","is_changed","ld","new_name","new_info","new_genome_build","new_ext","dataset_view","patch","copyToClipboard","href","history","lastIndexOf","substr","prompt","makeDatasetPrivate","removeDatasetRestrictions","_extractIds","roles_list","ids_list","savePermissions","access_ids","manage_ids","modify_ids","access_ids[]","manage_ids[]","modify_ids[]","datatypes","key","extension","description_url","sort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ACA,yCACE,OACE,2CACA,sDACF,QACF,UACA,uCACE,OACE,mCACA,oDACF,QACF,UACA,+CACE,OACE,kCACA,wEACF,QACF,UACA,kDACE,OACE,qCACA,2EACF,QACF,UACA,4CACE,OACE,yCACA,qEACF,QACF,UACA,iDACE,OACE,oCACA,0EACF,QACF,UACA,mCACE,OACE,+BACA,4DACF,QACF,UACA,sCACE,OACE,mCACA,+DACF,QACF,UACA,qCACE,OACE,kCACA,8DACF,QACF,UACA,gCACE,OACE,4BACA,yDACF,QACF,UACF,WAEF,QACE,qBACA,SACF,SAEA,wCACE,QACE,6BACA,OACE,iEACE,wKACF,WACF,OACF,SACF,UAEA,SAEA,UACEuH,KAAK,MAGT1G,gBAAkB,WAChB,MAAOpC,GAAEuB,UAET,wCACE,6BACE,2EACE,qJACE,+CACA,uBACF,YACF,MACF,SAGA,0BACE,6EACA,4DACE,uCACE,2GACF,iBACE,gFACF,UACF,YACF,QAEA,8HAEA,8BACE,2DACE,OACE,2EACA,6CACF,QACA,oCACE,OACE,iCACA,iDACF,QACF,UACA,wCACE,OACE,oCACA,qDACF,QACF,UACA,qCACE,OACE,4BACA,kDACF,QACF,UACA,yCACE,OACE,2CACA,sDACF,QACF,UACA,uCACE,OACE,mCACA,oDACF,QACF,UACA,+CACE,OACE,kCACA,wEACF,QACF,UACA,kDACE,OACE,qCACA,2EACF,QACF,UACA,4CACE,OACE,yCACA,qEACF,QACF,UACA,iDACE,OACE,oCACA,0EACF,QACF,UACA,mCACE,OACE,+BACA,4DACF,QACF,UACA,sCACE,OACE,2CACA,+DACF,QACF,UACA,qCACE,OACE,iDACA,8DACF,QACF,UACA,gCACE,OACE,4BACA,yDACF,QACF,UACF,WACA,QACE,qBACA,SACF,SAEF,SAEF,UACEuH,KAAK,MAGTxG,sBAAwB,WACtB,MAAOtC,GAAEuB,UAET,wCACE,6BACE,kLACE,oCACA,eACF,YACA,8KACE,uCACA,aACF,YACF,SAGA,0BACE,6EACA,4DACE,uCACE,2GACF,iBACE,gFACF,UACF,YACF,QAEA,8BACE,2DACE,OACE,oHACA,oIACF,QACA,OACE,iCACA,OACE,0EACF,QACF,QACA,OACE,oCACA,OACE,oEACF,QACF,QACA,OACE,4BACA,kDACF,QACA,OACE,2CACA,sDACF,QACA,OACE,mCACA,oDACF,QACA,mBACE,kCACA,wEACF,QACE,qCACA,yDACE,2EACF,iBACE,+BACF,UACF,QACA,OACE,yCACA,qEACF,QACA,OACE,oCACA,0EACF,QACA,OACE,+BACA,4DACF,QACA,OACE,mCACA,+DACF,QACA,OACE,yCACA,8IACF,QAEA,gCACE,OACE,4BACA,yDACF,QACF,UACF,WACA,QACE,qBACA,SACF,SACF,SAEF,UACEuH,KAAK,MAGTpC,2BAA6B,WAC3B,MAAO1G,GAAEuB,UAET,wCACE,6BACE,mDACE,6JACE,4CACA,0BACF,YACF,OACA,2EACE,mJACE,qCACA,wBACF,YACF,MACF,SAGA,0BACE,6EACE,4DACE,uCACE,2GACF,iBACE,gFACF,UACJ,YACF,QAEA,sDACA,oCACE,wBACE,yKACF,iBACE,+IACF,UACF,SACA,8BACE,uCACA,kDACA,mEACA,8KACA,QACA,uCACA,+LACA,4CACE,8DACE,yLACE,oCACA,4BACF,YACF,OACF,iBACE,4FACA,gKACE,wCACA,qBACA,YACF,gDACE,iLACE,kCACA,qBACF,YACF,OACF,UACA,6CACA,mEACA,iDACE,qFACA,mGACA,mGACF,SACA,4DACA,mEACA,iDACE,uLACF,SACA,iLACE,uCACA,aACF,YACF,SAEF,UACEuH,KAAK,MAGTnF,0BAA2B,WACzB,MAAO3D,GAAEuB,UACT,QACE,mCACE,mBACA,qHACE,8CACE,mGACF,YACF,YACF,SACA,mCACE,kBACA,4GACA,WACF,SACF,UACEuH,KAAK,MAITO,qBAAsB,WACpB,MAAOrJ,GAAEuB,UACT,uCACE,2CACE,iEACF,YACF,aACEuH,KAAK,OAKX,QACI3K,mBAAoBA"} \ No newline at end of file +{"version":3,"file":"library-dataset-view.js","sources":["../../../src/mvc/library/library-dataset-view.js"],"names":["define","mod_toastr","mod_library_model","mod_utils","mod_select","LibraryDatasetView","Backbone","View","extend","el","model","options","defaults","edit_mode","events","click .toolbtn_modify_dataset","click .toolbtn_cancel_modifications","click .toolbtn-download-dataset","click .toolbtn-import-dataset","click .btn-copy-link-to-clipboard","click .btn-make-private","click .btn-remove-restrictions","click .toolbtn_save_permissions","click .toolbtn_save_modifications","select_genome","select_extension","list_extensions","auto","id","text","description","list_genomes","initialize","this","_","fetchExtAndGenomes","fetchDataset","Item","that","fetch","success","show_permissions","showPermissions","show_version","fetchVersion","render","error","response","responseJSON","err_msg","onclick","Galaxy","libraries","library_router","back","$","remove","template","templateDataset","$el","html","item","get","tooltip","ldda_id","ldda","Ldda","url","urlRoot","renderVersion","templateVersion","enableModification","templateModifyDataset","renderSelectBoxes","genome_build","file_ext","downloadDataset","root","data","ld_ids","processDownload","method","param","inputs","each","split","pair","appendTo","submit","info","importIntoHistory","refreshUserHistoriesList","self","templateBulkImportInModal","modal","show","closing_events","title","body","histories","models","buttons","Import","importCurrentIntoHistory","Close","hide","callback","GalaxyHistories","length","warning","window","location","disableButton","new_history_name","val","post","name","done","new_history","processImportToHistory","fail","always","enableButton","history_id","find","historyItem","HistoryItem","jQuery","getJSON","save","content","source","undefined","fetched_permissions","set","access_dataset_roles","is_unrestricted","is_admin","user","isAdmin","templateDatasetPermissions","prepareSelectBoxes","css","_serializeRoles","role_list","selected_roles","i","push","selected_access_dataset_roles","selected_modify_item_roles","selected_manage_dataset_roles","modify_item_roles","manage_dataset_roles","access_select_options","minimumInputLength","multiple","placeholder","container","ajax","dataType","quietMillis","term","page","q","page_limit","results","more","total","roles","formatResult","role","type","formatSelection","initSelection","element","initialData","join","dropdownCssClass","modify_select_options","manage_select_options","accessSelectObject","modifySelectObject","manageSelectObject","templateAccessSelect","select2","saveModifications","is_changed","ld","new_name","new_info","new_genome_build","new_ext","dataset_view","patch","copyToClipboard","href","history","lastIndexOf","substr","prompt","makeDatasetPrivate","removeDatasetRestrictions","_extractIds","roles_list","ids_list","savePermissions","access_ids","manage_ids","modify_ids","access_ids[]","manage_ids[]","modify_ids[]","datatypes","key","extension","description_url","sort","a","b","unshift","genomes","current_genome","current_ext","value"],"mappings":"AAAAA,QACE,cACA,4BACA,cACA,oBAEF,SACQC,EACAC,EACAC,EACAC,GAGR,GAAIC,GAAqBC,SAASC,KAAKC,QACrCC,GAAI,UAEJC,MAAO,KAEPC,WAEAC,UACEC,WAAW,GAGbC,QACEC,gCAA0C,qBAC1CC,sCAA0C,SAC1CC,kCAA0C,kBAC1CC,gCAA0C,oBAC1CC,oCAA0C,kBAC1CC,0BAA0C,qBAC1CC,iCAA0C,4BAC1CC,kCAA0C,kBAC1CC,oCAA0C,qBAI5CC,cAAgB,KAGhBC,iBAAmB,KAGnBC,mBAGAC,MACIC,GAAc,OACdC,KAAc,cACdC,YAAc,sZASlBC,gBAEAC,WAAY,SAASrB,GACnBsB,KAAKtB,QAAUuB,EAAE1B,OAAOyB,KAAKtB,QAASA,GACtCsB,KAAKE,qBACDF,KAAKtB,QAAQiB,IACfK,KAAKG,gBAITA,aAAc,SAASzB,GACrBsB,KAAKtB,QAAUuB,EAAE1B,OAAOyB,KAAKtB,QAASA,GACtCsB,KAAKvB,MAAQ,GAAIR,GAAkBmC,MAAMT,GAAIK,KAAKtB,QAAQiB,IAC1D,IAAIU,GAAOL,IACXA,MAAKvB,MAAM6B,OACTC,QAAS,WACHF,EAAK3B,QAAQ8B,iBACbH,EAAKI,kBACEJ,EAAK3B,QAAQgC,aACpBL,EAAKM,eAELN,EAAKO,UAGXC,MAAO,SAASpC,EAAOqC,GACgB,mBAA1BA,GAASC,aAClB/C,EAAW6C,MAAMC,EAASC,aAAaC,QAAU,0BAA2B,IAAKC,QAAS,WAAYC,OAAOC,UAAUC,eAAeC,UAEtIrD,EAAW6C,MAAM,2CAA4C,IAAKI,QAAS,WAAYC,OAAOC,UAAUC,eAAeC,cAM/HT,OAAQ,SAASlC,GACfsB,KA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,6CACF,QACA,oCACE,OACE,iCACA,iDACF,QACF,UACA,wCACE,OACE,oCACA,qDACF,QACF,UACA,qCACE,OACE,4BACA,kDACF,QACF,UACA,yCACE,OACE,2CACA,sDACF,QACF,UACA,uCACE,OACE,mCACA,oDACF,QACF,UACA,+CACE,OACE,kCACA,wEACF,QACF,UACA,kDACE,OACE,qCACA,2EACF,QACF,UACA,4CACE,OACE,yCACA,qEACF,QACF,UACA,iDACE,OACE,oCACA,0EACF,QACF,UACA,mCACE,OACE,+BACA,4DACF,QACF,UACA,sCACE,OACE,mCACA,+DACF,QACF,UACA,qCACE,OACE,kCACA,8DACF,QACF,UACA,gCACE,OACE,4BACA,yDACF,QACF,UACF,WAEF,QACE,qBACA,SACF,SAEA,wCACE,QACE,6BACA,OACE,iEACE,wKACF,WACF,OACF,SACF,UAEA,SAEA,UACEuH,KAAK,MAGT1G,gBAAkB,WAChB,MAAOpC,GAAEuB,UAET,wCACE,6BACE,2EACE,qJACE,+CACA,uBACF,YACF,MACF,SAGA,0BACE,6EACA,4DACE,uCACE,2GACF,iBACE,gFACF,UACF,YACF,QAEA,8HAEA,8BACE,2DACE,OACE,2EACA,6CACF,QACA,oCACE,OACE,iCACA,iDACF,QACF,UACA,wCACE,OACE,oCACA,qDACF,QACF,UACA,qCACE,OACE,4BACA,kDACF,QACF,UACA,yCACE,OACE,2CACA,sDACF,QACF,UACA,uCACE,OACE,mCACA,oDACF,QACF,UACA,+CACE,OACE,kCACA,wEACF,QACF,UACA,kDACE,OACE,qCACA,2EACF,QACF,UACA,4CACE,OACE,yCACA,qEACF,QACF,UACA,iDACE,OACE,oCACA,0EACF,QACF,UACA,mCACE,OACE,+BACA,4DACF,QACF,UACA,sCACE,OACE,2CACA,+DACF,QACF,UACA,qCACE,OACE,iDACA,8DACF,QACF,UACA,gCACE,OACE,4BACA,yDACF,QACF,UACF,WACA,QACE,qBACA,SACF,SAEF,SAEF,UACEuH,KAAK,MAGTxG,sBAAwB,WACtB,MAAOtC,GAAEuB,UAET,wCACE,6BACE,kLACE,oCACA,eACF,YACA,8KACE,uCACA,aACF,YACF,SAGA,0BACE,6EACA,4DACE,uCACE,2GACF,iBACE,gFACF,UACF,YACF,QAEA,8BACE,2DACE,OACE,oHACA,oIACF,QACA,OACE,iCACA,OACE,0EACF,QACF,QACA,OACE,oCACA,OACE,oEACF,QACF,QACA,OACE,4BACA,kDACF,QACA,OACE,2CACA,sDACF,QACA,OACE,mCACA,oDACF,QACA,mBACE,kCACA,wEACF,QACE,qCACA,yDACE,2EACF,iBACE,+BACF,UACF,QACA,OACE,yCACA,qEACF,QACA,OACE,oCACA,0EACF,QACA,OACE,+BACA,4DACF,QACA,OACE,mCACA,+DACF,QACA,OACE,yCACA,8IACF,QAEA,gCACE,OACE,4BACA,yDACF,QACF,UACF,WACA,QACE,qBACA,SACF,SACF,SAEF,UACEuH,KAAK,MAGTpC,2BAA6B,WAC3B,MAAO1G,GAAEuB,UAET,wCACE,6BACE,mDACE,6JACE,4CACA,0BACF,YACF,OACA,2EACE,mJACE,qCACA,wBACF,YACF,MACF,SAGA,0BACE,6EACE,4DACE,uCACE,2GACF,iBACE,gFACF,UACJ,YACF,QAEA,sDACA,oCACE,wBACE,yKACF,iBACE,+IACF,UACF,SACA,8BACE,uCACA,kDACA,mEACA,8KACA,QACA,uCACA,+LACA,4CACE,8DACE,yLACE,oCACA,4BACF,YACF,OACF,iBACE,4FACA,gKACE,wCACA,qBACA,YACF,gDACE,iLACE,kCACA,qBACF,YACF,OACF,UACA,6CACA,mEACA,iDACE,qFACA,mGACA,mGACF,SACA,4DACA,mEACA,iDACE,uLACF,SACA,iLACE,uCACA,aACF,YACF,SAEF,UACEuH,KAAK,MAGTnF,0BAA2B,WACzB,MAAO3D,GAAEuB,UACT,QACE,mCACE,mBACA,qHACE,8CACE,mGACF,YACF,YACF,SACA,mCACE,kBACA,4GACA,WACF,SACF,UACEuH,KAAK,MAITO,qBAAsB,WACpB,MAAOrJ,GAAEuB,UACT,uCACE,2CACE,iEACF,YACF,aACEuH,KAAK,OAKX,QACI3K,mBAAoBA"} \ No newline at end of file diff --git a/static/maps/mvc/library/library-foldertoolbar-view.js.map b/static/maps/mvc/library/library-foldertoolbar-view.js.map index 91850a8d0836..0c8a929cb489 100644 --- a/static/maps/mvc/library/library-foldertoolbar-view.js.map +++ b/static/maps/mvc/library/library-foldertoolbar-view.js.map @@ -1 +1 @@ -{"version":3,"file":"library-foldertoolbar-view.js","sources":["../../../src/mvc/library/library-foldertoolbar-view.js"],"names":["define","mod_masthead","mod_utils","mod_toastr","mod_library_model","mod_select","FolderToolbarView","Backbone","View","extend","el","events","click #toolbtn_create_folder","click #toolbtn_bulk_import","click #include_deleted_datasets_chk","click #toolbtn_bulk_delete","click .toolbtn-show-locinfo","click .page_size_prompt","defaults","can_add_library_item","contains_file_or_folder","chain_call_control","total_number","failed_number","disabled_jstree_element","modal","jstree","histories","select_genome","select_extension","list_extensions","auto","id","text","description","list_genomes","initialize","options","this","_","fetchExtAndGenomes","render","toolbar_template","templateToolBar","template_defaults","is_admin","is_anonym","mutiple_add_dataset_options","Galaxy","user","isAdmin","isAnonymous","config","user_library_import_dir","allow_library_path_paste","library_import_dir","$el","html","renderPaginator","paginator_template","templatePaginator","$","find","show_page","parseInt","page_count","total_items_count","items_shown","configureElements","show","hide","tooltip","createFolderFromModal","event","preventDefault","stopPropagation","self","template","templateNewFolderInModal","closing_events","title","body","buttons","Create","create_new_folder_event","Close","folderDetails","serialize_new_folder","validate_new_folder","current_folder_id","folder","FolderAsModel","url_items","history","fragment","split","indexOf","length","url","urlRoot","save","success","set","type","libraries","folderListView","collection","add","error","model","response","responseJSON","err_msg","name","val","modalBulkImport","checkedValues","info","that","GalaxyHistories","fetch","done","templateBulkImportInModal","models","Import","importAllIntoHistory","fail","disableButton","new_history_name","post","root","new_history","last_used_history_id","processImportToHistory","always","enableButton","history_id","history_name","dataset_ids","folder_ids","each","row_id","closest","data","substring","push","datasets_to_import","i","library_dataset_id","historyItem","HistoryItem","content","source","library_folder_id","initChainCallControl","action","jQuery","getJSON","chainCallImportingIntoHistory","updateProgress","progress","progressStep","width","Math","round","txt_representation","download","folder_id","format","ld_ids","processDownload","method","param","inputs","pair","appendTo","submit","remove","addFilesFromHistoryModal","template_modal","templateAddFilesFromHistory","Add","addAllDatasetsFromHistory","closing_callback","library_router","navigate","trigger","fetchAndDisplayHistoryContents","change","target","value","importFilesFromPathModal","templateImportPathModal","importFromPathsClicked","renderSelectBoxes","get","datatypes","key","extension","description_url","sort","a","b","unshift","cache","genomes","css","container","importFilesFromGalaxyFolderModal","templateBrowserModal","importFromJstreePath","bind","renderJstree","Jstree","require","core","plugins","types","icon","file","checkbox","three_state","err_code","warning","preserve_dirs","is","link_data","space_to_tab","to_posix_lines","tag_using_filenames","file_type","dbkey","paths","valid_paths","trimmed","trim","chainCallImportingFolders","templateAddingDatasetsProgressBar","folder_name","templateDeletingItemsProgressBar","templateImportIntoHistoryProgressBar","emit","all_nodes","get_selected","selected_nodes","filter","node","state","disabled","selection_type","undefined","li_attr","full_path","full_source","chainCallImportingUserdirFiles","history_contents","HistoryContents","history_contents_template","templateHistoryContents","contents","reverse","prop","checked_hdas","history_item_ids","history_item_types","items_to_add","hid","item_type","history_item_id","folder_item","Item","from_hdca_id","from_hda_id","chainCallAddingHdas","history_item_set","popped_item","pop","onclick","window","location","promise","when","hdas_set","added_hdas","Folder","chainCallDeletingItems","items_to_delete","deleted_items","destroy","item","include_deleted","updated_item","model_class","checkIncludeDeleted","fetchFolder","checked","deleteSelectedItems","items_total","dataset","showLocInfo","library","libraryListView","parent_library_id","showLocInfoModal","Library","templateLocInfoInModal","showImportModal","back","showPageSizePrompt","folder_page_size","prompt","preferences","join"],"mappings":"AAAAA,QACI,kBACA,cACA,cACA,4BACA,oBAEJ,SAAUC,EACAC,EACAC,EACAC,EACAC,GAGV,GAAIC,GAAoBC,SAASC,KAAKC,QACpCC,GAAI,UAEJC,QACEC,+BAAwC,wBACxCC,6BAAwC,kBACx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B,SAAS7Q,GACxB,OAAOA,EAAQmH,QACb,IAAK,UACHlH,KAAK4I,0BACL,MACF,KAAK,YACH5I,KAAK0K,kCAAoCxD,OAAQ,aACjD,MACF,KAAK,OACHlH,KAAKyJ,0BACL,MACF,KAAK,UACHzJ,KAAK0K,kCAAoCxD,OAAQ,WACjD,MACF,SACExG,OAAOwD,UAAUgF,eAAe2H,OAChChT,EAAWyG,MAAM,4BAQvBwM,mBAAoB,WAClB,GAAIC,GAAmBC,OAAQ,8CAA+CtQ,OAAOwD,UAAU+M,YAAYpH,IAAK,oBACrF,OAApBkH,GAAgCA,GAAoBrP,SAAUqP,KACjErQ,OAAOwD,UAAU+M,YAAYjN,KAAO+M,iBAAoBrP,SAAUqP,KAClErQ,OAAOwD,UAAUC,eAAehE,QAAUT,GAAIM,KAAKD,QAAQL,GAAI+B,UAAW,MAIhFpB,gBAAiB,WACf,MAAOJ,GAAEsC,UAET,wCAEE,6BACE,yCACE,+CAEA,2DACA,sGACE,UACE,mFACF,WACF,SACA,qNACE,qEACF,YACA,0CACA,kEACE,oIACE,8FACF,YACA,yCACE,yEACA,6DACE,gFACF,UACA,qDACE,4BACA,+CACA,wDACE,mFACF,UACA,qDACE,kEACF,UACF,UACF,QACF,SACA,iBACE,0LACE,mEACF,OACF,UACA,iOACE,mCACA,mBACF,YACA,0FACE,kIACE,4EACF,YACA,yCACE,kEACA,kEACA,+DACF,QACF,SACE,+NACA,oDACA,8LACE,0CACA,gBACF,YACA,0GACE,8FACE,gDACE,8CACA,aACF,YACF,OACF,UACF,SACF,UAEF,kCACA,SAEA,wDAEF,UACE2O,KAAK,MAGTP,uBAAwB,WACtB,MAAO1Q,GAAEsC,UACP,QACE,6CACE,UACE,uCACA,YACF,WACA,UACE,OACE,gBACA,sCACF,QACA,gDACE,OACE,uBACA,6CACF,QACF,UACA,6CACE,OACE,oBACA,0CACF,QACF,UACA,uDACE,OACE,mBACA,2GACF,QACF,UACA,OACE,cACA,oCACF,QACF,WACF,WACA,6CACE,UACE,sCACA,YACF,WACA,UACE,OACE,gBACA,sCACF,QACA,gDACE,OACE,uBACA,6CACF,QACF,UACA,OACE,cACA,6BACF,QACA,WACJ,WACJ,UACE2O,KAAK,MAGT1O,yBAA0B,WACxB,MAAOvC,GAAEsC,UACT,8BACE,SACE,wEACA,4EACF,UACF,UACE2O,KAAK,MAIT9L,0BAA4B,WAC1B,MAAOnF,GAAEsC,UACT,QACE,mCACE,mBACA,iHACE,8CACE,mGACF,YACF,YACF,SACA,mCACE,kBACA,4GACA,WACF,SACF,UACE2O,KAAK,MAGTxE,qCAAuC,WACrC,MAAOzM,GAAEsC,UACT,4BACE,2EACF,SACA,yBACE,gJACE,mDACF,SACF,UACE2O,KAAK,MAGT3E,kCAAmC,WACjC,MAAOtM,GAAEsC,UACT,4BACE,iFACF,SACA,yBACE,gJACE,mDACF,SACF,UACE2O,KAAK,MAGTzE,iCAAkC,WAChC,MAAOxM,GAAEsC,UACT,4BACA,SACA,yBACE,gJACE,mDACF,SACF,UACE2O,KAAK,MAGTvG,qBAAsB,WACpB,MAAO1K,GAAEsC,UACT,gCACE,0JACA,wLACA,mCACE,oFACE,yGACF,WACA,sFACA,uFACA,WACF,SACA,mCACE,kFACE,yFACA,+BACF,WACA,kCACE,mEACA,gCACF,WACA,kCACE,0FACA,gCACF,WACA,kCACE,yEACA,yBACF,WACF,SACA,qGACE,aACF,YACA,qGACE,eACF,YACA,SAEA,4BACA,SACA,SACA,kFACA,QACE,gFACA,4EACF,SACA,OACA,QACG,4CACG,oCACA,0FACH,WACH,SACF,UACE2O,KAAK,MAGTxH,wBAAyB,WACvB,MAAOzJ,GAAEsC,UACT,gCACE,+JACA,sCACE,kCACE,yFACA,+BACF,WACA,kCACE,mEACA,gCACF,WACA,OACA,kCACE,0FACA,gCACF,WACA,kCACE,yEACA,yBACF,WACF,SACA,uKACA,SACA,kFACA,QACE,gFACA,4EACF,SACA,QACG,4CACG,oCACA,0FACH,WACH,SACF,UACE2O,KAAK;;EAGTpI,4BAA6B,WAC3B,MAAO7I,GAAEsC,UACT,6BACE,QACE,gCACA,8EACE,8CACE,mGACF,YACF,YACF,SACA,QACA,sCACA,SACF,UACE2O,KAAK,MAGTtD,wBAAyB,WACvB,MAAO3N,GAAEsC,UACT,gDACA,QACA,6GACE,aACF,YACA,+GACE,eACF,YACA,SACA,OACA,OACE,0DACE,oDACE,iDACA,yDACI,kEACA,0CACE,+GACE,UACF,6CACI,wFACA,0HACF,WACF,QACD,iBACE,6FACG,2GACE,6CACA,kLACF,UACF,QACF,UACN,iGACI,+GACE,6CACE,wFACA,qGACF,WACF,QACJ,UACF,UACF,YACF,SACE2O,KAAK,MAGT5P,kBAAmB,WACjB,MAAOrB,GAAEsC,UACT,wCACE,uCACE,gDACE,iGACA,wHACF,iBACE,iGACA,2GACF,UACF,iBACE,kHACA,wHACF,UACA,sBACE,0FACF,QACA,4CACE,2GACA,0HACF,iBACE,yHACA,2IACF,UACF,QACA,SACE,sBACA,8HACE,qBACF,OACA,0CACF,WACE2O,KAAK,OAKX,QACIlT,kBAAmBA"} \ No newline at end of file +{"version":3,"file":"library-foldertoolbar-view.js","sources":["../../../src/mvc/library/library-foldertoolbar-view.js"],"names":["define","mod_masthead","mod_utils","mod_toastr","mod_library_model","mod_select","FolderToolbarView","Backbone","View","extend","el","events","click #toolbtn_create_folder","click #toolbtn_bulk_import","click #include_deleted_datasets_chk","click #toolbtn_bulk_delete","click .toolbtn-show-locinfo","click .page_size_prompt","defaults","can_add_library_item","contains_file_or_folder","chain_call_control","total_number","failed_number","disabled_jstree_element","modal","jstree","histories","select_genome","select_extension","list_extensions","auto","id","text","description","list_genomes","initialize","options","this","_","fetchExtAndGenomes","render","toolbar_template","templateToolBar","template_defaults","is_admin","is_anonym","mutiple_add_dataset_options","Galaxy","user","isAdmin","isAnonymous","config","user_library_import_dir","allow_library_path_paste","library_import_dir","$el","html","renderPaginator","paginator_template","templatePaginator","$","find","show_page","parseInt","page_count","total_items_count","items_shown","configureElements","show","hide","tooltip","createFolderFromModal","event","preventDefault","stopPropagation","self","template","templateNewFolderInModal","closing_events","title","body","buttons","Create","create_new_folder_event","Close","folderDetails","serialize_new_folder","validate_new_folder","current_folder_id","folder","FolderAsModel","url_items","history","fragment","split","indexOf","length","url","urlRoot","save","success","set","type","libraries","folderListView","collection","add","error","model","response","responseJSON","err_msg","name","val","modalBulkImport","checkedValues","info","that","GalaxyHistories","fetch","done","templateBulkImportInModal","models","Import","importAllIntoHistory","fail","disableButton","new_history_name","post","root","new_history","last_used_history_id","processImportToHistory","always","enableButton","history_id","history_name","dataset_ids","folder_ids","each","row_id","closest","data","substring","push","datasets_to_import","i","library_dataset_id","historyItem","HistoryItem","content","source","library_folder_id","initChainCallControl","action","jQuery","getJSON","chainCallImportingIntoHistory","updateProgress","progress","progressStep","width","Math","round","txt_representation","download","folder_id","format","ld_ids","processDownload","method","param","inputs","pair","appendTo","submit","remove","addFilesFromHistoryModal","template_modal","templateAddFilesFromHistory","Add","addAllDatasetsFromHistory","closing_callback","library_router","navigate","trigger","fetchAndDisplayHistoryContents","change","target","value","importFilesFromPathModal","templateImportPathModal","importFromPathsClicked","renderSelectBoxes","get","datatypes","key","extension","description_url","sort","a","b","unshift","cache","genomes","css","container","importFilesFromGalaxyFolderModal","templateBrowserModal","importFromJstreePath","bind","renderJstree","Jstree","require","core","plugins","types","icon","file","checkbox","three_state","err_code","warning","preserve_dirs","is","link_data","space_to_tab","to_posix_lines","tag_using_filenames","file_type","dbkey","paths","valid_paths","trimmed","trim","chainCallImportingFolders","templateAddingDatasetsProgressBar","folder_name","templateDeletingItemsProgressBar","templateImportIntoHistoryProgressBar","emit","all_nodes","get_selected","selected_nodes","filter","node","state","disabled","selection_type","undefined","li_attr","full_path","full_source","chainCallImportingUserdirFiles","history_contents","HistoryContents","history_contents_template","templateHistoryContents","contents","reverse","prop","checked_hdas","history_item_ids","history_item_types","items_to_add","hid","item_type","history_item_id","folder_item","Item","from_hdca_id","from_hda_id","chainCallAddingHdas","history_item_set","popped_item","pop","onclick","window","location","promise","when","hdas_set","added_hdas","Folder","chainCallDeletingItems","items_to_delete","deleted_items","item_to_delete","destroy","item","include_deleted","updated_item","model_class","checkIncludeDeleted","fetchFolder","checked","deleteSelectedItems","$checkedValues","items_total","dataset","showLocInfo","library","libraryListView","parent_library_id","showLocInfoModal","Library","templateLocInfoInModal","showImportModal","back","showPageSizePrompt","folder_page_size","prompt","preferences","join"],"mappings":"AAAAA,QACI,kBACA,cACA,cACA,4BACA,oBAEJ,SAAUC,EACAC,EACAC,EACAC,EACAC,GAGV,GAAIC,GAAoBC,SAASC,KAAKC,QACpCC,GAAI,UAEJC,QACEC,+BAAwC,wBACxCC,6BAAwC,kBACxCC,sCAAwC,sBACxCC,6BAAwC,sBACxCC,8BAAwC,cACxCC,0BAAwC,sBAI1CC,UACEC,sBAA4B,EAC5BC,yBAA4B,EAC5BC,oBAC4BC,aAAkB,EAClBC,cAAkB,GAE9CC,wBAA4B,WAG9BC,MAAQ,KAGRC,OAAQ,KAGRC,UAAY,KAGZC,cAAgB,KAGhBC,iBAAmB,KAGnBC,mBAGAC,MACIC,GAAc,OACdC,KAAc,cACdC,YAAc,sZASlBC,gBAEAC,WAAY,SAASC,GACnBC,KAAKD,QAAUE,EAAErB,SAAUmB,MAAeC,KAAKpB,UAC/CoB,KAAKE,qBACLF,KAAKG,UAGPA,OAAQ,SAASJ,GACfC,KAAKD,QAAUE,EAAE9B,OAAQ6B,KAAKD,QAASA,EACvC,IAAIK,GAAmBJ,KAAKK,kBACxBC,GACAZ,GAAIM,KAAKD,QAAQL,GACjBa,UAAU,EACVC,WAAW,EACXC,6BAA6B,EAE7BC,QAAOC,OACTL,EAAkBC,SAAWG,OAAOC,KAAKC,UACzCN,EAAkBE,UAAYE,OAAOC,KAAKE,eACK,OAA1CH,OAAOI,OAAOC,yBAAoCL,OAAOI,OAAOE,4BAA6B,GAA8C,OAArCN,OAAOI,OAAOG,sBACvHX,EAAkBG,6BAA8B,IAGpDT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,kIACE,4EACF,YACA,yCACE,kEACA,kEACA,+DACF,QACF,SACE,+NACA,oDACA,8LACE,0CACA,gBACF,YACA,0GACE,8FACE,gDACE,8CACA,aACF,YACF,OACF,UACF,SACF,UAEF,kCACA,SAEA,wDAEF,UACE6O,KAAK,MAGTP,uBAAwB,WACtB,MAAO5Q,GAAEsC,UACP,QACE,6CACE,UACE,uCACA,YACF,WACA,UACE,OACE,gBACA,sCACF,QACA,gDACE,OACE,uBACA,6CACF,QACF,UACA,6CACE,OACE,oBACA,0CACF,QACF,UACA,uDACE,OACE,mBACA,2GACF,QACF,UACA,OACE,cACA,oCACF,QACF,WACF,WACA,6CACE,UACE,sCACA,YACF,WACA,UACE,OACE,gBACA,sCACF,QACA,gDACE,OACE,uBACA,6CACF,QACF,UACA,OACE,cACA,6BACF,QACA,WACJ,WACJ,UACE6O,KAAK,MAGT5O,yBAA0B,WACxB,MAAOvC,GAAEsC,UACT,8BACE,SACE,wEACA,4EACF,UACF,UACE6O,KAAK,MAIThM,0BAA4B,WAC1B,MAAOnF,GAAEsC,UACT,QACE,mCACE,mBACA,iHACE,8CACE,mGACF,YACF,YACF,SACA,mCACE,kBACA,4GACA,WACF,SACF,UACE6O,KAAK,MAGT1E,qCAAuC,WACrC,MAAOzM,GAAEsC,UACT,4BACE,2EACF,SACA,yBACE,gJACE,mDACF,SACF,UACE6O,KAAK,MAGT7E,kCAAmC,WACjC,MAAOtM,GAAEsC,UACT,4BACE,iFACF,SACA,yBACE,gJACE,mDACF,SACF,UACE6O,KAAK,MAGT3E,iCAAkC,WAChC,MAAOxM,GAAEsC,UACT,4BACA,SACA,yBACE,gJACE,mDACF,SACF,UACE6O,KAAK,MAGTzG,qBAAsB,WACpB,MAAO1K,GAAEsC,UACT,gCACE,0JACA,wLACA,mCACE,oFACE,yGACF,WACA,sFACA,uFACA,WACF,SACA,mCACE,kFACE,yFACA,+BACF,WACA,kCACE,mEACA,gCACF,WACA,kCACE,0FACA,gCACF,WACA,kCACE,yEACA,yBACF,WACF,SACA,qGACE,aACF,YACA,qGACE,eACF,YACA,SAEA,4BACA,SACA,SACA,kFACA,QACE,gFACA,4EACF,SACA,OACA,QACG,4CACG,oCACA,0FACH,WACH,SACF,UACE6O,KAAK,MAGT1H,wBAAyB,WACvB,MAAOzJ,GAAEsC,UACT,gCACE,+JACA,sCACE,kCACE,yFACA,+BACF,WACA,kCACE,mEACA,gCACF,WACA,OACA,kCACE,0FACA,gCACF,WACA,kCACE,yEACA,yBACF,WACF,SACA,uKACA,SACA,kFACA,QACE,gFACA,4EACF,SACA,QACG,4CACG,oCACA,0FACH,WACH,SACF,UACE6O,KAAK;;EAGTtI,4BAA6B,WAC3B,MAAO7I,GAAEsC,UACT,6BACE,QACE,gCACA,8EACE,8CACE,mGACF,YACF,YACF,SACA,QACA,sCACA,SACF,UACE6O,KAAK,MAGTxD,wBAAyB,WACvB,MAAO3N,GAAEsC,UACT,gDACA,QACA,6GACE,aACF,YACA,+GACE,eACF,YACA,SACA,OACA,OACE,0DACE,oDACE,iDACA,yDACI,kEACA,0CACE,+GACE,UACF,6CACI,wFACA,0HACF,WACF,QACD,iBACE,6FACG,2GACE,6CACA,kLACF,UACF,QACF,UACN,iGACI,+GACE,6CACE,wFACA,qGACF,WACF,QACJ,UACF,UACF,YACF,SACE6O,KAAK,MAGT9P,kBAAmB,WACjB,MAAOrB,GAAEsC,UACT,wCACE,uCACE,gDACE,iGACA,wHACF,iBACE,iGACA,2GACF,UACF,iBACE,kHACA,wHACF,UACA,sBACE,0FACF,QACA,4CACE,2GACA,0HACF,iBACE,yHACA,2IACF,UACF,QACA,SACE,sBACA,8HACE,qBACF,OACA,0CACF,WACE6O,KAAK,OAKX,QACIpT,kBAAmBA"} \ No newline at end of file diff --git a/static/scripts/bundled/analysis.bundled.js.map b/static/scripts/bundled/analysis.bundled.js.map index c45f9e1ab3a4..62616d64dd60 100644 --- a/static/scripts/bundled/analysis.bundled.js.map +++ b/static/scripts/bundled/analysis.bundled.js.map @@ -1,4 +1,5 @@ <<<<<<< HEAD +<<<<<<< HEAD {"version":3,"sources":["webpack:///analysis.bundled.js","webpack:///./galaxy/scripts/apps/analysis.js","webpack:///./galaxy/scripts/mvc/ui/ui-misc.js?fd98","webpack:///./galaxy/scripts/mvc/ui/ui-portlet.js?0568","webpack:///./galaxy/scripts/mvc/form/form-view.js?db3b","webpack:///./galaxy/scripts/mvc/ui/ui-buttons.js?4ced","webpack:///./galaxy/scripts/mvc/grid/grid-view.js?be4f","webpack:///./galaxy/scripts/mvc/ui/ui-list.js?ecf1","webpack:///./galaxy/scripts/mvc/ui/ui-options.js?405a","webpack:///./galaxy/scripts/mvc/ui/ui-select-default.js?402d","webpack:///./galaxy/scripts/mvc/dataset/data.js?f841*","webpack:///./galaxy/scripts/mvc/dataset/states.js","webpack:///./galaxy/scripts/mvc/ui/popup-menu.js?a948","webpack:///./galaxy/scripts/mvc/form/form-data.js?6144","webpack:///./galaxy/scripts/mvc/ui/icon-button.js?40a6*","webpack:///./galaxy/scripts/mvc/ui/ui-popover.js","webpack:///./galaxy/scripts/mvc/ui/ui-select.js","webpack:///./galaxy/scripts/mvc/ui/ui-table.js?4ded","webpack:///./galaxy/scripts/ui/editable-text.js?53d0","webpack:///./galaxy/scripts/ui/fa-icon-button.js","webpack:///./galaxy/scripts/viz/trackster/util.js?c726","webpack:///./galaxy/scripts/mvc/citation/citation-model.js?63a3","webpack:///./galaxy/scripts/mvc/form/form-input.js?af7f","webpack:///./galaxy/scripts/mvc/form/form-parameters.js?0ee1","webpack:///./galaxy/scripts/mvc/form/form-repeat.js?7c22","webpack:///./galaxy/scripts/mvc/form/form-section.js?2ccb","webpack:///./galaxy/scripts/mvc/grid/grid-model.js?e551","webpack:///./galaxy/scripts/mvc/grid/grid-template.js?73e1","webpack:///./galaxy/scripts/mvc/tool/tool-genomespace.js?5b3a","webpack:///./galaxy/scripts/mvc/ui/ui-color-picker.js?fa1d","webpack:///./galaxy/scripts/mvc/ui/ui-drilldown.js?de06","webpack:///./galaxy/scripts/mvc/ui/ui-select-content.js?e092","webpack:///./galaxy/scripts/mvc/ui/ui-select-ftp.js?cf41","webpack:///./galaxy/scripts/mvc/ui/ui-select-genomespace.js?f8ed","webpack:///./galaxy/scripts/mvc/ui/ui-select-library.js?fd76","webpack:///./galaxy/scripts/mvc/ui/ui-slider.js?93a7","webpack:///./galaxy/scripts/mvc/upload/upload-model.js","webpack:///./galaxy/scripts/mvc/tag.js","webpack:///./galaxy/scripts/mvc/tool/tool-form-base.js?81c1","webpack:///./galaxy/scripts/mvc/tool/tool-form.js?a6b7","webpack:///./galaxy/scripts/mvc/ui/ui-tabs.js?173b","webpack:///./galaxy/scripts/utils/deferred.js?8fee","webpack:///./galaxy/scripts/layout/router.js","webpack:///./galaxy/scripts/libs/bibtex.js?8f2e","webpack:///./galaxy/scripts/mvc/citation/citation-view.js?b4c0","webpack:///./galaxy/scripts/mvc/collection/collection-li.js","webpack:///./galaxy/scripts/mvc/collection/collection-model.js","webpack:///./galaxy/scripts/mvc/collection/list-collection-creator.js","webpack:///./galaxy/scripts/mvc/dataset/dataset-li.js","webpack:///./galaxy/scripts/mvc/form/form-wrapper.js","webpack:///./galaxy/scripts/mvc/history/hdca-model.js","webpack:///./galaxy/scripts/mvc/history/history-contents.js","webpack:///./galaxy/scripts/mvc/history/history-model.js","webpack:///./galaxy/scripts/mvc/history/history-preferences.js","webpack:///./galaxy/scripts/mvc/list/list-item.js","webpack:///./galaxy/scripts/mvc/tool/tools.js?fad9","webpack:///./galaxy/scripts/mvc/upload/upload-ftp.js","webpack:///./galaxy/scripts/mvc/upload/upload-settings.js","webpack:///./galaxy/scripts/utils/uploadbox.js","webpack:///./galaxy/scripts/mvc/annotation.js","webpack:///./galaxy/scripts/mvc/base/controlled-fetch-collection.js","webpack:///./galaxy/scripts/mvc/collection/base-creator.js","webpack:///./galaxy/scripts/mvc/collection/collection-view.js","webpack:///./galaxy/scripts/mvc/dataset/dataset-li-edit.js","webpack:///./galaxy/scripts/mvc/dataset/dataset-model.js","webpack:///./galaxy/scripts/mvc/history/copy-dialog.js","webpack:///./galaxy/scripts/mvc/history/hda-li.js","webpack:///./galaxy/scripts/mvc/history/hda-model.js","webpack:///./galaxy/scripts/mvc/history/hdca-li.js","webpack:///./galaxy/scripts/mvc/history/history-content-model.js","webpack:///./galaxy/scripts/mvc/list/list-view.js","webpack:///./galaxy/scripts/mvc/tool/tool-form-composite.js","webpack:///./galaxy/scripts/mvc/ui/error-modal.js","webpack:///./galaxy/scripts/ui/hoverhighlight.js","webpack:///./galaxy/scripts/ui/search-input.js","webpack:///./galaxy/scripts/utils/natural-sort.js","webpack:///./galaxy/scripts/apps/panels/history-panel.js","webpack:///./galaxy/scripts/apps/panels/tool-panel.js","webpack:///./galaxy/scripts/libs/toastr.js","webpack:///./galaxy/scripts/mvc/collection/collection-li-edit.js","webpack:///./galaxy/scripts/mvc/collection/collection-view-edit.js","webpack:///./galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js","webpack:///./galaxy/scripts/mvc/collection/pair-collection-creator.js","webpack:///./galaxy/scripts/mvc/dataset/dataset-edit-attributes.js","webpack:///./galaxy/scripts/mvc/dataset/dataset-error.js","webpack:///./galaxy/scripts/mvc/grid/grid-shared.js","webpack:///./galaxy/scripts/mvc/history/hda-li-edit.js","webpack:///./galaxy/scripts/mvc/history/hdca-li-edit.js","webpack:///./galaxy/scripts/mvc/history/history-list.js","webpack:///./galaxy/scripts/mvc/history/history-view-edit-current.js","webpack:///./galaxy/scripts/mvc/history/history-view-edit.js","webpack:///./galaxy/scripts/mvc/history/history-view.js","webpack:///./galaxy/scripts/mvc/history/options-menu.js","webpack:///./galaxy/scripts/mvc/upload/collection/collection-row.js","webpack:///./galaxy/scripts/mvc/upload/collection/collection-view.js","webpack:///./galaxy/scripts/mvc/upload/composite/composite-row.js","webpack:///./galaxy/scripts/mvc/upload/composite/composite-view.js","webpack:///./galaxy/scripts/mvc/upload/default/default-row.js","webpack:///./galaxy/scripts/mvc/upload/default/default-view.js","webpack:///./galaxy/scripts/mvc/upload/upload-button.js","webpack:///./galaxy/scripts/mvc/upload/upload-view.js","webpack:///./galaxy/scripts/mvc/user/user-custom-builds.js","webpack:///./galaxy/scripts/mvc/user/user-preferences.js","webpack:///./galaxy/scripts/mvc/workflow/workflow-icons.js","webpack:///./galaxy/scripts/mvc/workflow/workflow-model.js","webpack:///./galaxy/scripts/mvc/workflow/workflow.js","webpack:///./galaxy/scripts/ui/loading-indicator.js","webpack:///./galaxy/scripts/utils/ajax-queue.js","webpack:///./galaxy/scripts/utils/levenshtein.js","webpack:///(webpack)/buildin/amd-define.js"],"names":["webpackJsonp","module","exports","__webpack_require__","_","jQuery","$","GalaxyApp","Router","ToolPanel","HistoryPanel","Page","ToolForm","FormWrapper","UserPreferences","CustomBuilds","Tours","GridView","GridShared","Workflows","HistoryList","ToolFormComposite","Utils","Ui","DatasetError","DatasetEditAttributes","window","app","options","bootstrapped","Galaxy","debug","AnalysisRouter","extend","routes","(/)","(/)root*","(/)tours(/)(:tour_id)","(/)user(/)","(/)user(/)(:form_id)","(/)workflow(/)","(/)workflow/run(/)","(/)pages(/)(:action_id)","(/)visualizations/(:action_id)","(/)workflows/list_published(/)","(/)histories(/)(:action_id)","(/)datasets(/)list(/)","(/)workflow/import_workflow","(/)custom_builds","(/)datasets/edit","(/)datasets/error","require_login","authenticate","args","name","user","id","this","indexOf","show_tours","tour_id","giveTour","page","display","ToursView","show_user","View","show_user_form","form_id","model","Model","user_id","params","get","show_visualizations","action_id","plural","item","show_workflows_published","url_base","root","dict_format","show_histories","show_datasets","show_pages","show_workflows","show_run","_loadWorkflow","show_import_workflow","ImportWorkflowView","show_custom_builds","self","historyPanel","historyView","setTimeout","show_dataset_edit_attributes","show_dataset_error","home","tool_id","job_id","toolPanel","upload","show","_loadCenterIframe","_loadToolForm","workflow_id","m_c","m_a","decodeURIComponent","url","prop","getQueryString","data","style","success","response","error","error_msg","message","status","persistent","cls","Message","Left","Right","call","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","Backbone","Select","Slider","Options","Drilldown","Buttons","Modal","Label","tagName","initialize","setElement","listenTo","render","title","new_title","set","value","$el","removeClass","addClass","html","fade","update","messageForDisplay","timeout","clearTimeout","fadeOut","escape","UnescapedMessage","Input","type","placeholder","disabled","readonly","visible","area","color","events","input","new_val","undefined","attr","css","datalist","isArray","length","autocomplete","source","request","change","_onchange","val","each","attr_name","removeAttr","Hidden","append","$info","$hidden","text","hide","Upload","$file","$text","$wait","on","e","_readFile","file","target","files","reader","FileReader","onload","wait","result","readAsText","Button","ButtonDefault","ButtonIcon","ButtonCheck","ButtonMenu","ButtonLink","RadioButton","Checkbox","Radio","apply","uid","icon","buttons","body","scrollable","nopadding","operations","collapsible","collapsible_button","collapsed","onchange_title","_template","$body","$title_text","$title_icon","$header","$content","$backdrop","$buttons","$operations","tooltip","onclick","attributes","off","collapse","expand","make_text_editable","on_finish","empty","header","fadeIn","enableButton","find","disableButton","hideOperation","showOperation","setOperation","callback","height","setIcon","disable","enable","Portlet","FormSection","FormData","initial_errors","always_refresh","onchange","new_model","matchModel","node","input_id","input_list","isEqual","field","field_list","new_options","i","opt","push","label","trigger","emit","active","is_dynamic","unwait","highlight","silent","input_element","element_list","portlet","$panel","parents","filter","first","animate","scrollTop","offset","top","errors","error_messages","matchResponse","Manager","_renderForm","create","current_check","checksum","refresh_on_change","new_check","reset","remove","section","inputs","wait_text","wait_cls","percentage","$icon","$title","$progress","$progress_bar","placement","width","href","icons","total","$button","$menu","pull","onunload","tag","collection","Collection","$root","where","preventDefault","submodel","suboptions","$link","divider","addMenu","add","merge","ajaxSettings","traditional","GridModel","Templates","PopupMenu","grid","grid_config","add_tag_to_grid_filter","tag_name","tag_value","advanced_search","is","slideToggle","add_filter_condition","items","url_data","filters","v","k","ajax","param","embedded","init_grid","use_panels","padding","overflow","handle_refresh","refresh_frames","inArray","currHistoryPanel","loadCurrentHistory","allow_title_display","setWindowTitle","replace","footer","use_hide_message","init_grid_elements","init_grid_controls","init_refresh_on_change","click","submit_operation","select","keyup","set_sort_condition","submit","column_key","text_input_obj","text_input","parent","remove_filter_condition","set_categorical_filter","check_all_items","checkboxes","check_count","update_checked","rating","set_page","execute","items_length","index","button","popup","operation","_add_operation","settings","operation_config","allowed","allow_popup","addItem","url_args","confirmation_text","confirm","func","encode_id","findItemByHtml","add_filter","t","filter_element","container","go_page_one","remove_filter","col_key","cur_sort","new_sort","substring","sort_arrow","new_value","category_filter","cur_value","trim","filter_value","new_page","page_num","parseInt","split","cur_page","children","operation_button","operation_name","number_of_checked_ids","findWhere","item_ids","check","state","c","href_parts","href_parms_str","href_parms","toLowerCase","location","get_url_data","can_async_op","update_grid","go_to","async","$div","closest","load","method","alert","response_text","insert","json","parseJSON","complete","multiple","optional","v_id","v_name","_refresh","lst","isEmpty","_templateRow","Base","error_text","_changeValue","_changeWait","_changeData","_changeVisible","$message","$options","all_button","_getValue","_templateOptions","option","_templateOption","_messageShow","_setValue","values","selected","BaseIcons","pair","prototype","data2","empty_text","searchable","individual","pagesize","_changeDisabled","_renderSearchable","_renderClassic","$select","$dropdown","$resize","$resize_icon","event","currentY","pageY","currentHeight","minHeight","Math","max","select2","prepend","_match","term","String","toUpperCase","order","tags","matched_tags","closeOnSelect","query","q","results","found","slice","more","formatResult","reduce","memo","exists","d","sorter","keep","sort","setOnChange","a","b","Frames","mod_icon_btn","DatasetMetadata","Dataset","defaults","hda_ldda","metadata","_set_metadata","keys","new_key","get_metadata","attribute","urlRoot","TabularDataset","chunk_url","first_data_chunk","at_eof","url_viz","get_next_chunk","next_chunk","Deferred","getJSON","chunk","rval","ck_data","resolve","DatasetCollection","TabularDatasetChunkedView","row_count","loading_chunk","TabularButtonTracksterView","expand_to_container","scroll_elt","attempt_to_fetch","scrolled_to_bottom","loading_indicator","when","then","_renderChunk","data_table","cellpadding","column_names","header_container","appendTo","header_row","join","j","first_chunk","scroll","_renderCell","cell_contents","colspan","$cell","column_types","_renderRow","line","cells","row","num_columns","range","TopLevelTabularDatasetChunkedView","p","EmbeddedTabularDatasetChunkedView","position","innerHeight","el","scrollHeight","col","chrom","start","end","dataset_id","genome_build","file_ext","search","str","array","match","modal","frame","console","log","btn_viz","IconButtonView","IconButton","icon_class","mouseover tr","mouseleave","is_numeric","n","isNaN","parseFloat","isFinite","eq","btn_viz_pars","gene_region","left","createTabularDatasetChunkedView","dataset_config","parent_elt","view","STATES","UPLOAD","QUEUED","RUNNING","SETTING_METADATA","NEW","EMPTY","OK","PAUSED","FAILED_METADATA","NOT_VIEWABLE","DISCARDED","ERROR","READY_STATES","NOT_READY_STATES","menu","_renderAndShow","clickEvent","_getShownPosition","_setUpCloseBehavior","template","li","map","checked","menuWidth","x","pageX","min","document","scrollLeft","closePopup","err","contents","one","splice","removeItem","findIndexByHtml","has","toString","make_popupmenu","button_element","initial_options","convertedOptions","optionVal","optionKey","newOption","convertLinksToOptions","$parent","selector","elem","linkHref","linkTarget","confirmText","fromExistingDom","$buttonElement","$menuElement","menuElementLinkSelector","make_popup_menus","menuSelector","buttonSelectorBuildFn","popupMenusCreated","fromDom","sum","JSON","stringify","flat_id","input_value","flat_dict","result_dict","convert","identifier","head","section_label","block_indices","block_prefix","block_label","pos","substr","test_param","selectedCase","matchCase","flat","ignore","collapsible_value","payload","p_id","dict","_iterate","visitInputs","new_id","separator","Array","child","hasClass","truevalue","falsevalue","cases","prefix","context","key","cache","on_click","menu_options","is_menu_button","enabled","tooltip_config","bind","new_elem","toJSON","replaceWith","isFunction","buffer","IconButtonCollection","IconButtonMenuView","elt","create_icon_buttons_menu","config","global_config","button_config","optionsDefault","with_close","$close","_get_placement","newTitle","_get_width","$container","container_width","container_height","_get_height","container_position","minimumInputLength","initialData","select_data","before","after","del","_getIndex","select_opt","containerCssClass","dropdownCssClass","escapeMarkup","formatSelection","initSelection","dropdownAutoWidth","findIndex","content","ondblclick","onconfirm","selectable","cls_tr","$thead","$tbody","$tmessage","_row","dblclick","addHeader","appendHeader","align","wrapper","_commit","delAll","size","_onclick","old_value","_ondblclick","__WEBPACK_AMD_DEFINE_FACTORY__","factory","fn","config_dict","num_cols","num_rows","use_textarea","help_text","input_elt","button_elt","set_text","new_text","cur_text","rows","cols","keyCode","blur","stopPropagation","focus","faIconButton","tooltipConfig","classes","concat","faIcon","commatize","number","rgx","test","is_deferred","ServerStateDeferred","ajax_settings","interval","success_fn","go","deferred","_go","get_random_color","colors","new_color","nr","ng","nb","other_color","or","og","ob","n_brightness","o_brightness","diff","brightness","r","g","difference","r1","g1","b1","r2","g2","b2","ok","num_tries","round","random","abs","parseBibtex","baseMVC","_l","BibtexParser","logNamespace","Citation","LoggableMixin","_logNamespace","parsed","all","current","_fields","entry","entries","rawFields","Fields","lowerKey","entryType","EntryType","fields","BaseCitationCollection","partial","HistoryCitationCollection","history_id","ToolCitationCollection","app_options","text_enable","text_disable","cls_enable","cls_disable","$field","$preview","$collapsible","$collapsible_text","$collapsible_icon","$error_text","$error","backdrop","help_argument","collapsible_state","SelectContent","SelectLibrary","SelectFtp","SelectGenomeSpace","ColorPicker","types","password","data_column","genomebuild","data_collection","integer","float","boolean","drill_down","hidden","hidden_data","baseurl","library_data","ftpfile","genomespacefile","input_def","fieldClass","_fieldSelect","_fieldText","_fieldData","extensions","flavor","is_workflow","SelectClass","_fieldDrilldown","str_value","_fieldSlider","precise","_fieldHidden","info","_fieldBoolean","_fieldColor","_fieldLibrary","_fieldFtp","_fieldGenomeSpace","_fieldUpload","list","button_new","onnew","$list","button_delete","ondel","hideOptions","Repeat","InputElement","Parameters","parameters","_addConditional","_addRepeat","_addSection","_addRow","case_def","section_row","nonhidden","sub_section","_append","sub_section_id","block_index","repeat","n_cache","default","help","expanded","hide_label","text_value","collapsible_preview","argument","fixed","async_ops","categorical_filters","sort_key","show_item_checkboxes","num_pages","op","cur_val","condition","condition_index","pairs","get_url","tmpl","grid_header","grid_table","info_text","global_actions","show_popup","action","grid_filters","columns","column","extra","num_rows_rendered","encoded_id","current_item_id","nowrap","column_settings","column_config","link","attach_popup","label_id_prefix","use_paging","num_page_links","cur_page_num","page_link_range","min_page","min_offset","max_offset","max_range","max_page","page_index","allow_multiple","found_global","global_operation","legend","default_filter_dict","advanced_search_display","show_advanced_search_link","filterable","f_key","d_key","standard_search_display","grid_column_filter","column_label","is_text","temp_column","column_filter","seperator","cf_label","cf","cf_key","cf_arg","filter_key","sanitize","openFileBrowser","GS_UI_URL","genomespace_ui_url","GS_UPLOAD_URL","newWin","open","successCalBack","addEventListener","setCallbackOnGSUploadError","standard","base","theme","$view","$value","_build","$boxes","_templateCheck","hex","rgb","_content","line_def","_templateContent","$line","$box","_templateBox","bottom","header_index","element","_setState","header_id","is_expanded","$subgroup","attach","iterate","$tmpl","level","has_options","new_header","$group","Batch","DISABLED","ENABLED","LINKED","Configurations","src","batch","data_multiple","workflow_data","workflow_data_multiple","workflow_data_collection","module_data","module_data_collection","src_labels","hda","hdca","pagelimit","statustimer","button_product","$batch_div","$batch","linked","clone","lastenter","_handleDrop","history","_changeCurrent","_changeType","id_list","_batch","details","hid","$batchfield","batchmode","button_type","config_id","textify","button_data","button_width","margin-left","select_options","ev","drop_data","parse","originalEvent","dataTransfer","getData","new_src","history_content_type","current_value","_handleDropStatus","map_over_type","List","ftpfile_list","GenomespaceBrowser","browse_button","browseGenomeSpace","filename_textbox","token_textbox","successCallback","destination","token","Table","Libraries","LibraryDatasets","library_id","fetch","libraries","datasets","library_select","dataset_list","library_current","step","$slider","pressed","which","_isParameter","opts","has_slider","slider","ui","extension","genome","url_paste","file_name","file_mode","file_size","file_type","file_path","file_data","space_to_tab","to_posix_lines","clear","TagsEditor","HiddenUntilActivatedViewMixin","className","select_width","show_editor","usePrompt","workflow_mode","keydown","hiddenUntilActivated","$activator","_workflowTemplate","_defaultTemplate","$input","_getTagsUsed","_setUpBehaviors","_hashToName","startsWith","_nameToHash","_renderEditor","_renderTags","keydownHandler","hideEditor","showEditor","tagsToCSV","addButton","renderedArray","renderString","tagsArray","save","added","_addNewTagToTagsUsed","newTag","tagsUsed","contains","stopListening","FormBase","CitationModel","CitationView","_update","_destroy","process","_render","fixed_title","description","version","hide_operations","_operations","_footer","show_message","versions_button","narrow","sustain_version","versions","menu_button","biostar_url","prompt","origin","err_msg","requirements","requirements_visible","_templateRequirements","sharable_url","webhooks","webhook","activate","function","Function","_templateHelp","citations","$citations","citation_list_view","CitationListView","nreq","requirements_message","req","requirements_link","ToolFormBase","Webhooks","form","listen_to_history","buildmodel","build_url","build_data","_customize","error_message","redirect","large","Close","reject","postchange","current_state","tool_version","execute_btn","job_remap","job_def","validate","$f","enctype","_templateSuccess","jobs","WebhookView","toolId","refreshContents","input_found","err_data","_templateError","job_inputs","batch_n","batch_src","job_input_id","input_field","njobs","njobs_text","outputs","output","$nav","_add","_remove","_change","_reset","showTab","hideTab","tab_model","_template_tab","$href","last","has_deferred","promise","always","charAt","ready","isEmptyObject","QUERY_STRING","__identifer","navigate","queryObj","pop","access_denied","arg0","accumulator","tempStorage","parser","getErrors","STATES_","ENTRY_OR_JUNK","OBJECT_TYPE","ENTRY_KEY","KV_KEY","EQUALS","KV_VALUE","DATA_","CALLBACK_","CHAR_","LINE_","CHAR_IN_LINE_","SKIPWS_","SKIPCOMMENT_","PARSETMP_","SKIPTILLEOL_","VALBRACES_","BRACETYPE_","BRACECOUNT_","STATE_","ERRORS_","ENTRY_TYPES_","inproceedings","proceedings","article","techreport","misc","mastersthesis","book","phdthesis","incollection","unpublished","inbook","manual","periodical","booklet","masterthesis","conference","online","MACROS_","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","processCharacter_","error_","processEntry_","f","raw","CHARCONV_","re","rep","len","processed","skip","ObjectType","AnotherIteration","ot","Key","EntryKey","Value","\"","{","delim","doneParsingValue","macro","citationModel","formattedReference","ref","authorsAndYear","_asSentence","author","year","pages","address","volume","journal","booktitle","howpublished","note","institution","_formatBookInfo","doiUrl","doi","chapter","editor","publisher","series","issn","renderCitation","click .citations-to-bibtex","click .citations-to-formatted","citation","citationView","rawTextarea","citationsElement","showFormatted","showBibtex","partialWarningElement","LIST_ITEM","DATASET_LI","BASE_MVC","FoldoutListItemView","ListItemView","DCListItemView","hasUser","_setUpListeners","changed","_renderSubtitle","templates","subtitle","_getFoldoutPanelOptions","$selector","modelString","warnings","wrapTemplate","purged","deleted","titleBarTemplate","subtitleTemplate","titleBar","DCEListItemView","logger","DatasetDCEListItemView","DatasetListItemView","_fetchModelDetails","inReadyState","hasDetails","NestedDCDCEListItemView","_swapNewRender","$newRender","DATASET_MODEL","DatasetCollectionElementMixin","model_class","element_identifier","element_index","element_type","_mergeObject","object","element_id","constructor","idAttribute","arguments","DatasetCollectionElement","DCECollection","DatasetDCE","DatasetAssociation","mixin","warn","_downloadQueryParameters","elements","objStr","DatasetDCECollection","SearchableModelMixin","collection_type","collectionClass","_createElementsModel","unset","parent_hdca_id","populated","isDeletedOrPurged","getVisibleContents","create_time","Date","update_time","delete","undelete","searchAttributes","idAndName","ListDatasetCollection","PairDatasetCollection","NestedDCDCE","NestedDCDCECollection","NestedPairDCDCE","NestedPairDCDCECollection","ListPairedDatasetCollection","NestedListDCDCE","NestedListDCDCECollection","ListOfListsDatasetCollection","HDCA","baseCreator","UI_MODAL","naturalSort","createListCollection","defaultHideSourceItems","listCollectionCreatorModal","creationFn","hideSourceItems","createHDCA","DatasetCollectionElementView","toggle","toggleClass","discard","parentWidth","margin-right","destroy","click .name","click .discard","dragstart","dragend","dragover","drop","_click","_clickName","_clickDiscard","_dragstart","effectAllowed","setData","_dragend","_sendToParent","ListCollectionCreator","CollectionCreatorMixin","elementViewClass","HistoryListDatasetCollection","minElements","defaultAttributes","TypeError","oncreate","oncancel","autoscrollDist","highlightClr","footerSettings",".hide-originals","metric","creator","initialElements","_setUpCommonSettings","_instanceSetUp","_elementsSetUp","selectedIds","$dragging","blocking","invalidElements","workingElements","elementViews","_ensureElementIds","_validateElements","_mangleDuplicateNames","_sortElements","forEach","hasOwnProperty","uniqueId","problem","_isElementInvalid","validState","SAFETY","counter","existingNames","currName","Error","speed","_renderInvalid","main","_renderHeader","_renderMiddle","_renderFooter","_addPluginComponents","invalidInitial","problems","helpContent","_invalidElementsAlert","$middle","middle","_renderList","hoverhighlight","_showAlert","_disableNameAndCreate","isUndefined","_renderClearSelected","$tmp","removeElementView","elementView","_createElementView","invoke","_listenToElementView","addElementView","without","_renderNoElementsLeft","noElementsLeft","_elementToJSON","createList","hideOriginals","fail","xhr","done","_errorHandler","once","readyState","responseJSON","click .more-help","click .less-help","click .main-help","click .header .alert button","click .reset","click .clear-selected","click .collection-elements","dragover .collection-elements","drop .collection-elements","collection-element.dragstart .collection-elements","collection-element.dragend .collection-elements","change .collection-name","keydown .collection-name","change .hide-originals","click .cancel-create","click .create-collection","clearSelectedElements","_dragoverElements","_checkForAutoscroll","clientY","$nearest","_getNearestElement","$placeholder","$element","y","AUTOSCROLL_SPEED","upperDist","lowerDist","outerHeight","WIGGLE","lis","toArray","$li","halfHeight","floor","_dropElements","dropEffect","insertBefore","insertAfter","_syncOrderToDom","newElements","_elementDragstart","_elementDragend","_creatorTemplates","collectionCreatorModal","CreatorClass","closing_events","_collectionCreator","_super","changedAttributes","_renderNametags","fxSpeed","_renderPrimaryActions","_renderDisplayButton","displayBtnData","urls","addDataset","_renderDetails","noAccess","$details","_renderSecondaryActions","_renderSummary","_renderDetailMessages","_renderDisplayApplications","summaryRenderFn","summaries","unknown","$warnings","detailMessages","templateFn","displayApplications","_renderDownloadButton","_renderShowParamsButton","show_params","hasData","download","_renderMetaFileDownloadButton","meta_file","meta_download","tpl","click .display-btn","click .params-btn","click .download-btn","failed_metadata","detailsTemplate","noAccessTemplate","summaryTemplates","detailMessageTemplates","resubmitted","displayApplicationsTemplate","Form","submit_tooltip","submit_title","submit_icon","_submit","contentType","success_message","_showMessage","DC_MODEL","HISTORY_CONTENT","buildHDCASave","isNew","hcontentMixin","HistoryContentMixin","ListDC","PairDC","ListPairedDC","ListOfListsDC","HistoryPairDatasetCollection","HistoryListPairedDatasetCollection","HistoryListOfListsDatasetCollection","CONTROLLED_FETCH_COLLECTION","HDA_MODEL","HDCA_MODEL","HISTORY_PREFS","AJAX_QUEUE","PaginatedCollection","HistoryContents","attrs","HistoryDatasetAssociation","msg","validationError","limitPerPage","limitPerProgressiveFetch","historyId","models","setHistoryId","includeDeleted","includeHidden","newId","_setUpWebStorage","initialSettings","storage","HistoryPrefs","historyStorageKey","include-deleted","newVal","include-hidden","comparators","buildComparator","ascending","name-dsc","hid-asc","running","runningAndActive","getByHid","haveDetails","visibleAndUndeleted","setIncludeDeleted","setting","isBoolean","setIncludeHidden","prefs","expandedIds","_buildFetchData","_fetchParams","_buildFetchFilters","superFilters","getTotalItemCount","contentsShown","fetchUpdated","since","update_time-ge","toISOString","fetchDeleted","fetchHidden","fetchAllDetails","detailsFlag","fetchCollectionCounts","_filterAndUpdate","filterParams","updateWhat","updateArgs","fetched","modelArray","currJson","ajaxQueue","ajaxFn","AjaxQueue","reverse","isString","progressivelyFetchDetails","_recursivelyFetch","_options","detailKeys","limit","defer","notify","allFetched","limitPerCall","isCopyable","contentsJSON","copyableModelClasses","isObject","copy","LibraryDatasetDatasetAssociation","HistoryDatasetCollectionAssociation","elementIdentifiers","collectionType","hide_source_items","element_identifiers","haveSearchDetails","matches","matchesWhat","HISTORY_CONTENTS","UTILS","History","UPDATE_DELAY","contents_active","contents_states","contentsClass","searchAliases","historyJSON","_setUpCollectionListeners","updateTimeoutId","clearUpdateTimeout","change:id","makeArray","contentsActive","shown","nice_size","bytesToString","ownedByCurrUser","isAnonymous","numOfUnfinishedJobs","unfinishedJobIds","numOfUnfinishedShownContents","_fetchContentRelatedAttributes","contentRelatedAttrs","refresh","lastUpdateTime","fetchFn","currentPage","fetchPage","serverResponseDatetime","getResponseHeader","checkForUpdates","_delayThenUpdate","delay","nonReadyContentCount","historyData","fetchWithContents","contentsOptions","fetchContents","fetchCurrentPage","_delete","purge","allDatasets","postData","all_datasets","post","newHistory","setAsCurrent","_collectionSuper","InfinitelyScrollingCollection","HistoryCollection","limitOnFirstFetch","limitPerFetch","currentHistoryId","setUpListeners","change:deleted","copied","original","newData","setCurrent","set-as-current","oldCurrentId","fetchFirst","encoded_id-in","fetchMore","size-asc","currentHistory","unshift","hdas","historyOptions","xhrOptions","SessionStorageModel","show_deleted","show_hidden","addExpanded","removeExpanded","isExpanded","contentId","allExpanded","clearExpanded","storageKeyPrefix","clearAll","sessionStorage","ExpandableView","_buildNewRender","_queueNewRender","queue","next","$where","$newDetails","toggleExpanded","_expand","slideDown","slideUp","SelectableViewMixin","DraggableViewMixin","isSelectable","_renderWarnings","_renderTitleBar","showSelector","draggable","draggableOn","click .title-bar","keydown .title-bar","click .selector","_clickTitleBar","altKey","toggleSelect","_keyDownTitleBar","KEYCODE_SPACE","KEYCODE_RETURN","elTemplato","foldoutStyle","foldoutPanelClass","foldout","_createFoldoutPanel","_attachFoldout","FoldoutClass","_getFoldoutPanelClass","$whereTo","_expandByDrilldown","util","VisibilityMixin","is_visible","ToolParameter","num_samples","unescape","set_value","ToolParameterCollection","DataToolParameter","IntegerToolParameter","get_samples","d3","scale","linear","domain","ticks","FloatToolParameter","SelectToolParameter","subModelTypes","Tool","p_class","remove_inputs","tool","incompatible_inputs","only_samplable_inputs","valid_inputs","apply_search_results","set_input_value","set_input_values","inputs_dict","input_name","run","_run","rerun","target_dataset","regions","target_dataset_id","get_inputs_dict","input_dict","additional_params","run_deferred","ss_deferred","dataType","ToolCollection","ToolSectionLabel","ToolSection","elems","clear_search_results","cur_label","all_hidden","ToolSearch","search_hint_string","min_chars_for_search","clear_btn_url","clear_key","do_search","timer","ga","clear_search","tool_search","tools","layout","parse_elt","elt_dict","panel_elt","BaseView","update_visible","ToolLinkView","tool_link","formStyle","router","ToolSectionLabelView","ToolSectionView","update_open","panel_section","section_body","tool_view","label_view","click .toolSectionTitle > a","ToolSearchView","keyup :input","change :input","click #search-clear-btn","focus_and_select","query_changed","evData","ToolPanelView","handle_search_results","search_view","section_title_view","ToolFormView","tool_form","tool_panel_view","tool_form_view","show_tool","variable","class_add","class_remove","class_partial","onadd","onremove","ftp_files","_fill","_templateTable","$select_all","ftp_file","model_index","_find","_templateInfo","$it","filtered","path","ctime","ftp_upload_site","class_check","class_uncheck","$cover","$table","parameter","$checkbox","props","uploadpost","cnf","progress","maxfilesize","error_filesize","error_default","error_server","error_login","sizes","XMLHttpRequest","setRequestHeader","onreadystatechange","DONE","extra_info","responseText","statusText","lengthComputable","loaded","send","uploadinput","ondragover","ondragleave","dialog","uploadbox","queue_running","current_index","queue_index","mode","duplicate","announce","queue_length","queue_stop","stop","configure","compatible","File","FileList","dragleave","m","AnnotationEditor","$annotation","newAnnotation","annotation","previous","ControlledFetchCollection","setOrder","changed-order","_buildFetchOptions","_fetchFiltersToAjaxData","pick","filterMap","qv","update_time-asc","create_time-asc","comparator","shouldPaginate","getLastPage","getPageCount","getPageLimitOffset","pageNum","constrainPageNum","fetchPrevPage","fetchNextPage","lastFetched","fetchedData","numFetched","fetchAll","fetchData","_validationWarning","what","VALIDATION_CLASS","_changeHideOriginals","_changeName","_getName","_nameCheckForEnter","_clickCreate","_clickMoreHelp","_clickLessHelp","_toggleHelp","alertClass","_hideAlert","_cancelCreate","instance","$footer","property","LIST_VIEW","DC_LI","ModelListPanel","CollectionView","DatasetDCEViewClass","NestedDCDCEViewClass","modelCollectionKey","panelStack","parentName","downloadUrl","panel","_filterCollection","_getItemViewClass","_getItemViewOptions","_setUpItemViewListeners","expanded:drilldown","drilldown","_expandDrilldownPanel","collapsed:drilldown","_collapseDrilldownPanel","click .navigation .back","close","controlsTemplate","controls","ListCollectionView","PairCollectionView","ListOfPairsCollectionView","ListOfListsCollectionView","TAGS","ANNOTATIONS","DatasetListItemEdit","purgeAllowed","tagsEditorShown","annotationEditorShown","actions","_renderEditButton","_renderDeleteButton","editBtnData","deletedAlready","_renderAnnotation","_makeDbkeyEditLink","_renderToolHelpButton","datasetID","jobID","creating_job","parseToolBuild","helpString","parseHTML","parseToolID","_renderErrButton","_renderRerunButton","_renderVisualizationsButton","visualizations","$visualizations","_addScratchBookFn","addBack","$links","tagsEditor","onshowFirstTime","onshow","onhide","annotationEditor","editableDbkey","edit","click .undelete-link","click .purge-link","click .edit-btn","click .delete-btn","click .rerun-btn","click .report-err-btn","click .visualization-btn","click .dbkey a","_clickUndeleteLink","_clickPurgeLink","visualizationsTemplate","searchableMixin","accessible","data_type","meta_files","misc_blurb","misc_info","_generateUrls","report_error","visualization","currModel","newState","dataset","responseObj","messageBuriedInUnfortunatelyFormattedError","format","database","blurb","nameAndId","DatasetAssociationCollection","ids","notReady","startingLength","responses","ajaxFns","chain","curr","shift","MODAL","ERROR_MODAL","CopyDialog","defaultName","submitLabel","errorMessage","progressive","activeLabel","allLabel","anonWarning","_showAjaxIndicator","indicator","margin-top","checkNameAndCopy","copyAllDatasets","ajaxErrorModal","rejectWith","autoClose","defaultCopyNameFn","nameFn","defaultCopyName","defaultCopyWhat","allowAll","originalClosingCallback","closing_callback","isAnon","copyWhat","cancelled","ImportDialog","historyCopyDialog","useImport","HDAListItemView","DATASET","DC_VIEW","HDCAListItemView","change:tags change:populated change:visible","isVisible","unhide","LoadingIndicator","ListPanel","viewClass","emptyMsg","noneFoundMsg","searchPlaceholder","searchFor","selecting","lastSelected","dragItems","views","_createDefaultCollection","$scrollContainer","loading","_showLoadingIndicator","loading-done","_hideLoadingIndicator","_setUpViewListeners","changes","renderAll","removed","renderItems","addItemView","removeItemView","view:selected","shiftKey","lastSelectedView","viewFromModelId","selectRange","showSelectors","view:de-selected","_renderControls","_renderTitle","_renderSearch","$controls","_renderMultiselectActionMenu","multiselectActions","$newMenu","$actions","$messages","$emptyMessage","freeViews","shownModels","itemModel","_createItemView","_attachItems","_renderEmptyMessage","_filterItem","every","matchesAll","ViewClass","_destroyItemView","_destroyItemViews","getSelectedModels","_renderItemView$el","expandAll","collapseAll","modelIndex","_attachView","useFx","_insertIntoListAt","$what","viewFromModel","viewsWhereModel","properties","isMatch","viewRange","viewA","viewB","indexA","indexB","searchInput","initialVal","onfirstsearch","_firstSearch","onsearch","searchItems","onclear","clearSearch","force","$search","THROTTLE_SELECTOR_FX_AT","hideSelectors","hideSelector","toggleSelectors","selectAll","deselectAll","deselect","getSelectedViews","scrollPosition","scrollTo","scrollToTop","scrollToItem","scrollToId","click .select-all","click .deselect-all","elTemplate","setModel","freeModel","oldModelId","_setUpModelListeners","WorkflowIcons","$steps","_configure","resize","step_index","margin","_handleWorkflowParameter","exec","wp_name","wp_inputs","wp_count","links","forms","steps","parms","step_type","step_label","step_name","step_version","_isDataStep","sustain_repeats","sustain_conditionals","messages","needs_refresh","output_connections","output_connection","sub_step","input_step_index","connections_by_name","connection","step_linked","output_name","wp_input","wp_linked","post_job_actions","pja","action_arguments","arg","data_resolved","is_runtime_value","__class__","is_data_input","data_ref","default_value","_renderMessage","_renderParameters","_renderHistory","_renderStep","_execute","step_version_changes","wp_form","_refreshStep","history_form","short_str","is_simple_input","show_progress","source_step","wp_field","wp_value","_refreshHistory","_refresh_history","_enabled","history_form_data","new_history_name","replacement_params","parameters_normalized","validated","toolVersion","step_related_errors","_errorModal","Ok","DETAILS_MSG","errorModal","offlineErrorModal","badGatewayErrorModal","CONTACT_MSG","DEFAULT_AJAX_ERR_MSG","_ajaxDetails","raven","Raven","userAgent","navigator","onLine","omit","functions","lastAjax","scope","$this","targetSelector","mouseover","background","mouseout","parentNode","clearSearchInput","searchTerms","firstSearch","inputTemplate","KEYCODE_ESC","escWillClear","minSearchLen","$clearBtn","$loadingIndicator","toggleLoadingIndicator","$parentNode","inputVal","oninit","s","nC","fromCharCode","xN","yN","xD","getTime","yD","oFxNcL","oFyNcL","cLoc","numS","historyOptionsMenu","CurrentHistoryView","userIsAnonymous","allow_user_dataset_purge","listenToGalaxy","buttonRefresh","buttonOptions","buttonViewMulti","connectToQuotaMeter","quotaMeter","optionsMenu","anonymous","Tools","stored_workflow_menu_entries","toolbox","tool_panel","toolbox_in_panel","upload_button","nginx_upload_path","default_genome","default_extension","_templateAllWorkflow","menu_entry","_templateWorkflowLink","stored_workflow","encoded_stored_workflow_id","_templateTool","wf","define","optionsOverride","toastType","iconClass","getOptions","iconClasses","subscribe","listener","warning","$toastElement","getContainer","hideMethod","duration","hideDuration","easing","hideEasing","removeToast","getDefaults","tapToDismiss","toastClass","containerId","showMethod","showDuration","showEasing","onShown","onHidden","extendedTimeOut","positionClass","timeOut","titleClass","messageClass","closeHtml","newestOnTop","publish","hideToast","override","endTime","delayedhideToast","intervalId","stickAround","toastId","$titleElement","$messageElement","$closeElement","startTime","closeButton","hover","toastr","DATASET_LI_EDIT","DCListItemEdit","DCEListItemEdit","DatasetDCEListItemEdit","NestedDCDCEListItemEdit","DC_EDIT","CollectionViewEdit","nameSelector","newName","previousName","ListCollectionViewEdit","PairCollectionViewEdit","NestedPairCollectionViewEdit","ListOfPairsCollectionViewEdit","ListOfListsCollectionViewEdit","levenshteinDistance","autoPairFnBuilder","getRegExps","_regexps","RegExp","createPair","listA","listB","aInBIndex","bInAIndex","_pair","preprocessMatch","regexps","matchTo","possible","bestMatch","score","paired","scoreThreshold","createListOfPairsCollection","pairedCollectionCreatorModal","PairView","currentTarget","opacity","PairedCollectionCreator","DEFAULT_FILTERS","automaticallyPair","strategy","matchPercentage","twoPassAutopairing","initialList","commonFilters","strategies","DEFAULT_STRATEGY","removeExtensions","unpairedPanelHidden","pairedPanelHidden","_dataSetUp","illumina","Rs","simple","lcs","levenshtein","unpaired","_sortInitialList","_ensureIds","autoPair","_sortDatasetList","_splitByFilters","_filter","regexFilters","stringFilter","_addToUnpaired","binSearchSortedIndex","low","hi","mid","compared","autopairSimple","autopairLevenshtein","distance","autopairLCS","_naiveStartingAndEndingLCS","s1","s2","fwdLCS","revLCS","fwd","rev","_createPair","_guessNameForPair","forward","fwdName","revName","lastDotIndex","lastIndexOf","_unpair","unpairAll","_pairToJSON","ajaxData","_ajaxErrHandler","_renderFilters","_renderUnpaired","_renderPaired","$fwd","$rev","$prd","_renderUnpairedDisplayStr","_renderUnpairedEmpty","_renderPairButton","_renderUnpairedDataset","_adjUnpairedOnScrollbar","_renderUnpairedNotShown","numFiltered","$msg","$unpairedColumns","$firstDataset","ucRight","outerWidth","dsRight","rightDiff","_renderPairedEmpty","pairView",".remove-extensions","_chooseFiltersPopover","filterChoice","val1","val2","$popoverContent","filterSet","popover","splitView","msgClass","hideUnpaired","click .forward-column .column-title","click .reverse-column .column-title","click .unpair-all-link","change .forward-unpaired-filter input","focus .forward-unpaired-filter input","click .autopair-link","click .choose-filters .filter-choice","click .clear-filters-link","change .reverse-unpaired-filter input","focus .reverse-unpaired-filter input","click .forward-column .dataset.unpaired","click .reverse-column .dataset.unpaired","click .paired-column .dataset.unpaired","click .unpaired-columns","mousedown .unpaired-columns .dataset","click .paired-column-title","mousedown .flexible-partition-drag","click .paired-columns .dataset.paired","click .paired-columns","click .paired-columns .pair-name","click .unpair-btn","dragover .paired-columns .column-datasets","drop .paired-columns .column-datasets","pair.dragstart .paired-columns .column-datasets","pair.dragend .paired-columns .column-datasets","change .remove-extensions","toggleExtensions","_clickShowOnlyUnpaired","hidePaired","_clickShowOnlyPaired","_clickUnpairAll","_clickAutopair","_clickFilterChoice","$selected","_hideChooseFilters","_clearFilters","_clickUnpairedDataset","toggleSelectUnpaired","$dataset","waitToPair","pairAllSelected","fwds","revs","clearSelectedUnpaired","_mousedownUnpaired","$startTarget","moveListener","_clickPairRow","rowIndex","_startPartitionDrag","endDrag","unbind","trackMouse","startingY","adjPartition","mousemove","adj","$unpaired","$paired","unpairedHi","pairedHi","movingUpwards","flex","selectPair","clearSelectedPaired","_clickPairName","$name","$pair","customizedName","_clickUnpair","pairIndex","_dragoverPairedColumns","_getNearestPairedDatasetLi","_dropPairedColumns","_syncPairsToDom","newPaired","_pairDragstart","_pairDragend","_printList","_printPair","LIST_CREATOR","createPairCollection","pairCollectionCreatorModal","PairedDatasetCollectionElementView","PairCollectionCreator","_createForwardElementView","_createReverseElementView","swap","click .swap","Tabs","render_attribute_page","error_response","display_message","_templateHeader","create_tabs","call_ajax","tab_name","post_url","reload_history","$el_edit_attr","tabs","_getAttributesFormTemplate","_getConvertFormTemplate","_getChangeDataTypeFormTemplate","_getPermissionsFormTemplate","edit_attributes_inputs","submit_editattr","submit_autocorrect","convert_inputs","convert_datatype_inputs","can_manage_dataset","display_name","permission_inputs","form_data","detect","target_type","convert_data","post_data","permissions","update_roles_button","data_url","job_url","job","render_error_page","stderr","_getBugFormTemplate","doNotClear","safe","floating","_templateShared","shared_by_others","it","display_url","username","slug","HDA_LI","HDAListItemEdit","click .unhide-link","HDCA_LI","DC_VIEW_EDIT","HDCAListItemEdit","HistoryModel","_showCopyDialog","reload","HISTORY_MODEL","HISTORY_VIEW_EDIT","HistoryViewPrefs","storageKey","HistoryViewEdit","HDCAViewClass","preferences","currentContentId","loadHistory","switchToHistory","createNewHistory","change:nice_size change:size","oldState","_debouncedScrollCaptureHandler","debounce","prependTo","_renderQuotaMessage","quotaMsg","_setCurrentContentById","setCurrentContent","delegateEvents","click .uploader-link","click .get-data-link","$toolMenu","galaxy","center-frame:load","pathToMatch","fullpath","hdaId","useToURLRegexMap","regex","use","center-panel:load","showQuotaMessage","hideQuotaMessage","isOverQuota","clearMessages","$target","not","unhideHidden","deleteHidden","quotaMsgTemplate","HISTORY_VIEW","HDA_LI_EDIT","HDCA_LI_EDIT","LIST_COLLECTION_CREATOR","PAIR_COLLECTION_CREATOR","LIST_OF_PAIRS_COLLECTION_CREATOR","HistoryView","HDAViewClass","droptarget:drop","dataDropped","dropTargetOff","view:attached view:removed","_renderCounts","search:loading-progress","_renderSearchProgress","search:searching","_renderSearchFindings","updateHistoryDiskSize","_handleItemDeletedChange","change:visible","_handleItemVisibleChange","change:purged","fetching-deleted","fetching-hidden","fetching-deleted-done fetching-hidden-done","counts","toggleHDATagEditors","toggleHDAAnnotationEditors","_collectionActions","buildCollection","selection","createFunc","_handleItemDeletion","_handleItemUndeletion","_handleItemHidden","_handleItemUnhidden","showOrHide","click .show-selectors-btn","click .toggle-deleted-link","toggleShowDeleted","click .toggle-hidden-link","toggleShowHidden","dropTargetOn","dropTarget","dropHandlers","dragenter","$dropTarget","_renderDropTarget","_renderDropTargetHelp","evName","_dropHandlers","dropTargetToggle","countsTemplate","foundTemplate","USER","FETCH_COLLECTION_COUNTS_DELAY","errorHandler","views:ready view:attached view:removed","_renderSelectButton","view:attached","fetching-more","_toggleContentsLoadingIndicator","fetching-more-done","$indicator","$existing","$emptyMsg","_renderPagination","_renderSomeItems","$paginationControls","pagination","click > .controls .prev","click > .controls .next","change > .controls .pages","click .messages [class$=message]","_clickPrevPage","_clickNextPage","_changePageSelect","store","inputSelector","scrollToHid","ordinalIndicator","numStr","mainTemplate","paginationTemplate","buildMenu","menuOption","anon","galaxy_main","user_action","webhooks_menu","UploadModel","UploadSettings","Popover","status_classes","init","queued","$mode","$size","$info_text","$info_progress","$text_content","$symbol","$percentage","select_genome","select_extension","_removeRow","_refreshPercentage","_refreshStatus","_refreshInfo","_refreshFileSize","_showSettings","UploadRow","UploadFtp","upload_size","list_extensions","list_genomes","ui_button","currentFtp","btnLocal","btnFtp","_eventFtp","btnCreate","_eventCreate","btnStart","_eventStart","btnBuild","_eventBuild","btnStop","_eventStop","btnReset","_eventReset","btnClose","_eventAnnounce","toData","_eventProgress","_eventSuccess","_eventError","_eventComplete","ftp","ext","composite_files","updateExtension","select_collection","updateCollectionType","showExtensionInfo","updateGenome","_eventRemove","_updateScreen","upload_row","_uploadPercentage","hids","pluck","upload_completed","allHids","extension_popup","_templateDescription","defaults_only","enable_reset","enable_start","enable_build","enable_sources","show_table","description_url","$source","$settings","$status","$file_name","$file_desc","$file_size","_refreshReady","button_menu","_showFtp","_refreshFileName","_refreshMode","offsetHeight","file_desc","_showExtensionInfo","_refreshGenome","_refreshExtension","UploadButton","UploadViewDefault","UploadViewComposite","UploadViewCollection","auto","datatypes","a_text","b_text","datatypes_disable_auto","genomes","current_user","default_view","composite_view","collection_view","title_separator","installed_builds","table","$installed","$form","$help","_renderTable","initial_type","_renderHelp","len_type","_templateFasta","_templateLen","QueryStringParsing","information","communication","api_key","toolbox_filters","openids","custom_builds","logout","Cancel","Sign out","session_csrf_token","$preferences","email","use_remote_user","_addLink","enable_communication_server","has_user_tool_filters","enable_openid","_templateFooter","$row","_templateLink","$a","nice_total_disk_usage","enable_quotas","quota","data_input","data_collection_input","subworkflow","pause","WorkflowItem","workflow","WorkflowCollection","mod_toastr","WORKFLOWS","WorkflowItemView","bindAll","click #show-in-tool-panel","click #delete-workflow","click #rename-workflow","click #copy-workflow","_rowTemplate","showInToolPanel","removeWorkflow","wfName","renameWorkflow","oldName","copyWorkflow","wfJson","currentOwner","at","resp","errorThrown","jqXHR","textStatus","wfId","checkboxHtml","trHtml","_templateActions","renderTagEditor","TagEditor","owner","WorkflowListView","appendItem","unhighlightDropZone","readWorkflowFiles","theFile","wf_json","templateActions","_templateActionButtons","tableTemplate","_templateWorkflowTable","confirmDelete","minQueryLength","searchWorkflow","adjustActiondropdown","workflowItemView","$el_shared_wf_link","$el_searchinput","$el_tabletr","min_querylen","regular_expression","_templateNoWorkflow","tableHtml","_mainTemplate","myexperiment_target_url","cover","z-index","right","background-color","text-align","font-style","initialFunctions","numToProcess","NamedAjaxQueue","names","fnIndex","causeFail","obj","matrix"],"mappings":"AAAAA,cAAc,EAAE,IAEV,SAAUC,EAAQC,EAASC,ICFjC,SAAAC,GAAA,GAAIC,GAASF,EAAS,GAClBG,EAAID,EACJE,EAAYJ,EAAS,IAAWI,UAChCC,EAASL,EAAS,IAClBM,EAAYN,EAAS,KACrBO,EAAeP,EAAS,KACxBQ,EAAOR,EAAS,IAChBS,EAAWT,EAAS,IACpBU,EAAcV,EAAS,IACvBW,EAAkBX,EAAS,KAC3BY,EAAeZ,EAAS,KACxBa,EAAQb,EAAS,IACjBc,EAAWd,EAAS,IACpBe,EAAaf,EAAS,KACtB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Aa,MACb,YAAa,MACb,aAAc,MACd,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,MACd,YAAa,MACb,SAAU,MACV,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,MACd,YAAa,MACb,YAAa,MACb,gBAAiB,MACjB,QAAS,MACT,YAAa,MACb,YAAa,MACb,aAAc,MACd,YAAa,MACb,YAAa,MACb,SAAU,MACV,SAAU,MACV,YAAa,MACb,YAAa,MACb,aAAc,MACd,YAAa,MACb,YAAa,MACb,SAAU,MACV,SAAU,MACV,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,MACd,YAAa,MACb,cAAe,MACf,cAAe,MACf,eAAgB,MAChB,cAAe,MACf,SAAU,MACV,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,MACd,YAAa,MACb,YAAa,MACb,UAAW,MACX,QAAS,MACT,YAAa,MACb,YAAa,MACb,aAAc,MACd,YAAa,MACb,YAAa,MACb,SAAU,MACV,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,MACd,aAAc,MACd,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,SAAU,MACV,SAAU,MACV,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,MACd,aAAc,MACd,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,MACd,aAAc,MACd,YAAa,MACb,YAAa,MACb,cAAe,MACf,YAAa,MACb,cAAe,MACf,YAAa,MACb,cAAe,MACf,YAAa,MACb,YAAa,MACb,YAAa,MACb,QAAS,MACT,aAAc,MACd,eAAgB,MAChB,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,QAAS,MACT,QAAS,MACT,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,SAAU,MACV,SAAU,MACV,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,SAAU,MACV,SAAU,MACV,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,MACd,aAAc,MACd,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,MACd,aAAc,MACd,aAAc,MACd,aAAc,MACd,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,YAAa,MACb,gBAAiB,MACjB,gBAAiB,MACjB,UAAW,MACX,qBAAsB,MACtB,YAAa,MACb,cAAe,MACf,eAAgB,MAChB,eAAgB,MAChB,cAAe,MACf,eAAgB,MAChB,iBAAkB,MAClB,gBAAiB,MACjB,eAAgB,MAChB,cAAe,MACf,cAAe,MACf,cAAe,MACf,cAAe,MACf,gBAAiB,MACjB,eAAgB,MAChB,cAAe,MACf,cAAe,MACf,gBAAiB,MACjB,cAAe,MACf,cAAe,MACf,eAAgB,MAChB,gBAAiB,MACjB,YAAa,MACb,cAAe,MACf,aAAc,MACd,cAAe,MACf,aAAc,MACd,cAAe,MACf,cAAe,MACf,gBAAiB,MACjB,eAAgB,MAChB,cAAe,MACf,cAAe,MACf,cAAe,MACf,cAAe,MACf,cAAe,MACf,cAAe,MACf,gBAAiB,MACjB,gBAAiB,MACjB,gBAAiB,MACjB,eAAgB,MAChB,cAAe,MACf,qBAAsB,MACtB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,MAAApN,EAAA4H,KAAA0C,SAAAzC,IAAA9H,EAAAC,QAAA6H,K5GmiyBS,CACA,CACA,CACA,CACA,CACA,CACA,CACA,CAEH,SAAU9H,EAAQC,G6G5iyBxBD,EAAAC,QAAA,WAA6B,SAAAijD,OAAA","file":"analysis.bundled.js","sourcesContent":["webpackJsonp([3,1],[\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(_) {var jQuery = __webpack_require__(1),\n\t $ = jQuery,\n\t GalaxyApp = __webpack_require__(52).GalaxyApp,\n\t Router = __webpack_require__(55),\n\t ToolPanel = __webpack_require__(104),\n\t HistoryPanel = __webpack_require__(103),\n\t Page = __webpack_require__(53),\n\t ToolForm = __webpack_require__(47),\n\t FormWrapper = __webpack_require__(62),\n\t UserPreferences = __webpack_require__(145),\n\t CustomBuilds = __webpack_require__(144),\n\t Tours = __webpack_require__(93),\n\t GridView = __webpack_require__(12),\n\t GridShared = __webpack_require__(128),\n\t Workflows = __webpack_require__(149),\n\t HistoryList = __webpack_require__(131),\n\t ToolFormComposite = __webpack_require__(92),\n\t Utils = __webpack_require__(4),\n\t Ui = __webpack_require__(5),\n\t DatasetError = __webpack_require__(127),\n\t DatasetEditAttributes = __webpack_require__(126);\n\t\n\t/** define the 'Analyze Data'/analysis/main/home page for Galaxy\n\t * * has a masthead\n\t * * a left tool menu to allow the user to load tools in the center panel\n\t * * a right history menu that shows the user's current data\n\t * * a center panel\n\t * Both panels (generally) persist while the center panel shows any\n\t * UI needed for the current step of an analysis, like:\n\t * * tool forms to set tool parameters,\n\t * * tables showing the contents of datasets\n\t * * etc.\n\t */\n\twindow.app = function app(options, bootstrapped) {\n\t window.Galaxy = new GalaxyApp(options, bootstrapped);\n\t Galaxy.debug('analysis app');\n\t\n\t /** Routes */\n\t var AnalysisRouter = Router.extend({\n\t routes: {\n\t '(/)': 'home',\n\t '(/)root*': 'home',\n\t '(/)tours(/)(:tour_id)': 'show_tours',\n\t '(/)user(/)': 'show_user',\n\t '(/)user(/)(:form_id)': 'show_user_form',\n\t '(/)workflow(/)': 'show_workflows',\n\t '(/)workflow/run(/)': 'show_run',\n\t '(/)pages(/)(:action_id)': 'show_pages',\n\t '(/)visualizations/(:action_id)': 'show_visualizations',\n\t '(/)workflows/list_published(/)': 'show_workflows_published',\n\t '(/)histories(/)(:action_id)': 'show_histories',\n\t '(/)datasets(/)list(/)': 'show_datasets',\n\t '(/)workflow/import_workflow': 'show_import_workflow',\n\t '(/)custom_builds': 'show_custom_builds',\n\t '(/)datasets/edit': 'show_dataset_edit_attributes',\n\t '(/)datasets/error': 'show_dataset_error'\n\t },\n\t\n\t require_login: ['show_user', 'show_user_form', 'show_workflows'],\n\t\n\t authenticate: function (args, name) {\n\t return Galaxy.user && Galaxy.user.id || this.require_login.indexOf(name) == -1;\n\t },\n\t\n\t show_tours: function (tour_id) {\n\t if (tour_id) {\n\t Tours.giveTour(tour_id);\n\t } else {\n\t this.page.display(new Tours.ToursView());\n\t }\n\t },\n\t\n\t show_user: function () {\n\t this.page.display(new UserPreferences.View());\n\t },\n\t\n\t show_user_form: function (form_id) {\n\t var model = new UserPreferences.Model({ user_id: Galaxy.params.id });\n\t this.page.display(new FormWrapper.View(model.get(form_id)));\n\t },\n\t\n\t show_visualizations: function (action_id) {\n\t this.page.display(new GridShared.View({ action_id: action_id, plural: 'Visualizations', item: 'visualization' }));\n\t },\n\t\n\t show_workflows_published: function () {\n\t this.page.display(new GridView({ url_base: Galaxy.root + 'workflow/list_published', dict_format: true }));\n\t },\n\t\n\t show_histories: function (action_id) {\n\t this.page.display(new HistoryList.View({ action_id: action_id }));\n\t },\n\t\n\t show_datasets: function () {\n\t this.page.display(new GridView({ url_base: Galaxy.root + 'dataset/list', dict_format: true }));\n\t },\n\t\n\t show_pages: function (action_id) {\n\t this.page.display(new GridShared.View({ action_id: action_id, plural: 'Pages', item: 'page' }));\n\t },\n\t\n\t show_workflows: function () {\n\t this.page.display(new Workflows.View());\n\t },\n\t\n\t show_run: function () {\n\t this._loadWorkflow();\n\t },\n\t\n\t show_import_workflow: function () {\n\t this.page.display(new Workflows.ImportWorkflowView());\n\t },\n\t\n\t show_custom_builds: function () {\n\t var self = this;\n\t var historyPanel = this.page.historyPanel.historyView;\n\t if (!historyPanel || !historyPanel.model || !historyPanel.model.id) {\n\t window.setTimeout(function () {\n\t self.show_custom_builds();\n\t }, 500);\n\t return;\n\t }\n\t this.page.display(new CustomBuilds.View());\n\t },\n\t\n\t show_dataset_edit_attributes: function () {\n\t this.page.display(new DatasetEditAttributes.View());\n\t },\n\t\n\t show_dataset_error: function () {\n\t this.page.display(new DatasetError.View());\n\t },\n\t\n\t /** */\n\t home: function (params) {\n\t // TODO: to router, remove Globals\n\t // load a tool by id (tool_id) or rerun a previous tool execution (job_id)\n\t if (params.tool_id || params.job_id) {\n\t if (params.tool_id === 'upload1') {\n\t this.page.toolPanel.upload.show();\n\t this._loadCenterIframe('welcome');\n\t } else {\n\t this._loadToolForm(params);\n\t }\n\t } else {\n\t // show the workflow run form\n\t if (params.workflow_id) {\n\t this._loadWorkflow();\n\t // load the center iframe with controller.action: galaxy.org/?m_c=history&m_a=list -> history/list\n\t } else if (params.m_c) {\n\t this._loadCenterIframe(params.m_c + '/' + params.m_a);\n\t // show the workflow run form\n\t } else {\n\t this._loadCenterIframe('welcome');\n\t }\n\t }\n\t },\n\t\n\t /** load the center panel with a tool form described by the given params obj */\n\t _loadToolForm: function (params) {\n\t //TODO: load tool form code async\n\t params.id = decodeURIComponent(params.tool_id);\n\t this.page.display(new ToolForm.View(params));\n\t },\n\t\n\t /** load the center panel iframe using the given url */\n\t _loadCenterIframe: function (url, root) {\n\t root = root || Galaxy.root;\n\t url = root + url;\n\t this.page.$('#galaxy_main').prop('src', url);\n\t },\n\t\n\t /** load workflow by its url in run mode */\n\t _loadWorkflow: function () {\n\t var self = this;\n\t Utils.get({\n\t url: Galaxy.root + 'api/workflows/' + Utils.getQueryString('id') + '/download',\n\t data: { 'style': 'run' },\n\t success: function (response) {\n\t self.page.display(new ToolFormComposite.View(response));\n\t },\n\t error: function (response) {\n\t var error_msg = \"Error occurred while loading the resource.\",\n\t options = { 'message': error_msg, 'status': 'error', 'persistent': true, 'cls': 'errormessage' };\n\t self.page.display(new Ui.Message(options));\n\t }\n\t });\n\t }\n\t });\n\t\n\t // render and start the router\n\t $(function () {\n\t Galaxy.page = new Page.View(_.extend(options, {\n\t Left: ToolPanel,\n\t Right: HistoryPanel,\n\t Router: AnalysisRouter\n\t }));\n\t });\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ }),\n/* 1 */,\n/* 2 */,\n/* 3 */,\n/* 4 */,\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/**\n\t * This class contains backbone wrappers for basic ui elements such as Images, Labels, Buttons, Input fields etc.\n\t */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(15), __webpack_require__(42), __webpack_require__(14), __webpack_require__(37), __webpack_require__(11), __webpack_require__(8)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Select, Slider, Options, Drilldown, Buttons, Modal) {\n\t\n\t /** Label wrapper */\n\t var Label = Backbone.View.extend({\n\t tagName: 'label',\n\t initialize: function (options) {\n\t this.model = options && options.model || new Backbone.Model(options);\n\t this.tagName = options.tagName || this.tagName;\n\t this.setElement($('<' + this.tagName + '/>'));\n\t this.listenTo(this.model, 'change', this.render, this);\n\t this.render();\n\t },\n\t title: function (new_title) {\n\t this.model.set('title', new_title);\n\t },\n\t value: function () {\n\t return this.model.get('title');\n\t },\n\t render: function () {\n\t this.$el.removeClass().addClass('ui-label').addClass(this.model.get('cls')).html(this.model.get('title'));\n\t return this;\n\t }\n\t });\n\t\n\t /** Displays messages used e.g. in the tool form */\n\t var Message = Backbone.View.extend({\n\t initialize: function (options) {\n\t this.model = options && options.model || new Backbone.Model({\n\t message: null,\n\t status: 'info',\n\t cls: '',\n\t persistent: false,\n\t fade: true\n\t }).set(options);\n\t this.listenTo(this.model, 'change', this.render, this);\n\t this.render();\n\t },\n\t update: function (options) {\n\t this.model.set(options);\n\t },\n\t render: function () {\n\t this.$el.removeClass().addClass('ui-message').addClass(this.model.get('cls'));\n\t var status = this.model.get('status');\n\t if (this.model.get('large')) {\n\t this.$el.addClass((status == 'success' && 'done' || status == 'danger' && 'error' || status) + 'messagelarge');\n\t } else {\n\t this.$el.addClass('alert').addClass('alert-' + status);\n\t }\n\t if (this.model.get('message')) {\n\t this.$el.html(this.messageForDisplay());\n\t this.$el[this.model.get('fade') ? 'fadeIn' : 'show']();\n\t this.timeout && window.clearTimeout(this.timeout);\n\t if (!this.model.get('persistent')) {\n\t var self = this;\n\t this.timeout = window.setTimeout(function () {\n\t self.model.set('message', '');\n\t }, 3000);\n\t }\n\t } else {\n\t this.$el.fadeOut();\n\t }\n\t return this;\n\t },\n\t messageForDisplay: function () {\n\t return _.escape(this.model.get('message'));\n\t }\n\t });\n\t\n\t var UnescapedMessage = Message.extend({\n\t messageForDisplay: function () {\n\t return this.model.get('message');\n\t }\n\t });\n\t\n\t /** Renders an input element used e.g. in the tool form */\n\t var Input = Backbone.View.extend({\n\t initialize: function (options) {\n\t this.model = options && options.model || new Backbone.Model({\n\t type: 'text',\n\t placeholder: '',\n\t disabled: false,\n\t readonly: false,\n\t visible: true,\n\t cls: '',\n\t area: false,\n\t color: null,\n\t style: null\n\t }).set(options);\n\t this.tagName = this.model.get('area') ? 'textarea' : 'input';\n\t this.setElement($('<' + this.tagName + '/>'));\n\t this.listenTo(this.model, 'change', this.render, this);\n\t this.render();\n\t },\n\t events: {\n\t 'input': '_onchange'\n\t },\n\t value: function (new_val) {\n\t new_val !== undefined && this.model.set('value', typeof new_val === 'string' ? new_val : '');\n\t return this.model.get('value');\n\t },\n\t render: function () {\n\t var self = this;\n\t this.$el.removeClass().addClass('ui-' + this.tagName).addClass(this.model.get('cls')).addClass(this.model.get('style')).attr('id', this.model.id).attr('type', this.model.get('type')).attr('placeholder', this.model.get('placeholder')).css('color', this.model.get('color') || '').css('border-color', this.model.get('color') || '');\n\t var datalist = this.model.get('datalist');\n\t if ($.isArray(datalist) && datalist.length > 0) {\n\t this.$el.autocomplete({ source: function (request, response) {\n\t response(self.model.get('datalist'));\n\t },\n\t change: function () {\n\t self._onchange();\n\t } });\n\t }\n\t if (this.model.get('value') !== this.$el.val()) {\n\t this.$el.val(this.model.get('value'));\n\t }\n\t _.each(['readonly', 'disabled'], function (attr_name) {\n\t self.model.get(attr_name) ? self.$el.attr(attr_name, true) : self.$el.removeAttr(attr_name);\n\t });\n\t this.$el[this.model.get('visible') ? 'show' : 'hide']();\n\t return this;\n\t },\n\t _onchange: function () {\n\t this.value(this.$el.val());\n\t this.model.get('onchange') && this.model.get('onchange')(this.model.get('value'));\n\t }\n\t });\n\t\n\t /** Creates a hidden element input field used e.g. in the tool form */\n\t var Hidden = Backbone.View.extend({\n\t initialize: function (options) {\n\t this.model = options && options.model || new Backbone.Model(options);\n\t this.setElement($('
').append(this.$info = $('
')).append(this.$hidden = $('
')));\n\t this.listenTo(this.model, 'change', this.render, this);\n\t this.render();\n\t },\n\t value: function (new_val) {\n\t new_val !== undefined && this.model.set('value', new_val);\n\t return this.model.get('value');\n\t },\n\t render: function () {\n\t this.$el.attr('id', this.model.id);\n\t this.$hidden.val(this.model.get('value'));\n\t this.model.get('info') ? this.$info.show().text(this.model.get('info')) : this.$info.hide();\n\t return this;\n\t }\n\t });\n\t\n\t /** Creates a upload element input field */\n\t var Upload = Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.model = options && options.model || new Backbone.Model(options);\n\t this.setElement($('
').append(this.$info = $('
')).append(this.$file = $('').attr('type', 'file').addClass('ui-margin-bottom')).append(this.$text = $('', '
', '
'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t CitationView: CitationView,\n\t CitationListView: CitationListView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ }),\n/* 58 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(67), __webpack_require__(61), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_ITEM, DATASET_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t //==============================================================================\n\t\n\t var FoldoutListItemView = LIST_ITEM.FoldoutListItemView,\n\t ListItemView = LIST_ITEM.ListItemView;\n\t /** @class Read only view for DatasetCollection.\n\t */\n\t var DCListItemView = FoldoutListItemView.extend(\n\t /** @lends DCListItemView.prototype */{\n\t\n\t className: FoldoutListItemView.prototype.className + \" dataset-collection\",\n\t id: function () {\n\t return ['dataset_collection', this.model.get('id')].join('-');\n\t },\n\t\n\t /** override to add linkTarget */\n\t initialize: function (attributes) {\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t this.hasUser = attributes.hasUser;\n\t FoldoutListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t FoldoutListItemView.prototype._setUpListeners.call(this);\n\t this.listenTo(this.model, 'change', function (model, options) {\n\t // if the model has changed deletion status render it entirely\n\t if (_.has(model.changed, 'deleted')) {\n\t this.render();\n\t\n\t // if the model has been decorated after the fact with the element count,\n\t // render the subtitle where the count is displayed\n\t } else if (_.has(model.changed, 'element_count')) {\n\t this.$('> .title-bar .subtitle').replaceWith(this._renderSubtitle());\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... rendering\n\t /** render a subtitle to show the user what sort of collection this is */\n\t _renderSubtitle: function () {\n\t return $(this.templates.subtitle(this.model.toJSON(), this));\n\t },\n\t\n\t // ......................................................................... foldout\n\t /** override to add linktarget to sub-panel */\n\t _getFoldoutPanelOptions: function () {\n\t var options = FoldoutListItemView.prototype._getFoldoutPanelOptions.call(this);\n\t return _.extend(options, {\n\t linkTarget: this.linkTarget,\n\t hasUser: this.hasUser\n\t });\n\t },\n\t\n\t /** override to not catch sub-panel selectors */\n\t $selector: function () {\n\t return this.$('> .selector');\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DCListItemView.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, FoldoutListItemView.prototype.templates.warnings, {\n\t error: BASE_MVC.wrapTemplate([\n\t // error during index fetch - show error on dataset\n\t '<% if( model.error ){ %>', '
', _l('There was an error getting the data for this collection'), ': <%- model.error %>', '
', '<% } %>']),\n\t purged: BASE_MVC.wrapTemplate(['<% if( model.purged ){ %>', '
', _l('This collection has been deleted and removed from disk'), '
', '<% } %>']),\n\t deleted: BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>', '
', _l('This collection has been deleted'), '
', '<% } %>'])\n\t });\n\t\n\t // use element identifier\n\t var titleBarTemplate = BASE_MVC.wrapTemplate(['
', '
', '<%- collection.element_identifier || collection.name %>', '
', '
', '
'], 'collection');\n\t\n\t // use element identifier\n\t var subtitleTemplate = BASE_MVC.wrapTemplate(['
', '<% var countText = collection.element_count? ( collection.element_count + \" \" ) : \"\"; %>', '<% if( collection.collection_type === \"list\" ){ %>', _l('a list of <%- countText %>datasets'), '<% } else if( collection.collection_type === \"paired\" ){ %>', _l('a pair of datasets'), '<% } else if( collection.collection_type === \"list:paired\" ){ %>', _l('a list of <%- countText %>dataset pairs'), '<% } else if( collection.collection_type === \"list:list\" ){ %>', _l('a list of <%- countText %>dataset lists'), '<% } %>', '
'], 'collection');\n\t\n\t return _.extend({}, FoldoutListItemView.prototype.templates, {\n\t warnings: warnings,\n\t titleBar: titleBarTemplate,\n\t subtitle: subtitleTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for DatasetCollectionElement.\n\t */\n\t var DCEListItemView = ListItemView.extend(\n\t /** @lends DCEListItemView.prototype */{\n\t\n\t /** add the DCE class to the list item */\n\t className: ListItemView.prototype.className + \" dataset-collection-element\",\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t if (attributes.logger) {\n\t this.logger = this.model.logger = attributes.logger;\n\t }\n\t this.log('DCEListItemView.initialize:', attributes);\n\t ListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCEListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DCEListItemView.prototype.templates = function () {\n\t\n\t // use the element identifier here - since that will persist and the user will need it\n\t var titleBarTemplate = BASE_MVC.wrapTemplate(['
', '
', '<%- element.element_identifier %>', '
', '
', '
'], 'element');\n\t\n\t return _.extend({}, ListItemView.prototype.templates, {\n\t titleBar: titleBarTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for a DatasetCollectionElement that is also an DatasetAssociation\n\t * (a dataset contained in a dataset collection).\n\t */\n\t var DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend(\n\t /** @lends DatasetDCEListItemView.prototype */{\n\t\n\t className: DATASET_LI.DatasetListItemView.prototype.className + \" dataset-collection-element\",\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t if (attributes.logger) {\n\t this.logger = this.model.logger = attributes.logger;\n\t }\n\t this.log('DatasetDCEListItemView.initialize:', attributes);\n\t DATASET_LI.DatasetListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t /** In this override, only get details if in the ready state.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DatasetDCEListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetDCEListItemView.prototype.templates = function () {\n\t\n\t // use the element identifier here and not the dataset name\n\t //TODO:?? can we steal the DCE titlebar?\n\t var titleBarTemplate = BASE_MVC.wrapTemplate(['
', '', '
', '<%- element.element_identifier %>', '
', '
'], 'element');\n\t\n\t return _.extend({}, DATASET_LI.DatasetListItemView.prototype.templates, {\n\t titleBar: titleBarTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\t var NestedDCDCEListItemView = DCListItemView.extend(\n\t /** @lends NestedDCDCEListItemView.prototype */{\n\t\n\t className: DCListItemView.prototype.className + \" dataset-collection-element\",\n\t\n\t /** In this override, add the state as a class for use with state-based CSS */\n\t _swapNewRender: function ($newRender) {\n\t DCListItemView.prototype._swapNewRender.call(this, $newRender);\n\t var state = this.model.get('state') || 'ok';\n\t this.$el.addClass('state-' + state);\n\t return this.$el;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'NestedDCDCEListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t DCListItemView: DCListItemView,\n\t DCEListItemView: DCEListItemView,\n\t DatasetDCEListItemView: DatasetDCEListItemView,\n\t NestedDCDCEListItemView: NestedDCDCEListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ }),\n/* 59 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, Backbone, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(85), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET_MODEL, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /*\n\t Notes:\n\t \n\t Terminology:\n\t DatasetCollection/DC : a container of datasets or nested DatasetCollections\n\t Element/DatasetCollectionElement/DCE : an item contained in a DatasetCollection\n\t HistoryDatasetCollectionAssociation/HDCA: a DatasetCollection contained in a history\n\t \n\t \n\t This all seems too complex unfortunately:\n\t \n\t - Terminology collision between DatasetCollections (DCs) and Backbone Collections.\n\t - In the DatasetCollections API JSON, DC Elements use a 'Has A' stucture to *contain*\n\t either a dataset or a nested DC. This would make the hierarchy much taller. I've\n\t decided to merge the contained JSON with the DC element json - making the 'has a'\n\t relation into an 'is a' relation. This seems simpler to me and allowed a lot of\n\t DRY in both models and views, but may make tracking or tracing within these models\n\t more difficult (since DatasetCollectionElements are now *also* DatasetAssociations\n\t or DatasetCollections (nested)). This also violates the rule of thumb about\n\t favoring aggregation over inheritance.\n\t - Currently, there are three DatasetCollection subclasses: List, Pair, and ListPaired.\n\t These each should a) be usable on their own, b) be usable in the context of\n\t nesting within a collection model (at least in the case of ListPaired), and\n\t c) be usable within the context of other container models (like History or\n\t LibraryFolder, etc.). I've tried to separate/extract classes in order to\n\t handle those three situations, but it's proven difficult to do in a simple,\n\t readable manner.\n\t - Ideally, histories and libraries would inherit from the same server models as\n\t dataset collections do since they are (in essence) dataset collections themselves -\n\t making the whole nested structure simpler. This would be a large, error-prone\n\t refactoring and migration.\n\t \n\t Many of the classes and heirarchy are meant as extension points so, while the\n\t relations and flow may be difficult to understand initially, they'll allow us to\n\t handle the growth or flux dataset collection in the future (w/o actually implementing\n\t any YAGNI).\n\t \n\t */\n\t //_________________________________________________________________________________________________ ELEMENTS\n\t /** @class mixin for Dataset collection elements.\n\t * When collection elements are passed from the API, the underlying element is\n\t * in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).\n\t * This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues\n\t * effectively changing a DCE from a container to a subclass (has a --> is a).\n\t */\n\t\n\t var DatasetCollectionElementMixin = {\n\t\n\t /** default attributes used by elements in a dataset collection */\n\t defaults: {\n\t model_class: 'DatasetCollectionElement',\n\t element_identifier: null,\n\t element_index: null,\n\t element_type: null\n\t },\n\t\n\t /** merge the attributes of the sub-object 'object' into this model */\n\t _mergeObject: function (attributes) {\n\t // if we don't preserve and correct ids here, the element id becomes the object id\n\t // and collision in backbone's _byId will occur and only\n\t _.extend(attributes, attributes.object, { element_id: attributes.id });\n\t delete attributes.object;\n\t return attributes;\n\t },\n\t\n\t /** override to merge this.object into this */\n\t constructor: function (attributes, options) {\n\t // console.debug( '\\t DatasetCollectionElement.constructor:', attributes, options );\n\t attributes = this._mergeObject(attributes);\n\t this.idAttribute = 'element_id';\n\t Backbone.Model.apply(this, arguments);\n\t },\n\t\n\t /** when the model is fetched, merge this.object into this */\n\t parse: function (response, options) {\n\t var attributes = response;\n\t attributes = this._mergeObject(attributes);\n\t return attributes;\n\t }\n\t };\n\t\n\t /** @class Concrete class of Generic DatasetCollectionElement */\n\t var DatasetCollectionElement = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(DatasetCollectionElementMixin).extend({ _logNamespace: 'collections' });\n\t\n\t //==============================================================================\n\t /** @class Base/Abstract Backbone collection for Generic DCEs. */\n\t var DCECollection = Backbone.Collection.extend(BASE_MVC.LoggableMixin).extend(\n\t /** @lends DCECollection.prototype */{\n\t _logNamespace: 'collections',\n\t\n\t model: DatasetCollectionElement,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['DatasetCollectionElementCollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for a dataset collection element that is a dataset (HDA).\n\t */\n\t var DatasetDCE = DATASET_MODEL.DatasetAssociation.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends DatasetDCE.prototype */{\n\t\n\t /** url fn */\n\t url: function () {\n\t // won't always be an hda\n\t if (!this.has('history_id')) {\n\t console.warn('no endpoint for non-hdas within a collection yet');\n\t // (a little silly since this api endpoint *also* points at hdas)\n\t return Galaxy.root + 'api/datasets';\n\t }\n\t return Galaxy.root + 'api/histories/' + this.get('history_id') + '/contents/' + this.get('id');\n\t },\n\t\n\t defaults: _.extend({}, DATASET_MODEL.DatasetAssociation.prototype.defaults, DatasetCollectionElementMixin.defaults),\n\t\n\t _downloadQueryParameters: function () {\n\t return '?to_ext=' + this.get('file_ext') + '&hdca_id=' + this.get('parent_hdca_id') + '&element_identifier=' + this.get('element_identifier');\n\t },\n\t\n\t // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n\t // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n\t // - re-apply manually for now\n\t /** call the mixin constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t DatasetDCE.constructor:', attributes, options);\n\t //DATASET_MODEL.DatasetAssociation.prototype.constructor.call( this, attributes, options );\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** Does this model already contain detailed data (as opposed to just summary level data)? */\n\t hasDetails: function () {\n\t return this.elements && this.elements.length;\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.get('element_identifier');\n\t return ['DatasetDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n\t */\n\t var DatasetDCECollection = DCECollection.extend(\n\t /** @lends DatasetDCECollection.prototype */{\n\t model: DatasetDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['DatasetDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //_________________________________________________________________________________________________ COLLECTIONS\n\t /** @class Backbone model for Dataset Collections.\n\t * The DC API returns an array of JSON objects under the attribute elements.\n\t * This model:\n\t * - removes that array/attribute ('elements') from the model,\n\t * - creates a bbone collection (of the class defined in the 'collectionClass' attribute),\n\t * - passes that json onto the bbone collection\n\t * - caches the bbone collection in this.elements\n\t */\n\t var DatasetCollection = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(BASE_MVC.SearchableModelMixin).extend( /** @lends DatasetCollection.prototype */{\n\t _logNamespace: 'collections',\n\t\n\t /** default attributes for a model */\n\t defaults: {\n\t /* 'list', 'paired', or 'list:paired' */\n\t collection_type: null,\n\t //??\n\t deleted: false\n\t },\n\t\n\t /** Which class to use for elements */\n\t collectionClass: DCECollection,\n\t\n\t /** set up: create elements instance var and (on changes to elements) update them */\n\t initialize: function (model, options) {\n\t this.debug(this + '(DatasetCollection).initialize:', model, options, this);\n\t this.elements = this._createElementsModel();\n\t this.on('change:elements', function () {\n\t this.log('change:elements');\n\t //TODO: prob. better to update the collection instead of re-creating it\n\t this.elements = this._createElementsModel();\n\t });\n\t },\n\t\n\t /** move elements model attribute to full collection */\n\t _createElementsModel: function () {\n\t this.debug(this + '._createElementsModel', this.collectionClass, this.get('elements'), this.elements);\n\t //TODO: same patterns as DatasetCollectionElement _createObjectModel - refactor to BASE_MVC.hasSubModel?\n\t var elements = this.get('elements') || [];\n\t this.unset('elements', { silent: true });\n\t var self = this;\n\t _.each(elements, function (element, index) {\n\t _.extend(element, { \"parent_hdca_id\": self.get(\"id\") });\n\t });\n\t this.elements = new this.collectionClass(elements);\n\t //this.debug( 'collectionClass:', this.collectionClass + '', this.elements );\n\t return this.elements;\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** pass the elements back within the model json when this is serialized */\n\t toJSON: function () {\n\t var json = Backbone.Model.prototype.toJSON.call(this);\n\t if (this.elements) {\n\t json.elements = this.elements.toJSON();\n\t }\n\t return json;\n\t },\n\t\n\t /** Is this collection in a 'ready' state no processing (for the collection) is left\n\t * to do on the server.\n\t */\n\t inReadyState: function () {\n\t var populated = this.get('populated');\n\t return this.isDeletedOrPurged() || populated;\n\t },\n\t\n\t //TODO:?? the following are the same interface as DatasetAssociation - can we combine?\n\t /** Does the DC contain any elements yet? Is a fetch() required? */\n\t hasDetails: function () {\n\t return this.elements.length !== 0;\n\t },\n\t\n\t /** Given the filters, what models in this.elements would be returned? */\n\t getVisibleContents: function (filters) {\n\t // filters unused for now\n\t return this.elements;\n\t },\n\t\n\t // ........................................................................ ajax\n\t /** override to use actual Dates objects for create/update times */\n\t parse: function (response, options) {\n\t var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n\t if (parsed.create_time) {\n\t parsed.create_time = new Date(parsed.create_time);\n\t }\n\t if (parsed.update_time) {\n\t parsed.update_time = new Date(parsed.update_time);\n\t }\n\t return parsed;\n\t },\n\t\n\t /** save this dataset, _Mark_ing it as deleted (just a flag) */\n\t 'delete': function (options) {\n\t if (this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true }, options);\n\t },\n\t /** save this dataset, _Mark_ing it as undeleted */\n\t undelete: function (options) {\n\t if (!this.get('deleted') || this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: false }, options);\n\t },\n\t\n\t /** Is this collection deleted or purged? */\n\t isDeletedOrPurged: function () {\n\t return this.get('deleted') || this.get('purged');\n\t },\n\t\n\t // ........................................................................ searchable\n\t /** searchable attributes for collections */\n\t searchAttributes: ['name', 'tags'],\n\t\n\t // ........................................................................ misc\n\t /** String representation */\n\t toString: function () {\n\t var idAndName = [this.get('id'), this.get('name') || this.get('element_identifier')];\n\t return 'DatasetCollection(' + idAndName.join(',') + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** Model for a DatasetCollection containing datasets (non-nested).\n\t */\n\t var ListDatasetCollection = DatasetCollection.extend(\n\t /** @lends ListDatasetCollection.prototype */{\n\t\n\t /** override since we know the collection will only contain datasets */\n\t collectionClass: DatasetDCECollection,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'List' + DatasetCollection.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** Model for a DatasetCollection containing fwd/rev datasets (a list of 2).\n\t */\n\t var PairDatasetCollection = ListDatasetCollection.extend(\n\t /** @lends PairDatasetCollection.prototype */{\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'Pair' + DatasetCollection.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //_________________________________________________________________________________________________ NESTED COLLECTIONS\n\t // this is where things get weird, man. Weird.\n\t //TODO: it might be possible to compact all the following...I think.\n\t //==============================================================================\n\t /** @class Backbone model for a Generic DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested collection). Currently only list:paired.\n\t */\n\t var NestedDCDCE = DatasetCollection.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends NestedDCDCE.prototype */{\n\t\n\t // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n\t // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n\t // - re-apply manually it now\n\t /** call the mixin constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t NestedDCDCE.constructor:', attributes, options);\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.object ? '' + this.object : this.get('element_identifier');\n\t return ['NestedDCDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n\t */\n\t var NestedDCDCECollection = DCECollection.extend(\n\t /** @lends NestedDCDCECollection.prototype */{\n\t\n\t /** This is a collection of nested collections */\n\t model: NestedDCDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['NestedDCDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n\t */\n\t var NestedPairDCDCE = PairDatasetCollection.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends NestedPairDCDCE.prototype */{\n\t //TODO:?? possibly rename to NestedDatasetCollection?\n\t\n\t // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n\t // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n\t // - re-apply manually it now\n\t /** This is both a collection and a collection element - call the constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t NestedPairDCDCE.constructor:', attributes, options);\n\t //DatasetCollection.constructor.call( this, attributes, options );\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.object ? '' + this.object : this.get('element_identifier');\n\t return ['NestedPairDCDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection for a backbone collection containing paired dataset collections.\n\t */\n\t var NestedPairDCDCECollection = NestedDCDCECollection.extend(\n\t /** @lends PairDCDCECollection.prototype */{\n\t\n\t /** We know this collection is composed of only nested pair collections */\n\t model: NestedPairDCDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['NestedPairDCDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n\t */\n\t var ListPairedDatasetCollection = DatasetCollection.extend(\n\t /** @lends ListPairedDatasetCollection.prototype */{\n\t\n\t /** list:paired is the only collection that itself contains collections */\n\t collectionClass: NestedPairDCDCECollection,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['ListPairedDatasetCollection(', this.get('name'), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for a list dataset collection within a list:list dataset collection. */\n\t var NestedListDCDCE = ListDatasetCollection.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends NestedListDCDCE.prototype */{\n\t\n\t /** This is both a collection and a collection element - call the constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t NestedListDCDCE.constructor:', attributes, options);\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.object ? '' + this.object : this.get('element_identifier');\n\t return ['NestedListDCDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection containing list dataset collections. */\n\t var NestedListDCDCECollection = NestedDCDCECollection.extend({\n\t\n\t /** We know this collection is composed of only nested pair collections */\n\t model: NestedListDCDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['NestedListDCDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\n\t var ListOfListsDatasetCollection = DatasetCollection.extend({\n\t\n\t /** list:paired is the only collection that itself contains collections */\n\t collectionClass: NestedListDCDCECollection,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['ListOfListsDatasetCollection(', this.get('name'), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t ListDatasetCollection: ListDatasetCollection,\n\t PairDatasetCollection: PairDatasetCollection,\n\t ListPairedDatasetCollection: ListPairedDatasetCollection,\n\t ListOfListsDatasetCollection: ListOfListsDatasetCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ }),\n/* 60 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, $, jQuery) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(63), __webpack_require__(17), __webpack_require__(7), __webpack_require__(82), __webpack_require__(8), __webpack_require__(100), __webpack_require__(6), __webpack_require__(97)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HDCA, STATES, BASE_MVC, baseCreator, UI_MODAL, naturalSort, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t\n\t /*==============================================================================\n\t TODO:\n\t use proper Element model and not just json\n\t straighten out createFn, collection.createHDCA\n\t possibly stop using modals for this\n\t It would be neat to do a drag and drop\n\t \n\t ==============================================================================*/\n\t /** A view for both DatasetDCEs and NestedDCDCEs\n\t * (things that implement collection-model:DatasetCollectionElementMixin)\n\t */\n\t var DatasetCollectionElementView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t //TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n\t tagName: 'li',\n\t className: 'collection-element',\n\t\n\t initialize: function (attributes) {\n\t this.element = attributes.element || {};\n\t this.selected = attributes.selected || false;\n\t },\n\t\n\t render: function () {\n\t this.$el.attr('data-element-id', this.element.id).attr('draggable', true).html(this.template({ element: this.element }));\n\t if (this.selected) {\n\t this.$el.addClass('selected');\n\t }\n\t return this;\n\t },\n\t\n\t //TODO: lots of unused space in the element - possibly load details and display them horiz.\n\t template: _.template(['', '<%- element.name %>', '', ''].join('')),\n\t\n\t /** select this element and pub */\n\t select: function (toggle) {\n\t this.$el.toggleClass('selected', toggle);\n\t this.trigger('select', {\n\t source: this,\n\t selected: this.$el.hasClass('selected')\n\t });\n\t },\n\t\n\t /** animate the removal of this element and pub */\n\t discard: function () {\n\t var view = this,\n\t parentWidth = this.$el.parent().width();\n\t this.$el.animate({ 'margin-right': parentWidth }, 'fast', function () {\n\t view.trigger('discard', {\n\t source: view\n\t });\n\t view.destroy();\n\t });\n\t },\n\t\n\t /** remove the DOM and any listeners */\n\t destroy: function () {\n\t this.off();\n\t this.$el.remove();\n\t },\n\t\n\t events: {\n\t 'click': '_click',\n\t 'click .name': '_clickName',\n\t 'click .discard': '_clickDiscard',\n\t\n\t 'dragstart': '_dragstart',\n\t 'dragend': '_dragend',\n\t 'dragover': '_sendToParent',\n\t 'drop': '_sendToParent'\n\t },\n\t\n\t /** select when the li is clicked */\n\t _click: function (ev) {\n\t ev.stopPropagation();\n\t this.select(ev);\n\t },\n\t\n\t /** rename a pair when the name is clicked */\n\t _clickName: function (ev) {\n\t ev.stopPropagation();\n\t ev.preventDefault();\n\t var promptString = [_l('Enter a new name for the element'), ':\\n(', _l('Note that changing the name here will not rename the dataset'), ')'].join(''),\n\t response = prompt(_l('Enter a new name for the element') + ':', this.element.name);\n\t if (response) {\n\t this.element.name = response;\n\t this.render();\n\t }\n\t //TODO: cancelling with ESC leads to closure of the creator...\n\t },\n\t\n\t /** discard when the discard button is clicked */\n\t _clickDiscard: function (ev) {\n\t ev.stopPropagation();\n\t this.discard();\n\t },\n\t\n\t /** dragging pairs for re-ordering */\n\t _dragstart: function (ev) {\n\t if (ev.originalEvent) {\n\t ev = ev.originalEvent;\n\t }\n\t ev.dataTransfer.effectAllowed = 'move';\n\t ev.dataTransfer.setData('text/plain', JSON.stringify(this.element));\n\t\n\t this.$el.addClass('dragging');\n\t this.$el.parent().trigger('collection-element.dragstart', [this]);\n\t },\n\t\n\t /** dragging for re-ordering */\n\t _dragend: function (ev) {\n\t this.$el.removeClass('dragging');\n\t this.$el.parent().trigger('collection-element.dragend', [this]);\n\t },\n\t\n\t /** manually bubble up an event to the parent/container */\n\t _sendToParent: function (ev) {\n\t this.$el.parent().trigger(ev);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'DatasetCollectionElementView()';\n\t }\n\t });\n\t\n\t // ============================================================================\n\t /** An interface for building collections.\n\t */\n\t var ListCollectionCreator = Backbone.View.extend(BASE_MVC.LoggableMixin).extend(baseCreator.CollectionCreatorMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t /** the class used to display individual elements */\n\t elementViewClass: DatasetCollectionElementView,\n\t /** the class this creator will create and save */\n\t collectionClass: HDCA.HistoryListDatasetCollection,\n\t className: 'list-collection-creator collection-creator flex-row-container',\n\t\n\t /** minimum number of valid elements to start with in order to build a collection of this type */\n\t minElements: 1,\n\t\n\t defaultAttributes: {\n\t //TODO: remove - use new collectionClass().save()\n\t /** takes elements and creates the proper collection - returns a promise */\n\t creationFn: function () {\n\t throw new TypeError('no creation fn for creator');\n\t },\n\t /** fn to call when the collection is created (scoped to this) */\n\t oncreate: function () {},\n\t /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n\t oncancel: function () {},\n\t /** distance from list edge to begin autoscrolling list */\n\t autoscrollDist: 24,\n\t /** Color passed to hoverhighlight */\n\t highlightClr: 'rgba( 64, 255, 255, 1.0 )'\n\t },\n\t\n\t footerSettings: {\n\t '.hide-originals': 'hideOriginals'\n\t },\n\t\n\t /** set up initial options, instance vars, behaviors */\n\t initialize: function (attributes) {\n\t this.metric('ListCollectionCreator.initialize', attributes);\n\t var creator = this;\n\t _.each(this.defaultAttributes, function (value, key) {\n\t value = attributes[key] || value;\n\t creator[key] = value;\n\t });\n\t\n\t /** unordered, original list - cache to allow reversal */\n\t creator.initialElements = attributes.elements || [];\n\t\n\t this._setUpCommonSettings(attributes);\n\t this._instanceSetUp();\n\t this._elementsSetUp();\n\t this._setUpBehaviors();\n\t },\n\t\n\t /** set up instance vars */\n\t _instanceSetUp: function () {\n\t /** Ids of elements that have been selected by the user - to preserve over renders */\n\t this.selectedIds = {};\n\t /** DOM elements currently being dragged */\n\t this.$dragging = null;\n\t /** Used for blocking UI events during ajax/operations (don't post twice) */\n\t this.blocking = false;\n\t },\n\t\n\t // ------------------------------------------------------------------------ process raw list\n\t /** set up main data */\n\t _elementsSetUp: function () {\n\t //this.debug( '-- _dataSetUp' );\n\t /** a list of invalid elements and the reasons they aren't valid */\n\t this.invalidElements = [];\n\t //TODO: handle fundamental problem of syncing DOM, views, and list here\n\t /** data for list in progress */\n\t this.workingElements = [];\n\t /** views for workingElements */\n\t this.elementViews = [];\n\t\n\t // copy initial list, sort, add ids if needed\n\t this.workingElements = this.initialElements.slice(0);\n\t this._ensureElementIds();\n\t this._validateElements();\n\t this._mangleDuplicateNames();\n\t this._sortElements();\n\t },\n\t\n\t /** add ids to dataset objs in initial list if none */\n\t _ensureElementIds: function () {\n\t this.workingElements.forEach(function (element) {\n\t if (!element.hasOwnProperty('id')) {\n\t element.id = _.uniqueId();\n\t }\n\t });\n\t return this.workingElements;\n\t },\n\t\n\t /** separate working list into valid and invalid elements for this collection */\n\t _validateElements: function () {\n\t var creator = this,\n\t existingNames = {};\n\t creator.invalidElements = [];\n\t\n\t this.workingElements = this.workingElements.filter(function (element) {\n\t var problem = creator._isElementInvalid(element);\n\t if (problem) {\n\t creator.invalidElements.push({\n\t element: element,\n\t text: problem\n\t });\n\t }\n\t return !problem;\n\t });\n\t return this.workingElements;\n\t },\n\t\n\t /** describe what is wrong with a particular element if anything */\n\t _isElementInvalid: function (element) {\n\t if (element.history_content_type !== 'dataset') {\n\t return _l(\"is not a dataset\");\n\t }\n\t var validState = element.state === STATES.OK || _.contains(STATES.NOT_READY_STATES, element.state);\n\t if (!validState) {\n\t return _l(\"has errored, is paused, or is not accessible\");\n\t }\n\t if (element.deleted || element.purged) {\n\t return _l(\"has been deleted or purged\");\n\t }\n\t return null;\n\t },\n\t\n\t /** mangle duplicate names using a mac-like '(counter)' addition to any duplicates */\n\t _mangleDuplicateNames: function () {\n\t var SAFETY = 900,\n\t counter = 1,\n\t existingNames = {};\n\t this.workingElements.forEach(function (element) {\n\t var currName = element.name;\n\t while (existingNames.hasOwnProperty(currName)) {\n\t currName = element.name + ' (' + counter + ')';\n\t counter += 1;\n\t if (counter >= SAFETY) {\n\t throw new Error('Safety hit in while loop - thats impressive');\n\t }\n\t }\n\t element.name = currName;\n\t existingNames[element.name] = true;\n\t });\n\t },\n\t\n\t /** sort a list of elements */\n\t _sortElements: function (list) {\n\t // // currently only natural sort by name\n\t // this.workingElements.sort( function( a, b ){ return naturalSort( a.name, b.name ); });\n\t // return this.workingElements;\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering\n\t // templates : ListCollectionCreator.templates,\n\t /** render the entire interface */\n\t render: function (speed, callback) {\n\t //this.debug( '-- _render' );\n\t if (this.workingElements.length < this.minElements) {\n\t return this._renderInvalid(speed, callback);\n\t }\n\t\n\t this.$el.empty().html(this.templates.main());\n\t this._renderHeader(speed);\n\t this._renderMiddle(speed);\n\t this._renderFooter(speed);\n\t this._addPluginComponents();\n\t this.$('.collection-name').focus();\n\t this.trigger('rendered', this);\n\t return this;\n\t },\n\t\n\t /** render a simplified interface aimed at telling the user why they can't move forward */\n\t _renderInvalid: function (speed, callback) {\n\t //this.debug( '-- _render' );\n\t this.$el.empty().html(this.templates.invalidInitial({\n\t problems: this.invalidElements,\n\t elements: this.workingElements\n\t }));\n\t if (typeof this.oncancel === 'function') {\n\t this.$('.cancel-create.btn').show();\n\t }\n\t this.trigger('rendered', this);\n\t return this;\n\t },\n\t\n\t /** render the header section */\n\t _renderHeader: function (speed, callback) {\n\t var $header = this.$('.header').empty().html(this.templates.header()).find('.help-content').prepend($(this.templates.helpContent()));\n\t //TODO: should only show once despite calling _renderHeader again\n\t if (this.invalidElements.length) {\n\t this._invalidElementsAlert();\n\t }\n\t return $header;\n\t },\n\t\n\t /** render the middle including the elements */\n\t _renderMiddle: function (speed, callback) {\n\t var $middle = this.$('.middle').empty().html(this.templates.middle());\n\t this._renderList(speed);\n\t return $middle;\n\t },\n\t\n\t /** add any jQuery/bootstrap/custom plugins to elements rendered */\n\t _addPluginComponents: function () {\n\t this.$('.help-content i').hoverhighlight('.collection-creator', this.highlightClr);\n\t },\n\t\n\t /** build and show an alert describing any elements that could not be included due to problems */\n\t _invalidElementsAlert: function () {\n\t this._showAlert(this.templates.invalidElements({ problems: this.invalidElements }), 'alert-warning');\n\t },\n\t\n\t _disableNameAndCreate: function (disable) {\n\t disable = !_.isUndefined(disable) ? disable : true;\n\t if (disable) {\n\t this.$('.collection-name').prop('disabled', true);\n\t this.$('.create-collection').toggleClass('disabled', true);\n\t // } else {\n\t // this.$( '.collection-name' ).prop( 'disabled', false );\n\t // this.$( '.create-collection' ).removeClass( 'disable' );\n\t }\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering elements\n\t /** conv. to the main list display DOM */\n\t $list: function () {\n\t return this.$('.collection-elements');\n\t },\n\t\n\t /** show or hide the clear selected control based on the num of selected elements */\n\t _renderClearSelected: function () {\n\t if (_.size(this.selectedIds)) {\n\t this.$('.collection-elements-controls > .clear-selected').show();\n\t } else {\n\t this.$('.collection-elements-controls > .clear-selected').hide();\n\t }\n\t },\n\t\n\t /** render the elements in order (or a warning if no elements found) */\n\t _renderList: function (speed, callback) {\n\t //this.debug( '-- _renderList' );\n\t var creator = this,\n\t $tmp = jQuery('
'),\n\t $list = creator.$list();\n\t\n\t _.each(this.elementViews, function (view) {\n\t view.destroy();\n\t creator.removeElementView(view);\n\t });\n\t\n\t // if( !this.workingElements.length ){\n\t // this._renderNoValidElements();\n\t // return;\n\t // }\n\t\n\t creator.workingElements.forEach(function (element) {\n\t var elementView = creator._createElementView(element);\n\t $tmp.append(elementView.$el);\n\t });\n\t\n\t creator._renderClearSelected();\n\t $list.empty().append($tmp.children());\n\t _.invoke(creator.elementViews, 'render');\n\t\n\t if ($list.height() > $list.css('max-height')) {\n\t $list.css('border-width', '1px 0px 1px 0px');\n\t } else {\n\t $list.css('border-width', '0px');\n\t }\n\t },\n\t\n\t /** create an element view, cache in elementViews, set up listeners, and return */\n\t _createElementView: function (element) {\n\t var elementView = new this.elementViewClass({\n\t //TODO: use non-generic class or not all\n\t // model : COLLECTION.DatasetDCE( element )\n\t element: element,\n\t selected: _.has(this.selectedIds, element.id)\n\t });\n\t this.elementViews.push(elementView);\n\t this._listenToElementView(elementView);\n\t return elementView;\n\t },\n\t\n\t /** listen to any element events */\n\t _listenToElementView: function (view) {\n\t var creator = this;\n\t creator.listenTo(view, {\n\t select: function (data) {\n\t var element = data.source.element;\n\t if (data.selected) {\n\t creator.selectedIds[element.id] = true;\n\t } else {\n\t delete creator.selectedIds[element.id];\n\t }\n\t creator.trigger('elements:select', data);\n\t },\n\t discard: function (data) {\n\t creator.trigger('elements:discard', data);\n\t }\n\t });\n\t },\n\t\n\t /** add a new element view based on the json in element */\n\t addElementView: function (element) {\n\t //TODO: workingElements is sorted, add element in appropo index\n\t // add element, sort elements, find element index\n\t // var view = this._createElementView( element );\n\t // return view;\n\t },\n\t\n\t /** stop listening to view and remove from caches */\n\t removeElementView: function (view) {\n\t delete this.selectedIds[view.element.id];\n\t this._renderClearSelected();\n\t\n\t this.elementViews = _.without(this.elementViews, view);\n\t this.stopListening(view);\n\t },\n\t\n\t /** render a message in the list that no elements remain to create a collection */\n\t _renderNoElementsLeft: function () {\n\t this._disableNameAndCreate(true);\n\t this.$('.collection-elements').append(this.templates.noElementsLeft());\n\t },\n\t\n\t // /** render a message in the list that no valid elements were found to create a collection */\n\t // _renderNoValidElements : function(){\n\t // this._disableNameAndCreate( true );\n\t // this.$( '.collection-elements' ).append( this.templates.noValidElements() );\n\t // },\n\t\n\t // ------------------------------------------------------------------------ API\n\t /** convert element into JSON compatible with the collections API */\n\t _elementToJSON: function (element) {\n\t // return element.toJSON();\n\t return element;\n\t },\n\t\n\t /** create the collection via the API\n\t * @returns {jQuery.xhr Object} the jquery ajax request\n\t */\n\t createList: function (name) {\n\t if (!this.workingElements.length) {\n\t var message = _l('No valid elements for final list') + '. ';\n\t message += '' + _l('Cancel') + ' ';\n\t message += _l('or');\n\t message += ' ' + _l('start over') + '.';\n\t this._showAlert(message);\n\t return;\n\t }\n\t\n\t var creator = this,\n\t elements = this.workingElements.map(function (element) {\n\t return creator._elementToJSON(element);\n\t });\n\t\n\t creator.blocking = true;\n\t return creator.creationFn(elements, name, creator.hideOriginals).always(function () {\n\t creator.blocking = false;\n\t }).fail(function (xhr, status, message) {\n\t creator.trigger('error', {\n\t xhr: xhr,\n\t status: status,\n\t message: _l('An error occurred while creating this collection')\n\t });\n\t }).done(function (response, message, xhr) {\n\t creator.trigger('collection:created', response, message, xhr);\n\t creator.metric('collection:created', response);\n\t if (typeof creator.oncreate === 'function') {\n\t creator.oncreate.call(this, response, message, xhr);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ events\n\t /** set up event handlers on self */\n\t _setUpBehaviors: function () {\n\t this.on('error', this._errorHandler);\n\t\n\t this.once('rendered', function () {\n\t this.trigger('rendered:initial', this);\n\t });\n\t\n\t this.on('elements:select', function (data) {\n\t this._renderClearSelected();\n\t });\n\t\n\t this.on('elements:discard', function (data) {\n\t var element = data.source.element;\n\t this.removeElementView(data.source);\n\t\n\t this.workingElements = _.without(this.workingElements, element);\n\t if (!this.workingElements.length) {\n\t this._renderNoElementsLeft();\n\t }\n\t });\n\t\n\t //this.on( 'all', function(){\n\t // this.info( arguments );\n\t //});\n\t return this;\n\t },\n\t\n\t /** handle errors with feedback and details to the user (if available) */\n\t _errorHandler: function (data) {\n\t this.error(data);\n\t\n\t var creator = this,\n\t content = data.message || _l('An error occurred');\n\t if (data.xhr) {\n\t var xhr = data.xhr,\n\t message = data.message;\n\t if (xhr.readyState === 0 && xhr.status === 0) {\n\t content += ': ' + _l('Galaxy could not be reached and may be updating.') + _l(' Try again in a few minutes.');\n\t } else if (xhr.responseJSON) {\n\t content += ':
' + JSON.stringify(xhr.responseJSON) + '
';\n\t } else {\n\t content += ': ' + message;\n\t }\n\t }\n\t creator._showAlert(content, 'alert-danger');\n\t },\n\t\n\t events: {\n\t // header\n\t 'click .more-help': '_clickMoreHelp',\n\t 'click .less-help': '_clickLessHelp',\n\t 'click .main-help': '_toggleHelp',\n\t 'click .header .alert button': '_hideAlert',\n\t\n\t 'click .reset': 'reset',\n\t 'click .clear-selected': 'clearSelectedElements',\n\t\n\t // elements - selection\n\t 'click .collection-elements': 'clearSelectedElements',\n\t\n\t // elements - drop target\n\t // 'dragenter .collection-elements': '_dragenterElements',\n\t // 'dragleave .collection-elements': '_dragleaveElements',\n\t 'dragover .collection-elements': '_dragoverElements',\n\t 'drop .collection-elements': '_dropElements',\n\t\n\t // these bubble up from the elements as custom events\n\t 'collection-element.dragstart .collection-elements': '_elementDragstart',\n\t 'collection-element.dragend .collection-elements': '_elementDragend',\n\t\n\t // footer\n\t 'change .collection-name': '_changeName',\n\t 'keydown .collection-name': '_nameCheckForEnter',\n\t 'change .hide-originals': '_changeHideOriginals',\n\t 'click .cancel-create': '_cancelCreate',\n\t 'click .create-collection': '_clickCreate' //,\n\t },\n\t\n\t // ........................................................................ elements\n\t /** reset all data to the initial state */\n\t reset: function () {\n\t this._instanceSetUp();\n\t this._elementsSetUp();\n\t this.render();\n\t },\n\t\n\t /** deselect all elements */\n\t clearSelectedElements: function (ev) {\n\t this.$('.collection-elements .collection-element').removeClass('selected');\n\t this.$('.collection-elements-controls > .clear-selected').hide();\n\t },\n\t\n\t //_dragenterElements : function( ev ){\n\t // //this.debug( '_dragenterElements:', ev );\n\t //},\n\t //TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n\t // _dragleaveElements : function( ev ){\n\t // //this.debug( '_dragleaveElements:', ev );\n\t // },\n\t\n\t /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n\t _dragoverElements: function (ev) {\n\t //this.debug( '_dragoverElements:', ev );\n\t ev.preventDefault();\n\t\n\t var $list = this.$list();\n\t this._checkForAutoscroll($list, ev.originalEvent.clientY);\n\t var $nearest = this._getNearestElement(ev.originalEvent.clientY);\n\t\n\t //TODO: no need to re-create - move instead\n\t this.$('.element-drop-placeholder').remove();\n\t var $placeholder = $('
');\n\t if (!$nearest.length) {\n\t $list.append($placeholder);\n\t } else {\n\t $nearest.before($placeholder);\n\t }\n\t },\n\t\n\t /** If the mouse is near enough to the list's top or bottom, scroll the list */\n\t _checkForAutoscroll: function ($element, y) {\n\t var AUTOSCROLL_SPEED = 2,\n\t offset = $element.offset(),\n\t scrollTop = $element.scrollTop(),\n\t upperDist = y - offset.top,\n\t lowerDist = offset.top + $element.outerHeight() - y;\n\t if (upperDist >= 0 && upperDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop - AUTOSCROLL_SPEED);\n\t } else if (lowerDist >= 0 && lowerDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop + AUTOSCROLL_SPEED);\n\t }\n\t },\n\t\n\t /** get the nearest element based on the mouse's Y coordinate.\n\t * If the y is at the end of the list, return an empty jQuery object.\n\t */\n\t _getNearestElement: function (y) {\n\t var WIGGLE = 4,\n\t lis = this.$('.collection-elements li.collection-element').toArray();\n\t for (var i = 0; i < lis.length; i++) {\n\t var $li = $(lis[i]),\n\t top = $li.offset().top,\n\t halfHeight = Math.floor($li.outerHeight() / 2) + WIGGLE;\n\t if (top + halfHeight > y && top - halfHeight < y) {\n\t return $li;\n\t }\n\t }\n\t return $();\n\t },\n\t\n\t /** drop (dragged/selected elements) onto the list, re-ordering the internal list */\n\t _dropElements: function (ev) {\n\t if (ev.originalEvent) {\n\t ev = ev.originalEvent;\n\t }\n\t // both required for firefox\n\t ev.preventDefault();\n\t ev.dataTransfer.dropEffect = 'move';\n\t\n\t // insert before the nearest element or after the last.\n\t var $nearest = this._getNearestElement(ev.clientY);\n\t if ($nearest.length) {\n\t this.$dragging.insertBefore($nearest);\n\t } else {\n\t // no nearest before - insert after last element\n\t this.$dragging.insertAfter(this.$('.collection-elements .collection-element').last());\n\t }\n\t // resync the creator's list based on the new DOM order\n\t this._syncOrderToDom();\n\t return false;\n\t },\n\t\n\t /** resync the creator's list of elements based on the DOM order */\n\t _syncOrderToDom: function () {\n\t var creator = this,\n\t newElements = [];\n\t //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n\t this.$('.collection-elements .collection-element').each(function () {\n\t var id = $(this).attr('data-element-id'),\n\t element = _.findWhere(creator.workingElements, { id: id });\n\t if (element) {\n\t newElements.push(element);\n\t } else {\n\t console.error('missing element: ', id);\n\t }\n\t });\n\t this.workingElements = newElements;\n\t this._renderList();\n\t },\n\t\n\t /** drag communication with element sub-views: dragstart */\n\t _elementDragstart: function (ev, element) {\n\t // auto select the element causing the event and move all selected\n\t element.select(true);\n\t this.$dragging = this.$('.collection-elements .collection-element.selected');\n\t },\n\t\n\t /** drag communication with element sub-views: dragend - remove the placeholder */\n\t _elementDragend: function (ev, element) {\n\t $('.element-drop-placeholder').remove();\n\t this.$dragging = null;\n\t },\n\t\n\t // ------------------------------------------------------------------------ templates\n\t //TODO: move to require text plugin and load these as text\n\t //TODO: underscore currently unnecc. bc no vars are used\n\t //TODO: better way of localizing text-nodes in long strings\n\t /** underscore template fns attached to class */\n\t templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\t\n\t /** the header (not including help text) */\n\t header: _.template(['', '
', '', '', '
'].join('')),\n\t\n\t /** the middle: element list */\n\t middle: _.template(['', '
', '
'].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer: _.template(['
', '
', '', '
', '
', '', '
', _l('Name'), ':
', '
', '
', '
', '
', '', '
', '', '', '
', '
', '
', '', '
', '
'].join('')),\n\t\n\t /** help content */\n\t helpContent: _.template(['

', _l(['Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ', 'workflows in order to have analyses done on each member of the entire group. This interface allows ', 'you to create a collection and re-order the final collection.'].join('')), '

', '
    ', '
  • ', _l(['Rename elements in the list by clicking on ', 'the existing name.'].join('')), '
  • ', '
  • ', _l(['Discard elements from the final created list by clicking on the ', '\"Discard\" button.'].join('')), '
  • ', '
  • ', _l(['Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ', 'them and you can then move those selected by dragging the ', 'entire group. Deselect them by clicking them again or by clicking the ', 'the \"Clear selected\" link.'].join('')), '
  • ', '
  • ', _l(['Click the \"Start over\" link to begin again as if you had just opened ', 'the interface.'].join('')), '
  • ', '
  • ', _l(['Click the \"Cancel\" button to exit the interface.'].join('')), '
  • ', '

', '

', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '

'].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t invalidElements: _.template([_l('The following selections could not be included due to problems:'), '
    <% _.each( problems, function( problem ){ %>', '
  • <%- problem.element.name %>: <%- problem.text %>
  • ', '<% }); %>
'].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t noElementsLeft: _.template(['
  • ', _l('No elements left! '), _l('Would you like to '), '', _l('start over'), '?', '
  • '].join('')),\n\t\n\t /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n\t invalidInitial: _.template(['
    ', '
    ', '', '<% if( _.size( problems ) ){ %>', _l('The following selections could not be included due to problems'), ':', '
      <% _.each( problems, function( problem ){ %>', '
    • <%- problem.element.name %>: <%- problem.text %>
    • ', '<% }); %>
    ', '<% } else if( _.size( elements ) < 1 ){ %>', _l('No datasets were selected'), '.', '<% } %>', '
    ', _l('At least one element is needed for the collection'), '. ', _l('You may need to '), '', _l('cancel'), ' ', _l('and reselect new elements'), '.', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
    ', '
    ', '
    '].join(''))\n\t }),\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListCollectionCreator';\n\t }\n\t });\n\t\n\t //=============================================================================\n\t /** Create a modal and load its body with the given CreatorClass creator type\n\t * @returns {Deferred} resolved when creator has built a collection.\n\t */\n\t var collectionCreatorModal = function _collectionCreatorModal(elements, options, CreatorClass) {\n\t\n\t var deferred = jQuery.Deferred(),\n\t modal = Galaxy.modal || new UI_MODAL.View(),\n\t creator;\n\t\n\t options = _.defaults(options || {}, {\n\t elements: elements,\n\t oncancel: function () {\n\t modal.hide();\n\t deferred.reject('cancelled');\n\t },\n\t oncreate: function (creator, response) {\n\t modal.hide();\n\t deferred.resolve(response);\n\t }\n\t });\n\t\n\t creator = new CreatorClass(options);\n\t modal.show({\n\t title: options.title || _l('Create a collection'),\n\t body: creator.$el,\n\t width: '80%',\n\t height: '100%',\n\t closing_events: true\n\t });\n\t creator.render();\n\t window._collectionCreator = creator;\n\t\n\t //TODO: remove modal header\n\t return deferred;\n\t };\n\t\n\t /** List collection flavor of collectionCreatorModal. */\n\t var listCollectionCreatorModal = function _listCollectionCreatorModal(elements, options) {\n\t options = options || {};\n\t options.title = _l('Create a collection from a list of datasets');\n\t return collectionCreatorModal(elements, options, ListCollectionCreator);\n\t };\n\t\n\t //==============================================================================\n\t /** Use a modal to create a list collection, then add it to the given history contents.\n\t * @returns {Deferred} resolved when the collection is added to the history.\n\t */\n\t function createListCollection(contents, defaultHideSourceItems) {\n\t var elements = contents.toJSON(),\n\t promise = listCollectionCreatorModal(elements, {\n\t defaultHideSourceItems: defaultHideSourceItems,\n\t creationFn: function (elements, name, hideSourceItems) {\n\t elements = elements.map(function (element) {\n\t return {\n\t id: element.id,\n\t name: element.name,\n\t //TODO: this allows for list:list even if the filter above does not - reconcile\n\t src: element.history_content_type === 'dataset' ? 'hda' : 'hdca'\n\t };\n\t });\n\t return contents.createHDCA(elements, 'list', name, hideSourceItems);\n\t }\n\t });\n\t return promise;\n\t }\n\t\n\t //==============================================================================\n\t return {\n\t DatasetCollectionElementView: DatasetCollectionElementView,\n\t ListCollectionCreator: ListCollectionCreator,\n\t\n\t collectionCreatorModal: collectionCreatorModal,\n\t listCollectionCreatorModal: listCollectionCreatorModal,\n\t createListCollection: createListCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ }),\n/* 61 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, jQuery, Backbone, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(67), __webpack_require__(17), __webpack_require__(25), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_ITEM, STATES, faIconButton, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t var logNamespace = 'dataset';\n\t /*==============================================================================\n\t TODO:\n\t straighten out state rendering and templates used\n\t inaccessible/STATES.NOT_VIEWABLE is a special case\n\t simplify button rendering\n\t \n\t ==============================================================================*/\n\t var _super = LIST_ITEM.ListItemView;\n\t /** @class Read only list view for either LDDAs, HDAs, or HDADCEs.\n\t * Roughly, any DatasetInstance (and not a raw Dataset).\n\t */\n\t var DatasetListItemView = _super.extend(\n\t /** @lends DatasetListItemView.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t className: _super.prototype.className + \" dataset\",\n\t //TODO:?? doesn't exactly match an hda's type_id\n\t id: function () {\n\t return ['dataset', this.model.get('id')].join('-');\n\t },\n\t\n\t /** Set up: instance vars, options, and event handlers */\n\t initialize: function (attributes) {\n\t if (attributes.logger) {\n\t this.logger = this.model.logger = attributes.logger;\n\t }\n\t this.log(this + '.initialize:', attributes);\n\t _super.prototype.initialize.call(this, attributes);\n\t\n\t /** where should pages from links be displayed? (default to new tab/window) */\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t },\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t var self = this;\n\t\n\t // re-rendering on any model changes\n\t return self.listenTo(self.model, {\n\t 'change': function (model) {\n\t // if the model moved into the ready state and is expanded without details, fetch those details now\n\t if (self.model.changedAttributes().state && self.model.inReadyState() && self.expanded && !self.model.hasDetails()) {\n\t // normally, will render automatically (due to fetch -> change),\n\t // but! setting_metadata sometimes doesn't cause any other changes besides state\n\t // so, not rendering causes it to seem frozen in setting_metadata state\n\t self.model.fetch({ silent: true }).done(function () {\n\t self.render();\n\t });\n\t } else {\n\t if (_.has(model.changed, 'tags') && _.keys(model.changed).length === 1) {\n\t // If only the tags have changed, rerender specifically\n\t // the titlebar region. Otherwise default to the full\n\t // render.\n\t self.$('.nametags').html(self._renderNametags());\n\t } else {\n\t self.render();\n\t }\n\t }\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... expandable\n\t /** In this override, only get details if in the ready state, get rerunnable if in other states.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t // ......................................................................... removal\n\t /** Remove this view's html from the DOM and remove all event listeners.\n\t * @param {Number or String} speed jq effect speed\n\t * @param {Function} callback an optional function called when removal is done (scoped to this view)\n\t */\n\t remove: function (speed, callback) {\n\t var view = this;\n\t speed = speed || this.fxSpeed;\n\t this.$el.fadeOut(speed, function () {\n\t Backbone.View.prototype.remove.call(view);\n\t if (callback) {\n\t callback.call(view);\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... rendering\n\t /* TODO:\n\t dataset states are the issue primarily making dataset rendering complex\n\t each state should have it's own way of displaying/set of details\n\t often with different actions that can be applied\n\t throw in deleted/purged/visible and things get complicated easily\n\t I've considered (a couple of times) - creating a view for each state\n\t - but recreating the view during an update...seems wrong\n\t */\n\t /** In this override, add the dataset state as a class for use with state-based CSS */\n\t _swapNewRender: function ($newRender) {\n\t _super.prototype._swapNewRender.call(this, $newRender);\n\t if (this.model.has('state')) {\n\t this.$el.addClass('state-' + this.model.get('state'));\n\t }\n\t return this.$el;\n\t },\n\t\n\t // ................................................................................ titlebar\n\t /** In this override, add the dataset display button. */\n\t _renderPrimaryActions: function () {\n\t // render just the display for read-only\n\t return [this._renderDisplayButton()];\n\t },\n\t\n\t /** Render icon-button to display dataset data */\n\t _renderDisplayButton: function () {\n\t // don't show display if not viewable or not accessible\n\t var state = this.model.get('state');\n\t if (state === STATES.NOT_VIEWABLE || state === STATES.DISCARDED || !this.model.get('accessible')) {\n\t return null;\n\t }\n\t\n\t var displayBtnData = {\n\t target: this.linkTarget,\n\t classes: 'display-btn'\n\t };\n\t\n\t // show a disabled display if the data's been purged\n\t if (this.model.get('purged')) {\n\t displayBtnData.disabled = true;\n\t displayBtnData.title = _l('Cannot display datasets removed from disk');\n\t\n\t // disable if still uploading\n\t } else if (state === STATES.UPLOAD) {\n\t displayBtnData.disabled = true;\n\t displayBtnData.title = _l('This dataset must finish uploading before it can be viewed');\n\t\n\t // disable if still new\n\t } else if (state === STATES.NEW) {\n\t displayBtnData.disabled = true;\n\t displayBtnData.title = _l('This dataset is not yet viewable');\n\t } else {\n\t displayBtnData.title = _l('View data');\n\t\n\t // default link for dataset\n\t displayBtnData.href = this.model.urls.display;\n\t\n\t // add frame manager option onclick event\n\t var self = this;\n\t displayBtnData.onclick = function (ev) {\n\t if (Galaxy.frame && Galaxy.frame.active) {\n\t // Add dataset to frames.\n\t Galaxy.frame.addDataset(self.model.get('id'));\n\t ev.preventDefault();\n\t }\n\t };\n\t }\n\t displayBtnData.faIcon = 'fa-eye';\n\t return faIconButton(displayBtnData);\n\t },\n\t\n\t // ......................................................................... rendering details\n\t /** Render the enclosing div of the hda body and, if expanded, the html in the body\n\t * @returns {jQuery} rendered DOM\n\t */\n\t _renderDetails: function () {\n\t //TODO: generalize to be allow different details for each state\n\t\n\t // no access - render nothing but a message\n\t if (this.model.get('state') === STATES.NOT_VIEWABLE) {\n\t return $(this.templates.noAccess(this.model.toJSON(), this));\n\t }\n\t\n\t var $details = _super.prototype._renderDetails.call(this);\n\t $details.find('.actions .left').empty().append(this._renderSecondaryActions());\n\t $details.find('.summary').html(this._renderSummary()).prepend(this._renderDetailMessages());\n\t $details.find('.display-applications').html(this._renderDisplayApplications());\n\t\n\t this._setUpBehaviors($details);\n\t return $details;\n\t },\n\t\n\t /** Defer to the appropo summary rendering fn based on state */\n\t _renderSummary: function () {\n\t var json = this.model.toJSON(),\n\t summaryRenderFn = this.templates.summaries[json.state];\n\t summaryRenderFn = summaryRenderFn || this.templates.summaries.unknown;\n\t return summaryRenderFn(json, this);\n\t },\n\t\n\t /** Render messages to be displayed only when the details are shown */\n\t _renderDetailMessages: function () {\n\t var view = this,\n\t $warnings = $('
    '),\n\t json = view.model.toJSON();\n\t //TODO:! unordered (map)\n\t _.each(view.templates.detailMessages, function (templateFn) {\n\t $warnings.append($(templateFn(json, view)));\n\t });\n\t return $warnings;\n\t },\n\t\n\t /** Render the external display application links */\n\t _renderDisplayApplications: function () {\n\t if (this.model.isDeletedOrPurged()) {\n\t return '';\n\t }\n\t // render both old and new display apps using the same template\n\t return [this.templates.displayApplications(this.model.get('display_apps'), this), this.templates.displayApplications(this.model.get('display_types'), this)].join('');\n\t },\n\t\n\t // ......................................................................... secondary/details actions\n\t /** A series of links/buttons for less commonly used actions: re-run, info, etc. */\n\t _renderSecondaryActions: function () {\n\t this.debug('_renderSecondaryActions');\n\t switch (this.model.get('state')) {\n\t case STATES.NOT_VIEWABLE:\n\t return [];\n\t case STATES.OK:\n\t case STATES.FAILED_METADATA:\n\t case STATES.ERROR:\n\t return [this._renderDownloadButton(), this._renderShowParamsButton()];\n\t }\n\t return [this._renderShowParamsButton()];\n\t },\n\t\n\t /** Render icon-button to show the input and output (stdout/err) for the job that created this.\n\t * @returns {jQuery} rendered DOM\n\t */\n\t _renderShowParamsButton: function () {\n\t // gen. safe to show in all cases\n\t return faIconButton({\n\t title: _l('View details'),\n\t classes: 'params-btn',\n\t href: this.model.urls.show_params,\n\t target: this.linkTarget,\n\t faIcon: 'fa-info-circle',\n\t onclick: function (ev) {\n\t if (Galaxy.frame && Galaxy.frame.active) {\n\t Galaxy.frame.add({ title: 'Dataset details', url: this.href });\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** Render icon-button/popupmenu to download the data (and/or the associated meta files (bai, etc.)) for this.\n\t * @returns {jQuery} rendered DOM\n\t */\n\t _renderDownloadButton: function () {\n\t // don't show anything if the data's been purged\n\t if (this.model.get('purged') || !this.model.hasData()) {\n\t return null;\n\t }\n\t\n\t // return either: a popupmenu with links to download assoc. meta files (if there are meta files)\n\t // or a single download icon-button (if there are no meta files)\n\t if (!_.isEmpty(this.model.get('meta_files'))) {\n\t return this._renderMetaFileDownloadButton();\n\t }\n\t\n\t return $(['', '', ''].join(''));\n\t },\n\t\n\t /** Render the download button which opens a dropdown with links to download assoc. meta files (indeces, etc.) */\n\t _renderMetaFileDownloadButton: function () {\n\t var urls = this.model.urls;\n\t return $(['
    ', '', '', '', '', '
    '].join('\\n'));\n\t },\n\t\n\t _renderNametags: function () {\n\t var tpl = _.template(['<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>', '<% if (tag.indexOf(\"name:\") == 0){ %>', '<%- tag.slice(5) %>', '<% } %>', '<% }); %>'].join(''));\n\t return tpl({ tags: this.model.get('tags') });\n\t },\n\t\n\t // ......................................................................... misc\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .display-btn': function (ev) {\n\t this.trigger('display', this, ev);\n\t },\n\t 'click .params-btn': function (ev) {\n\t this.trigger('params', this, ev);\n\t },\n\t 'click .download-btn': function (ev) {\n\t this.trigger('download', this, ev);\n\t }\n\t }),\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DatasetListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetListItemView.prototype.templates = function () {\n\t //TODO: move to require text! plugin\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t failed_metadata: BASE_MVC.wrapTemplate([\n\t // failed metadata is rendered as a warning on an otherwise ok dataset view\n\t '<% if( model.state === \"failed_metadata\" ){ %>', '
    ', _l('An error occurred setting the metadata for this dataset'), '
    ', '<% } %>']),\n\t error: BASE_MVC.wrapTemplate([\n\t // error during index fetch - show error on dataset\n\t '<% if( model.error ){ %>', '
    ', _l('There was an error getting the data for this dataset'), ': <%- model.error %>', '
    ', '<% } %>']),\n\t purged: BASE_MVC.wrapTemplate(['<% if( model.purged ){ %>', '
    ', _l('This dataset has been deleted and removed from disk'), '
    ', '<% } %>']),\n\t deleted: BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>', '
    ', _l('This dataset has been deleted'), '
    ', '<% } %>'])\n\t\n\t //NOTE: hidden warning is only needed for HDAs\n\t });\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate(['
    ', '
    ', '
    ', '
    ', '
    ', '
    ',\n\t\n\t // do not display tags, annotation, display apps, or peek when deleted\n\t '<% if( !dataset.deleted && !dataset.purged ){ %>', '
    ', '
    ', '
    ', '<% if( dataset.peek ){ %>', '
    <%= dataset.peek %>
    ', '<% } %>', '<% } %>', '
    '], 'dataset');\n\t\n\t var noAccessTemplate = BASE_MVC.wrapTemplate(['
    ', '
    ', _l('You do not have permission to view this dataset'), '
    ', '
    '], 'dataset');\n\t\n\t //TODO: still toooooooooooooo complex - rework\n\t var summaryTemplates = {};\n\t summaryTemplates[STATES.OK] = summaryTemplates[STATES.FAILED_METADATA] = BASE_MVC.wrapTemplate(['<% if( dataset.misc_blurb ){ %>', '
    ', '<%- dataset.misc_blurb %>', '
    ', '<% } %>', '<% if( dataset.file_ext ){ %>', '
    ', '', '<%- dataset.file_ext %>', '
    ', '<% } %>', '<% if( dataset.metadata_dbkey ){ %>', '
    ', '', '', '<%- dataset.metadata_dbkey %>', '', '
    ', '<% } %>', '<% if( dataset.misc_info ){ %>', '
    ', '<%- dataset.misc_info %>', '
    ', '<% } %>'], 'dataset');\n\t summaryTemplates[STATES.NEW] = BASE_MVC.wrapTemplate(['
    ', _l('This is a new dataset and not all of its data are available yet'), '
    '], 'dataset');\n\t summaryTemplates[STATES.NOT_VIEWABLE] = BASE_MVC.wrapTemplate(['
    ', _l('You do not have permission to view this dataset'), '
    '], 'dataset');\n\t summaryTemplates[STATES.DISCARDED] = BASE_MVC.wrapTemplate(['
    ', _l('The job creating this dataset was cancelled before completion'), '
    '], 'dataset');\n\t summaryTemplates[STATES.QUEUED] = BASE_MVC.wrapTemplate(['
    ', _l('This job is waiting to run'), '
    '], 'dataset');\n\t summaryTemplates[STATES.RUNNING] = BASE_MVC.wrapTemplate(['
    ', _l('This job is currently running'), '
    '], 'dataset');\n\t summaryTemplates[STATES.UPLOAD] = BASE_MVC.wrapTemplate(['
    ', _l('This dataset is currently uploading'), '
    '], 'dataset');\n\t summaryTemplates[STATES.SETTING_METADATA] = BASE_MVC.wrapTemplate(['
    ', _l('Metadata is being auto-detected'), '
    '], 'dataset');\n\t summaryTemplates[STATES.PAUSED] = BASE_MVC.wrapTemplate(['
    ', _l('This job is paused. Use the \"Resume Paused Jobs\" in the history menu to resume'), '
    '], 'dataset');\n\t summaryTemplates[STATES.ERROR] = BASE_MVC.wrapTemplate(['<% if( !dataset.purged ){ %>', '
    <%- dataset.misc_blurb %>
    ', '<% } %>', '', _l('An error occurred with this dataset'), ':', '
    <%- dataset.misc_info %>
    '], 'dataset');\n\t summaryTemplates[STATES.EMPTY] = BASE_MVC.wrapTemplate(['
    ', _l('No data'), ': <%- dataset.misc_blurb %>
    '], 'dataset');\n\t summaryTemplates.unknown = BASE_MVC.wrapTemplate(['
    Error: unknown dataset state: \"<%- dataset.state %>\"
    '], 'dataset');\n\t\n\t // messages to be displayed only within the details section ('below the fold')\n\t var detailMessageTemplates = {\n\t resubmitted: BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.resubmitted ){ %>', '
    ', _l('The job creating this dataset has been resubmitted'), '
    ', '<% } %>'])\n\t };\n\t\n\t // this is applied to both old and new style display apps\n\t var displayApplicationsTemplate = BASE_MVC.wrapTemplate(['<% _.each( apps, function( app ){ %>', '
    ', '<%- app.label %> ', '', '<% _.each( app.links, function( link ){ %>', '\" href=\"<%- link.href %>\">', '<% print( _l( link.text ) ); %>', ' ', '<% }); %>', '', '
    ', '<% }); %>'], 'apps');\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t warnings: warnings,\n\t details: detailsTemplate,\n\t noAccess: noAccessTemplate,\n\t summaries: summaryTemplates,\n\t detailMessages: detailMessageTemplates,\n\t displayApplications: displayApplicationsTemplate\n\t });\n\t }();\n\t\n\t // ============================================================================\n\t return {\n\t DatasetListItemView: DatasetListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ }),\n/* 62 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {/** Generic form view */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(10), __webpack_require__(5)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Form, Ui) {\n\t\n\t var View = Backbone.View.extend({\n\t\n\t initialize: function (options) {\n\t this.model = new Backbone.Model(options);\n\t this.url = this.model.get('url');\n\t this.redirect = this.model.get('redirect');\n\t this.setElement('
    ');\n\t this.render();\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t $.ajax({\n\t url: Galaxy.root + this.url,\n\t type: 'GET'\n\t }).done(function (response) {\n\t var options = $.extend({}, self.model.attributes, response);\n\t var form = new Form({\n\t title: options.title,\n\t message: options.message,\n\t status: options.status || 'warning',\n\t icon: options.icon,\n\t inputs: options.inputs,\n\t buttons: {\n\t 'submit': new Ui.Button({\n\t tooltip: options.submit_tooltip,\n\t title: options.submit_title || 'Save',\n\t icon: options.submit_icon || 'fa-save',\n\t cls: 'btn btn-primary ui-clear-float',\n\t onclick: function () {\n\t self._submit(form);\n\t }\n\t })\n\t }\n\t });\n\t self.$el.empty().append(form.$el);\n\t }).fail(function (response) {\n\t self.$el.empty().append(new Ui.Message({\n\t message: 'Failed to load resource ' + self.url + '.',\n\t status: 'danger',\n\t persistent: true\n\t }).$el);\n\t });\n\t },\n\t\n\t _submit: function (form) {\n\t var self = this;\n\t $.ajax({\n\t url: Galaxy.root + self.url,\n\t data: JSON.stringify(form.data.create()),\n\t type: 'PUT',\n\t contentType: 'application/json'\n\t }).done(function (response) {\n\t var success_message = { message: response.message, status: 'success', persistent: false };\n\t if (self.redirect) {\n\t window.location = Galaxy.root + self.redirect + '?' + $.param(success_message);\n\t } else {\n\t form.data.matchModel(response, function (input, input_id) {\n\t form.field_list[input_id].value(input.value);\n\t });\n\t self._showMessage(form, success_message);\n\t }\n\t }).fail(function (response) {\n\t self._showMessage(form, { message: response.responseJSON.err_msg, status: 'danger', persistent: false });\n\t });\n\t },\n\t\n\t _showMessage: function (form, options) {\n\t var $panel = form.$el.parents().filter(function () {\n\t return ['auto', 'scroll'].indexOf($(this).css('overflow')) != -1;\n\t }).first();\n\t $panel.animate({ scrollTop: 0 }, 500);\n\t form.message.update(options);\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ }),\n/* 63 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(59), __webpack_require__(90), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DC_MODEL, HISTORY_CONTENT, _l) {\n\t\n\t 'use strict';\n\t\n\t /*==============================================================================\n\t \n\t Models for DatasetCollections contained within a history.\n\t \n\t TODO:\n\t these might be compactable to one class if some duplication with\n\t collection-model is used.\n\t \n\t ==============================================================================*/\n\t\n\t var hcontentMixin = HISTORY_CONTENT.HistoryContentMixin,\n\t ListDC = DC_MODEL.ListDatasetCollection,\n\t PairDC = DC_MODEL.PairDatasetCollection,\n\t ListPairedDC = DC_MODEL.ListPairedDatasetCollection,\n\t ListOfListsDC = DC_MODEL.ListOfListsDatasetCollection;\n\t\n\t //==============================================================================\n\t /** Override to post to contents route w/o id. */\n\t function buildHDCASave(_super) {\n\t return function _save(attributes, options) {\n\t if (this.isNew()) {\n\t options = options || {};\n\t options.url = this.urlRoot + this.get('history_id') + '/contents';\n\t attributes = attributes || {};\n\t attributes.type = 'dataset_collection';\n\t }\n\t return _super.call(this, attributes, options);\n\t };\n\t }\n\t\n\t //==============================================================================\n\t /** @class Backbone model for List Dataset Collection within a History.\n\t */\n\t var HistoryListDatasetCollection = ListDC.extend(hcontentMixin).extend(\n\t /** @lends HistoryListDatasetCollection.prototype */{\n\t\n\t defaults: _.extend(_.clone(ListDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'list',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(ListDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'History' + ListDC.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for Pair Dataset Collection within a History.\n\t * @constructs\n\t */\n\t var HistoryPairDatasetCollection = PairDC.extend(hcontentMixin).extend(\n\t /** @lends HistoryPairDatasetCollection.prototype */{\n\t\n\t defaults: _.extend(_.clone(PairDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'paired',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(PairDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'History' + PairDC.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for List of Pairs Dataset Collection within a History. */\n\t var HistoryListPairedDatasetCollection = ListPairedDC.extend(hcontentMixin).extend({\n\t\n\t defaults: _.extend(_.clone(ListPairedDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'list:paired',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(ListPairedDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'History' + ListPairedDC.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for List of Lists Dataset Collection within a History. */\n\t var HistoryListOfListsDatasetCollection = ListOfListsDC.extend(hcontentMixin).extend({\n\t\n\t defaults: _.extend(_.clone(ListOfListsDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'list:list',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(ListOfListsDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['HistoryListOfListsDatasetCollection(', this.get('name'), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HistoryListDatasetCollection: HistoryListDatasetCollection,\n\t HistoryPairDatasetCollection: HistoryPairDatasetCollection,\n\t HistoryListPairedDatasetCollection: HistoryListPairedDatasetCollection,\n\t HistoryListOfListsDatasetCollection: HistoryListOfListsDatasetCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ }),\n/* 64 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, jQuery, Backbone) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(81), __webpack_require__(88), __webpack_require__(63), __webpack_require__(66), __webpack_require__(7), __webpack_require__(154)], __WEBPACK_AMD_DEFINE_RESULT__ = function (CONTROLLED_FETCH_COLLECTION, HDA_MODEL, HDCA_MODEL, HISTORY_PREFS, BASE_MVC, AJAX_QUEUE) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = CONTROLLED_FETCH_COLLECTION.PaginatedCollection;\n\t /** @class Backbone collection for history content.\n\t * NOTE: history content seems like a dataset collection, but differs in that it is mixed:\n\t * each element can be either an HDA (dataset) or a DatasetCollection and co-exist on\n\t * the same level.\n\t * Dataset collections on the other hand are not mixed and (so far) can only contain either\n\t * HDAs or child dataset collections on one level.\n\t * This is why this does not inherit from any of the DatasetCollections (currently).\n\t */\n\t var HistoryContents = _super.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: 'history',\n\t\n\t // ........................................................................ composite collection\n\t /** since history content is a mix, override model fn into a factory, creating based on history_content_type */\n\t model: function (attrs, options) {\n\t if (attrs.history_content_type === \"dataset\") {\n\t return new HDA_MODEL.HistoryDatasetAssociation(attrs, options);\n\t } else if (attrs.history_content_type === \"dataset_collection\") {\n\t switch (attrs.collection_type) {\n\t case 'list':\n\t return new HDCA_MODEL.HistoryListDatasetCollection(attrs, options);\n\t case 'paired':\n\t return new HDCA_MODEL.HistoryPairDatasetCollection(attrs, options);\n\t case 'list:paired':\n\t return new HDCA_MODEL.HistoryListPairedDatasetCollection(attrs, options);\n\t case 'list:list':\n\t return new HDCA_MODEL.HistoryListOfListsDatasetCollection(attrs, options);\n\t }\n\t // This is a hack inside a hack:\n\t // Raise a plain object with validationError to fake a model.validationError\n\t // (since we don't have a model to use validate with)\n\t // (the outer hack being the mixed content/model function in this collection)\n\t var msg = 'Unknown collection_type: ' + attrs.collection_type;\n\t console.warn(msg, attrs);\n\t return { validationError: msg };\n\t }\n\t return { validationError: 'Unknown history_content_type: ' + attrs.history_content_type };\n\t },\n\t\n\t // ........................................................................ set up\n\t limitPerPage: 500,\n\t\n\t /** @type {Integer} how many contents per call to fetch when using progressivelyFetchDetails */\n\t limitPerProgressiveFetch: 500,\n\t\n\t /** @type {String} order used here and when fetching from server */\n\t order: 'hid',\n\t\n\t /** root api url */\n\t urlRoot: Galaxy.root + 'api/histories',\n\t\n\t /** complete api url */\n\t url: function () {\n\t return this.urlRoot + '/' + this.historyId + '/contents';\n\t },\n\t\n\t /** Set up */\n\t initialize: function (models, options) {\n\t options = options || {};\n\t _super.prototype.initialize.call(this, models, options);\n\t\n\t this.history = options.history || null;\n\t this.setHistoryId(options.historyId || null);\n\t /** @type {Boolean} does this collection contain and fetch deleted elements */\n\t this.includeDeleted = options.includeDeleted || this.includeDeleted;\n\t /** @type {Boolean} does this collection contain and fetch non-visible elements */\n\t this.includeHidden = options.includeHidden || this.includeHidden;\n\t\n\t // backbonejs uses collection.model.prototype.idAttribute to determine if a model is *already* in a collection\n\t // and either merged or replaced. In this case, our 'model' is a function so we need to add idAttribute\n\t // manually here - if we don't, contents will not merge but be replaced/swapped.\n\t this.model.prototype.idAttribute = 'type_id';\n\t },\n\t\n\t setHistoryId: function (newId) {\n\t this.historyId = newId;\n\t this._setUpWebStorage();\n\t },\n\t\n\t /** Set up client side storage. Currently PersistanStorage keyed under 'history:' */\n\t _setUpWebStorage: function (initialSettings) {\n\t // TODO: use initialSettings\n\t if (!this.historyId) {\n\t return;\n\t }\n\t this.storage = new HISTORY_PREFS.HistoryPrefs({\n\t id: HISTORY_PREFS.HistoryPrefs.historyStorageKey(this.historyId)\n\t });\n\t this.trigger('new-storage', this.storage, this);\n\t\n\t this.on({\n\t 'include-deleted': function (newVal) {\n\t this.storage.includeDeleted(newVal);\n\t },\n\t 'include-hidden': function (newVal) {\n\t this.storage.includeHidden(newVal);\n\t }\n\t });\n\t\n\t this.includeDeleted = this.storage.includeDeleted() || false;\n\t this.includeHidden = this.storage.includeHidden() || false;\n\t return this;\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** @type {Object} map of collection available sorting orders containing comparator fns */\n\t comparators: _.extend(_.clone(_super.prototype.comparators), {\n\t 'name': BASE_MVC.buildComparator('name', { ascending: true }),\n\t 'name-dsc': BASE_MVC.buildComparator('name', { ascending: false }),\n\t 'hid': BASE_MVC.buildComparator('hid', { ascending: false }),\n\t 'hid-asc': BASE_MVC.buildComparator('hid', { ascending: true })\n\t }),\n\t\n\t /** Get every model in this collection not in a 'ready' state (running). */\n\t running: function () {\n\t return this.filter(function (c) {\n\t return !c.inReadyState();\n\t });\n\t },\n\t\n\t /** return contents that are not ready and not deleted/hidden */\n\t runningAndActive: function () {\n\t return this.filter(function (c) {\n\t return !c.inReadyState() && c.get('visible')\n\t // TODO: deletedOrPurged?\n\t && !c.get('deleted');\n\t });\n\t },\n\t\n\t /** Get the model with the given hid\n\t * @param {Int} hid the hid to search for\n\t * @returns {HistoryDatasetAssociation} the model with the given hid or undefined if not found\n\t */\n\t getByHid: function (hid) {\n\t // note: there *can* be more than one content with a given hid, this finds the first based on order\n\t return this.findWhere({ hid: hid });\n\t },\n\t\n\t /** return true if all contents have details */\n\t haveDetails: function () {\n\t return this.all(function (c) {\n\t return c.hasDetails();\n\t });\n\t },\n\t\n\t // ........................................................................ hidden / deleted\n\t /** return a new contents collection of only hidden items */\n\t hidden: function () {\n\t return this.filter(function (c) {\n\t return c.hidden();\n\t });\n\t },\n\t\n\t /** return a new contents collection of only hidden items */\n\t deleted: function () {\n\t return this.filter(function (c) {\n\t return c.get('deleted');\n\t });\n\t },\n\t\n\t /** return a new contents collection of only hidden items */\n\t visibleAndUndeleted: function () {\n\t return this.filter(function (c) {\n\t return c.get('visible') &&\n\t // TODO: deletedOrPurged?\n\t !c.get('deleted');\n\t });\n\t },\n\t\n\t /** create a setter in order to publish the change */\n\t setIncludeDeleted: function (setting, options) {\n\t if (_.isBoolean(setting) && setting !== this.includeDeleted) {\n\t this.includeDeleted = setting;\n\t if (_.result(options, 'silent')) {\n\t return;\n\t }\n\t this.trigger('include-deleted', setting, this);\n\t }\n\t },\n\t\n\t /** create a setter in order to publish the change */\n\t setIncludeHidden: function (setting, options) {\n\t if (_.isBoolean(setting) && setting !== this.includeHidden) {\n\t this.includeHidden = setting;\n\t options = options || {};\n\t if (_.result(options, 'silent')) {\n\t return;\n\t }\n\t this.trigger('include-hidden', setting, this);\n\t }\n\t },\n\t\n\t // ........................................................................ ajax\n\t // ............ controlled fetch collection\n\t /** override to get expanded ids from sessionStorage and pass to API as details */\n\t fetch: function (options) {\n\t options = options || {};\n\t if (this.historyId && !options.details) {\n\t var prefs = HISTORY_PREFS.HistoryPrefs.get(this.historyId).toJSON();\n\t if (!_.isEmpty(prefs.expandedIds)) {\n\t options.details = _.values(prefs.expandedIds).join(',');\n\t }\n\t }\n\t return _super.prototype.fetch.call(this, options);\n\t },\n\t\n\t // ............. ControlledFetch stuff\n\t /** override to include the API versioning flag */\n\t _buildFetchData: function (options) {\n\t return _.extend(_super.prototype._buildFetchData.call(this, options), {\n\t v: 'dev'\n\t });\n\t },\n\t\n\t /** Extend to include details and version */\n\t _fetchParams: _super.prototype._fetchParams.concat([\n\t // TODO: remove (the need for) both\n\t /** version */\n\t 'v',\n\t /** dataset ids to get full details of */\n\t 'details']),\n\t\n\t /** override to add deleted/hidden filters */\n\t _buildFetchFilters: function (options) {\n\t var superFilters = _super.prototype._buildFetchFilters.call(this, options) || {};\n\t var filters = {};\n\t if (!this.includeDeleted) {\n\t filters.deleted = false;\n\t filters.purged = false;\n\t }\n\t if (!this.includeHidden) {\n\t filters.visible = true;\n\t }\n\t return _.defaults(superFilters, filters);\n\t },\n\t\n\t // ............ paginated collection\n\t getTotalItemCount: function () {\n\t return this.history.contentsShown();\n\t },\n\t\n\t // ............ history contents specific ajax\n\t /** override to filter requested contents to those updated after the Date 'since' */\n\t fetchUpdated: function (since, options) {\n\t if (since) {\n\t options = options || { filters: {} };\n\t options.remove = false;\n\t options.filters = {\n\t 'update_time-ge': since.toISOString(),\n\t // workflows will produce hidden datasets (non-output datasets) that still\n\t // need to be updated in the collection or they'll update forever\n\t // we can remove the default visible filter by using an 'empty' value\n\t visible: ''\n\t };\n\t }\n\t return this.fetch(options);\n\t },\n\t\n\t /** fetch all the deleted==true contents of this collection */\n\t fetchDeleted: function (options) {\n\t options = options || {};\n\t var self = this;\n\t options.filters = _.extend(options.filters, {\n\t // all deleted, purged or not\n\t deleted: true,\n\t purged: undefined\n\t });\n\t options.remove = false;\n\t\n\t self.trigger('fetching-deleted', self);\n\t return self.fetch(options).always(function () {\n\t self.trigger('fetching-deleted-done', self);\n\t });\n\t },\n\t\n\t /** fetch all the visible==false contents of this collection */\n\t fetchHidden: function (options) {\n\t options = options || {};\n\t var self = this;\n\t options.filters = _.extend(options.filters, {\n\t visible: false\n\t });\n\t options.remove = false;\n\t\n\t self.trigger('fetching-hidden', self);\n\t return self.fetch(options).always(function () {\n\t self.trigger('fetching-hidden-done', self);\n\t });\n\t },\n\t\n\t /** fetch detailed model data for all contents in this collection */\n\t fetchAllDetails: function (options) {\n\t options = options || {};\n\t var detailsFlag = { details: 'all' };\n\t options.data = _.extend(options.data || {}, detailsFlag);\n\t return this.fetch(options);\n\t },\n\t\n\t /** specialty fetch method for retrieving the element_counts of all hdcas in the history */\n\t fetchCollectionCounts: function (options) {\n\t options = options || {};\n\t options.keys = ['type_id', 'element_count'].join(',');\n\t options.filters = _.extend(options.filters || {}, {\n\t history_content_type: 'dataset_collection'\n\t });\n\t options.remove = false;\n\t return this.fetch(options);\n\t },\n\t\n\t // ............. quasi-batch ops\n\t // TODO: to batch\n\t /** helper that fetches using filterParams then calls save on each fetched using updateWhat as the save params */\n\t _filterAndUpdate: function (filterParams, updateWhat) {\n\t var self = this;\n\t var idAttribute = self.model.prototype.idAttribute;\n\t var updateArgs = [updateWhat];\n\t\n\t return self.fetch({ filters: filterParams, remove: false }).then(function (fetched) {\n\t // convert filtered json array to model array\n\t fetched = fetched.reduce(function (modelArray, currJson, i) {\n\t var model = self.get(currJson[idAttribute]);\n\t return model ? modelArray.concat(model) : modelArray;\n\t }, []);\n\t return self.ajaxQueue('save', updateArgs, fetched);\n\t });\n\t },\n\t\n\t /** using a queue, perform ajaxFn on each of the models in this collection */\n\t ajaxQueue: function (ajaxFn, args, collection) {\n\t collection = collection || this.models;\n\t return new AJAX_QUEUE.AjaxQueue(collection.slice().reverse().map(function (content, i) {\n\t var fn = _.isString(ajaxFn) ? content[ajaxFn] : ajaxFn;\n\t return function () {\n\t return fn.apply(content, args);\n\t };\n\t })).deferred;\n\t },\n\t\n\t /** fetch contents' details in batches of limitPerCall - note: only get searchable details here */\n\t progressivelyFetchDetails: function (options) {\n\t options = options || {};\n\t var deferred = jQuery.Deferred();\n\t var self = this;\n\t var limit = options.limitPerCall || self.limitPerProgressiveFetch;\n\t // TODO: only fetch tags and annotations if specifically requested\n\t var searchAttributes = HDA_MODEL.HistoryDatasetAssociation.prototype.searchAttributes;\n\t var detailKeys = searchAttributes.join(',');\n\t\n\t function _recursivelyFetch(offset) {\n\t offset = offset || 0;\n\t var _options = _.extend(_.clone(options), {\n\t view: 'summary',\n\t keys: detailKeys,\n\t limit: limit,\n\t offset: offset,\n\t reset: offset === 0,\n\t remove: false\n\t });\n\t\n\t _.defer(function () {\n\t self.fetch.call(self, _options).fail(deferred.reject).done(function (response) {\n\t deferred.notify(response, limit, offset);\n\t if (response.length !== limit) {\n\t self.allFetched = true;\n\t deferred.resolve(response, limit, offset);\n\t } else {\n\t _recursivelyFetch(offset + limit);\n\t }\n\t });\n\t });\n\t }\n\t _recursivelyFetch();\n\t return deferred;\n\t },\n\t\n\t /** does some bit of JSON represent something that can be copied into this contents collection */\n\t isCopyable: function (contentsJSON) {\n\t var copyableModelClasses = ['HistoryDatasetAssociation', 'HistoryDatasetCollectionAssociation'];\n\t return _.isObject(contentsJSON) && contentsJSON.id && _.contains(copyableModelClasses, contentsJSON.model_class);\n\t },\n\t\n\t /** copy an existing, accessible hda into this collection */\n\t copy: function (json) {\n\t // TODO: somehow showhorn all this into 'save'\n\t var id, type, contentType;\n\t if (_.isString(json)) {\n\t id = json;\n\t contentType = 'hda';\n\t type = 'dataset';\n\t } else {\n\t id = json.id;\n\t contentType = {\n\t 'HistoryDatasetAssociation': 'hda',\n\t 'LibraryDatasetDatasetAssociation': 'ldda',\n\t 'HistoryDatasetCollectionAssociation': 'hdca'\n\t }[json.model_class] || 'hda';\n\t type = contentType === 'hdca' ? 'dataset_collection' : 'dataset';\n\t }\n\t var collection = this,\n\t xhr = jQuery.ajax(this.url(), {\n\t method: 'POST',\n\t contentType: 'application/json',\n\t data: JSON.stringify({\n\t content: id,\n\t source: contentType,\n\t type: type\n\t })\n\t }).done(function (response) {\n\t collection.add([response], { parse: true });\n\t }).fail(function (error, status, message) {\n\t collection.trigger('error', collection, xhr, {}, 'Error copying contents', { type: type, id: id, source: contentType });\n\t });\n\t return xhr;\n\t },\n\t\n\t /** create a new HDCA in this collection */\n\t createHDCA: function (elementIdentifiers, collectionType, name, hideSourceItems, options) {\n\t // normally collection.create returns the new model, but we need the promise from the ajax, so we fake create\n\t //precondition: elementIdentifiers is an array of plain js objects\n\t // in the proper form to create the collectionType\n\t var hdca = this.model({\n\t history_content_type: 'dataset_collection',\n\t collection_type: collectionType,\n\t history_id: this.historyId,\n\t name: name,\n\t hide_source_items: hideSourceItems || false,\n\t // should probably be able to just send in a bunch of json here and restruct per class\n\t // note: element_identifiers is now (incorrectly) an attribute\n\t element_identifiers: elementIdentifiers\n\t // do not create the model on the client until the ajax returns\n\t });\n\t return hdca.save(options);\n\t },\n\t\n\t // ........................................................................ searching\n\t /** return true if all contents have the searchable attributes */\n\t haveSearchDetails: function () {\n\t return this.allFetched && this.all(function (content) {\n\t // null (which is a valid returned annotation value)\n\t // will return false when using content.has( 'annotation' )\n\t //TODO: a bit hacky - formalize\n\t return _.has(content.attributes, 'annotation');\n\t });\n\t },\n\t\n\t /** return a new collection of contents whose attributes contain the substring matchesWhat */\n\t matches: function (matchesWhat) {\n\t return this.filter(function (content) {\n\t return content.matches(matchesWhat);\n\t });\n\t },\n\t\n\t // ........................................................................ misc\n\t /** In this override, copy the historyId to the clone */\n\t clone: function () {\n\t var clone = Backbone.Collection.prototype.clone.call(this);\n\t clone.historyId = this.historyId;\n\t return clone;\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['HistoryContents(', [this.historyId, this.length].join(), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HistoryContents: HistoryContents\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ }),\n/* 65 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, jQuery, _, $) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(64), __webpack_require__(66), __webpack_require__(81), __webpack_require__(4), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HISTORY_CONTENTS, HISTORY_PREFS, CONTROLLED_FETCH_COLLECTION, UTILS, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /** @class Model for a Galaxy history resource - both a record of user\n\t * tool use and a collection of the datasets those tools produced.\n\t * @name History\n\t * @augments Backbone.Model\n\t */\n\t\n\t var History = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(BASE_MVC.mixin(BASE_MVC.SearchableModelMixin, /** @lends History.prototype */{\n\t _logNamespace: 'history',\n\t\n\t /** ms between fetches when checking running jobs/datasets for updates */\n\t UPDATE_DELAY: 4000,\n\t\n\t // values from api (may need more)\n\t defaults: {\n\t model_class: 'History',\n\t id: null,\n\t name: 'Unnamed History',\n\t state: 'new',\n\t\n\t deleted: false,\n\t contents_active: {},\n\t contents_states: {}\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/histories',\n\t\n\t contentsClass: HISTORY_CONTENTS.HistoryContents,\n\t\n\t /** What model fields to search with */\n\t searchAttributes: ['name', 'annotation', 'tags'],\n\t\n\t /** Adding title and singular tag */\n\t searchAliases: {\n\t title: 'name',\n\t tag: 'tags'\n\t },\n\t\n\t // ........................................................................ set up/tear down\n\t /** Set up the model\n\t * @param {Object} historyJSON model data for this History\n\t * @param {Object} options any extra settings including logger\n\t */\n\t initialize: function (historyJSON, options) {\n\t options = options || {};\n\t this.logger = options.logger || null;\n\t this.log(this + \".initialize:\", historyJSON, options);\n\t\n\t /** HistoryContents collection of the HDAs contained in this history. */\n\t this.contents = new this.contentsClass([], {\n\t history: this,\n\t historyId: this.get('id'),\n\t order: options.order\n\t });\n\t\n\t this._setUpListeners();\n\t this._setUpCollectionListeners();\n\t\n\t /** cached timeout id for the dataset updater */\n\t this.updateTimeoutId = null;\n\t },\n\t\n\t /** set up any event listeners for this history including those to the contained HDAs\n\t * events: error:contents if an error occurred with the contents collection\n\t */\n\t _setUpListeners: function () {\n\t // if the model's id changes ('current' or null -> an actual id), update the contents history_id\n\t return this.on({\n\t 'error': function (model, xhr, options, msg, details) {\n\t this.clearUpdateTimeout();\n\t },\n\t 'change:id': function (model, newId) {\n\t if (this.contents) {\n\t this.contents.historyId = newId;\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** event handlers for the contents submodels */\n\t _setUpCollectionListeners: function () {\n\t if (!this.contents) {\n\t return this;\n\t }\n\t // bubble up errors\n\t return this.listenTo(this.contents, {\n\t 'error': function () {\n\t this.trigger.apply(this, jQuery.makeArray(arguments));\n\t }\n\t });\n\t },\n\t\n\t // ........................................................................ derived attributes\n\t /** */\n\t contentsShown: function () {\n\t var contentsActive = this.get('contents_active');\n\t var shown = contentsActive.active || 0;\n\t shown += this.contents.includeDeleted ? contentsActive.deleted : 0;\n\t shown += this.contents.includeHidden ? contentsActive.hidden : 0;\n\t return shown;\n\t },\n\t\n\t /** convert size in bytes to a more human readable version */\n\t nice_size: function () {\n\t var size = this.get('size');\n\t return size ? UTILS.bytesToString(size, true, 2) : _l('(empty)');\n\t },\n\t\n\t /** override to add nice_size */\n\t toJSON: function () {\n\t return _.extend(Backbone.Model.prototype.toJSON.call(this), {\n\t nice_size: this.nice_size()\n\t });\n\t },\n\t\n\t /** override to allow getting nice_size */\n\t get: function (key) {\n\t if (key === 'nice_size') {\n\t return this.nice_size();\n\t }\n\t return Backbone.Model.prototype.get.apply(this, arguments);\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** T/F is this history owned by the current user (Galaxy.user)\n\t * Note: that this will return false for an anon user even if the history is theirs.\n\t */\n\t ownedByCurrUser: function () {\n\t // no currUser\n\t if (!Galaxy || !Galaxy.user) {\n\t return false;\n\t }\n\t // user is anon or history isn't owned\n\t if (Galaxy.user.isAnonymous() || Galaxy.user.id !== this.get('user_id')) {\n\t return false;\n\t }\n\t return true;\n\t },\n\t\n\t /** Return the number of running jobs assoc with this history (note: unknown === 0) */\n\t numOfUnfinishedJobs: function () {\n\t var unfinishedJobIds = this.get('non_ready_jobs');\n\t return unfinishedJobIds ? unfinishedJobIds.length : 0;\n\t },\n\t\n\t /** Return the number of running hda/hdcas in this history (note: unknown === 0) */\n\t numOfUnfinishedShownContents: function () {\n\t return this.contents.runningAndActive().length || 0;\n\t },\n\t\n\t // ........................................................................ updates\n\t _fetchContentRelatedAttributes: function () {\n\t var contentRelatedAttrs = ['size', 'non_ready_jobs', 'contents_active', 'hid_counter'];\n\t return this.fetch({ data: $.param({ keys: contentRelatedAttrs.join(',') }) });\n\t },\n\t\n\t /** check for any changes since the last time we updated (or fetch all if ) */\n\t refresh: function (options) {\n\t // console.log( this + '.refresh' );\n\t options = options || {};\n\t var self = this;\n\t\n\t // note if there was no previous update time, all summary contents will be fetched\n\t var lastUpdateTime = self.lastUpdateTime;\n\t // if we don't flip this, then a fully-fetched list will not be re-checked via fetch\n\t this.contents.allFetched = false;\n\t var fetchFn = self.contents.currentPage !== 0 ? function () {\n\t return self.contents.fetchPage(self.contents.currentPage);\n\t } : function () {\n\t return self.contents.fetchUpdated(lastUpdateTime);\n\t };\n\t // note: if there was no previous update time, all summary contents will be fetched\n\t return fetchFn().done(function (response, status, xhr) {\n\t var serverResponseDatetime;\n\t try {\n\t serverResponseDatetime = new Date(xhr.getResponseHeader('Date'));\n\t } catch (err) {}\n\t self.lastUpdateTime = serverResponseDatetime || new Date();\n\t self.checkForUpdates(options);\n\t });\n\t },\n\t\n\t /** continuously fetch updated contents every UPDATE_DELAY ms if this history's datasets or jobs are unfinished */\n\t checkForUpdates: function (options) {\n\t // console.log( this + '.checkForUpdates' );\n\t options = options || {};\n\t var delay = this.UPDATE_DELAY;\n\t var self = this;\n\t if (!self.id) {\n\t return;\n\t }\n\t\n\t function _delayThenUpdate() {\n\t // prevent buildup of updater timeouts by clearing previous if any, then set new and cache id\n\t self.clearUpdateTimeout();\n\t self.updateTimeoutId = setTimeout(function () {\n\t self.refresh(options);\n\t }, delay);\n\t }\n\t\n\t // if there are still datasets in the non-ready state, recurse into this function with the new time\n\t var nonReadyContentCount = this.numOfUnfinishedShownContents();\n\t // console.log( 'nonReadyContentCount:', nonReadyContentCount );\n\t if (nonReadyContentCount > 0) {\n\t _delayThenUpdate();\n\t } else {\n\t // no datasets are running, but currently runnning jobs may still produce new datasets\n\t // see if the history has any running jobs and continue to update if so\n\t // (also update the size for the user in either case)\n\t self._fetchContentRelatedAttributes().done(function (historyData) {\n\t // console.log( 'non_ready_jobs:', historyData.non_ready_jobs );\n\t if (self.numOfUnfinishedJobs() > 0) {\n\t _delayThenUpdate();\n\t } else {\n\t // otherwise, let listeners know that all updates have stopped\n\t self.trigger('ready');\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** clear the timeout and the cached timeout id */\n\t clearUpdateTimeout: function () {\n\t if (this.updateTimeoutId) {\n\t clearTimeout(this.updateTimeoutId);\n\t this.updateTimeoutId = null;\n\t }\n\t },\n\t\n\t // ........................................................................ ajax\n\t /** override to use actual Dates objects for create/update times */\n\t parse: function (response, options) {\n\t var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n\t if (parsed.create_time) {\n\t parsed.create_time = new Date(parsed.create_time);\n\t }\n\t if (parsed.update_time) {\n\t parsed.update_time = new Date(parsed.update_time);\n\t }\n\t return parsed;\n\t },\n\t\n\t /** fetch this histories data (using options) then it's contents (using contentsOptions) */\n\t fetchWithContents: function (options, contentsOptions) {\n\t options = options || {};\n\t var self = this;\n\t\n\t // console.log( this + '.fetchWithContents' );\n\t // TODO: push down to a base class\n\t options.view = 'dev-detailed';\n\t\n\t // fetch history then use history data to fetch (paginated) contents\n\t return this.fetch(options).then(function getContents(history) {\n\t self.contents.history = self;\n\t self.contents.setHistoryId(history.id);\n\t return self.fetchContents(contentsOptions);\n\t });\n\t },\n\t\n\t /** fetch this histories contents, adjusting options based on the stored history preferences */\n\t fetchContents: function (options) {\n\t options = options || {};\n\t var self = this;\n\t\n\t // we're updating, reset the update time\n\t self.lastUpdateTime = new Date();\n\t return self.contents.fetchCurrentPage(options);\n\t },\n\t\n\t /** save this history, _Mark_ing it as deleted (just a flag) */\n\t _delete: function (options) {\n\t if (this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true }, options);\n\t },\n\t /** purge this history, _Mark_ing it as purged and removing all dataset data from the server */\n\t purge: function (options) {\n\t if (this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true, purged: true }, options);\n\t },\n\t /** save this history, _Mark_ing it as undeleted */\n\t undelete: function (options) {\n\t if (!this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: false }, options);\n\t },\n\t\n\t /** Make a copy of this history on the server\n\t * @param {Boolean} current if true, set the copy as the new current history (default: true)\n\t * @param {String} name name of new history (default: none - server sets to: Copy of )\n\t * @fires copied passed this history and the response JSON from the copy\n\t * @returns {xhr}\n\t */\n\t copy: function (current, name, allDatasets) {\n\t current = current !== undefined ? current : true;\n\t if (!this.id) {\n\t throw new Error('You must set the history ID before copying it.');\n\t }\n\t\n\t var postData = { history_id: this.id };\n\t if (current) {\n\t postData.current = true;\n\t }\n\t if (name) {\n\t postData.name = name;\n\t }\n\t if (!allDatasets) {\n\t postData.all_datasets = false;\n\t }\n\t postData.view = 'dev-detailed';\n\t\n\t var history = this;\n\t var copy = jQuery.post(this.urlRoot, postData);\n\t // if current - queue to setAsCurrent before firing 'copied'\n\t if (current) {\n\t return copy.then(function (response) {\n\t var newHistory = new History(response);\n\t return newHistory.setAsCurrent().done(function () {\n\t history.trigger('copied', history, response);\n\t });\n\t });\n\t }\n\t return copy.done(function (response) {\n\t history.trigger('copied', history, response);\n\t });\n\t },\n\t\n\t setAsCurrent: function () {\n\t var history = this,\n\t xhr = jQuery.getJSON(Galaxy.root + 'history/set_as_current?id=' + this.id);\n\t\n\t xhr.done(function () {\n\t history.trigger('set-as-current', history);\n\t });\n\t return xhr;\n\t },\n\t\n\t // ........................................................................ misc\n\t toString: function () {\n\t return 'History(' + this.get('id') + ',' + this.get('name') + ')';\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t var _collectionSuper = CONTROLLED_FETCH_COLLECTION.InfinitelyScrollingCollection;\n\t /** @class A collection of histories (per user)\n\t * that maintains the current history as the first in the collection.\n\t * New or copied histories become the current history.\n\t */\n\t var HistoryCollection = _collectionSuper.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: 'history',\n\t\n\t model: History,\n\t /** @type {String} initial order used by collection */\n\t order: 'update_time',\n\t /** @type {Number} limit used for the first fetch (or a reset) */\n\t limitOnFirstFetch: 10,\n\t /** @type {Number} limit used for each subsequent fetch */\n\t limitPerFetch: 10,\n\t\n\t initialize: function (models, options) {\n\t options = options || {};\n\t this.log('HistoryCollection.initialize', models, options);\n\t _collectionSuper.prototype.initialize.call(this, models, options);\n\t\n\t /** @type {boolean} should deleted histories be included */\n\t this.includeDeleted = options.includeDeleted || false;\n\t\n\t /** @type {String} encoded id of the history that's current */\n\t this.currentHistoryId = options.currentHistoryId;\n\t\n\t this.setUpListeners();\n\t // note: models are sent to reset *after* this fn ends; up to this point\n\t // the collection *is empty*\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/histories',\n\t url: function () {\n\t return this.urlRoot;\n\t },\n\t\n\t /** set up reflexive event handlers */\n\t setUpListeners: function setUpListeners() {\n\t return this.on({\n\t // when a history is deleted, remove it from the collection (if optionally set to do so)\n\t 'change:deleted': function (history) {\n\t // TODO: this becomes complicated when more filters are used\n\t this.debug('change:deleted', this.includeDeleted, history.get('deleted'));\n\t if (!this.includeDeleted && history.get('deleted')) {\n\t this.remove(history);\n\t }\n\t },\n\t // listen for a history copy, setting it to current\n\t 'copied': function (original, newData) {\n\t this.setCurrent(new History(newData, []));\n\t },\n\t // when a history is made current, track the id in the collection\n\t 'set-as-current': function (history) {\n\t var oldCurrentId = this.currentHistoryId;\n\t this.trigger('no-longer-current', oldCurrentId);\n\t this.currentHistoryId = history.id;\n\t }\n\t });\n\t },\n\t\n\t /** override to change view */\n\t _buildFetchData: function (options) {\n\t return _.extend(_collectionSuper.prototype._buildFetchData.call(this, options), {\n\t view: 'dev-detailed'\n\t });\n\t },\n\t\n\t /** override to filter out deleted and purged */\n\t _buildFetchFilters: function (options) {\n\t var superFilters = _collectionSuper.prototype._buildFetchFilters.call(this, options) || {};\n\t var filters = {};\n\t if (!this.includeDeleted) {\n\t filters.deleted = false;\n\t filters.purged = false;\n\t } else {\n\t // force API to return both deleted and non\n\t //TODO: when the API is updated, remove this\n\t filters.deleted = null;\n\t }\n\t return _.defaults(superFilters, filters);\n\t },\n\t\n\t /** override to fetch current as well (as it may be outside the first 10, etc.) */\n\t fetchFirst: function (options) {\n\t var self = this;\n\t // TODO: batch?\n\t var xhr = $.when();\n\t if (this.currentHistoryId) {\n\t xhr = _collectionSuper.prototype.fetchFirst.call(self, {\n\t silent: true,\n\t limit: 1,\n\t filters: {\n\t // without these a deleted current history will return [] here and block the other xhr\n\t 'purged': '',\n\t 'deleted': '',\n\t 'encoded_id-in': this.currentHistoryId\n\t }\n\t });\n\t }\n\t return xhr.then(function () {\n\t options = options || {};\n\t options.offset = 0;\n\t return self.fetchMore(options);\n\t });\n\t },\n\t\n\t /** @type {Object} map of collection available sorting orders containing comparator fns */\n\t comparators: _.extend(_.clone(_collectionSuper.prototype.comparators), {\n\t 'name': BASE_MVC.buildComparator('name', { ascending: true }),\n\t 'name-dsc': BASE_MVC.buildComparator('name', { ascending: false }),\n\t 'size': BASE_MVC.buildComparator('size', { ascending: false }),\n\t 'size-asc': BASE_MVC.buildComparator('size', { ascending: true })\n\t }),\n\t\n\t /** override to always have the current history first */\n\t sort: function (options) {\n\t options = options || {};\n\t var silent = options.silent;\n\t var currentHistory = this.remove(this.get(this.currentHistoryId));\n\t _collectionSuper.prototype.sort.call(this, _.defaults({ silent: true }, options));\n\t this.unshift(currentHistory, { silent: true });\n\t if (!silent) {\n\t this.trigger('sort', this, options);\n\t }\n\t return this;\n\t },\n\t\n\t /** create a new history and by default set it to be the current history */\n\t create: function create(data, hdas, historyOptions, xhrOptions) {\n\t //TODO: .create is actually a collection function that's overridden here\n\t var collection = this,\n\t xhr = jQuery.getJSON(Galaxy.root + 'history/create_new_current');\n\t return xhr.done(function (newData) {\n\t collection.setCurrent(new History(newData, [], historyOptions || {}));\n\t });\n\t },\n\t\n\t /** set the current history to the given history, placing it first in the collection.\n\t * Pass standard bbone options for use in unshift.\n\t * @triggers new-current passed history and this collection\n\t */\n\t setCurrent: function (history, options) {\n\t options = options || {};\n\t // new histories go in the front\n\t this.unshift(history, options);\n\t this.currentHistoryId = history.get('id');\n\t if (!options.silent) {\n\t this.trigger('new-current', history, this);\n\t }\n\t return this;\n\t },\n\t\n\t toString: function toString() {\n\t return 'HistoryCollection(' + this.length + ',current:' + this.currentHistoryId + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t History: History,\n\t HistoryCollection: HistoryCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ }),\n/* 66 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(7)], __WEBPACK_AMD_DEFINE_RESULT__ = function (BASE_MVC) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'history';\n\t\n\t // ============================================================================\n\t /** session storage for individual history preferences */\n\t var HistoryPrefs = BASE_MVC.SessionStorageModel.extend(\n\t /** @lends HistoryPrefs.prototype */{\n\t //TODO:?? move to user prefs?\n\t defaults: {\n\t //TODO:?? expandedIds to array?\n\t expandedIds: {},\n\t show_deleted: false,\n\t show_hidden: false\n\t },\n\t\n\t /** add an hda id to the hash of expanded hdas */\n\t addExpanded: function (model) {\n\t //TODO: use type_id and not model\n\t var current = this.get('expandedIds');\n\t current[model.id] = model.get('id');\n\t this.save('expandedIds', current);\n\t },\n\t\n\t /** remove an hda id from the hash of expanded hdas */\n\t removeExpanded: function (model) {\n\t var current = this.get('expandedIds');\n\t delete current[model.id];\n\t this.save('expandedIds', current);\n\t },\n\t\n\t isExpanded: function (contentId) {\n\t return _.result(this.get('expandedIds'), contentId, false);\n\t },\n\t\n\t allExpanded: function () {\n\t return _.values(this.get('expandedIds'));\n\t },\n\t\n\t clearExpanded: function () {\n\t this.set('expandedIds', {});\n\t },\n\t\n\t includeDeleted: function (val) {\n\t // moving the invocation here so other components don't need to know the key\n\t // TODO: change this key later\n\t if (!_.isUndefined(val)) {\n\t this.set('show_deleted', val);\n\t }\n\t return this.get('show_deleted');\n\t },\n\t\n\t includeHidden: function (val) {\n\t // TODO: change this key later\n\t if (!_.isUndefined(val)) {\n\t this.set('show_hidden', val);\n\t }\n\t return this.get('show_hidden');\n\t },\n\t\n\t toString: function () {\n\t return 'HistoryPrefs(' + this.id + ')';\n\t }\n\t\n\t }, {\n\t // ........................................................................ class vars\n\t // class lvl for access w/o instantiation\n\t storageKeyPrefix: 'history:',\n\t\n\t /** key string to store each histories settings under */\n\t historyStorageKey: function historyStorageKey(historyId) {\n\t if (!historyId) {\n\t throw new Error('HistoryPrefs.historyStorageKey needs valid id: ' + historyId);\n\t }\n\t // single point of change\n\t return HistoryPrefs.storageKeyPrefix + historyId;\n\t },\n\t\n\t /** return the existing storage for the history with the given id (or create one if it doesn't exist) */\n\t get: function get(historyId) {\n\t return new HistoryPrefs({ id: HistoryPrefs.historyStorageKey(historyId) });\n\t },\n\t\n\t /** clear all history related items in sessionStorage */\n\t clearAll: function clearAll(historyId) {\n\t for (var key in sessionStorage) {\n\t if (key.indexOf(HistoryPrefs.storageKeyPrefix) === 0) {\n\t sessionStorage.removeItem(key);\n\t }\n\t }\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HistoryPrefs: HistoryPrefs\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ }),\n/* 67 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'list';\n\t //==============================================================================\n\t /** A view which, when first rendered, shows only summary data/attributes, but\n\t * can be expanded to show further details (and optionally fetch those\n\t * details from the server).\n\t */\n\t var ExpandableView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t //TODO: Although the reasoning behind them is different, this shares a lot with HiddenUntilActivated above: combine them\n\t //PRECONDITION: model must have method hasDetails\n\t //PRECONDITION: subclasses must have templates.el and templates.details\n\t\n\t initialize: function (attributes) {\n\t /** are the details of this view expanded/shown or not? */\n\t this.expanded = attributes.expanded || false;\n\t this.log('\\t expanded:', this.expanded);\n\t this.fxSpeed = attributes.fxSpeed !== undefined ? attributes.fxSpeed : this.fxSpeed;\n\t },\n\t\n\t // ........................................................................ render main\n\t /** jq fx speed */\n\t fxSpeed: 'fast',\n\t\n\t /** Render this content, set up ui.\n\t * @param {Number or String} speed the speed of the render\n\t */\n\t render: function (speed) {\n\t var $newRender = this._buildNewRender();\n\t this._setUpBehaviors($newRender);\n\t this._queueNewRender($newRender, speed);\n\t return this;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el.\n\t * If the view is already expanded, build the details as well.\n\t */\n\t _buildNewRender: function () {\n\t // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n\t var $newRender = $(this.templates.el(this.model.toJSON(), this));\n\t if (this.expanded) {\n\t this.$details($newRender).replaceWith(this._renderDetails().show());\n\t }\n\t return $newRender;\n\t },\n\t\n\t /** Fade out the old el, swap in the new contents, then fade in.\n\t * @param {Number or String} speed jq speed to use for rendering effects\n\t * @fires rendered when rendered\n\t */\n\t _queueNewRender: function ($newRender, speed) {\n\t speed = speed === undefined ? this.fxSpeed : speed;\n\t var view = this;\n\t\n\t if (speed === 0) {\n\t view._swapNewRender($newRender);\n\t view.trigger('rendered', view);\n\t } else {\n\t $(view).queue('fx', [function (next) {\n\t view.$el.fadeOut(speed, next);\n\t }, function (next) {\n\t view._swapNewRender($newRender);\n\t next();\n\t }, function (next) {\n\t view.$el.fadeIn(speed, next);\n\t }, function (next) {\n\t view.trigger('rendered', view);\n\t next();\n\t }]);\n\t }\n\t },\n\t\n\t /** empty out the current el, move the $newRender's children in */\n\t _swapNewRender: function ($newRender) {\n\t return this.$el.empty().attr('class', _.isFunction(this.className) ? this.className() : this.className).append($newRender.children());\n\t },\n\t\n\t /** set up js behaviors, event handlers for elements within the given container\n\t * @param {jQuery} $container jq object that contains the elements to process (defaults to this.$el)\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t // set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)\n\t //make_popup_menus( $where );\n\t $where.find('[title]').tooltip({ placement: 'bottom' });\n\t },\n\t\n\t // ......................................................................... details\n\t /** shortcut to details DOM (as jQ) */\n\t $details: function ($where) {\n\t $where = $where || this.$el;\n\t return $where.find('> .details');\n\t },\n\t\n\t /** build the DOM for the details and set up behaviors on it */\n\t _renderDetails: function () {\n\t var $newDetails = $(this.templates.details(this.model.toJSON(), this));\n\t this._setUpBehaviors($newDetails);\n\t return $newDetails;\n\t },\n\t\n\t // ......................................................................... expansion/details\n\t /** Show or hide the details\n\t * @param {Boolean} expand if true, expand; if false, collapse\n\t */\n\t toggleExpanded: function (expand) {\n\t expand = expand === undefined ? !this.expanded : expand;\n\t if (expand) {\n\t this.expand();\n\t } else {\n\t this.collapse();\n\t }\n\t return this;\n\t },\n\t\n\t /** Render and show the full, detailed body of this view including extra data and controls.\n\t * note: if the model does not have detailed data, fetch that data before showing the body\n\t * @fires expanded when a body has been expanded\n\t */\n\t expand: function () {\n\t var view = this;\n\t return view._fetchModelDetails().always(function () {\n\t view._expand();\n\t });\n\t },\n\t\n\t /** Check for model details and, if none, fetch them.\n\t * @returns {jQuery.promise} the model.fetch.xhr if details are being fetched, an empty promise if not\n\t */\n\t _fetchModelDetails: function () {\n\t if (!this.model.hasDetails()) {\n\t return this.model.fetch();\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** Inner fn called when expand (public) has fetched the details */\n\t _expand: function () {\n\t var view = this,\n\t $newDetails = view._renderDetails();\n\t view.$details().replaceWith($newDetails);\n\t // needs to be set after the above or the slide will not show\n\t view.expanded = true;\n\t view.$details().slideDown(view.fxSpeed, function () {\n\t view.trigger('expanded', view);\n\t });\n\t },\n\t\n\t /** Hide the body/details of an HDA.\n\t * @fires collapsed when a body has been collapsed\n\t */\n\t collapse: function () {\n\t this.debug(this + '(ExpandableView).collapse');\n\t var view = this;\n\t view.expanded = false;\n\t this.$details().slideUp(view.fxSpeed, function () {\n\t view.trigger('collapsed', view);\n\t });\n\t }\n\t\n\t });\n\t\n\t //==============================================================================\n\t /** A view that is displayed in some larger list/grid/collection.\n\t * Inherits from Expandable, Selectable, Draggable.\n\t * The DOM contains warnings, a title bar, and a series of primary action controls.\n\t * Primary actions are meant to be easily accessible item functions (such as delete)\n\t * that are rendered in the title bar.\n\t *\n\t * Details are rendered when the user clicks the title bar or presses enter/space when\n\t * the title bar is in focus.\n\t *\n\t * Designed as a base class for history panel contents - but usable elsewhere (I hope).\n\t */\n\t var ListItemView = ExpandableView.extend(BASE_MVC.mixin(BASE_MVC.SelectableViewMixin, BASE_MVC.DraggableViewMixin, {\n\t\n\t tagName: 'div',\n\t className: 'list-item',\n\t\n\t /** Set up the base class and all mixins */\n\t initialize: function (attributes) {\n\t ExpandableView.prototype.initialize.call(this, attributes);\n\t BASE_MVC.SelectableViewMixin.initialize.call(this, attributes);\n\t BASE_MVC.DraggableViewMixin.initialize.call(this, attributes);\n\t this._setUpListeners();\n\t },\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t // hide the primary actions in the title bar when selectable and narrow\n\t this.on('selectable', function (isSelectable) {\n\t if (isSelectable) {\n\t this.$('.primary-actions').hide();\n\t } else {\n\t this.$('.primary-actions').show();\n\t }\n\t }, this);\n\t return this;\n\t },\n\t\n\t // ........................................................................ rendering\n\t /** In this override, call methods to build warnings, titlebar and primary actions */\n\t _buildNewRender: function () {\n\t var $newRender = ExpandableView.prototype._buildNewRender.call(this);\n\t $newRender.children('.warnings').replaceWith(this._renderWarnings());\n\t $newRender.children('.title-bar').replaceWith(this._renderTitleBar());\n\t $newRender.children('.primary-actions').append(this._renderPrimaryActions());\n\t $newRender.find('> .title-bar .subtitle').replaceWith(this._renderSubtitle());\n\t return $newRender;\n\t },\n\t\n\t /** In this override, render the selector controls and set up dragging before the swap */\n\t _swapNewRender: function ($newRender) {\n\t ExpandableView.prototype._swapNewRender.call(this, $newRender);\n\t if (this.selectable) {\n\t this.showSelector(0);\n\t }\n\t if (this.draggable) {\n\t this.draggableOn();\n\t }\n\t return this.$el;\n\t },\n\t\n\t /** Render any warnings the item may need to show (e.g. \"I'm deleted\") */\n\t _renderWarnings: function () {\n\t var view = this,\n\t $warnings = $('
    '),\n\t json = view.model.toJSON();\n\t //TODO:! unordered (map)\n\t _.each(view.templates.warnings, function (templateFn) {\n\t $warnings.append($(templateFn(json, view)));\n\t });\n\t return $warnings;\n\t },\n\t\n\t /** Render the title bar (the main/exposed SUMMARY dom element) */\n\t _renderTitleBar: function () {\n\t return $(this.templates.titleBar(this.model.toJSON(), this));\n\t },\n\t\n\t /** Return an array of jQ objects containing common/easily-accessible item controls */\n\t _renderPrimaryActions: function () {\n\t // override this\n\t return [];\n\t },\n\t\n\t /** Render the title bar (the main/exposed SUMMARY dom element) */\n\t _renderSubtitle: function () {\n\t return $(this.templates.subtitle(this.model.toJSON(), this));\n\t },\n\t\n\t // ......................................................................... events\n\t /** event map */\n\t events: {\n\t // expand the body when the title is clicked or when in focus and space or enter is pressed\n\t 'click .title-bar': '_clickTitleBar',\n\t 'keydown .title-bar': '_keyDownTitleBar',\n\t 'click .selector': 'toggleSelect'\n\t },\n\t\n\t /** expand when the title bar is clicked */\n\t _clickTitleBar: function (event) {\n\t event.stopPropagation();\n\t if (event.altKey) {\n\t this.toggleSelect(event);\n\t if (!this.selectable) {\n\t this.showSelector();\n\t }\n\t } else {\n\t this.toggleExpanded();\n\t }\n\t },\n\t\n\t /** expand when the title bar is in focus and enter or space is pressed */\n\t _keyDownTitleBar: function (event) {\n\t // bail (with propagation) if keydown and not space or enter\n\t var KEYCODE_SPACE = 32,\n\t KEYCODE_RETURN = 13;\n\t if (event && event.type === 'keydown' && (event.keyCode === KEYCODE_SPACE || event.keyCode === KEYCODE_RETURN)) {\n\t this.toggleExpanded();\n\t event.stopPropagation();\n\t return false;\n\t }\n\t return true;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'ListItemView(' + modelString + ')';\n\t }\n\t }));\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t ListItemView.prototype.templates = function () {\n\t\n\t var elTemplato = BASE_MVC.wrapTemplate(['
    ',\n\t // errors, messages, etc.\n\t '
    ',\n\t\n\t // multi-select checkbox\n\t '
    ', '', '
    ',\n\t // space for title bar buttons - gen. floated to the right\n\t '
    ', '
    ',\n\t\n\t // expandable area for more details\n\t '
    ', '
    ']);\n\t\n\t var warnings = {};\n\t\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t // adding a tabindex here allows focusing the title bar and the use of keydown to expand the dataset display\n\t '
    ',\n\t //TODO: prob. belongs in dataset-list-item\n\t '', '
    ', '<%- element.name %>', '
    ', '
    ', '
    '], 'element');\n\t\n\t var subtitleTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
    ']);\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
    ']);\n\t\n\t return {\n\t el: elTemplato,\n\t warnings: warnings,\n\t titleBar: titleBarTemplate,\n\t subtitle: subtitleTemplate,\n\t details: detailsTemplate\n\t };\n\t }();\n\t\n\t //==============================================================================\n\t /** A view that is displayed in some larger list/grid/collection.\n\t * *AND* can display some sub-list of it's own when expanded (e.g. dataset collections).\n\t * This list will 'foldout' when the item is expanded depending on this.foldoutStyle:\n\t * If 'foldout': will expand vertically to show the nested list\n\t * If 'drilldown': will overlay the parent list\n\t *\n\t * Inherits from ListItemView.\n\t *\n\t * _renderDetails does the work of creating this.details: a sub-view that shows the nested list\n\t */\n\t var FoldoutListItemView = ListItemView.extend({\n\t\n\t /** If 'foldout': show the sub-panel inside the expanded item\n\t * If 'drilldown': only fire events and handle by pub-sub\n\t * (allow the panel containing this item to attach it, hide itself, etc.)\n\t */\n\t foldoutStyle: 'foldout',\n\t /** Panel view class to instantiate for the sub-panel */\n\t foldoutPanelClass: null,\n\t\n\t /** override to:\n\t * add attributes foldoutStyle and foldoutPanelClass for config poly\n\t * disrespect attributes.expanded if drilldown\n\t */\n\t initialize: function (attributes) {\n\t if (this.foldoutStyle === 'drilldown') {\n\t this.expanded = false;\n\t }\n\t this.foldoutStyle = attributes.foldoutStyle || this.foldoutStyle;\n\t this.foldoutPanelClass = attributes.foldoutPanelClass || this.foldoutPanelClass;\n\t\n\t ListItemView.prototype.initialize.call(this, attributes);\n\t this.foldout = this._createFoldoutPanel();\n\t },\n\t\n\t /** in this override, attach the foldout panel when rendering details */\n\t _renderDetails: function () {\n\t if (this.foldoutStyle === 'drilldown') {\n\t return $();\n\t }\n\t var $newDetails = ListItemView.prototype._renderDetails.call(this);\n\t return this._attachFoldout(this.foldout, $newDetails);\n\t },\n\t\n\t /** In this override, handle collection expansion. */\n\t _createFoldoutPanel: function () {\n\t var model = this.model;\n\t var FoldoutClass = this._getFoldoutPanelClass(model),\n\t options = this._getFoldoutPanelOptions(model),\n\t foldout = new FoldoutClass(_.extend(options, {\n\t model: model\n\t }));\n\t return foldout;\n\t },\n\t\n\t /** Stub to return proper foldout panel class */\n\t _getFoldoutPanelClass: function () {\n\t // override\n\t return this.foldoutPanelClass;\n\t },\n\t\n\t /** Stub to return proper foldout panel options */\n\t _getFoldoutPanelOptions: function () {\n\t return {\n\t // propagate foldout style down\n\t foldoutStyle: this.foldoutStyle,\n\t fxSpeed: this.fxSpeed\n\t };\n\t },\n\t\n\t /** Render the foldout panel inside the view, hiding controls */\n\t _attachFoldout: function (foldout, $whereTo) {\n\t $whereTo = $whereTo || this.$('> .details');\n\t this.foldout = foldout.render(0);\n\t foldout.$('> .controls').hide();\n\t return $whereTo.append(foldout.$el);\n\t },\n\t\n\t /** In this override, branch on foldoutStyle to show expanded */\n\t expand: function () {\n\t var view = this;\n\t return view._fetchModelDetails().always(function () {\n\t if (view.foldoutStyle === 'foldout') {\n\t view._expand();\n\t } else if (view.foldoutStyle === 'drilldown') {\n\t view._expandByDrilldown();\n\t }\n\t });\n\t },\n\t\n\t /** For drilldown, set up close handler and fire expanded:drilldown\n\t * containing views can listen to this and handle other things\n\t * (like hiding themselves) by listening for expanded/collapsed:drilldown\n\t */\n\t _expandByDrilldown: function () {\n\t var view = this;\n\t // attachment and rendering done by listener\n\t view.listenTo(view.foldout, 'close', function () {\n\t view.trigger('collapsed:drilldown', view, view.foldout);\n\t });\n\t view.trigger('expanded:drilldown', view, view.foldout);\n\t }\n\t\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t FoldoutListItemView.prototype.templates = function () {\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate(['
    ',\n\t // override with more info (that goes above the panel)\n\t '
    '], 'collection');\n\t\n\t return _.extend({}, ListItemView.prototype.templates, {\n\t details: detailsTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t ExpandableView: ExpandableView,\n\t ListItemView: ListItemView,\n\t FoldoutListItemView: FoldoutListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ }),\n/* 68 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {/**\n\t * Model, view, and controller objects for Galaxy tools and tool panel.\n\t */\n\t\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3), __webpack_require__(27), __webpack_require__(16), __webpack_require__(47)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_, util, data, ToolForm) {\n\t 'use strict';\n\t\n\t /**\n\t * Mixin for tracking model visibility.\n\t */\n\t\n\t var VisibilityMixin = {\n\t hidden: false,\n\t\n\t show: function () {\n\t this.set(\"hidden\", false);\n\t },\n\t\n\t hide: function () {\n\t this.set(\"hidden\", true);\n\t },\n\t\n\t toggle: function () {\n\t this.set(\"hidden\", !this.get(\"hidden\"));\n\t },\n\t\n\t is_visible: function () {\n\t return !this.attributes.hidden;\n\t }\n\t\n\t };\n\t\n\t /**\n\t * A tool parameter.\n\t */\n\t var ToolParameter = Backbone.Model.extend({\n\t defaults: {\n\t name: null,\n\t label: null,\n\t type: null,\n\t value: null,\n\t html: null,\n\t num_samples: 5\n\t },\n\t\n\t initialize: function (options) {\n\t this.attributes.html = unescape(this.attributes.html);\n\t },\n\t\n\t copy: function () {\n\t return new ToolParameter(this.toJSON());\n\t },\n\t\n\t set_value: function (value) {\n\t this.set('value', value || '');\n\t }\n\t });\n\t\n\t var ToolParameterCollection = Backbone.Collection.extend({\n\t model: ToolParameter\n\t });\n\t\n\t /**\n\t * A data tool parameter.\n\t */\n\t var DataToolParameter = ToolParameter.extend({});\n\t\n\t /**\n\t * An integer tool parameter.\n\t */\n\t var IntegerToolParameter = ToolParameter.extend({\n\t set_value: function (value) {\n\t this.set('value', parseInt(value, 10));\n\t },\n\t\n\t /**\n\t * Returns samples from a tool input.\n\t */\n\t get_samples: function () {\n\t return d3.scale.linear().domain([this.get('min'), this.get('max')]).ticks(this.get('num_samples'));\n\t }\n\t });\n\t\n\t var FloatToolParameter = IntegerToolParameter.extend({\n\t set_value: function (value) {\n\t this.set('value', parseFloat(value));\n\t }\n\t });\n\t\n\t /**\n\t * A select tool parameter.\n\t */\n\t var SelectToolParameter = ToolParameter.extend({\n\t /**\n\t * Returns tool options.\n\t */\n\t get_samples: function () {\n\t return _.map(this.get('options'), function (option) {\n\t return option[0];\n\t });\n\t }\n\t });\n\t\n\t // Set up dictionary of parameter types.\n\t ToolParameter.subModelTypes = {\n\t 'integer': IntegerToolParameter,\n\t 'float': FloatToolParameter,\n\t 'data': DataToolParameter,\n\t 'select': SelectToolParameter\n\t };\n\t\n\t /**\n\t * A Galaxy tool.\n\t */\n\t var Tool = Backbone.Model.extend({\n\t // Default attributes.\n\t defaults: {\n\t id: null,\n\t name: null,\n\t description: null,\n\t target: null,\n\t inputs: [],\n\t outputs: []\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/tools',\n\t\n\t initialize: function (options) {\n\t\n\t // Set parameters.\n\t this.set('inputs', new ToolParameterCollection(_.map(options.inputs, function (p) {\n\t var p_class = ToolParameter.subModelTypes[p.type] || ToolParameter;\n\t return new p_class(p);\n\t })));\n\t },\n\t\n\t /**\n\t *\n\t */\n\t toJSON: function () {\n\t var rval = Backbone.Model.prototype.toJSON.call(this);\n\t\n\t // Convert inputs to JSON manually.\n\t rval.inputs = this.get('inputs').map(function (i) {\n\t return i.toJSON();\n\t });\n\t return rval;\n\t },\n\t\n\t /**\n\t * Removes inputs of a particular type; this is useful because not all inputs can be handled by\n\t * client and server yet.\n\t */\n\t remove_inputs: function (types) {\n\t var tool = this,\n\t incompatible_inputs = tool.get('inputs').filter(function (input) {\n\t return types.indexOf(input.get('type')) !== -1;\n\t });\n\t tool.get('inputs').remove(incompatible_inputs);\n\t },\n\t\n\t /**\n\t * Returns object copy, optionally including only inputs that can be sampled.\n\t */\n\t copy: function (only_samplable_inputs) {\n\t var copy = new Tool(this.toJSON());\n\t\n\t // Return only samplable inputs if flag is set.\n\t if (only_samplable_inputs) {\n\t var valid_inputs = new Backbone.Collection();\n\t copy.get('inputs').each(function (input) {\n\t if (input.get_samples()) {\n\t valid_inputs.push(input);\n\t }\n\t });\n\t copy.set('inputs', valid_inputs);\n\t }\n\t\n\t return copy;\n\t },\n\t\n\t apply_search_results: function (results) {\n\t _.indexOf(results, this.attributes.id) !== -1 ? this.show() : this.hide();\n\t return this.is_visible();\n\t },\n\t\n\t /**\n\t * Set a tool input's value.\n\t */\n\t set_input_value: function (name, value) {\n\t this.get('inputs').find(function (input) {\n\t return input.get('name') === name;\n\t }).set('value', value);\n\t },\n\t\n\t /**\n\t * Set many input values at once.\n\t */\n\t set_input_values: function (inputs_dict) {\n\t var self = this;\n\t _.each(_.keys(inputs_dict), function (input_name) {\n\t self.set_input_value(input_name, inputs_dict[input_name]);\n\t });\n\t },\n\t\n\t /**\n\t * Run tool; returns a Deferred that resolves to the tool's output(s).\n\t */\n\t run: function () {\n\t return this._run();\n\t },\n\t\n\t /**\n\t * Rerun tool using regions and a target dataset.\n\t */\n\t rerun: function (target_dataset, regions) {\n\t return this._run({\n\t action: 'rerun',\n\t target_dataset_id: target_dataset.id,\n\t regions: regions\n\t });\n\t },\n\t\n\t /**\n\t * Returns input dict for tool's inputs.\n\t */\n\t get_inputs_dict: function () {\n\t var input_dict = {};\n\t this.get('inputs').each(function (input) {\n\t input_dict[input.get('name')] = input.get('value');\n\t });\n\t return input_dict;\n\t },\n\t\n\t /**\n\t * Run tool; returns a Deferred that resolves to the tool's output(s).\n\t * NOTE: this method is a helper method and should not be called directly.\n\t */\n\t _run: function (additional_params) {\n\t // Create payload.\n\t var payload = _.extend({\n\t tool_id: this.id,\n\t inputs: this.get_inputs_dict()\n\t }, additional_params);\n\t\n\t // Because job may require indexing datasets, use server-side\n\t // deferred to ensure that job is run. Also use deferred that\n\t // resolves to outputs from tool.\n\t var run_deferred = $.Deferred(),\n\t ss_deferred = new util.ServerStateDeferred({\n\t ajax_settings: {\n\t url: this.urlRoot,\n\t data: JSON.stringify(payload),\n\t dataType: \"json\",\n\t contentType: 'application/json',\n\t type: \"POST\"\n\t },\n\t interval: 2000,\n\t success_fn: function (response) {\n\t return response !== \"pending\";\n\t }\n\t });\n\t\n\t // Run job and resolve run_deferred to tool outputs.\n\t $.when(ss_deferred.go()).then(function (result) {\n\t run_deferred.resolve(new data.DatasetCollection(result));\n\t });\n\t return run_deferred;\n\t }\n\t });\n\t _.extend(Tool.prototype, VisibilityMixin);\n\t\n\t /**\n\t * Tool view.\n\t */\n\t var ToolView = Backbone.View.extend({});\n\t\n\t /**\n\t * Wrap collection of tools for fast access/manipulation.\n\t */\n\t var ToolCollection = Backbone.Collection.extend({\n\t model: Tool\n\t });\n\t\n\t /**\n\t * Label or section header in tool panel.\n\t */\n\t var ToolSectionLabel = Backbone.Model.extend(VisibilityMixin);\n\t\n\t /**\n\t * Section of tool panel with elements (labels and tools).\n\t */\n\t var ToolSection = Backbone.Model.extend({\n\t defaults: {\n\t elems: [],\n\t open: false\n\t },\n\t\n\t clear_search_results: function () {\n\t _.each(this.attributes.elems, function (elt) {\n\t elt.show();\n\t });\n\t\n\t this.show();\n\t this.set(\"open\", false);\n\t },\n\t\n\t apply_search_results: function (results) {\n\t var all_hidden = true,\n\t cur_label;\n\t _.each(this.attributes.elems, function (elt) {\n\t if (elt instanceof ToolSectionLabel) {\n\t cur_label = elt;\n\t cur_label.hide();\n\t } else if (elt instanceof Tool) {\n\t if (elt.apply_search_results(results)) {\n\t all_hidden = false;\n\t if (cur_label) {\n\t cur_label.show();\n\t }\n\t }\n\t }\n\t });\n\t\n\t if (all_hidden) {\n\t this.hide();\n\t } else {\n\t this.show();\n\t this.set(\"open\", true);\n\t }\n\t }\n\t });\n\t _.extend(ToolSection.prototype, VisibilityMixin);\n\t\n\t /**\n\t * Tool search that updates results when query is changed. Result value of null\n\t * indicates that query was not run; if not null, results are from search using\n\t * query.\n\t */\n\t var ToolSearch = Backbone.Model.extend({\n\t defaults: {\n\t search_hint_string: \"search tools\",\n\t min_chars_for_search: 3,\n\t clear_btn_url: \"\",\n\t visible: true,\n\t query: \"\",\n\t results: null,\n\t // ESC (27) will clear the input field and tool search filters\n\t clear_key: 27\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/tools',\n\t\n\t initialize: function () {\n\t this.on(\"change:query\", this.do_search);\n\t },\n\t\n\t /**\n\t * Do the search and update the results.\n\t */\n\t do_search: function () {\n\t var query = this.attributes.query;\n\t\n\t // If query is too short, do not search.\n\t if (query.length < this.attributes.min_chars_for_search) {\n\t this.set(\"results\", null);\n\t return;\n\t }\n\t\n\t // Do search via AJAX.\n\t var q = query;\n\t // Stop previous ajax-request\n\t if (this.timer) {\n\t clearTimeout(this.timer);\n\t }\n\t // Start a new ajax-request in X ms\n\t $(\"#search-clear-btn\").hide();\n\t $(\"#search-spinner\").show();\n\t var self = this;\n\t this.timer = setTimeout(function () {\n\t // log the search to analytics if present\n\t if (typeof ga !== 'undefined') {\n\t ga('send', 'pageview', Galaxy.root + '?q=' + q);\n\t }\n\t $.get(self.urlRoot, { q: q }, function (data) {\n\t self.set(\"results\", data);\n\t $(\"#search-spinner\").hide();\n\t $(\"#search-clear-btn\").show();\n\t }, \"json\");\n\t }, 400);\n\t },\n\t\n\t clear_search: function () {\n\t this.set(\"query\", \"\");\n\t this.set(\"results\", null);\n\t }\n\t\n\t });\n\t _.extend(ToolSearch.prototype, VisibilityMixin);\n\t\n\t /**\n\t * Tool Panel.\n\t */\n\t var ToolPanel = Backbone.Model.extend({\n\t\n\t initialize: function (options) {\n\t this.attributes.tool_search = options.tool_search;\n\t this.attributes.tool_search.on(\"change:results\", this.apply_search_results, this);\n\t this.attributes.tools = options.tools;\n\t this.attributes.layout = new Backbone.Collection(this.parse(options.layout));\n\t },\n\t\n\t /**\n\t * Parse tool panel dictionary and return collection of tool panel elements.\n\t */\n\t parse: function (response) {\n\t // Recursive function to parse tool panel elements.\n\t var self = this,\n\t\n\t // Helper to recursively parse tool panel.\n\t parse_elt = function (elt_dict) {\n\t var type = elt_dict.model_class;\n\t // There are many types of tools; for now, anything that ends in 'Tool'\n\t // is treated as a generic tool.\n\t if (type.indexOf('Tool') === type.length - 4) {\n\t return self.attributes.tools.get(elt_dict.id);\n\t } else if (type === 'ToolSection') {\n\t // Parse elements.\n\t var elems = _.map(elt_dict.elems, parse_elt);\n\t elt_dict.elems = elems;\n\t return new ToolSection(elt_dict);\n\t } else if (type === 'ToolSectionLabel') {\n\t return new ToolSectionLabel(elt_dict);\n\t }\n\t };\n\t\n\t return _.map(response, parse_elt);\n\t },\n\t\n\t clear_search_results: function () {\n\t this.get('layout').each(function (panel_elt) {\n\t if (panel_elt instanceof ToolSection) {\n\t panel_elt.clear_search_results();\n\t } else {\n\t // Label or tool, so just show.\n\t panel_elt.show();\n\t }\n\t });\n\t },\n\t\n\t apply_search_results: function () {\n\t var results = this.get('tool_search').get('results');\n\t if (results === null) {\n\t this.clear_search_results();\n\t return;\n\t }\n\t\n\t var cur_label = null;\n\t this.get('layout').each(function (panel_elt) {\n\t if (panel_elt instanceof ToolSectionLabel) {\n\t cur_label = panel_elt;\n\t cur_label.hide();\n\t } else if (panel_elt instanceof Tool) {\n\t if (panel_elt.apply_search_results(results)) {\n\t if (cur_label) {\n\t cur_label.show();\n\t }\n\t }\n\t } else {\n\t // Starting new section, so clear current label.\n\t cur_label = null;\n\t panel_elt.apply_search_results(results);\n\t }\n\t });\n\t }\n\t });\n\t\n\t /**\n\t * View classes for Galaxy tools and tool panel.\n\t *\n\t * Views use the templates defined below for rendering. Views update as needed\n\t * based on (a) model/collection events and (b) user interactions; in this sense,\n\t * they are controllers are well and the HTML is the real view in the MVC architecture.\n\t */\n\t\n\t /**\n\t * Base view that handles visibility based on model's hidden attribute.\n\t */\n\t var BaseView = Backbone.View.extend({\n\t initialize: function () {\n\t this.model.on(\"change:hidden\", this.update_visible, this);\n\t this.update_visible();\n\t },\n\t update_visible: function () {\n\t this.model.attributes.hidden ? this.$el.hide() : this.$el.show();\n\t }\n\t });\n\t\n\t /**\n\t * Link to a tool.\n\t */\n\t var ToolLinkView = BaseView.extend({\n\t tagName: 'div',\n\t\n\t render: function () {\n\t // create element\n\t var $link = $('
    ');\n\t $link.append(templates.tool_link(this.model.toJSON()));\n\t\n\t var formStyle = this.model.get('form_style', null);\n\t // open upload dialog for upload tool\n\t if (this.model.id === 'upload1') {\n\t $link.find('a').on('click', function (e) {\n\t e.preventDefault();\n\t Galaxy.upload.show();\n\t });\n\t } else if (formStyle === 'regular') {\n\t // regular tools\n\t var self = this;\n\t $link.find('a').on('click', function (e) {\n\t e.preventDefault();\n\t Galaxy.router.push('/', { tool_id: self.model.id, version: self.model.get('version') });\n\t });\n\t }\n\t\n\t // add element\n\t this.$el.append($link);\n\t return this;\n\t }\n\t });\n\t\n\t /**\n\t * Panel label/section header.\n\t */\n\t var ToolSectionLabelView = BaseView.extend({\n\t tagName: 'div',\n\t className: 'toolPanelLabel',\n\t\n\t render: function () {\n\t this.$el.append($(\"\").text(this.model.attributes.text));\n\t return this;\n\t }\n\t });\n\t\n\t /**\n\t * Panel section.\n\t */\n\t var ToolSectionView = BaseView.extend({\n\t tagName: 'div',\n\t className: 'toolSectionWrapper',\n\t\n\t initialize: function () {\n\t BaseView.prototype.initialize.call(this);\n\t this.model.on(\"change:open\", this.update_open, this);\n\t },\n\t\n\t render: function () {\n\t // Build using template.\n\t this.$el.append(templates.panel_section(this.model.toJSON()));\n\t\n\t // Add tools to section.\n\t var section_body = this.$el.find(\".toolSectionBody\");\n\t _.each(this.model.attributes.elems, function (elt) {\n\t if (elt instanceof Tool) {\n\t var tool_view = new ToolLinkView({ model: elt, className: \"toolTitle\" });\n\t tool_view.render();\n\t section_body.append(tool_view.$el);\n\t } else if (elt instanceof ToolSectionLabel) {\n\t var label_view = new ToolSectionLabelView({ model: elt });\n\t label_view.render();\n\t section_body.append(label_view.$el);\n\t } else {\n\t // TODO: handle nested section bodies?\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t events: {\n\t 'click .toolSectionTitle > a': 'toggle'\n\t },\n\t\n\t /**\n\t * Toggle visibility of tool section.\n\t */\n\t toggle: function () {\n\t this.model.set(\"open\", !this.model.attributes.open);\n\t },\n\t\n\t /**\n\t * Update whether section is open or close.\n\t */\n\t update_open: function () {\n\t this.model.attributes.open ? this.$el.children(\".toolSectionBody\").slideDown(\"fast\") : this.$el.children(\".toolSectionBody\").slideUp(\"fast\");\n\t }\n\t });\n\t\n\t var ToolSearchView = Backbone.View.extend({\n\t tagName: 'div',\n\t id: 'tool-search',\n\t className: 'bar',\n\t\n\t events: {\n\t 'click': 'focus_and_select',\n\t 'keyup :input': 'query_changed',\n\t 'change :input': 'query_changed',\n\t 'click #search-clear-btn': 'clear'\n\t },\n\t\n\t render: function () {\n\t this.$el.append(templates.tool_search(this.model.toJSON()));\n\t if (!this.model.is_visible()) {\n\t this.$el.hide();\n\t }\n\t\n\t // Adjust top for issue 2907 depending on whether the messagebox is visible.\n\t if ($(\"#messagebox\").is(\":visible\")) {\n\t this.$el.css(\"top\", \"95px\");\n\t }\n\t\n\t this.$el.find('[title]').tooltip();\n\t return this;\n\t },\n\t\n\t focus_and_select: function () {\n\t this.$el.find(\":input\").focus().select();\n\t },\n\t\n\t clear: function () {\n\t this.model.clear_search();\n\t this.$el.find(\":input\").val('');\n\t this.focus_and_select();\n\t return false;\n\t },\n\t\n\t query_changed: function (evData) {\n\t // check for the 'clear key' (ESC) first\n\t if (this.model.attributes.clear_key && this.model.attributes.clear_key === evData.which) {\n\t this.clear();\n\t return false;\n\t }\n\t this.model.set(\"query\", this.$el.find(\":input\").val());\n\t }\n\t });\n\t\n\t /**\n\t * Tool panel view. Events triggered include:\n\t * tool_link_click(click event, tool_model)\n\t */\n\t var ToolPanelView = Backbone.View.extend({\n\t tagName: 'div',\n\t className: 'toolMenu',\n\t\n\t /**\n\t * Set up view.\n\t */\n\t initialize: function () {\n\t this.model.get('tool_search').on(\"change:results\", this.handle_search_results, this);\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t\n\t // Render search.\n\t var search_view = new ToolSearchView({ model: this.model.get('tool_search') });\n\t search_view.render();\n\t self.$el.append(search_view.$el);\n\t\n\t // Render panel.\n\t this.model.get('layout').each(function (panel_elt) {\n\t if (panel_elt instanceof ToolSection) {\n\t var section_title_view = new ToolSectionView({ model: panel_elt });\n\t section_title_view.render();\n\t self.$el.append(section_title_view.$el);\n\t } else if (panel_elt instanceof Tool) {\n\t var tool_view = new ToolLinkView({ model: panel_elt, className: \"toolTitleNoSection\" });\n\t tool_view.render();\n\t self.$el.append(tool_view.$el);\n\t } else if (panel_elt instanceof ToolSectionLabel) {\n\t var label_view = new ToolSectionLabelView({ model: panel_elt });\n\t label_view.render();\n\t self.$el.append(label_view.$el);\n\t }\n\t });\n\t\n\t // Setup tool link click eventing.\n\t self.$el.find(\"a.tool-link\").click(function (e) {\n\t // Tool id is always the first class.\n\t var tool_id = $(this).attr('class').split(/\\s+/)[0],\n\t tool = self.model.get('tools').get(tool_id);\n\t\n\t self.trigger(\"tool_link_click\", e, tool);\n\t });\n\t\n\t return this;\n\t },\n\t\n\t handle_search_results: function () {\n\t var results = this.model.get('tool_search').get('results');\n\t if (results && results.length === 0) {\n\t $(\"#search-no-results\").show();\n\t } else {\n\t $(\"#search-no-results\").hide();\n\t }\n\t }\n\t });\n\t\n\t /**\n\t * View for working with a tool: setting parameters and inputs and executing the tool.\n\t */\n\t var ToolFormView = Backbone.View.extend({\n\t className: 'toolForm',\n\t\n\t render: function () {\n\t this.$el.children().remove();\n\t this.$el.append(templates.tool_form(this.model.toJSON()));\n\t }\n\t });\n\t\n\t /**\n\t * Integrated tool menu + tool execution.\n\t */\n\t var IntegratedToolMenuAndView = Backbone.View.extend({\n\t className: 'toolMenuAndView',\n\t\n\t initialize: function () {\n\t this.tool_panel_view = new ToolPanelView({ collection: this.collection });\n\t this.tool_form_view = new ToolFormView();\n\t },\n\t\n\t render: function () {\n\t // Render and append tool panel.\n\t this.tool_panel_view.render();\n\t this.tool_panel_view.$el.css(\"float\", \"left\");\n\t this.$el.append(this.tool_panel_view.$el);\n\t\n\t // Append tool form view.\n\t this.tool_form_view.$el.hide();\n\t this.$el.append(this.tool_form_view.$el);\n\t\n\t // On tool link click, show tool.\n\t var self = this;\n\t this.tool_panel_view.on(\"tool_link_click\", function (e, tool) {\n\t // Prevents click from activating link:\n\t e.preventDefault();\n\t // Show tool that was clicked on:\n\t self.show_tool(tool);\n\t });\n\t },\n\t\n\t /**\n\t * Fetch and display tool.\n\t */\n\t show_tool: function (tool) {\n\t var self = this;\n\t tool.fetch().done(function () {\n\t self.tool_form_view.model = tool;\n\t self.tool_form_view.render();\n\t self.tool_form_view.$el.show();\n\t $('#left').width(\"650px\");\n\t });\n\t }\n\t });\n\t\n\t // TODO: move into relevant views\n\t var templates = {\n\t // the search bar at the top of the tool panel\n\t tool_search: _.template(['\" autocomplete=\"off\" type=\"text\" />', ' ',\n\t //TODO: replace with icon\n\t ''].join('')),\n\t\n\t // the category level container in the tool panel (e.g. 'Get Data', 'Text Manipulation')\n\t panel_section: _.template(['
    \">', '<%- name %>', '
    ', '
    \" class=\"toolSectionBody\" style=\"display: none;\">', '
    ', '
    '].join('')),\n\t\n\t // a single tool's link in the tool panel; will load the tool form in the center panel\n\t tool_link: _.template([' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">', '', '<% _.each( labels, function( label ){ %>', '\">', '<%- label %>', '', '<% }); %>', '', '', '<%- name %>', '', ' <%- description %>', ''].join('')),\n\t\n\t // the tool form for entering tool parameters, viewing help and executing the tool\n\t // loaded when a tool link is clicked in the tool panel\n\t tool_form: _.template(['
    <%- tool.name %> (version <%- tool.version %>)
    ', '
    ', '<% _.each( tool.inputs, function( input ){ %>', '
    ', '', '
    ', '<%= input.html %>', '
    ', '
    ', '<%- input.help %>', '
    ', '
    ', '
    ', '<% }); %>', '
    ', '
    ', '', '
    ', '
    ', '
    <% tool.help %>
    ', '
    '].join(''), { variable: 'tool' })\n\t };\n\t\n\t // Exports\n\t return {\n\t ToolParameter: ToolParameter,\n\t IntegerToolParameter: IntegerToolParameter,\n\t SelectToolParameter: SelectToolParameter,\n\t Tool: Tool,\n\t ToolCollection: ToolCollection,\n\t ToolSearch: ToolSearch,\n\t ToolPanel: ToolPanel,\n\t ToolPanelView: ToolPanelView,\n\t ToolFormView: ToolFormView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ }),\n/* 69 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This renders the content of the ftp popup **/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils) {\n\t return Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.options = Utils.merge(options, {\n\t class_add: 'upload-icon-button fa fa-square-o',\n\t class_remove: 'upload-icon-button fa fa-check-square-o',\n\t class_partial: 'upload-icon-button fa fa-minus-square-o',\n\t collection: null,\n\t onchange: function () {},\n\t onadd: function () {},\n\t onremove: function () {}\n\t });\n\t this.collection = this.options.collection;\n\t this.setElement(this._template());\n\t this.rows = [];\n\t Utils.get({\n\t url: Galaxy.root + 'api/remote_files',\n\t success: function (ftp_files) {\n\t self._fill(ftp_files);\n\t },\n\t error: function () {\n\t self._fill();\n\t }\n\t });\n\t },\n\t\n\t /** Fill table with ftp entries */\n\t _fill: function (ftp_files) {\n\t if (ftp_files && ftp_files.length > 0) {\n\t this.$('.upload-ftp-content').html($(this._templateTable()));\n\t var size = 0;\n\t for (var index in ftp_files) {\n\t this.rows.push(this._add(ftp_files[index]));\n\t size += ftp_files[index].size;\n\t }\n\t this.$('.upload-ftp-number').html(ftp_files.length + ' files');\n\t this.$('.upload-ftp-disk').html(Utils.bytesToString(size, true));\n\t if (this.collection) {\n\t var self = this;\n\t this.$('._has_collection').show();\n\t this.$select_all = this.$('.upload-selectall').addClass(this.options.class_add);\n\t this.$select_all.on('click', function () {\n\t var add = self.$select_all.hasClass(self.options.class_add);\n\t for (var index in ftp_files) {\n\t var ftp_file = ftp_files[index];\n\t var model_index = self._find(ftp_file);\n\t if (!model_index && add || model_index && !add) {\n\t self.rows[index].trigger('click');\n\t }\n\t }\n\t });\n\t this._refresh();\n\t }\n\t } else {\n\t this.$('.upload-ftp-content').html($(this._templateInfo()));\n\t }\n\t this.$('.upload-ftp-wait').hide();\n\t },\n\t\n\t /** Add file to table */\n\t _add: function (ftp_file) {\n\t var self = this;\n\t var $it = $(this._templateRow(ftp_file));\n\t var $icon = $it.find('.icon');\n\t this.$('tbody').append($it);\n\t if (this.collection) {\n\t $icon.addClass(this._find(ftp_file) ? this.options.class_remove : this.options.class_add);\n\t $it.on('click', function () {\n\t var model_index = self._find(ftp_file);\n\t $icon.removeClass();\n\t if (!model_index) {\n\t self.options.onadd(ftp_file);\n\t $icon.addClass(self.options.class_remove);\n\t } else {\n\t self.options.onremove(model_index);\n\t $icon.addClass(self.options.class_add);\n\t }\n\t self._refresh();\n\t });\n\t } else {\n\t $it.on('click', function () {\n\t self.options.onchange(ftp_file);\n\t });\n\t }\n\t return $it;\n\t },\n\t\n\t /** Refresh select all button state */\n\t _refresh: function () {\n\t var filtered = this.collection.where({ file_mode: 'ftp', enabled: true });\n\t this.$select_all.removeClass();\n\t if (filtered.length == 0) {\n\t this.$select_all.addClass(this.options.class_add);\n\t } else {\n\t this.$select_all.addClass(filtered.length == this.rows.length ? this.options.class_remove : this.options.class_partial);\n\t }\n\t },\n\t\n\t /** Get model index */\n\t _find: function (ftp_file) {\n\t var item = this.collection.findWhere({\n\t file_path: ftp_file.path,\n\t file_mode: 'ftp',\n\t enabled: true\n\t });\n\t return item && item.get('id');\n\t },\n\t\n\t /** Template of row */\n\t _templateRow: function (options) {\n\t return '' + '
    ' + '' + _.escape(options.path) + '' + '' + Utils.bytesToString(options.size) + '' + '' + options.ctime + '' + '';\n\t },\n\t\n\t /** Template of table */\n\t _templateTable: function () {\n\t return 'Available files: ' + '' + '' + '  ' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
    NameSizeCreated
    ';\n\t },\n\t\n\t /** Template of info message */\n\t _templateInfo: function () {\n\t return '
    ' + 'Your FTP directory does not contain any files.' + '
    ';\n\t },\n\t\n\t /** Template of main view */\n\t _template: function () {\n\t return '
    ' + '
    ' + '
    This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at ' + this.options.ftp_upload_site + ' using your Galaxy credentials (email address and password).
    ' + '
    ' + '
    ';\n\t }\n\t });\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 70 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This renders the content of the settings popup, allowing users to specify flags i.e. for space-to-tab conversion **/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils) {\n\t return Backbone.View.extend({\n\t options: {\n\t class_check: 'fa-check-square-o',\n\t class_uncheck: 'fa-square-o',\n\t parameters: [{\n\t id: 'space_to_tab',\n\t title: 'Convert spaces to tabs'\n\t }, {\n\t id: 'to_posix_lines',\n\t title: 'Use POSIX standard'\n\t }]\n\t },\n\t\n\t initialize: function (options) {\n\t var self = this;\n\t this.model = options.model;\n\t this.setElement($('
    ').addClass('upload-settings'));\n\t this.$el.append($('
    ').addClass('upload-settings-cover'));\n\t this.$el.append($('').addClass('upload-settings-table ui-table-striped').append(''));\n\t this.$cover = this.$('.upload-settings-cover');\n\t this.$table = this.$('.upload-settings-table > tbody');\n\t this.listenTo(this.model, 'change', this.render, this);\n\t this.model.trigger('change');\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t this.$table.empty();\n\t _.each(this.options.parameters, function (parameter) {\n\t var $checkbox = $('
    ').addClass('upload-' + parameter.id + ' upload-icon-button fa').addClass(self.model.get(parameter.id) && self.options.class_check || self.options.class_uncheck).on('click', function () {\n\t self.model.get('enabled') && self.model.set(parameter.id, !self.model.get(parameter.id));\n\t });\n\t self.$table.append($('
    ').append($('' + '' + '' + '');\n\t });\n\t $tmpl.append($table);\n\t } else {\n\t $tmpl.append('No ' + this.model.get('plural').toLowerCase() + ' have been shared with you.');\n\t }\n\t return $tmpl;\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 129 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(84), __webpack_require__(87), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET_LI_EDIT, HDA_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DATASET_LI_EDIT.DatasetListItemEdit;\n\t /** @class Editing view for HistoryDatasetAssociation.\n\t */\n\t var HDAListItemEdit = _super.extend(\n\t /** @lends HDAListItemEdit.prototype */{\n\t\n\t className: _super.prototype.className + \" history-content\",\n\t\n\t /** In this override, only get details if in the ready state, get rerunnable if in other states.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t\n\t // special case the need for the rerunnable and creating_job attributes\n\t // needed for rendering re-run button on queued, running datasets\n\t } else if (!view.model.has('rerunnable')) {\n\t return view.model.fetch({ silent: true, data: {\n\t // only fetch rerunnable and creating_job to keep overhead down\n\t keys: ['rerunnable', 'creating_job'].join(',')\n\t } });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .unhide-link': function (ev) {\n\t this.model.unhide();return false;\n\t }\n\t }),\n\t\n\t /** string rep */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDAListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t HDAListItemEdit.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t hidden: BASE_MVC.wrapTemplate(['<% if( !dataset.visible ){ %>',\n\t // add a link to unhide a dataset\n\t '
    ', _l('This dataset has been hidden'), '
    ', _l('Unhide it'), '', '
    ', '<% } %>'], 'dataset')\n\t });\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t //NOTE: *steal* the HDAListItemView titleBar\n\t titleBar: HDA_LI.HDAListItemView.prototype.templates.titleBar,\n\t warnings: warnings\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HDAListItemEdit: HDAListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 130 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(89), __webpack_require__(123), __webpack_require__(25), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HDCA_LI, DC_VIEW_EDIT, faIconButton, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = HDCA_LI.HDCAListItemView;\n\t /** @class Editing view for HistoryDatasetCollectionAssociation.\n\t */\n\t var HDCAListItemEdit = _super.extend(\n\t /** @lends HDCAListItemEdit.prototype */{\n\t\n\t /** logger used to record this.log messages, commonly set to console */\n\t //logger : console,\n\t\n\t /** Override to return editable versions of the collection panels */\n\t _getFoldoutPanelClass: function () {\n\t switch (this.model.get('collection_type')) {\n\t case 'list':\n\t return DC_VIEW_EDIT.ListCollectionViewEdit;\n\t case 'paired':\n\t return DC_VIEW_EDIT.PairCollectionViewEdit;\n\t case 'list:paired':\n\t return DC_VIEW_EDIT.ListOfPairsCollectionViewEdit;\n\t case 'list:list':\n\t return DC_VIEW_EDIT.ListOfListsCollectionViewEdit;\n\t }\n\t throw new TypeError('Uknown collection_type: ' + this.model.get('collection_type'));\n\t },\n\t\n\t // ......................................................................... delete\n\t /** In this override, add the delete button. */\n\t _renderPrimaryActions: function () {\n\t this.log(this + '._renderPrimaryActions');\n\t // render the display, edit attr and delete icon-buttons\n\t return _super.prototype._renderPrimaryActions.call(this).concat([this._renderDeleteButton()]);\n\t },\n\t\n\t /** Render icon-button to delete this collection. */\n\t _renderDeleteButton: function () {\n\t var self = this,\n\t deleted = this.model.get('deleted');\n\t return faIconButton({\n\t title: deleted ? _l('Dataset collection is already deleted') : _l('Delete'),\n\t classes: 'delete-btn',\n\t faIcon: 'fa-times',\n\t disabled: deleted,\n\t onclick: function () {\n\t // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n\t self.$el.find('.icon-btn.delete-btn').trigger('mouseout');\n\t self.model['delete']();\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... misc\n\t /** string rep */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDCAListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HDCAListItemEdit: HDCAListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }),\n/* 131 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This class renders the grid list. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(12), __webpack_require__(65), __webpack_require__(86)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, GridView, HistoryModel, historyCopyDialog) {\n\t\n\t var View = Backbone.View.extend({\n\t title: \"Histories\",\n\t initialize: function (options) {\n\t var self = this;\n\t this.setElement($('
    '));\n\t this.model = new Backbone.Model();\n\t Utils.get({\n\t url: Galaxy.root + 'history/' + options.action_id,\n\t success: function (response) {\n\t response['dict_format'] = true;\n\t _.each(response['operations'], function (operation) {\n\t if (operation.label == 'Copy') {\n\t operation.onclick = function (id) {\n\t self._showCopyDialog(id);\n\t };\n\t }\n\t });\n\t self.model.set(response);\n\t self.render();\n\t }\n\t });\n\t },\n\t\n\t render: function () {\n\t var grid = new GridView(this.model.attributes);\n\t this.$el.empty().append(grid.$el);\n\t },\n\t\n\t _showCopyDialog: function (id) {\n\t var history = new HistoryModel.History({ id: id });\n\t history.fetch().fail(function () {\n\t alert('History could not be fetched. Please contact an administrator');\n\t }).done(function () {\n\t historyCopyDialog(history, {}).done(function () {\n\t if (window.parent && window.parent.Galaxy && window.parent.Galaxy.currHistoryPanel) {\n\t window.parent.Galaxy.currHistoryPanel.loadCurrentHistory();\n\t }\n\t window.location.reload(true);\n\t });\n\t });\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 132 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(65), __webpack_require__(133), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HISTORY_MODEL, HISTORY_VIEW_EDIT, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t // ============================================================================\n\t /** session storage for history panel preferences (and to maintain state)\n\t */\n\t\n\t var HistoryViewPrefs = BASE_MVC.SessionStorageModel.extend(\n\t /** @lends HistoryViewPrefs.prototype */{\n\t defaults: {\n\t /** should the tags editor be shown or hidden initially? */\n\t tagsEditorShown: false,\n\t /** should the annotation editor be shown or hidden initially? */\n\t annotationEditorShown: false,\n\t ///** what is the currently focused content (dataset or collection) in the current history?\n\t // * (the history panel will highlight and scroll to the focused content view)\n\t // */\n\t //focusedContentId : null\n\t /** Current scroll position */\n\t scrollPosition: 0\n\t },\n\t toString: function () {\n\t return 'HistoryViewPrefs(' + JSON.stringify(this.toJSON()) + ')';\n\t }\n\t });\n\t\n\t /** key string to store panel prefs (made accessible on class so you can access sessionStorage directly) */\n\t HistoryViewPrefs.storageKey = function storageKey() {\n\t return 'history-panel';\n\t };\n\t\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t var _super = HISTORY_VIEW_EDIT.HistoryViewEdit;\n\t // used in root/index.mako\n\t /** @class View/Controller for the user's current history model as used in the history\n\t * panel (current right hand panel) of the analysis page.\n\t *\n\t * The only history panel that:\n\t * will poll for updates.\n\t * displays datasets in reverse hid order.\n\t */\n\t var CurrentHistoryView = _super.extend( /** @lends CurrentHistoryView.prototype */{\n\t\n\t className: _super.prototype.className + ' current-history-panel',\n\t\n\t /** override to use drilldown (and not foldout) for how collections are displayed */\n\t HDCAViewClass: _super.prototype.HDCAViewClass.extend({\n\t foldoutStyle: 'drilldown'\n\t }),\n\t\n\t emptyMsg: [_l('This history is empty'), '. ', _l('You can '), '', _l('load your own data'), '', _l(' or '), '', _l('get data from an external source'), ''].join(''),\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events */\n\t initialize: function (attributes) {\n\t attributes = attributes || {};\n\t\n\t // ---- persistent preferences\n\t /** maintain state / preferences over page loads */\n\t this.preferences = new HistoryViewPrefs(_.extend({\n\t id: HistoryViewPrefs.storageKey()\n\t }, _.pick(attributes, _.keys(HistoryViewPrefs.prototype.defaults))));\n\t\n\t _super.prototype.initialize.call(this, attributes);\n\t\n\t /** sub-views that will overlay this panel (collections) */\n\t this.panelStack = [];\n\t\n\t /** id of currently focused content */\n\t this.currentContentId = attributes.currentContentId || null;\n\t //NOTE: purposely not sent to localstorage since panel recreation roughly lines up with a reset of this value\n\t },\n\t\n\t /** Override to cache the current scroll position with a listener */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t\n\t var panel = this;\n\t // reset scroll position when there's a new history\n\t this.on('new-model', function () {\n\t panel.preferences.set('scrollPosition', 0);\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ loading history/item models\n\t // TODO: next three more appropriate moved to the app level\n\t /** (re-)loads the user's current history & contents w/ details */\n\t loadCurrentHistory: function () {\n\t return this.loadHistory(null, { url: Galaxy.root + 'history/current_history_json' });\n\t },\n\t\n\t /** loads a history & contents w/ details and makes them the current history */\n\t switchToHistory: function (historyId, attributes) {\n\t if (Galaxy.user.isAnonymous()) {\n\t this.trigger('error', _l('You must be logged in to switch histories'), _l('Anonymous user'));\n\t return $.when();\n\t }\n\t return this.loadHistory(historyId, { url: Galaxy.root + 'history/set_as_current?id=' + historyId });\n\t },\n\t\n\t /** creates a new history on the server and sets it as the user's current history */\n\t createNewHistory: function (attributes) {\n\t if (Galaxy.user.isAnonymous()) {\n\t this.trigger('error', _l('You must be logged in to create histories'), _l('Anonymous user'));\n\t return $.when();\n\t }\n\t return this.loadHistory(null, { url: Galaxy.root + 'history/create_new_current' });\n\t },\n\t\n\t /** release/free/shutdown old models and set up panel for new models */\n\t setModel: function (model, attributes, render) {\n\t _super.prototype.setModel.call(this, model, attributes, render);\n\t if (this.model && this.model.id) {\n\t this.log('checking for updates');\n\t this.model.checkForUpdates();\n\t }\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ history/content event listening\n\t /** listening for history events */\n\t _setUpModelListeners: function () {\n\t _super.prototype._setUpModelListeners.call(this);\n\t // re-broadcast any model change events so that listeners don't have to re-bind to each history\n\t return this.listenTo(this.model, {\n\t 'change:nice_size change:size': function () {\n\t this.trigger('history-size-change', this, this.model, arguments);\n\t },\n\t 'change:id': function () {\n\t this.once('loading-done', function () {\n\t this.model.checkForUpdates();\n\t });\n\t }\n\t });\n\t },\n\t\n\t /** listening for collection events */\n\t _setUpCollectionListeners: function () {\n\t _super.prototype._setUpCollectionListeners.call(this);\n\t // if a hidden item is created (gen. by a workflow), moves thru the updater to the ready state,\n\t // then: remove it from the collection if the panel is set to NOT show hidden datasets\n\t this.listenTo(this.collection, 'state:ready', function (model, newState, oldState) {\n\t if (!model.get('visible') && !this.collection.storage.includeHidden()) {\n\t this.removeItemView(model);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel rendering\n\t /** override to add a handler to capture the scroll position when the parent scrolls */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t // console.log( '_setUpBehaviors', this.$scrollContainer( $where ).get(0), this.$list( $where ) );\n\t // we need to call this in _setUpBehaviors which is called after render since the $el\n\t // may not be attached to $el.parent and $scrollContainer() may not work\n\t var panel = this;\n\t _super.prototype._setUpBehaviors.call(panel, $where);\n\t\n\t // cache the handler to remove and re-add so we don't pile up the handlers\n\t if (!this._debouncedScrollCaptureHandler) {\n\t this._debouncedScrollCaptureHandler = _.debounce(function scrollCapture() {\n\t // cache the scroll position (only if visible)\n\t if (panel.$el.is(':visible')) {\n\t panel.preferences.set('scrollPosition', $(this).scrollTop());\n\t }\n\t }, 40);\n\t }\n\t\n\t panel.$scrollContainer($where).off('scroll', this._debouncedScrollCaptureHandler).on('scroll', this._debouncedScrollCaptureHandler);\n\t return panel;\n\t },\n\t\n\t /** In this override, handle null models and move the search input to the top */\n\t _buildNewRender: function () {\n\t if (!this.model) {\n\t return $();\n\t }\n\t var $newRender = _super.prototype._buildNewRender.call(this);\n\t $newRender.find('.search').prependTo($newRender.find('> .controls'));\n\t this._renderQuotaMessage($newRender);\n\t return $newRender;\n\t },\n\t\n\t /** render the message displayed when a user is over quota and can't run jobs */\n\t _renderQuotaMessage: function ($whereTo) {\n\t $whereTo = $whereTo || this.$el;\n\t return $(this.templates.quotaMsg({}, this)).prependTo($whereTo.find('.messages'));\n\t },\n\t\n\t /** In this override, get and set current panel preferences when editor is used */\n\t _renderTags: function ($where) {\n\t var panel = this;\n\t // render tags and show/hide based on preferences\n\t _super.prototype._renderTags.call(panel, $where);\n\t if (panel.preferences.get('tagsEditorShown')) {\n\t panel.tagsEditor.toggle(true);\n\t }\n\t // store preference when shown or hidden\n\t panel.listenTo(panel.tagsEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden', function (tagsEditor) {\n\t panel.preferences.set('tagsEditorShown', tagsEditor.hidden);\n\t });\n\t },\n\t\n\t /** In this override, get and set current panel preferences when editor is used */\n\t _renderAnnotation: function ($where) {\n\t var panel = this;\n\t // render annotation and show/hide based on preferences\n\t _super.prototype._renderAnnotation.call(panel, $where);\n\t if (panel.preferences.get('annotationEditorShown')) {\n\t panel.annotationEditor.toggle(true);\n\t }\n\t // store preference when shown or hidden\n\t panel.listenTo(panel.annotationEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden', function (annotationEditor) {\n\t panel.preferences.set('annotationEditorShown', annotationEditor.hidden);\n\t });\n\t },\n\t\n\t /** Override to scroll to cached position (in prefs) after swapping */\n\t _swapNewRender: function ($newRender) {\n\t _super.prototype._swapNewRender.call(this, $newRender);\n\t var panel = this;\n\t _.delay(function () {\n\t var pos = panel.preferences.get('scrollPosition');\n\t if (pos) {\n\t panel.scrollTo(pos, 0);\n\t }\n\t }, 10);\n\t //TODO: is this enough of a delay on larger histories?\n\t\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** Override to add the current-content highlight class to currentContentId's view */\n\t _attachItems: function ($whereTo) {\n\t _super.prototype._attachItems.call(this, $whereTo);\n\t var panel = this;\n\t if (panel.currentContentId) {\n\t panel._setCurrentContentById(panel.currentContentId);\n\t }\n\t return this;\n\t },\n\t\n\t /** Override to remove any drill down panels */\n\t addItemView: function (model, collection, options) {\n\t var view = _super.prototype.addItemView.call(this, model, collection, options);\n\t if (!view) {\n\t return view;\n\t }\n\t if (this.panelStack.length) {\n\t return this._collapseDrilldownPanel();\n\t }\n\t return view;\n\t },\n\t\n\t // ------------------------------------------------------------------------ collection sub-views\n\t /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t _super.prototype._setUpItemViewListeners.call(panel, view);\n\t // use pub-sub to: handle drilldown expansion and collapse\n\t return panel.listenTo(view, {\n\t 'expanded:drilldown': function (v, drilldown) {\n\t this._expandDrilldownPanel(drilldown);\n\t },\n\t 'collapsed:drilldown': function (v, drilldown) {\n\t this._collapseDrilldownPanel(drilldown);\n\t }\n\t });\n\t },\n\t\n\t /** display 'current content': add a visible highlight and store the id of a content item */\n\t setCurrentContent: function (view) {\n\t this.$('.history-content.current-content').removeClass('current-content');\n\t if (view) {\n\t view.$el.addClass('current-content');\n\t this.currentContentId = view.model.id;\n\t } else {\n\t this.currentContentId = null;\n\t }\n\t },\n\t\n\t /** find the view with the id and then call setCurrentContent on it */\n\t _setCurrentContentById: function (id) {\n\t var view = this.viewFromModelId(id) || null;\n\t this.setCurrentContent(view);\n\t },\n\t\n\t /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n\t _expandDrilldownPanel: function (drilldown) {\n\t this.panelStack.push(drilldown);\n\t // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n\t this.$controls().add(this.$list()).hide();\n\t drilldown.parentName = this.model.get('name');\n\t drilldown.delegateEvents().render().$el.appendTo(this.$el);\n\t },\n\t\n\t /** Handle drilldown close by freeing the panel and re-rendering this panel */\n\t _collapseDrilldownPanel: function (drilldown) {\n\t this.panelStack.pop();\n\t //TODO: MEM: free the panel\n\t this.$controls().add(this.$list()).show();\n\t },\n\t\n\t // ........................................................................ panel events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t // the two links in the empty message\n\t 'click .uploader-link': function (ev) {\n\t Galaxy.upload.show(ev);\n\t },\n\t 'click .get-data-link': function (ev) {\n\t var $toolMenu = $('.toolMenuContainer');\n\t $toolMenu.parent().scrollTop(0);\n\t $toolMenu.find('span:contains(\"Get Data\")').click();\n\t }\n\t }),\n\t\n\t // ........................................................................ external objects/MVC\n\t listenToGalaxy: function (galaxy) {\n\t this.listenTo(galaxy, {\n\t // when the galaxy_main iframe is loaded with a new page,\n\t // compare the url to the following list and if there's a match\n\t // pull the id from url and indicate in the history view that\n\t // the dataset with that id is the 'current'ly active dataset\n\t 'center-frame:load': function (data) {\n\t var pathToMatch = data.fullpath;\n\t var hdaId = null;\n\t var useToURLRegexMap = {\n\t 'display': /datasets\\/([a-f0-9]+)\\/display/,\n\t 'edit': /datasets\\/([a-f0-9]+)\\/edit/,\n\t 'report_error': /dataset\\/errors\\?id=([a-f0-9]+)/,\n\t 'rerun': /tool_runner\\/rerun\\?id=([a-f0-9]+)/,\n\t 'show_params': /datasets\\/([a-f0-9]+)\\/show_params/\n\t // no great way to do this here? (leave it in the dataset event handlers above?)\n\t // 'visualization' : 'visualization',\n\t };\n\t _.find(useToURLRegexMap, function (regex, use) {\n\t // grab the more specific match result (1), save, and use it as the find flag\n\t hdaId = _.result(pathToMatch.match(regex), 1);\n\t return hdaId;\n\t });\n\t // need to type mangle to go from web route to history contents\n\t this._setCurrentContentById(hdaId ? 'dataset-' + hdaId : null);\n\t },\n\t // when the center panel is given a new view, clear the current indicator\n\t 'center-panel:load': function (view) {\n\t this._setCurrentContentById();\n\t }\n\t });\n\t },\n\t\n\t //TODO: remove quota meter from panel and remove this\n\t /** add listeners to an external quota meter (mvc/user/user-quotameter.js) */\n\t connectToQuotaMeter: function (quotaMeter) {\n\t if (!quotaMeter) {\n\t return this;\n\t }\n\t // show/hide the 'over quota message' in the history when the meter tells it to\n\t this.listenTo(quotaMeter, 'quota:over', this.showQuotaMessage);\n\t this.listenTo(quotaMeter, 'quota:under', this.hideQuotaMessage);\n\t\n\t // having to add this to handle re-render of hview while overquota (the above do not fire)\n\t this.on('rendered rendered:initial', function () {\n\t if (quotaMeter && quotaMeter.isOverQuota()) {\n\t this.showQuotaMessage();\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** Override to preserve the quota message */\n\t clearMessages: function (ev) {\n\t var $target = !_.isUndefined(ev) ? $(ev.currentTarget) : this.$messages().children('[class$=\"message\"]');\n\t $target = $target.not('.quota-message');\n\t $target.fadeOut(this.fxSpeed, function () {\n\t $(this).remove();\n\t });\n\t return this;\n\t },\n\t\n\t /** Show the over quota message (which happens to be in the history panel).\n\t */\n\t showQuotaMessage: function () {\n\t var $msg = this.$('.quota-message');\n\t if ($msg.is(':hidden')) {\n\t $msg.slideDown(this.fxSpeed);\n\t }\n\t },\n\t\n\t /** Hide the over quota message (which happens to be in the history panel).\n\t */\n\t hideQuotaMessage: function () {\n\t var $msg = this.$('.quota-message');\n\t if (!$msg.is(':hidden')) {\n\t $msg.slideUp(this.fxSpeed);\n\t }\n\t },\n\t\n\t // ........................................................................ options menu\n\t //TODO: remove to batch\n\t /** unhide any hidden datasets */\n\t unhideHidden: function () {\n\t var self = this;\n\t if (confirm(_l('Really unhide all hidden datasets?'))) {\n\t // get all hidden, regardless of deleted/purged\n\t return self.model.contents._filterAndUpdate({ visible: false, deleted: '', purged: '' }, { visible: true }).done(function () {\n\t // TODO: would be better to render these as they're unhidden instead of all at once\n\t if (!self.model.contents.includeHidden) {\n\t self.renderItems();\n\t }\n\t });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** delete any hidden datasets */\n\t deleteHidden: function () {\n\t var self = this;\n\t if (confirm(_l('Really delete all hidden datasets?'))) {\n\t return self.model.contents._filterAndUpdate(\n\t // get all hidden, regardless of deleted/purged\n\t { visible: false, deleted: '', purged: '' },\n\t // both delete *and* unhide them\n\t { deleted: true, visible: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** Return a string rep of the history */\n\t toString: function () {\n\t return 'CurrentHistoryView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t CurrentHistoryView.prototype.templates = function () {\n\t\n\t var quotaMsgTemplate = BASE_MVC.wrapTemplate(['
    ', _l('You are over your disk quota'), '. ', _l('Tool execution is on hold until your disk usage drops below your allocated quota'), '.', '
    '], 'history');\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t quotaMsg: quotaMsgTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t CurrentHistoryView: CurrentHistoryView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ }),\n/* 133 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, _, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(134), __webpack_require__(64), __webpack_require__(17), __webpack_require__(88), __webpack_require__(129), __webpack_require__(130), __webpack_require__(45), __webpack_require__(80), __webpack_require__(60), __webpack_require__(125), __webpack_require__(124), __webpack_require__(25), __webpack_require__(18), __webpack_require__(7), __webpack_require__(6), __webpack_require__(24)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HISTORY_VIEW, HISTORY_CONTENTS, STATES, HDA_MODEL, HDA_LI_EDIT, HDCA_LI_EDIT, TAGS, ANNOTATIONS, LIST_COLLECTION_CREATOR, PAIR_COLLECTION_CREATOR, LIST_OF_PAIRS_COLLECTION_CREATOR, faIconButton, PopupMenu, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t\n\t var _super = HISTORY_VIEW.HistoryView;\n\t // base class for history-view-edit-current and used as-is in history/view.mako\n\t /** @class Editable View/Controller for the history model.\n\t *\n\t * Allows:\n\t * (everything HistoryView allows)\n\t * changing the name\n\t * displaying and editing tags and annotations\n\t * multi-selection and operations on mulitple content items\n\t */\n\t var HistoryViewEdit = _super.extend(\n\t /** @lends HistoryViewEdit.prototype */{\n\t\n\t /** class to use for constructing the HistoryDatasetAssociation views */\n\t HDAViewClass: HDA_LI_EDIT.HDAListItemEdit,\n\t /** class to use for constructing the HistoryDatasetCollectionAssociation views */\n\t HDCAViewClass: HDCA_LI_EDIT.HDCAListItemEdit,\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes\n\t */\n\t initialize: function (attributes) {\n\t attributes = attributes || {};\n\t _super.prototype.initialize.call(this, attributes);\n\t\n\t // ---- set up instance vars\n\t /** editor for tags - sub-view */\n\t this.tagsEditor = null;\n\t\n\t /** enable drag and drop - sub-view */\n\t this.dragItems = true;\n\t\n\t /** editor for annotations - sub-view */\n\t this.annotationEditor = null;\n\t\n\t /** allow user purge of dataset files? */\n\t this.purgeAllowed = attributes.purgeAllowed || false;\n\t\n\t // states/modes the panel can be in\n\t /** is the panel currently showing the dataset selection controls? */\n\t this.annotationEditorShown = attributes.annotationEditorShown || false;\n\t this.tagsEditorShown = attributes.tagsEditorShown || false;\n\t },\n\t\n\t /** Override to handle history as drag-drop target */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t return this.on({\n\t 'droptarget:drop': function (ev, data) {\n\t // process whatever was dropped and re-hide the drop target\n\t this.dataDropped(data);\n\t this.dropTargetOff();\n\t },\n\t 'view:attached view:removed': function () {\n\t this._renderCounts();\n\t },\n\t 'search:loading-progress': this._renderSearchProgress,\n\t 'search:searching': this._renderSearchFindings\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ listeners\n\t /** listening for history and HDA events */\n\t _setUpModelListeners: function () {\n\t _super.prototype._setUpModelListeners.call(this);\n\t this.listenTo(this.model, 'change:size', this.updateHistoryDiskSize);\n\t return this;\n\t },\n\t\n\t /** listening for collection events */\n\t _setUpCollectionListeners: function () {\n\t _super.prototype._setUpCollectionListeners.call(this);\n\t this.listenTo(this.collection, {\n\t 'change:deleted': this._handleItemDeletedChange,\n\t 'change:visible': this._handleItemVisibleChange,\n\t 'change:purged': function (model) {\n\t // hafta get the new nice-size w/o the purged model\n\t this.model.fetch();\n\t },\n\t // loading indicators for deleted/hidden\n\t 'fetching-deleted': function (collection) {\n\t this.$('> .controls .deleted-count').html('' + _l('loading...') + '');\n\t },\n\t 'fetching-hidden': function (collection) {\n\t this.$('> .controls .hidden-count').html('' + _l('loading...') + '');\n\t },\n\t 'fetching-deleted-done fetching-hidden-done': this._renderCounts\n\t });\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel rendering\n\t /** In this override, add tag and annotation editors and a btn to toggle the selectors */\n\t _buildNewRender: function () {\n\t // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n\t var $newRender = _super.prototype._buildNewRender.call(this);\n\t if (!this.model) {\n\t return $newRender;\n\t }\n\t\n\t if (Galaxy && Galaxy.user && Galaxy.user.id && Galaxy.user.id === this.model.get('user_id')) {\n\t this._renderTags($newRender);\n\t this._renderAnnotation($newRender);\n\t }\n\t return $newRender;\n\t },\n\t\n\t /** Update the history size display (curr. upper right of panel). */\n\t updateHistoryDiskSize: function () {\n\t this.$('.history-size').text(this.model.get('nice_size'));\n\t },\n\t\n\t /** override to render counts when the items are rendered */\n\t renderItems: function ($whereTo) {\n\t var views = _super.prototype.renderItems.call(this, $whereTo);\n\t if (!this.searchFor) {\n\t this._renderCounts($whereTo);\n\t } else {\n\t this._renderSearchFindings($whereTo);\n\t }\n\t return views;\n\t },\n\t\n\t /** override to show counts, what's deleted/hidden, and links to toggle those */\n\t _renderCounts: function ($whereTo) {\n\t $whereTo = $whereTo instanceof jQuery ? $whereTo : this.$el;\n\t var html = this.templates.counts(this.model.toJSON(), this);\n\t return $whereTo.find('> .controls .subtitle').html(html);\n\t },\n\t\n\t /** render the tags sub-view controller */\n\t _renderTags: function ($where) {\n\t var panel = this;\n\t this.tagsEditor = new TAGS.TagsEditor({\n\t model: this.model,\n\t el: $where.find('.controls .tags-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // show hide sub-view tag editors when this is shown/hidden\n\t onshow: function () {\n\t panel.toggleHDATagEditors(true, panel.fxSpeed);\n\t },\n\t onhide: function () {\n\t panel.toggleHDATagEditors(false, panel.fxSpeed);\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit history tags'),\n\t classes: 'history-tag-btn',\n\t faIcon: 'fa-tags'\n\t }).appendTo($where.find('.controls .actions'))\n\t });\n\t },\n\t /** render the annotation sub-view controller */\n\t _renderAnnotation: function ($where) {\n\t var panel = this;\n\t this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n\t model: this.model,\n\t el: $where.find('.controls .annotation-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // show hide sub-view view annotation editors when this is shown/hidden\n\t onshow: function () {\n\t panel.toggleHDAAnnotationEditors(true, panel.fxSpeed);\n\t },\n\t onhide: function () {\n\t panel.toggleHDAAnnotationEditors(false, panel.fxSpeed);\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit history annotation'),\n\t classes: 'history-annotate-btn',\n\t faIcon: 'fa-comment'\n\t }).appendTo($where.find('.controls .actions'))\n\t });\n\t },\n\t\n\t /** Set up HistoryViewEdit js/widget behaviours\n\t * In this override, make the name editable\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t _super.prototype._setUpBehaviors.call(this, $where);\n\t if (!this.model) {\n\t return;\n\t }\n\t\n\t // anon users shouldn't have access to any of the following\n\t if (!Galaxy.user || Galaxy.user.isAnonymous() || Galaxy.user.id !== this.model.get('user_id')) {\n\t return;\n\t }\n\t\n\t var panel = this,\n\t nameSelector = '> .controls .name';\n\t $where.find(nameSelector).attr('title', _l('Click to rename history')).tooltip({ placement: 'bottom' }).make_text_editable({\n\t on_finish: function (newName) {\n\t var previousName = panel.model.get('name');\n\t if (newName && newName !== previousName) {\n\t panel.$el.find(nameSelector).text(newName);\n\t panel.model.save({ name: newName }).fail(function () {\n\t panel.$el.find(nameSelector).text(panel.model.previous('name'));\n\t });\n\t } else {\n\t panel.$el.find(nameSelector).text(previousName);\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** return a new popup menu for choosing a multi selection action\n\t * ajax calls made for multiple datasets are queued\n\t */\n\t multiselectActions: function () {\n\t var panel = this,\n\t actions = [{ html: _l('Hide datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.hide;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }, { html: _l('Unhide datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.unhide;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }, { html: _l('Delete datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype['delete'];\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }, { html: _l('Undelete datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.undelete;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }];\n\t if (panel.purgeAllowed) {\n\t actions.push({\n\t html: _l('Permanently delete datasets'), func: function () {\n\t if (confirm(_l('This will permanently remove the data in your datasets. Are you sure?'))) {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.purge;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }\n\t });\n\t }\n\t actions = actions.concat(panel._collectionActions());\n\t return actions;\n\t },\n\t\n\t /** */\n\t _collectionActions: function () {\n\t var panel = this;\n\t return [{ html: _l('Build Dataset List'), func: function () {\n\t panel.buildCollection(\"list\");\n\t }\n\t },\n\t // TODO: Only show quick pair if two things selected.\n\t { html: _l('Build Dataset Pair'), func: function () {\n\t panel.buildCollection(\"paired\");\n\t }\n\t }, { html: _l('Build List of Dataset Pairs'), func: function () {\n\t panel.buildCollection(\"list:paired\");\n\t }\n\t }];\n\t },\n\t\n\t buildCollection: function (collectionType, selection, hideSourceItems) {\n\t var panel = this;\n\t var selection = selection || panel.getSelectedModels();\n\t var hideSourceItems = hideSourceItems || false;\n\t var createFunc;\n\t if (collectionType == \"list\") {\n\t createFunc = LIST_COLLECTION_CREATOR.createListCollection;\n\t } else if (collectionType == \"paired\") {\n\t createFunc = PAIR_COLLECTION_CREATOR.createPairCollection;\n\t } else if (collectionType == \"list:paired\") {\n\t createFunc = LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection;\n\t } else {\n\t console.warn(\"Unknown collectionType encountered \" + collectionType);\n\t }\n\t createFunc(selection, hideSourceItems).done(function () {\n\t panel.model.refresh();\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** In this override, add purgeAllowed and whether tags/annotation editors should be shown */\n\t _getItemViewOptions: function (model) {\n\t var options = _super.prototype._getItemViewOptions.call(this, model);\n\t _.extend(options, {\n\t purgeAllowed: this.purgeAllowed,\n\t tagsEditorShown: this.tagsEditor && !this.tagsEditor.hidden,\n\t annotationEditorShown: this.annotationEditor && !this.annotationEditor.hidden\n\t });\n\t return options;\n\t },\n\t\n\t /** If this item is deleted and we're not showing deleted items, remove the view\n\t * @param {Model} the item model to check\n\t */\n\t _handleItemDeletedChange: function (itemModel) {\n\t if (itemModel.get('deleted')) {\n\t this._handleItemDeletion(itemModel);\n\t } else {\n\t this._handleItemUndeletion(itemModel);\n\t }\n\t this._renderCounts();\n\t },\n\t\n\t _handleItemDeletion: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.deleted += 1;\n\t contentsShown.active -= 1;\n\t if (!this.model.contents.includeDeleted) {\n\t this.removeItemView(itemModel);\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t _handleItemUndeletion: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.deleted -= 1;\n\t if (!this.model.contents.includeDeleted) {\n\t contentsShown.active -= 1;\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t /** If this item is hidden and we're not showing hidden items, remove the view\n\t * @param {Model} the item model to check\n\t */\n\t _handleItemVisibleChange: function (itemModel) {\n\t if (itemModel.hidden()) {\n\t this._handleItemHidden(itemModel);\n\t } else {\n\t this._handleItemUnhidden(itemModel);\n\t }\n\t this._renderCounts();\n\t },\n\t\n\t _handleItemHidden: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.hidden += 1;\n\t contentsShown.active -= 1;\n\t if (!this.model.contents.includeHidden) {\n\t this.removeItemView(itemModel);\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t _handleItemUnhidden: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.hidden -= 1;\n\t if (!this.model.contents.includeHidden) {\n\t contentsShown.active -= 1;\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t /** toggle the visibility of each content's tagsEditor applying all the args sent to this function */\n\t toggleHDATagEditors: function (showOrHide, speed) {\n\t _.each(this.views, function (view) {\n\t if (view.tagsEditor) {\n\t view.tagsEditor.toggle(showOrHide, speed);\n\t }\n\t });\n\t },\n\t\n\t /** toggle the visibility of each content's annotationEditor applying all the args sent to this function */\n\t toggleHDAAnnotationEditors: function (showOrHide, speed) {\n\t _.each(this.views, function (view) {\n\t if (view.annotationEditor) {\n\t view.annotationEditor.toggle(showOrHide, speed);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .show-selectors-btn': 'toggleSelectors',\n\t 'click .toggle-deleted-link': function (ev) {\n\t this.toggleShowDeleted();\n\t },\n\t 'click .toggle-hidden-link': function (ev) {\n\t this.toggleShowHidden();\n\t }\n\t }),\n\t\n\t // ------------------------------------------------------------------------ search\n\t _renderSearchProgress: function (limit, offset) {\n\t var stop = limit + offset;\n\t return this.$('> .controls .subtitle').html(['', _l('Searching '), stop, '/', this.model.contentsShown(), ''].join(''));\n\t },\n\t\n\t /** override to display number found in subtitle */\n\t _renderSearchFindings: function ($whereTo) {\n\t $whereTo = $whereTo instanceof jQuery ? $whereTo : this.$el;\n\t var html = this.templates.found(this.model.toJSON(), this);\n\t $whereTo.find('> .controls .subtitle').html(html);\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ as drop target\n\t /** turn all the drag and drop handlers on and add some help text above the drop area */\n\t dropTargetOn: function () {\n\t if (this.dropTarget) {\n\t return this;\n\t }\n\t this.dropTarget = true;\n\t\n\t //TODO: to init\n\t var dropHandlers = {\n\t 'dragenter': _.bind(this.dragenter, this),\n\t 'dragover': _.bind(this.dragover, this),\n\t 'dragleave': _.bind(this.dragleave, this),\n\t 'drop': _.bind(this.drop, this)\n\t };\n\t\n\t var $dropTarget = this._renderDropTarget();\n\t this.$list().before([this._renderDropTargetHelp(), $dropTarget]);\n\t for (var evName in dropHandlers) {\n\t if (dropHandlers.hasOwnProperty(evName)) {\n\t //console.debug( evName, dropHandlers[ evName ] );\n\t $dropTarget.on(evName, dropHandlers[evName]);\n\t }\n\t }\n\t return this;\n\t },\n\t\n\t /** render a box to serve as a 'drop here' area on the history */\n\t _renderDropTarget: function () {\n\t this.$('.history-drop-target').remove();\n\t return $('
    ').addClass('history-drop-target');\n\t },\n\t\n\t /** tell the user how it works */\n\t _renderDropTargetHelp: function () {\n\t this.$('.history-drop-target-help').remove();\n\t return $('
    ').addClass('history-drop-target-help').text(_l('Drag datasets here to copy them to the current history'));\n\t },\n\t\n\t /** shut down drag and drop event handlers and remove drop target */\n\t dropTargetOff: function () {\n\t if (!this.dropTarget) {\n\t return this;\n\t }\n\t //this.log( 'dropTargetOff' );\n\t this.dropTarget = false;\n\t var dropTarget = this.$('.history-drop-target').get(0);\n\t for (var evName in this._dropHandlers) {\n\t if (this._dropHandlers.hasOwnProperty(evName)) {\n\t dropTarget.off(evName, this._dropHandlers[evName]);\n\t }\n\t }\n\t this.$('.history-drop-target').remove();\n\t this.$('.history-drop-target-help').remove();\n\t return this;\n\t },\n\t /** toggle the target on/off */\n\t dropTargetToggle: function () {\n\t if (this.dropTarget) {\n\t this.dropTargetOff();\n\t } else {\n\t this.dropTargetOn();\n\t }\n\t return this;\n\t },\n\t\n\t dragenter: function (ev) {\n\t //console.debug( 'dragenter:', this, ev );\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t this.$('.history-drop-target').css('border', '2px solid black');\n\t },\n\t dragover: function (ev) {\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t },\n\t dragleave: function (ev) {\n\t //console.debug( 'dragleave:', this, ev );\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t this.$('.history-drop-target').css('border', '1px dashed black');\n\t },\n\t /** when (text) is dropped try to parse as json and trigger an event */\n\t drop: function (ev) {\n\t ev.preventDefault();\n\t //ev.stopPropagation();\n\t\n\t var self = this;\n\t var dataTransfer = ev.originalEvent.dataTransfer;\n\t var data = dataTransfer.getData(\"text\");\n\t\n\t dataTransfer.dropEffect = 'move';\n\t try {\n\t data = JSON.parse(data);\n\t } catch (err) {\n\t self.warn('error parsing JSON from drop:', data);\n\t }\n\t\n\t self.trigger('droptarget:drop', ev, data, self);\n\t return false;\n\t },\n\t\n\t /** handler that copies data into the contents */\n\t dataDropped: function (data) {\n\t var self = this;\n\t // HDA: dropping will copy it to the history\n\t if (_.isObject(data) && data.model_class === 'HistoryDatasetAssociation' && data.id) {\n\t if (self.contents.currentPage !== 0) {\n\t return self.contents.fetchPage(0).then(function () {\n\t return self.model.contents.copy(data.id);\n\t });\n\t }\n\t return self.model.contents.copy(data.id);\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t // ........................................................................ misc\n\t /** Return a string rep of the history */\n\t toString: function () {\n\t return 'HistoryViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t HistoryViewEdit.prototype.templates = function () {\n\t\n\t var countsTemplate = BASE_MVC.wrapTemplate(['<% var shown = Math.max( view.views.length, history.contents_active.active ) %>', '<% if( shown ){ %>', '', '<%- shown %> ', _l('shown'), '', '<% } %>', '<% if( history.contents_active.deleted ){ %>', '', '<% if( view.model.contents.includeDeleted ){ %>', '', _l('hide deleted'), '', '<% } else { %>', '<%- history.contents_active.deleted %> ', '', _l('deleted'), '', '<% } %>', '', '<% } %>', '<% if( history.contents_active.hidden ){ %>', '', '<% if( view.model.contents.includeHidden ){ %>', '', _l('hide hidden'), '', '<% } else { %>', '<%- history.contents_active.hidden %> ', '', _l('hidden'), '', '<% } %>', '', '<% } %>'], 'history');\n\t\n\t var foundTemplate = BASE_MVC.wrapTemplate([_l('Found'), ' <%- view.views.length %>, ', '<% if( history.contents_active.deleted ){ %>', '<% if( view.model.contents.includeDeleted ){ %>', '', _l('hide deleted'), ', ', '<% } else { %>', '', _l('show deleted'), ', ', '<% } %>', '<% } %>', '<% if( history.contents_active.hidden ){ %>', '<% if( view.model.contents.includeHidden ){ %>', '', _l('hide hidden'), '', '<% } else { %>', '', _l('show hidden'), '', '<% } %>', '<% } %>'], 'history');\n\t\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t counts: countsTemplate,\n\t found: foundTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HistoryViewEdit: HistoryViewEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ }),\n/* 134 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(91), __webpack_require__(65), __webpack_require__(64), __webpack_require__(66), __webpack_require__(87), __webpack_require__(89), __webpack_require__(95), __webpack_require__(94), __webpack_require__(25), __webpack_require__(7), __webpack_require__(6), __webpack_require__(98)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_VIEW, HISTORY_MODEL, HISTORY_CONTENTS, HISTORY_PREFS, HDA_LI, HDCA_LI, USER, ERROR_MODAL, faIconButton, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t /** @class non-editable, read-only View/Controller for a history model.\n\t * Allows:\n\t * changing the loaded history\n\t * displaying data, info, and download\n\t * tracking history attrs: size, tags, annotations, name, etc.\n\t * Does not allow:\n\t * changing the name\n\t */\n\t\n\t var _super = LIST_VIEW.ModelListPanel;\n\t var HistoryView = _super.extend(\n\t /** @lends HistoryView.prototype */{\n\t _logNamespace: 'history',\n\t\n\t /** class to use for constructing the HDA views */\n\t HDAViewClass: HDA_LI.HDAListItemView,\n\t /** class to use for constructing the HDCA views */\n\t HDCAViewClass: HDCA_LI.HDCAListItemView,\n\t /** class to used for constructing collection of sub-view models */\n\t collectionClass: HISTORY_CONTENTS.HistoryContents,\n\t /** key of attribute in model to assign to this.collection */\n\t modelCollectionKey: 'contents',\n\t\n\t tagName: 'div',\n\t className: _super.prototype.className + ' history-panel',\n\t\n\t /** string to display when the collection is empty */\n\t emptyMsg: _l('This history is empty'),\n\t /** displayed when no items match the search terms */\n\t noneFoundMsg: _l('No matching datasets found'),\n\t /** string used for search placeholder */\n\t searchPlaceholder: _l('search datasets'),\n\t\n\t /** @type {Number} ms to wait after history load to fetch/decorate hdcas with element_count */\n\t FETCH_COLLECTION_COUNTS_DELAY: 2000,\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, bind listeners.\n\t * @param {Object} attributes optional settings for the panel\n\t */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t // ---- instance vars\n\t // control contents/behavior based on where (and in what context) the panel is being used\n\t /** where should pages from links be displayed? (default to new tab/window) */\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t },\n\t\n\t /** create and return a collection for when none is initially passed */\n\t _createDefaultCollection: function () {\n\t // override\n\t return new this.collectionClass([], { history: this.model });\n\t },\n\t\n\t /** In this override, clear the update timer on the model */\n\t freeModel: function () {\n\t _super.prototype.freeModel.call(this);\n\t if (this.model) {\n\t this.model.clearUpdateTimeout();\n\t }\n\t return this;\n\t },\n\t\n\t /** create any event listeners for the panel\n\t * @fires: rendered:initial on the first render\n\t * @fires: empty-history when switching to a history with no contents or creating a new history\n\t */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t this.on({\n\t error: function (model, xhr, options, msg, details) {\n\t this.errorHandler(model, xhr, options, msg, details);\n\t },\n\t 'loading-done': function () {\n\t var self = this;\n\t // after the initial load, decorate with more time consuming fields (like HDCA element_counts)\n\t _.delay(function () {\n\t self.model.contents.fetchCollectionCounts();\n\t }, self.FETCH_COLLECTION_COUNTS_DELAY);\n\t },\n\t 'views:ready view:attached view:removed': function (view) {\n\t this._renderSelectButton();\n\t },\n\t 'view:attached': function (view) {\n\t this.scrollTo(0);\n\t }\n\t });\n\t // this.on( 'all', function(){ console.debug( arguments ); });\n\t },\n\t\n\t // ------------------------------------------------------------------------ loading history/hda models\n\t /** load the history with the given id then it's contents, sending ajax options to both */\n\t loadHistory: function (historyId, options, contentsOptions) {\n\t contentsOptions = _.extend(contentsOptions || { silent: true });\n\t this.info('loadHistory:', historyId, options, contentsOptions);\n\t var self = this;\n\t self.setModel(new HISTORY_MODEL.History({ id: historyId }));\n\t\n\t contentsOptions.silent = true;\n\t self.trigger('loading');\n\t return self.model.fetchWithContents(options, contentsOptions).always(function () {\n\t self.render();\n\t self.trigger('loading-done');\n\t });\n\t },\n\t\n\t /** convenience alias to the model. Updates the item list only (not the history) */\n\t refreshContents: function (options) {\n\t if (this.model) {\n\t return this.model.refresh(options);\n\t }\n\t // may have callbacks - so return an empty promise\n\t return $.when();\n\t },\n\t\n\t /** Override to reset web storage when the id changes (since it needs the id) */\n\t _setUpCollectionListeners: function () {\n\t _super.prototype._setUpCollectionListeners.call(this);\n\t return this.listenTo(this.collection, {\n\t // 'all' : function(){ console.log( this.collection + ':', arguments ); },\n\t 'fetching-more': function () {\n\t this._toggleContentsLoadingIndicator(true);\n\t this.$emptyMessage().hide();\n\t },\n\t 'fetching-more-done': function () {\n\t this._toggleContentsLoadingIndicator(false);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel rendering\n\t /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n\t _showLoadingIndicator: function (msg, speed, callback) {\n\t var $indicator = $('
    ');\n\t this.$el.html($indicator.text(msg).slideDown(!_.isUndefined(speed) ? speed : this.fxSpeed));\n\t },\n\t\n\t /** hide the loading indicator */\n\t _hideLoadingIndicator: function (speed) {\n\t // make speed a bit slower to compensate for slow rendering of up to 500 contents\n\t this.$('.loading-indicator').slideUp(!_.isUndefined(speed) ? speed : this.fxSpeed + 200, function () {\n\t $(this).remove();\n\t });\n\t },\n\t\n\t /** In this override, add a btn to toggle the selectors */\n\t _buildNewRender: function () {\n\t var $newRender = _super.prototype._buildNewRender.call(this);\n\t this._renderSelectButton($newRender);\n\t return $newRender;\n\t },\n\t\n\t /** button for starting select mode */\n\t _renderSelectButton: function ($where) {\n\t $where = $where || this.$el;\n\t // do not render selector option if no actions\n\t if (!this.multiselectActions().length) {\n\t return null;\n\t }\n\t // do not render (and remove even) if nothing to select\n\t if (!this.views.length) {\n\t this.hideSelectors();\n\t $where.find('.controls .actions .show-selectors-btn').remove();\n\t return null;\n\t }\n\t // don't bother rendering if there's one already\n\t var $existing = $where.find('.controls .actions .show-selectors-btn');\n\t if ($existing.length) {\n\t return $existing;\n\t }\n\t\n\t return faIconButton({\n\t title: _l('Operations on multiple datasets'),\n\t classes: 'show-selectors-btn',\n\t faIcon: 'fa-check-square-o'\n\t }).prependTo($where.find('.controls .actions'));\n\t },\n\t\n\t /** override to avoid showing intial empty message using contents_active */\n\t _renderEmptyMessage: function ($whereTo) {\n\t var self = this;\n\t var $emptyMsg = self.$emptyMessage($whereTo);\n\t\n\t var empty = self.model.get('contents_active').active <= 0;\n\t if (empty) {\n\t return $emptyMsg.empty().append(self.emptyMsg).show();\n\t } else if (self.searchFor && self.model.contents.haveSearchDetails() && !self.views.length) {\n\t return $emptyMsg.empty().append(self.noneFoundMsg).show();\n\t }\n\t $emptyMsg.hide();\n\t return $();\n\t },\n\t\n\t /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n\t $scrollContainer: function ($where) {\n\t // override or set via attributes.$scrollContainer\n\t return this.$list($where);\n\t },\n\t\n\t // ------------------------------------------------------------------------ subviews\n\t _toggleContentsLoadingIndicator: function (show) {\n\t if (!show) {\n\t this.$list().find('.contents-loading-indicator').remove();\n\t } else {\n\t this.$list().html('
    ' + '
    ');\n\t }\n\t },\n\t\n\t /** override to render pagination also */\n\t renderItems: function ($whereTo) {\n\t // console.log( this + '.renderItems-----------------', new Date() );\n\t $whereTo = $whereTo || this.$el;\n\t var self = this;\n\t var $list = self.$list($whereTo);\n\t\n\t // TODO: bootstrap hack to remove orphaned tooltips\n\t $('.tooltip').remove();\n\t\n\t $list.empty();\n\t self.views = [];\n\t\n\t var models = self._filterCollection();\n\t if (models.length) {\n\t self._renderPagination($whereTo);\n\t self.views = self._renderSomeItems(models, $list);\n\t } else {\n\t // TODO: consolidate with _renderPagination above by (???) passing in models/length?\n\t $whereTo.find('> .controls .list-pagination').empty();\n\t }\n\t self._renderEmptyMessage($whereTo).toggle(!models.length);\n\t\n\t self.trigger('views:ready', self.views);\n\t return self.views;\n\t },\n\t\n\t /** render pagination controls if not searching and contents says we're paginating */\n\t _renderPagination: function ($whereTo) {\n\t var $paginationControls = $whereTo.find('> .controls .list-pagination');\n\t if (this.searchFor || !this.model.contents.shouldPaginate()) return $paginationControls.empty();\n\t\n\t $paginationControls.html(this.templates.pagination({\n\t // pagination is 1-based for the user\n\t current: this.model.contents.currentPage + 1,\n\t last: this.model.contents.getLastPage() + 1\n\t }, this));\n\t $paginationControls.find('select.pages').tooltip();\n\t return $paginationControls;\n\t },\n\t\n\t /** render a subset of the entire collection (client-side pagination) */\n\t _renderSomeItems: function (models, $list) {\n\t var self = this;\n\t var views = [];\n\t $list.append(models.map(function (m) {\n\t var view = self._createItemView(m);\n\t views.push(view);\n\t return self._renderItemView$el(view);\n\t }));\n\t return views;\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** in this override, check if the contents would also display based on includeDeleted/hidden */\n\t _filterItem: function (model) {\n\t var self = this;\n\t var contents = self.model.contents;\n\t return (contents.includeHidden || !model.hidden()) && (contents.includeDeleted || !model.isDeletedOrPurged()) && _super.prototype._filterItem.call(self, model);\n\t },\n\t\n\t /** In this override, since history contents are mixed,\n\t * get the appropo view class based on history_content_type\n\t */\n\t _getItemViewClass: function (model) {\n\t var contentType = model.get(\"history_content_type\");\n\t switch (contentType) {\n\t case 'dataset':\n\t return this.HDAViewClass;\n\t case 'dataset_collection':\n\t return this.HDCAViewClass;\n\t }\n\t throw new TypeError('Unknown history_content_type: ' + contentType);\n\t },\n\t\n\t /** in this override, add a linktarget, and expand if id is in web storage */\n\t _getItemViewOptions: function (model) {\n\t var options = _super.prototype._getItemViewOptions.call(this, model);\n\t return _.extend(options, {\n\t linkTarget: this.linkTarget,\n\t expanded: this.model.contents.storage.isExpanded(model.id),\n\t hasUser: this.model.ownedByCurrUser()\n\t });\n\t },\n\t\n\t /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t _super.prototype._setUpItemViewListeners.call(panel, view);\n\t //TODO: send from content view: this.model.collection.storage.addExpanded\n\t // maintain a list of items whose bodies are expanded\n\t return panel.listenTo(view, {\n\t 'expanded': function (v) {\n\t panel.model.contents.storage.addExpanded(v.model);\n\t },\n\t 'collapsed': function (v) {\n\t panel.model.contents.storage.removeExpanded(v.model);\n\t }\n\t });\n\t },\n\t\n\t /** override to remove expandedIds from webstorage */\n\t collapseAll: function () {\n\t this.model.contents.storage.clearExpanded();\n\t _super.prototype.collapseAll.call(this);\n\t },\n\t\n\t // ------------------------------------------------------------------------ selection\n\t /** Override to correctly set the historyId of the new collection */\n\t getSelectedModels: function () {\n\t var collection = _super.prototype.getSelectedModels.call(this);\n\t collection.historyId = this.collection.historyId;\n\t return collection;\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .show-selectors-btn': 'toggleSelectors',\n\t 'click > .controls .prev': '_clickPrevPage',\n\t 'click > .controls .next': '_clickNextPage',\n\t 'change > .controls .pages': '_changePageSelect',\n\t // allow (error) messages to be clicked away\n\t 'click .messages [class$=message]': 'clearMessages'\n\t }),\n\t\n\t _clickPrevPage: function (ev) {\n\t this.model.clearUpdateTimeout();\n\t this.model.contents.fetchPrevPage();\n\t },\n\t\n\t _clickNextPage: function (ev) {\n\t this.model.clearUpdateTimeout();\n\t this.model.contents.fetchNextPage();\n\t },\n\t\n\t _changePageSelect: function (ev) {\n\t this.model.clearUpdateTimeout();\n\t var page = $(ev.currentTarget).val();\n\t this.model.contents.fetchPage(page);\n\t },\n\t\n\t /** Toggle and store the deleted visibility and re-render items\n\t * @returns {Boolean} new setting\n\t */\n\t toggleShowDeleted: function (show, options) {\n\t show = show !== undefined ? show : !this.model.contents.includeDeleted;\n\t var self = this;\n\t var contents = self.model.contents;\n\t contents.setIncludeDeleted(show, options);\n\t self.trigger('show-deleted', show);\n\t\n\t contents.fetchCurrentPage({ renderAll: true });\n\t return show;\n\t },\n\t\n\t /** Toggle and store whether to render explicity hidden contents\n\t * @returns {Boolean} new setting\n\t */\n\t toggleShowHidden: function (show, store, options) {\n\t // console.log( 'toggleShowHidden', show, store );\n\t show = show !== undefined ? show : !this.model.contents.includeHidden;\n\t var self = this;\n\t var contents = self.model.contents;\n\t contents.setIncludeHidden(show, options);\n\t self.trigger('show-hidden', show);\n\t\n\t contents.fetchCurrentPage({ renderAll: true });\n\t return show;\n\t },\n\t\n\t /** On the first search, if there are no details - load them, then search */\n\t _firstSearch: function (searchFor) {\n\t var self = this;\n\t var inputSelector = '> .controls .search-input';\n\t this.log('onFirstSearch', searchFor);\n\t\n\t // if the contents already have enough details to search, search and return now\n\t if (self.model.contents.haveSearchDetails()) {\n\t self.searchItems(searchFor);\n\t return;\n\t }\n\t\n\t // otherwise, load the details progressively here\n\t self.$(inputSelector).searchInput('toggle-loading');\n\t // set this now so that only results will show during progress\n\t self.searchFor = searchFor;\n\t var xhr = self.model.contents.progressivelyFetchDetails({ silent: true }).progress(function (response, limit, offset) {\n\t self.renderItems();\n\t self.trigger('search:loading-progress', limit, offset);\n\t }).always(function () {\n\t self.$el.find(inputSelector).searchInput('toggle-loading');\n\t }).done(function () {\n\t self.searchItems(searchFor, 'force');\n\t });\n\t },\n\t\n\t /** clear the search filters and show all views that are normally shown */\n\t clearSearch: function (searchFor) {\n\t var self = this;\n\t if (!self.searchFor) return self;\n\t //self.log( 'onSearchClear', self );\n\t self.searchFor = '';\n\t self.trigger('search:clear', self);\n\t self.$('> .controls .search-query').val('');\n\t // NOTE: silent + render prevents collection update event with merge only\n\t // - which causes an empty page due to event handler above\n\t self.model.contents.fetchCurrentPage({ silent: true }).done(function () {\n\t self.renderItems();\n\t });\n\t return self;\n\t },\n\t\n\t // ........................................................................ error handling\n\t /** Event handler for errors (from the panel, the history, or the history's contents)\n\t * Alternately use two strings for model and xhr to use custom message and title (respectively)\n\t * @param {Model or View} model the (Backbone) source of the error\n\t * @param {XMLHTTPRequest} xhr any ajax obj. assoc. with the error\n\t * @param {Object} options the options map commonly used with bbone ajax\n\t */\n\t errorHandler: function (model, xhr, options) {\n\t //TODO: to mixin or base model\n\t // interrupted ajax or no connection\n\t if (xhr && xhr.status === 0 && xhr.readyState === 0) {\n\t // return ERROR_MODAL.offlineErrorModal();\n\t // fail silently\n\t return;\n\t }\n\t // otherwise, leave something to report in the console\n\t this.error(model, xhr, options);\n\t // and feedback to a modal\n\t // if sent two strings (and possibly details as 'options'), use those as message and title\n\t if (_.isString(model) && _.isString(xhr)) {\n\t var message = model;\n\t var title = xhr;\n\t return ERROR_MODAL.errorModal(message, title, options);\n\t }\n\t // bad gateway\n\t // TODO: possibly to global handler\n\t if (xhr && xhr.status === 502) {\n\t return ERROR_MODAL.badGatewayErrorModal();\n\t }\n\t return ERROR_MODAL.ajaxErrorModal(model, xhr, options);\n\t },\n\t\n\t /** Remove all messages from the panel. */\n\t clearMessages: function (ev) {\n\t var $target = !_.isUndefined(ev) ? $(ev.currentTarget) : this.$messages().children('[class$=\"message\"]');\n\t $target.fadeOut(this.fxSpeed, function () {\n\t $(this).remove();\n\t });\n\t return this;\n\t },\n\t\n\t // ........................................................................ scrolling\n\t /** Scrolls the panel to show the content sub-view with the given hid.\n\t * @param {Integer} hid the hid of item to scroll into view\n\t * @returns {HistoryView} the panel\n\t */\n\t scrollToHid: function (hid) {\n\t return this.scrollToItem(_.first(this.viewsWhereModel({ hid: hid })));\n\t },\n\t\n\t // ........................................................................ misc\n\t /** utility for adding -st, -nd, -rd, -th to numbers */\n\t ordinalIndicator: function (number) {\n\t var numStr = number + '';\n\t switch (numStr.charAt(numStr.length - 1)) {\n\t case '1':\n\t return numStr + 'st';\n\t case '2':\n\t return numStr + 'nd';\n\t case '3':\n\t return numStr + 'rd';\n\t default:\n\t return numStr + 'th';\n\t }\n\t },\n\t\n\t /** Return a string rep of the history */\n\t toString: function () {\n\t return 'HistoryView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t HistoryView.prototype.templates = function () {\n\t\n\t var mainTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
    ', '
    ', '
      ', '
      ', '
      ']);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
      ', '
      ', '
      <%- history.name %>
      ', '
      ', '
      ', '
      <%- history.nice_size %>
      ', '
      ', '
      ', '<% if( history.deleted && history.purged ){ %>', '
      ', _l('This history has been purged and deleted'), '
      ', '<% } else if( history.deleted ){ %>', '
      ', _l('This history has been deleted'), '
      ', '<% } else if( history.purged ){ %>', '
      ', _l('This history has been purged'), '
      ', '<% } %>', '<% if( history.message ){ %>',\n\t // should already be localized\n\t '
      messagesmall\">', '<%= history.message.text %>', '
      ', '<% } %>', '
      ',\n\t\n\t // add tags and annotations\n\t '
      ', '
      ', '
      ', '
      ', '
      ', '
      ', '
      ', '', '', '
      ', '
      ', '
      ', '
      ', '
      ', '
      '], 'history');\n\t\n\t var paginationTemplate = BASE_MVC.wrapTemplate(['', '', ''], 'pages');\n\t\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t el: mainTemplate,\n\t controls: controlsTemplate,\n\t pagination: paginationTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HistoryView: HistoryView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ }),\n/* 135 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(18), __webpack_require__(86), __webpack_require__(7), __webpack_require__(6), __webpack_require__(44)], __WEBPACK_AMD_DEFINE_RESULT__ = function (PopupMenu, historyCopyDialog, BASE_MVC, _l, Webhooks) {\n\t\n\t 'use strict';\n\t\n\t // ============================================================================\n\t\n\t var menu = [{\n\t html: _l('History Lists'),\n\t header: true\n\t }, {\n\t html: _l('Saved Histories'),\n\t href: 'histories/list',\n\t target: '_top'\n\t\n\t }, {\n\t html: _l('Histories Shared with Me'),\n\t href: 'histories/list_shared',\n\t target: '_top'\n\t }, {\n\t html: _l('Current History'),\n\t header: true,\n\t anon: true\n\t }, {\n\t html: _l('Create New'),\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel) {\n\t Galaxy.currHistoryPanel.createNewHistory();\n\t }\n\t }\n\t }, {\n\t html: _l('Copy History'),\n\t func: function () {\n\t historyCopyDialog(Galaxy.currHistoryPanel.model).done(function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }, {\n\t html: _l('Share or Publish'),\n\t href: 'history/sharing'\n\t }, {\n\t html: _l('Show Structure'),\n\t href: 'history/display_structured',\n\t anon: true\n\t }, {\n\t html: _l('Extract Workflow'),\n\t href: 'workflow/build_from_current_history'\n\t }, {\n\t html: _l('Delete'),\n\t anon: true,\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really delete the current history?'))) {\n\t Galaxy.currHistoryPanel.model._delete().done(function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Delete Permanently'),\n\t purge: true,\n\t anon: true,\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really delete the current history permanently? This cannot be undone.'))) {\n\t Galaxy.currHistoryPanel.model.purge().done(function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Dataset Actions'),\n\t header: true,\n\t anon: true\n\t }, {\n\t html: _l('Copy Datasets'),\n\t href: 'dataset/copy_datasets'\n\t }, {\n\t html: _l('Dataset Security'),\n\t href: 'root/history_set_default_permissions'\n\t }, {\n\t html: _l('Resume Paused Jobs'),\n\t href: 'history/resume_paused_jobs?current=True',\n\t anon: true\n\t }, {\n\t html: _l('Collapse Expanded Datasets'),\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel) {\n\t Galaxy.currHistoryPanel.collapseAll();\n\t }\n\t }\n\t }, {\n\t html: _l('Unhide Hidden Datasets'),\n\t anon: true,\n\t func: function () {\n\t // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really unhide all hidden datasets?'))) {\n\t $.post(Galaxy.root + \"history/adjust_hidden\", { 'user_action': 'unhide' }, function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Delete Hidden Datasets'),\n\t anon: true,\n\t func: function () {\n\t // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really delete all hidden datasets?'))) {\n\t $.post(Galaxy.root + \"history/adjust_hidden\", { 'user_action': 'delete' }, function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Purge Deleted Datasets'),\n\t confirm: _l('Really delete all deleted datasets permanently? This cannot be undone.'),\n\t href: 'history/purge_deleted_datasets',\n\t purge: true,\n\t anon: true\n\t }, {\n\t html: _l('Downloads'),\n\t header: true\n\t }, {\n\t html: _l('Export Tool Citations'),\n\t href: 'history/citations',\n\t anon: true\n\t }, {\n\t html: _l('Export History to File'),\n\t href: 'history/export_archive?preview=True',\n\t anon: true\n\t }, {\n\t html: _l('Other Actions'),\n\t header: true\n\t }, {\n\t html: _l('Import from File'),\n\t href: 'history/import_archive'\n\t }];\n\t\n\t // Webhooks\n\t Webhooks.add({\n\t url: 'api/webhooks/history-menu/all',\n\t async: false, // (hypothetically) slows down the performance\n\t callback: function (webhooks) {\n\t var webhooks_menu = [];\n\t\n\t $.each(webhooks.models, function (index, model) {\n\t var webhook = model.toJSON();\n\t if (webhook.activate) {\n\t webhooks_menu.push({\n\t html: _l(webhook.config.title),\n\t // func: function() {},\n\t anon: true\n\t });\n\t }\n\t });\n\t\n\t if (webhooks_menu.length > 0) {\n\t webhooks_menu.unshift({\n\t html: _l('Webhooks'),\n\t header: true\n\t });\n\t $.merge(menu, webhooks_menu);\n\t }\n\t }\n\t });\n\t\n\t function buildMenu(isAnon, purgeAllowed, urlRoot) {\n\t return _.clone(menu).filter(function (menuOption) {\n\t if (isAnon && !menuOption.anon) {\n\t return false;\n\t }\n\t if (!purgeAllowed && menuOption.purge) {\n\t return false;\n\t }\n\t\n\t //TODO:?? hard-coded galaxy_main\n\t if (menuOption.href) {\n\t menuOption.href = urlRoot + menuOption.href;\n\t menuOption.target = menuOption.target || 'galaxy_main';\n\t }\n\t\n\t if (menuOption.confirm) {\n\t menuOption.func = function () {\n\t if (confirm(menuOption.confirm)) {\n\t galaxy_main.location = menuOption.href;\n\t }\n\t };\n\t }\n\t return true;\n\t });\n\t }\n\t\n\t var create = function ($button, options) {\n\t options = options || {};\n\t var isAnon = options.anonymous === undefined ? true : options.anonymous,\n\t purgeAllowed = options.purgeAllowed || false,\n\t menu = buildMenu(isAnon, purgeAllowed, Galaxy.root);\n\t //console.debug( 'menu:', menu );\n\t return new PopupMenu($button, menu);\n\t };\n\t\n\t // ============================================================================\n\t return create;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 136 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** Renders the collection uploader rows */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(43), __webpack_require__(70), __webpack_require__(21), __webpack_require__(22)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, UploadModel, UploadSettings, Popover, Select) {\n\t return Backbone.View.extend({\n\t /** Dictionary of upload states and associated icons */\n\t status_classes: {\n\t init: 'upload-icon-button fa fa-trash-o',\n\t queued: 'upload-icon fa fa-spinner fa-spin',\n\t running: 'upload-icon fa fa-spinner fa-spin',\n\t success: 'upload-icon-button fa fa-check',\n\t error: 'upload-icon-button fa fa-exclamation-triangle'\n\t },\n\t\n\t initialize: function (app, options) {\n\t var self = this;\n\t this.app = app;\n\t this.model = options.model;\n\t this.setElement(this._template(options.model));\n\t this.$mode = this.$('.upload-mode');\n\t this.$title = this.$('.upload-title-extended');\n\t this.$text = this.$('.upload-text');\n\t this.$size = this.$('.upload-size');\n\t this.$info_text = this.$('.upload-info-text');\n\t this.$info_progress = this.$('.upload-info-progress');\n\t this.$text_content = this.$('.upload-text-content');\n\t this.$symbol = this.$('.upload-symbol');\n\t this.$progress_bar = this.$('.upload-progress-bar');\n\t this.$percentage = this.$('.upload-percentage');\n\t\n\t // append popup to settings icon\n\t this.settings = new Popover.View({\n\t title: 'Upload configuration',\n\t container: this.$('.upload-settings'),\n\t placement: 'bottom'\n\t });\n\t\n\t // identify default genome and extension values\n\t var default_genome = this.app.select_genome.value();\n\t var default_extension = this.app.select_extension.value();\n\t\n\t // handle click event\n\t this.$symbol.on('click', function () {\n\t self._removeRow();\n\t });\n\t\n\t // handle text editing event\n\t this.$text_content.on('change input', function (e) {\n\t self.model.set({ 'url_paste': $(e.target).val(),\n\t 'file_size': $(e.target).val().length });\n\t });\n\t\n\t // model events\n\t this.listenTo(this.model, 'change:percentage', function () {\n\t self._refreshPercentage();\n\t });\n\t this.listenTo(this.model, 'change:status', function () {\n\t self._refreshStatus();\n\t });\n\t this.listenTo(this.model, 'change:info', function () {\n\t self._refreshInfo();\n\t });\n\t this.listenTo(this.model, 'change:file_size', function () {\n\t self._refreshFileSize();\n\t });\n\t this.listenTo(this.model, 'remove', function () {\n\t self.remove();\n\t });\n\t this.app.collection.on('reset', function () {\n\t self.remove();\n\t });\n\t },\n\t\n\t render: function () {\n\t var options = this.model.attributes;\n\t this.$title.html(_.escape(options.file_name));\n\t this.$size.html(Utils.bytesToString(options.file_size));\n\t this.$mode.removeClass().addClass('upload-mode').addClass('text-primary');\n\t if (options.file_mode == 'new') {\n\t this.$text.css({ 'width': this.$el.width() - 16 + 'px', 'top': this.$el.height() - 8 + 'px' }).show();\n\t this.$el.height(this.$el.height() - 8 + this.$text.height() + 16);\n\t this.$mode.addClass('fa fa-edit');\n\t } else if (options.file_mode == 'local') {\n\t this.$mode.addClass('fa fa-laptop');\n\t } else if (options.file_mode == 'ftp') {\n\t this.$mode.addClass('fa fa-folder-open-o');\n\t }\n\t },\n\t\n\t /** Refresh info text */\n\t _refreshInfo: function () {\n\t var info = this.model.get('info');\n\t if (info) {\n\t this.$info_text.html('Failed: ' + info).show();\n\t } else {\n\t this.$info_text.hide();\n\t }\n\t },\n\t\n\t /** Refresh percentage status */\n\t _refreshPercentage: function () {\n\t var percentage = parseInt(this.model.get('percentage'));\n\t this.$progress_bar.css({ width: percentage + '%' });\n\t this.$percentage.html(percentage != 100 ? percentage + '%' : 'Adding to history...');\n\t },\n\t\n\t /** Refresh status */\n\t _refreshStatus: function () {\n\t var status = this.model.get('status');\n\t this.$symbol.removeClass().addClass('upload-symbol').addClass(this.status_classes[status]);\n\t this.model.set('enabled', status == 'init');\n\t var enabled = this.model.get('enabled');\n\t this.$text_content.attr('disabled', !enabled);\n\t if (status == 'success') {\n\t this.$el.addClass('success');\n\t this.$percentage.html('100%');\n\t }\n\t if (status == 'error') {\n\t this.$el.addClass('danger');\n\t this.$info_progress.hide();\n\t }\n\t },\n\t\n\t /** Refresh file size */\n\t _refreshFileSize: function () {\n\t this.$size.html(Utils.bytesToString(this.model.get('file_size')));\n\t },\n\t\n\t /** Remove row */\n\t _removeRow: function () {\n\t if (['init', 'success', 'error'].indexOf(this.model.get('status')) !== -1) {\n\t this.app.collection.remove(this.model);\n\t }\n\t },\n\t\n\t /** Attach file info popup */\n\t _showSettings: function () {\n\t if (!this.settings.visible) {\n\t this.settings.empty();\n\t this.settings.append(new UploadSettings(this).$el);\n\t this.settings.show();\n\t } else {\n\t this.settings.hide();\n\t }\n\t },\n\t\n\t /** View template */\n\t _template: function (options) {\n\t return '
      ' + '' +\n '' +\n '' +\n '' +\n '' +\n '';\n },\n\n /** Template of table */\n _templateTable: function() {\n return 'Available files: ' +\n '' +\n '' +\n '  ' +\n '' +\n '' +\n '' +\n '
      ').append($checkbox)).append($('').append(parameter.title)));\n\t });\n\t this.$cover[this.model.get('enabled') && 'hide' || 'show']();\n\t }\n\t });\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 71 */,\n/* 72 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(jQuery, _) {/*\n\t galaxy upload plugins - requires FormData and XMLHttpRequest\n\t*/\n\t;(function ($) {\n\t // add event properties\n\t jQuery.event.props.push(\"dataTransfer\");\n\t\n\t /**\n\t Posts file data to the API\n\t */\n\t $.uploadpost = function (config) {\n\t // parse options\n\t var cnf = $.extend({}, {\n\t data: {},\n\t success: function () {},\n\t error: function () {},\n\t progress: function () {},\n\t url: null,\n\t maxfilesize: 2048,\n\t error_filesize: 'File exceeds 2GB. Please use a FTP client.',\n\t error_default: 'Please make sure the file is available.',\n\t error_server: 'Upload request failed.',\n\t error_login: 'Uploads require you to log in.'\n\t }, config);\n\t\n\t // link data\n\t var data = cnf.data;\n\t\n\t // check errors\n\t if (data.error_message) {\n\t cnf.error(data.error_message);\n\t return;\n\t }\n\t\n\t // construct form data\n\t var form = new FormData();\n\t for (var key in data.payload) {\n\t form.append(key, data.payload[key]);\n\t }\n\t\n\t // add files to submission\n\t var sizes = 0;\n\t for (var key in data.files) {\n\t var d = data.files[key];\n\t form.append(d.name, d.file, d.file.name);\n\t sizes += d.file.size;\n\t }\n\t\n\t // check file size, unless it's an ftp file\n\t if (sizes > 1048576 * cnf.maxfilesize) {\n\t cnf.error(cnf.error_filesize);\n\t return;\n\t }\n\t\n\t // prepare request\n\t var xhr = new XMLHttpRequest();\n\t xhr.open('POST', cnf.url, true);\n\t xhr.setRequestHeader('Accept', 'application/json');\n\t xhr.setRequestHeader('Cache-Control', 'no-cache');\n\t xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\t\n\t // captures state changes\n\t xhr.onreadystatechange = function () {\n\t // check for request completed, server connection closed\n\t if (xhr.readyState == xhr.DONE) {\n\t // parse response\n\t var response = null;\n\t var extra_info = \"\";\n\t if (xhr.responseText) {\n\t try {\n\t response = jQuery.parseJSON(xhr.responseText);\n\t extra_info = response.err_msg;\n\t } catch (e) {\n\t response = xhr.responseText;\n\t extra_info = response;\n\t }\n\t }\n\t // pass any error to the error option\n\t if (xhr.status < 200 || xhr.status > 299) {\n\t var text = xhr.statusText;\n\t if (xhr.status == 403) {\n\t text = cnf.error_login;\n\t } else if (xhr.status == 0) {\n\t text = cnf.error_server;\n\t } else if (!text) {\n\t text = cnf.error_default;\n\t }\n\t cnf.error(text + ' (' + xhr.status + '). ' + extra_info);\n\t } else {\n\t cnf.success(response);\n\t }\n\t }\n\t };\n\t\n\t // prepare upload progress\n\t xhr.upload.addEventListener('progress', function (e) {\n\t if (e.lengthComputable) {\n\t cnf.progress(Math.round(e.loaded * 100 / e.total));\n\t }\n\t }, false);\n\t\n\t // send request\n\t Galaxy.emit.debug('uploadbox::uploadpost()', 'Posting following data.', cnf);\n\t xhr.send(form);\n\t };\n\t\n\t /**\n\t Handles the upload events drag/drop etc.\n\t */\n\t $.fn.uploadinput = function (options) {\n\t // initialize\n\t var el = this;\n\t var opts = $.extend({}, {\n\t ondragover: function () {},\n\t ondragleave: function () {},\n\t onchange: function () {},\n\t multiple: false\n\t }, options);\n\t\n\t // append hidden upload field\n\t var $input = $('');\n\t el.append($input.change(function (e) {\n\t opts.onchange(e.target.files);\n\t $(this).val('');\n\t }));\n\t\n\t // drag/drop events\n\t el.on('drop', function (e) {\n\t opts.ondragleave(e);\n\t if (e.dataTransfer) {\n\t opts.onchange(e.dataTransfer.files);\n\t e.preventDefault();\n\t }\n\t });\n\t el.on('dragover', function (e) {\n\t e.preventDefault();\n\t opts.ondragover(e);\n\t });\n\t el.on('dragleave', function (e) {\n\t e.stopPropagation();\n\t opts.ondragleave(e);\n\t });\n\t\n\t // exports\n\t return {\n\t dialog: function () {\n\t $input.trigger('click');\n\t }\n\t };\n\t };\n\t\n\t /**\n\t Handles the upload queue and events such as drag/drop etc.\n\t */\n\t $.fn.uploadbox = function (options) {\n\t // parse options\n\t var opts = $.extend({}, {\n\t dragover: function () {},\n\t dragleave: function () {},\n\t announce: function (d) {},\n\t initialize: function (d) {},\n\t progress: function (d, m) {},\n\t success: function (d, m) {},\n\t error: function (d, m) {\n\t alert(m);\n\t },\n\t complete: function () {}\n\t }, options);\n\t\n\t // file queue\n\t var queue = {};\n\t\n\t // queue index/length counter\n\t var queue_index = 0;\n\t var queue_length = 0;\n\t\n\t // indicates if queue is currently running\n\t var queue_running = false;\n\t var queue_stop = false;\n\t\n\t // element\n\t var uploadinput = $(this).uploadinput({\n\t multiple: true,\n\t onchange: function (files) {\n\t add(files);\n\t },\n\t ondragover: options.ondragover,\n\t ondragleave: options.ondragleave\n\t });\n\t\n\t // add new files to upload queue\n\t function add(files) {\n\t if (files && files.length && !queue_running) {\n\t var current_index = queue_index;\n\t _.each(files, function (file, key) {\n\t if (file.mode !== 'new' && _.filter(queue, function (f) {\n\t return f.name === file.name && f.size === file.size;\n\t }).length) {\n\t file.duplicate = true;\n\t }\n\t });\n\t _.each(files, function (file) {\n\t if (!file.duplicate) {\n\t var index = String(queue_index++);\n\t queue[index] = file;\n\t opts.announce(index, queue[index]);\n\t queue_length++;\n\t }\n\t });\n\t return current_index;\n\t }\n\t }\n\t\n\t // remove file from queue\n\t function remove(index) {\n\t if (queue[index]) {\n\t delete queue[index];\n\t queue_length--;\n\t }\n\t }\n\t\n\t // process an upload, recursive\n\t function process() {\n\t // validate\n\t if (queue_length == 0 || queue_stop) {\n\t queue_stop = false;\n\t queue_running = false;\n\t opts.complete();\n\t return;\n\t } else {\n\t queue_running = true;\n\t }\n\t\n\t // get an identifier from the queue\n\t var index = -1;\n\t for (var key in queue) {\n\t index = key;\n\t break;\n\t }\n\t\n\t // get current file from queue\n\t var file = queue[index];\n\t\n\t // remove from queue\n\t remove(index);\n\t\n\t // create and submit data\n\t $.uploadpost({\n\t url: opts.url,\n\t data: opts.initialize(index),\n\t success: function (message) {\n\t opts.success(index, message);process();\n\t },\n\t error: function (message) {\n\t opts.error(index, message);process();\n\t },\n\t progress: function (percentage) {\n\t opts.progress(index, percentage);\n\t }\n\t });\n\t }\n\t\n\t /*\n\t public interface\n\t */\n\t\n\t // open file browser for selection\n\t function select() {\n\t uploadinput.dialog();\n\t }\n\t\n\t // remove all entries from queue\n\t function reset(index) {\n\t for (index in queue) {\n\t remove(index);\n\t }\n\t }\n\t\n\t // initiate upload process\n\t function start() {\n\t if (!queue_running) {\n\t queue_running = true;\n\t process();\n\t }\n\t }\n\t\n\t // stop upload process\n\t function stop() {\n\t queue_stop = true;\n\t }\n\t\n\t // set options\n\t function configure(options) {\n\t opts = $.extend({}, opts, options);\n\t return opts;\n\t }\n\t\n\t // verify browser compatibility\n\t function compatible() {\n\t return window.File && window.FormData && window.XMLHttpRequest && window.FileList;\n\t }\n\t\n\t // export functions\n\t return {\n\t 'select': select,\n\t 'add': add,\n\t 'remove': remove,\n\t 'start': start,\n\t 'stop': stop,\n\t 'reset': reset,\n\t 'configure': configure,\n\t 'compatible': compatible\n\t };\n\t };\n\t})(jQuery);\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 73 */,\n/* 74 */,\n/* 75 */,\n/* 76 */,\n/* 77 */,\n/* 78 */,\n/* 79 */,\n/* 80 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(7), __webpack_require__(6), __webpack_require__(24)], __WEBPACK_AMD_DEFINE_RESULT__ = function (baseMVC, _l) {\n\t // =============================================================================\n\t /** A view on any model that has a 'annotation' attribute\n\t */\n\t var AnnotationEditor = Backbone.View.extend(baseMVC.LoggableMixin).extend(baseMVC.HiddenUntilActivatedViewMixin).extend({\n\t\n\t tagName: 'div',\n\t className: 'annotation-display',\n\t\n\t /** Set up listeners, parse options */\n\t initialize: function (options) {\n\t options = options || {};\n\t this.tooltipConfig = options.tooltipConfig || { placement: 'bottom' };\n\t //console.debug( this, options );\n\t // only listen to the model only for changes to annotations\n\t this.listenTo(this.model, 'change:annotation', function () {\n\t this.render();\n\t });\n\t this.hiddenUntilActivated(options.$activator, options);\n\t },\n\t\n\t /** Build the DOM elements, call select to on the created input, and set up behaviors */\n\t render: function () {\n\t var view = this;\n\t this.$el.html(this._template());\n\t\n\t //TODO: handle empties better\n\t this.$annotation().make_text_editable({\n\t use_textarea: true,\n\t on_finish: function (newAnnotation) {\n\t view.$annotation().text(newAnnotation);\n\t view.model.save({ annotation: newAnnotation }, { silent: true }).fail(function () {\n\t view.$annotation().text(view.model.previous('annotation'));\n\t });\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** @returns {String} the html text used to build the view's DOM */\n\t _template: function () {\n\t var annotation = this.model.get('annotation');\n\t return [\n\t //TODO: make prompt optional\n\t '',\n\t // set up initial tags by adding as CSV to input vals (necc. to init select2)\n\t '
      ', _.escape(annotation), '
      '].join('');\n\t },\n\t\n\t /** @returns {jQuery} the main element for this view */\n\t $annotation: function () {\n\t return this.$el.find('.annotation');\n\t },\n\t\n\t /** shut down event listeners and remove this view's DOM */\n\t remove: function () {\n\t this.$annotation.off();\n\t this.stopListening(this.model);\n\t Backbone.View.prototype.remove.call(this);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return ['AnnotationEditor(', this.model + '', ')'].join('');\n\t }\n\t });\n\t // =============================================================================\n\t return {\n\t AnnotationEditor: AnnotationEditor\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3)))\n\n/***/ }),\n/* 81 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3), __webpack_require__(2), __webpack_require__(7)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_, Backbone, BASE_MVC) {\n\t 'use strict';\n\t\n\t //=============================================================================\n\t /**\n\t * A Collection that can be limited/offset/re-ordered/filtered.\n\t * @type {Backbone.Collection}\n\t */\n\t\n\t var ControlledFetchCollection = Backbone.Collection.extend({\n\t\n\t /** call setOrder on initialization to build the comparator based on options */\n\t initialize: function (models, options) {\n\t Backbone.Collection.prototype.initialize.call(this, models, options);\n\t this.setOrder(options.order || this.order, { silent: true });\n\t },\n\t\n\t /** set up to track order changes and re-sort when changed */\n\t _setUpListeners: function () {\n\t return this.on({\n\t 'changed-order': this.sort\n\t });\n\t },\n\t\n\t /** override to provide order and offsets based on instance vars, set limit if passed,\n\t * and set allFetched/fire 'all-fetched' when xhr returns\n\t */\n\t fetch: function (options) {\n\t options = this._buildFetchOptions(options);\n\t // console.log( 'fetch options:', options );\n\t return Backbone.Collection.prototype.fetch.call(this, options);\n\t },\n\t\n\t /** build ajax data/parameters from options */\n\t _buildFetchOptions: function (options) {\n\t // note: we normally want options passed in to override the defaults built here\n\t // so most of these fns will generate defaults\n\t options = _.clone(options) || {};\n\t var self = this;\n\t\n\t // jquery ajax option; allows multiple q/qv for filters (instead of 'q[]')\n\t options.traditional = true;\n\t\n\t // options.data\n\t // we keep limit, offset, etc. in options *as well as move it into data* because:\n\t // - it makes fetch calling convenient to add it to a single options map (instead of as mult. args)\n\t // - it allows the std. event handlers (for fetch, etc.) to have access\n\t // to the pagination options too\n\t // (i.e. this.on( 'sync', function( options ){ if( options.limit ){ ... } }))\n\t // however, when we send to xhr/jquery we copy them to data also so that they become API query params\n\t options.data = options.data || self._buildFetchData(options);\n\t // console.log( 'data:', options.data );\n\t\n\t // options.data.filters --> options.data.q, options.data.qv\n\t var filters = this._buildFetchFilters(options);\n\t // console.log( 'filters:', filters );\n\t if (!_.isEmpty(filters)) {\n\t _.extend(options.data, this._fetchFiltersToAjaxData(filters));\n\t }\n\t // console.log( 'data:', options.data );\n\t return options;\n\t },\n\t\n\t /** Build the dictionary to send to fetch's XHR as data */\n\t _buildFetchData: function (options) {\n\t var defaults = {};\n\t if (this.order) {\n\t defaults.order = this.order;\n\t }\n\t return _.defaults(_.pick(options, this._fetchParams), defaults);\n\t },\n\t\n\t /** These attribute keys are valid params to fetch/API-index */\n\t _fetchParams: [\n\t /** model dependent string to control the order of models returned */\n\t 'order',\n\t /** limit the number of models returned from a fetch */\n\t 'limit',\n\t /** skip this number of models when fetching */\n\t 'offset',\n\t /** what series of attributes to return (model dependent) */\n\t 'view',\n\t /** individual keys to return for the models (see api/histories.index) */\n\t 'keys'],\n\t\n\t /** add any needed filters here based on collection state */\n\t _buildFetchFilters: function (options) {\n\t // override\n\t return _.clone(options.filters || {});\n\t },\n\t\n\t /** Convert dictionary filters to qqv style arrays */\n\t _fetchFiltersToAjaxData: function (filters) {\n\t // return as a map so ajax.data can extend from it\n\t var filterMap = {\n\t q: [],\n\t qv: []\n\t };\n\t _.each(filters, function (v, k) {\n\t // don't send if filter value is empty\n\t if (v === undefined || v === '') {\n\t return;\n\t }\n\t // json to python\n\t if (v === true) {\n\t v = 'True';\n\t }\n\t if (v === false) {\n\t v = 'False';\n\t }\n\t if (v === null) {\n\t v = 'None';\n\t }\n\t // map to k/v arrays (q/qv)\n\t filterMap.q.push(k);\n\t filterMap.qv.push(v);\n\t });\n\t return filterMap;\n\t },\n\t\n\t /** override to reset allFetched flag to false */\n\t reset: function (models, options) {\n\t this.allFetched = false;\n\t return Backbone.Collection.prototype.reset.call(this, models, options);\n\t },\n\t\n\t // ........................................................................ order\n\t order: null,\n\t\n\t /** @type {Object} map of collection available sorting orders containing comparator fns */\n\t comparators: {\n\t 'update_time': BASE_MVC.buildComparator('update_time', { ascending: false }),\n\t 'update_time-asc': BASE_MVC.buildComparator('update_time', { ascending: true }),\n\t 'create_time': BASE_MVC.buildComparator('create_time', { ascending: false }),\n\t 'create_time-asc': BASE_MVC.buildComparator('create_time', { ascending: true })\n\t },\n\t\n\t /** set the order and comparator for this collection then sort with the new order\n\t * @event 'changed-order' passed the new order and the collection\n\t */\n\t setOrder: function (order, options) {\n\t options = options || {};\n\t var collection = this;\n\t var comparator = collection.comparators[order];\n\t if (_.isUndefined(comparator)) {\n\t throw new Error('unknown order: ' + order);\n\t }\n\t // if( _.isUndefined( comparator ) ){ return; }\n\t if (comparator === collection.comparator) {\n\t return;\n\t }\n\t\n\t var oldOrder = collection.order;\n\t collection.order = order;\n\t collection.comparator = comparator;\n\t\n\t if (!options.silent) {\n\t collection.trigger('changed-order', options);\n\t }\n\t return collection;\n\t }\n\t\n\t });\n\t\n\t //=============================================================================\n\t /**\n\t *\n\t */\n\t var PaginatedCollection = ControlledFetchCollection.extend({\n\t\n\t /** @type {Number} limit used for each page's fetch */\n\t limitPerPage: 500,\n\t\n\t initialize: function (models, options) {\n\t ControlledFetchCollection.prototype.initialize.call(this, models, options);\n\t this.currentPage = options.currentPage || 0;\n\t },\n\t\n\t getTotalItemCount: function () {\n\t return this.length;\n\t },\n\t\n\t shouldPaginate: function () {\n\t return this.getTotalItemCount() >= this.limitPerPage;\n\t },\n\t\n\t getLastPage: function () {\n\t return Math.floor(this.getTotalItemCount() / this.limitPerPage);\n\t },\n\t\n\t getPageCount: function () {\n\t return this.getLastPage() + 1;\n\t },\n\t\n\t getPageLimitOffset: function (pageNum) {\n\t pageNum = this.constrainPageNum(pageNum);\n\t return {\n\t limit: this.limitPerPage,\n\t offset: pageNum * this.limitPerPage\n\t };\n\t },\n\t\n\t constrainPageNum: function (pageNum) {\n\t return Math.max(0, Math.min(pageNum, this.getLastPage()));\n\t },\n\t\n\t /** fetch the next page of data */\n\t fetchPage: function (pageNum, options) {\n\t var self = this;\n\t pageNum = self.constrainPageNum(pageNum);\n\t self.currentPage = pageNum;\n\t options = _.defaults(options || {}, self.getPageLimitOffset(pageNum));\n\t\n\t self.trigger('fetching-more');\n\t return self.fetch(options).always(function () {\n\t self.trigger('fetching-more-done');\n\t });\n\t },\n\t\n\t fetchCurrentPage: function (options) {\n\t return this.fetchPage(this.currentPage, options);\n\t },\n\t\n\t fetchPrevPage: function (options) {\n\t return this.fetchPage(this.currentPage - 1, options);\n\t },\n\t\n\t fetchNextPage: function (options) {\n\t return this.fetchPage(this.currentPage + 1, options);\n\t }\n\t });\n\t\n\t //=============================================================================\n\t /**\n\t * A Collection that will load more elements without reseting.\n\t */\n\t var InfinitelyScrollingCollection = ControlledFetchCollection.extend({\n\t\n\t /** @type {Number} limit used for the first fetch (or a reset) */\n\t limitOnFirstFetch: null,\n\t /** @type {Number} limit used for each subsequent fetch */\n\t limitPerFetch: 100,\n\t\n\t initialize: function (models, options) {\n\t ControlledFetchCollection.prototype.initialize.call(this, models, options);\n\t /** @type {Integer} number of contents to return from the first fetch */\n\t this.limitOnFirstFetch = options.limitOnFirstFetch || this.limitOnFirstFetch;\n\t /** @type {Integer} limit for every fetch after the first */\n\t this.limitPerFetch = options.limitPerFetch || this.limitPerFetch;\n\t /** @type {Boolean} are all contents fetched? */\n\t this.allFetched = false;\n\t /** @type {Integer} what was the offset of the last content returned */\n\t this.lastFetched = options.lastFetched || 0;\n\t },\n\t\n\t /** build ajax data/parameters from options */\n\t _buildFetchOptions: function (options) {\n\t // options (options for backbone.fetch and jquery.ajax generally)\n\t // backbone option; false here to make fetching an addititive process\n\t options.remove = options.remove || false;\n\t return ControlledFetchCollection.prototype._buildFetchOptions.call(this, options);\n\t },\n\t\n\t /** fetch the first 'page' of data */\n\t fetchFirst: function (options) {\n\t // console.log( 'ControlledFetchCollection.fetchFirst:', options );\n\t options = options ? _.clone(options) : {};\n\t this.allFetched = false;\n\t this.lastFetched = 0;\n\t return this.fetchMore(_.defaults(options, {\n\t reset: true,\n\t limit: this.limitOnFirstFetch\n\t }));\n\t },\n\t\n\t /** fetch the next page of data */\n\t fetchMore: function (options) {\n\t // console.log( 'ControlledFetchCollection.fetchMore:', options );\n\t options = _.clone(options || {});\n\t var collection = this;\n\t\n\t // console.log( 'fetchMore, options.reset:', options.reset );\n\t if (!options.reset && collection.allFetched) {\n\t return jQuery.when();\n\t }\n\t\n\t // TODO: this fails in the edge case where\n\t // the first fetch offset === limit (limit 4, offset 4, collection.length 4)\n\t options.offset = options.reset ? 0 : options.offset || collection.lastFetched;\n\t var limit = options.limit = options.limit || collection.limitPerFetch || null;\n\t // console.log( 'fetchMore, limit:', limit, 'offset:', options.offset );\n\t\n\t collection.trigger('fetching-more');\n\t return collection.fetch(options).always(function () {\n\t collection.trigger('fetching-more-done');\n\t })\n\t // maintain allFetched flag and trigger if all were fetched this time\n\t .done(function _postFetchMore(fetchedData) {\n\t var numFetched = _.isArray(fetchedData) ? fetchedData.length : 0;\n\t collection.lastFetched += numFetched;\n\t // console.log( 'fetchMore, lastFetched:', collection.lastFetched );\n\t // anything less than a full page means we got all there is to get\n\t if (!limit || numFetched < limit) {\n\t collection.allFetched = true;\n\t collection.trigger('all-fetched', this);\n\t }\n\t });\n\t },\n\t\n\t /** fetch all the collection */\n\t fetchAll: function (options) {\n\t // whitelist options to prevent allowing limit/offset/filters\n\t // (use vanilla fetch instead)\n\t options = options || {};\n\t var self = this;\n\t options = _.pick(options, 'silent');\n\t options.filters = {};\n\t return self.fetch(options).done(function (fetchData) {\n\t self.allFetched = true;\n\t self.trigger('all-fetched', self);\n\t });\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t ControlledFetchCollection: ControlledFetchCollection,\n\t PaginatedCollection: PaginatedCollection,\n\t InfinitelyScrollingCollection: InfinitelyScrollingCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 82 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t\n\t /* For presentation-related functionality shared across collection creators.\n\t Particularily overlapping functionality related to name processing and help.\n\t */\n\t var CollectionCreatorMixin = {\n\t\n\t /** add (or clear if clear is truthy) a validation warning to the DOM element described in what */\n\t _validationWarning: function (what, clear) {\n\t var VALIDATION_CLASS = 'validation-warning';\n\t if (what === 'name') {\n\t what = this.$('.collection-name').add(this.$('.collection-name-prompt'));\n\t this.$('.collection-name').focus().select();\n\t }\n\t if (clear) {\n\t what = what || this.$('.' + VALIDATION_CLASS);\n\t what.removeClass(VALIDATION_CLASS);\n\t } else {\n\t what.addClass(VALIDATION_CLASS);\n\t }\n\t },\n\t\n\t _changeHideOriginals: function (ev) {\n\t this.hideOriginals = this.$('.hide-originals').prop(\"checked\");\n\t },\n\t\n\t // ........................................................................ footer\n\t /** handle a collection name change */\n\t _changeName: function (ev) {\n\t this._validationWarning('name', !!this._getName());\n\t },\n\t\n\t /** check for enter key press when in the collection name and submit */\n\t _nameCheckForEnter: function (ev) {\n\t if (ev.keyCode === 13 && !this.blocking) {\n\t this._clickCreate();\n\t }\n\t },\n\t\n\t /** get the current collection name */\n\t _getName: function () {\n\t return _.escape(this.$('.collection-name').val());\n\t },\n\t\n\t // ........................................................................ header\n\t /** expand help */\n\t _clickMoreHelp: function (ev) {\n\t ev.stopPropagation();\n\t this.$('.main-help').addClass('expanded');\n\t this.$('.more-help').hide();\n\t },\n\t /** collapse help */\n\t _clickLessHelp: function (ev) {\n\t ev.stopPropagation();\n\t this.$('.main-help').removeClass('expanded');\n\t this.$('.more-help').show();\n\t },\n\t /** toggle help */\n\t _toggleHelp: function (ev) {\n\t ev.stopPropagation();\n\t this.$('.main-help').toggleClass('expanded');\n\t this.$('.more-help').toggle();\n\t },\n\t\n\t /** show an alert on the top of the interface containing message (alertClass is bootstrap's alert-*) */\n\t _showAlert: function (message, alertClass) {\n\t alertClass = alertClass || 'alert-danger';\n\t this.$('.main-help').hide();\n\t this.$('.header .alert').attr('class', 'alert alert-dismissable').addClass(alertClass).show().find('.alert-message').html(message);\n\t },\n\t /** hide the alerts at the top */\n\t _hideAlert: function (message) {\n\t this.$('.main-help').show();\n\t this.$('.header .alert').hide();\n\t },\n\t\n\t _cancelCreate: function (ev) {\n\t if (typeof this.oncancel === 'function') {\n\t this.oncancel.call(this);\n\t }\n\t },\n\t\n\t /** attempt to create the current collection */\n\t _clickCreate: function (ev) {\n\t var name = this._getName();\n\t if (!name) {\n\t this._validationWarning('name');\n\t } else if (!this.blocking) {\n\t this.createList(name);\n\t }\n\t },\n\t\n\t _setUpCommonSettings: function (attributes) {\n\t this.hideOriginals = attributes.defaultHideSourceItems || false;\n\t },\n\t\n\t /** render the footer, completion controls, and cancel controls */\n\t _renderFooter: function (speed, callback) {\n\t var instance = this;\n\t var $footer = this.$('.footer').empty().html(this.templates.footer());\n\t _.each(this.footerSettings, function (property, selector) {\n\t this.$(selector).prop('checked', instance[property]);\n\t });\n\t if (typeof this.oncancel === 'function') {\n\t this.$('.cancel-create.btn').show();\n\t }\n\t return $footer;\n\t },\n\t\n\t _creatorTemplates: {\n\t main: _.template(['
      ', '
      ', '
      '].join(''))\n\t }\n\t\n\t //==============================================================================\n\t };return {\n\t CollectionCreatorMixin: CollectionCreatorMixin\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ }),\n/* 83 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(91), __webpack_require__(59), __webpack_require__(58), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_VIEW, DC_MODEL, DC_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t /** @class non-editable, read-only View/Controller for a dataset collection.\n\t */\n\t var _super = LIST_VIEW.ModelListPanel;\n\t var CollectionView = _super.extend(\n\t /** @lends CollectionView.prototype */{\n\t //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n\t _logNamespace: logNamespace,\n\t\n\t className: _super.prototype.className + ' dataset-collection-panel',\n\t\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView,\n\t /** key of attribute in model to assign to this.collection */\n\t modelCollectionKey: 'elements',\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes optional settings for the panel\n\t */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t\n\t this.hasUser = attributes.hasUser;\n\t /** A stack of panels that currently cover or hide this panel */\n\t this.panelStack = [];\n\t /** The text of the link to go back to the panel containing this one */\n\t this.parentName = attributes.parentName;\n\t /** foldout or drilldown */\n\t this.foldoutStyle = attributes.foldoutStyle || 'foldout';\n\t this.downloadUrl = this.model.attributes.url + '/download';\n\t },\n\t\n\t _queueNewRender: function ($newRender, speed) {\n\t speed = speed === undefined ? this.fxSpeed : speed;\n\t var panel = this;\n\t panel.log('_queueNewRender:', $newRender, speed);\n\t\n\t // TODO: jquery@1.12 doesn't change display when the elem has display: flex\n\t // this causes display: block for those elems after the use of show/hide animations\n\t // animations are removed from this view for now until fixed\n\t panel._swapNewRender($newRender);\n\t panel.trigger('rendered', panel);\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** In this override, use model.getVisibleContents */\n\t _filterCollection: function () {\n\t //TODO: should *not* be model.getVisibleContents - visibility is not model related\n\t return this.model.getVisibleContents();\n\t },\n\t\n\t /** override to return proper view class based on element_type */\n\t _getItemViewClass: function (model) {\n\t //this.debug( this + '._getItemViewClass:', model );\n\t //TODO: subclasses use DCEViewClass - but are currently unused - decide\n\t switch (model.get('element_type')) {\n\t case 'hda':\n\t return this.DatasetDCEViewClass;\n\t case 'dataset_collection':\n\t return this.NestedDCDCEViewClass;\n\t }\n\t throw new TypeError('Unknown element type:', model.get('element_type'));\n\t },\n\t\n\t /** override to add link target and anon */\n\t _getItemViewOptions: function (model) {\n\t var options = _super.prototype._getItemViewOptions.call(this, model);\n\t return _.extend(options, {\n\t linkTarget: this.linkTarget,\n\t hasUser: this.hasUser,\n\t //TODO: could move to only nested: list:paired\n\t foldoutStyle: this.foldoutStyle\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ collection sub-views\n\t /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t _super.prototype._setUpItemViewListeners.call(panel, view);\n\t\n\t // use pub-sub to: handle drilldown expansion and collapse\n\t panel.listenTo(view, {\n\t 'expanded:drilldown': function (v, drilldown) {\n\t this._expandDrilldownPanel(drilldown);\n\t },\n\t 'collapsed:drilldown': function (v, drilldown) {\n\t this._collapseDrilldownPanel(drilldown);\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n\t _expandDrilldownPanel: function (drilldown) {\n\t this.panelStack.push(drilldown);\n\t // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n\t this.$('> .controls').add(this.$list()).hide();\n\t drilldown.parentName = this.model.get('name');\n\t this.$el.append(drilldown.render().$el);\n\t },\n\t\n\t /** Handle drilldown close by freeing the panel and re-rendering this panel */\n\t _collapseDrilldownPanel: function (drilldown) {\n\t this.panelStack.pop();\n\t this.render();\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: {\n\t 'click .navigation .back': 'close'\n\t },\n\t\n\t /** close/remove this collection panel */\n\t close: function (event) {\n\t this.remove();\n\t this.trigger('close');\n\t },\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'CollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t CollectionView.prototype.templates = function () {\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
      ', '', '
      ', '
      <%- collection.name || collection.element_identifier %>
      ', '
      ', '<% if( collection.collection_type === \"list\" ){ %>', _l('a list of datasets'), '<% } else if( collection.collection_type === \"paired\" ){ %>', _l('a pair of datasets'), '<% } else if( collection.collection_type === \"list:paired\" ){ %>', _l('a list of paired datasets'), '<% } else if( collection.collection_type === \"list:list\" ){ %>', _l('a list of dataset lists'), '<% } %>', '
      ', '
      ', '
      ', '', '
      '], 'collection');\n\t\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t controls: controlsTemplate\n\t });\n\t }();\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var ListCollectionView = CollectionView.extend(\n\t /** @lends ListCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var PairCollectionView = ListCollectionView.extend(\n\t /** @lends PairCollectionView.prototype */{\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'PairCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var ListOfPairsCollectionView = CollectionView.extend(\n\t /** @lends ListOfPairsCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n\t foldoutPanelClass: PairCollectionView\n\t }),\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfPairsCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\n\t var ListOfListsCollectionView = CollectionView.extend({\n\t\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n\t foldoutPanelClass: PairCollectionView\n\t }),\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfListsCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t CollectionView: CollectionView,\n\t ListCollectionView: ListCollectionView,\n\t PairCollectionView: PairCollectionView,\n\t ListOfPairsCollectionView: ListOfPairsCollectionView,\n\t ListOfListsCollectionView: ListOfListsCollectionView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ }),\n/* 84 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(61), __webpack_require__(45), __webpack_require__(80), __webpack_require__(25), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, DATASET_LI, TAGS, ANNOTATIONS, faIconButton, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t //==============================================================================\n\t\n\t var _super = DATASET_LI.DatasetListItemView;\n\t /** @class Editing view for DatasetAssociation.\n\t */\n\t var DatasetListItemEdit = _super.extend(\n\t /** @lends DatasetListItemEdit.prototype */{\n\t\n\t /** set up: options */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t this.hasUser = attributes.hasUser;\n\t\n\t /** allow user purge of dataset files? */\n\t this.purgeAllowed = attributes.purgeAllowed || false;\n\t\n\t //TODO: move to HiddenUntilActivatedViewMixin\n\t /** should the tags editor be shown or hidden initially? */\n\t this.tagsEditorShown = attributes.tagsEditorShown || false;\n\t /** should the tags editor be shown or hidden initially? */\n\t this.annotationEditorShown = attributes.annotationEditorShown || false;\n\t },\n\t\n\t // ......................................................................... titlebar actions\n\t /** In this override, add the other two primary actions: edit and delete */\n\t _renderPrimaryActions: function () {\n\t var actions = _super.prototype._renderPrimaryActions.call(this);\n\t if (this.model.get('state') === STATES.NOT_VIEWABLE) {\n\t return actions;\n\t }\n\t // render the display, edit attr and delete icon-buttons\n\t return _super.prototype._renderPrimaryActions.call(this).concat([this._renderEditButton(), this._renderDeleteButton()]);\n\t },\n\t\n\t //TODO: move titleButtons into state renderers, remove state checks in the buttons\n\t\n\t /** Render icon-button to edit the attributes (format, permissions, etc.) this dataset. */\n\t _renderEditButton: function () {\n\t // don't show edit while uploading, in-accessible\n\t // DO show if in error (ala previous history panel)\n\t if (this.model.get('state') === STATES.DISCARDED || !this.model.get('accessible')) {\n\t return null;\n\t }\n\t\n\t var purged = this.model.get('purged'),\n\t deleted = this.model.get('deleted'),\n\t editBtnData = {\n\t title: _l('Edit attributes'),\n\t href: Galaxy.root + 'datasets/edit?dataset_id=' + this.model.attributes.id,\n\t faIcon: 'fa-pencil',\n\t classes: 'edit-btn'\n\t };\n\t // disable if purged or deleted and explain why in the tooltip\n\t if (deleted || purged) {\n\t editBtnData.disabled = true;\n\t if (purged) {\n\t editBtnData.title = _l('Cannot edit attributes of datasets removed from disk');\n\t } else if (deleted) {\n\t editBtnData.title = _l('Undelete dataset to edit attributes');\n\t }\n\t\n\t // disable if still uploading or new\n\t } else if (_.contains([STATES.UPLOAD, STATES.NEW], this.model.get('state'))) {\n\t editBtnData.disabled = true;\n\t editBtnData.title = _l('This dataset is not yet editable');\n\t }\n\t return faIconButton(editBtnData);\n\t },\n\t\n\t /** Render icon-button to delete this hda. */\n\t _renderDeleteButton: function () {\n\t // don't show delete if...\n\t if (!this.model.get('accessible')) {\n\t return null;\n\t }\n\t\n\t var self = this,\n\t deletedAlready = this.model.isDeletedOrPurged();\n\t return faIconButton({\n\t title: !deletedAlready ? _l('Delete') : _l('Dataset is already deleted'),\n\t disabled: deletedAlready,\n\t faIcon: 'fa-times',\n\t classes: 'delete-btn',\n\t onclick: function () {\n\t // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n\t self.$el.find('.icon-btn.delete-btn').trigger('mouseout');\n\t self.model['delete']();\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... details\n\t /** In this override, add tags and annotations controls, make the ? dbkey a link to editing page */\n\t _renderDetails: function () {\n\t //TODO: generalize to be allow different details for each state\n\t var $details = _super.prototype._renderDetails.call(this),\n\t state = this.model.get('state');\n\t\n\t if (!this.model.isDeletedOrPurged() && _.contains([STATES.OK, STATES.FAILED_METADATA], state)) {\n\t this._renderTags($details);\n\t this._renderAnnotation($details);\n\t this._makeDbkeyEditLink($details);\n\t }\n\t\n\t this._setUpBehaviors($details);\n\t return $details;\n\t },\n\t\n\t /**************************************************************************\n\t * Render help button to show tool help text without rerunning the tool.\n\t * Issue #2100\n\t */\n\t _renderToolHelpButton: function () {\n\t var datasetID = this.model.attributes.dataset_id;\n\t var jobID = this.model.attributes.creating_job;\n\t var self = this;\n\t\n\t var parseToolBuild = function (data) {\n\t var helpString = '
      ';\n\t if (data.name && data.help) {\n\t helpString += 'Tool help for ' + data.name + '
      ';\n\t helpString += data.help;\n\t } else {\n\t helpString += 'Tool help is unavailable for this dataset.
      ';\n\t }\n\t helpString += '
      ';\n\t self.$el.find('.details').append($.parseHTML(helpString));\n\t };\n\t var parseToolID = function (data) {\n\t $.ajax({\n\t url: Galaxy.root + 'api/tools/' + data.tool_id + '/build'\n\t }).done(function (data) {\n\t parseToolBuild(data);\n\t }).fail(function () {\n\t parseToolBuild({});\n\t });\n\t };\n\t if (Galaxy.user.id === null) {\n\t return null;\n\t }\n\t return faIconButton({\n\t title: _l('Tool Help'),\n\t classes: 'icon-btn',\n\t href: '#',\n\t faIcon: 'fa-question',\n\t onclick: function () {\n\t var divString = 'thdiv-' + datasetID;\n\t if (self.$el.find(\".toolhelp\").length > 0) {\n\t self.$el.find(\".toolhelp\").toggle();\n\t } else {\n\t $.ajax({\n\t url: Galaxy.root + 'api/jobs/' + jobID\n\t }).done(function (data) {\n\t parseToolID(data);\n\t }).fail(function () {\n\t console.log('Failed at recovering job information from the Galaxy API for job id \"' + jobID + '\".');\n\t });\n\t }\n\t }\n\t });\n\t },\n\t //*************************************************************************\n\t\n\t /** Add less commonly used actions in the details section based on state */\n\t _renderSecondaryActions: function () {\n\t var actions = _super.prototype._renderSecondaryActions.call(this);\n\t switch (this.model.get('state')) {\n\t case STATES.UPLOAD:\n\t case STATES.NOT_VIEWABLE:\n\t return actions;\n\t case STATES.ERROR:\n\t // error button comes first\n\t actions.unshift(this._renderErrButton());\n\t return actions.concat([this._renderRerunButton(), this._renderToolHelpButton()]);\n\t case STATES.OK:\n\t case STATES.FAILED_METADATA:\n\t return actions.concat([this._renderRerunButton(), this._renderVisualizationsButton(), this._renderToolHelpButton()]);\n\t }\n\t return actions.concat([this._renderRerunButton(), this._renderToolHelpButton()]);\n\t },\n\t\n\t /** Render icon-button to report an error on this dataset to the galaxy admin. */\n\t _renderErrButton: function () {\n\t return faIconButton({\n\t title: _l('View or report this error'),\n\t href: Galaxy.root + 'datasets/error?dataset_id=' + this.model.attributes.id,\n\t classes: 'report-error-btn',\n\t faIcon: 'fa-bug'\n\t });\n\t },\n\t\n\t /** Render icon-button to re-run the job that created this dataset. */\n\t _renderRerunButton: function () {\n\t var creating_job = this.model.get('creating_job');\n\t if (this.model.get('rerunnable')) {\n\t return faIconButton({\n\t title: _l('Run this job again'),\n\t href: this.model.urls.rerun,\n\t classes: 'rerun-btn',\n\t target: this.linkTarget,\n\t faIcon: 'fa-refresh',\n\t onclick: function (ev) {\n\t ev.preventDefault();\n\t Galaxy.router.push('/', { job_id: creating_job });\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** Render an icon-button or popupmenu of links based on the applicable visualizations */\n\t _renderVisualizationsButton: function () {\n\t //TODO: someday - lazyload visualizations\n\t var visualizations = this.model.get('visualizations');\n\t if (this.model.isDeletedOrPurged() || !this.hasUser || !this.model.hasData() || _.isEmpty(visualizations)) {\n\t return null;\n\t }\n\t if (!_.isObject(visualizations[0])) {\n\t this.warn('Visualizations have been switched off');\n\t return null;\n\t }\n\t\n\t var $visualizations = $(this.templates.visualizations(visualizations, this));\n\t //HACK: need to re-write those directed at galaxy_main with linkTarget\n\t $visualizations.find('[target=\"galaxy_main\"]').attr('target', this.linkTarget);\n\t // use addBack here to include the root $visualizations elem (for the case of 1 visualization)\n\t this._addScratchBookFn($visualizations.find('.visualization-link').addBack('.visualization-link'));\n\t return $visualizations;\n\t },\n\t\n\t /** add scratchbook functionality to visualization links */\n\t _addScratchBookFn: function ($links) {\n\t var li = this;\n\t $links.click(function (ev) {\n\t if (Galaxy.frame && Galaxy.frame.active) {\n\t Galaxy.frame.add({\n\t title: 'Visualization',\n\t url: $(this).attr('href')\n\t });\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t }\n\t });\n\t },\n\t\n\t //TODO: if possible move these to readonly view - but display the owner's tags/annotation (no edit)\n\t /** Render the tags list/control */\n\t _renderTags: function ($where) {\n\t if (!this.hasUser) {\n\t return;\n\t }\n\t var view = this;\n\t this.tagsEditor = new TAGS.TagsEditor({\n\t model: this.model,\n\t el: $where.find('.tags-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow: function () {\n\t view.tagsEditorShown = true;\n\t },\n\t onhide: function () {\n\t view.tagsEditorShown = false;\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit dataset tags'),\n\t classes: 'tag-btn',\n\t faIcon: 'fa-tags'\n\t }).appendTo($where.find('.actions .right'))\n\t });\n\t if (this.tagsEditorShown) {\n\t this.tagsEditor.toggle(true);\n\t }\n\t },\n\t\n\t /** Render the annotation display/control */\n\t _renderAnnotation: function ($where) {\n\t if (!this.hasUser) {\n\t return;\n\t }\n\t var view = this;\n\t this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n\t model: this.model,\n\t el: $where.find('.annotation-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow: function () {\n\t view.annotationEditorShown = true;\n\t },\n\t onhide: function () {\n\t view.annotationEditorShown = false;\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit dataset annotation'),\n\t classes: 'annotate-btn',\n\t faIcon: 'fa-comment'\n\t }).appendTo($where.find('.actions .right'))\n\t });\n\t if (this.annotationEditorShown) {\n\t this.annotationEditor.toggle(true);\n\t }\n\t },\n\t\n\t /** If the format/dbkey/genome_build isn't set, make the display a link to the edit page */\n\t _makeDbkeyEditLink: function ($details) {\n\t // make the dbkey a link to editing\n\t if (this.model.get('metadata_dbkey') === '?' && !this.model.isDeletedOrPurged()) {\n\t var editableDbkey = $('?').attr('href', this.model.urls.edit).attr('target', this.linkTarget);\n\t $details.find('.dbkey .value').replaceWith(editableDbkey);\n\t }\n\t },\n\t\n\t // ......................................................................... events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .undelete-link': '_clickUndeleteLink',\n\t 'click .purge-link': '_clickPurgeLink',\n\t\n\t 'click .edit-btn': function (ev) {\n\t this.trigger('edit', this, ev);\n\t },\n\t 'click .delete-btn': function (ev) {\n\t this.trigger('delete', this, ev);\n\t },\n\t 'click .rerun-btn': function (ev) {\n\t this.trigger('rerun', this, ev);\n\t },\n\t 'click .report-err-btn': function (ev) {\n\t this.trigger('report-err', this, ev);\n\t },\n\t 'click .visualization-btn': function (ev) {\n\t this.trigger('visualize', this, ev);\n\t },\n\t 'click .dbkey a': function (ev) {\n\t this.trigger('edit', this, ev);\n\t }\n\t }),\n\t\n\t /** listener for item undelete (in the messages section) */\n\t _clickUndeleteLink: function (ev) {\n\t this.model.undelete();\n\t return false;\n\t },\n\t\n\t /** listener for item purge (in the messages section) */\n\t _clickPurgeLink: function (ev) {\n\t if (confirm(_l('This will permanently remove the data in your dataset. Are you sure?'))) {\n\t this.model.purge();\n\t }\n\t return false;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** string rep */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDAEditView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetListItemEdit.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t failed_metadata: BASE_MVC.wrapTemplate([\n\t // in this override, provide a link to the edit page\n\t '<% if( dataset.state === \"failed_metadata\" ){ %>', '', '<% } %>'], 'dataset'),\n\t\n\t deleted: BASE_MVC.wrapTemplate([\n\t // in this override, provide links to undelete or purge the dataset\n\t '<% if( dataset.deleted && !dataset.purged ){ %>',\n\t // deleted not purged\n\t '
      ', _l('This dataset has been deleted'), '
      ', _l('Undelete it'), '', '<% if( view.purgeAllowed ){ %>', '
      ', _l('Permanently remove it from disk'), '', '<% } %>', '
      ', '<% } %>'], 'dataset')\n\t });\n\t\n\t var visualizationsTemplate = BASE_MVC.wrapTemplate(['<% if( visualizations.length === 1 ){ %>', '\"', ' target=\"<%- visualizations[0].target %>\" title=\"', _l('Visualize in'), ' <%- visualizations[0].html %>\">', '', '', '<% } else { %>', '
      ', '', '', '', '', '
      ', '<% } %>'], 'visualizations');\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t warnings: warnings,\n\t visualizations: visualizationsTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t DatasetListItemEdit: DatasetListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ }),\n/* 85 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t var logNamespace = 'dataset';\n\t //==============================================================================\n\t var searchableMixin = BASE_MVC.SearchableModelMixin;\n\t /** @class base model for any DatasetAssociation (HDAs, LDDAs, DatasetCollectionDAs).\n\t * No knowledge of what type (HDA/LDDA/DCDA) should be needed here.\n\t * The DA's are made searchable (by attribute) by mixing in SearchableModelMixin.\n\t */\n\t var DatasetAssociation = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(BASE_MVC.mixin(searchableMixin, /** @lends DatasetAssociation.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t /** default attributes for a model */\n\t defaults: {\n\t state: STATES.NEW,\n\t deleted: false,\n\t purged: false,\n\t name: '(unnamed dataset)',\n\t accessible: true,\n\t // sniffed datatype (sam, tabular, bed, etc.)\n\t data_type: '',\n\t file_ext: '',\n\t file_size: 0,\n\t\n\t // array of associated file types (eg. [ 'bam_index', ... ])\n\t meta_files: [],\n\t\n\t misc_blurb: '',\n\t misc_info: '',\n\t\n\t tags: []\n\t // do NOT default on annotation, as this default is valid and will be passed on 'save'\n\t // which is incorrect behavior when the model is only partially fetched (annos are not passed in summary data)\n\t //annotation : ''\n\t },\n\t\n\t /** instance vars and listeners */\n\t initialize: function (attributes, options) {\n\t this.debug(this + '(Dataset).initialize', attributes, options);\n\t\n\t //!! this state is not in trans.app.model.Dataset.states - set it here -\n\t if (!this.get('accessible')) {\n\t this.set('state', STATES.NOT_VIEWABLE);\n\t }\n\t\n\t /** Datasets rely/use some web controllers - have the model generate those URLs on startup */\n\t this.urls = this._generateUrls();\n\t\n\t this._setUpListeners();\n\t },\n\t\n\t /** returns misc. web urls for rendering things like re-run, display, etc. */\n\t _generateUrls: function () {\n\t var id = this.get('id');\n\t if (!id) {\n\t return {};\n\t }\n\t var urls = {\n\t 'purge': 'datasets/' + id + '/purge_async',\n\t 'display': 'datasets/' + id + '/display/?preview=True',\n\t 'edit': 'datasets/' + id + '/edit',\n\t 'download': 'datasets/' + id + '/display' + this._downloadQueryParameters(),\n\t 'report_error': 'dataset/errors?id=' + id,\n\t 'rerun': 'tool_runner/rerun?id=' + id,\n\t 'show_params': 'datasets/' + id + '/show_params',\n\t 'visualization': 'visualization',\n\t 'meta_download': 'dataset/get_metadata_file?hda_id=' + id + '&metadata_name='\n\t };\n\t _.each(urls, function (value, key) {\n\t urls[key] = Galaxy.root + value;\n\t });\n\t this.urls = urls;\n\t return urls;\n\t },\n\t\n\t _downloadQueryParameters: function () {\n\t return '?to_ext=' + this.get('file_ext');\n\t },\n\t\n\t /** set up any event listeners\n\t * event: state:ready fired when this DA moves into/is already in a ready state\n\t */\n\t _setUpListeners: function () {\n\t // if the state has changed and the new state is a ready state, fire an event\n\t this.on('change:state', function (currModel, newState) {\n\t this.log(this + ' has changed state:', currModel, newState);\n\t if (this.inReadyState()) {\n\t this.trigger('state:ready', currModel, newState, this.previous('state'));\n\t }\n\t });\n\t // the download url (currently) relies on having a correct file extension\n\t this.on('change:id change:file_ext', function (currModel) {\n\t this._generateUrls();\n\t });\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** override to add urls */\n\t toJSON: function () {\n\t var json = Backbone.Model.prototype.toJSON.call(this);\n\t //console.warn( 'returning json?' );\n\t //return json;\n\t return _.extend(json, {\n\t urls: this.urls\n\t });\n\t },\n\t\n\t /** Is this dataset deleted or purged? */\n\t isDeletedOrPurged: function () {\n\t return this.get('deleted') || this.get('purged');\n\t },\n\t\n\t /** Is this dataset in a 'ready' state; where 'Ready' states are states where no\n\t * processing (for the ds) is left to do on the server.\n\t */\n\t inReadyState: function () {\n\t var ready = _.contains(STATES.READY_STATES, this.get('state'));\n\t return this.isDeletedOrPurged() || ready;\n\t },\n\t\n\t /** Does this model already contain detailed data (as opposed to just summary level data)? */\n\t hasDetails: function () {\n\t // if it's inaccessible assume it has everything it needs\n\t if (!this.get('accessible')) {\n\t return true;\n\t }\n\t return this.has('annotation');\n\t },\n\t\n\t /** Convenience function to match dataset.has_data. */\n\t hasData: function () {\n\t return this.get('file_size') > 0;\n\t },\n\t\n\t // ........................................................................ ajax\n\t fetch: function (options) {\n\t var dataset = this;\n\t return Backbone.Model.prototype.fetch.call(this, options).always(function () {\n\t dataset._generateUrls();\n\t });\n\t },\n\t\n\t /** override to use actual Dates objects for create/update times */\n\t parse: function (response, options) {\n\t var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n\t if (parsed.create_time) {\n\t parsed.create_time = new Date(parsed.create_time);\n\t }\n\t if (parsed.update_time) {\n\t parsed.update_time = new Date(parsed.update_time);\n\t }\n\t return parsed;\n\t },\n\t\n\t /** override to wait by default */\n\t save: function (attrs, options) {\n\t options = options || {};\n\t options.wait = _.isUndefined(options.wait) ? true : options.wait;\n\t return Backbone.Model.prototype.save.call(this, attrs, options);\n\t },\n\t\n\t //NOTE: subclasses of DA's will need to implement url and urlRoot in order to have these work properly\n\t /** save this dataset, _Mark_ing it as deleted (just a flag) */\n\t 'delete': function (options) {\n\t if (this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true }, options);\n\t },\n\t /** save this dataset, _Mark_ing it as undeleted */\n\t undelete: function (options) {\n\t if (!this.get('deleted') || this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: false }, options);\n\t },\n\t\n\t /** remove the file behind this dataset from the filesystem (if permitted) */\n\t purge: function _purge(options) {\n\t //TODO: use, override model.destroy, HDA.delete({ purge: true })\n\t if (this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t options = options || {};\n\t options.url = this.urls.purge;\n\t\n\t //TODO: ideally this would be a DELETE call to the api\n\t // using purge async for now\n\t var hda = this,\n\t xhr = jQuery.ajax(options);\n\t xhr.done(function (message, status, responseObj) {\n\t hda.set({ deleted: true, purged: true });\n\t });\n\t xhr.fail(function (xhr, status, message) {\n\t // Exception messages are hidden within error page including: '...not allowed in this Galaxy instance.'\n\t // unbury and re-add to xhr\n\t var error = _l(\"Unable to purge dataset\");\n\t var messageBuriedInUnfortunatelyFormattedError = 'Removal of datasets by users ' + 'is not allowed in this Galaxy instance';\n\t if (xhr.responseJSON && xhr.responseJSON.error) {\n\t error = xhr.responseJSON.error;\n\t } else if (xhr.responseText.indexOf(messageBuriedInUnfortunatelyFormattedError) !== -1) {\n\t error = messageBuriedInUnfortunatelyFormattedError;\n\t }\n\t xhr.responseText = error;\n\t hda.trigger('error', hda, xhr, options, _l(error), { error: error });\n\t });\n\t return xhr;\n\t },\n\t\n\t // ........................................................................ searching\n\t /** what attributes of an HDA will be used in a text search */\n\t searchAttributes: ['name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'],\n\t\n\t /** our attr keys don't often match the labels we display to the user - so, when using\n\t * attribute specifiers ('name=\"bler\"') in a term, allow passing in aliases for the\n\t * following attr keys.\n\t */\n\t searchAliases: {\n\t title: 'name',\n\t format: 'file_ext',\n\t database: 'genome_build',\n\t blurb: 'misc_blurb',\n\t description: 'misc_blurb',\n\t info: 'misc_info',\n\t tag: 'tags'\n\t },\n\t\n\t // ........................................................................ misc\n\t /** String representation */\n\t toString: function () {\n\t var nameAndId = this.get('id') || '';\n\t if (this.get('name')) {\n\t nameAndId = '\"' + this.get('name') + '\",' + nameAndId;\n\t }\n\t return 'Dataset(' + nameAndId + ')';\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection for dataset associations.\n\t */\n\t var DatasetAssociationCollection = Backbone.Collection.extend(BASE_MVC.LoggableMixin).extend(\n\t /** @lends HistoryContents.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t model: DatasetAssociation,\n\t\n\t /** root api url */\n\t urlRoot: Galaxy.root + 'api/datasets',\n\t\n\t /** url fn */\n\t url: function () {\n\t return this.urlRoot;\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** Get the ids of every item in this collection\n\t * @returns array of encoded ids\n\t */\n\t ids: function () {\n\t return this.map(function (item) {\n\t return item.get('id');\n\t });\n\t },\n\t\n\t /** Get contents that are not ready\n\t * @returns array of content models\n\t */\n\t notReady: function () {\n\t return this.filter(function (content) {\n\t return !content.inReadyState();\n\t });\n\t },\n\t\n\t /** return true if any datasets don't have details */\n\t haveDetails: function () {\n\t return this.all(function (dataset) {\n\t return dataset.hasDetails();\n\t });\n\t },\n\t\n\t // ........................................................................ ajax\n\t /** using a queue, perform ajaxFn on each of the models in this collection */\n\t ajaxQueue: function (ajaxFn, options) {\n\t var deferred = jQuery.Deferred(),\n\t startingLength = this.length,\n\t responses = [];\n\t\n\t if (!startingLength) {\n\t deferred.resolve([]);\n\t return deferred;\n\t }\n\t\n\t // use reverse order (stylistic choice)\n\t var ajaxFns = this.chain().reverse().map(function (dataset, i) {\n\t return function () {\n\t var xhr = ajaxFn.call(dataset, options);\n\t // if successful, notify using the deferred to allow tracking progress\n\t xhr.done(function (response) {\n\t deferred.notify({ curr: i, total: startingLength, response: response, model: dataset });\n\t });\n\t // (regardless of previous error or success) if not last ajax call, shift and call the next\n\t // if last fn, resolve deferred\n\t xhr.always(function (response) {\n\t responses.push(response);\n\t if (ajaxFns.length) {\n\t ajaxFns.shift()();\n\t } else {\n\t deferred.resolve(responses);\n\t }\n\t });\n\t };\n\t }).value();\n\t // start the queue\n\t ajaxFns.shift()();\n\t\n\t return deferred;\n\t },\n\t\n\t // ........................................................................ sorting/filtering\n\t /** return a new collection of datasets whose attributes contain the substring matchesWhat */\n\t matches: function (matchesWhat) {\n\t return this.filter(function (dataset) {\n\t return dataset.matches(matchesWhat);\n\t });\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['DatasetAssociationCollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t DatasetAssociation: DatasetAssociation,\n\t DatasetAssociationCollection: DatasetAssociationCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ }),\n/* 86 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, jQuery, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(8), __webpack_require__(94), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (MODAL, ERROR_MODAL, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /**\n\t * A dialog/modal that allows copying a user history or 'importing' from user\n\t * another. Generally called via historyCopyDialog below.\n\t * @type {Object}\n\t */\n\t\n\t var CopyDialog = {\n\t\n\t // language related strings/fns\n\t defaultName: _.template(\"Copy of '<%- name %>'\"),\n\t title: _.template(_l('Copying history') + ' \"<%- name %>\"'),\n\t submitLabel: _l('Copy'),\n\t errorMessage: _l('History could not be copied.'),\n\t progressive: _l('Copying history'),\n\t activeLabel: _l('Copy only the active, non-deleted datasets'),\n\t allLabel: _l('Copy all datasets including deleted ones'),\n\t anonWarning: _l('As an anonymous user, unless you login or register, you will lose your current history ') + _l('after copying this history. '),\n\t\n\t // template for modal body\n\t _template: _.template([\n\t //TODO: remove inline styles\n\t // show a warning message for losing current to anon users\n\t '<% if( isAnon ){ %>', '
      ', '<%- anonWarning %>', _l('You can'), ' ', _l('login here'), ' ', _l('or'), ' ', ' ', _l('register here'), '.', '
      ', '<% } %>', '
      ', '
      ',\n\t // TODO: could use required here and the form validators\n\t // NOTE: use unescaped here if escaped in the modal function below\n\t '\" />', '

      ', _l('Please enter a valid history title'), '

      ',\n\t // if allowAll, add the option to copy deleted datasets, too\n\t '<% if( allowAll ){ %>', '
      ', '

      ', _l('Choose which datasets from the original history to include:'), '

      ',\n\t // copy non-deleted is the default\n\t '/>', '', '
      ', '/>', '', '<% } %>', '
      '].join('')),\n\t\n\t // empty modal body and let the user know the copy is happening\n\t _showAjaxIndicator: function _showAjaxIndicator() {\n\t var indicator = '

      ' + this.progressive + '...

      ';\n\t this.modal.$('.modal-body').empty().append(indicator).css({ 'margin-top': '8px' });\n\t },\n\t\n\t // (sorta) public interface - display the modal, render the form, and potentially copy the history\n\t // returns a jQuery.Deferred done->history copied, fail->user cancelled\n\t dialog: function _dialog(modal, history, options) {\n\t options = options || {};\n\t\n\t var dialog = this,\n\t deferred = jQuery.Deferred(),\n\t\n\t // TODO: getting a little byzantine here\n\t defaultCopyNameFn = options.nameFn || this.defaultName,\n\t defaultCopyName = defaultCopyNameFn({ name: history.get('name') }),\n\t\n\t // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n\t defaultCopyWhat = options.allDatasets ? 'copy-all' : 'copy-non-deleted',\n\t allowAll = !_.isUndefined(options.allowAll) ? options.allowAll : true,\n\t autoClose = !_.isUndefined(options.autoClose) ? options.autoClose : true;\n\t\n\t this.modal = modal;\n\t\n\t // validate the name and copy if good\n\t function checkNameAndCopy() {\n\t var name = modal.$('#copy-modal-title').val();\n\t if (!name) {\n\t modal.$('.invalid-title').show();\n\t return;\n\t }\n\t // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n\t var copyAllDatasets = modal.$('input[name=\"copy-what\"]:checked').val() === 'copy-all';\n\t modal.$('button').prop('disabled', true);\n\t dialog._showAjaxIndicator();\n\t history.copy(true, name, copyAllDatasets).done(function (response) {\n\t deferred.resolve(response);\n\t }).fail(function (xhr, status, message) {\n\t var options = { name: name, copyAllDatasets: copyAllDatasets };\n\t ERROR_MODAL.ajaxErrorModal(history, xhr, options, dialog.errorMessage);\n\t deferred.rejectWith(deferred, arguments);\n\t }).done(function () {\n\t if (autoClose) {\n\t modal.hide();\n\t }\n\t });\n\t }\n\t\n\t var originalClosingCallback = options.closing_callback;\n\t modal.show(_.extend(options, {\n\t title: this.title({ name: history.get('name') }),\n\t body: $(dialog._template({\n\t name: defaultCopyName,\n\t isAnon: Galaxy.user.isAnonymous(),\n\t allowAll: allowAll,\n\t copyWhat: defaultCopyWhat,\n\t activeLabel: this.activeLabel,\n\t allLabel: this.allLabel,\n\t anonWarning: this.anonWarning\n\t })),\n\t buttons: _.object([[_l('Cancel'), function () {\n\t modal.hide();\n\t }], [this.submitLabel, checkNameAndCopy]]),\n\t height: 'auto',\n\t closing_events: true,\n\t closing_callback: function _historyCopyClose(cancelled) {\n\t if (cancelled) {\n\t deferred.reject({ cancelled: true });\n\t }\n\t if (originalClosingCallback) {\n\t originalClosingCallback(cancelled);\n\t }\n\t }\n\t }));\n\t\n\t // set the default dataset copy, autofocus the title, and set up for a simple return\n\t modal.$('#copy-modal-title').focus().select();\n\t modal.$('#copy-modal-title').on('keydown', function (ev) {\n\t if (ev.keyCode === 13) {\n\t ev.preventDefault();\n\t checkNameAndCopy();\n\t }\n\t });\n\t\n\t return deferred;\n\t }\n\t };\n\t\n\t //==============================================================================\n\t // maintain the (slight) distinction between copy and import\n\t /**\n\t * Subclass CopyDialog to use the import language.\n\t */\n\t var ImportDialog = _.extend({}, CopyDialog, {\n\t defaultName: _.template(\"imported: <%- name %>\"),\n\t title: _.template(_l('Importing history') + ' \"<%- name %>\"'),\n\t submitLabel: _l('Import'),\n\t errorMessage: _l('History could not be imported.'),\n\t progressive: _l('Importing history'),\n\t activeLabel: _l('Import only the active, non-deleted datasets'),\n\t allLabel: _l('Import all datasets including deleted ones'),\n\t anonWarning: _l('As an anonymous user, unless you login or register, you will lose your current history ') + _l('after importing this history. ')\n\t\n\t });\n\t\n\t //==============================================================================\n\t /**\n\t * Main interface for both history import and history copy dialogs.\n\t * @param {Backbone.Model} history the history to copy\n\t * @param {Object} options a hash\n\t * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n\t *\n\t * options:\n\t * (this object is also passed to the modal used to display the dialog and accepts modal options)\n\t * {Function} nameFn if defined, use this to build the default name shown to the user\n\t * (the fn is passed: {name: })\n\t * {bool} useImport if true, use the 'import' language (instead of Copy)\n\t * {bool} allowAll if true, allow the user to choose between copying all datasets and\n\t * only non-deleted datasets\n\t * {String} allDatasets default initial checked radio button: 'copy-all' or 'copy-non-deleted',\n\t */\n\t var historyCopyDialog = function (history, options) {\n\t options = options || {};\n\t // create our own modal if Galaxy doesn't have one (mako tab without use_panels)\n\t var modal = window.parent.Galaxy.modal || new MODAL.View({});\n\t return options.useImport ? ImportDialog.dialog(modal, history, options) : CopyDialog.dialog(modal, history, options);\n\t };\n\t\n\t //==============================================================================\n\t return historyCopyDialog;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ }),\n/* 87 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(61), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DATASET_LI.DatasetListItemView;\n\t /** @class Read only view for HistoryDatasetAssociation.\n\t * Since there are no controls on the HDAView to hide the dataset,\n\t * the primary thing this class does (currently) is override templates\n\t * to render the HID.\n\t */\n\t var HDAListItemView = _super.extend(\n\t /** @lends HDAListItemView.prototype */{\n\t\n\t className: _super.prototype.className + \" history-content\",\n\t\n\t initialize: function (attributes, options) {\n\t _super.prototype.initialize.call(this, attributes, options);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDAListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t HDAListItemView.prototype.templates = function () {\n\t\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t // adding the hid display to the title\n\t '
      ', '', '
      ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- dataset.hid %> ', '<%- dataset.name %>', '
      ', '
      ', '', '<% _.each(_.sortBy(_.uniq(dataset.tags), function(x) { return x }), function(tag){ %>', '<% if (tag.indexOf(\"name:\") == 0){ %>', '<%- tag.slice(5) %>', '<% } %>', '<% }); %>', '', '
      '], 'dataset');\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t hidden: BASE_MVC.wrapTemplate([\n\t // add a warning when hidden\n\t '<% if( !dataset.visible ){ %>', '
      ', _l('This dataset has been hidden'), '
      ', '<% } %>'], 'dataset')\n\t });\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t titleBar: titleBarTemplate,\n\t warnings: warnings\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HDAListItemView: HDAListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ }),\n/* 88 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(85), __webpack_require__(90), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET, HISTORY_CONTENT, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DATASET.DatasetAssociation,\n\t hcontentMixin = HISTORY_CONTENT.HistoryContentMixin;\n\t /** @class (HDA) model for a Galaxy dataset contained in and related to a history.\n\t */\n\t var HistoryDatasetAssociation = _super.extend(BASE_MVC.mixin(hcontentMixin,\n\t /** @lends HistoryDatasetAssociation.prototype */{\n\t\n\t /** default attributes for a model */\n\t defaults: _.extend({}, _super.prototype.defaults, hcontentMixin.defaults, {\n\t history_content_type: 'dataset',\n\t model_class: 'HistoryDatasetAssociation'\n\t })\n\t }));\n\t\n\t //==============================================================================\n\t return {\n\t HistoryDatasetAssociation: HistoryDatasetAssociation\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ }),\n/* 89 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(58), __webpack_require__(83), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, DC_LI, DC_VIEW, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DC_LI.DCListItemView;\n\t /** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n\t */\n\t var HDCAListItemView = _super.extend(\n\t /** @lends HDCAListItemView.prototype */{\n\t\n\t className: _super.prototype.className + \" history-content\",\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t this.listenTo(this.model, {\n\t 'change:tags change:populated change:visible': function (model, options) {\n\t this.render();\n\t }\n\t });\n\t },\n\t\n\t /** Override to provide the proper collections panels as the foldout */\n\t _getFoldoutPanelClass: function () {\n\t switch (this.model.get('collection_type')) {\n\t case 'list':\n\t return DC_VIEW.ListCollectionView;\n\t case 'paired':\n\t return DC_VIEW.PairCollectionView;\n\t case 'list:paired':\n\t return DC_VIEW.ListOfPairsCollectionView;\n\t case 'list:list':\n\t return DC_VIEW.ListOfListsCollectionView;\n\t }\n\t throw new TypeError('Uknown collection_type: ' + this.model.get('collection_type'));\n\t },\n\t\n\t /** In this override, add the state as a class for use with state-based CSS */\n\t _swapNewRender: function ($newRender) {\n\t _super.prototype._swapNewRender.call(this, $newRender);\n\t //TODO: model currently has no state\n\t var state = !this.model.get('populated') ? STATES.RUNNING : STATES.OK;\n\t //if( this.model.has( 'state' ) ){\n\t this.$el.addClass('state-' + state);\n\t //}\n\t return this.$el;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDCAListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t /** underscore templates */\n\t HDCAListItemView.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t hidden: BASE_MVC.wrapTemplate([\n\t // add a warning when hidden\n\t '<% if( !collection.visible ){ %>', '
      ', _l('This collection has been hidden'), '
      ', '<% } %>'], 'collection')\n\t });\n\t\n\t // could steal this from hda-base (or use mixed content)\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t // adding the hid display to the title\n\t '
      ', '', '
      ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- collection.hid %> ', '<%- collection.name %>', '
      ', '
      ', '', '<% _.each(_.sortBy(_.uniq(collection.tags), function(x) { return x }), function(tag){ %>', '<% if (tag.indexOf(\"name:\") == 0){ %>', '<%- tag.slice(5) %>', '<% } %>', '<% }); %>', '', '
      '], 'collection');\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t warnings: warnings,\n\t titleBar: titleBarTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HDCAListItemView: HDCAListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ }),\n/* 90 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /** @class Mixin for HistoryContents content (HDAs, HDCAs).\n\t */\n\t\n\t var HistoryContentMixin = {\n\t\n\t /** default attributes for a model */\n\t defaults: {\n\t /** parent (containing) history */\n\t history_id: null,\n\t /** some content_type (HistoryContents can contain mixed model classes) */\n\t history_content_type: null,\n\t /** indicating when/what order the content was generated in the context of the history */\n\t hid: null,\n\t /** whether the user wants the content shown (visible) */\n\t visible: true\n\t },\n\t\n\t // ........................................................................ mixed content element\n\t // In order to be part of a MIXED bbone collection, we can't rely on the id\n\t // (which may collide btwn models of different classes)\n\t // Instead, use type_id which prefixes the history_content_type so the bbone collection can differentiate\n\t idAttribute: 'type_id',\n\t\n\t // ........................................................................ common queries\n\t /** the more common alias of visible */\n\t hidden: function () {\n\t return !this.get('visible');\n\t },\n\t\n\t //TODO: remove\n\t /** based on includeDeleted, includeHidden (gen. from the container control),\n\t * would this ds show in the list of ds's?\n\t * @param {Boolean} includeDeleted are we showing deleted hdas?\n\t * @param {Boolean} includeHidden are we showing hidden hdas?\n\t */\n\t isVisible: function (includeDeleted, includeHidden) {\n\t var isVisible = true;\n\t if (!includeDeleted && (this.get('deleted') || this.get('purged'))) {\n\t isVisible = false;\n\t }\n\t if (!includeHidden && !this.get('visible')) {\n\t isVisible = false;\n\t }\n\t return isVisible;\n\t },\n\t\n\t // ........................................................................ ajax\n\t //TODO?: these are probably better done on the leaf classes\n\t /** history content goes through the 'api/histories' API */\n\t urlRoot: Galaxy.root + 'api/histories/',\n\t\n\t /** full url spec. for this content */\n\t url: function () {\n\t var url = this.urlRoot + this.get('history_id') + '/contents/' + this.get('history_content_type') + 's/' + this.get('id');\n\t return url;\n\t },\n\t\n\t /** save this content as not visible */\n\t hide: function (options) {\n\t if (!this.get('visible')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ visible: false }, options);\n\t },\n\t /** save this content as visible */\n\t unhide: function (options) {\n\t if (this.get('visible')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ visible: true }, options);\n\t },\n\t\n\t // ........................................................................ misc\n\t toString: function () {\n\t return [this.get('type_id'), this.get('hid'), this.get('name')].join(':');\n\t }\n\t };\n\t\n\t //==============================================================================\n\t return {\n\t HistoryContentMixin: HistoryContentMixin\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 91 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(67), __webpack_require__(152), __webpack_require__(7), __webpack_require__(6), __webpack_require__(98)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_ITEM, LoadingIndicator, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'list';\n\t /* ============================================================================\n\t TODO:\n\t \n\t ============================================================================ */\n\t /** @class View for a list/collection of models and the sub-views of those models.\n\t * Sub-views must (at least have the interface if not) inherit from ListItemView.\n\t * (For a list panel that also includes some 'container' model (History->HistoryContents)\n\t * use ModelWithListPanel)\n\t *\n\t * Allows for:\n\t * searching collection/sub-views\n\t * selecting/multi-selecting sub-views\n\t *\n\t * Currently used:\n\t * for dataset/dataset-choice\n\t * as superclass of ModelListPanel\n\t */\n\t var ListPanel = Backbone.View.extend(BASE_MVC.LoggableMixin).extend( /** @lends ListPanel.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t /** class to use for constructing the sub-views */\n\t viewClass: LIST_ITEM.ListItemView,\n\t /** class to used for constructing collection of sub-view models */\n\t collectionClass: Backbone.Collection,\n\t\n\t tagName: 'div',\n\t className: 'list-panel',\n\t\n\t /** (in ms) that jquery effects will use */\n\t fxSpeed: 'fast',\n\t\n\t /** string to display when the collection has no contents */\n\t emptyMsg: _l('This list is empty'),\n\t /** displayed when no items match the search terms */\n\t noneFoundMsg: _l('No matching items found'),\n\t /** string used for search placeholder */\n\t searchPlaceholder: _l('search'),\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes optional settings for the list\n\t */\n\t initialize: function (attributes, options) {\n\t attributes = attributes || {};\n\t // set the logger if requested\n\t if (attributes.logger) {\n\t this.logger = attributes.logger;\n\t }\n\t this.log(this + '.initialize:', attributes);\n\t\n\t // ---- instance vars\n\t /** how quickly should jquery fx run? */\n\t this.fxSpeed = _.has(attributes, 'fxSpeed') ? attributes.fxSpeed : this.fxSpeed;\n\t\n\t /** filters for displaying subviews */\n\t this.filters = [];\n\t /** current search terms */\n\t this.searchFor = attributes.searchFor || '';\n\t\n\t /** loading indicator */\n\t // this.indicator = new LoadingIndicator( this.$el );\n\t\n\t /** currently showing selectors on items? */\n\t this.selecting = attributes.selecting !== undefined ? attributes.selecting : true;\n\t //this.selecting = false;\n\t\n\t /** cached selected item.model.ids to persist btwn renders */\n\t this.selected = attributes.selected || [];\n\t /** the last selected item.model.id */\n\t this.lastSelected = null;\n\t\n\t /** are sub-views draggable */\n\t this.dragItems = attributes.dragItems || false;\n\t\n\t /** list item view class (when passed models) */\n\t this.viewClass = attributes.viewClass || this.viewClass;\n\t\n\t /** list item views */\n\t this.views = [];\n\t /** list item models */\n\t this.collection = attributes.collection || this._createDefaultCollection();\n\t\n\t /** filter fns run over collection items to see if they should show in the list */\n\t this.filters = attributes.filters || [];\n\t\n\t /** override $scrollContainer fn via attributes - fn should return jq for elem to call scrollTo on */\n\t this.$scrollContainer = attributes.$scrollContainer || this.$scrollContainer;\n\t\n\t /** @type {String} generic title */\n\t this.title = attributes.title || '';\n\t /** @type {String} generic subtitle */\n\t this.subtitle = attributes.subtitle || '';\n\t\n\t this._setUpListeners();\n\t },\n\t\n\t // ------------------------------------------------------------------------ listeners\n\t /** create any event listeners for the list */\n\t _setUpListeners: function () {\n\t this.off();\n\t\n\t //TODO: move errorHandler down into list-view from history-view or\n\t // pass to global error handler (Galaxy)\n\t this.on({\n\t error: function (model, xhr, options, msg, details) {\n\t //this.errorHandler( model, xhr, options, msg, details );\n\t console.error(model, xhr, options, msg, details);\n\t },\n\t // show hide the loading indicator\n\t loading: function () {\n\t this._showLoadingIndicator('loading...', 40);\n\t },\n\t 'loading-done': function () {\n\t this._hideLoadingIndicator(40);\n\t }\n\t });\n\t\n\t // throw the first render up as a diff namespace using once (for outside consumption)\n\t this.once('rendered', function () {\n\t this.trigger('rendered:initial', this);\n\t });\n\t\n\t this._setUpCollectionListeners();\n\t this._setUpViewListeners();\n\t return this;\n\t },\n\t\n\t /** create and return a collection for when none is initially passed */\n\t _createDefaultCollection: function () {\n\t // override\n\t return new this.collectionClass([]);\n\t },\n\t\n\t /** listening for collection events */\n\t _setUpCollectionListeners: function () {\n\t this.log(this + '._setUpCollectionListeners', this.collection);\n\t this.stopListening(this.collection);\n\t\n\t // bubble up error events\n\t this.listenTo(this.collection, {\n\t error: function (model, xhr, options, msg, details) {\n\t this.trigger('error', model, xhr, options, msg, details);\n\t },\n\t update: function (collection, options) {\n\t var changes = options.changes;\n\t // console.info( collection + ', update:', changes, '\\noptions:', options );\n\t // more than one: render everything\n\t if (options.renderAll || changes.added.length + changes.removed.length > 1) {\n\t return this.renderItems();\n\t }\n\t // otherwise, let the single add/remove handlers do it\n\t if (changes.added.length === 1) {\n\t return this.addItemView(_.first(changes.added), collection, options);\n\t }\n\t if (changes.removed.length === 1) {\n\t return this.removeItemView(_.first(changes.removed), collection, options);\n\t }\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** listening for sub-view events that bubble up with the 'view:' prefix */\n\t _setUpViewListeners: function () {\n\t this.log(this + '._setUpViewListeners');\n\t\n\t // shift to select a range\n\t this.on({\n\t 'view:selected': function (view, ev) {\n\t if (ev && ev.shiftKey && this.lastSelected) {\n\t var lastSelectedView = this.viewFromModelId(this.lastSelected);\n\t if (lastSelectedView) {\n\t this.selectRange(view, lastSelectedView);\n\t }\n\t } else if (ev && ev.altKey && !this.selecting) {\n\t this.showSelectors();\n\t }\n\t this.selected.push(view.model.id);\n\t this.lastSelected = view.model.id;\n\t },\n\t\n\t 'view:de-selected': function (view, ev) {\n\t this.selected = _.without(this.selected, view.model.id);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering\n\t /** Render this content, set up ui.\n\t * @param {Number or String} speed the speed of the render\n\t */\n\t render: function (speed) {\n\t this.log(this + '.render', speed);\n\t var $newRender = this._buildNewRender();\n\t this._setUpBehaviors($newRender);\n\t this._queueNewRender($newRender, speed);\n\t return this;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el. */\n\t _buildNewRender: function () {\n\t this.debug(this + '(ListPanel)._buildNewRender');\n\t var $newRender = $(this.templates.el({}, this));\n\t this._renderControls($newRender);\n\t this._renderTitle($newRender);\n\t this._renderSubtitle($newRender);\n\t this._renderSearch($newRender);\n\t this.renderItems($newRender);\n\t return $newRender;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el. */\n\t _renderControls: function ($newRender) {\n\t this.debug(this + '(ListPanel)._renderControls');\n\t var $controls = $(this.templates.controls({}, this));\n\t $newRender.find('.controls').replaceWith($controls);\n\t return $controls;\n\t },\n\t\n\t /** return a jQuery object containing the title DOM */\n\t _renderTitle: function ($where) {\n\t //$where = $where || this.$el;\n\t //$where.find( '.title' ).replaceWith( ... )\n\t },\n\t\n\t /** return a jQuery object containing the subtitle DOM (if any) */\n\t _renderSubtitle: function ($where) {\n\t //$where = $where || this.$el;\n\t //$where.find( '.title' ).replaceWith( ... )\n\t },\n\t\n\t /** Fade out the old el, swap in the new contents, then fade in.\n\t * @param {Number or String} speed jq speed to use for rendering effects\n\t * @fires rendered when rendered\n\t */\n\t _queueNewRender: function ($newRender, speed) {\n\t speed = speed === undefined ? this.fxSpeed : speed;\n\t var panel = this;\n\t panel.log('_queueNewRender:', $newRender, speed);\n\t\n\t $(panel).queue('fx', [function (next) {\n\t panel.$el.fadeOut(speed, next);\n\t }, function (next) {\n\t panel._swapNewRender($newRender);\n\t next();\n\t }, function (next) {\n\t panel.$el.fadeIn(speed, next);\n\t }, function (next) {\n\t panel.trigger('rendered', panel);\n\t next();\n\t }]);\n\t },\n\t\n\t /** empty out the current el, move the $newRender's children in */\n\t _swapNewRender: function ($newRender) {\n\t this.$el.empty().attr('class', this.className).append($newRender.children());\n\t if (this.selecting) {\n\t this.showSelectors(0);\n\t }\n\t return this;\n\t },\n\t\n\t /** Set up any behaviors, handlers (ep. plugins) that need to be called when the entire view has been built but\n\t * not attached to the page yet.\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t this.$controls($where).find('[title]').tooltip();\n\t // set up the pupup for actions available when multi selecting\n\t this._renderMultiselectActionMenu($where);\n\t return this;\n\t },\n\t\n\t /** render a menu containing the actions available to sets of selected items */\n\t _renderMultiselectActionMenu: function ($where) {\n\t $where = $where || this.$el;\n\t var $menu = $where.find('.list-action-menu'),\n\t actions = this.multiselectActions();\n\t if (!actions.length) {\n\t return $menu.empty();\n\t }\n\t\n\t var $newMenu = $(['
      ', '', '
        ', '
      ', '
      '].join(''));\n\t var $actions = actions.map(function (action) {\n\t var html = ['
    • ', action.html, '
    • '].join('');\n\t return $(html).click(function (ev) {\n\t ev.preventDefault();\n\t return action.func(ev);\n\t });\n\t });\n\t $newMenu.find('ul').append($actions);\n\t $menu.replaceWith($newMenu);\n\t return $newMenu;\n\t },\n\t\n\t /** return a list of plain objects used to render multiselect actions menu. Each object should have:\n\t * html: an html string used as the anchor contents\n\t * func: a function called when the anchor is clicked (passed the click event)\n\t */\n\t multiselectActions: function () {\n\t return [];\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-$element shortcuts\n\t /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n\t $scrollContainer: function ($where) {\n\t // override or set via attributes.$scrollContainer\n\t return ($where || this.$el).parent().parent();\n\t },\n\t /** convenience selector for the section that displays the list controls */\n\t $controls: function ($where) {\n\t return ($where || this.$el).find('> .controls');\n\t },\n\t /** list-items: where the subviews are contained in the view's dom */\n\t $list: function ($where) {\n\t return ($where || this.$el).find('> .list-items');\n\t },\n\t /** container where list messages are attached */\n\t $messages: function ($where) {\n\t //TODO: controls isn't really correct here (only for ModelListPanel)\n\t return ($where || this.$el).find('> .controls .messages');\n\t },\n\t /** the message displayed when no views can be shown (no views, none matching search) */\n\t $emptyMessage: function ($where) {\n\t return ($where || this.$el).find('> .empty-message');\n\t },\n\t\n\t // ------------------------------------------------------------------------ hda sub-views\n\t /** render the subviews for the list's collection */\n\t renderItems: function ($whereTo) {\n\t $whereTo = $whereTo || this.$el;\n\t var panel = this;\n\t panel.log(this + '.renderItems', $whereTo);\n\t\n\t var $list = panel.$list($whereTo);\n\t panel.freeViews();\n\t // console.log( 'views freed' );\n\t //TODO:? cache and re-use views?\n\t var shownModels = panel._filterCollection();\n\t // console.log( 'models filtered:', shownModels );\n\t\n\t panel.views = shownModels.map(function (itemModel) {\n\t var view = panel._createItemView(itemModel);\n\t return view;\n\t });\n\t\n\t $list.empty();\n\t // console.log( 'list emptied' );\n\t if (panel.views.length) {\n\t panel._attachItems($whereTo);\n\t // console.log( 'items attached' );\n\t }\n\t panel._renderEmptyMessage($whereTo).toggle(!panel.views.length);\n\t panel.trigger('views:ready', panel.views);\n\t\n\t // console.log( '------------------------------------------- rendering items' );\n\t return panel.views;\n\t },\n\t\n\t /** Filter the collection to only those models that should be currently viewed */\n\t _filterCollection: function () {\n\t // override this\n\t var panel = this;\n\t return panel.collection.filter(_.bind(panel._filterItem, panel));\n\t },\n\t\n\t /** Should the model be viewable in the current state?\n\t * Checks against this.filters and this.searchFor\n\t */\n\t _filterItem: function (model) {\n\t // override this\n\t var panel = this;\n\t return _.every(panel.filters.map(function (fn) {\n\t return fn.call(model);\n\t })) && (!panel.searchFor || model.matchesAll(panel.searchFor));\n\t },\n\t\n\t /** Create a view for a model and set up it's listeners */\n\t _createItemView: function (model) {\n\t var ViewClass = this._getItemViewClass(model);\n\t var options = _.extend(this._getItemViewOptions(model), {\n\t model: model\n\t });\n\t var view = new ViewClass(options);\n\t this._setUpItemViewListeners(view);\n\t return view;\n\t },\n\t\n\t /** Free a view for a model. Note: does not remove it from the DOM */\n\t _destroyItemView: function (view) {\n\t this.stopListening(view);\n\t this.views = _.without(this.views, view);\n\t },\n\t\n\t _destroyItemViews: function (view) {\n\t var self = this;\n\t self.views.forEach(function (v) {\n\t self.stopListening(v);\n\t });\n\t self.views = [];\n\t return self;\n\t },\n\t\n\t /** free any sub-views the list has */\n\t freeViews: function () {\n\t return this._destroyItemViews();\n\t },\n\t\n\t /** Get the bbone view class based on the model */\n\t _getItemViewClass: function (model) {\n\t // override this\n\t return this.viewClass;\n\t },\n\t\n\t /** Get the options passed to the new view based on the model */\n\t _getItemViewOptions: function (model) {\n\t // override this\n\t return {\n\t //logger : this.logger,\n\t fxSpeed: this.fxSpeed,\n\t expanded: false,\n\t selectable: this.selecting,\n\t selected: _.contains(this.selected, model.id),\n\t draggable: this.dragItems\n\t };\n\t },\n\t\n\t /** Set up listeners for new models */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t // send all events to the panel, re-namspaceing them with the view prefix\n\t this.listenTo(view, 'all', function () {\n\t var args = Array.prototype.slice.call(arguments, 0);\n\t args[0] = 'view:' + args[0];\n\t panel.trigger.apply(panel, args);\n\t });\n\t\n\t // drag multiple - hijack ev.setData to add all selected items\n\t this.listenTo(view, 'draggable:dragstart', function (ev, v) {\n\t //TODO: set multiple drag data here\n\t var json = {},\n\t selected = this.getSelectedModels();\n\t if (selected.length) {\n\t json = selected.toJSON();\n\t } else {\n\t json = [v.model.toJSON()];\n\t }\n\t ev.dataTransfer.setData('text', JSON.stringify(json));\n\t //ev.dataTransfer.setDragImage( v.el, 60, 60 );\n\t }, this);\n\t\n\t return panel;\n\t },\n\t\n\t /** Attach views in this.views to the model based on $whereTo */\n\t _attachItems: function ($whereTo) {\n\t var self = this;\n\t // console.log( '_attachItems:', $whereTo, this.$list( $whereTo ) );\n\t //ASSUMES: $list has been emptied\n\t this.$list($whereTo).append(this.views.map(function (view) {\n\t return self._renderItemView$el(view);\n\t }));\n\t return this;\n\t },\n\t\n\t /** get a given subview's $el (or whatever may wrap it) and return it */\n\t _renderItemView$el: function (view) {\n\t // useful to wrap and override\n\t return view.render(0).$el;\n\t },\n\t\n\t /** render the empty/none-found message */\n\t _renderEmptyMessage: function ($whereTo) {\n\t this.debug('_renderEmptyMessage', $whereTo, this.searchFor);\n\t var text = this.searchFor ? this.noneFoundMsg : this.emptyMsg;\n\t return this.$emptyMessage($whereTo).text(text);\n\t },\n\t\n\t /** expand all item views */\n\t expandAll: function () {\n\t _.each(this.views, function (view) {\n\t view.expand();\n\t });\n\t },\n\t\n\t /** collapse all item views */\n\t collapseAll: function () {\n\t _.each(this.views, function (view) {\n\t view.collapse();\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ collection/views syncing\n\t /** Add a view (if the model should be viewable) to the panel */\n\t addItemView: function (model, collection, options) {\n\t // console.log( this + '.addItemView:', model );\n\t var panel = this;\n\t // get the index of the model in the list of filtered models shown by this list\n\t // in order to insert the view in the proper place\n\t //TODO:? potentially expensive\n\t var modelIndex = panel._filterCollection().indexOf(model);\n\t if (modelIndex === -1) {\n\t return undefined;\n\t }\n\t var view = panel._createItemView(model);\n\t // console.log( 'adding and rendering:', modelIndex, view.toString() );\n\t\n\t $(view).queue('fx', [function (next) {\n\t // hide the empty message first if only view\n\t if (panel.$emptyMessage().is(':visible')) {\n\t panel.$emptyMessage().fadeOut(panel.fxSpeed, next);\n\t } else {\n\t next();\n\t }\n\t }, function (next) {\n\t panel._attachView(view, modelIndex);\n\t next();\n\t }]);\n\t return view;\n\t },\n\t\n\t /** internal fn to add view (to both panel.views and panel.$list) */\n\t _attachView: function (view, modelIndex, useFx) {\n\t // console.log( this + '._attachView:', view, modelIndex, useFx );\n\t useFx = _.isUndefined(useFx) ? true : useFx;\n\t modelIndex = modelIndex || 0;\n\t var panel = this;\n\t\n\t // use the modelIndex to splice into views and insert at the proper index in the DOM\n\t panel.views.splice(modelIndex, 0, view);\n\t panel._insertIntoListAt(modelIndex, panel._renderItemView$el(view).hide());\n\t\n\t panel.trigger('view:attached', view);\n\t if (useFx) {\n\t view.$el.slideDown(panel.fxSpeed, function () {\n\t panel.trigger('view:attached:rendered');\n\t });\n\t } else {\n\t view.$el.show();\n\t panel.trigger('view:attached:rendered');\n\t }\n\t return view;\n\t },\n\t\n\t /** insert a jq object as a child of list-items at the specified *DOM index* */\n\t _insertIntoListAt: function (index, $what) {\n\t // console.log( this + '._insertIntoListAt:', index, $what );\n\t var $list = this.$list();\n\t if (index === 0) {\n\t $list.prepend($what);\n\t } else {\n\t $list.children().eq(index - 1).after($what);\n\t }\n\t return $what;\n\t },\n\t\n\t /** Remove a view from the panel (if found) */\n\t removeItemView: function (model, collection, options) {\n\t var panel = this;\n\t var view = _.find(panel.views, function (v) {\n\t return v.model === model;\n\t });\n\t if (!view) {\n\t return undefined;\n\t }\n\t panel.views = _.without(panel.views, view);\n\t panel.trigger('view:removed', view);\n\t\n\t // potentially show the empty message if no views left\n\t // use anonymous queue here - since remove can happen multiple times\n\t $({}).queue('fx', [function (next) {\n\t view.$el.fadeOut(panel.fxSpeed, next);\n\t }, function (next) {\n\t view.remove();\n\t panel.trigger('view:removed:rendered');\n\t if (!panel.views.length) {\n\t panel._renderEmptyMessage().fadeIn(panel.fxSpeed, next);\n\t } else {\n\t next();\n\t }\n\t }]);\n\t return view;\n\t },\n\t\n\t /** get views based on model.id */\n\t viewFromModelId: function (id) {\n\t return _.find(this.views, function (v) {\n\t return v.model.id === id;\n\t });\n\t },\n\t\n\t /** get views based on model */\n\t viewFromModel: function (model) {\n\t return model ? this.viewFromModelId(model.id) : undefined;\n\t },\n\t\n\t /** get views based on model properties */\n\t viewsWhereModel: function (properties) {\n\t return this.views.filter(function (view) {\n\t return _.isMatch(view.model.attributes, properties);\n\t });\n\t },\n\t\n\t /** A range of views between (and including) viewA and viewB */\n\t viewRange: function (viewA, viewB) {\n\t if (viewA === viewB) {\n\t return viewA ? [viewA] : [];\n\t }\n\t\n\t var indexA = this.views.indexOf(viewA),\n\t indexB = this.views.indexOf(viewB);\n\t\n\t // handle not found\n\t if (indexA === -1 || indexB === -1) {\n\t if (indexA === indexB) {\n\t return [];\n\t }\n\t return indexA === -1 ? [viewB] : [viewA];\n\t }\n\t // reverse if indeces are\n\t //note: end inclusive\n\t return indexA < indexB ? this.views.slice(indexA, indexB + 1) : this.views.slice(indexB, indexA + 1);\n\t },\n\t\n\t // ------------------------------------------------------------------------ searching\n\t /** render a search input for filtering datasets shown\n\t * (see SearchableMixin in base-mvc for implementation of the actual searching)\n\t * return will start the search\n\t * esc will clear the search\n\t * clicking the clear button will clear the search\n\t * uses searchInput in ui.js\n\t */\n\t _renderSearch: function ($where) {\n\t $where.find('.controls .search-input').searchInput({\n\t placeholder: this.searchPlaceholder,\n\t initialVal: this.searchFor,\n\t onfirstsearch: _.bind(this._firstSearch, this),\n\t onsearch: _.bind(this.searchItems, this),\n\t onclear: _.bind(this.clearSearch, this)\n\t });\n\t return $where;\n\t },\n\t\n\t /** What to do on the first search entered */\n\t _firstSearch: function (searchFor) {\n\t // override to load model details if necc.\n\t this.log('onFirstSearch', searchFor);\n\t return this.searchItems(searchFor);\n\t },\n\t\n\t /** filter view list to those that contain the searchFor terms */\n\t searchItems: function (searchFor, force) {\n\t this.log('searchItems', searchFor, this.searchFor, force);\n\t if (!force && this.searchFor === searchFor) {\n\t return this;\n\t }\n\t this.searchFor = searchFor;\n\t this.renderItems();\n\t this.trigger('search:searching', searchFor, this);\n\t var $search = this.$('> .controls .search-query');\n\t if ($search.val() !== searchFor) {\n\t $search.val(searchFor);\n\t }\n\t return this;\n\t },\n\t\n\t /** clear the search filters and show all views that are normally shown */\n\t clearSearch: function (searchFor) {\n\t //this.log( 'onSearchClear', this );\n\t this.searchFor = '';\n\t this.trigger('search:clear', this);\n\t this.$('> .controls .search-query').val('');\n\t this.renderItems();\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ selection\n\t /** @type Integer when the number of list item views is >= to this, don't animate selectors */\n\t THROTTLE_SELECTOR_FX_AT: 20,\n\t\n\t /** show selectors on all visible itemViews and associated controls */\n\t showSelectors: function (speed) {\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t this.selecting = true;\n\t this.$('.list-actions').slideDown(speed);\n\t speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT ? 0 : speed;\n\t _.each(this.views, function (view) {\n\t view.showSelector(speed);\n\t });\n\t //this.selected = [];\n\t //this.lastSelected = null;\n\t },\n\t\n\t /** hide selectors on all visible itemViews and associated controls */\n\t hideSelectors: function (speed) {\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t this.selecting = false;\n\t this.$('.list-actions').slideUp(speed);\n\t speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT ? 0 : speed;\n\t _.each(this.views, function (view) {\n\t view.hideSelector(speed);\n\t });\n\t this.selected = [];\n\t this.lastSelected = null;\n\t },\n\t\n\t /** show or hide selectors on all visible itemViews and associated controls */\n\t toggleSelectors: function () {\n\t if (!this.selecting) {\n\t this.showSelectors();\n\t } else {\n\t this.hideSelectors();\n\t }\n\t },\n\t\n\t /** select all visible items */\n\t selectAll: function (event) {\n\t _.each(this.views, function (view) {\n\t view.select(event);\n\t });\n\t },\n\t\n\t /** deselect all visible items */\n\t deselectAll: function (event) {\n\t this.lastSelected = null;\n\t _.each(this.views, function (view) {\n\t view.deselect(event);\n\t });\n\t },\n\t\n\t /** select a range of datasets between A and B */\n\t selectRange: function (viewA, viewB) {\n\t var range = this.viewRange(viewA, viewB);\n\t _.each(range, function (view) {\n\t view.select();\n\t });\n\t return range;\n\t },\n\t\n\t /** return an array of all currently selected itemViews */\n\t getSelectedViews: function () {\n\t return _.filter(this.views, function (v) {\n\t return v.selected;\n\t });\n\t },\n\t\n\t /** return a collection of the models of all currenly selected items */\n\t getSelectedModels: function () {\n\t // console.log( '(getSelectedModels)' );\n\t return new this.collection.constructor(_.map(this.getSelectedViews(), function (view) {\n\t return view.model;\n\t }));\n\t },\n\t\n\t // ------------------------------------------------------------------------ loading indicator\n\t /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n\t _showLoadingIndicator: function (msg, speed, callback) {\n\t this.debug('_showLoadingIndicator', this.indicator, msg, speed, callback);\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t if (!this.indicator) {\n\t this.indicator = new LoadingIndicator(this.$el);\n\t this.debug('\\t created', this.indicator);\n\t }\n\t if (!this.$el.is(':visible')) {\n\t this.indicator.show(0, callback);\n\t } else {\n\t this.$el.fadeOut(speed);\n\t this.indicator.show(msg, speed, callback);\n\t }\n\t },\n\t\n\t /** hide the loading indicator */\n\t _hideLoadingIndicator: function (speed, callback) {\n\t this.debug('_hideLoadingIndicator', this.indicator, speed, callback);\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t if (this.indicator) {\n\t this.indicator.hide(speed, callback);\n\t }\n\t },\n\t\n\t // ------------------------------------------------------------------------ scrolling\n\t /** get the current scroll position of the panel in its parent */\n\t scrollPosition: function () {\n\t return this.$scrollContainer().scrollTop();\n\t },\n\t\n\t /** set the current scroll position of the panel in its parent */\n\t scrollTo: function (pos, speed) {\n\t speed = speed || 0;\n\t this.$scrollContainer().animate({ scrollTop: pos }, speed);\n\t return this;\n\t },\n\t\n\t /** Scrolls the panel to the top. */\n\t scrollToTop: function (speed) {\n\t return this.scrollTo(0, speed);\n\t },\n\t\n\t /** scroll to the given view in list-items */\n\t scrollToItem: function (view, speed) {\n\t if (!view) {\n\t return this;\n\t }\n\t return this;\n\t },\n\t\n\t /** Scrolls the panel to show the content with the given id. */\n\t scrollToId: function (id, speed) {\n\t return this.scrollToItem(this.viewFromModelId(id), speed);\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: {\n\t 'click .select-all': 'selectAll',\n\t 'click .deselect-all': 'deselectAll'\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** Return a string rep of the panel */\n\t toString: function () {\n\t return 'ListPanel(' + this.collection + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t ListPanel.prototype.templates = function () {\n\t\n\t var elTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
      ', '
      ', '
      ', '
      ', '
      ']);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
      ', '
      ', '
      <%- view.title %>
      ', '
      ', '
      <%- view.subtitle %>
      ',\n\t // buttons, controls go here\n\t '
      ',\n\t // deleted msg, etc.\n\t '
      ', '
      ', '
      ', '
      ',\n\t\n\t // show when selectors are shown\n\t '
      ', '
      ', '', '', '
      ', '
      ', '
      ', '
      ', '
      ']);\n\t\n\t return {\n\t el: elTemplate,\n\t controls: controlsTemplate\n\t };\n\t }();\n\t\n\t //=============================================================================\n\t /** View for a model that has a sub-collection (e.g. History, DatasetCollection)\n\t * Allows:\n\t * the model to be reset\n\t * auto assign panel.collection to panel.model[ panel.modelCollectionKey ]\n\t *\n\t */\n\t var ModelListPanel = ListPanel.extend({\n\t\n\t /** key of attribute in model to assign to this.collection */\n\t modelCollectionKey: 'contents',\n\t\n\t initialize: function (attributes) {\n\t ListPanel.prototype.initialize.call(this, attributes);\n\t this.selecting = attributes.selecting !== undefined ? attributes.selecting : false;\n\t\n\t this.setModel(this.model, attributes);\n\t },\n\t\n\t /** release/free/shutdown old models and set up panel for new models\n\t * @fires new-model with the panel as parameter\n\t */\n\t setModel: function (model, attributes) {\n\t attributes = attributes || {};\n\t this.debug(this + '.setModel:', model, attributes);\n\t\n\t this.freeModel();\n\t this.freeViews();\n\t\n\t if (model) {\n\t var oldModelId = this.model ? this.model.get('id') : null;\n\t\n\t // set up the new model with user, logger, storage, events\n\t this.model = model;\n\t if (this.logger) {\n\t this.model.logger = this.logger;\n\t }\n\t this._setUpModelListeners();\n\t\n\t //TODO: relation btwn model, collection becoming tangled here\n\t // free the collection, and assign the new collection to either\n\t // the model[ modelCollectionKey ], attributes.collection, or an empty vanilla collection\n\t this.stopListening(this.collection);\n\t this.collection = this.model[this.modelCollectionKey] || attributes.collection || this._createDefaultCollection();\n\t this._setUpCollectionListeners();\n\t\n\t if (oldModelId && model.get('id') !== oldModelId) {\n\t this.trigger('new-model', this);\n\t }\n\t }\n\t return this;\n\t },\n\t\n\t /** free the current model and all listeners for it, free any views for the model */\n\t freeModel: function () {\n\t // stop/release the previous model, and clear cache to sub-views\n\t if (this.model) {\n\t this.stopListening(this.model);\n\t //TODO: see base-mvc\n\t //this.model.free();\n\t //this.model = null;\n\t }\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ listening\n\t /** listening for model events */\n\t _setUpModelListeners: function () {\n\t // override\n\t this.log(this + '._setUpModelListeners', this.model);\n\t // bounce model errors up to the panel\n\t this.listenTo(this.model, 'error', function () {\n\t var args = Array.prototype.slice.call(arguments, 0);\n\t //args.unshift( 'model:error' );\n\t args.unshift('error');\n\t this.trigger.apply(this, args);\n\t }, this);\n\t\n\t // debugging\n\t if (this.logger) {\n\t this.listenTo(this.model, 'all', function (event) {\n\t this.info(this + '(model)', event, arguments);\n\t });\n\t }\n\t return this;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el.\n\t */\n\t _renderControls: function ($newRender) {\n\t this.debug(this + '(ModelListPanel)._renderControls');\n\t var json = this.model ? this.model.toJSON() : {},\n\t $controls = $(this.templates.controls(json, this));\n\t $newRender.find('.controls').replaceWith($controls);\n\t return $controls;\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** Return a string rep of the panel */\n\t toString: function () {\n\t return 'ModelListPanel(' + this.model + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t ModelListPanel.prototype.templates = function () {\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
      ', '
      ',\n\t //TODO: this is really the only difference - consider factoring titlebar out\n\t '
      <%- model.name %>
      ', '
      ', '
      <%- view.subtitle %>
      ', '
      ', '
      ', '
      ', '
      ', '
      ', '
      ', '
      ', '', '', '
      ', '
      ', '
      ', '
      ', '
      ']);\n\t\n\t return _.extend(_.clone(ListPanel.prototype.templates), {\n\t controls: controlsTemplate\n\t });\n\t }();\n\t\n\t //=============================================================================\n\t return {\n\t ListPanel: ListPanel,\n\t ModelListPanel: ModelListPanel\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ }),\n/* 92 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This is the run workflow tool form view. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(50), __webpack_require__(5), __webpack_require__(10), __webpack_require__(19), __webpack_require__(46), __webpack_require__(8), __webpack_require__(44), __webpack_require__(147)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Deferred, Ui, Form, FormData, ToolFormBase, Modal, Webhooks, WorkflowIcons) {\n\t\n\t var View = Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.modal = parent.Galaxy.modal || new Modal.View();\n\t this.model = options && options.model || new Backbone.Model(options);\n\t this.deferred = new Deferred();\n\t this.setElement($('
      ').addClass('ui-form-composite').append(this.$message = $('
      ')).append(this.$header = $('
      ')).append(this.$steps = $('
      ')));\n\t $('body').append(this.$el);\n\t this._configure();\n\t this.render();\n\t $(window).resize(function () {\n\t self._refresh();\n\t });\n\t },\n\t\n\t /** Refresh height of scrollable div below header, handle scrolling by lazy loading steps */\n\t _refresh: function (step_index) {\n\t var margin = _.reduce(this.$el.children(), function (memo, child) {\n\t return memo + $(child).outerHeight();\n\t }, 0) - this.$steps.height() + 90;\n\t this.$steps.css('height', $(window).height() - margin);\n\t },\n\t\n\t /** Configures form/step options for each workflow step */\n\t _configure: function () {\n\t var self = this;\n\t this.forms = [];\n\t this.steps = [];\n\t this.links = [];\n\t this.parms = [];\n\t _.each(this.model.get('steps'), function (step, i) {\n\t Galaxy.emit.debug('tool-form-composite::initialize()', i + ' : Preparing workflow step.');\n\t var icon = WorkflowIcons[step.step_type];\n\t var title = parseInt(i + 1) + ': ' + (step.step_label || step.step_name);\n\t if (step.annotation) {\n\t title += ' - ' + step.annotation;\n\t }\n\t if (step.step_version) {\n\t title += ' (Galaxy Version ' + step.step_version + ')';\n\t }\n\t step = Utils.merge({\n\t index: i,\n\t fixed_title: _.escape(title),\n\t icon: icon || '',\n\t help: null,\n\t citations: null,\n\t collapsible: true,\n\t collapsed: i > 0 && !self._isDataStep(step),\n\t sustain_version: true,\n\t sustain_repeats: true,\n\t sustain_conditionals: true,\n\t narrow: true,\n\t text_enable: 'Edit',\n\t text_disable: 'Undo',\n\t cls_enable: 'fa fa-edit',\n\t cls_disable: 'fa fa-undo',\n\t errors: step.messages,\n\t initial_errors: true,\n\t cls: 'ui-portlet-narrow',\n\t hide_operations: true,\n\t needs_refresh: false,\n\t always_refresh: step.step_type != 'tool'\n\t }, step);\n\t self.steps[i] = step;\n\t self.links[i] = [];\n\t self.parms[i] = {};\n\t });\n\t\n\t // build linear index of step input pairs\n\t _.each(this.steps, function (step, i) {\n\t FormData.visitInputs(step.inputs, function (input, name) {\n\t self.parms[i][name] = input;\n\t });\n\t });\n\t\n\t // iterate through data input modules and collect linked sub steps\n\t _.each(this.steps, function (step, i) {\n\t _.each(step.output_connections, function (output_connection) {\n\t _.each(self.steps, function (sub_step, j) {\n\t sub_step.step_index === output_connection.input_step_index && self.links[i].push(sub_step);\n\t });\n\t });\n\t });\n\t\n\t // convert all connected data inputs to hidden fields with proper labels,\n\t // and track the linked source step\n\t _.each(this.steps, function (step, i) {\n\t _.each(self.steps, function (sub_step, j) {\n\t var connections_by_name = {};\n\t _.each(step.output_connections, function (connection) {\n\t sub_step.step_index === connection.input_step_index && (connections_by_name[connection.input_name] = connection);\n\t });\n\t _.each(self.parms[j], function (input, name) {\n\t var connection = connections_by_name[name];\n\t if (connection) {\n\t input.type = 'hidden';\n\t input.help = input.step_linked ? input.help + ', ' : '';\n\t input.help += 'Output dataset \\'' + connection.output_name + '\\' from step ' + (parseInt(i) + 1);\n\t input.step_linked = input.step_linked || [];\n\t input.step_linked.push(step);\n\t }\n\t });\n\t });\n\t });\n\t\n\t // identify and configure workflow parameters\n\t var wp_count = 0;\n\t this.wp_inputs = {};\n\t function _handleWorkflowParameter(value, callback) {\n\t var re = /\\$\\{(.+?)\\}/g,\n\t match;\n\t while (match = re.exec(String(value))) {\n\t var wp_name = match[1];\n\t callback(self.wp_inputs[wp_name] = self.wp_inputs[wp_name] || {\n\t label: wp_name,\n\t name: wp_name,\n\t type: 'text',\n\t color: 'hsl( ' + ++wp_count * 100 + ', 70%, 30% )',\n\t style: 'ui-form-wp-source',\n\t links: []\n\t });\n\t }\n\t }\n\t _.each(this.steps, function (step, i) {\n\t _.each(self.parms[i], function (input, name) {\n\t _handleWorkflowParameter(input.value, function (wp_input) {\n\t wp_input.links.push(step);\n\t input.wp_linked = true;\n\t input.type = 'text';\n\t input.backdrop = true;\n\t input.style = 'ui-form-wp-target';\n\t });\n\t });\n\t _.each(step.post_job_actions, function (pja) {\n\t _.each(pja.action_arguments, function (arg) {\n\t _handleWorkflowParameter(arg, function () {});\n\t });\n\t });\n\t });\n\t\n\t // select fields are shown for dynamic fields if all putative data inputs are available,\n\t // or if an explicit reference is specified as data_ref and available\n\t _.each(this.steps, function (step, i) {\n\t if (step.step_type == 'tool') {\n\t var data_resolved = true;\n\t FormData.visitInputs(step.inputs, function (input, name, context) {\n\t var is_runtime_value = input.value && input.value.__class__ == 'RuntimeValue';\n\t var is_data_input = ['data', 'data_collection'].indexOf(input.type) != -1;\n\t var data_ref = context[input.data_ref];\n\t input.step_linked && !self._isDataStep(input.step_linked) && (data_resolved = false);\n\t input.options && (input.options.length == 0 && !data_resolved || input.wp_linked) && (input.is_workflow = true);\n\t data_ref && (input.is_workflow = data_ref.step_linked && !self._isDataStep(data_ref.step_linked) || input.wp_linked);\n\t (is_data_input || input.value && input.value.__class__ == 'RuntimeValue' && !input.step_linked) && (step.collapsed = false);\n\t is_runtime_value && (input.value = input.default_value);\n\t input.flavor = 'workflow';\n\t if (!is_runtime_value && !is_data_input && input.type !== 'hidden' && !input.wp_linked) {\n\t if (input.optional || !Utils.isEmpty(input.value) && input.value !== '') {\n\t input.collapsible_value = input.value;\n\t input.collapsible_preview = true;\n\t }\n\t }\n\t });\n\t }\n\t });\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t this.deferred.reset();\n\t this._renderHeader();\n\t this._renderMessage();\n\t this._renderParameters();\n\t this._renderHistory();\n\t _.each(this.steps, function (step) {\n\t self._renderStep(step);\n\t });\n\t },\n\t\n\t /** Render header */\n\t _renderHeader: function () {\n\t var self = this;\n\t this.execute_btn = new Ui.Button({\n\t icon: 'fa-check',\n\t title: 'Run workflow',\n\t cls: 'btn btn-primary',\n\t onclick: function () {\n\t self._execute();\n\t }\n\t });\n\t this.$header.addClass('ui-form-header').empty().append(new Ui.Label({ title: 'Workflow: ' + this.model.get('name') }).$el).append(this.execute_btn.$el);\n\t },\n\t\n\t /** Render message */\n\t _renderMessage: function () {\n\t this.$message.empty();\n\t if (this.model.get('has_upgrade_messages')) {\n\t this.$message.append(new Ui.Message({\n\t message: 'Some tools in this workflow may have changed since it was last saved or some errors were found. The workflow may still run, but any new options will have default values. Please review the messages below to make a decision about whether the changes will affect your analysis.',\n\t status: 'warning',\n\t persistent: true,\n\t fade: false\n\t }).$el);\n\t }\n\t var step_version_changes = this.model.get('step_version_changes');\n\t if (step_version_changes && step_version_changes.length > 0) {\n\t this.$message.append(new Ui.Message({\n\t message: 'Some tools are being executed with different versions compared to those available when this workflow was last saved because the other versions are not or no longer available on this Galaxy instance. To upgrade your workflow and dismiss this message simply edit the workflow and re-save it.',\n\t status: 'warning',\n\t persistent: true,\n\t fade: false\n\t }).$el);\n\t }\n\t },\n\t\n\t /** Render workflow parameters */\n\t _renderParameters: function () {\n\t var self = this;\n\t this.wp_form = null;\n\t if (!_.isEmpty(this.wp_inputs)) {\n\t this.wp_form = new Form({ title: 'Workflow Parameters', inputs: this.wp_inputs, cls: 'ui-portlet-narrow', onchange: function () {\n\t _.each(self.wp_form.input_list, function (input_def, i) {\n\t _.each(input_def.links, function (step) {\n\t self._refreshStep(step);\n\t });\n\t });\n\t }\n\t });\n\t this._append(this.$steps.empty(), this.wp_form.$el);\n\t }\n\t },\n\t\n\t /** Render workflow parameters */\n\t _renderHistory: function () {\n\t this.history_form = new Form({\n\t cls: 'ui-portlet-narrow',\n\t title: 'History Options',\n\t inputs: [{\n\t type: 'conditional',\n\t name: 'new_history',\n\t test_param: {\n\t name: 'check',\n\t label: 'Send results to a new history',\n\t type: 'boolean',\n\t value: 'false',\n\t help: ''\n\t },\n\t cases: [{\n\t value: 'true',\n\t inputs: [{\n\t name: 'name',\n\t label: 'History name',\n\t type: 'text',\n\t value: this.model.get('name')\n\t }]\n\t }]\n\t }]\n\t });\n\t this._append(this.$steps, this.history_form.$el);\n\t },\n\t\n\t /** Render step */\n\t _renderStep: function (step) {\n\t var self = this;\n\t var form = null;\n\t this.deferred.execute(function (promise) {\n\t self.$steps.addClass('ui-steps');\n\t if (step.step_type == 'tool') {\n\t step.postchange = function (process, form) {\n\t var self = this;\n\t var current_state = {\n\t tool_id: step.id,\n\t tool_version: step.version,\n\t inputs: $.extend(true, {}, form.data.create())\n\t };\n\t form.wait(true);\n\t Galaxy.emit.debug('tool-form-composite::postchange()', 'Sending current state.', current_state);\n\t Utils.request({\n\t type: 'POST',\n\t url: Galaxy.root + 'api/tools/' + step.id + '/build',\n\t data: current_state,\n\t success: function (data) {\n\t form.update(data);\n\t form.wait(false);\n\t Galaxy.emit.debug('tool-form-composite::postchange()', 'Received new model.', data);\n\t process.resolve();\n\t },\n\t error: function (response) {\n\t Galaxy.emit.debug('tool-form-composite::postchange()', 'Refresh request failed.', response);\n\t process.reject();\n\t }\n\t });\n\t };\n\t form = new ToolFormBase(step);\n\t if (step.post_job_actions && step.post_job_actions.length) {\n\t form.portlet.append($('
      ').addClass('ui-form-element-disabled').append($('
      ').addClass('ui-form-title').html('Job Post Actions')).append($('
      ').addClass('ui-form-preview').html(_.reduce(step.post_job_actions, function (memo, value) {\n\t return memo + ' ' + value.short_str;\n\t }, ''))));\n\t }\n\t } else {\n\t var is_simple_input = ['data_input', 'data_collection_input'].indexOf(step.step_type) != -1;\n\t _.each(step.inputs, function (input) {\n\t input.flavor = 'module';input.hide_label = is_simple_input;\n\t });\n\t form = new Form(Utils.merge({\n\t title: step.fixed_title,\n\t onchange: function () {\n\t _.each(self.links[step.index], function (link) {\n\t self._refreshStep(link);\n\t });\n\t },\n\t inputs: step.inputs && step.inputs.length > 0 ? step.inputs : [{ type: 'hidden', name: 'No options available.', ignore: null }]\n\t }, step));\n\t }\n\t self.forms[step.index] = form;\n\t self._append(self.$steps, form.$el);\n\t self._refresh();\n\t step.needs_refresh && self._refreshStep(step);\n\t form.portlet[!self.show_progress ? 'enable' : 'disable']();\n\t self.show_progress && self.execute_btn.model.set({ wait: true,\n\t wait_text: 'Preparing...',\n\t percentage: (step.index + 1) * 100.0 / self.steps.length });\n\t Galaxy.emit.debug('tool-form-composite::initialize()', step.index + ' : Workflow step state ready.', step);\n\t setTimeout(function () {\n\t promise.resolve();\n\t }, 0);\n\t });\n\t },\n\t\n\t /** Refreshes step values from source step values */\n\t _refreshStep: function (step) {\n\t var self = this;\n\t var form = this.forms[step.index];\n\t if (form) {\n\t _.each(self.parms[step.index], function (input, name) {\n\t if (input.step_linked || input.wp_linked) {\n\t var field = form.field_list[form.data.match(name)];\n\t if (field) {\n\t var new_value = undefined;\n\t if (input.step_linked) {\n\t new_value = { values: [] };\n\t _.each(input.step_linked, function (source_step) {\n\t if (self._isDataStep(source_step)) {\n\t var value = self.forms[source_step.index].data.create().input;\n\t value && _.each(value.values, function (v) {\n\t new_value.values.push(v);\n\t });\n\t }\n\t });\n\t if (!input.multiple && new_value.values.length > 0) {\n\t new_value = { values: [new_value.values[0]] };\n\t }\n\t } else if (input.wp_linked) {\n\t new_value = input.value;\n\t var re = /\\$\\{(.+?)\\}/g,\n\t match;\n\t while (match = re.exec(input.value)) {\n\t var wp_field = self.wp_form.field_list[self.wp_form.data.match(match[1])];\n\t var wp_value = wp_field && wp_field.value();\n\t if (wp_value) {\n\t new_value = new_value.split(match[0]).join(wp_value);\n\t }\n\t }\n\t }\n\t if (new_value !== undefined) {\n\t field.value(new_value);\n\t }\n\t }\n\t }\n\t });\n\t form.trigger('change');\n\t } else {\n\t step.needs_refresh = true;\n\t }\n\t },\n\t\n\t /** Refresh the history after job submission while form is shown */\n\t _refreshHistory: function () {\n\t var self = this;\n\t var history = parent.Galaxy && parent.Galaxy.currHistoryPanel && parent.Galaxy.currHistoryPanel.model;\n\t this._refresh_history && clearTimeout(this._refresh_history);\n\t if (history) {\n\t history.refresh().success(function () {\n\t if (history.numOfUnfinishedShownContents() === 0) {\n\t self._refresh_history = setTimeout(function () {\n\t self._refreshHistory();\n\t }, history.UPDATE_DELAY);\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** Build remaining steps */\n\t _execute: function () {\n\t var self = this;\n\t this.show_progress = true;\n\t this._enabled(false);\n\t this.deferred.execute(function (promise) {\n\t setTimeout(function () {\n\t promise.resolve();self._submit();\n\t }, 0);\n\t });\n\t },\n\t\n\t /** Validate and submit workflow */\n\t _submit: function () {\n\t var self = this;\n\t var history_form_data = this.history_form.data.create();\n\t var job_def = {\n\t new_history_name: history_form_data['new_history|name'] ? history_form_data['new_history|name'] : null,\n\t history_id: !history_form_data['new_history|name'] ? this.model.get('history_id') : null,\n\t replacement_params: this.wp_form ? this.wp_form.data.create() : {},\n\t parameters: {},\n\t // Tool form will submit flat maps for each parameter\n\t // (e.g. \"repeat_0|cond|param\": \"foo\" instead of nested\n\t // data structures).\n\t parameters_normalized: true,\n\t // Tool form always wants a list of invocations back\n\t // so that inputs can be batched.\n\t batch: true\n\t };\n\t var validated = true;\n\t for (var i in this.forms) {\n\t var form = this.forms[i];\n\t var job_inputs = form.data.create();\n\t var step = self.steps[i];\n\t var step_index = step.step_index;\n\t form.trigger('reset');\n\t for (var job_input_id in job_inputs) {\n\t var input_value = job_inputs[job_input_id];\n\t var input_id = form.data.match(job_input_id);\n\t var input_field = form.field_list[input_id];\n\t var input_def = form.input_list[input_id];\n\t if (!input_def.step_linked) {\n\t if (this._isDataStep(step)) {\n\t validated = input_value && input_value.values && input_value.values.length > 0;\n\t } else {\n\t validated = input_def.optional || input_def.is_workflow && input_value !== '' || !input_def.is_workflow && input_value !== null;\n\t }\n\t if (!validated) {\n\t form.highlight(input_id);\n\t break;\n\t }\n\t job_def.parameters[step_index] = job_def.parameters[step_index] || {};\n\t job_def.parameters[step_index][job_input_id] = job_inputs[job_input_id];\n\t }\n\t }\n\t if (!validated) {\n\t break;\n\t }\n\t }\n\t if (!validated) {\n\t self._enabled(true);\n\t Galaxy.emit.debug('tool-form-composite::submit()', 'Validation failed.', job_def);\n\t } else {\n\t Galaxy.emit.debug('tool-form-composite::submit()', 'Validation complete.', job_def);\n\t Utils.request({\n\t type: 'POST',\n\t url: Galaxy.root + 'api/workflows/' + this.model.id + '/invocations',\n\t data: job_def,\n\t success: function (response) {\n\t Galaxy.emit.debug('tool-form-composite::submit', 'Submission successful.', response);\n\t self.$el.children().hide();\n\t self.$el.append(self._templateSuccess(response));\n\t\n\t // Show Webhook if job is running\n\t if ($.isArray(response) && response.length > 0) {\n\t self.$el.append($('
      ', { id: 'webhook-view' }));\n\t var WebhookApp = new Webhooks.WebhookView({\n\t urlRoot: Galaxy.root + 'api/webhooks/workflow',\n\t toolId: job_def.tool_id,\n\t toolVersion: job_def.tool_version\n\t });\n\t }\n\t\n\t self._refreshHistory();\n\t },\n\t error: function (response) {\n\t Galaxy.emit.debug('tool-form-composite::submit', 'Submission failed.', response);\n\t var input_found = false;\n\t if (response && response.err_data) {\n\t for (var i in self.forms) {\n\t var form = self.forms[i];\n\t var step_related_errors = response.err_data[form.model.get('step_index')];\n\t if (step_related_errors) {\n\t var error_messages = form.data.matchResponse(step_related_errors);\n\t for (var input_id in error_messages) {\n\t form.highlight(input_id, error_messages[input_id]);\n\t input_found = true;\n\t break;\n\t }\n\t }\n\t }\n\t }\n\t if (!input_found) {\n\t self.modal.show({\n\t title: 'Workflow submission failed',\n\t body: self._templateError(job_def, response && response.err_msg),\n\t buttons: {\n\t 'Close': function () {\n\t self.modal.hide();\n\t }\n\t }\n\t });\n\t }\n\t },\n\t complete: function () {\n\t self._enabled(true);\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** Append new dom to body */\n\t _append: function ($container, $el) {\n\t $container.append('

      ').append($el);\n\t },\n\t\n\t /** Set enabled/disabled state */\n\t _enabled: function (enabled) {\n\t this.execute_btn.model.set({ wait: !enabled, wait_text: 'Sending...', percentage: -1 });\n\t this.wp_form && this.wp_form.portlet[enabled ? 'enable' : 'disable']();\n\t this.history_form && this.history_form.portlet[enabled ? 'enable' : 'disable']();\n\t _.each(this.forms, function (form) {\n\t form && form.portlet[enabled ? 'enable' : 'disable']();\n\t });\n\t },\n\t\n\t /** Is data input module/step */\n\t _isDataStep: function (steps) {\n\t var lst = $.isArray(steps) ? steps : [steps];\n\t for (var i = 0; i < lst.length; i++) {\n\t var step = lst[i];\n\t if (!step || !step.step_type || !step.step_type.startsWith('data')) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t },\n\t\n\t /** Templates */\n\t _templateSuccess: function (response) {\n\t if ($.isArray(response) && response.length > 0) {\n\t return $('

      ').addClass('donemessagelarge').append($('

      ').html('Successfully invoked workflow ' + Utils.sanitize(this.model.get('name')) + '' + (response.length > 1 ? ' ' + response.length + ' times' : '') + '.')).append($('

      ').append('').text('You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from \\'running\\' to \\'finished\\' if completed successfully or \\'error\\' if problems were encountered.'));\n\t } else {\n\t return this._templateError(response, 'Invalid success response. No invocations found.');\n\t }\n\t },\n\t\n\t _templateError: function (response, err_msg) {\n\t return $('

      ').addClass('errormessagelarge').append($('

      ').text('The server could not complete the request. Please contact the Galaxy Team if this error persists. ' + (JSON.stringify(err_msg) || ''))).append($('

      ').text(JSON.stringify(response, null, 4)));\n\t        }\n\t    });\n\t    return {\n\t        View: View\n\t    };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 93 */,\n/* 94 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_l) {\n\t    'use strict';\n\t\n\t    //TODO: toastr is another possibility - I didn't see where I might add details, tho\n\t\n\t    /* ============================================================================\n\t    Error modals meant to replace the o-so-easy alerts.\n\t    \n\t    These are currently styled as errormessages but use the Galaxy.modal\n\t    infrastructure to be shown/closed. They're capable of showing details in a\n\t    togglable dropdown and the details are formatted in a pre.\n\t    \n\t    Example:\n\t        errorModal( 'Heres a message', 'A Title', { some_details: 'here' });\n\t        errorModal( 'Heres a message' ); // no details, title is 'Error'\n\t    \n\t    There are three specialized forms:\n\t        offlineErrorModal       a canned response for when there's no connection\n\t        badGatewayErrorModal    canned response for when Galaxy is restarting\n\t        ajaxErrorModal          plugable into any Backbone class as an\n\t            error event handler by accepting the error args: model, xhr, options\n\t    \n\t    Examples:\n\t        if( navigator.offLine ){ offlineErrorModal(); }\n\t        if( xhr.status === 502 ){ badGatewayErrorModal(); }\n\t        this.listenTo( this.model, 'error', ajaxErrorModal );\n\t    \n\t    ============================================================================ */\n\t\n\t    var CONTACT_MSG = _l('Please contact a Galaxy administrator if the problem persists.');\n\t    var DEFAULT_AJAX_ERR_MSG = _l('An error occurred while updating information with the server.');\n\t    var DETAILS_MSG = _l('The following information can assist the developers in finding the source of the error:');\n\t\n\t    /** private helper that builds the modal and handles adding details */\n\t    function _errorModal(message, title, details) {\n\t        // create and return the modal, adding details button only if needed\n\t        Galaxy.modal.show({\n\t            title: title,\n\t            body: message,\n\t            closing_events: true,\n\t            buttons: { Ok: function () {\n\t                    Galaxy.modal.hide();\n\t                } }\n\t        });\n\t        Galaxy.modal.$el.addClass('error-modal');\n\t\n\t        if (details) {\n\t            Galaxy.modal.$('.error-details').add(Galaxy.modal.$('button:contains(\"Details\")')).remove();\n\t            $('
      ').addClass('error-details').hide().appendTo(Galaxy.modal.$('.modal-content')).append([$('

      ').text(DETAILS_MSG), $('

      ').text(JSON.stringify(details, null, '  '))]);\n\t\n\t            $('').appendTo(Galaxy.modal.$('.buttons')).click(function () {\n\t                Galaxy.modal.$('.error-details').toggle();\n\t            });\n\t        }\n\t        return Galaxy.modal;\n\t    }\n\t\n\t    /** Display a modal showing an error message but fallback to alert if there's no modal */\n\t    function errorModal(message, title, details) {\n\t        if (!message) {\n\t            return;\n\t        }\n\t\n\t        message = _l(message);\n\t        title = _l(title) || _l('Error:');\n\t        if (window.Galaxy && Galaxy.modal) {\n\t            return _errorModal(message, title, details);\n\t        }\n\t\n\t        alert(title + '\\n\\n' + message);\n\t        console.log('error details:', JSON.stringify(details));\n\t    }\n\t\n\t    // ----------------------------------------------------------------------------\n\t    /** display a modal when the user may be offline */\n\t    function offlineErrorModal() {\n\t        return errorModal(_l('You appear to be offline. Please check your connection and try again.'), _l('Offline?'));\n\t    }\n\t\n\t    // ----------------------------------------------------------------------------\n\t    /** 502 messages that should be displayed when galaxy is restarting */\n\t    function badGatewayErrorModal() {\n\t        return errorModal(_l('Galaxy is currently unreachable. Please try again in a few minutes.') + ' ' + CONTACT_MSG, _l('Cannot connect to Galaxy'));\n\t    }\n\t\n\t    // ----------------------------------------------------------------------------\n\t    /** display a modal (with details) about a failed Backbone ajax operation */\n\t    function ajaxErrorModal(model, xhr, options, message, title) {\n\t        message = message || DEFAULT_AJAX_ERR_MSG;\n\t        message += ' ' + CONTACT_MSG;\n\t        title = title || _l('An error occurred');\n\t        var details = _ajaxDetails(model, xhr, options);\n\t        return errorModal(message, title, details);\n\t    }\n\t\n\t    /** build details which may help debugging the ajax call */\n\t    function _ajaxDetails(model, xhr, options) {\n\t        return {\n\t            //TODO: still can't manage Raven id\n\t            raven: _.result(window.Raven, 'lastEventId'),\n\t            userAgent: navigator.userAgent,\n\t            onLine: navigator.onLine,\n\t            version: _.result(Galaxy.config, 'version_major'),\n\t            xhr: _.omit(xhr, _.functions(xhr)),\n\t            options: _.omit(options, 'xhr'),\n\t            // add ajax data from Galaxy object cache\n\t            url: _.result(Galaxy.lastAjax, 'url'),\n\t            data: _.result(Galaxy.lastAjax, 'data'),\n\t            // backbone stuff (auto-redacting email for user)\n\t            model: _.result(model, 'toJSON', model + ''),\n\t            user: _.omit(_.result(Galaxy.user, 'toJSON'), 'email')\n\t        };\n\t    }\n\t\n\t    //=============================================================================\n\t    return {\n\t        errorModal: errorModal,\n\t        offlineErrorModal: offlineErrorModal,\n\t        badGatewayErrorModal: badGatewayErrorModal,\n\t        ajaxErrorModal: ajaxErrorModal\n\t    };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 95 */,\n/* 96 */,\n/* 97 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, $) {(function (factory) {\n\t    if (true) {\n\t        !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t    } else {\n\t        // Browser globals\n\t        factory(jQuery);\n\t    }\n\t})(function () {\n\t    //=============================================================================\n\t\n\t    jQuery.fn.extend({\n\t        hoverhighlight: function $hoverhighlight(scope, color) {\n\t            scope = scope || 'body';\n\t            if (!this.length) {\n\t                return this;\n\t            }\n\t\n\t            $(this).each(function () {\n\t                var $this = $(this),\n\t                    targetSelector = $this.data('target');\n\t\n\t                if (targetSelector) {\n\t                    $this.mouseover(function (ev) {\n\t                        $(targetSelector, scope).css({\n\t                            background: color\n\t                        });\n\t                    }).mouseout(function (ev) {\n\t                        $(targetSelector).css({\n\t                            background: ''\n\t                        });\n\t                    });\n\t                }\n\t            });\n\t            return this;\n\t        }\n\t    });\n\t});\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ }),\n/* 98 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, jQuery) {// from: https://raw.githubusercontent.com/umdjs/umd/master/jqueryPlugin.js\n\t// Uses AMD or browser globals to create a jQuery plugin.\n\t(function (factory) {\n\t    if (true) {\n\t        //TODO: So...this turns out to be an all or nothing thing. If I load jQuery in the define below, it will\n\t        //  (of course) wipe the old jquery *and all the plugins loaded into it*. So the define below *is still\n\t        //  relying on jquery being loaded globally* in order to preserve plugins.\n\t        !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t    } else {\n\t        // Browser globals\n\t        factory(jQuery);\n\t    }\n\t})(function () {\n\t    var _l = window._l || function (s) {\n\t        return s;\n\t    };\n\t\n\t    //TODO: consolidate with tool menu functionality, use there\n\t\n\t    /** searchInput: (jQuery plugin)\n\t     *      Creates a search input, a clear button, and loading indicator\n\t     *      within the selected node.\n\t     *\n\t     *      When the user either presses return or enters some minimal number\n\t     *      of characters, a callback is called. Pressing ESC when the input\n\t     *      is focused will clear the input and call a separate callback.\n\t     */\n\t    function searchInput(parentNode, options) {\n\t        var KEYCODE_ESC = 27,\n\t            KEYCODE_RETURN = 13,\n\t            $parentNode = $(parentNode),\n\t            firstSearch = true,\n\t            defaults = {\n\t            initialVal: '',\n\t            name: 'search',\n\t            placeholder: 'search',\n\t            classes: '',\n\t            onclear: function () {},\n\t            onfirstsearch: null,\n\t            onsearch: function (inputVal) {},\n\t            minSearchLen: 0,\n\t            escWillClear: true,\n\t            oninit: function () {}\n\t        };\n\t\n\t        // .................................................................... input rendering and events\n\t        // visually clear the search, trigger an event, and call the callback\n\t        function clearSearchInput(event) {\n\t            var $input = $(this).parent().children('input');\n\t            $input.val('').trigger('searchInput.clear').blur();\n\t            options.onclear();\n\t        }\n\t\n\t        // search for searchTerms, trigger an event, call the appropo callback (based on whether this is the first)\n\t        function search(event, searchTerms) {\n\t            if (!searchTerms) {\n\t                return clearSearchInput();\n\t            }\n\t            $(this).trigger('search.search', searchTerms);\n\t            if (typeof options.onfirstsearch === 'function' && firstSearch) {\n\t                firstSearch = false;\n\t                options.onfirstsearch(searchTerms);\n\t            } else {\n\t                options.onsearch(searchTerms);\n\t            }\n\t        }\n\t\n\t        // .................................................................... input rendering and events\n\t        function inputTemplate() {\n\t            // class search-query is bootstrap 2.3 style that now lives in base.less\n\t            return [''].join('');\n\t        }\n\t\n\t        // the search input that responds to keyboard events and displays the search value\n\t        function $input() {\n\t            return $(inputTemplate())\n\t            // select all text on a focus\n\t            .focus(function (event) {\n\t                $(this).select();\n\t            })\n\t            // attach behaviors to esc, return if desired, search on some min len string\n\t            .keyup(function (event) {\n\t                event.preventDefault();\n\t                event.stopPropagation();\n\t\n\t                // esc key will clear if desired\n\t                if (event.which === KEYCODE_ESC && options.escWillClear) {\n\t                    clearSearchInput.call(this, event);\n\t                } else {\n\t                    var searchTerms = $(this).val();\n\t                    // return key or the search string len > minSearchLen (if not 0) triggers search\n\t                    if (event.which === KEYCODE_RETURN || options.minSearchLen && searchTerms.length >= options.minSearchLen) {\n\t                        search.call(this, event, searchTerms);\n\t                    }\n\t                }\n\t            }).val(options.initialVal);\n\t        }\n\t\n\t        // .................................................................... clear button rendering and events\n\t        // a button for clearing the search bar, placed on the right hand side\n\t        function $clearBtn() {\n\t            return $([''].join('')).tooltip({ placement: 'bottom' }).click(function (event) {\n\t                clearSearchInput.call(this, event);\n\t            });\n\t        }\n\t\n\t        // .................................................................... loadingIndicator rendering\n\t        // a button for clearing the search bar, placed on the right hand side\n\t        function $loadingIndicator() {\n\t            return $([''].join('')).hide().tooltip({ placement: 'bottom' });\n\t        }\n\t\n\t        // .................................................................... commands\n\t        // visually swap the load, clear buttons\n\t        function toggleLoadingIndicator() {\n\t            $parentNode.find('.search-loading').toggle();\n\t            $parentNode.find('.search-clear').toggle();\n\t        }\n\t\n\t        // .................................................................... init\n\t        // string command (not constructor)\n\t        if (jQuery.type(options) === 'string') {\n\t            if (options === 'toggle-loading') {\n\t                toggleLoadingIndicator();\n\t            }\n\t            return $parentNode;\n\t        }\n\t\n\t        // initial render\n\t        if (jQuery.type(options) === 'object') {\n\t            options = jQuery.extend(true, {}, defaults, options);\n\t        }\n\t        //NOTE: prepended\n\t        return $parentNode.addClass('search-input').prepend([$input(), $clearBtn(), $loadingIndicator()]);\n\t    }\n\t\n\t    // as jq plugin\n\t    jQuery.fn.extend({\n\t        searchInput: function $searchInput(options) {\n\t            return this.each(function () {\n\t                return searchInput(this, options);\n\t            });\n\t        }\n\t    });\n\t});\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ }),\n/* 99 */,\n/* 100 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t    // Alphanumeric/natural sort fn\n\t    function naturalSort(a, b) {\n\t        // setup temp-scope variables for comparison evauluation\n\t        var re = /(-?[0-9\\.]+)/g,\n\t            x = a.toString().toLowerCase() || '',\n\t            y = b.toString().toLowerCase() || '',\n\t            nC = String.fromCharCode(0),\n\t            xN = x.replace(re, nC + '$1' + nC).split(nC),\n\t            yN = y.replace(re, nC + '$1' + nC).split(nC),\n\t            xD = new Date(x).getTime(),\n\t            yD = xD ? new Date(y).getTime() : null;\n\t        // natural sorting of dates\n\t        if (yD) {\n\t            if (xD < yD) {\n\t                return -1;\n\t            } else if (xD > yD) {\n\t                return 1;\n\t            }\n\t        }\n\t        // natural sorting through split numeric strings and default strings\n\t        var oFxNcL, oFyNcL;\n\t        for (var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {\n\t            oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];\n\t            oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];\n\t            if (oFxNcL < oFyNcL) {\n\t                return -1;\n\t            } else if (oFxNcL > oFyNcL) {\n\t                return 1;\n\t            }\n\t        }\n\t        return 0;\n\t    }\n\t\n\t    return naturalSort;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }),\n/* 101 */,\n/* 102 */,\n/* 103 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Backbone) {var Ui = __webpack_require__(5),\n\t    historyOptionsMenu = __webpack_require__(135);\n\tCurrentHistoryView = __webpack_require__(132).CurrentHistoryView, _l = __webpack_require__(6);\n\t\n\t/** the right hand panel in the analysis page that shows the current history */\n\tvar HistoryPanel = Backbone.View.extend({\n\t\n\t    initialize: function (page, options) {\n\t        var self = this;\n\t        this.userIsAnonymous = Galaxy.user.isAnonymous();\n\t        this.allow_user_dataset_purge = options.config.allow_user_dataset_purge;\n\t        this.root = options.root;\n\t\n\t        // view of the current history\n\t        this.historyView = new CurrentHistoryView({\n\t            className: CurrentHistoryView.prototype.className + ' middle',\n\t            purgeAllowed: this.allow_user_dataset_purge,\n\t            linkTarget: 'galaxy_main'\n\t        });\n\t\n\t        // add history panel to Galaxy object\n\t        Galaxy.currHistoryPanel = this.historyView;\n\t        Galaxy.currHistoryPanel.listenToGalaxy(Galaxy);\n\t\n\t        // build buttons\n\t        this.buttonRefresh = new Ui.ButtonLink({\n\t            id: 'history-refresh-button',\n\t            title: 'Refresh history',\n\t            cls: 'panel-header-button',\n\t            icon: 'fa fa-refresh',\n\t            onclick: function () {\n\t                self.historyView.loadCurrentHistory();\n\t            }\n\t        });\n\t        this.buttonOptions = new Ui.ButtonLink({\n\t            id: 'history-options-button',\n\t            title: 'History options',\n\t            cls: 'panel-header-button',\n\t            target: 'galaxy_main',\n\t            icon: 'fa fa-cog',\n\t            href: this.root + 'root/history_options'\n\t        });\n\t        this.buttonViewMulti = new Ui.ButtonLink({\n\t            id: 'history-view-multi-button',\n\t            title: 'View all histories',\n\t            cls: 'panel-header-button',\n\t            icon: 'fa fa-columns',\n\t            href: this.root + 'history/view_multiple'\n\t        });\n\t\n\t        // define components\n\t        this.model = new Backbone.Model({\n\t            cls: 'history-right-panel',\n\t            title: _l('History'),\n\t            buttons: [this.buttonRefresh, this.buttonOptions, this.buttonViewMulti]\n\t        });\n\t\n\t        // build body template and connect history view\n\t        this.setElement(this._template());\n\t        this.historyView.setElement(this.$el);\n\t        this.historyView.connectToQuotaMeter(Galaxy.quotaMeter);\n\t        this.historyView.loadCurrentHistory();\n\t\n\t        // fetch to update the quota meter adding 'current' for any anon-user's id\n\t        Galaxy.listenTo(this.historyView, 'history-size-change', function () {\n\t            Galaxy.user.fetch({ url: Galaxy.user.urlRoot() + '/' + (Galaxy.user.id || 'current') });\n\t        });\n\t    },\n\t\n\t    render: function () {\n\t        this.optionsMenu = historyOptionsMenu(this.buttonOptions.$el, {\n\t            anonymous: this.userIsAnonymous,\n\t            purgeAllowed: this.allow_user_dataset_purge,\n\t            root: this.root\n\t        });\n\t        this.buttonViewMulti.$el[!this.userIsAnonymous ? 'show' : 'hide']();\n\t    },\n\t\n\t    /** add history view div */\n\t    _template: function (data) {\n\t        return ['
      '].join('');\n\t },\n\t\n\t toString: function () {\n\t return 'historyPanel';\n\t }\n\t});\n\t\n\tmodule.exports = HistoryPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ }),\n/* 104 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Backbone, _) {var Tools = __webpack_require__(68),\n\t Upload = __webpack_require__(143),\n\t _l = __webpack_require__(6),\n\t ToolForm = __webpack_require__(92);\n\t\n\tvar ToolPanel = Backbone.View.extend({\n\t initialize: function (page, options) {\n\t // access configuration options\n\t var config = options.config;\n\t this.root = options.root;\n\t\n\t /** @type {Object[]} descriptions of user's workflows to be shown in the tool menu */\n\t this.stored_workflow_menu_entries = config.stored_workflow_menu_entries || [];\n\t\n\t // create tool search, tool panel, and tool panel view.\n\t var tool_search = new Tools.ToolSearch({\n\t hidden: false\n\t });\n\t var tools = new Tools.ToolCollection(config.toolbox);\n\t this.tool_panel = new Tools.ToolPanel({\n\t tool_search: tool_search,\n\t tools: tools,\n\t layout: config.toolbox_in_panel\n\t });\n\t this.tool_panel_view = new Tools.ToolPanelView({ model: this.tool_panel });\n\t\n\t // add upload modal\n\t this.upload_button = new Upload({\n\t nginx_upload_path: config.nginx_upload_path,\n\t ftp_upload_site: config.ftp_upload_site,\n\t default_genome: config.default_genome,\n\t default_extension: config.default_extension\n\t });\n\t\n\t // add uploader button to Galaxy object\n\t Galaxy.upload = this.upload_button;\n\t\n\t // components for panel definition\n\t this.model = new Backbone.Model({\n\t title: _l('Tools'),\n\t buttons: [this.upload_button]\n\t });\n\t\n\t // build body template\n\t this.setElement(this._template());\n\t },\n\t\n\t render: function () {\n\t // if there are tools, render panel and display everything\n\t var self = this;\n\t if (this.tool_panel.get('layout').size() > 0) {\n\t this.$el.prepend(this.tool_panel_view.$el);\n\t this.tool_panel_view.render();\n\t }\n\t // build the dom for the workflow portion of the tool menu\n\t // add internal workflow list\n\t self.$('#internal-workflows').append(self._templateAllWorkflow({\n\t title: _l('All workflows'),\n\t href: 'workflow'\n\t }));\n\t _.each(this.stored_workflow_menu_entries, function (menu_entry) {\n\t self.$('#internal-workflows').append(self._templateWorkflowLink({\n\t title: menu_entry.stored_workflow.name,\n\t href: 'workflow/run?id=' + menu_entry.encoded_stored_workflow_id\n\t }));\n\t });\n\t },\n\t\n\t /** build a link to one tool */\n\t _templateTool: function (tool) {\n\t return [''].join('');\n\t },\n\t\n\t /** build a link to 'All Workflows' */\n\t _templateAllWorkflow: function (tool) {\n\t return ['
      ',\n\t // global\n\t '', tool.title, '', '
      '].join('');\n\t },\n\t\n\t /** build links to workflows in toolpanel */\n\t _templateWorkflowLink: function (wf) {\n\t return [''].join('');\n\t },\n\t\n\t /** override to include inital menu dom and workflow section */\n\t _template: function () {\n\t return ['
      ', '
      ', '
      ', '', _l('Search did not match any tools.'), '', '
      ', '
      ', '
      ', '
      ', '
      ', '', _l('Workflows'), '', '
      ', '
      ', '
      ', '
      ', '
      '].join('');\n\t },\n\t\n\t toString: function () {\n\t return 'toolPanel';\n\t }\n\t});\n\t\n\tmodule.exports = ToolPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3)))\n\n/***/ }),\n/* 105 */,\n/* 106 */,\n/* 107 */,\n/* 108 */,\n/* 109 */,\n/* 110 */,\n/* 111 */,\n/* 112 */,\n/* 113 */,\n/* 114 */,\n/* 115 */,\n/* 116 */,\n/* 117 */,\n/* 118 */,\n/* 119 */,\n/* 120 */,\n/* 121 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {/*\n\t * Toastr\n\t * Version 2.0.1\n\t * Copyright 2012 John Papa and Hans Fjällemark. \n\t * All Rights Reserved. \n\t * Use, reproduction, distribution, and modification of this code is subject to the terms and \n\t * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php\n\t *\n\t * Author: John Papa and Hans Fjällemark\n\t * Project: https://github.com/CodeSeven/toastr\n\t */\n\t;(function (define) {\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t\t\tvar $ = jQuery;\n\t\t\treturn function () {\n\t\t\t\tvar version = '2.0.1';\n\t\t\t\tvar $container;\n\t\t\t\tvar listener;\n\t\t\t\tvar toastId = 0;\n\t\t\t\tvar toastType = {\n\t\t\t\t\terror: 'error',\n\t\t\t\t\tinfo: 'info',\n\t\t\t\t\tsuccess: 'success',\n\t\t\t\t\twarning: 'warning'\n\t\t\t\t};\n\t\n\t\t\t\tvar toastr = {\n\t\t\t\t\tclear: clear,\n\t\t\t\t\terror: error,\n\t\t\t\t\tgetContainer: getContainer,\n\t\t\t\t\tinfo: info,\n\t\t\t\t\toptions: {},\n\t\t\t\t\tsubscribe: subscribe,\n\t\t\t\t\tsuccess: success,\n\t\t\t\t\tversion: version,\n\t\t\t\t\twarning: warning\n\t\t\t\t};\n\t\n\t\t\t\treturn toastr;\n\t\n\t\t\t\t//#region Accessible Methods\n\t\t\t\tfunction error(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.error,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.error,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction info(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.info,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.info,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction subscribe(callback) {\n\t\t\t\t\tlistener = callback;\n\t\t\t\t}\n\t\n\t\t\t\tfunction success(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.success,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.success,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction warning(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.warning,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.warning,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction clear($toastElement) {\n\t\t\t\t\tvar options = getOptions();\n\t\t\t\t\tif (!$container) {\n\t\t\t\t\t\tgetContainer(options);\n\t\t\t\t\t}\n\t\t\t\t\tif ($toastElement && $(':focus', $toastElement).length === 0) {\n\t\t\t\t\t\t$toastElement[options.hideMethod]({\n\t\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\t\tremoveToast($toastElement);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif ($container.children().length) {\n\t\t\t\t\t\t$container[options.hideMethod]({\n\t\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\t\t$container.remove();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//#endregion\n\t\n\t\t\t\t//#region Internal Methods\n\t\n\t\t\t\tfunction getDefaults() {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttapToDismiss: true,\n\t\t\t\t\t\ttoastClass: 'toast',\n\t\t\t\t\t\tcontainerId: 'toast-container',\n\t\t\t\t\t\tdebug: false,\n\t\n\t\t\t\t\t\tshowMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery\n\t\t\t\t\t\tshowDuration: 300,\n\t\t\t\t\t\tshowEasing: 'swing', //swing and linear are built into jQuery\n\t\t\t\t\t\tonShown: undefined,\n\t\t\t\t\t\thideMethod: 'fadeOut',\n\t\t\t\t\t\thideDuration: 1000,\n\t\t\t\t\t\thideEasing: 'swing',\n\t\t\t\t\t\tonHidden: undefined,\n\t\n\t\t\t\t\t\textendedTimeOut: 1000,\n\t\t\t\t\t\ticonClasses: {\n\t\t\t\t\t\t\terror: 'toast-error',\n\t\t\t\t\t\t\tinfo: 'toast-info',\n\t\t\t\t\t\t\tsuccess: 'toast-success',\n\t\t\t\t\t\t\twarning: 'toast-warning'\n\t\t\t\t\t\t},\n\t\t\t\t\t\ticonClass: 'toast-info',\n\t\t\t\t\t\tpositionClass: 'toast-top-right',\n\t\t\t\t\t\ttimeOut: 5000, // Set timeOut and extendedTimeout to 0 to make it sticky\n\t\t\t\t\t\ttitleClass: 'toast-title',\n\t\t\t\t\t\tmessageClass: 'toast-message',\n\t\t\t\t\t\ttarget: 'body',\n\t\t\t\t\t\tcloseHtml: '',\n\t\t\t\t\t\tnewestOnTop: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\n\t\t\t\tfunction publish(args) {\n\t\t\t\t\tif (!listener) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlistener(args);\n\t\t\t\t}\n\t\n\t\t\t\tfunction notify(map) {\n\t\t\t\t\tvar options = getOptions(),\n\t\t\t\t\t iconClass = map.iconClass || options.iconClass;\n\t\n\t\t\t\t\tif (typeof map.optionsOverride !== 'undefined') {\n\t\t\t\t\t\toptions = $.extend(options, map.optionsOverride);\n\t\t\t\t\t\ticonClass = map.optionsOverride.iconClass || iconClass;\n\t\t\t\t\t}\n\t\n\t\t\t\t\ttoastId++;\n\t\n\t\t\t\t\t$container = getContainer(options);\n\t\t\t\t\tvar intervalId = null,\n\t\t\t\t\t $toastElement = $('
      '),\n\t\t\t\t\t $titleElement = $('
      '),\n\t\t\t\t\t $messageElement = $('
      '),\n\t\t\t\t\t $closeElement = $(options.closeHtml),\n\t\t\t\t\t response = {\n\t\t\t\t\t\ttoastId: toastId,\n\t\t\t\t\t\tstate: 'visible',\n\t\t\t\t\t\tstartTime: new Date(),\n\t\t\t\t\t\toptions: options,\n\t\t\t\t\t\tmap: map\n\t\t\t\t\t};\n\t\n\t\t\t\t\tif (map.iconClass) {\n\t\t\t\t\t\t$toastElement.addClass(options.toastClass).addClass(iconClass);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (map.title) {\n\t\t\t\t\t\t$titleElement.append(map.title).addClass(options.titleClass);\n\t\t\t\t\t\t$toastElement.append($titleElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (map.message) {\n\t\t\t\t\t\t$messageElement.append(map.message).addClass(options.messageClass);\n\t\t\t\t\t\t$toastElement.append($messageElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (options.closeButton) {\n\t\t\t\t\t\t$closeElement.addClass('toast-close-button');\n\t\t\t\t\t\t$toastElement.prepend($closeElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$toastElement.hide();\n\t\t\t\t\tif (options.newestOnTop) {\n\t\t\t\t\t\t$container.prepend($toastElement);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$container.append($toastElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$toastElement[options.showMethod]({ duration: options.showDuration, easing: options.showEasing, complete: options.onShown });\n\t\t\t\t\tif (options.timeOut > 0) {\n\t\t\t\t\t\tintervalId = setTimeout(hideToast, options.timeOut);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$toastElement.hover(stickAround, delayedhideToast);\n\t\t\t\t\tif (!options.onclick && options.tapToDismiss) {\n\t\t\t\t\t\t$toastElement.click(hideToast);\n\t\t\t\t\t}\n\t\t\t\t\tif (options.closeButton && $closeElement) {\n\t\t\t\t\t\t$closeElement.click(function (event) {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\thideToast(true);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (options.onclick) {\n\t\t\t\t\t\t$toastElement.click(function () {\n\t\t\t\t\t\t\toptions.onclick();\n\t\t\t\t\t\t\thideToast();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\tpublish(response);\n\t\n\t\t\t\t\tif (options.debug && console) {\n\t\t\t\t\t\tconsole.log(response);\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn $toastElement;\n\t\n\t\t\t\t\tfunction hideToast(override) {\n\t\t\t\t\t\tif ($(':focus', $toastElement).length && !override) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn $toastElement[options.hideMethod]({\n\t\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\t\tremoveToast($toastElement);\n\t\t\t\t\t\t\t\tif (options.onHidden) {\n\t\t\t\t\t\t\t\t\toptions.onHidden();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tresponse.state = 'hidden';\n\t\t\t\t\t\t\t\tresponse.endTime = new Date(), publish(response);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\tfunction delayedhideToast() {\n\t\t\t\t\t\tif (options.timeOut > 0 || options.extendedTimeOut > 0) {\n\t\t\t\t\t\t\tintervalId = setTimeout(hideToast, options.extendedTimeOut);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\tfunction stickAround() {\n\t\t\t\t\t\tclearTimeout(intervalId);\n\t\t\t\t\t\t$toastElement.stop(true, true)[options.showMethod]({ duration: options.showDuration, easing: options.showEasing });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction getContainer(options) {\n\t\t\t\t\tif (!options) {\n\t\t\t\t\t\toptions = getOptions();\n\t\t\t\t\t}\n\t\t\t\t\t$container = $('#' + options.containerId);\n\t\t\t\t\tif ($container.length) {\n\t\t\t\t\t\treturn $container;\n\t\t\t\t\t}\n\t\t\t\t\t$container = $('
      ').attr('id', options.containerId).addClass(options.positionClass);\n\t\t\t\t\t$container.appendTo($(options.target));\n\t\t\t\t\treturn $container;\n\t\t\t\t}\n\t\n\t\t\t\tfunction getOptions() {\n\t\t\t\t\treturn $.extend({}, getDefaults(), toastr.options);\n\t\t\t\t}\n\t\n\t\t\t\tfunction removeToast($toastElement) {\n\t\t\t\t\tif (!$container) {\n\t\t\t\t\t\t$container = getContainer();\n\t\t\t\t\t}\n\t\t\t\t\tif ($toastElement.is(':visible')) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t$toastElement.remove();\n\t\t\t\t\t$toastElement = null;\n\t\t\t\t\tif ($container.children().length === 0) {\n\t\t\t\t\t\t$container.remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//#endregion\n\t\t\t}();\n\t\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t})(__webpack_require__(165));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 122 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(58), __webpack_require__(84), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DC_LI, DATASET_LI_EDIT, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t //==============================================================================\n\t\n\t var DCListItemView = DC_LI.DCListItemView;\n\t /** @class Edit view for DatasetCollection.\n\t */\n\t var DCListItemEdit = DCListItemView.extend(\n\t /** @lends DCListItemEdit.prototype */{\n\t\n\t /** override to add linkTarget */\n\t initialize: function (attributes) {\n\t DCListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t var DCEListItemView = DC_LI.DCEListItemView;\n\t /** @class Read only view for DatasetCollectionElement.\n\t */\n\t var DCEListItemEdit = DCEListItemView.extend(\n\t /** @lends DCEListItemEdit.prototype */{\n\t //TODO: this might be expendable - compacted with HDAListItemView\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t DCEListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCEListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t // NOTE: this does not inherit from DatasetDCEListItemView as you would expect\n\t //TODO: but should - if we can find something simpler than using diamond\n\t /** @class Editable view for a DatasetCollectionElement that is also an DatasetAssociation\n\t * (a dataset contained in a dataset collection).\n\t */\n\t var DatasetDCEListItemEdit = DATASET_LI_EDIT.DatasetListItemEdit.extend(\n\t /** @lends DatasetDCEListItemEdit.prototype */{\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t DATASET_LI_EDIT.DatasetListItemEdit.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // NOTE: this does not inherit from DatasetDCEListItemView - so we duplicate this here\n\t //TODO: fix\n\t /** In this override, only get details if in the ready state.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** Override to remove delete button */\n\t _renderDeleteButton: function () {\n\t return null;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DatasetDCEListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetDCEListItemEdit.prototype.templates = function () {\n\t\n\t return _.extend({}, DATASET_LI_EDIT.DatasetListItemEdit.prototype.templates, {\n\t titleBar: DC_LI.DatasetDCEListItemView.prototype.templates.titleBar\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\t var NestedDCDCEListItemEdit = DC_LI.NestedDCDCEListItemView.extend(\n\t /** @lends NestedDCDCEListItemEdit.prototype */{\n\t\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'NestedDCDCEListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t DCListItemEdit: DCListItemEdit,\n\t DCEListItemEdit: DCEListItemEdit,\n\t DatasetDCEListItemEdit: DatasetDCEListItemEdit,\n\t NestedDCDCEListItemEdit: NestedDCDCEListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ }),\n/* 123 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(83), __webpack_require__(59), __webpack_require__(122), __webpack_require__(7), __webpack_require__(45), __webpack_require__(25), __webpack_require__(6), __webpack_require__(24)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, TAGS, faIconButton, _l) {\n\t\n\t 'use strict';\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t /** @class editable View/Controller for a dataset collection.\n\t */\n\t\n\t var _super = DC_VIEW.CollectionView;\n\t var CollectionViewEdit = _super.extend(\n\t /** @lends CollectionView.prototype */{\n\t //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n\t\n\t /** logger used to record this.log messages, commonly set to console */\n\t //logger : console,\n\t\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_EDIT.DatasetDCEListItemEdit,\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit,\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes optional settings for the panel\n\t */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t /** In this override, make the collection name editable\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t _super.prototype._setUpBehaviors.call(this, $where);\n\t if (!this.model) {\n\t return;\n\t }\n\t\n\t // anon users shouldn't have access to any of the following\n\t if (!Galaxy.user || Galaxy.user.isAnonymous()) {\n\t return;\n\t }\n\t\n\t this.tagsEditorShown = true;\n\t\n\t //TODO: extract\n\t var panel = this,\n\t nameSelector = '> .controls .name';\n\t $where.find(nameSelector).attr('title', _l('Click to rename collection')).tooltip({ placement: 'bottom' }).make_text_editable({\n\t on_finish: function (newName) {\n\t var previousName = panel.model.get('name');\n\t if (newName && newName !== previousName) {\n\t panel.$el.find(nameSelector).text(newName);\n\t panel.model.save({ name: newName }).fail(function () {\n\t panel.$el.find(nameSelector).text(panel.model.previous('name'));\n\t });\n\t } else {\n\t panel.$el.find(nameSelector).text(previousName);\n\t }\n\t }\n\t });\n\t this.tagsEditor = new TAGS.TagsEditor({\n\t model: this.model,\n\t el: $where.find('.tags-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t usePrompt: false\n\t });\n\t this.tagsEditor.toggle(true);\n\t },\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'CollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var ListCollectionViewEdit = CollectionViewEdit.extend(\n\t /** @lends ListCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_EDIT.DatasetDCEListItemEdit,\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class Editable, read-only View/Controller for a dataset collection. */\n\t var PairCollectionViewEdit = ListCollectionViewEdit.extend(\n\t /** @lends PairCollectionViewEdit.prototype */{\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'PairCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class Editable (roughly since these collections are immutable),\n\t * View/Controller for a dataset collection.\n\t */\n\t var NestedPairCollectionViewEdit = PairCollectionViewEdit.extend(\n\t /** @lends NestedPairCollectionViewEdit.prototype */{\n\t\n\t /** Override to remove the editable text from the name/identifier - these collections are considered immutable */\n\t _setUpBehaviors: function ($where) {\n\t _super.prototype._setUpBehaviors.call(this, $where);\n\t },\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'NestedPairCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class editable, View/Controller for a list of pairs dataset collection. */\n\t var ListOfPairsCollectionViewEdit = CollectionViewEdit.extend(\n\t /** @lends ListOfPairsCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit.extend({\n\t foldoutPanelClass: NestedPairCollectionViewEdit\n\t }),\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfPairsCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class View/Controller for a list of lists dataset collection. */\n\t var ListOfListsCollectionViewEdit = CollectionViewEdit.extend(\n\t /** @lends ListOfListsCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit.extend({\n\t foldoutPanelClass: NestedPairCollectionViewEdit\n\t }),\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfListsCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t CollectionViewEdit: CollectionViewEdit,\n\t ListCollectionViewEdit: ListCollectionViewEdit,\n\t PairCollectionViewEdit: PairCollectionViewEdit,\n\t ListOfPairsCollectionViewEdit: ListOfPairsCollectionViewEdit,\n\t ListOfListsCollectionViewEdit: ListOfListsCollectionViewEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }),\n/* 124 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(156), __webpack_require__(100), __webpack_require__(82), __webpack_require__(7), __webpack_require__(6), __webpack_require__(97)], __WEBPACK_AMD_DEFINE_RESULT__ = function (levenshteinDistance, naturalSort, baseCreator, baseMVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t /* ============================================================================\n\t TODO:\n\t \n\t \n\t PROGRAMMATICALLY:\n\t currPanel.once( 'rendered', function(){\n\t currPanel.showSelectors();\n\t currPanel.selectAll();\n\t _.last( currPanel.actionsPopup.options ).func();\n\t });\n\t \n\t ============================================================================ */\n\t /** A view for paired datasets in the collections creator.\n\t */\n\t var PairView = Backbone.View.extend(baseMVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t tagName: 'li',\n\t className: 'dataset paired',\n\t\n\t initialize: function (attributes) {\n\t this.pair = attributes.pair || {};\n\t },\n\t\n\t template: _.template(['<%- pair.forward.name %>', '', '<%- pair.name %>', '', '<%- pair.reverse.name %>'].join('')),\n\t\n\t render: function () {\n\t this.$el.attr('draggable', true).data('pair', this.pair).html(this.template({ pair: this.pair })).addClass('flex-column-container');\n\t return this;\n\t },\n\t\n\t events: {\n\t 'dragstart': '_dragstart',\n\t 'dragend': '_dragend',\n\t 'dragover': '_sendToParent',\n\t 'drop': '_sendToParent'\n\t },\n\t\n\t /** dragging pairs for re-ordering */\n\t _dragstart: function (ev) {\n\t ev.currentTarget.style.opacity = '0.4';\n\t if (ev.originalEvent) {\n\t ev = ev.originalEvent;\n\t }\n\t\n\t ev.dataTransfer.effectAllowed = 'move';\n\t ev.dataTransfer.setData('text/plain', JSON.stringify(this.pair));\n\t\n\t this.$el.parent().trigger('pair.dragstart', [this]);\n\t },\n\t\n\t /** dragging pairs for re-ordering */\n\t _dragend: function (ev) {\n\t ev.currentTarget.style.opacity = '1.0';\n\t this.$el.parent().trigger('pair.dragend', [this]);\n\t },\n\t\n\t /** manually bubble up an event to the parent/container */\n\t _sendToParent: function (ev) {\n\t this.$el.parent().trigger(ev);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'PairView(' + this.pair.name + ')';\n\t }\n\t });\n\t\n\t // ============================================================================\n\t /** returns an autopair function that uses the provided options.match function */\n\t function autoPairFnBuilder(options) {\n\t options = options || {};\n\t options.createPair = options.createPair || function _defaultCreatePair(params) {\n\t params = params || {};\n\t var a = params.listA.splice(params.indexA, 1)[0],\n\t b = params.listB.splice(params.indexB, 1)[0],\n\t aInBIndex = params.listB.indexOf(a),\n\t bInAIndex = params.listA.indexOf(b);\n\t if (aInBIndex !== -1) {\n\t params.listB.splice(aInBIndex, 1);\n\t }\n\t if (bInAIndex !== -1) {\n\t params.listA.splice(bInAIndex, 1);\n\t }\n\t return this._pair(a, b, { silent: true });\n\t };\n\t // compile these here outside of the loop\n\t var _regexps = [];\n\t function getRegExps() {\n\t if (!_regexps.length) {\n\t _regexps = [new RegExp(this.filters[0]), new RegExp(this.filters[1])];\n\t }\n\t return _regexps;\n\t }\n\t // mangle params as needed\n\t options.preprocessMatch = options.preprocessMatch || function _defaultPreprocessMatch(params) {\n\t var regexps = getRegExps.call(this);\n\t return _.extend(params, {\n\t matchTo: params.matchTo.name.replace(regexps[0], ''),\n\t possible: params.possible.name.replace(regexps[1], '')\n\t });\n\t };\n\t\n\t return function _strategy(params) {\n\t this.debug('autopair _strategy ---------------------------');\n\t params = params || {};\n\t var listA = params.listA,\n\t listB = params.listB,\n\t indexA = 0,\n\t indexB,\n\t bestMatch = {\n\t score: 0.0,\n\t index: null\n\t },\n\t paired = [];\n\t //console.debug( 'params:', JSON.stringify( params, null, ' ' ) );\n\t this.debug('starting list lens:', listA.length, listB.length);\n\t this.debug('bestMatch (starting):', JSON.stringify(bestMatch, null, ' '));\n\t\n\t while (indexA < listA.length) {\n\t var matchTo = listA[indexA];\n\t bestMatch.score = 0.0;\n\t\n\t for (indexB = 0; indexB < listB.length; indexB++) {\n\t var possible = listB[indexB];\n\t this.debug(indexA + ':' + matchTo.name);\n\t this.debug(indexB + ':' + possible.name);\n\t\n\t // no matching with self\n\t if (listA[indexA] !== listB[indexB]) {\n\t bestMatch = options.match.call(this, options.preprocessMatch.call(this, {\n\t matchTo: matchTo,\n\t possible: possible,\n\t index: indexB,\n\t bestMatch: bestMatch\n\t }));\n\t this.debug('bestMatch:', JSON.stringify(bestMatch, null, ' '));\n\t if (bestMatch.score === 1.0) {\n\t this.debug('breaking early due to perfect match');\n\t break;\n\t }\n\t }\n\t }\n\t var scoreThreshold = options.scoreThreshold.call(this);\n\t this.debug('scoreThreshold:', scoreThreshold);\n\t this.debug('bestMatch.score:', bestMatch.score);\n\t\n\t if (bestMatch.score >= scoreThreshold) {\n\t //console.debug( 'autoPairFnBuilder.strategy', listA[ indexA ].name, listB[ bestMatch.index ].name );\n\t paired.push(options.createPair.call(this, {\n\t listA: listA,\n\t indexA: indexA,\n\t listB: listB,\n\t indexB: bestMatch.index\n\t }));\n\t //console.debug( 'list lens now:', listA.length, listB.length );\n\t } else {\n\t indexA += 1;\n\t }\n\t if (!listA.length || !listB.length) {\n\t return paired;\n\t }\n\t }\n\t this.debug('paired:', JSON.stringify(paired, null, ' '));\n\t this.debug('autopair _strategy ---------------------------');\n\t return paired;\n\t };\n\t }\n\t\n\t // ============================================================================\n\t /** An interface for building collections of paired datasets.\n\t */\n\t var PairedCollectionCreator = Backbone.View.extend(baseMVC.LoggableMixin).extend(baseCreator.CollectionCreatorMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t className: 'list-of-pairs-collection-creator collection-creator flex-row-container',\n\t\n\t /** set up initial options, instance vars, behaviors, and autopair (if set to do so) */\n\t initialize: function (attributes) {\n\t this.metric('PairedCollectionCreator.initialize', attributes);\n\t //this.debug( '-- PairedCollectionCreator:', attributes );\n\t\n\t attributes = _.defaults(attributes, {\n\t datasets: [],\n\t filters: this.DEFAULT_FILTERS,\n\t automaticallyPair: true,\n\t strategy: 'lcs',\n\t matchPercentage: 0.9,\n\t twoPassAutopairing: true\n\t });\n\t\n\t /** unordered, original list */\n\t this.initialList = attributes.datasets;\n\t\n\t /** is this from a history? if so, what's its id? */\n\t this.historyId = attributes.historyId;\n\t\n\t /** which filters should be used initially? (String[2] or name in commonFilters) */\n\t this.filters = this.commonFilters[attributes.filters] || this.commonFilters[this.DEFAULT_FILTERS];\n\t if (_.isArray(attributes.filters)) {\n\t this.filters = attributes.filters;\n\t }\n\t\n\t /** try to auto pair the unpaired datasets on load? */\n\t this.automaticallyPair = attributes.automaticallyPair;\n\t\n\t /** what method to use for auto pairing (will be passed aggression level) */\n\t this.strategy = this.strategies[attributes.strategy] || this.strategies[this.DEFAULT_STRATEGY];\n\t if (_.isFunction(attributes.strategy)) {\n\t this.strategy = attributes.strategy;\n\t }\n\t\n\t /** distance/mismatch level allowed for autopairing */\n\t this.matchPercentage = attributes.matchPercentage;\n\t\n\t /** try to autopair using simple first, then this.strategy on the remainder */\n\t this.twoPassAutopairing = attributes.twoPassAutopairing;\n\t\n\t /** remove file extensions (\\.*) from created pair names? */\n\t this.removeExtensions = true;\n\t //this.removeExtensions = false;\n\t\n\t /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n\t this.oncancel = attributes.oncancel;\n\t /** fn to call when the collection is created (scoped to this) */\n\t this.oncreate = attributes.oncreate;\n\t\n\t /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n\t this.autoscrollDist = attributes.autoscrollDist || 24;\n\t\n\t /** is the unpaired panel shown? */\n\t this.unpairedPanelHidden = false;\n\t /** is the paired panel shown? */\n\t this.pairedPanelHidden = false;\n\t\n\t /** DOM elements currently being dragged */\n\t this.$dragging = null;\n\t\n\t /** Used for blocking UI events during ajax/operations (don't post twice) */\n\t this.blocking = false;\n\t\n\t this._setUpCommonSettings(attributes);\n\t this._setUpBehaviors();\n\t this._dataSetUp();\n\t },\n\t\n\t /** map of common filter pairs by name */\n\t commonFilters: {\n\t illumina: ['_1', '_2'],\n\t Rs: ['_R1', '_R2']\n\t },\n\t /** which commonFilter to use by default */\n\t DEFAULT_FILTERS: 'illumina',\n\t\n\t /** map of name->fn for autopairing */\n\t strategies: {\n\t 'simple': 'autopairSimple',\n\t 'lcs': 'autopairLCS',\n\t 'levenshtein': 'autopairLevenshtein'\n\t },\n\t /** default autopair strategy name */\n\t DEFAULT_STRATEGY: 'lcs',\n\t\n\t // ------------------------------------------------------------------------ process raw list\n\t /** set up main data: cache initialList, sort, and autopair */\n\t _dataSetUp: function () {\n\t //this.debug( '-- _dataSetUp' );\n\t\n\t this.paired = [];\n\t this.unpaired = [];\n\t\n\t this.selectedIds = [];\n\t\n\t // sort initial list, add ids if needed, and save new working copy to unpaired\n\t this._sortInitialList();\n\t this._ensureIds();\n\t this.unpaired = this.initialList.slice(0);\n\t\n\t if (this.automaticallyPair) {\n\t this.autoPair();\n\t this.once('rendered:initial', function () {\n\t this.trigger('autopair');\n\t });\n\t }\n\t },\n\t\n\t /** sort initial list */\n\t _sortInitialList: function () {\n\t //this.debug( '-- _sortInitialList' );\n\t this._sortDatasetList(this.initialList);\n\t },\n\t\n\t /** sort a list of datasets */\n\t _sortDatasetList: function (list) {\n\t // currently only natural sort by name\n\t list.sort(function (a, b) {\n\t return naturalSort(a.name, b.name);\n\t });\n\t return list;\n\t },\n\t\n\t /** add ids to dataset objs in initial list if none */\n\t _ensureIds: function () {\n\t this.initialList.forEach(function (dataset) {\n\t if (!dataset.hasOwnProperty('id')) {\n\t dataset.id = _.uniqueId();\n\t }\n\t });\n\t return this.initialList;\n\t },\n\t\n\t /** split initial list into two lists, those that pass forward filters & those passing reverse */\n\t _splitByFilters: function () {\n\t var regexFilters = this.filters.map(function (stringFilter) {\n\t return new RegExp(stringFilter);\n\t }),\n\t split = [[], []];\n\t\n\t function _filter(unpaired, filter) {\n\t return filter.test(unpaired.name);\n\t //return dataset.name.indexOf( filter ) >= 0;\n\t }\n\t this.unpaired.forEach(function _filterEach(unpaired) {\n\t // 90% of the time this seems to work, but:\n\t //TODO: this treats *all* strings as regex which may confuse people - possibly check for // surrounding?\n\t // would need explanation in help as well\n\t regexFilters.forEach(function (filter, i) {\n\t if (_filter(unpaired, filter)) {\n\t split[i].push(unpaired);\n\t }\n\t });\n\t });\n\t return split;\n\t },\n\t\n\t /** add a dataset to the unpaired list in it's proper order */\n\t _addToUnpaired: function (dataset) {\n\t // currently, unpaired is natural sorted by name, use binary search to find insertion point\n\t var binSearchSortedIndex = function (low, hi) {\n\t if (low === hi) {\n\t return low;\n\t }\n\t\n\t var mid = Math.floor((hi - low) / 2) + low,\n\t compared = naturalSort(dataset.name, this.unpaired[mid].name);\n\t\n\t if (compared < 0) {\n\t return binSearchSortedIndex(low, mid);\n\t } else if (compared > 0) {\n\t return binSearchSortedIndex(mid + 1, hi);\n\t }\n\t // walk the equal to find the last\n\t while (this.unpaired[mid] && this.unpaired[mid].name === dataset.name) {\n\t mid++;\n\t }\n\t return mid;\n\t }.bind(this);\n\t\n\t this.unpaired.splice(binSearchSortedIndex(0, this.unpaired.length), 0, dataset);\n\t },\n\t\n\t // ------------------------------------------------------------------------ auto pairing\n\t /** two passes to automatically create pairs:\n\t * use both simpleAutoPair, then the fn mentioned in strategy\n\t */\n\t autoPair: function (strategy) {\n\t // split first using exact matching\n\t var split = this._splitByFilters(),\n\t paired = [];\n\t if (this.twoPassAutopairing) {\n\t paired = this.autopairSimple({\n\t listA: split[0],\n\t listB: split[1]\n\t });\n\t split = this._splitByFilters();\n\t }\n\t\n\t // uncomment to see printlns while running tests\n\t //this.debug = function(){ console.log.apply( console, arguments ); };\n\t\n\t // then try the remainder with something less strict\n\t strategy = strategy || this.strategy;\n\t split = this._splitByFilters();\n\t paired = paired.concat(this[strategy].call(this, {\n\t listA: split[0],\n\t listB: split[1]\n\t }));\n\t return paired;\n\t },\n\t\n\t /** autopair by exact match */\n\t autopairSimple: autoPairFnBuilder({\n\t scoreThreshold: function () {\n\t return 0.6;\n\t },\n\t match: function _match(params) {\n\t params = params || {};\n\t if (params.matchTo === params.possible) {\n\t return {\n\t index: params.index,\n\t score: 1.0\n\t };\n\t }\n\t return params.bestMatch;\n\t }\n\t }),\n\t\n\t /** autopair by levenshtein edit distance scoring */\n\t autopairLevenshtein: autoPairFnBuilder({\n\t scoreThreshold: function () {\n\t return this.matchPercentage;\n\t },\n\t match: function _matches(params) {\n\t params = params || {};\n\t var distance = levenshteinDistance(params.matchTo, params.possible),\n\t score = 1.0 - distance / Math.max(params.matchTo.length, params.possible.length);\n\t if (score > params.bestMatch.score) {\n\t return {\n\t index: params.index,\n\t score: score\n\t };\n\t }\n\t return params.bestMatch;\n\t }\n\t }),\n\t\n\t /** autopair by longest common substrings scoring */\n\t autopairLCS: autoPairFnBuilder({\n\t scoreThreshold: function () {\n\t return this.matchPercentage;\n\t },\n\t match: function _matches(params) {\n\t params = params || {};\n\t var match = this._naiveStartingAndEndingLCS(params.matchTo, params.possible).length,\n\t score = match / Math.max(params.matchTo.length, params.possible.length);\n\t if (score > params.bestMatch.score) {\n\t return {\n\t index: params.index,\n\t score: score\n\t };\n\t }\n\t return params.bestMatch;\n\t }\n\t }),\n\t\n\t /** return the concat'd longest common prefix and suffix from two strings */\n\t _naiveStartingAndEndingLCS: function (s1, s2) {\n\t var fwdLCS = '',\n\t revLCS = '',\n\t i = 0,\n\t j = 0;\n\t while (i < s1.length && i < s2.length) {\n\t if (s1[i] !== s2[i]) {\n\t break;\n\t }\n\t fwdLCS += s1[i];\n\t i += 1;\n\t }\n\t if (i === s1.length) {\n\t return s1;\n\t }\n\t if (i === s2.length) {\n\t return s2;\n\t }\n\t\n\t i = s1.length - 1;\n\t j = s2.length - 1;\n\t while (i >= 0 && j >= 0) {\n\t if (s1[i] !== s2[j]) {\n\t break;\n\t }\n\t revLCS = [s1[i], revLCS].join('');\n\t i -= 1;\n\t j -= 1;\n\t }\n\t return fwdLCS + revLCS;\n\t },\n\t\n\t // ------------------------------------------------------------------------ pairing / unpairing\n\t /** create a pair from fwd and rev, removing them from unpaired, and placing the new pair in paired */\n\t _pair: function (fwd, rev, options) {\n\t options = options || {};\n\t this.debug('_pair:', fwd, rev);\n\t var pair = this._createPair(fwd, rev, options.name);\n\t this.paired.push(pair);\n\t this.unpaired = _.without(this.unpaired, fwd, rev);\n\t if (!options.silent) {\n\t this.trigger('pair:new', pair);\n\t }\n\t return pair;\n\t },\n\t\n\t /** create a pair Object from fwd and rev, adding the name attribute (will guess if not given) */\n\t _createPair: function (fwd, rev, name) {\n\t // ensure existance and don't pair something with itself\n\t if (!(fwd && rev) || fwd === rev) {\n\t throw new Error('Bad pairing: ' + [JSON.stringify(fwd), JSON.stringify(rev)]);\n\t }\n\t name = name || this._guessNameForPair(fwd, rev);\n\t return { forward: fwd, name: name, reverse: rev };\n\t },\n\t\n\t /** try to find a good pair name for the given fwd and rev datasets */\n\t _guessNameForPair: function (fwd, rev, removeExtensions) {\n\t removeExtensions = removeExtensions !== undefined ? removeExtensions : this.removeExtensions;\n\t var fwdName = fwd.name,\n\t revName = rev.name,\n\t lcs = this._naiveStartingAndEndingLCS(fwdName.replace(new RegExp(this.filters[0]), ''), revName.replace(new RegExp(this.filters[1]), ''));\n\t if (removeExtensions) {\n\t var lastDotIndex = lcs.lastIndexOf('.');\n\t if (lastDotIndex > 0) {\n\t var extension = lcs.slice(lastDotIndex, lcs.length);\n\t lcs = lcs.replace(extension, '');\n\t fwdName = fwdName.replace(extension, '');\n\t revName = revName.replace(extension, '');\n\t }\n\t }\n\t return lcs || fwdName + ' & ' + revName;\n\t },\n\t\n\t /** unpair a pair, removing it from paired, and adding the fwd,rev datasets back into unpaired */\n\t _unpair: function (pair, options) {\n\t options = options || {};\n\t if (!pair) {\n\t throw new Error('Bad pair: ' + JSON.stringify(pair));\n\t }\n\t this.paired = _.without(this.paired, pair);\n\t this._addToUnpaired(pair.forward);\n\t this._addToUnpaired(pair.reverse);\n\t\n\t if (!options.silent) {\n\t this.trigger('pair:unpair', [pair]);\n\t }\n\t return pair;\n\t },\n\t\n\t /** unpair all paired datasets */\n\t unpairAll: function () {\n\t var pairs = [];\n\t while (this.paired.length) {\n\t pairs.push(this._unpair(this.paired[0], { silent: true }));\n\t }\n\t this.trigger('pair:unpair', pairs);\n\t },\n\t\n\t // ------------------------------------------------------------------------ API\n\t /** convert a pair into JSON compatible with the collections API */\n\t _pairToJSON: function (pair, src) {\n\t src = src || 'hda';\n\t //TODO: consider making this the pair structure when created instead\n\t return {\n\t collection_type: 'paired',\n\t src: 'new_collection',\n\t name: pair.name,\n\t element_identifiers: [{\n\t name: 'forward',\n\t id: pair.forward.id,\n\t src: src\n\t }, {\n\t name: 'reverse',\n\t id: pair.reverse.id,\n\t src: src\n\t }]\n\t };\n\t },\n\t\n\t /** create the collection via the API\n\t * @returns {jQuery.xhr Object} the jquery ajax request\n\t */\n\t createList: function (name) {\n\t var creator = this,\n\t url = Galaxy.root + 'api/histories/' + this.historyId + '/contents/dataset_collections';\n\t\n\t //TODO: use ListPairedCollection.create()\n\t var ajaxData = {\n\t type: 'dataset_collection',\n\t collection_type: 'list:paired',\n\t hide_source_items: creator.hideOriginals || false,\n\t name: _.escape(name || creator.$('.collection-name').val()),\n\t element_identifiers: creator.paired.map(function (pair) {\n\t return creator._pairToJSON(pair);\n\t })\n\t\n\t };\n\t //this.debug( JSON.stringify( ajaxData ) );\n\t creator.blocking = true;\n\t return jQuery.ajax(url, {\n\t type: 'POST',\n\t contentType: 'application/json',\n\t dataType: 'json',\n\t data: JSON.stringify(ajaxData)\n\t }).always(function () {\n\t creator.blocking = false;\n\t }).fail(function (xhr, status, message) {\n\t creator._ajaxErrHandler(xhr, status, message);\n\t }).done(function (response, message, xhr) {\n\t //this.info( 'ok', response, message, xhr );\n\t creator.trigger('collection:created', response, message, xhr);\n\t creator.metric('collection:created', response);\n\t if (typeof creator.oncreate === 'function') {\n\t creator.oncreate.call(this, response, message, xhr);\n\t }\n\t });\n\t },\n\t\n\t /** handle ajax errors with feedback and details to the user (if available) */\n\t _ajaxErrHandler: function (xhr, status, message) {\n\t this.error(xhr, status, message);\n\t var content = _l('An error occurred while creating this collection');\n\t if (xhr) {\n\t if (xhr.readyState === 0 && xhr.status === 0) {\n\t content += ': ' + _l('Galaxy could not be reached and may be updating.') + _l(' Try again in a few minutes.');\n\t } else if (xhr.responseJSON) {\n\t content += '
      ' + JSON.stringify(xhr.responseJSON) + '
      ';\n\t } else {\n\t content += ': ' + message;\n\t }\n\t }\n\t creator._showAlert(content, 'alert-danger');\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering\n\t /** render the entire interface */\n\t render: function (speed, callback) {\n\t //this.debug( '-- _render' );\n\t //this.$el.empty().html( this.templates.main() );\n\t this.$el.empty().html(this.templates.main());\n\t this._renderHeader(speed);\n\t this._renderMiddle(speed);\n\t this._renderFooter(speed);\n\t this._addPluginComponents();\n\t this.trigger('rendered', this);\n\t return this;\n\t },\n\t\n\t /** render the header section */\n\t _renderHeader: function (speed, callback) {\n\t //this.debug( '-- _renderHeader' );\n\t var $header = this.$('.header').empty().html(this.templates.header()).find('.help-content').prepend($(this.templates.helpContent()));\n\t\n\t this._renderFilters();\n\t return $header;\n\t },\n\t /** fill the filter inputs with the filter values */\n\t _renderFilters: function () {\n\t return this.$('.forward-column .column-header input').val(this.filters[0]).add(this.$('.reverse-column .column-header input').val(this.filters[1]));\n\t },\n\t\n\t /** render the middle including unpaired and paired sections (which may be hidden) */\n\t _renderMiddle: function (speed, callback) {\n\t var $middle = this.$('.middle').empty().html(this.templates.middle());\n\t\n\t // (re-) hide the un/paired panels based on instance vars\n\t if (this.unpairedPanelHidden) {\n\t this.$('.unpaired-columns').hide();\n\t } else if (this.pairedPanelHidden) {\n\t this.$('.paired-columns').hide();\n\t }\n\t\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t return $middle;\n\t },\n\t /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n\t _renderUnpaired: function (speed, callback) {\n\t //this.debug( '-- _renderUnpaired' );\n\t var creator = this,\n\t $fwd,\n\t $rev,\n\t $prd = [],\n\t split = this._splitByFilters();\n\t // update unpaired counts\n\t this.$('.forward-column .title').text([split[0].length, _l('unpaired forward')].join(' '));\n\t this.$('.forward-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[0].length));\n\t this.$('.reverse-column .title').text([split[1].length, _l('unpaired reverse')].join(' '));\n\t this.$('.reverse-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[1].length));\n\t\n\t this.$('.unpaired-columns .column-datasets').empty();\n\t\n\t // show/hide the auto pair button if any unpaired are left\n\t this.$('.autopair-link').toggle(this.unpaired.length !== 0);\n\t if (this.unpaired.length === 0) {\n\t this._renderUnpairedEmpty();\n\t return;\n\t }\n\t\n\t // create the dataset dom arrays\n\t $rev = split[1].map(function (dataset, i) {\n\t // if there'll be a fwd dataset across the way, add a button to pair the row\n\t if (split[0][i] !== undefined && split[0][i] !== dataset) {\n\t $prd.push(creator._renderPairButton());\n\t }\n\t return creator._renderUnpairedDataset(dataset);\n\t });\n\t $fwd = split[0].map(function (dataset) {\n\t return creator._renderUnpairedDataset(dataset);\n\t });\n\t\n\t if (!$fwd.length && !$rev.length) {\n\t this._renderUnpairedNotShown();\n\t return;\n\t }\n\t // add to appropo cols\n\t //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n\t // and swapping out that\n\t this.$('.unpaired-columns .forward-column .column-datasets').append($fwd).add(this.$('.unpaired-columns .paired-column .column-datasets').append($prd)).add(this.$('.unpaired-columns .reverse-column .column-datasets').append($rev));\n\t this._adjUnpairedOnScrollbar();\n\t },\n\t /** return a string to display the count of filtered out datasets */\n\t _renderUnpairedDisplayStr: function (numFiltered) {\n\t return ['(', numFiltered, ' ', _l('filtered out'), ')'].join('');\n\t },\n\t /** return an unattached jQuery DOM element to represent an unpaired dataset */\n\t _renderUnpairedDataset: function (dataset) {\n\t //TODO: to underscore template\n\t return $('
    • ').attr('id', 'dataset-' + dataset.id).addClass('dataset unpaired').attr('draggable', true).addClass(dataset.selected ? 'selected' : '').append($('').addClass('dataset-name').text(dataset.name))\n\t //??\n\t .data('dataset', dataset);\n\t },\n\t /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n\t _renderPairButton: function () {\n\t //TODO: *not* a dataset - don't pretend like it is\n\t return $('
    • ').addClass('dataset unpaired').append($('').addClass('dataset-name').text(_l('Pair these datasets')));\n\t },\n\t /** a message to display when no unpaired left */\n\t _renderUnpairedEmpty: function () {\n\t //this.debug( '-- renderUnpairedEmpty' );\n\t var $msg = $('
      ').text('(' + _l('no remaining unpaired datasets') + ')');\n\t this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n\t return $msg;\n\t },\n\t /** a message to display when no unpaired can be shown with the current filters */\n\t _renderUnpairedNotShown: function () {\n\t //this.debug( '-- renderUnpairedEmpty' );\n\t var $msg = $('
      ').text('(' + _l('no datasets were found matching the current filters') + ')');\n\t this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n\t return $msg;\n\t },\n\t /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n\t _adjUnpairedOnScrollbar: function () {\n\t var $unpairedColumns = this.$('.unpaired-columns').last(),\n\t $firstDataset = this.$('.unpaired-columns .reverse-column .dataset').first();\n\t if (!$firstDataset.length) {\n\t return;\n\t }\n\t var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n\t dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n\t rightDiff = Math.floor(ucRight) - Math.floor(dsRight);\n\t //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n\t this.$('.unpaired-columns .forward-column').css('margin-left', rightDiff > 0 ? rightDiff : 0);\n\t },\n\t\n\t /** render the paired section and update counts of paired datasets */\n\t _renderPaired: function (speed, callback) {\n\t //this.debug( '-- _renderPaired' );\n\t this.$('.paired-column-title .title').text([this.paired.length, _l('paired')].join(' '));\n\t // show/hide the unpair all link\n\t this.$('.unpair-all-link').toggle(this.paired.length !== 0);\n\t if (this.paired.length === 0) {\n\t this._renderPairedEmpty();\n\t return;\n\t //TODO: would be best to return here (the $columns)\n\t } else {\n\t // show/hide 'remove extensions link' when any paired and they seem to have extensions\n\t this.$('.remove-extensions-link').show();\n\t }\n\t\n\t this.$('.paired-columns .column-datasets').empty();\n\t var creator = this;\n\t this.paired.forEach(function (pair, i) {\n\t //TODO: cache these?\n\t var pairView = new PairView({ pair: pair });\n\t creator.$('.paired-columns .column-datasets').append(pairView.render().$el).append([''].join(''));\n\t });\n\t },\n\t /** a message to display when none paired */\n\t _renderPairedEmpty: function () {\n\t var $msg = $('
      ').text('(' + _l('no paired datasets yet') + ')');\n\t this.$('.paired-columns .column-datasets').empty().prepend($msg);\n\t return $msg;\n\t },\n\t\n\t footerSettings: {\n\t '.hide-originals': 'hideOriginals',\n\t '.remove-extensions': 'removeExtensions'\n\t },\n\t\n\t /** add any jQuery/bootstrap/custom plugins to elements rendered */\n\t _addPluginComponents: function () {\n\t this._chooseFiltersPopover('.choose-filters-link');\n\t this.$('.help-content i').hoverhighlight('.collection-creator', 'rgba( 64, 255, 255, 1.0 )');\n\t },\n\t\n\t /** build a filter selection popover allowing selection of common filter pairs */\n\t _chooseFiltersPopover: function (selector) {\n\t function filterChoice(val1, val2) {\n\t return [''].join('');\n\t }\n\t var $popoverContent = $(_.template(['
      ', '
      ', _l('Choose from the following filters to change which unpaired reads are shown in the display'), ':
      ', _.values(this.commonFilters).map(function (filterSet) {\n\t return filterChoice(filterSet[0], filterSet[1]);\n\t }).join(''), '
      '].join(''))({}));\n\t\n\t return this.$(selector).popover({\n\t container: '.collection-creator',\n\t placement: 'bottom',\n\t html: true,\n\t //animation : false,\n\t content: $popoverContent\n\t });\n\t },\n\t\n\t /** add (or clear if clear is truthy) a validation warning to what */\n\t _validationWarning: function (what, clear) {\n\t var VALIDATION_CLASS = 'validation-warning';\n\t if (what === 'name') {\n\t what = this.$('.collection-name').add(this.$('.collection-name-prompt'));\n\t this.$('.collection-name').focus().select();\n\t }\n\t if (clear) {\n\t what = what || this.$('.' + VALIDATION_CLASS);\n\t what.removeClass(VALIDATION_CLASS);\n\t } else {\n\t what.addClass(VALIDATION_CLASS);\n\t }\n\t },\n\t\n\t // ------------------------------------------------------------------------ events\n\t /** set up event handlers on self */\n\t _setUpBehaviors: function () {\n\t this.once('rendered', function () {\n\t this.trigger('rendered:initial', this);\n\t });\n\t\n\t this.on('pair:new', function () {\n\t //TODO: ideally only re-render the columns (or even elements) involved\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t\n\t // scroll to bottom where new pairs are added\n\t //TODO: this doesn't seem to work - innerHeight sticks at 133...\n\t // may have to do with improper flex columns\n\t //var $pairedView = this.$( '.paired-columns' );\n\t //$pairedView.scrollTop( $pairedView.innerHeight() );\n\t //this.debug( $pairedView.height() )\n\t this.$('.paired-columns').scrollTop(8000000);\n\t });\n\t this.on('pair:unpair', function (pairs) {\n\t //TODO: ideally only re-render the columns (or even elements) involved\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t this.splitView();\n\t });\n\t\n\t this.on('filter-change', function () {\n\t this.filters = [this.$('.forward-unpaired-filter input').val(), this.$('.reverse-unpaired-filter input').val()];\n\t this.metric('filter-change', this.filters);\n\t this._renderFilters();\n\t this._renderUnpaired();\n\t });\n\t\n\t this.on('autopair', function () {\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t\n\t var message,\n\t msgClass = null;\n\t if (this.paired.length) {\n\t msgClass = 'alert-success';\n\t message = this.paired.length + ' ' + _l('pairs created');\n\t if (!this.unpaired.length) {\n\t message += ': ' + _l('all datasets have been successfully paired');\n\t this.hideUnpaired();\n\t this.$('.collection-name').focus();\n\t }\n\t } else {\n\t message = _l(['Could not automatically create any pairs from the given dataset names.', 'You may want to choose or enter different filters and try auto-pairing again.', 'Close this message using the X on the right to view more help.'].join(' '));\n\t }\n\t this._showAlert(message, msgClass);\n\t });\n\t\n\t //this.on( 'all', function(){\n\t // this.info( arguments );\n\t //});\n\t return this;\n\t },\n\t\n\t events: {\n\t // header\n\t 'click .more-help': '_clickMoreHelp',\n\t 'click .less-help': '_clickLessHelp',\n\t 'click .main-help': '_toggleHelp',\n\t 'click .header .alert button': '_hideAlert',\n\t 'click .forward-column .column-title': '_clickShowOnlyUnpaired',\n\t 'click .reverse-column .column-title': '_clickShowOnlyUnpaired',\n\t 'click .unpair-all-link': '_clickUnpairAll',\n\t //TODO: this seems kinda backasswards - re-sending jq event as a backbone event, can we listen directly?\n\t 'change .forward-unpaired-filter input': function (ev) {\n\t this.trigger('filter-change');\n\t },\n\t 'focus .forward-unpaired-filter input': function (ev) {\n\t $(ev.currentTarget).select();\n\t },\n\t 'click .autopair-link': '_clickAutopair',\n\t 'click .choose-filters .filter-choice': '_clickFilterChoice',\n\t 'click .clear-filters-link': '_clearFilters',\n\t 'change .reverse-unpaired-filter input': function (ev) {\n\t this.trigger('filter-change');\n\t },\n\t 'focus .reverse-unpaired-filter input': function (ev) {\n\t $(ev.currentTarget).select();\n\t },\n\t // unpaired\n\t 'click .forward-column .dataset.unpaired': '_clickUnpairedDataset',\n\t 'click .reverse-column .dataset.unpaired': '_clickUnpairedDataset',\n\t 'click .paired-column .dataset.unpaired': '_clickPairRow',\n\t 'click .unpaired-columns': 'clearSelectedUnpaired',\n\t 'mousedown .unpaired-columns .dataset': '_mousedownUnpaired',\n\t // divider\n\t 'click .paired-column-title': '_clickShowOnlyPaired',\n\t 'mousedown .flexible-partition-drag': '_startPartitionDrag',\n\t // paired\n\t 'click .paired-columns .dataset.paired': 'selectPair',\n\t 'click .paired-columns': 'clearSelectedPaired',\n\t 'click .paired-columns .pair-name': '_clickPairName',\n\t 'click .unpair-btn': '_clickUnpair',\n\t // paired - drop target\n\t //'dragenter .paired-columns' : '_dragenterPairedColumns',\n\t //'dragleave .paired-columns .column-datasets': '_dragleavePairedColumns',\n\t 'dragover .paired-columns .column-datasets': '_dragoverPairedColumns',\n\t 'drop .paired-columns .column-datasets': '_dropPairedColumns',\n\t\n\t 'pair.dragstart .paired-columns .column-datasets': '_pairDragstart',\n\t 'pair.dragend .paired-columns .column-datasets': '_pairDragend',\n\t\n\t // footer\n\t 'change .remove-extensions': function (ev) {\n\t this.toggleExtensions();\n\t },\n\t 'change .collection-name': '_changeName',\n\t 'keydown .collection-name': '_nameCheckForEnter',\n\t 'change .hide-originals': '_changeHideOriginals',\n\t 'click .cancel-create': '_cancelCreate',\n\t 'click .create-collection': '_clickCreate' //,\n\t },\n\t\n\t /** toggle between showing only unpaired and split view */\n\t _clickShowOnlyUnpaired: function (ev) {\n\t //this.debug( 'click unpaired', ev.currentTarget );\n\t if (this.$('.paired-columns').is(':visible')) {\n\t this.hidePaired();\n\t } else {\n\t this.splitView();\n\t }\n\t },\n\t /** toggle between showing only paired and split view */\n\t _clickShowOnlyPaired: function (ev) {\n\t //this.debug( 'click paired' );\n\t if (this.$('.unpaired-columns').is(':visible')) {\n\t this.hideUnpaired();\n\t } else {\n\t this.splitView();\n\t }\n\t },\n\t\n\t /** hide unpaired, show paired */\n\t hideUnpaired: function (speed, callback) {\n\t this.unpairedPanelHidden = true;\n\t this.pairedPanelHidden = false;\n\t this._renderMiddle(speed, callback);\n\t },\n\t /** hide paired, show unpaired */\n\t hidePaired: function (speed, callback) {\n\t this.unpairedPanelHidden = false;\n\t this.pairedPanelHidden = true;\n\t this._renderMiddle(speed, callback);\n\t },\n\t /** show both paired and unpaired (splitting evenly) */\n\t splitView: function (speed, callback) {\n\t this.unpairedPanelHidden = this.pairedPanelHidden = false;\n\t this._renderMiddle(speed, callback);\n\t return this;\n\t },\n\t\n\t /** unpair all paired and do other super neat stuff which I'm not really sure about yet... */\n\t _clickUnpairAll: function (ev) {\n\t this.metric('unpairAll');\n\t this.unpairAll();\n\t },\n\t\n\t /** attempt to autopair */\n\t _clickAutopair: function (ev) {\n\t var paired = this.autoPair();\n\t this.metric('autopair', paired.length, this.unpaired.length);\n\t this.trigger('autopair');\n\t },\n\t\n\t /** set the filters based on the data attributes of the button click target */\n\t _clickFilterChoice: function (ev) {\n\t var $selected = $(ev.currentTarget);\n\t this.$('.forward-unpaired-filter input').val($selected.data('forward'));\n\t this.$('.reverse-unpaired-filter input').val($selected.data('reverse'));\n\t this._hideChooseFilters();\n\t this.trigger('filter-change');\n\t },\n\t\n\t /** hide the choose filters popover */\n\t _hideChooseFilters: function () {\n\t //TODO: update bootstrap and remove the following hack\n\t // see also: https://github.com/twbs/bootstrap/issues/10260\n\t this.$('.choose-filters-link').popover('hide');\n\t this.$('.popover').css('display', 'none');\n\t },\n\t\n\t /** clear both filters */\n\t _clearFilters: function (ev) {\n\t this.$('.forward-unpaired-filter input').val('');\n\t this.$('.reverse-unpaired-filter input').val('');\n\t this.trigger('filter-change');\n\t },\n\t\n\t // ........................................................................ unpaired\n\t /** select an unpaired dataset */\n\t _clickUnpairedDataset: function (ev) {\n\t ev.stopPropagation();\n\t return this.toggleSelectUnpaired($(ev.currentTarget));\n\t },\n\t\n\t /** Toggle the selection of an unpaired dataset representation.\n\t * @param [jQuery] $dataset the unpaired dataset dom rep to select\n\t * @param [Boolean] options.force if defined, force selection based on T/F; otherwise, toggle\n\t */\n\t toggleSelectUnpaired: function ($dataset, options) {\n\t options = options || {};\n\t var dataset = $dataset.data('dataset'),\n\t select = options.force !== undefined ? options.force : !$dataset.hasClass('selected');\n\t //this.debug( id, options.force, $dataset, dataset );\n\t if (!$dataset.length || dataset === undefined) {\n\t return $dataset;\n\t }\n\t\n\t if (select) {\n\t $dataset.addClass('selected');\n\t if (!options.waitToPair) {\n\t this.pairAllSelected();\n\t }\n\t } else {\n\t $dataset.removeClass('selected');\n\t //delete dataset.selected;\n\t }\n\t return $dataset;\n\t },\n\t\n\t /** pair all the currently selected unpaired datasets */\n\t pairAllSelected: function (options) {\n\t options = options || {};\n\t var creator = this,\n\t fwds = [],\n\t revs = [],\n\t pairs = [];\n\t creator.$('.unpaired-columns .forward-column .dataset.selected').each(function () {\n\t fwds.push($(this).data('dataset'));\n\t });\n\t creator.$('.unpaired-columns .reverse-column .dataset.selected').each(function () {\n\t revs.push($(this).data('dataset'));\n\t });\n\t fwds.length = revs.length = Math.min(fwds.length, revs.length);\n\t //this.debug( fwds );\n\t //this.debug( revs );\n\t fwds.forEach(function (fwd, i) {\n\t try {\n\t pairs.push(creator._pair(fwd, revs[i], { silent: true }));\n\t } catch (err) {\n\t //TODO: preserve selected state of those that couldn't be paired\n\t //TODO: warn that some could not be paired\n\t creator.error(err);\n\t }\n\t });\n\t if (pairs.length && !options.silent) {\n\t this.trigger('pair:new', pairs);\n\t }\n\t return pairs;\n\t },\n\t\n\t /** clear the selection on all unpaired datasets */\n\t clearSelectedUnpaired: function () {\n\t this.$('.unpaired-columns .dataset.selected').removeClass('selected');\n\t },\n\t\n\t /** when holding down the shift key on a click, 'paint' the moused over datasets as selected */\n\t _mousedownUnpaired: function (ev) {\n\t if (ev.shiftKey) {\n\t var creator = this,\n\t $startTarget = $(ev.target).addClass('selected'),\n\t moveListener = function (ev) {\n\t creator.$(ev.target).filter('.dataset').addClass('selected');\n\t };\n\t $startTarget.parent().on('mousemove', moveListener);\n\t\n\t // on any mouseup, stop listening to the move and try to pair any selected\n\t $(document).one('mouseup', function (ev) {\n\t $startTarget.parent().off('mousemove', moveListener);\n\t creator.pairAllSelected();\n\t });\n\t }\n\t },\n\t\n\t /** attempt to pair two datasets directly across from one another */\n\t _clickPairRow: function (ev) {\n\t //if( !ev.currentTarget ){ return true; }\n\t var rowIndex = $(ev.currentTarget).index(),\n\t fwd = $('.unpaired-columns .forward-column .dataset').eq(rowIndex).data('dataset'),\n\t rev = $('.unpaired-columns .reverse-column .dataset').eq(rowIndex).data('dataset');\n\t //this.debug( 'row:', rowIndex, fwd, rev );\n\t this._pair(fwd, rev);\n\t },\n\t\n\t // ........................................................................ divider/partition\n\t /** start dragging the visible divider/partition between unpaired and paired panes */\n\t _startPartitionDrag: function (ev) {\n\t var creator = this,\n\t startingY = ev.pageY;\n\t //this.debug( 'partition drag START:', ev );\n\t $('body').css('cursor', 'ns-resize');\n\t creator.$('.flexible-partition-drag').css('color', 'black');\n\t\n\t function endDrag(ev) {\n\t //creator.debug( 'partition drag STOP:', ev );\n\t // doing this by an added class didn't really work well - kept flashing still\n\t creator.$('.flexible-partition-drag').css('color', '');\n\t $('body').css('cursor', '').unbind('mousemove', trackMouse);\n\t }\n\t function trackMouse(ev) {\n\t var offset = ev.pageY - startingY;\n\t //creator.debug( 'partition:', startingY, offset );\n\t if (!creator.adjPartition(offset)) {\n\t //creator.debug( 'mouseup triggered' );\n\t $('body').trigger('mouseup');\n\t }\n\t creator._adjUnpairedOnScrollbar();\n\t startingY += offset;\n\t }\n\t $('body').mousemove(trackMouse);\n\t $('body').one('mouseup', endDrag);\n\t },\n\t\n\t /** adjust the parition up/down +/-adj pixels */\n\t adjPartition: function (adj) {\n\t var $unpaired = this.$('.unpaired-columns'),\n\t $paired = this.$('.paired-columns'),\n\t unpairedHi = parseInt($unpaired.css('height'), 10),\n\t pairedHi = parseInt($paired.css('height'), 10);\n\t //this.debug( adj, 'hi\\'s:', unpairedHi, pairedHi, unpairedHi + adj, pairedHi - adj );\n\t\n\t unpairedHi = Math.max(10, unpairedHi + adj);\n\t pairedHi = pairedHi - adj;\n\t\n\t var movingUpwards = adj < 0;\n\t // when the divider gets close to the top - lock into hiding the unpaired section\n\t if (movingUpwards) {\n\t if (this.unpairedPanelHidden) {\n\t return false;\n\t } else if (unpairedHi <= 10) {\n\t this.hideUnpaired();\n\t return false;\n\t }\n\t } else {\n\t if (this.unpairedPanelHidden) {\n\t $unpaired.show();\n\t this.unpairedPanelHidden = false;\n\t }\n\t }\n\t\n\t // when the divider gets close to the bottom - lock into hiding the paired section\n\t if (!movingUpwards) {\n\t if (this.pairedPanelHidden) {\n\t return false;\n\t } else if (pairedHi <= 15) {\n\t this.hidePaired();\n\t return false;\n\t }\n\t } else {\n\t if (this.pairedPanelHidden) {\n\t $paired.show();\n\t this.pairedPanelHidden = false;\n\t }\n\t }\n\t\n\t $unpaired.css({\n\t height: unpairedHi + 'px',\n\t flex: '0 0 auto'\n\t });\n\t return true;\n\t },\n\t\n\t // ........................................................................ paired\n\t /** select a pair when clicked */\n\t selectPair: function (ev) {\n\t ev.stopPropagation();\n\t $(ev.currentTarget).toggleClass('selected');\n\t },\n\t\n\t /** deselect all pairs */\n\t clearSelectedPaired: function (ev) {\n\t this.$('.paired-columns .dataset.selected').removeClass('selected');\n\t },\n\t\n\t /** rename a pair when the pair name is clicked */\n\t _clickPairName: function (ev) {\n\t ev.stopPropagation();\n\t var $name = $(ev.currentTarget),\n\t $pair = $name.parent().parent(),\n\t index = $pair.index('.dataset.paired'),\n\t pair = this.paired[index],\n\t response = prompt('Enter a new name for the pair:', pair.name);\n\t if (response) {\n\t pair.name = response;\n\t // set a flag (which won't be passed in json creation) for manual naming so we don't overwrite these\n\t // when adding/removing extensions\n\t //hackish\n\t pair.customizedName = true;\n\t $name.text(pair.name);\n\t }\n\t },\n\t\n\t /** unpair this pair */\n\t _clickUnpair: function (ev) {\n\t //if( !ev.currentTarget ){ return true; }\n\t var pairIndex = Math.floor($(ev.currentTarget).index('.unpair-btn'));\n\t //this.debug( 'pair:', pairIndex );\n\t this._unpair(this.paired[pairIndex]);\n\t },\n\t\n\t // ........................................................................ paired - drag and drop re-ordering\n\t //_dragenterPairedColumns : function( ev ){\n\t // this.debug( '_dragenterPairedColumns:', ev );\n\t //},\n\t //_dragleavePairedColumns : function( ev ){\n\t // //this.debug( '_dragleavePairedColumns:', ev );\n\t //},\n\t /** track the mouse drag over the paired list adding a placeholder to show where the drop would occur */\n\t _dragoverPairedColumns: function (ev) {\n\t //this.debug( '_dragoverPairedColumns:', ev );\n\t ev.preventDefault();\n\t\n\t var $list = this.$('.paired-columns .column-datasets');\n\t this._checkForAutoscroll($list, ev.originalEvent.clientY);\n\t //this.debug( ev.originalEvent.clientX, ev.originalEvent.clientY );\n\t var $nearest = this._getNearestPairedDatasetLi(ev.originalEvent.clientY);\n\t\n\t $('.element-drop-placeholder').remove();\n\t var $placeholder = $('
      ');\n\t if (!$nearest.length) {\n\t $list.append($placeholder);\n\t } else {\n\t $nearest.before($placeholder);\n\t }\n\t },\n\t\n\t /** If the mouse is near enough to the list's top or bottom, scroll the list */\n\t _checkForAutoscroll: function ($element, y) {\n\t var AUTOSCROLL_SPEED = 2;\n\t var offset = $element.offset(),\n\t scrollTop = $element.scrollTop(),\n\t upperDist = y - offset.top,\n\t lowerDist = offset.top + $element.outerHeight() - y;\n\t //this.debug( '_checkForAutoscroll:', scrollTop, upperDist, lowerDist );\n\t if (upperDist >= 0 && upperDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop - AUTOSCROLL_SPEED);\n\t } else if (lowerDist >= 0 && lowerDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop + AUTOSCROLL_SPEED);\n\t }\n\t },\n\t\n\t /** get the nearest *previous* paired dataset PairView based on the mouse's Y coordinate.\n\t * If the y is at the end of the list, return an empty jQuery object.\n\t */\n\t _getNearestPairedDatasetLi: function (y) {\n\t var WIGGLE = 4,\n\t lis = this.$('.paired-columns .column-datasets li').toArray();\n\t for (var i = 0; i < lis.length; i++) {\n\t var $li = $(lis[i]),\n\t top = $li.offset().top,\n\t halfHeight = Math.floor($li.outerHeight() / 2) + WIGGLE;\n\t if (top + halfHeight > y && top - halfHeight < y) {\n\t //this.debug( y, top + halfHeight, top - halfHeight )\n\t return $li;\n\t }\n\t }\n\t return $();\n\t },\n\t /** drop (dragged/selected PairViews) onto the list, re-ordering both the DOM and the internal array of pairs */\n\t _dropPairedColumns: function (ev) {\n\t // both required for firefox\n\t ev.preventDefault();\n\t ev.dataTransfer.dropEffect = 'move';\n\t\n\t var $nearest = this._getNearestPairedDatasetLi(ev.originalEvent.clientY);\n\t if ($nearest.length) {\n\t this.$dragging.insertBefore($nearest);\n\t } else {\n\t // no nearest before - insert after last element (unpair button)\n\t this.$dragging.insertAfter(this.$('.paired-columns .unpair-btn').last());\n\t }\n\t // resync the creator's list of paired based on the new DOM order\n\t this._syncPairsToDom();\n\t return false;\n\t },\n\t /** resync the creator's list of paired based on the DOM order of pairs */\n\t _syncPairsToDom: function () {\n\t var newPaired = [];\n\t //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n\t this.$('.paired-columns .dataset.paired').each(function () {\n\t newPaired.push($(this).data('pair'));\n\t });\n\t //this.debug( newPaired );\n\t this.paired = newPaired;\n\t this._renderPaired();\n\t },\n\t /** drag communication with pair sub-views: dragstart */\n\t _pairDragstart: function (ev, pair) {\n\t //this.debug( '_pairDragstart', ev, pair )\n\t // auto select the pair causing the event and move all selected\n\t pair.$el.addClass('selected');\n\t var $selected = this.$('.paired-columns .dataset.selected');\n\t this.$dragging = $selected;\n\t },\n\t /** drag communication with pair sub-views: dragend - remove the placeholder */\n\t _pairDragend: function (ev, pair) {\n\t //this.debug( '_pairDragend', ev, pair )\n\t $('.element-drop-placeholder').remove();\n\t this.$dragging = null;\n\t },\n\t\n\t // ........................................................................ footer\n\t toggleExtensions: function (force) {\n\t var creator = this;\n\t creator.removeExtensions = force !== undefined ? force : !creator.removeExtensions;\n\t\n\t _.each(creator.paired, function (pair) {\n\t // don't overwrite custom names\n\t if (pair.customizedName) {\n\t return;\n\t }\n\t pair.name = creator._guessNameForPair(pair.forward, pair.reverse);\n\t });\n\t\n\t creator._renderPaired();\n\t creator._renderFooter();\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** debug a dataset list */\n\t _printList: function (list) {\n\t var creator = this;\n\t _.each(list, function (e) {\n\t if (list === creator.paired) {\n\t creator._printPair(e);\n\t } else {\n\t //creator.debug( e );\n\t }\n\t });\n\t },\n\t\n\t /** print a pair Object */\n\t _printPair: function (pair) {\n\t this.debug(pair.forward.name, pair.reverse.name, ': ->', pair.name);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'PairedCollectionCreator';\n\t },\n\t\n\t templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\t\n\t /** the header (not including help text) */\n\t header: _.template(['', '
      ', '', '', '
      ', '
      ', '
      ', '
      ', '
      ', '', _l('Unpaired forward'), '', '', '
      ', '
      ', '', '
      ', '
      ', '
      ', '', '
      ', '
      ', '
      ', '', _l('Unpaired reverse'), '', '', '
      ', '
      ', '', '
      ', '
      ', '
      ', '
      '].join('')),\n\t\n\t /** the middle: unpaired, divider, and paired */\n\t middle: _.template([\n\t // contains two flex rows (rows that fill available space) and a divider btwn\n\t '
      ', '
      ', '
        ', '
        ', '
        ', '
          ', '
          ', '
          ', '
            ', '
            ', '
            ', '
            ', '
            ', '
            ', '
            ', '', '
            ', '', _l('Unpair all'), '', '
            ', '
            ', '
            ', '
              ', '
              '].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer: _.template(['
              ', '
              ', '', '', '
              ', '
              ', '', '
              ', _l('Name'), ':
              ', '
              ', '
              ', '
              ', '
              ', '', '
              ', '', '', '
              ', '
              ', '
              ', '', '
              ', '
              '].join('')),\n\t\n\t /** help content */\n\t helpContent: _.template(['

              ', _l(['Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ', 'These collections can be passed to tools and workflows in order to have analyses done on each member of ', 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ', 'and re-order the final collection.'].join('')), '

              ', '

              ', _l(['Unpaired datasets are shown in the unpaired section ', '(hover over the underlined words to highlight below). ', 'Paired datasets are shown in the paired section.', '

                To pair datasets, you can:', '
              • Click a dataset in the ', 'forward column ', 'to select it then click a dataset in the ', 'reverse column.', '
              • ', '
              • Click one of the \"Pair these datasets\" buttons in the ', 'middle column ', 'to pair the datasets in a particular row.', '
              • ', '
              • Click \"Auto-pair\" ', 'to have your datasets automatically paired based on name.', '
              • ', '
              '].join('')), '

              ', '

              ', _l(['

                You can filter what is shown in the unpaired sections by:', '
              • Entering partial dataset names in either the ', 'forward filter or ', 'reverse filter.', '
              • ', '
              • Choosing from a list of preset filters by clicking the ', '\"Choose filters\" link.', '
              • ', '
              • Entering regular expressions to match dataset names. See: ', 'MDN\\'s JavaScript Regular Expression Tutorial. ', 'Note: forward slashes (\\\\) are not needed.', '
              • ', '
              • Clearing the filters by clicking the ', '\"Clear filters\" link.', '
              • ', '
              '].join('')), '

              ', '

              ', _l(['To unpair individual dataset pairs, click the ', 'unpair buttons ( ). ', 'Click the \"Unpair all\" link to unpair all pairs.'].join('')), '

              ', '

              ', _l(['You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ', '\"Remove file extensions from pair names?\" control.'].join('')), '

              ', '

              ', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\". ', '(Note: you do not have to pair all unpaired datasets to finish.)'].join('')), '

              '].join(''))\n\t })\n\t });\n\t\n\t //=============================================================================\n\t /** a modal version of the paired collection creator */\n\t var pairedCollectionCreatorModal = function _pairedCollectionCreatorModal(datasets, options) {\n\t\n\t var deferred = jQuery.Deferred(),\n\t creator;\n\t\n\t options = _.defaults(options || {}, {\n\t datasets: datasets,\n\t oncancel: function () {\n\t Galaxy.modal.hide();\n\t deferred.reject('cancelled');\n\t },\n\t oncreate: function (creator, response) {\n\t Galaxy.modal.hide();\n\t deferred.resolve(response);\n\t }\n\t });\n\t\n\t if (!window.Galaxy || !Galaxy.modal) {\n\t throw new Error('Galaxy or Galaxy.modal not found');\n\t }\n\t\n\t creator = new PairedCollectionCreator(options);\n\t Galaxy.modal.show({\n\t title: 'Create a collection of paired datasets',\n\t body: creator.$el,\n\t width: '80%',\n\t height: '800px',\n\t closing_events: true\n\t });\n\t creator.render();\n\t window.creator = creator;\n\t\n\t //TODO: remove modal header\n\t return deferred;\n\t };\n\t\n\t //=============================================================================\n\t function createListOfPairsCollection(collection, defaultHideSourceItems) {\n\t var elements = collection.toJSON();\n\t //TODO: validate elements\n\t return pairedCollectionCreatorModal(elements, {\n\t historyId: collection.historyId,\n\t defaultHideSourceItems: defaultHideSourceItems\n\t });\n\t }\n\t\n\t //=============================================================================\n\t return {\n\t PairedCollectionCreator: PairedCollectionCreator,\n\t pairedCollectionCreatorModal: pairedCollectionCreatorModal,\n\t createListOfPairsCollection: createListOfPairsCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ }),\n/* 125 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(60), __webpack_require__(63), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_CREATOR, HDCA, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t /*==============================================================================\n\t TODO:\n\t the paired creator doesn't really mesh with the list creator as parent\n\t it may be better to make an abstract super class for both\n\t composites may inherit from this (or vis-versa)\n\t PairedDatasetCollectionElementView doesn't make a lot of sense\n\t \n\t ==============================================================================*/\n\t /** */\n\t var PairedDatasetCollectionElementView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t //TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n\t tagName: 'li',\n\t className: 'collection-element',\n\t\n\t initialize: function (attributes) {\n\t this.element = attributes.element || {};\n\t this.identifier = attributes.identifier;\n\t },\n\t\n\t render: function () {\n\t this.$el.attr('data-element-id', this.element.id).html(this.template({ identifier: this.identifier, element: this.element }));\n\t return this;\n\t },\n\t\n\t //TODO: lots of unused space in the element - possibly load details and display them horiz.\n\t template: _.template(['<%- identifier %>', '<%- element.name %>'].join('')),\n\t\n\t /** remove the DOM and any listeners */\n\t destroy: function () {\n\t this.off();\n\t this.$el.remove();\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'DatasetCollectionElementView()';\n\t }\n\t });\n\t\n\t // ============================================================================\n\t var _super = LIST_CREATOR.ListCollectionCreator;\n\t\n\t /** An interface for building collections.\n\t */\n\t var PairCollectionCreator = _super.extend({\n\t\n\t /** the class used to display individual elements */\n\t elementViewClass: PairedDatasetCollectionElementView,\n\t /** the class this creator will create and save */\n\t collectionClass: HDCA.HistoryPairDatasetCollection,\n\t className: 'pair-collection-creator collection-creator flex-row-container',\n\t\n\t /** override to no-op */\n\t _mangleDuplicateNames: function () {},\n\t\n\t // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n\t // bad inital choices and\n\t // when the user has painted his/her self into a corner during creation/use-of-the-creator\n\t /** render the entire interface */\n\t render: function (speed, callback) {\n\t if (this.workingElements.length === 2) {\n\t return _super.prototype.render.call(this, speed, callback);\n\t }\n\t return this._renderInvalid(speed, callback);\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering elements\n\t /** render forward/reverse */\n\t _renderList: function (speed, callback) {\n\t //this.debug( '-- _renderList' );\n\t //precondition: there are two valid elements in workingElements\n\t var creator = this,\n\t $tmp = jQuery('
              '),\n\t $list = creator.$list();\n\t\n\t // lose the original views, create the new, append all at once, then call their renders\n\t _.each(this.elementViews, function (view) {\n\t view.destroy();\n\t creator.removeElementView(view);\n\t });\n\t $tmp.append(creator._createForwardElementView().$el);\n\t $tmp.append(creator._createReverseElementView().$el);\n\t $list.empty().append($tmp.children());\n\t _.invoke(creator.elementViews, 'render');\n\t },\n\t\n\t /** create the forward element view */\n\t _createForwardElementView: function () {\n\t return this._createElementView(this.workingElements[0], { identifier: 'forward' });\n\t },\n\t\n\t /** create the forward element view */\n\t _createReverseElementView: function () {\n\t return this._createElementView(this.workingElements[1], { identifier: 'reverse' });\n\t },\n\t\n\t /** create an element view, cache in elementViews, and return */\n\t _createElementView: function (element, options) {\n\t var elementView = new this.elementViewClass(_.extend(options, {\n\t element: element\n\t }));\n\t this.elementViews.push(elementView);\n\t return elementView;\n\t },\n\t\n\t /** swap the forward, reverse elements and re-render */\n\t swap: function () {\n\t this.workingElements = [this.workingElements[1], this.workingElements[0]];\n\t this._renderList();\n\t },\n\t\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .swap': 'swap'\n\t }),\n\t\n\t // ------------------------------------------------------------------------ templates\n\t //TODO: move to require text plugin and load these as text\n\t //TODO: underscore currently unnecc. bc no vars are used\n\t //TODO: better way of localizing text-nodes in long strings\n\t /** underscore template fns attached to class */\n\t templates: _.extend(_.clone(_super.prototype.templates), {\n\t /** the middle: element list */\n\t middle: _.template(['', '
              ', '
              '].join('')),\n\t\n\t /** help content */\n\t helpContent: _.template(['

              ', _l(['Pair collections are permanent collections containing two datasets: one forward and one reverse. ', 'Often these are forward and reverse reads. The pair collections can be passed to tools and ', 'workflows in order to have analyses done on both datasets. This interface allows ', 'you to create a pair, name it, and swap which is forward and which reverse.'].join('')), '

              ', '
                ', '
              • ', _l(['Click the \"Swap\" link to make your forward dataset the reverse ', 'and the reverse dataset forward.'].join('')), '
              • ', '
              • ', _l(['Click the \"Cancel\" button to exit the interface.'].join('')), '
              • ', '

              ', '

              ', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '

              '].join('')),\n\t\n\t /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n\t invalidInitial: _.template(['
              ', '
              ', '', '<% if( _.size( problems ) ){ %>', _l('The following selections could not be included due to problems'), '
                <% _.each( problems, function( problem ){ %>', '
              • <%- problem.element.name %>: <%- problem.text %>
              • ', '<% }); %>
              ', '<% } else if( _.size( elements ) === 0 ){ %>', _l('No datasets were selected'), '.', '<% } else if( _.size( elements ) === 1 ){ %>', _l('Only one dataset was selected'), ': <%- elements[0].name %>', '<% } else if( _.size( elements ) > 2 ){ %>', _l('Too many datasets were selected'), ': <%- _.pluck( elements, \"name\" ).join( \", \") %>', '<% } %>', '
              ', _l('Two (and only two) elements are needed for the pair'), '. ', _l('You may need to '), '', _l('cancel'), ' ', _l('and reselect new elements'), '.', '
              ', '
              ', '
              ', '
              ', '
              ', '
              ', '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
              ', '
              ', '
              '].join(''))\n\t }),\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'PairCollectionCreator';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** List collection flavor of collectionCreatorModal. */\n\t var pairCollectionCreatorModal = function _pairCollectionCreatorModal(elements, options) {\n\t options = options || {};\n\t options.title = _l('Create a collection from a pair of datasets');\n\t return LIST_CREATOR.collectionCreatorModal(elements, options, PairCollectionCreator);\n\t };\n\t\n\t //==============================================================================\n\t /** Use a modal to create a pair collection, then add it to the given history contents.\n\t * @returns {Deferred} resolved when the collection is added to the history.\n\t */\n\t function createPairCollection(contents, defaultHideSourceItems) {\n\t var elements = contents.toJSON(),\n\t promise = pairCollectionCreatorModal(elements, {\n\t defaultHideSourceItems: defaultHideSourceItems,\n\t creationFn: function (elements, name, hideSourceItems) {\n\t elements = [{ name: \"forward\", src: \"hda\", id: elements[0].id }, { name: \"reverse\", src: \"hda\", id: elements[1].id }];\n\t return contents.createHDCA(elements, 'paired', name, hideSourceItems);\n\t }\n\t });\n\t return promise;\n\t }\n\t\n\t //==============================================================================\n\t return {\n\t PairCollectionCreator: PairCollectionCreator,\n\t pairCollectionCreatorModal: pairCollectionCreatorModal,\n\t createPairCollection: createPairCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ }),\n/* 126 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(49), __webpack_require__(5), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Tabs, Ui, Form) {\n\t\n\t /** Dataset edit attributes view */\n\t var View = Backbone.View.extend({\n\t initialize: function () {\n\t this.setElement('
              ');\n\t this.model = new Backbone.Model({ 'dataset_id': Galaxy.params.dataset_id });\n\t this.render();\n\t },\n\t\n\t // Fetch data for the selected dataset and \n\t // build tabs for editing its attributes\n\t render: function () {\n\t var url = Galaxy.root + 'dataset/edit',\n\t self = this;\n\t Utils.get({\n\t url: url,\n\t data: { 'dataset_id': self.model.get('dataset_id') },\n\t success: function (response) {\n\t self.render_attribute_page(self, response);\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while loading the dataset.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t\n\t /** Render all the tabs view */\n\t render_attribute_page: function (self, response) {\n\t var message = {\n\t 'message': response.message,\n\t 'status': response.status,\n\t 'persistent': true,\n\t 'cls': response.status + 'message'\n\t };\n\t self.$el.empty().append(self._templateHeader());\n\t self.display_message(message, self.$('.response-message'));\n\t // Create all tabs\n\t self.create_tabs(response, self.$('.edit-attr'));\n\t },\n\t\n\t /** Perform AJAX post call */\n\t call_ajax: function (self, data, tab_name) {\n\t var post_url = Galaxy.root + 'dataset/edit';\n\t $.ajax({\n\t type: \"PUT\",\n\t url: post_url,\n\t data: data,\n\t success: function (response) {\n\t self.render_attribute_page(self, response);\n\t self.reload_history();\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t\n\t /** Display actions messages */\n\t display_message: function (response, $el) {\n\t $el.empty().html(new Ui.Message(response).$el);\n\t },\n\t\n\t /** Create tabs for different attributes of dataset*/\n\t create_tabs: function (response, $el_edit_attr) {\n\t var self = this;\n\t self.tabs = new Tabs.View();\n\t self.tabs.add({\n\t id: 'attributes',\n\t title: 'Attributes',\n\t icon: 'fa fa-bars',\n\t tooltip: 'Edit dataset attributes',\n\t $el: self._getAttributesFormTemplate(response)\n\t });\n\t\n\t self.tabs.add({\n\t id: 'convert',\n\t title: 'Convert',\n\t icon: 'fa-gear',\n\t tooltip: 'Convert to new format',\n\t $el: self._getConvertFormTemplate(response)\n\t });\n\t\n\t self.tabs.add({\n\t id: 'datatype',\n\t title: 'Datatypes',\n\t icon: 'fa-database',\n\t tooltip: 'Change data type',\n\t $el: self._getChangeDataTypeFormTemplate(response)\n\t });\n\t\n\t self.tabs.add({\n\t id: 'permissions',\n\t title: 'Permissions',\n\t icon: 'fa-user',\n\t tooltip: 'Permissions',\n\t $el: self._getPermissionsFormTemplate(response)\n\t });\n\t $el_edit_attr.append(self.tabs.$el);\n\t self.tabs.showTab('attributes');\n\t },\n\t\n\t /** Main template */\n\t _templateHeader: function () {\n\t return '
              ' + '
              ' + '

              Edit Dataset Attributes

              ' + '
              ';\n\t },\n\t\n\t /** Attributes tab template */\n\t _getAttributesFormTemplate: function (response) {\n\t var self = this;\n\t var form = new Form({\n\t title: 'Edit attributes',\n\t inputs: response.edit_attributes_inputs,\n\t operations: {\n\t 'submit_editattr': new Ui.ButtonIcon({\n\t tooltip: 'Save attributes of the dataset.',\n\t icon: 'fa-floppy-o ',\n\t title: 'Save attributes',\n\t onclick: function () {\n\t self._submit(self, form, response, \"edit_attributes\");\n\t }\n\t }),\n\t 'submit_autocorrect': new Ui.ButtonIcon({\n\t tooltip: 'This will inspect the dataset and attempt to correct the values of fields if they are not accurate.',\n\t icon: 'fa-undo ',\n\t title: 'Auto-detect',\n\t onclick: function () {\n\t self._submit(self, form, response, \"auto-detect\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Convert tab template */\n\t _getConvertFormTemplate: function (response) {\n\t var self = this;\n\t var form = new Form({\n\t title: 'Convert to new format',\n\t inputs: response.convert_inputs,\n\t operations: {\n\t 'submit': new Ui.ButtonIcon({\n\t tooltip: 'Convert the datatype to a new format.',\n\t title: 'Convert datatype',\n\t icon: 'fa-exchange ',\n\t onclick: function () {\n\t self._submit(self, form, response, \"convert\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Change datatype template */\n\t _getChangeDataTypeFormTemplate: function (response) {\n\t var self = this;\n\t var form = new Form({\n\t title: 'Change datatype',\n\t inputs: response.convert_datatype_inputs,\n\t operations: {\n\t 'submit': new Ui.ButtonIcon({\n\t tooltip: 'Change the datatype to a new type.',\n\t title: 'Change datatype',\n\t icon: 'fa-exchange ',\n\t onclick: function () {\n\t self._submit(self, form, response, \"change\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Permissions template */\n\t _getPermissionsFormTemplate: function (response) {\n\t var template = \"\",\n\t self = this;\n\t if (response.can_manage_dataset) {\n\t var form = new Form({\n\t title: 'Manage dataset permissions on ' + response.display_name,\n\t inputs: response.permission_inputs,\n\t operations: {\n\t 'submit': new Ui.ButtonIcon({\n\t tooltip: 'Save permissions.',\n\t title: 'Save permissions',\n\t icon: 'fa-floppy-o ',\n\t onclick: function () {\n\t self._submit(self, form, response, \"permissions\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t } else {\n\t var form = new Form({\n\t title: 'View permissions',\n\t inputs: response.permission_inputs\n\t });\n\t return form.$el;\n\t }\n\t },\n\t\n\t /** Submit action */\n\t _submit: function (self, form, response, type) {\n\t var form_data = form.data.create();\n\t form_data.dataset_id = response.dataset_id;\n\t switch (type) {\n\t case \"edit_attributes\":\n\t form_data.save = 'Save';\n\t break;\n\t\n\t case \"auto-detect\":\n\t form_data.detect = 'Auto-detect';\n\t break;\n\t\n\t case \"convert\":\n\t if (form_data.target_type !== null && form_data.target_type) {\n\t form_data.dataset_id = response.dataset_id;\n\t form_data.convert_data = 'Convert';\n\t }\n\t break;\n\t\n\t case \"change\":\n\t form_data.change = 'Save';\n\t break;\n\t\n\t case \"permissions\":\n\t var post_data = {};\n\t post_data.permissions = JSON.stringify(form_data);\n\t post_data.update_roles_button = \"Save\";\n\t post_data.dataset_id = response.dataset_id;\n\t form_data = post_data;\n\t break;\n\t }\n\t self.call_ajax(self, form_data);\n\t },\n\t\n\t /** Reload Galaxy's history after updating dataset's attributes */\n\t reload_history: function () {\n\t if (window.Galaxy) {\n\t window.Galaxy.currHistoryPanel.loadCurrentHistory();\n\t }\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ }),\n/* 127 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(5), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Ui, Form) {\n\t\n\t /** Dataset edit attributes view */\n\t var View = Backbone.View.extend({\n\t initialize: function () {\n\t this.setElement('
              ');\n\t this.model = new Backbone.Model({ 'dataset_id': Galaxy.params.dataset_id });\n\t this.render();\n\t },\n\t\n\t // Fetch data for the selected dataset and\n\t render: function () {\n\t var data_url = Galaxy.root + 'api/datasets/' + this.model.get('dataset_id'),\n\t self = this;\n\t\n\t Utils.get({\n\t url: data_url,\n\t success: function (dataset) {\n\t var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n\t Utils.get({\n\t url: job_url,\n\t success: function (job) {\n\t var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n\t self.render_error_page(self, dataset, job);\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while loading the job.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while loading the dataset.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t\n\t /** Render the view */\n\t render_error_page: function (self, dataset, job) {\n\t self.$el.empty().append(self._templateHeader());\n\t self.$el.append('

              Dataset Error

              ');\n\t self.$el.append('

              An error occured while running the tool ' + job.tool_id + '.

              ');\n\t self.$el.append('

              Tool execution generated the following messages:

              ');\n\t self.$el.append('
              ' + job.stderr + '
              ');\n\t self.$el.append('

              Report This Error

            1. ');\n\t self.$el.append('

              Usually the local Galaxy administrators regularly review errors that occur on the server. However, if you would like to provide additional information (such as what you were trying to do when the error occurred) and a contact e-mail address, we will be better able to investigate your problem and get back to you.

              ');\n\t self.$el.append(self._getBugFormTemplate(dataset, job));\n\t },\n\t\n\t /** Display actions messages */\n\t display_message: function (response, $el, doNotClear, safe) {\n\t if (!safe) {\n\t if (doNotClear) {\n\t $el.append(new Ui.Message(response).$el);\n\t } else {\n\t $el.empty().html(new Ui.Message(response).$el);\n\t }\n\t } else {\n\t if (doNotClear) {\n\t $el.append(new Ui.UnescapedMessage(response).$el);\n\t } else {\n\t $el.empty().html(new Ui.UnescapedMessage(response).$el);\n\t }\n\t }\n\t },\n\t\n\t /** Main template */\n\t _templateHeader: function () {\n\t return '
              ' + '
              ' + '
              ';\n\t },\n\t\n\t /** Convert tab template */\n\t _getBugFormTemplate: function (dataset, job) {\n\t var self = this;\n\t var inputs = [{\n\t \"help\": \"Your email address\",\n\t \"options\": [],\n\t \"type\": \"text\",\n\t \"name\": \"email\",\n\t \"label\": \"Your email\",\n\t \"value\": Galaxy.user.get('email')\n\t }, {\n\t \"help\": \"Any additional comments you can provide regarding what you were doing at the time of the bug.\",\n\t \"options\": [],\n\t \"type\": \"text\",\n\t \"area\": true,\n\t \"name\": \"message\",\n\t \"label\": \"Message\"\n\t }];\n\t\n\t // TODO\n\t if (false) {\n\t inputs.push({\n\t \"name\": \"public_consent\",\n\t \"label\": \"Public Disclosure Consent\",\n\t \"help\": \"This Galaxy is configured to report to one or more error reporting backends that public to the world. By selecting 'yes', you acknowledge that this bug report will be made public.\",\n\t \"value\": String(Boolean(false)),\n\t \"options\": [],\n\t \"type\": \"boolean\"\n\t });\n\t }\n\t\n\t var form = new Form({\n\t title: 'Error Report',\n\t inputs: inputs,\n\t buttons: {\n\t save: new Ui.Button({\n\t icon: 'fa-bug',\n\t title: 'Report',\n\t cls: 'ui-button btn btn-primary',\n\t floating: 'clear',\n\t onclick: function () {\n\t var form_data = form.data.create();\n\t var url = Galaxy.root + 'api/jobs/' + job.id + '/error';\n\t form_data.dataset_id = dataset.id;\n\t self.submit(form_data, url);\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Make ajax request */\n\t submit: function (form_data, url) {\n\t var self = this;\n\t // Some required metadata\n\t $.ajax({\n\t type: \"POST\",\n\t url: url,\n\t data: form_data,\n\t success: function (response) {\n\t // Clear out the div\n\t self.$el.empty().append(self._templateHeader());\n\t // And display the messages.\n\t response.messages.forEach(function (message) {\n\t self.display_message({\n\t 'status': message[1],\n\t 'message': message[0],\n\t 'persistent': true\n\t }, self.$('.response-message'), true, true);\n\t });\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ }),\n/* 128 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This class renders the grid list with shared section. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(12)], __WEBPACK_AMD_DEFINE_RESULT__ = function (GridView) {\n\t var View = Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.setElement($('
              '));\n\t this.model = new Backbone.Model(options);\n\t this.item = this.model.get('item');\n\t this.title = this.model.get('plural');\n\t $.ajax({\n\t url: Galaxy.root + this.item + '/' + this.model.get('action_id'),\n\t success: function (response) {\n\t response['dict_format'] = true;\n\t self.model.set(response);\n\t self.render();\n\t }\n\t });\n\t },\n\t\n\t render: function () {\n\t var grid = new GridView(this.model.attributes);\n\t this.$el.empty().append(grid.$el);\n\t this.$el.append(this._templateShared());\n\t },\n\t\n\t _templateShared: function () {\n\t var self = this;\n\t var $tmpl = $('
              ' + '

              ' + this.model.get('plural') + ' shared with you by others

              ' + '
              ');\n\t var options = this.model.attributes;\n\t if (options.shared_by_others && options.shared_by_others.length > 0) {\n\t var $table = $('' + '' + '' + '' + '' + '
              TitleOwner
              ');\n\t _.each(options.shared_by_others, function (it, index) {\n\t var display_url = Galaxy.root + self.item + '/display_by_username_and_slug?username=' + it.username + '&slug=' + it.slug;\n\t $table.append('
              ' + '' + _.escape(it.title) + '' + '' + _.escape(it.username) + '
              ' + '
              ' + '
              ' + '
              ' + '
              ' + '
              You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.
              ' + '',\n '
              ',\n '
              '\n ].join( '' );\n }\n});\n\n//==============================================================================\nreturn {\n CitationView : CitationView,\n CitationListView : CitationListView\n};\n\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/citation/citation-view.js","define([\n \"mvc/list/list-item\",\n \"mvc/dataset/dataset-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_ITEM, DATASET_LI, BASE_MVC, _l ){\n\n'use strict';\n//==============================================================================\nvar FoldoutListItemView = LIST_ITEM.FoldoutListItemView,\n ListItemView = LIST_ITEM.ListItemView;\n/** @class Read only view for DatasetCollection.\n */\nvar DCListItemView = FoldoutListItemView.extend(\n/** @lends DCListItemView.prototype */{\n\n className : FoldoutListItemView.prototype.className + \" dataset-collection\",\n id : function(){\n return [ 'dataset_collection', this.model.get( 'id' ) ].join( '-' );\n },\n\n /** override to add linkTarget */\n initialize : function( attributes ){\n this.linkTarget = attributes.linkTarget || '_blank';\n this.hasUser = attributes.hasUser;\n FoldoutListItemView.prototype.initialize.call( this, attributes );\n },\n\n /** event listeners */\n _setUpListeners : function(){\n FoldoutListItemView.prototype._setUpListeners.call( this );\n this.listenTo( this.model, 'change', function( model, options ){\n // if the model has changed deletion status render it entirely\n if( _.has( model.changed, 'deleted' ) ){\n this.render();\n\n // if the model has been decorated after the fact with the element count,\n // render the subtitle where the count is displayed\n } else if( _.has( model.changed, 'element_count' ) ){\n this.$( '> .title-bar .subtitle' ).replaceWith( this._renderSubtitle() );\n }\n });\n },\n\n // ......................................................................... rendering\n /** render a subtitle to show the user what sort of collection this is */\n _renderSubtitle : function(){\n return $( this.templates.subtitle( this.model.toJSON(), this ) );\n },\n\n // ......................................................................... foldout\n /** override to add linktarget to sub-panel */\n _getFoldoutPanelOptions : function(){\n var options = FoldoutListItemView.prototype._getFoldoutPanelOptions.call( this );\n return _.extend( options, {\n linkTarget : this.linkTarget,\n hasUser : this.hasUser\n });\n },\n\n /** override to not catch sub-panel selectors */\n $selector : function(){\n return this.$( '> .selector' );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDCListItemView.prototype.templates = (function(){\n\n var warnings = _.extend( {}, FoldoutListItemView.prototype.templates.warnings, {\n error : BASE_MVC.wrapTemplate([\n // error during index fetch - show error on dataset\n '<% if( model.error ){ %>',\n '
              ',\n _l( 'There was an error getting the data for this collection' ), ': <%- model.error %>',\n '
              ',\n '<% } %>'\n ]),\n purged : BASE_MVC.wrapTemplate([\n '<% if( model.purged ){ %>',\n '
              ',\n _l( 'This collection has been deleted and removed from disk' ),\n '
              ',\n '<% } %>'\n ]),\n deleted : BASE_MVC.wrapTemplate([\n // deleted not purged\n '<% if( model.deleted && !model.purged ){ %>',\n '
              ',\n _l( 'This collection has been deleted' ),\n '
              ',\n '<% } %>'\n ])\n });\n\n // use element identifier\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n '
              ',\n '
              ',\n '<%- collection.element_identifier || collection.name %>',\n '
              ',\n '
              ',\n '
              '\n ], 'collection' );\n\n // use element identifier\n var subtitleTemplate = BASE_MVC.wrapTemplate([\n '
              ',\n '<% var countText = collection.element_count? ( collection.element_count + \" \" ) : \"\"; %>',\n '<% if( collection.collection_type === \"list\" ){ %>',\n _l( 'a list of <%- countText %>datasets' ),\n '<% } else if( collection.collection_type === \"paired\" ){ %>',\n _l( 'a pair of datasets' ),\n '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n _l( 'a list of <%- countText %>dataset pairs' ),\n '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n _l( 'a list of <%- countText %>dataset lists' ),\n '<% } %>',\n '
              '\n ], 'collection' );\n\n return _.extend( {}, FoldoutListItemView.prototype.templates, {\n warnings : warnings,\n titleBar : titleBarTemplate,\n subtitle : subtitleTemplate\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for DatasetCollectionElement.\n */\nvar DCEListItemView = ListItemView.extend(\n/** @lends DCEListItemView.prototype */{\n\n /** add the DCE class to the list item */\n className : ListItemView.prototype.className + \" dataset-collection-element\",\n\n /** set up */\n initialize : function( attributes ){\n if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }\n this.log( 'DCEListItemView.initialize:', attributes );\n ListItemView.prototype.initialize.call( this, attributes );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCEListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDCEListItemView.prototype.templates = (function(){\n\n // use the element identifier here - since that will persist and the user will need it\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n '
              ',\n '
              ',\n '<%- element.element_identifier %>',\n '
              ',\n '
              ',\n '
              '\n ], 'element' );\n\n return _.extend( {}, ListItemView.prototype.templates, {\n titleBar : titleBarTemplate\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for a DatasetCollectionElement that is also an DatasetAssociation\n * (a dataset contained in a dataset collection).\n */\nvar DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend(\n/** @lends DatasetDCEListItemView.prototype */{\n\n className : DATASET_LI.DatasetListItemView.prototype.className + \" dataset-collection-element\",\n\n /** set up */\n initialize : function( attributes ){\n if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }\n this.log( 'DatasetDCEListItemView.initialize:', attributes );\n DATASET_LI.DatasetListItemView.prototype.initialize.call( this, attributes );\n },\n\n /** In this override, only get details if in the ready state.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n }\n return jQuery.when();\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DatasetDCEListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetDCEListItemView.prototype.templates = (function(){\n\n // use the element identifier here and not the dataset name\n //TODO:?? can we steal the DCE titlebar?\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n '
              ',\n '',\n '
              ',\n '<%- element.element_identifier %>',\n '
              ',\n '
              '\n ], 'element' );\n\n return _.extend( {}, DATASET_LI.DatasetListItemView.prototype.templates, {\n titleBar : titleBarTemplate\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n * (a nested DC).\n */\nvar NestedDCDCEListItemView = DCListItemView.extend(\n/** @lends NestedDCDCEListItemView.prototype */{\n\n className : DCListItemView.prototype.className + \" dataset-collection-element\",\n\n /** In this override, add the state as a class for use with state-based CSS */\n _swapNewRender : function( $newRender ){\n DCListItemView.prototype._swapNewRender.call( this, $newRender );\n var state = this.model.get( 'state' ) || 'ok';\n this.$el.addClass( 'state-' + state );\n return this.$el;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'NestedDCDCEListItemView(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\n return {\n DCListItemView : DCListItemView,\n DCEListItemView : DCEListItemView,\n DatasetDCEListItemView : DatasetDCEListItemView,\n NestedDCDCEListItemView : NestedDCDCEListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-li.js","define([\n \"mvc/dataset/dataset-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET_MODEL, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\n/*\nNotes:\n\nTerminology:\n DatasetCollection/DC : a container of datasets or nested DatasetCollections\n Element/DatasetCollectionElement/DCE : an item contained in a DatasetCollection\n HistoryDatasetCollectionAssociation/HDCA: a DatasetCollection contained in a history\n\n\nThis all seems too complex unfortunately:\n\n- Terminology collision between DatasetCollections (DCs) and Backbone Collections.\n- In the DatasetCollections API JSON, DC Elements use a 'Has A' stucture to *contain*\n either a dataset or a nested DC. This would make the hierarchy much taller. I've\n decided to merge the contained JSON with the DC element json - making the 'has a'\n relation into an 'is a' relation. This seems simpler to me and allowed a lot of\n DRY in both models and views, but may make tracking or tracing within these models\n more difficult (since DatasetCollectionElements are now *also* DatasetAssociations\n or DatasetCollections (nested)). This also violates the rule of thumb about\n favoring aggregation over inheritance.\n- Currently, there are three DatasetCollection subclasses: List, Pair, and ListPaired.\n These each should a) be usable on their own, b) be usable in the context of\n nesting within a collection model (at least in the case of ListPaired), and\n c) be usable within the context of other container models (like History or\n LibraryFolder, etc.). I've tried to separate/extract classes in order to\n handle those three situations, but it's proven difficult to do in a simple,\n readable manner.\n- Ideally, histories and libraries would inherit from the same server models as\n dataset collections do since they are (in essence) dataset collections themselves -\n making the whole nested structure simpler. This would be a large, error-prone\n refactoring and migration.\n\nMany of the classes and heirarchy are meant as extension points so, while the\nrelations and flow may be difficult to understand initially, they'll allow us to\nhandle the growth or flux dataset collection in the future (w/o actually implementing\nany YAGNI).\n\n*/\n//_________________________________________________________________________________________________ ELEMENTS\n/** @class mixin for Dataset collection elements.\n * When collection elements are passed from the API, the underlying element is\n * in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).\n * This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues\n * effectively changing a DCE from a container to a subclass (has a --> is a).\n */\nvar DatasetCollectionElementMixin = {\n\n /** default attributes used by elements in a dataset collection */\n defaults : {\n model_class : 'DatasetCollectionElement',\n element_identifier : null,\n element_index : null,\n element_type : null\n },\n\n /** merge the attributes of the sub-object 'object' into this model */\n _mergeObject : function( attributes ){\n // if we don't preserve and correct ids here, the element id becomes the object id\n // and collision in backbone's _byId will occur and only\n _.extend( attributes, attributes.object, { element_id: attributes.id });\n delete attributes.object;\n return attributes;\n },\n\n /** override to merge this.object into this */\n constructor : function( attributes, options ){\n // console.debug( '\\t DatasetCollectionElement.constructor:', attributes, options );\n attributes = this._mergeObject( attributes );\n this.idAttribute = 'element_id';\n Backbone.Model.apply( this, arguments );\n },\n\n /** when the model is fetched, merge this.object into this */\n parse : function( response, options ){\n var attributes = response;\n attributes = this._mergeObject( attributes );\n return attributes;\n }\n};\n\n/** @class Concrete class of Generic DatasetCollectionElement */\nvar DatasetCollectionElement = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( DatasetCollectionElementMixin )\n .extend({ _logNamespace : 'collections' });\n\n\n//==============================================================================\n/** @class Base/Abstract Backbone collection for Generic DCEs. */\nvar DCECollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).extend(\n/** @lends DCECollection.prototype */{\n _logNamespace : 'collections',\n\n model: DatasetCollectionElement,\n\n /** String representation. */\n toString : function(){\n return ([ 'DatasetCollectionElementCollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for a dataset collection element that is a dataset (HDA).\n */\nvar DatasetDCE = DATASET_MODEL.DatasetAssociation.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends DatasetDCE.prototype */{\n\n /** url fn */\n url : function(){\n // won't always be an hda\n if( !this.has( 'history_id' ) ){\n console.warn( 'no endpoint for non-hdas within a collection yet' );\n // (a little silly since this api endpoint *also* points at hdas)\n return Galaxy.root + 'api/datasets';\n }\n return Galaxy.root + 'api/histories/' + this.get( 'history_id' ) + '/contents/' + this.get( 'id' );\n },\n\n defaults : _.extend( {},\n DATASET_MODEL.DatasetAssociation.prototype.defaults,\n DatasetCollectionElementMixin.defaults\n ),\n\n _downloadQueryParameters : function() {\n return '?to_ext=' + this.get( 'file_ext' ) + '&hdca_id=' + this.get( 'parent_hdca_id' ) + '&element_identifier=' + this.get( 'element_identifier' );\n },\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually for now\n /** call the mixin constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t DatasetDCE.constructor:', attributes, options );\n //DATASET_MODEL.DatasetAssociation.prototype.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** Does this model already contain detailed data (as opposed to just summary level data)? */\n hasDetails : function(){\n return this.elements && this.elements.length;\n },\n\n /** String representation. */\n toString : function(){\n var objStr = this.get( 'element_identifier' );\n return ([ 'DatasetDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n */\nvar DatasetDCECollection = DCECollection.extend(\n/** @lends DatasetDCECollection.prototype */{\n model: DatasetDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'DatasetDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//_________________________________________________________________________________________________ COLLECTIONS\n/** @class Backbone model for Dataset Collections.\n * The DC API returns an array of JSON objects under the attribute elements.\n * This model:\n * - removes that array/attribute ('elements') from the model,\n * - creates a bbone collection (of the class defined in the 'collectionClass' attribute),\n * - passes that json onto the bbone collection\n * - caches the bbone collection in this.elements\n */\nvar DatasetCollection = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( BASE_MVC.SearchableModelMixin )\n .extend(/** @lends DatasetCollection.prototype */{\n _logNamespace : 'collections',\n\n /** default attributes for a model */\n defaults : {\n /* 'list', 'paired', or 'list:paired' */\n collection_type : null,\n //??\n deleted : false\n },\n\n /** Which class to use for elements */\n collectionClass : DCECollection,\n\n /** set up: create elements instance var and (on changes to elements) update them */\n initialize : function( model, options ){\n this.debug( this + '(DatasetCollection).initialize:', model, options, this );\n this.elements = this._createElementsModel();\n this.on( 'change:elements', function(){\n this.log( 'change:elements' );\n //TODO: prob. better to update the collection instead of re-creating it\n this.elements = this._createElementsModel();\n });\n },\n\n /** move elements model attribute to full collection */\n _createElementsModel : function(){\n this.debug( this + '._createElementsModel', this.collectionClass, this.get( 'elements' ), this.elements );\n //TODO: same patterns as DatasetCollectionElement _createObjectModel - refactor to BASE_MVC.hasSubModel?\n var elements = this.get( 'elements' ) || [];\n this.unset( 'elements', { silent: true });\n var self = this;\n _.each(elements, function(element, index) {\n _.extend(element, {\"parent_hdca_id\": self.get(\"id\")});\n });\n this.elements = new this.collectionClass( elements );\n //this.debug( 'collectionClass:', this.collectionClass + '', this.elements );\n return this.elements;\n },\n\n // ........................................................................ common queries\n /** pass the elements back within the model json when this is serialized */\n toJSON : function(){\n var json = Backbone.Model.prototype.toJSON.call( this );\n if( this.elements ){\n json.elements = this.elements.toJSON();\n }\n return json;\n },\n\n /** Is this collection in a 'ready' state no processing (for the collection) is left\n * to do on the server.\n */\n inReadyState : function(){\n var populated = this.get( 'populated' );\n return ( this.isDeletedOrPurged() || populated );\n },\n\n //TODO:?? the following are the same interface as DatasetAssociation - can we combine?\n /** Does the DC contain any elements yet? Is a fetch() required? */\n hasDetails : function(){\n return this.elements.length !== 0;\n },\n\n /** Given the filters, what models in this.elements would be returned? */\n getVisibleContents : function( filters ){\n // filters unused for now\n return this.elements;\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse : function( response, options ){\n var parsed = Backbone.Model.prototype.parse.call( this, response, options );\n if( parsed.create_time ){\n parsed.create_time = new Date( parsed.create_time );\n }\n if( parsed.update_time ){\n parsed.update_time = new Date( parsed.update_time );\n }\n return parsed;\n },\n\n /** save this dataset, _Mark_ing it as deleted (just a flag) */\n 'delete' : function( options ){\n if( this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: true }, options );\n },\n /** save this dataset, _Mark_ing it as undeleted */\n undelete : function( options ){\n if( !this.get( 'deleted' ) || this.get( 'purged' ) ){ return jQuery.when(); }\n return this.save( { deleted: false }, options );\n },\n\n /** Is this collection deleted or purged? */\n isDeletedOrPurged : function(){\n return ( this.get( 'deleted' ) || this.get( 'purged' ) );\n },\n\n // ........................................................................ searchable\n /** searchable attributes for collections */\n searchAttributes : [\n 'name', 'tags'\n ],\n\n // ........................................................................ misc\n /** String representation */\n toString : function(){\n var idAndName = [ this.get( 'id' ), this.get( 'name' ) || this.get( 'element_identifier' ) ];\n return 'DatasetCollection(' + ( idAndName.join(',') ) + ')';\n }\n});\n\n\n//==============================================================================\n/** Model for a DatasetCollection containing datasets (non-nested).\n */\nvar ListDatasetCollection = DatasetCollection.extend(\n/** @lends ListDatasetCollection.prototype */{\n\n /** override since we know the collection will only contain datasets */\n collectionClass : DatasetDCECollection,\n\n /** String representation. */\n toString : function(){ return 'List' + DatasetCollection.prototype.toString.call( this ); }\n});\n\n\n//==============================================================================\n/** Model for a DatasetCollection containing fwd/rev datasets (a list of 2).\n */\nvar PairDatasetCollection = ListDatasetCollection.extend(\n/** @lends PairDatasetCollection.prototype */{\n\n /** String representation. */\n toString : function(){ return 'Pair' + DatasetCollection.prototype.toString.call( this ); }\n});\n\n\n//_________________________________________________________________________________________________ NESTED COLLECTIONS\n// this is where things get weird, man. Weird.\n//TODO: it might be possible to compact all the following...I think.\n//==============================================================================\n/** @class Backbone model for a Generic DatasetCollectionElement that is also a DatasetCollection\n * (a nested collection). Currently only list:paired.\n */\nvar NestedDCDCE = DatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends NestedDCDCE.prototype */{\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** call the mixin constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t NestedDCDCE.constructor:', attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** String representation. */\n toString : function(){\n var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );\n return ([ 'NestedDCDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n */\nvar NestedDCDCECollection = DCECollection.extend(\n/** @lends NestedDCDCECollection.prototype */{\n\n /** This is a collection of nested collections */\n model: NestedDCDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'NestedDCDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n */\nvar NestedPairDCDCE = PairDatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends NestedPairDCDCE.prototype */{\n//TODO:?? possibly rename to NestedDatasetCollection?\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** This is both a collection and a collection element - call the constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t NestedPairDCDCE.constructor:', attributes, options );\n //DatasetCollection.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** String representation. */\n toString : function(){\n var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );\n return ([ 'NestedPairDCDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection for a backbone collection containing paired dataset collections.\n */\nvar NestedPairDCDCECollection = NestedDCDCECollection.extend(\n/** @lends PairDCDCECollection.prototype */{\n\n /** We know this collection is composed of only nested pair collections */\n model: NestedPairDCDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'NestedPairDCDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n */\nvar ListPairedDatasetCollection = DatasetCollection.extend(\n/** @lends ListPairedDatasetCollection.prototype */{\n\n /** list:paired is the only collection that itself contains collections */\n collectionClass : NestedPairDCDCECollection,\n\n /** String representation. */\n toString : function(){\n return ([ 'ListPairedDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for a list dataset collection within a list:list dataset collection. */\nvar NestedListDCDCE = ListDatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends NestedListDCDCE.prototype */{\n\n /** This is both a collection and a collection element - call the constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t NestedListDCDCE.constructor:', attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** String representation. */\n toString : function(){\n var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );\n return ([ 'NestedListDCDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection containing list dataset collections. */\nvar NestedListDCDCECollection = NestedDCDCECollection.extend({\n\n /** We know this collection is composed of only nested pair collections */\n model: NestedListDCDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'NestedListDCDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\nvar ListOfListsDatasetCollection = DatasetCollection.extend({\n\n /** list:paired is the only collection that itself contains collections */\n collectionClass : NestedListDCDCECollection,\n\n /** String representation. */\n toString : function(){\n return ([ 'ListOfListsDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n ListDatasetCollection : ListDatasetCollection,\n PairDatasetCollection : PairDatasetCollection,\n ListPairedDatasetCollection : ListPairedDatasetCollection,\n ListOfListsDatasetCollection: ListOfListsDatasetCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-model.js","\ndefine([\n \"mvc/history/hdca-model\",\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"mvc/collection/base-creator\",\n \"mvc/ui/ui-modal\",\n \"utils/natural-sort\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( HDCA, STATES, BASE_MVC, baseCreator, UI_MODAL, naturalSort, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n\n/*==============================================================================\nTODO:\n use proper Element model and not just json\n straighten out createFn, collection.createHDCA\n possibly stop using modals for this\n It would be neat to do a drag and drop\n\n==============================================================================*/\n/** A view for both DatasetDCEs and NestedDCDCEs\n * (things that implement collection-model:DatasetCollectionElementMixin)\n */\nvar DatasetCollectionElementView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n//TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName : 'li',\n className : 'collection-element',\n\n initialize : function( attributes ){\n this.element = attributes.element || {};\n this.selected = attributes.selected || false;\n },\n\n render : function(){\n this.$el\n .attr( 'data-element-id', this.element.id )\n .attr( 'draggable', true )\n .html( this.template({ element: this.element }) );\n if( this.selected ){\n this.$el.addClass( 'selected' );\n }\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template : _.template([\n '',\n '<%- element.name %>',\n '',\n '',\n ].join('')),\n\n /** select this element and pub */\n select : function( toggle ){\n this.$el.toggleClass( 'selected', toggle );\n this.trigger( 'select', {\n source : this,\n selected : this.$el.hasClass( 'selected' )\n });\n },\n\n /** animate the removal of this element and pub */\n discard : function(){\n var view = this,\n parentWidth = this.$el.parent().width();\n this.$el.animate({ 'margin-right' : parentWidth }, 'fast', function(){\n view.trigger( 'discard', {\n source : view\n });\n view.destroy();\n });\n },\n\n /** remove the DOM and any listeners */\n destroy : function(){\n this.off();\n this.$el.remove();\n },\n\n events : {\n 'click' : '_click',\n 'click .name' : '_clickName',\n 'click .discard': '_clickDiscard',\n\n 'dragstart' : '_dragstart',\n 'dragend' : '_dragend',\n 'dragover' : '_sendToParent',\n 'drop' : '_sendToParent'\n },\n\n /** select when the li is clicked */\n _click : function( ev ){\n ev.stopPropagation();\n this.select( ev );\n },\n\n /** rename a pair when the name is clicked */\n _clickName : function( ev ){\n ev.stopPropagation();\n ev.preventDefault();\n var promptString = [ _l( 'Enter a new name for the element' ), ':\\n(',\n _l( 'Note that changing the name here will not rename the dataset' ), ')' ].join( '' ),\n response = prompt( _l( 'Enter a new name for the element' ) + ':', this.element.name );\n if( response ){\n this.element.name = response;\n this.render();\n }\n //TODO: cancelling with ESC leads to closure of the creator...\n },\n\n /** discard when the discard button is clicked */\n _clickDiscard : function( ev ){\n ev.stopPropagation();\n this.discard();\n },\n\n /** dragging pairs for re-ordering */\n _dragstart : function( ev ){\n if( ev.originalEvent ){ ev = ev.originalEvent; }\n ev.dataTransfer.effectAllowed = 'move';\n ev.dataTransfer.setData( 'text/plain', JSON.stringify( this.element ) );\n\n this.$el.addClass( 'dragging' );\n this.$el.parent().trigger( 'collection-element.dragstart', [ this ] );\n },\n\n /** dragging for re-ordering */\n _dragend : function( ev ){\n this.$el.removeClass( 'dragging' );\n this.$el.parent().trigger( 'collection-element.dragend', [ this ] );\n },\n\n /** manually bubble up an event to the parent/container */\n _sendToParent : function( ev ){\n this.$el.parent().trigger( ev );\n },\n\n /** string rep */\n toString : function(){\n return 'DatasetCollectionElementView()';\n }\n});\n\n\n// ============================================================================\n/** An interface for building collections.\n */\nvar ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend( baseCreator.CollectionCreatorMixin ).extend({\n _logNamespace : logNamespace,\n\n /** the class used to display individual elements */\n elementViewClass : DatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass : HDCA.HistoryListDatasetCollection,\n className : 'list-collection-creator collection-creator flex-row-container',\n\n /** minimum number of valid elements to start with in order to build a collection of this type */\n minElements : 1,\n\n defaultAttributes : {\n//TODO: remove - use new collectionClass().save()\n /** takes elements and creates the proper collection - returns a promise */\n creationFn : function(){ throw new TypeError( 'no creation fn for creator' ); },\n /** fn to call when the collection is created (scoped to this) */\n oncreate : function(){},\n /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n oncancel : function(){},\n /** distance from list edge to begin autoscrolling list */\n autoscrollDist : 24,\n /** Color passed to hoverhighlight */\n highlightClr : 'rgba( 64, 255, 255, 1.0 )'\n },\n\n footerSettings : {\n '.hide-originals': 'hideOriginals'\n },\n\n /** set up initial options, instance vars, behaviors */\n initialize : function( attributes ){\n this.metric( 'ListCollectionCreator.initialize', attributes );\n var creator = this;\n _.each( this.defaultAttributes, function( value, key ){\n value = attributes[ key ] || value;\n creator[ key ] = value;\n });\n\n /** unordered, original list - cache to allow reversal */\n creator.initialElements = attributes.elements || [];\n\n this._setUpCommonSettings( attributes );\n this._instanceSetUp();\n this._elementsSetUp();\n this._setUpBehaviors();\n },\n\n /** set up instance vars */\n _instanceSetUp : function(){\n /** Ids of elements that have been selected by the user - to preserve over renders */\n this.selectedIds = {};\n /** DOM elements currently being dragged */\n this.$dragging = null;\n /** Used for blocking UI events during ajax/operations (don't post twice) */\n this.blocking = false;\n },\n\n // ------------------------------------------------------------------------ process raw list\n /** set up main data */\n _elementsSetUp : function(){\n //this.debug( '-- _dataSetUp' );\n /** a list of invalid elements and the reasons they aren't valid */\n this.invalidElements = [];\n//TODO: handle fundamental problem of syncing DOM, views, and list here\n /** data for list in progress */\n this.workingElements = [];\n /** views for workingElements */\n this.elementViews = [];\n\n // copy initial list, sort, add ids if needed\n this.workingElements = this.initialElements.slice( 0 );\n this._ensureElementIds();\n this._validateElements();\n this._mangleDuplicateNames();\n this._sortElements();\n },\n\n /** add ids to dataset objs in initial list if none */\n _ensureElementIds : function(){\n this.workingElements.forEach( function( element ){\n if( !element.hasOwnProperty( 'id' ) ){\n element.id = _.uniqueId();\n }\n });\n return this.workingElements;\n },\n\n /** separate working list into valid and invalid elements for this collection */\n _validateElements : function(){\n var creator = this,\n existingNames = {};\n creator.invalidElements = [];\n\n this.workingElements = this.workingElements.filter( function( element ){\n var problem = creator._isElementInvalid( element );\n if( problem ){\n creator.invalidElements.push({\n element : element,\n text : problem\n });\n }\n return !problem;\n });\n return this.workingElements;\n },\n\n /** describe what is wrong with a particular element if anything */\n _isElementInvalid : function( element ){\n if( element.history_content_type !== 'dataset' ){\n return _l( \"is not a dataset\" );\n }\n var validState = element.state === STATES.OK || _.contains( STATES.NOT_READY_STATES, element.state );\n if( ! validState ){\n return _l( \"has errored, is paused, or is not accessible\" );\n }\n if( element.deleted || element.purged ){\n return _l( \"has been deleted or purged\" );\n }\n return null;\n },\n\n /** mangle duplicate names using a mac-like '(counter)' addition to any duplicates */\n _mangleDuplicateNames : function(){\n var SAFETY = 900,\n counter = 1,\n existingNames = {};\n this.workingElements.forEach( function( element ){\n var currName = element.name;\n while( existingNames.hasOwnProperty( currName ) ){\n currName = element.name + ' (' + counter + ')';\n counter += 1;\n if( counter >= SAFETY ){\n throw new Error( 'Safety hit in while loop - thats impressive' );\n }\n }\n element.name = currName;\n existingNames[ element.name ] = true;\n });\n },\n\n /** sort a list of elements */\n _sortElements : function( list ){\n // // currently only natural sort by name\n // this.workingElements.sort( function( a, b ){ return naturalSort( a.name, b.name ); });\n // return this.workingElements;\n },\n\n // ------------------------------------------------------------------------ rendering\n // templates : ListCollectionCreator.templates,\n /** render the entire interface */\n render : function( speed, callback ){\n //this.debug( '-- _render' );\n if( this.workingElements.length < this.minElements ){\n return this._renderInvalid( speed, callback );\n }\n\n this.$el.empty().html( this.templates.main() );\n this._renderHeader( speed );\n this._renderMiddle( speed );\n this._renderFooter( speed );\n this._addPluginComponents();\n this.$( '.collection-name' ).focus();\n this.trigger( 'rendered', this );\n return this;\n },\n\n\n /** render a simplified interface aimed at telling the user why they can't move forward */\n _renderInvalid : function( speed, callback ){\n //this.debug( '-- _render' );\n this.$el.empty().html( this.templates.invalidInitial({\n problems: this.invalidElements,\n elements: this.workingElements,\n }));\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n this.trigger( 'rendered', this );\n return this;\n },\n\n /** render the header section */\n _renderHeader : function( speed, callback ){\n var $header = this.$( '.header' ).empty().html( this.templates.header() )\n .find( '.help-content' ).prepend( $( this.templates.helpContent() ) );\n //TODO: should only show once despite calling _renderHeader again\n if( this.invalidElements.length ){\n this._invalidElementsAlert();\n }\n return $header;\n },\n\n /** render the middle including the elements */\n _renderMiddle : function( speed, callback ){\n var $middle = this.$( '.middle' ).empty().html( this.templates.middle() );\n this._renderList( speed );\n return $middle;\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents : function(){\n this.$( '.help-content i' ).hoverhighlight( '.collection-creator', this.highlightClr );\n },\n\n /** build and show an alert describing any elements that could not be included due to problems */\n _invalidElementsAlert : function(){\n this._showAlert( this.templates.invalidElements({ problems: this.invalidElements }), 'alert-warning' );\n },\n\n _disableNameAndCreate : function( disable ){\n disable = !_.isUndefined( disable )? disable : true;\n if( disable ){\n this.$( '.collection-name' ).prop( 'disabled', true );\n this.$( '.create-collection' ).toggleClass( 'disabled', true );\n // } else {\n // this.$( '.collection-name' ).prop( 'disabled', false );\n // this.$( '.create-collection' ).removeClass( 'disable' );\n }\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** conv. to the main list display DOM */\n $list : function(){\n return this.$( '.collection-elements' );\n },\n\n /** show or hide the clear selected control based on the num of selected elements */\n _renderClearSelected : function(){\n if( _.size( this.selectedIds ) ){\n this.$( '.collection-elements-controls > .clear-selected' ).show();\n } else {\n this.$( '.collection-elements-controls > .clear-selected' ).hide();\n }\n },\n\n /** render the elements in order (or a warning if no elements found) */\n _renderList : function( speed, callback ){\n //this.debug( '-- _renderList' );\n var creator = this,\n $tmp = jQuery( '
              ' ),\n $list = creator.$list();\n\n _.each( this.elementViews, function( view ){\n view.destroy();\n creator.removeElementView( view );\n });\n\n // if( !this.workingElements.length ){\n // this._renderNoValidElements();\n // return;\n // }\n\n creator.workingElements.forEach( function( element ){\n var elementView = creator._createElementView( element );\n $tmp.append( elementView.$el );\n });\n\n creator._renderClearSelected();\n $list.empty().append( $tmp.children() );\n _.invoke( creator.elementViews, 'render' );\n\n if( $list.height() > $list.css( 'max-height' ) ){\n $list.css( 'border-width', '1px 0px 1px 0px' );\n } else {\n $list.css( 'border-width', '0px' );\n }\n },\n\n /** create an element view, cache in elementViews, set up listeners, and return */\n _createElementView : function( element ){\n var elementView = new this.elementViewClass({\n//TODO: use non-generic class or not all\n // model : COLLECTION.DatasetDCE( element )\n element : element,\n selected: _.has( this.selectedIds, element.id )\n });\n this.elementViews.push( elementView );\n this._listenToElementView( elementView );\n return elementView;\n },\n\n /** listen to any element events */\n _listenToElementView : function( view ){\n var creator = this;\n creator.listenTo( view, {\n select : function( data ){\n var element = data.source.element;\n if( data.selected ){\n creator.selectedIds[ element.id ] = true;\n } else {\n delete creator.selectedIds[ element.id ];\n }\n creator.trigger( 'elements:select', data );\n },\n discard : function( data ){\n creator.trigger( 'elements:discard', data );\n }\n });\n },\n\n /** add a new element view based on the json in element */\n addElementView : function( element ){\n//TODO: workingElements is sorted, add element in appropo index\n // add element, sort elements, find element index\n // var view = this._createElementView( element );\n // return view;\n },\n\n /** stop listening to view and remove from caches */\n removeElementView : function( view ){\n delete this.selectedIds[ view.element.id ];\n this._renderClearSelected();\n\n this.elementViews = _.without( this.elementViews, view );\n this.stopListening( view );\n },\n\n /** render a message in the list that no elements remain to create a collection */\n _renderNoElementsLeft : function(){\n this._disableNameAndCreate( true );\n this.$( '.collection-elements' ).append( this.templates.noElementsLeft() );\n },\n\n // /** render a message in the list that no valid elements were found to create a collection */\n // _renderNoValidElements : function(){\n // this._disableNameAndCreate( true );\n // this.$( '.collection-elements' ).append( this.templates.noValidElements() );\n // },\n\n // ------------------------------------------------------------------------ API\n /** convert element into JSON compatible with the collections API */\n _elementToJSON : function( element ){\n // return element.toJSON();\n return element;\n },\n\n /** create the collection via the API\n * @returns {jQuery.xhr Object} the jquery ajax request\n */\n createList : function( name ){\n if( !this.workingElements.length ){\n var message = _l( 'No valid elements for final list' ) + '. ';\n message += '' + _l( 'Cancel' ) + ' ';\n message += _l( 'or' );\n message += ' ' + _l( 'start over' ) + '.';\n this._showAlert( message );\n return;\n }\n\n var creator = this,\n elements = this.workingElements.map( function( element ){\n return creator._elementToJSON( element );\n });\n\n creator.blocking = true;\n return creator.creationFn( elements, name, creator.hideOriginals )\n .always( function(){\n creator.blocking = false;\n })\n .fail( function( xhr, status, message ){\n creator.trigger( 'error', {\n xhr : xhr,\n status : status,\n message : _l( 'An error occurred while creating this collection' )\n });\n })\n .done( function( response, message, xhr ){\n creator.trigger( 'collection:created', response, message, xhr );\n creator.metric( 'collection:created', response );\n if( typeof creator.oncreate === 'function' ){\n creator.oncreate.call( this, response, message, xhr );\n }\n });\n },\n\n // ------------------------------------------------------------------------ events\n /** set up event handlers on self */\n _setUpBehaviors : function(){\n this.on( 'error', this._errorHandler );\n\n this.once( 'rendered', function(){\n this.trigger( 'rendered:initial', this );\n });\n\n this.on( 'elements:select', function( data ){\n this._renderClearSelected();\n });\n\n this.on( 'elements:discard', function( data ){\n var element = data.source.element;\n this.removeElementView( data.source );\n\n this.workingElements = _.without( this.workingElements, element );\n if( !this.workingElements.length ){\n this._renderNoElementsLeft();\n }\n });\n\n //this.on( 'all', function(){\n // this.info( arguments );\n //});\n return this;\n },\n\n /** handle errors with feedback and details to the user (if available) */\n _errorHandler : function( data ){\n this.error( data );\n\n var creator = this,\n content = data.message || _l( 'An error occurred' );\n if( data.xhr ){\n var xhr = data.xhr,\n message = data.message;\n if( xhr.readyState === 0 && xhr.status === 0 ){\n content += ': ' + _l( 'Galaxy could not be reached and may be updating.' ) +\n _l( ' Try again in a few minutes.' );\n } else if( xhr.responseJSON ){\n content += ':
              ' + JSON.stringify( xhr.responseJSON ) + '
              ';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n events : {\n // header\n 'click .more-help' : '_clickMoreHelp',\n 'click .less-help' : '_clickLessHelp',\n 'click .main-help' : '_toggleHelp',\n 'click .header .alert button' : '_hideAlert',\n\n 'click .reset' : 'reset',\n 'click .clear-selected' : 'clearSelectedElements',\n\n // elements - selection\n 'click .collection-elements' : 'clearSelectedElements',\n\n // elements - drop target\n // 'dragenter .collection-elements': '_dragenterElements',\n // 'dragleave .collection-elements': '_dragleaveElements',\n 'dragover .collection-elements' : '_dragoverElements',\n 'drop .collection-elements' : '_dropElements',\n\n // these bubble up from the elements as custom events\n 'collection-element.dragstart .collection-elements' : '_elementDragstart',\n 'collection-element.dragend .collection-elements' : '_elementDragend',\n\n // footer\n 'change .collection-name' : '_changeName',\n 'keydown .collection-name' : '_nameCheckForEnter',\n 'change .hide-originals' : '_changeHideOriginals',\n 'click .cancel-create' : '_cancelCreate',\n 'click .create-collection' : '_clickCreate'//,\n },\n\n // ........................................................................ elements\n /** reset all data to the initial state */\n reset : function(){\n this._instanceSetUp();\n this._elementsSetUp();\n this.render();\n },\n\n /** deselect all elements */\n clearSelectedElements : function( ev ){\n this.$( '.collection-elements .collection-element' ).removeClass( 'selected' );\n this.$( '.collection-elements-controls > .clear-selected' ).hide();\n },\n\n //_dragenterElements : function( ev ){\n // //this.debug( '_dragenterElements:', ev );\n //},\n//TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n // _dragleaveElements : function( ev ){\n // //this.debug( '_dragleaveElements:', ev );\n // },\n\n /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n _dragoverElements : function( ev ){\n //this.debug( '_dragoverElements:', ev );\n ev.preventDefault();\n\n var $list = this.$list();\n this._checkForAutoscroll( $list, ev.originalEvent.clientY );\n var $nearest = this._getNearestElement( ev.originalEvent.clientY );\n\n //TODO: no need to re-create - move instead\n this.$( '.element-drop-placeholder' ).remove();\n var $placeholder = $( '
              ' );\n if( !$nearest.length ){\n $list.append( $placeholder );\n } else {\n $nearest.before( $placeholder );\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll : function( $element, y ){\n var AUTOSCROLL_SPEED = 2,\n offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = ( offset.top + $element.outerHeight() ) - y;\n if( upperDist >= 0 && upperDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop - AUTOSCROLL_SPEED );\n } else if( lowerDist >= 0 && lowerDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop + AUTOSCROLL_SPEED );\n }\n },\n\n /** get the nearest element based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestElement : function( y ){\n var WIGGLE = 4,\n lis = this.$( '.collection-elements li.collection-element' ).toArray();\n for( var i=0; i y && top - halfHeight < y ){\n return $li;\n }\n }\n return $();\n },\n\n /** drop (dragged/selected elements) onto the list, re-ordering the internal list */\n _dropElements : function( ev ){\n if( ev.originalEvent ){ ev = ev.originalEvent; }\n // both required for firefox\n ev.preventDefault();\n ev.dataTransfer.dropEffect = 'move';\n\n // insert before the nearest element or after the last.\n var $nearest = this._getNearestElement( ev.clientY );\n if( $nearest.length ){\n this.$dragging.insertBefore( $nearest );\n } else {\n // no nearest before - insert after last element\n this.$dragging.insertAfter( this.$( '.collection-elements .collection-element' ).last() );\n }\n // resync the creator's list based on the new DOM order\n this._syncOrderToDom();\n return false;\n },\n\n /** resync the creator's list of elements based on the DOM order */\n _syncOrderToDom : function(){\n var creator = this,\n newElements = [];\n //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n this.$( '.collection-elements .collection-element' ).each( function(){\n var id = $( this ).attr( 'data-element-id' ),\n element = _.findWhere( creator.workingElements, { id: id });\n if( element ){\n newElements.push( element );\n } else {\n console.error( 'missing element: ', id );\n }\n });\n this.workingElements = newElements;\n this._renderList();\n },\n\n /** drag communication with element sub-views: dragstart */\n _elementDragstart : function( ev, element ){\n // auto select the element causing the event and move all selected\n element.select( true );\n this.$dragging = this.$( '.collection-elements .collection-element.selected' );\n },\n\n /** drag communication with element sub-views: dragend - remove the placeholder */\n _elementDragend : function( ev, element ){\n $( '.element-drop-placeholder' ).remove();\n this.$dragging = null;\n },\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates : _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\n /** the header (not including help text) */\n header : _.template([\n '
              ',\n '', _l( 'More help' ), '',\n '
              ',\n '', _l( 'Less' ), '',\n '
              ',\n '
              ',\n '
              ',\n '',\n '',\n '
              ',\n ].join('')),\n\n /** the middle: element list */\n middle : _.template([\n '',\n '
              ',\n '
              '\n ].join('')),\n\n /** creation and cancel controls */\n footer : _.template([\n '
              ',\n '
              ',\n '',\n '
              ',\n '
              ',\n '',\n '
              ', _l( 'Name' ), ':
              ',\n '
              ',\n '
              ',\n\n '
              ',\n '
              ',\n '',\n '
              ',\n '',\n '',\n '
              ',\n '
              ',\n\n '
              ',\n '',\n '
              ',\n '
              '\n ].join('')),\n\n /** help content */\n helpContent : _.template([\n '

              ', _l([\n 'Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ',\n 'workflows in order to have analyses done on each member of the entire group. This interface allows ',\n 'you to create a collection and re-order the final collection.'\n ].join( '' )), '

              ',\n '
                ',\n '
              • ', _l([\n 'Rename elements in the list by clicking on ',\n 'the existing name.'\n ].join( '' )), '
              • ',\n '
              • ', _l([\n 'Discard elements from the final created list by clicking on the ',\n '\"Discard\" button.'\n ].join( '' )), '
              • ',\n '
              • ', _l([\n 'Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ',\n 'them and you can then move those selected by dragging the ',\n 'entire group. Deselect them by clicking them again or by clicking the ',\n 'the \"Clear selected\" link.'\n ].join( '' )), '
              • ',\n '
              • ', _l([\n 'Click the \"Start over\" link to begin again as if you had just opened ',\n 'the interface.'\n ].join( '' )), '
              • ',\n '
              • ', _l([\n 'Click the \"Cancel\" button to exit the interface.'\n ].join( '' )), '
              • ',\n '

              ',\n '

              ', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '

              '\n ].join('')),\n\n /** shown in list when all elements are discarded */\n invalidElements : _.template([\n _l( 'The following selections could not be included due to problems:' ),\n '
                <% _.each( problems, function( problem ){ %>',\n '
              • <%- problem.element.name %>: <%- problem.text %>
              • ',\n '<% }); %>
              '\n ].join('')),\n\n /** shown in list when all elements are discarded */\n noElementsLeft : _.template([\n '
            2. ',\n _l( 'No elements left! ' ),\n _l( 'Would you like to ' ), '', _l( 'start over' ), '?',\n '
            3. '\n ].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial : _.template([\n '
              ',\n '
              ',\n '',\n '<% if( _.size( problems ) ){ %>',\n _l( 'The following selections could not be included due to problems' ), ':',\n '
                <% _.each( problems, function( problem ){ %>',\n '
              • <%- problem.element.name %>: <%- problem.text %>
              • ',\n '<% }); %>
              ',\n '<% } else if( _.size( elements ) < 1 ){ %>',\n _l( 'No datasets were selected' ), '.',\n '<% } %>',\n '
              ',\n _l( 'At least one element is needed for the collection' ), '. ',\n _l( 'You may need to ' ),\n '', _l( 'cancel' ), ' ',\n _l( 'and reselect new elements' ), '.',\n '
              ',\n '
              ',\n '
              ',\n '
              ',\n '
              ',\n '
              ',\n '',\n // _l( 'Create a different kind of collection' ),\n '
              ',\n '
              ',\n '
              '\n ].join('')),\n }),\n\n // ------------------------------------------------------------------------ misc\n /** string rep */\n toString : function(){ return 'ListCollectionCreator'; }\n});\n\n\n\n//=============================================================================\n/** Create a modal and load its body with the given CreatorClass creator type\n * @returns {Deferred} resolved when creator has built a collection.\n */\nvar collectionCreatorModal = function _collectionCreatorModal( elements, options, CreatorClass ){\n\n var deferred = jQuery.Deferred(),\n modal = Galaxy.modal || ( new UI_MODAL.View() ),\n creator;\n\n options = _.defaults( options || {}, {\n elements : elements,\n oncancel : function(){\n modal.hide();\n deferred.reject( 'cancelled' );\n },\n oncreate : function( creator, response ){\n modal.hide();\n deferred.resolve( response );\n }\n });\n\n creator = new CreatorClass( options );\n modal.show({\n title : options.title || _l( 'Create a collection' ),\n body : creator.$el,\n width : '80%',\n height : '100%',\n closing_events: true\n });\n creator.render();\n window._collectionCreator = creator;\n\n //TODO: remove modal header\n return deferred;\n};\n\n/** List collection flavor of collectionCreatorModal. */\nvar listCollectionCreatorModal = function _listCollectionCreatorModal( elements, options ){\n options = options || {};\n options.title = _l( 'Create a collection from a list of datasets' );\n return collectionCreatorModal( elements, options, ListCollectionCreator );\n};\n\n\n//==============================================================================\n/** Use a modal to create a list collection, then add it to the given history contents.\n * @returns {Deferred} resolved when the collection is added to the history.\n */\nfunction createListCollection( contents, defaultHideSourceItems ){\n var elements = contents.toJSON(),\n promise = listCollectionCreatorModal( elements, {\n defaultHideSourceItems: defaultHideSourceItems,\n creationFn : function( elements, name, hideSourceItems ){\n elements = elements.map( function( element ){\n return {\n id : element.id,\n name : element.name,\n //TODO: this allows for list:list even if the filter above does not - reconcile\n src : ( element.history_content_type === 'dataset'? 'hda' : 'hdca' )\n };\n });\n return contents.createHDCA( elements, 'list', name, hideSourceItems );\n }\n });\n return promise;\n}\n\n//==============================================================================\n return {\n DatasetCollectionElementView: DatasetCollectionElementView,\n ListCollectionCreator : ListCollectionCreator,\n\n collectionCreatorModal : collectionCreatorModal,\n listCollectionCreatorModal : listCollectionCreatorModal,\n createListCollection : createListCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/list-collection-creator.js","define([\n \"mvc/list/list-item\",\n \"mvc/dataset/states\",\n \"ui/fa-icon-button\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_ITEM, STATES, faIconButton, BASE_MVC, _l ){\n'use strict';\n\nvar logNamespace = 'dataset';\n/*==============================================================================\nTODO:\n straighten out state rendering and templates used\n inaccessible/STATES.NOT_VIEWABLE is a special case\n simplify button rendering\n\n==============================================================================*/\nvar _super = LIST_ITEM.ListItemView;\n/** @class Read only list view for either LDDAs, HDAs, or HDADCEs.\n * Roughly, any DatasetInstance (and not a raw Dataset).\n */\nvar DatasetListItemView = _super.extend(\n/** @lends DatasetListItemView.prototype */{\n _logNamespace : logNamespace,\n\n className : _super.prototype.className + \" dataset\",\n //TODO:?? doesn't exactly match an hda's type_id\n id : function(){\n return [ 'dataset', this.model.get( 'id' ) ].join( '-' );\n },\n\n /** Set up: instance vars, options, and event handlers */\n initialize : function( attributes ){\n if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }\n this.log( this + '.initialize:', attributes );\n _super.prototype.initialize.call( this, attributes );\n\n /** where should pages from links be displayed? (default to new tab/window) */\n this.linkTarget = attributes.linkTarget || '_blank';\n },\n\n /** event listeners */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n var self = this;\n\n // re-rendering on any model changes\n return self.listenTo( self.model, {\n 'change': function( model ){\n // if the model moved into the ready state and is expanded without details, fetch those details now\n if( self.model.changedAttributes().state &&\n self.model.inReadyState() &&\n self.expanded &&\n !self.model.hasDetails() ){\n // normally, will render automatically (due to fetch -> change),\n // but! setting_metadata sometimes doesn't cause any other changes besides state\n // so, not rendering causes it to seem frozen in setting_metadata state\n self.model.fetch({ silent : true })\n .done( function(){ self.render(); });\n } else {\n if( _.has( model.changed, 'tags' ) && _.keys( model.changed ).length === 1 ){\n // If only the tags have changed, rerender specifically\n // the titlebar region. Otherwise default to the full\n // render.\n self.$( '.nametags' ).html( self._renderNametags() );\n } else {\n self.render();\n }\n }\n }\n });\n },\n\n // ......................................................................... expandable\n /** In this override, only get details if in the ready state, get rerunnable if in other states.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n }\n return jQuery.when();\n },\n\n // ......................................................................... removal\n /** Remove this view's html from the DOM and remove all event listeners.\n * @param {Number or String} speed jq effect speed\n * @param {Function} callback an optional function called when removal is done (scoped to this view)\n */\n remove : function( speed, callback ){\n var view = this;\n speed = speed || this.fxSpeed;\n this.$el.fadeOut( speed, function(){\n Backbone.View.prototype.remove.call( view );\n if( callback ){ callback.call( view ); }\n });\n },\n\n // ......................................................................... rendering\n /* TODO:\n dataset states are the issue primarily making dataset rendering complex\n each state should have it's own way of displaying/set of details\n often with different actions that can be applied\n throw in deleted/purged/visible and things get complicated easily\n I've considered (a couple of times) - creating a view for each state\n - but recreating the view during an update...seems wrong\n */\n /** In this override, add the dataset state as a class for use with state-based CSS */\n _swapNewRender : function( $newRender ){\n _super.prototype._swapNewRender.call( this, $newRender );\n if( this.model.has( 'state' ) ){\n this.$el.addClass( 'state-' + this.model.get( 'state' ) );\n }\n return this.$el;\n },\n\n // ................................................................................ titlebar\n /** In this override, add the dataset display button. */\n _renderPrimaryActions : function(){\n // render just the display for read-only\n return [ this._renderDisplayButton() ];\n },\n\n /** Render icon-button to display dataset data */\n _renderDisplayButton : function(){\n // don't show display if not viewable or not accessible\n var state = this.model.get( 'state' );\n if( ( state === STATES.NOT_VIEWABLE ) ||\n ( state === STATES.DISCARDED ) ||\n ( !this.model.get( 'accessible' ) ) ){\n return null;\n }\n\n var displayBtnData = {\n target : this.linkTarget,\n classes : 'display-btn'\n };\n\n // show a disabled display if the data's been purged\n if( this.model.get( 'purged' ) ){\n displayBtnData.disabled = true;\n displayBtnData.title = _l( 'Cannot display datasets removed from disk' );\n\n // disable if still uploading\n } else if( state === STATES.UPLOAD ){\n displayBtnData.disabled = true;\n displayBtnData.title = _l( 'This dataset must finish uploading before it can be viewed' );\n\n // disable if still new\n } else if( state === STATES.NEW ){\n displayBtnData.disabled = true;\n displayBtnData.title = _l( 'This dataset is not yet viewable' );\n\n } else {\n displayBtnData.title = _l( 'View data' );\n\n // default link for dataset\n displayBtnData.href = this.model.urls.display;\n\n // add frame manager option onclick event\n var self = this;\n displayBtnData.onclick = function( ev ){\n if (Galaxy.frame && Galaxy.frame.active) {\n // Add dataset to frames.\n Galaxy.frame.addDataset(self.model.get('id'));\n ev.preventDefault();\n }\n };\n }\n displayBtnData.faIcon = 'fa-eye';\n return faIconButton( displayBtnData );\n },\n\n // ......................................................................... rendering details\n /** Render the enclosing div of the hda body and, if expanded, the html in the body\n * @returns {jQuery} rendered DOM\n */\n _renderDetails : function(){\n //TODO: generalize to be allow different details for each state\n\n // no access - render nothing but a message\n if( this.model.get( 'state' ) === STATES.NOT_VIEWABLE ){\n return $( this.templates.noAccess( this.model.toJSON(), this ) );\n }\n\n var $details = _super.prototype._renderDetails.call( this );\n $details.find( '.actions .left' ).empty().append( this._renderSecondaryActions() );\n $details.find( '.summary' ).html( this._renderSummary() )\n .prepend( this._renderDetailMessages() );\n $details.find( '.display-applications' ).html( this._renderDisplayApplications() );\n\n this._setUpBehaviors( $details );\n return $details;\n },\n\n /** Defer to the appropo summary rendering fn based on state */\n _renderSummary : function(){\n var json = this.model.toJSON(),\n summaryRenderFn = this.templates.summaries[ json.state ];\n summaryRenderFn = summaryRenderFn || this.templates.summaries.unknown;\n return summaryRenderFn( json, this );\n },\n\n /** Render messages to be displayed only when the details are shown */\n _renderDetailMessages : function(){\n var view = this,\n $warnings = $( '
              ' ),\n json = view.model.toJSON();\n //TODO:! unordered (map)\n _.each( view.templates.detailMessages, function( templateFn ){\n $warnings.append( $( templateFn( json, view ) ) );\n });\n return $warnings;\n },\n\n /** Render the external display application links */\n _renderDisplayApplications : function(){\n if( this.model.isDeletedOrPurged() ){ return ''; }\n // render both old and new display apps using the same template\n return [\n this.templates.displayApplications( this.model.get( 'display_apps' ), this ),\n this.templates.displayApplications( this.model.get( 'display_types' ), this )\n ].join( '' );\n },\n\n // ......................................................................... secondary/details actions\n /** A series of links/buttons for less commonly used actions: re-run, info, etc. */\n _renderSecondaryActions : function(){\n this.debug( '_renderSecondaryActions' );\n switch( this.model.get( 'state' ) ){\n case STATES.NOT_VIEWABLE:\n return [];\n case STATES.OK:\n case STATES.FAILED_METADATA:\n case STATES.ERROR:\n return [ this._renderDownloadButton(), this._renderShowParamsButton() ];\n }\n return [ this._renderShowParamsButton() ];\n },\n\n /** Render icon-button to show the input and output (stdout/err) for the job that created this.\n * @returns {jQuery} rendered DOM\n */\n _renderShowParamsButton : function(){\n // gen. safe to show in all cases\n return faIconButton({\n title : _l( 'View details' ),\n classes : 'params-btn',\n href : this.model.urls.show_params,\n target : this.linkTarget,\n faIcon : 'fa-info-circle',\n onclick : function( ev ) {\n if ( Galaxy.frame && Galaxy.frame.active ) {\n Galaxy.frame.add( { title: 'Dataset details', url: this.href } );\n ev.preventDefault();\n ev.stopPropagation();\n }\n }\n });\n },\n\n\n /** Render icon-button/popupmenu to download the data (and/or the associated meta files (bai, etc.)) for this.\n * @returns {jQuery} rendered DOM\n */\n _renderDownloadButton : function(){\n // don't show anything if the data's been purged\n if( this.model.get( 'purged' ) || !this.model.hasData() ){ return null; }\n\n // return either: a popupmenu with links to download assoc. meta files (if there are meta files)\n // or a single download icon-button (if there are no meta files)\n if( !_.isEmpty( this.model.get( 'meta_files' ) ) ){\n return this._renderMetaFileDownloadButton();\n }\n\n return $([\n '',\n '',\n ''\n ].join( '' ));\n },\n\n /** Render the download button which opens a dropdown with links to download assoc. meta files (indeces, etc.) */\n _renderMetaFileDownloadButton : function(){\n var urls = this.model.urls;\n return $([\n '
              ',\n '',\n '',\n '',\n '',\n '
              '\n ].join( '\\n' ));\n },\n\n _renderNametags : function(){\n var tpl = _.template([\n '<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>',\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n '<% } %>',\n '<% }); %>'].join(''));\n return tpl({tags: this.model.get('tags')});\n },\n\n // ......................................................................... misc\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .display-btn' : function( ev ){ this.trigger( 'display', this, ev ); },\n 'click .params-btn' : function( ev ){ this.trigger( 'params', this, ev ); },\n 'click .download-btn' : function( ev ){ this.trigger( 'download', this, ev ); }\n }),\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DatasetListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetListItemView.prototype.templates = (function(){\n//TODO: move to require text! plugin\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n failed_metadata : BASE_MVC.wrapTemplate([\n // failed metadata is rendered as a warning on an otherwise ok dataset view\n '<% if( model.state === \"failed_metadata\" ){ %>',\n '
              ',\n _l( 'An error occurred setting the metadata for this dataset' ),\n '
              ',\n '<% } %>'\n ]),\n error : BASE_MVC.wrapTemplate([\n // error during index fetch - show error on dataset\n '<% if( model.error ){ %>',\n '
              ',\n _l( 'There was an error getting the data for this dataset' ), ': <%- model.error %>',\n '
              ',\n '<% } %>'\n ]),\n purged : BASE_MVC.wrapTemplate([\n '<% if( model.purged ){ %>',\n '
              ',\n _l( 'This dataset has been deleted and removed from disk' ),\n '
              ',\n '<% } %>'\n ]),\n deleted : BASE_MVC.wrapTemplate([\n // deleted not purged\n '<% if( model.deleted && !model.purged ){ %>',\n '
              ',\n _l( 'This dataset has been deleted' ),\n '
              ',\n '<% } %>'\n ])\n\n //NOTE: hidden warning is only needed for HDAs\n });\n\n var detailsTemplate = BASE_MVC.wrapTemplate([\n '
              ',\n '
              ',\n\n '
              ',\n '
              ',\n '
              ',\n '
              ',\n\n // do not display tags, annotation, display apps, or peek when deleted\n '<% if( !dataset.deleted && !dataset.purged ){ %>',\n '
              ',\n '
              ',\n\n '
              ',\n\n '<% if( dataset.peek ){ %>',\n '
              <%= dataset.peek %>
              ',\n '<% } %>',\n '<% } %>',\n '
              '\n ], 'dataset' );\n\n var noAccessTemplate = BASE_MVC.wrapTemplate([\n '
              ',\n '
              ',\n _l( 'You do not have permission to view this dataset' ),\n '
              ',\n '
              '\n ], 'dataset' );\n\n//TODO: still toooooooooooooo complex - rework\n var summaryTemplates = {};\n summaryTemplates[ STATES.OK ] = summaryTemplates[ STATES.FAILED_METADATA ] = BASE_MVC.wrapTemplate([\n '<% if( dataset.misc_blurb ){ %>',\n '
              ',\n '<%- dataset.misc_blurb %>',\n '
              ',\n '<% } %>',\n\n '<% if( dataset.file_ext ){ %>',\n '
              ',\n '',\n '<%- dataset.file_ext %>',\n '
              ',\n '<% } %>',\n\n '<% if( dataset.metadata_dbkey ){ %>',\n '
              ',\n '',\n '',\n '<%- dataset.metadata_dbkey %>',\n '',\n '
              ',\n '<% } %>',\n\n '<% if( dataset.misc_info ){ %>',\n '
              ',\n '<%- dataset.misc_info %>',\n '
              ',\n '<% } %>'\n ], 'dataset' );\n summaryTemplates[ STATES.NEW ] = BASE_MVC.wrapTemplate([\n '
              ', _l( 'This is a new dataset and not all of its data are available yet' ), '
              '\n ], 'dataset' );\n summaryTemplates[ STATES.NOT_VIEWABLE ] = BASE_MVC.wrapTemplate([\n '
              ', _l( 'You do not have permission to view this dataset' ), '
              '\n ], 'dataset' );\n summaryTemplates[ STATES.DISCARDED ] = BASE_MVC.wrapTemplate([\n '
              ', _l( 'The job creating this dataset was cancelled before completion' ), '
              '\n ], 'dataset' );\n summaryTemplates[ STATES.QUEUED ] = BASE_MVC.wrapTemplate([\n '
              ', _l( 'This job is waiting to run' ), '
              '\n ], 'dataset' );\n summaryTemplates[ STATES.RUNNING ] = BASE_MVC.wrapTemplate([\n '
              ', _l( 'This job is currently running' ), '
              '\n ], 'dataset' );\n summaryTemplates[ STATES.UPLOAD ] = BASE_MVC.wrapTemplate([\n '
              ', _l( 'This dataset is currently uploading' ), '
              '\n ], 'dataset' );\n summaryTemplates[ STATES.SETTING_METADATA ] = BASE_MVC.wrapTemplate([\n '
              ', _l( 'Metadata is being auto-detected' ), '
              '\n ], 'dataset' );\n summaryTemplates[ STATES.PAUSED ] = BASE_MVC.wrapTemplate([\n '
              ', _l( 'This job is paused. Use the \"Resume Paused Jobs\" in the history menu to resume' ), '
              '\n ], 'dataset' );\n summaryTemplates[ STATES.ERROR ] = BASE_MVC.wrapTemplate([\n '<% if( !dataset.purged ){ %>',\n '
              <%- dataset.misc_blurb %>
              ',\n '<% } %>',\n '', _l( 'An error occurred with this dataset' ), ':',\n '
              <%- dataset.misc_info %>
              '\n ], 'dataset' );\n summaryTemplates[ STATES.EMPTY ] = BASE_MVC.wrapTemplate([\n '
              ', _l( 'No data' ), ': <%- dataset.misc_blurb %>
              '\n ], 'dataset' );\n summaryTemplates.unknown = BASE_MVC.wrapTemplate([\n '
              Error: unknown dataset state: \"<%- dataset.state %>\"
              '\n ], 'dataset' );\n\n // messages to be displayed only within the details section ('below the fold')\n var detailMessageTemplates = {\n resubmitted : BASE_MVC.wrapTemplate([\n // deleted not purged\n '<% if( model.resubmitted ){ %>',\n '
              ',\n _l( 'The job creating this dataset has been resubmitted' ),\n '
              ',\n '<% } %>'\n ])\n };\n\n // this is applied to both old and new style display apps\n var displayApplicationsTemplate = BASE_MVC.wrapTemplate([\n '<% _.each( apps, function( app ){ %>',\n '
              ',\n '<%- app.label %> ',\n '',\n '<% _.each( app.links, function( link ){ %>',\n '\" href=\"<%- link.href %>\">',\n '<% print( _l( link.text ) ); %>',\n ' ',\n '<% }); %>',\n '',\n '
              ',\n '<% }); %>'\n ], 'apps' );\n\n return _.extend( {}, _super.prototype.templates, {\n warnings : warnings,\n details : detailsTemplate,\n noAccess : noAccessTemplate,\n summaries : summaryTemplates,\n detailMessages : detailMessageTemplates,\n displayApplications : displayApplicationsTemplate\n });\n}());\n\n\n// ============================================================================\n return {\n DatasetListItemView : DatasetListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-li.js","/** Generic form view */\ndefine( [ 'mvc/form/form-view', 'mvc/ui/ui-misc' ], function( Form, Ui ) {\n\n var View = Backbone.View.extend({\n\n initialize: function( options ) {\n this.model = new Backbone.Model( options );\n this.url = this.model.get( 'url' );\n this.redirect = this.model.get( 'redirect' );\n this.setElement( '
              ' );\n this.render();\n },\n\n render: function() {\n var self = this;\n $.ajax({\n url : Galaxy.root + this.url,\n type : 'GET'\n }).done( function( response ) {\n var options = $.extend( {}, self.model.attributes, response );\n var form = new Form({\n title : options.title,\n message: options.message,\n status : options.status || 'warning',\n icon : options.icon,\n inputs : options.inputs,\n buttons: {\n 'submit': new Ui.Button({\n tooltip : options.submit_tooltip,\n title : options.submit_title || 'Save',\n icon : options.submit_icon || 'fa-save',\n cls : 'btn btn-primary ui-clear-float',\n onclick : function() { self._submit( form ) }\n })\n }\n });\n self.$el.empty().append( form.$el );\n }).fail( function( response ) {\n self.$el.empty().append( new Ui.Message({\n message : 'Failed to load resource ' + self.url + '.',\n status : 'danger',\n persistent : true\n }).$el );\n });\n },\n\n _submit: function( form ) {\n var self = this;\n $.ajax( {\n url : Galaxy.root + self.url,\n data : JSON.stringify( form.data.create() ),\n type : 'PUT',\n contentType : 'application/json'\n }).done( function( response ) {\n var success_message = { message: response.message, status: 'success', persistent: false };\n if ( self.redirect ) {\n window.location = Galaxy.root + self.redirect + '?' + $.param( success_message );\n } else {\n form.data.matchModel( response, function ( input, input_id ) {\n form.field_list[ input_id ].value( input.value );\n });\n self._showMessage( form, success_message );\n }\n }).fail( function( response ) {\n self._showMessage( form, { message: response.responseJSON.err_msg, status: 'danger', persistent: false } );\n });\n },\n\n _showMessage: function( form, options ) {\n var $panel = form.$el.parents().filter(function() {\n return [ 'auto', 'scroll' ].indexOf( $( this ).css( 'overflow' ) ) != -1;\n }).first();\n $panel.animate( { scrollTop : 0 }, 500 );\n form.message.update( options );\n }\n });\n\n return {\n View : View\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/form/form-wrapper.js","define([\n \"mvc/collection/collection-model\",\n \"mvc/history/history-content-model\",\n \"utils/localization\"\n], function( DC_MODEL, HISTORY_CONTENT, _l ){\n\n'use strict';\n\n/*==============================================================================\n\nModels for DatasetCollections contained within a history.\n\nTODO:\n these might be compactable to one class if some duplication with\n collection-model is used.\n\n==============================================================================*/\nvar hcontentMixin = HISTORY_CONTENT.HistoryContentMixin,\n ListDC = DC_MODEL.ListDatasetCollection,\n PairDC = DC_MODEL.PairDatasetCollection,\n ListPairedDC = DC_MODEL.ListPairedDatasetCollection,\n ListOfListsDC = DC_MODEL.ListOfListsDatasetCollection;\n\n//==============================================================================\n/** Override to post to contents route w/o id. */\nfunction buildHDCASave( _super ){\n return function _save( attributes, options ){\n if( this.isNew() ){\n options = options || {};\n options.url = this.urlRoot + this.get( 'history_id' ) + '/contents';\n attributes = attributes || {};\n attributes.type = 'dataset_collection';\n }\n return _super.call( this, attributes, options );\n };\n}\n\n\n//==============================================================================\n/** @class Backbone model for List Dataset Collection within a History.\n */\nvar HistoryListDatasetCollection = ListDC.extend( hcontentMixin ).extend(\n/** @lends HistoryListDatasetCollection.prototype */{\n\n defaults : _.extend( _.clone( ListDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'list',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( ListDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return 'History' + ListDC.prototype.toString.call( this );\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for Pair Dataset Collection within a History.\n * @constructs\n */\nvar HistoryPairDatasetCollection = PairDC.extend( hcontentMixin ).extend(\n/** @lends HistoryPairDatasetCollection.prototype */{\n\n defaults : _.extend( _.clone( PairDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'paired',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( PairDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return 'History' + PairDC.prototype.toString.call( this );\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for List of Pairs Dataset Collection within a History. */\nvar HistoryListPairedDatasetCollection = ListPairedDC.extend( hcontentMixin ).extend({\n\n defaults : _.extend( _.clone( ListPairedDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'list:paired',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( ListPairedDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return 'History' + ListPairedDC.prototype.toString.call( this );\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for List of Lists Dataset Collection within a History. */\nvar HistoryListOfListsDatasetCollection = ListOfListsDC.extend( hcontentMixin ).extend({\n\n defaults : _.extend( _.clone( ListOfListsDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'list:list',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( ListOfListsDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return ([ 'HistoryListOfListsDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n HistoryListDatasetCollection : HistoryListDatasetCollection,\n HistoryPairDatasetCollection : HistoryPairDatasetCollection,\n HistoryListPairedDatasetCollection : HistoryListPairedDatasetCollection,\n HistoryListOfListsDatasetCollection : HistoryListOfListsDatasetCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hdca-model.js","define([\n \"mvc/base/controlled-fetch-collection\",\n \"mvc/history/hda-model\",\n \"mvc/history/hdca-model\",\n \"mvc/history/history-preferences\",\n \"mvc/base-mvc\",\n \"utils/ajax-queue\"\n], function( CONTROLLED_FETCH_COLLECTION, HDA_MODEL, HDCA_MODEL, HISTORY_PREFS, BASE_MVC, AJAX_QUEUE ){\n'use strict';\n\n//==============================================================================\nvar _super = CONTROLLED_FETCH_COLLECTION.PaginatedCollection;\n/** @class Backbone collection for history content.\n * NOTE: history content seems like a dataset collection, but differs in that it is mixed:\n * each element can be either an HDA (dataset) or a DatasetCollection and co-exist on\n * the same level.\n * Dataset collections on the other hand are not mixed and (so far) can only contain either\n * HDAs or child dataset collections on one level.\n * This is why this does not inherit from any of the DatasetCollections (currently).\n */\nvar HistoryContents = _super.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : 'history',\n\n // ........................................................................ composite collection\n /** since history content is a mix, override model fn into a factory, creating based on history_content_type */\n model : function( attrs, options ) {\n if( attrs.history_content_type === \"dataset\" ) {\n return new HDA_MODEL.HistoryDatasetAssociation( attrs, options );\n\n } else if( attrs.history_content_type === \"dataset_collection\" ) {\n switch( attrs.collection_type ){\n case 'list':\n return new HDCA_MODEL.HistoryListDatasetCollection( attrs, options );\n case 'paired':\n return new HDCA_MODEL.HistoryPairDatasetCollection( attrs, options );\n case 'list:paired':\n return new HDCA_MODEL.HistoryListPairedDatasetCollection( attrs, options );\n case 'list:list':\n return new HDCA_MODEL.HistoryListOfListsDatasetCollection( attrs, options );\n }\n // This is a hack inside a hack:\n // Raise a plain object with validationError to fake a model.validationError\n // (since we don't have a model to use validate with)\n // (the outer hack being the mixed content/model function in this collection)\n var msg = 'Unknown collection_type: ' + attrs.collection_type;\n console.warn( msg, attrs );\n return { validationError : msg };\n }\n return { validationError : 'Unknown history_content_type: ' + attrs.history_content_type };\n },\n\n // ........................................................................ set up\n limitPerPage : 500,\n\n /** @type {Integer} how many contents per call to fetch when using progressivelyFetchDetails */\n limitPerProgressiveFetch : 500,\n\n /** @type {String} order used here and when fetching from server */\n order : 'hid',\n\n /** root api url */\n urlRoot : Galaxy.root + 'api/histories',\n\n /** complete api url */\n url : function(){\n return this.urlRoot + '/' + this.historyId + '/contents';\n },\n\n /** Set up */\n initialize : function( models, options ){\n options = options || {};\n _super.prototype.initialize.call( this, models, options );\n\n this.history = options.history || null;\n this.setHistoryId( options.historyId || null );\n /** @type {Boolean} does this collection contain and fetch deleted elements */\n this.includeDeleted = options.includeDeleted || this.includeDeleted;\n /** @type {Boolean} does this collection contain and fetch non-visible elements */\n this.includeHidden = options.includeHidden || this.includeHidden;\n\n // backbonejs uses collection.model.prototype.idAttribute to determine if a model is *already* in a collection\n // and either merged or replaced. In this case, our 'model' is a function so we need to add idAttribute\n // manually here - if we don't, contents will not merge but be replaced/swapped.\n this.model.prototype.idAttribute = 'type_id';\n },\n\n setHistoryId : function( newId ){\n this.historyId = newId;\n this._setUpWebStorage();\n },\n\n /** Set up client side storage. Currently PersistanStorage keyed under 'history:' */\n _setUpWebStorage : function( initialSettings ){\n // TODO: use initialSettings\n if( !this.historyId ){ return; }\n this.storage = new HISTORY_PREFS.HistoryPrefs({\n id: HISTORY_PREFS.HistoryPrefs.historyStorageKey( this.historyId )\n });\n this.trigger( 'new-storage', this.storage, this );\n\n this.on({\n 'include-deleted' : function( newVal ){\n this.storage.includeDeleted( newVal );\n },\n 'include-hidden' : function( newVal ){\n this.storage.includeHidden( newVal );\n }\n });\n\n this.includeDeleted = this.storage.includeDeleted() || false;\n this.includeHidden = this.storage.includeHidden() || false;\n return this;\n },\n\n // ........................................................................ common queries\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators : _.extend( _.clone( _super.prototype.comparators ), {\n 'name' : BASE_MVC.buildComparator( 'name', { ascending: true }),\n 'name-dsc' : BASE_MVC.buildComparator( 'name', { ascending: false }),\n 'hid' : BASE_MVC.buildComparator( 'hid', { ascending: false }),\n 'hid-asc' : BASE_MVC.buildComparator( 'hid', { ascending: true }),\n }),\n\n /** Get every model in this collection not in a 'ready' state (running). */\n running : function(){\n return this.filter( function( c ){ return !c.inReadyState(); });\n },\n\n /** return contents that are not ready and not deleted/hidden */\n runningAndActive : function(){\n return this.filter( function( c ){\n return ( !c.inReadyState() )\n && ( c.get( 'visible' ) )\n // TODO: deletedOrPurged?\n && ( !c.get( 'deleted' ) );\n });\n },\n\n /** Get the model with the given hid\n * @param {Int} hid the hid to search for\n * @returns {HistoryDatasetAssociation} the model with the given hid or undefined if not found\n */\n getByHid : function( hid ){\n // note: there *can* be more than one content with a given hid, this finds the first based on order\n return this.findWhere({ hid: hid });\n },\n\n /** return true if all contents have details */\n haveDetails : function(){\n return this.all( function( c ){ return c.hasDetails(); });\n },\n\n // ........................................................................ hidden / deleted\n /** return a new contents collection of only hidden items */\n hidden : function(){\n return this.filter( function( c ){ return c.hidden(); });\n },\n\n /** return a new contents collection of only hidden items */\n deleted : function(){\n return this.filter( function( c ){ return c.get( 'deleted' ); });\n },\n\n /** return a new contents collection of only hidden items */\n visibleAndUndeleted : function(){\n return this.filter( function( c ){\n return ( c.get( 'visible' ) )\n // TODO: deletedOrPurged?\n && ( !c.get( 'deleted' ) );\n });\n },\n\n /** create a setter in order to publish the change */\n setIncludeDeleted : function( setting, options ){\n if( _.isBoolean( setting ) && setting !== this.includeDeleted ){\n this.includeDeleted = setting;\n if( _.result( options, 'silent' ) ){ return; }\n this.trigger( 'include-deleted', setting, this );\n }\n },\n\n /** create a setter in order to publish the change */\n setIncludeHidden : function( setting, options ){\n if( _.isBoolean( setting ) && setting !== this.includeHidden ){\n this.includeHidden = setting;\n options = options || {};\n if( _.result( options, 'silent' ) ){ return; }\n this.trigger( 'include-hidden', setting, this );\n }\n },\n\n // ........................................................................ ajax\n // ............ controlled fetch collection\n /** override to get expanded ids from sessionStorage and pass to API as details */\n fetch : function( options ){\n options = options || {};\n if( this.historyId && !options.details ){\n var prefs = HISTORY_PREFS.HistoryPrefs.get( this.historyId ).toJSON();\n if( !_.isEmpty( prefs.expandedIds ) ){\n options.details = _.values( prefs.expandedIds ).join( ',' );\n }\n }\n return _super.prototype.fetch.call( this, options );\n },\n\n // ............. ControlledFetch stuff\n /** override to include the API versioning flag */\n _buildFetchData : function( options ){\n return _.extend( _super.prototype._buildFetchData.call( this, options ), {\n v : 'dev'\n });\n },\n\n /** Extend to include details and version */\n _fetchParams : _super.prototype._fetchParams.concat([\n // TODO: remove (the need for) both\n /** version */\n 'v',\n /** dataset ids to get full details of */\n 'details',\n ]),\n\n /** override to add deleted/hidden filters */\n _buildFetchFilters : function( options ){\n var superFilters = _super.prototype._buildFetchFilters.call( this, options ) || {};\n var filters = {};\n if( !this.includeDeleted ){\n filters.deleted = false;\n filters.purged = false;\n }\n if( !this.includeHidden ){\n filters.visible = true;\n }\n return _.defaults( superFilters, filters );\n },\n\n // ............ paginated collection\n getTotalItemCount : function(){\n return this.history.contentsShown();\n },\n\n // ............ history contents specific ajax\n /** override to filter requested contents to those updated after the Date 'since' */\n fetchUpdated : function( since, options ){\n if( since ){\n options = options || { filters: {} };\n options.remove = false;\n options.filters = {\n 'update_time-ge' : since.toISOString(),\n // workflows will produce hidden datasets (non-output datasets) that still\n // need to be updated in the collection or they'll update forever\n // we can remove the default visible filter by using an 'empty' value\n visible : ''\n };\n }\n return this.fetch( options );\n },\n\n /** fetch all the deleted==true contents of this collection */\n fetchDeleted : function( options ){\n options = options || {};\n var self = this;\n options.filters = _.extend( options.filters, {\n // all deleted, purged or not\n deleted : true,\n purged : undefined\n });\n options.remove = false;\n\n self.trigger( 'fetching-deleted', self );\n return self.fetch( options )\n .always( function(){ self.trigger( 'fetching-deleted-done', self ); });\n },\n\n /** fetch all the visible==false contents of this collection */\n fetchHidden : function( options ){\n options = options || {};\n var self = this;\n options.filters = _.extend( options.filters, {\n visible : false\n });\n options.remove = false;\n\n self.trigger( 'fetching-hidden', self );\n return self.fetch( options )\n .always( function(){ self.trigger( 'fetching-hidden-done', self ); });\n },\n\n /** fetch detailed model data for all contents in this collection */\n fetchAllDetails : function( options ){\n options = options || {};\n var detailsFlag = { details: 'all' };\n options.data = _.extend( options.data || {}, detailsFlag );\n return this.fetch( options );\n },\n\n /** specialty fetch method for retrieving the element_counts of all hdcas in the history */\n fetchCollectionCounts : function( options ){\n options = options || {};\n options.keys = [ 'type_id', 'element_count' ].join( ',' );\n options.filters = _.extend( options.filters || {}, {\n history_content_type: 'dataset_collection',\n });\n options.remove = false;\n return this.fetch( options );\n },\n\n // ............. quasi-batch ops\n // TODO: to batch\n /** helper that fetches using filterParams then calls save on each fetched using updateWhat as the save params */\n _filterAndUpdate : function( filterParams, updateWhat ){\n var self = this;\n var idAttribute = self.model.prototype.idAttribute;\n var updateArgs = [ updateWhat ];\n\n return self.fetch({ filters: filterParams, remove: false })\n .then( function( fetched ){\n // convert filtered json array to model array\n fetched = fetched.reduce( function( modelArray, currJson, i ){\n var model = self.get( currJson[ idAttribute ] );\n return model? modelArray.concat( model ) : modelArray;\n }, []);\n return self.ajaxQueue( 'save', updateArgs, fetched );\n });\n },\n\n /** using a queue, perform ajaxFn on each of the models in this collection */\n ajaxQueue : function( ajaxFn, args, collection ){\n collection = collection || this.models;\n return new AJAX_QUEUE.AjaxQueue( collection.slice().reverse().map( function( content, i ){\n var fn = _.isString( ajaxFn )? content[ ajaxFn ] : ajaxFn;\n return function(){ return fn.apply( content, args ); };\n })).deferred;\n },\n\n /** fetch contents' details in batches of limitPerCall - note: only get searchable details here */\n progressivelyFetchDetails : function( options ){\n options = options || {};\n var deferred = jQuery.Deferred();\n var self = this;\n var limit = options.limitPerCall || self.limitPerProgressiveFetch;\n // TODO: only fetch tags and annotations if specifically requested\n var searchAttributes = HDA_MODEL.HistoryDatasetAssociation.prototype.searchAttributes;\n var detailKeys = searchAttributes.join( ',' );\n\n function _recursivelyFetch( offset ){\n offset = offset || 0;\n var _options = _.extend( _.clone( options ), {\n view : 'summary',\n keys : detailKeys,\n limit : limit,\n offset : offset,\n reset : offset === 0,\n remove : false\n });\n\n _.defer( function(){\n self.fetch.call( self, _options )\n .fail( deferred.reject )\n .done( function( response ){\n deferred.notify( response, limit, offset );\n if( response.length !== limit ){\n self.allFetched = true;\n deferred.resolve( response, limit, offset );\n\n } else {\n _recursivelyFetch( offset + limit );\n }\n });\n });\n }\n _recursivelyFetch();\n return deferred;\n },\n\n /** does some bit of JSON represent something that can be copied into this contents collection */\n isCopyable : function( contentsJSON ){\n var copyableModelClasses = [\n 'HistoryDatasetAssociation',\n 'HistoryDatasetCollectionAssociation'\n ];\n return ( ( _.isObject( contentsJSON ) && contentsJSON.id )\n && ( _.contains( copyableModelClasses, contentsJSON.model_class ) ) );\n },\n\n /** copy an existing, accessible hda into this collection */\n copy : function( json ){\n // TODO: somehow showhorn all this into 'save'\n var id, type, contentType;\n if( _.isString( json ) ){\n id = json;\n contentType = 'hda';\n type = 'dataset';\n } else {\n id = json.id;\n contentType = ({\n 'HistoryDatasetAssociation' : 'hda',\n 'LibraryDatasetDatasetAssociation' : 'ldda',\n 'HistoryDatasetCollectionAssociation' : 'hdca'\n })[ json.model_class ] || 'hda';\n type = ( contentType === 'hdca'? 'dataset_collection' : 'dataset' );\n }\n var collection = this,\n xhr = jQuery.ajax( this.url(), {\n method: 'POST',\n contentType: 'application/json',\n data: JSON.stringify({\n content : id,\n source : contentType,\n type : type\n })\n })\n .done( function( response ){\n collection.add([ response ], { parse: true });\n })\n .fail( function( error, status, message ){\n collection.trigger( 'error', collection, xhr, {},\n 'Error copying contents', { type: type, id: id, source: contentType });\n });\n return xhr;\n },\n\n /** create a new HDCA in this collection */\n createHDCA : function( elementIdentifiers, collectionType, name, hideSourceItems, options ){\n // normally collection.create returns the new model, but we need the promise from the ajax, so we fake create\n //precondition: elementIdentifiers is an array of plain js objects\n // in the proper form to create the collectionType\n var hdca = this.model({\n history_content_type: 'dataset_collection',\n collection_type : collectionType,\n history_id : this.historyId,\n name : name,\n hide_source_items : hideSourceItems || false,\n // should probably be able to just send in a bunch of json here and restruct per class\n // note: element_identifiers is now (incorrectly) an attribute\n element_identifiers : elementIdentifiers\n // do not create the model on the client until the ajax returns\n });\n return hdca.save( options );\n },\n\n // ........................................................................ searching\n /** return true if all contents have the searchable attributes */\n haveSearchDetails : function(){\n return this.allFetched && this.all( function( content ){\n // null (which is a valid returned annotation value)\n // will return false when using content.has( 'annotation' )\n //TODO: a bit hacky - formalize\n return _.has( content.attributes, 'annotation' );\n });\n },\n\n /** return a new collection of contents whose attributes contain the substring matchesWhat */\n matches : function( matchesWhat ){\n return this.filter( function( content ){\n return content.matches( matchesWhat );\n });\n },\n\n // ........................................................................ misc\n /** In this override, copy the historyId to the clone */\n clone : function(){\n var clone = Backbone.Collection.prototype.clone.call( this );\n clone.historyId = this.historyId;\n return clone;\n },\n\n /** String representation. */\n toString : function(){\n return ([ 'HistoryContents(', [ this.historyId, this.length ].join(), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n HistoryContents : HistoryContents\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-contents.js","\ndefine([\n \"mvc/history/history-contents\",\n \"mvc/history/history-preferences\",\n \"mvc/base/controlled-fetch-collection\",\n \"utils/utils\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( HISTORY_CONTENTS, HISTORY_PREFS, CONTROLLED_FETCH_COLLECTION, UTILS, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\n/** @class Model for a Galaxy history resource - both a record of user\n * tool use and a collection of the datasets those tools produced.\n * @name History\n * @augments Backbone.Model\n */\nvar History = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( BASE_MVC.mixin( BASE_MVC.SearchableModelMixin, /** @lends History.prototype */{\n _logNamespace : 'history',\n\n /** ms between fetches when checking running jobs/datasets for updates */\n UPDATE_DELAY : 4000,\n\n // values from api (may need more)\n defaults : {\n model_class : 'History',\n id : null,\n name : 'Unnamed History',\n state : 'new',\n\n deleted : false,\n contents_active : {},\n contents_states : {},\n },\n\n urlRoot: Galaxy.root + 'api/histories',\n\n contentsClass : HISTORY_CONTENTS.HistoryContents,\n\n /** What model fields to search with */\n searchAttributes : [\n 'name', 'annotation', 'tags'\n ],\n\n /** Adding title and singular tag */\n searchAliases : {\n title : 'name',\n tag : 'tags'\n },\n\n // ........................................................................ set up/tear down\n /** Set up the model\n * @param {Object} historyJSON model data for this History\n * @param {Object} options any extra settings including logger\n */\n initialize : function( historyJSON, options ){\n options = options || {};\n this.logger = options.logger || null;\n this.log( this + \".initialize:\", historyJSON, options );\n\n /** HistoryContents collection of the HDAs contained in this history. */\n this.contents = new this.contentsClass( [], {\n history : this,\n historyId : this.get( 'id' ),\n order : options.order,\n });\n\n this._setUpListeners();\n this._setUpCollectionListeners();\n\n /** cached timeout id for the dataset updater */\n this.updateTimeoutId = null;\n },\n\n /** set up any event listeners for this history including those to the contained HDAs\n * events: error:contents if an error occurred with the contents collection\n */\n _setUpListeners : function(){\n // if the model's id changes ('current' or null -> an actual id), update the contents history_id\n return this.on({\n 'error' : function( model, xhr, options, msg, details ){\n this.clearUpdateTimeout();\n },\n 'change:id' : function( model, newId ){\n if( this.contents ){\n this.contents.historyId = newId;\n }\n },\n });\n },\n\n /** event handlers for the contents submodels */\n _setUpCollectionListeners : function(){\n if( !this.contents ){ return this; }\n // bubble up errors\n return this.listenTo( this.contents, {\n 'error' : function(){\n this.trigger.apply( this, jQuery.makeArray( arguments ) );\n },\n });\n },\n\n // ........................................................................ derived attributes\n /** */\n contentsShown : function(){\n var contentsActive = this.get( 'contents_active' );\n var shown = contentsActive.active || 0;\n shown += this.contents.includeDeleted? contentsActive.deleted : 0;\n shown += this.contents.includeHidden? contentsActive.hidden : 0;\n return shown;\n },\n\n /** convert size in bytes to a more human readable version */\n nice_size : function(){\n var size = this.get( 'size' );\n return size? UTILS.bytesToString( size, true, 2 ) : _l( '(empty)' );\n },\n\n /** override to add nice_size */\n toJSON : function(){\n return _.extend( Backbone.Model.prototype.toJSON.call( this ), {\n nice_size : this.nice_size()\n });\n },\n\n /** override to allow getting nice_size */\n get : function( key ){\n if( key === 'nice_size' ){\n return this.nice_size();\n }\n return Backbone.Model.prototype.get.apply( this, arguments );\n },\n\n // ........................................................................ common queries\n /** T/F is this history owned by the current user (Galaxy.user)\n * Note: that this will return false for an anon user even if the history is theirs.\n */\n ownedByCurrUser : function(){\n // no currUser\n if( !Galaxy || !Galaxy.user ){\n return false;\n }\n // user is anon or history isn't owned\n if( Galaxy.user.isAnonymous() || Galaxy.user.id !== this.get( 'user_id' ) ){\n return false;\n }\n return true;\n },\n\n /** Return the number of running jobs assoc with this history (note: unknown === 0) */\n numOfUnfinishedJobs : function(){\n var unfinishedJobIds = this.get( 'non_ready_jobs' );\n return unfinishedJobIds? unfinishedJobIds.length : 0;\n },\n\n /** Return the number of running hda/hdcas in this history (note: unknown === 0) */\n numOfUnfinishedShownContents : function(){\n return this.contents.runningAndActive().length || 0;\n },\n\n // ........................................................................ updates\n _fetchContentRelatedAttributes : function(){\n var contentRelatedAttrs = [ 'size', 'non_ready_jobs', 'contents_active', 'hid_counter' ];\n return this.fetch({ data : $.param({ keys : contentRelatedAttrs.join( ',' ) }) });\n },\n\n /** check for any changes since the last time we updated (or fetch all if ) */\n refresh : function( options ){\n // console.log( this + '.refresh' );\n options = options || {};\n var self = this;\n\n // note if there was no previous update time, all summary contents will be fetched\n var lastUpdateTime = self.lastUpdateTime;\n // if we don't flip this, then a fully-fetched list will not be re-checked via fetch\n this.contents.allFetched = false;\n var fetchFn = self.contents.currentPage !== 0\n ? function(){ return self.contents.fetchPage( self.contents.currentPage ); }\n : function(){ return self.contents.fetchUpdated( lastUpdateTime ); };\n // note: if there was no previous update time, all summary contents will be fetched\n return fetchFn()\n .done( function( response, status, xhr ){\n var serverResponseDatetime;\n try {\n serverResponseDatetime = new Date( xhr.getResponseHeader( 'Date' ) );\n } catch( err ){}\n self.lastUpdateTime = serverResponseDatetime || new Date();\n self.checkForUpdates( options );\n });\n },\n\n /** continuously fetch updated contents every UPDATE_DELAY ms if this history's datasets or jobs are unfinished */\n checkForUpdates : function( options ){\n // console.log( this + '.checkForUpdates' );\n options = options || {};\n var delay = this.UPDATE_DELAY;\n var self = this;\n if( !self.id ){ return; }\n\n function _delayThenUpdate(){\n // prevent buildup of updater timeouts by clearing previous if any, then set new and cache id\n self.clearUpdateTimeout();\n self.updateTimeoutId = setTimeout( function(){\n self.refresh( options );\n }, delay );\n }\n\n // if there are still datasets in the non-ready state, recurse into this function with the new time\n var nonReadyContentCount = this.numOfUnfinishedShownContents();\n // console.log( 'nonReadyContentCount:', nonReadyContentCount );\n if( nonReadyContentCount > 0 ){\n _delayThenUpdate();\n\n } else {\n // no datasets are running, but currently runnning jobs may still produce new datasets\n // see if the history has any running jobs and continue to update if so\n // (also update the size for the user in either case)\n self._fetchContentRelatedAttributes()\n .done( function( historyData ){\n // console.log( 'non_ready_jobs:', historyData.non_ready_jobs );\n if( self.numOfUnfinishedJobs() > 0 ){\n _delayThenUpdate();\n\n } else {\n // otherwise, let listeners know that all updates have stopped\n self.trigger( 'ready' );\n }\n });\n }\n },\n\n /** clear the timeout and the cached timeout id */\n clearUpdateTimeout : function(){\n if( this.updateTimeoutId ){\n clearTimeout( this.updateTimeoutId );\n this.updateTimeoutId = null;\n }\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse : function( response, options ){\n var parsed = Backbone.Model.prototype.parse.call( this, response, options );\n if( parsed.create_time ){\n parsed.create_time = new Date( parsed.create_time );\n }\n if( parsed.update_time ){\n parsed.update_time = new Date( parsed.update_time );\n }\n return parsed;\n },\n\n /** fetch this histories data (using options) then it's contents (using contentsOptions) */\n fetchWithContents : function( options, contentsOptions ){\n options = options || {};\n var self = this;\n\n // console.log( this + '.fetchWithContents' );\n // TODO: push down to a base class\n options.view = 'dev-detailed';\n\n // fetch history then use history data to fetch (paginated) contents\n return this.fetch( options ).then( function getContents( history ){\n self.contents.history = self;\n self.contents.setHistoryId( history.id );\n return self.fetchContents( contentsOptions );\n });\n },\n\n /** fetch this histories contents, adjusting options based on the stored history preferences */\n fetchContents : function( options ){\n options = options || {};\n var self = this;\n\n // we're updating, reset the update time\n self.lastUpdateTime = new Date();\n return self.contents.fetchCurrentPage( options );\n },\n\n /** save this history, _Mark_ing it as deleted (just a flag) */\n _delete : function( options ){\n if( this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: true }, options );\n },\n /** purge this history, _Mark_ing it as purged and removing all dataset data from the server */\n purge : function( options ){\n if( this.get( 'purged' ) ){ return jQuery.when(); }\n return this.save( { deleted: true, purged: true }, options );\n },\n /** save this history, _Mark_ing it as undeleted */\n undelete : function( options ){\n if( !this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: false }, options );\n },\n\n /** Make a copy of this history on the server\n * @param {Boolean} current if true, set the copy as the new current history (default: true)\n * @param {String} name name of new history (default: none - server sets to: Copy of )\n * @fires copied passed this history and the response JSON from the copy\n * @returns {xhr}\n */\n copy : function( current, name, allDatasets ){\n current = ( current !== undefined )?( current ):( true );\n if( !this.id ){\n throw new Error( 'You must set the history ID before copying it.' );\n }\n\n var postData = { history_id : this.id };\n if( current ){\n postData.current = true;\n }\n if( name ){\n postData.name = name;\n }\n if( !allDatasets ){\n postData.all_datasets = false;\n }\n postData.view = 'dev-detailed';\n\n var history = this;\n var copy = jQuery.post( this.urlRoot, postData );\n // if current - queue to setAsCurrent before firing 'copied'\n if( current ){\n return copy.then( function( response ){\n var newHistory = new History( response );\n return newHistory.setAsCurrent()\n .done( function(){\n history.trigger( 'copied', history, response );\n });\n });\n }\n return copy.done( function( response ){\n history.trigger( 'copied', history, response );\n });\n },\n\n setAsCurrent : function(){\n var history = this,\n xhr = jQuery.getJSON( Galaxy.root + 'history/set_as_current?id=' + this.id );\n\n xhr.done( function(){\n history.trigger( 'set-as-current', history );\n });\n return xhr;\n },\n\n // ........................................................................ misc\n toString : function(){\n return 'History(' + this.get( 'id' ) + ',' + this.get( 'name' ) + ')';\n }\n}));\n\n\n//==============================================================================\nvar _collectionSuper = CONTROLLED_FETCH_COLLECTION.InfinitelyScrollingCollection;\n/** @class A collection of histories (per user)\n * that maintains the current history as the first in the collection.\n * New or copied histories become the current history.\n */\nvar HistoryCollection = _collectionSuper.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : 'history',\n\n model : History,\n /** @type {String} initial order used by collection */\n order : 'update_time',\n /** @type {Number} limit used for the first fetch (or a reset) */\n limitOnFirstFetch : 10,\n /** @type {Number} limit used for each subsequent fetch */\n limitPerFetch : 10,\n\n initialize : function( models, options ){\n options = options || {};\n this.log( 'HistoryCollection.initialize', models, options );\n _collectionSuper.prototype.initialize.call( this, models, options );\n\n /** @type {boolean} should deleted histories be included */\n this.includeDeleted = options.includeDeleted || false;\n\n /** @type {String} encoded id of the history that's current */\n this.currentHistoryId = options.currentHistoryId;\n\n this.setUpListeners();\n // note: models are sent to reset *after* this fn ends; up to this point\n // the collection *is empty*\n },\n\n urlRoot : Galaxy.root + 'api/histories',\n url : function(){ return this.urlRoot; },\n\n /** set up reflexive event handlers */\n setUpListeners : function setUpListeners(){\n return this.on({\n // when a history is deleted, remove it from the collection (if optionally set to do so)\n 'change:deleted' : function( history ){\n // TODO: this becomes complicated when more filters are used\n this.debug( 'change:deleted', this.includeDeleted, history.get( 'deleted' ) );\n if( !this.includeDeleted && history.get( 'deleted' ) ){\n this.remove( history );\n }\n },\n // listen for a history copy, setting it to current\n 'copied' : function( original, newData ){\n this.setCurrent( new History( newData, [] ) );\n },\n // when a history is made current, track the id in the collection\n 'set-as-current' : function( history ){\n var oldCurrentId = this.currentHistoryId;\n this.trigger( 'no-longer-current', oldCurrentId );\n this.currentHistoryId = history.id;\n }\n });\n },\n\n /** override to change view */\n _buildFetchData : function( options ){\n return _.extend( _collectionSuper.prototype._buildFetchData.call( this, options ), {\n view : 'dev-detailed'\n });\n },\n\n /** override to filter out deleted and purged */\n _buildFetchFilters : function( options ){\n var superFilters = _collectionSuper.prototype._buildFetchFilters.call( this, options ) || {};\n var filters = {};\n if( !this.includeDeleted ){\n filters.deleted = false;\n filters.purged = false;\n } else {\n // force API to return both deleted and non\n //TODO: when the API is updated, remove this\n filters.deleted = null;\n }\n return _.defaults( superFilters, filters );\n },\n\n /** override to fetch current as well (as it may be outside the first 10, etc.) */\n fetchFirst : function( options ){\n var self = this;\n // TODO: batch?\n var xhr = $.when();\n if( this.currentHistoryId ){\n xhr = _collectionSuper.prototype.fetchFirst.call( self, {\n silent: true,\n limit : 1,\n filters: {\n // without these a deleted current history will return [] here and block the other xhr\n 'purged' : '',\n 'deleted' : '',\n 'encoded_id-in' : this.currentHistoryId,\n }\n });\n }\n return xhr.then( function(){\n options = options || {};\n options.offset = 0;\n return self.fetchMore( options );\n });\n },\n\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators : _.extend( _.clone( _collectionSuper.prototype.comparators ), {\n 'name' : BASE_MVC.buildComparator( 'name', { ascending: true }),\n 'name-dsc' : BASE_MVC.buildComparator( 'name', { ascending: false }),\n 'size' : BASE_MVC.buildComparator( 'size', { ascending: false }),\n 'size-asc' : BASE_MVC.buildComparator( 'size', { ascending: true }),\n }),\n\n /** override to always have the current history first */\n sort : function( options ){\n options = options || {};\n var silent = options.silent;\n var currentHistory = this.remove( this.get( this.currentHistoryId ) );\n _collectionSuper.prototype.sort.call( this, _.defaults({ silent: true }, options ) );\n this.unshift( currentHistory, { silent: true });\n if( !silent ){\n this.trigger( 'sort', this, options );\n }\n return this;\n },\n\n /** create a new history and by default set it to be the current history */\n create : function create( data, hdas, historyOptions, xhrOptions ){\n //TODO: .create is actually a collection function that's overridden here\n var collection = this,\n xhr = jQuery.getJSON( Galaxy.root + 'history/create_new_current' );\n return xhr.done( function( newData ){\n collection.setCurrent( new History( newData, [], historyOptions || {} ) );\n });\n },\n\n /** set the current history to the given history, placing it first in the collection.\n * Pass standard bbone options for use in unshift.\n * @triggers new-current passed history and this collection\n */\n setCurrent : function( history, options ){\n options = options || {};\n // new histories go in the front\n this.unshift( history, options );\n this.currentHistoryId = history.get( 'id' );\n if( !options.silent ){\n this.trigger( 'new-current', history, this );\n }\n return this;\n },\n\n toString: function toString(){\n return 'HistoryCollection(' + this.length + ',current:' + this.currentHistoryId + ')';\n }\n});\n\n\n//==============================================================================\nreturn {\n History : History,\n HistoryCollection : HistoryCollection\n};});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-model.js","define([\n \"mvc/base-mvc\"\n], function( BASE_MVC ){\n\n'use strict';\n\nvar logNamespace = 'history';\n\n// ============================================================================\n/** session storage for individual history preferences */\nvar HistoryPrefs = BASE_MVC.SessionStorageModel.extend(\n/** @lends HistoryPrefs.prototype */{\n //TODO:?? move to user prefs?\n defaults : {\n //TODO:?? expandedIds to array?\n expandedIds : {},\n show_deleted : false,\n show_hidden : false\n },\n\n /** add an hda id to the hash of expanded hdas */\n addExpanded : function( model ){\n//TODO: use type_id and not model\n var current = this.get( 'expandedIds' );\n current[ model.id ] = model.get( 'id' );\n this.save( 'expandedIds', current );\n },\n\n /** remove an hda id from the hash of expanded hdas */\n removeExpanded : function( model ){\n var current = this.get( 'expandedIds' );\n delete current[ model.id ];\n this.save( 'expandedIds', current );\n },\n\n isExpanded : function( contentId ){\n return _.result( this.get( 'expandedIds' ), contentId, false );\n },\n\n allExpanded : function(){\n return _.values( this.get( 'expandedIds' ) );\n },\n\n clearExpanded : function(){\n this.set( 'expandedIds', {} );\n },\n\n includeDeleted : function( val ){\n // moving the invocation here so other components don't need to know the key\n // TODO: change this key later\n if( !_.isUndefined( val ) ){ this.set( 'show_deleted', val ); }\n return this.get( 'show_deleted' );\n },\n\n includeHidden : function( val ){\n // TODO: change this key later\n if( !_.isUndefined( val ) ){ this.set( 'show_hidden', val ); }\n return this.get( 'show_hidden' );\n },\n\n toString : function(){\n return 'HistoryPrefs(' + this.id + ')';\n }\n\n}, {\n // ........................................................................ class vars\n // class lvl for access w/o instantiation\n storageKeyPrefix : 'history:',\n\n /** key string to store each histories settings under */\n historyStorageKey : function historyStorageKey( historyId ){\n if( !historyId ){\n throw new Error( 'HistoryPrefs.historyStorageKey needs valid id: ' + historyId );\n }\n // single point of change\n return ( HistoryPrefs.storageKeyPrefix + historyId );\n },\n\n /** return the existing storage for the history with the given id (or create one if it doesn't exist) */\n get : function get( historyId ){\n return new HistoryPrefs({ id: HistoryPrefs.historyStorageKey( historyId ) });\n },\n\n /** clear all history related items in sessionStorage */\n clearAll : function clearAll( historyId ){\n for( var key in sessionStorage ){\n if( key.indexOf( HistoryPrefs.storageKeyPrefix ) === 0 ){\n sessionStorage.removeItem( key );\n }\n }\n }\n});\n\n//==============================================================================\n return {\n HistoryPrefs: HistoryPrefs\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-preferences.js","define([\n 'mvc/base-mvc',\n 'utils/localization'\n], function( BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'list';\n//==============================================================================\n/** A view which, when first rendered, shows only summary data/attributes, but\n * can be expanded to show further details (and optionally fetch those\n * details from the server).\n */\nvar ExpandableView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n //TODO: Although the reasoning behind them is different, this shares a lot with HiddenUntilActivated above: combine them\n //PRECONDITION: model must have method hasDetails\n //PRECONDITION: subclasses must have templates.el and templates.details\n\n initialize : function( attributes ){\n /** are the details of this view expanded/shown or not? */\n this.expanded = attributes.expanded || false;\n this.log( '\\t expanded:', this.expanded );\n this.fxSpeed = attributes.fxSpeed !== undefined? attributes.fxSpeed : this.fxSpeed;\n },\n\n // ........................................................................ render main\n /** jq fx speed */\n fxSpeed : 'fast',\n\n /** Render this content, set up ui.\n * @param {Number or String} speed the speed of the render\n */\n render : function( speed ){\n var $newRender = this._buildNewRender();\n this._setUpBehaviors( $newRender );\n this._queueNewRender( $newRender, speed );\n return this;\n },\n\n /** Build a temp div containing the new children for the view's $el.\n * If the view is already expanded, build the details as well.\n */\n _buildNewRender : function(){\n // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n var $newRender = $( this.templates.el( this.model.toJSON(), this ) );\n if( this.expanded ){\n this.$details( $newRender ).replaceWith( this._renderDetails().show() );\n }\n return $newRender;\n },\n\n /** Fade out the old el, swap in the new contents, then fade in.\n * @param {Number or String} speed jq speed to use for rendering effects\n * @fires rendered when rendered\n */\n _queueNewRender : function( $newRender, speed ) {\n speed = ( speed === undefined )?( this.fxSpeed ):( speed );\n var view = this;\n\n if( speed === 0 ){\n view._swapNewRender( $newRender );\n view.trigger( 'rendered', view );\n\n } else {\n $( view ).queue( 'fx', [\n function( next ){\n view.$el.fadeOut( speed, next );\n },\n function( next ){\n view._swapNewRender( $newRender );\n next();\n },\n function( next ){\n view.$el.fadeIn( speed, next );\n },\n function( next ){\n view.trigger( 'rendered', view );\n next();\n }\n ]);\n }\n },\n\n /** empty out the current el, move the $newRender's children in */\n _swapNewRender : function( $newRender ){\n return this.$el.empty()\n .attr( 'class', _.isFunction( this.className )? this.className(): this.className )\n .append( $newRender.children() );\n },\n\n /** set up js behaviors, event handlers for elements within the given container\n * @param {jQuery} $container jq object that contains the elements to process (defaults to this.$el)\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n // set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)\n //make_popup_menus( $where );\n $where.find( '[title]' ).tooltip({ placement : 'bottom' });\n },\n\n // ......................................................................... details\n /** shortcut to details DOM (as jQ) */\n $details : function( $where ){\n $where = $where || this.$el;\n return $where.find( '> .details' );\n },\n\n /** build the DOM for the details and set up behaviors on it */\n _renderDetails : function(){\n var $newDetails = $( this.templates.details( this.model.toJSON(), this ) );\n this._setUpBehaviors( $newDetails );\n return $newDetails;\n },\n\n // ......................................................................... expansion/details\n /** Show or hide the details\n * @param {Boolean} expand if true, expand; if false, collapse\n */\n toggleExpanded : function( expand ){\n expand = ( expand === undefined )?( !this.expanded ):( expand );\n if( expand ){\n this.expand();\n } else {\n this.collapse();\n }\n return this;\n },\n\n /** Render and show the full, detailed body of this view including extra data and controls.\n * note: if the model does not have detailed data, fetch that data before showing the body\n * @fires expanded when a body has been expanded\n */\n expand : function(){\n var view = this;\n return view._fetchModelDetails().always( function(){\n view._expand();\n });\n },\n\n /** Check for model details and, if none, fetch them.\n * @returns {jQuery.promise} the model.fetch.xhr if details are being fetched, an empty promise if not\n */\n _fetchModelDetails : function(){\n if( !this.model.hasDetails() ){\n return this.model.fetch();\n }\n return jQuery.when();\n },\n\n /** Inner fn called when expand (public) has fetched the details */\n _expand : function(){\n var view = this,\n $newDetails = view._renderDetails();\n view.$details().replaceWith( $newDetails );\n // needs to be set after the above or the slide will not show\n view.expanded = true;\n view.$details().slideDown( view.fxSpeed, function(){\n view.trigger( 'expanded', view );\n });\n },\n\n /** Hide the body/details of an HDA.\n * @fires collapsed when a body has been collapsed\n */\n collapse : function(){\n this.debug( this + '(ExpandableView).collapse' );\n var view = this;\n view.expanded = false;\n this.$details().slideUp( view.fxSpeed, function(){\n view.trigger( 'collapsed', view );\n });\n }\n\n});\n\n\n//==============================================================================\n/** A view that is displayed in some larger list/grid/collection.\n * Inherits from Expandable, Selectable, Draggable.\n * The DOM contains warnings, a title bar, and a series of primary action controls.\n * Primary actions are meant to be easily accessible item functions (such as delete)\n * that are rendered in the title bar.\n *\n * Details are rendered when the user clicks the title bar or presses enter/space when\n * the title bar is in focus.\n *\n * Designed as a base class for history panel contents - but usable elsewhere (I hope).\n */\nvar ListItemView = ExpandableView.extend(\n BASE_MVC.mixin( BASE_MVC.SelectableViewMixin, BASE_MVC.DraggableViewMixin, {\n\n tagName : 'div',\n className : 'list-item',\n\n /** Set up the base class and all mixins */\n initialize : function( attributes ){\n ExpandableView.prototype.initialize.call( this, attributes );\n BASE_MVC.SelectableViewMixin.initialize.call( this, attributes );\n BASE_MVC.DraggableViewMixin.initialize.call( this, attributes );\n this._setUpListeners();\n },\n\n /** event listeners */\n _setUpListeners : function(){\n // hide the primary actions in the title bar when selectable and narrow\n this.on( 'selectable', function( isSelectable ){\n if( isSelectable ){\n this.$( '.primary-actions' ).hide();\n } else {\n this.$( '.primary-actions' ).show();\n }\n }, this );\n return this;\n },\n\n // ........................................................................ rendering\n /** In this override, call methods to build warnings, titlebar and primary actions */\n _buildNewRender : function(){\n var $newRender = ExpandableView.prototype._buildNewRender.call( this );\n $newRender.children( '.warnings' ).replaceWith( this._renderWarnings() );\n $newRender.children( '.title-bar' ).replaceWith( this._renderTitleBar() );\n $newRender.children( '.primary-actions' ).append( this._renderPrimaryActions() );\n $newRender.find( '> .title-bar .subtitle' ).replaceWith( this._renderSubtitle() );\n return $newRender;\n },\n\n /** In this override, render the selector controls and set up dragging before the swap */\n _swapNewRender : function( $newRender ){\n ExpandableView.prototype._swapNewRender.call( this, $newRender );\n if( this.selectable ){ this.showSelector( 0 ); }\n if( this.draggable ){ this.draggableOn(); }\n return this.$el;\n },\n\n /** Render any warnings the item may need to show (e.g. \"I'm deleted\") */\n _renderWarnings : function(){\n var view = this,\n $warnings = $( '
              ' ),\n json = view.model.toJSON();\n //TODO:! unordered (map)\n _.each( view.templates.warnings, function( templateFn ){\n $warnings.append( $( templateFn( json, view ) ) );\n });\n return $warnings;\n },\n\n /** Render the title bar (the main/exposed SUMMARY dom element) */\n _renderTitleBar : function(){\n return $( this.templates.titleBar( this.model.toJSON(), this ) );\n },\n\n /** Return an array of jQ objects containing common/easily-accessible item controls */\n _renderPrimaryActions : function(){\n // override this\n return [];\n },\n\n /** Render the title bar (the main/exposed SUMMARY dom element) */\n _renderSubtitle : function(){\n return $( this.templates.subtitle( this.model.toJSON(), this ) );\n },\n\n // ......................................................................... events\n /** event map */\n events : {\n // expand the body when the title is clicked or when in focus and space or enter is pressed\n 'click .title-bar' : '_clickTitleBar',\n 'keydown .title-bar' : '_keyDownTitleBar',\n 'click .selector' : 'toggleSelect'\n },\n\n /** expand when the title bar is clicked */\n _clickTitleBar : function( event ){\n event.stopPropagation();\n if( event.altKey ){\n this.toggleSelect( event );\n if( !this.selectable ){\n this.showSelector();\n }\n } else {\n this.toggleExpanded();\n }\n },\n\n /** expand when the title bar is in focus and enter or space is pressed */\n _keyDownTitleBar : function( event ){\n // bail (with propagation) if keydown and not space or enter\n var KEYCODE_SPACE = 32, KEYCODE_RETURN = 13;\n if( event && ( event.type === 'keydown' )\n &&( event.keyCode === KEYCODE_SPACE || event.keyCode === KEYCODE_RETURN ) ){\n this.toggleExpanded();\n event.stopPropagation();\n return false;\n }\n return true;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'ListItemView(' + modelString + ')';\n }\n}));\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nListItemView.prototype.templates = (function(){\n\n var elTemplato = BASE_MVC.wrapTemplate([\n '
              ',\n // errors, messages, etc.\n '
              ',\n\n // multi-select checkbox\n '
              ',\n '',\n '
              ',\n // space for title bar buttons - gen. floated to the right\n '
              ',\n '
              ',\n\n // expandable area for more details\n '
              ',\n '
              '\n ]);\n\n var warnings = {};\n\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n // adding a tabindex here allows focusing the title bar and the use of keydown to expand the dataset display\n '
              ',\n //TODO: prob. belongs in dataset-list-item\n '',\n '
              ',\n '<%- element.name %>',\n '
              ',\n '
              ',\n '
              '\n ], 'element' );\n\n var subtitleTemplate = BASE_MVC.wrapTemplate([\n // override this\n '
              '\n ]);\n\n var detailsTemplate = BASE_MVC.wrapTemplate([\n // override this\n '
              '\n ]);\n\n return {\n el : elTemplato,\n warnings : warnings,\n titleBar : titleBarTemplate,\n subtitle : subtitleTemplate,\n details : detailsTemplate\n };\n}());\n\n\n//==============================================================================\n/** A view that is displayed in some larger list/grid/collection.\n * *AND* can display some sub-list of it's own when expanded (e.g. dataset collections).\n * This list will 'foldout' when the item is expanded depending on this.foldoutStyle:\n * If 'foldout': will expand vertically to show the nested list\n * If 'drilldown': will overlay the parent list\n *\n * Inherits from ListItemView.\n *\n * _renderDetails does the work of creating this.details: a sub-view that shows the nested list\n */\nvar FoldoutListItemView = ListItemView.extend({\n\n /** If 'foldout': show the sub-panel inside the expanded item\n * If 'drilldown': only fire events and handle by pub-sub\n * (allow the panel containing this item to attach it, hide itself, etc.)\n */\n foldoutStyle : 'foldout',\n /** Panel view class to instantiate for the sub-panel */\n foldoutPanelClass : null,\n\n /** override to:\n * add attributes foldoutStyle and foldoutPanelClass for config poly\n * disrespect attributes.expanded if drilldown\n */\n initialize : function( attributes ){\n if( this.foldoutStyle === 'drilldown' ){ this.expanded = false; }\n this.foldoutStyle = attributes.foldoutStyle || this.foldoutStyle;\n this.foldoutPanelClass = attributes.foldoutPanelClass || this.foldoutPanelClass;\n\n ListItemView.prototype.initialize.call( this, attributes );\n this.foldout = this._createFoldoutPanel();\n },\n\n /** in this override, attach the foldout panel when rendering details */\n _renderDetails : function(){\n if( this.foldoutStyle === 'drilldown' ){ return $(); }\n var $newDetails = ListItemView.prototype._renderDetails.call( this );\n return this._attachFoldout( this.foldout, $newDetails );\n },\n\n /** In this override, handle collection expansion. */\n _createFoldoutPanel : function(){\n var model = this.model;\n var FoldoutClass = this._getFoldoutPanelClass( model ),\n options = this._getFoldoutPanelOptions( model ),\n foldout = new FoldoutClass( _.extend( options, {\n model : model\n }));\n return foldout;\n },\n\n /** Stub to return proper foldout panel class */\n _getFoldoutPanelClass : function(){\n // override\n return this.foldoutPanelClass;\n },\n\n /** Stub to return proper foldout panel options */\n _getFoldoutPanelOptions : function(){\n return {\n // propagate foldout style down\n foldoutStyle : this.foldoutStyle,\n fxSpeed : this.fxSpeed\n };\n },\n\n /** Render the foldout panel inside the view, hiding controls */\n _attachFoldout : function( foldout, $whereTo ){\n $whereTo = $whereTo || this.$( '> .details' );\n this.foldout = foldout.render( 0 );\n foldout.$( '> .controls' ).hide();\n return $whereTo.append( foldout.$el );\n },\n\n /** In this override, branch on foldoutStyle to show expanded */\n expand : function(){\n var view = this;\n return view._fetchModelDetails()\n .always(function(){\n if( view.foldoutStyle === 'foldout' ){\n view._expand();\n } else if( view.foldoutStyle === 'drilldown' ){\n view._expandByDrilldown();\n }\n });\n },\n\n /** For drilldown, set up close handler and fire expanded:drilldown\n * containing views can listen to this and handle other things\n * (like hiding themselves) by listening for expanded/collapsed:drilldown\n */\n _expandByDrilldown : function(){\n var view = this;\n // attachment and rendering done by listener\n view.listenTo( view.foldout, 'close', function(){\n view.trigger( 'collapsed:drilldown', view, view.foldout );\n });\n view.trigger( 'expanded:drilldown', view, view.foldout );\n }\n\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nFoldoutListItemView.prototype.templates = (function(){\n\n var detailsTemplate = BASE_MVC.wrapTemplate([\n '
              ',\n // override with more info (that goes above the panel)\n '
              '\n ], 'collection' );\n\n return _.extend( {}, ListItemView.prototype.templates, {\n details : detailsTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n ExpandableView : ExpandableView,\n ListItemView : ListItemView,\n FoldoutListItemView : FoldoutListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/list/list-item.js","/**\n * Model, view, and controller objects for Galaxy tools and tool panel.\n */\n\n define([\n \"libs/underscore\",\n \"viz/trackster/util\",\n \"mvc/dataset/data\",\n \"mvc/tool/tool-form\"\n\n], function(_, util, data, ToolForm) {\n 'use strict';\n\n/**\n * Mixin for tracking model visibility.\n */\nvar VisibilityMixin = {\n hidden: false,\n\n show: function() {\n this.set(\"hidden\", false);\n },\n\n hide: function() {\n this.set(\"hidden\", true);\n },\n\n toggle: function() {\n this.set(\"hidden\", !this.get(\"hidden\"));\n },\n\n is_visible: function() {\n return !this.attributes.hidden;\n }\n\n};\n\n/**\n * A tool parameter.\n */\nvar ToolParameter = Backbone.Model.extend({\n defaults: {\n name: null,\n label: null,\n type: null,\n value: null,\n html: null,\n num_samples: 5\n },\n\n initialize: function(options) {\n this.attributes.html = unescape(this.attributes.html);\n },\n\n copy: function() {\n return new ToolParameter(this.toJSON());\n },\n\n set_value: function(value) {\n this.set('value', value || '');\n }\n});\n\nvar ToolParameterCollection = Backbone.Collection.extend({\n model: ToolParameter\n});\n\n/**\n * A data tool parameter.\n */\nvar DataToolParameter = ToolParameter.extend({});\n\n/**\n * An integer tool parameter.\n */\nvar IntegerToolParameter = ToolParameter.extend({\n set_value: function(value) {\n this.set('value', parseInt(value, 10));\n },\n\n /**\n * Returns samples from a tool input.\n */\n get_samples: function() {\n return d3.scale.linear()\n .domain([this.get('min'), this.get('max')])\n .ticks(this.get('num_samples'));\n }\n});\n\nvar FloatToolParameter = IntegerToolParameter.extend({\n set_value: function(value) {\n this.set('value', parseFloat(value));\n }\n});\n\n/**\n * A select tool parameter.\n */\nvar SelectToolParameter = ToolParameter.extend({\n /**\n * Returns tool options.\n */\n get_samples: function() {\n return _.map(this.get('options'), function(option) {\n return option[0];\n });\n }\n});\n\n// Set up dictionary of parameter types.\nToolParameter.subModelTypes = {\n 'integer': IntegerToolParameter,\n 'float': FloatToolParameter,\n 'data': DataToolParameter,\n 'select': SelectToolParameter\n};\n\n/**\n * A Galaxy tool.\n */\nvar Tool = Backbone.Model.extend({\n // Default attributes.\n defaults: {\n id: null,\n name: null,\n description: null,\n target: null,\n inputs: [],\n outputs: []\n },\n\n urlRoot: Galaxy.root + 'api/tools',\n\n initialize: function(options) {\n\n // Set parameters.\n this.set('inputs', new ToolParameterCollection(_.map(options.inputs, function(p) {\n var p_class = ToolParameter.subModelTypes[p.type] || ToolParameter;\n return new p_class(p);\n })));\n },\n\n /**\n *\n */\n toJSON: function() {\n var rval = Backbone.Model.prototype.toJSON.call(this);\n\n // Convert inputs to JSON manually.\n rval.inputs = this.get('inputs').map(function(i) { return i.toJSON(); });\n return rval;\n },\n\n /**\n * Removes inputs of a particular type; this is useful because not all inputs can be handled by\n * client and server yet.\n */\n remove_inputs: function(types) {\n var tool = this,\n incompatible_inputs = tool.get('inputs').filter( function(input) {\n return ( types.indexOf( input.get('type') ) !== -1);\n });\n tool.get('inputs').remove(incompatible_inputs);\n },\n\n /**\n * Returns object copy, optionally including only inputs that can be sampled.\n */\n copy: function(only_samplable_inputs) {\n var copy = new Tool(this.toJSON());\n\n // Return only samplable inputs if flag is set.\n if (only_samplable_inputs) {\n var valid_inputs = new Backbone.Collection();\n copy.get('inputs').each(function(input) {\n if (input.get_samples()) {\n valid_inputs.push(input);\n }\n });\n copy.set('inputs', valid_inputs);\n }\n\n return copy;\n },\n\n apply_search_results: function(results) {\n ( _.indexOf(results, this.attributes.id) !== -1 ? this.show() : this.hide() );\n return this.is_visible();\n },\n\n /**\n * Set a tool input's value.\n */\n set_input_value: function(name, value) {\n this.get('inputs').find(function(input) {\n return input.get('name') === name;\n }).set('value', value);\n },\n\n /**\n * Set many input values at once.\n */\n set_input_values: function(inputs_dict) {\n var self = this;\n _.each(_.keys(inputs_dict), function(input_name) {\n self.set_input_value(input_name, inputs_dict[input_name]);\n });\n },\n\n /**\n * Run tool; returns a Deferred that resolves to the tool's output(s).\n */\n run: function() {\n return this._run();\n },\n\n /**\n * Rerun tool using regions and a target dataset.\n */\n rerun: function(target_dataset, regions) {\n return this._run({\n action: 'rerun',\n target_dataset_id: target_dataset.id,\n regions: regions\n });\n },\n\n /**\n * Returns input dict for tool's inputs.\n */\n get_inputs_dict: function() {\n var input_dict = {};\n this.get('inputs').each(function(input) {\n input_dict[input.get('name')] = input.get('value');\n });\n return input_dict;\n },\n\n /**\n * Run tool; returns a Deferred that resolves to the tool's output(s).\n * NOTE: this method is a helper method and should not be called directly.\n */\n _run: function(additional_params) {\n // Create payload.\n var payload = _.extend({\n tool_id: this.id,\n inputs: this.get_inputs_dict()\n }, additional_params);\n\n // Because job may require indexing datasets, use server-side\n // deferred to ensure that job is run. Also use deferred that\n // resolves to outputs from tool.\n var run_deferred = $.Deferred(),\n ss_deferred = new util.ServerStateDeferred({\n ajax_settings: {\n url: this.urlRoot,\n data: JSON.stringify(payload),\n dataType: \"json\",\n contentType: 'application/json',\n type: \"POST\"\n },\n interval: 2000,\n success_fn: function(response) {\n return response !== \"pending\";\n }\n });\n\n // Run job and resolve run_deferred to tool outputs.\n $.when(ss_deferred.go()).then(function(result) {\n run_deferred.resolve(new data.DatasetCollection(result));\n });\n return run_deferred;\n }\n});\n_.extend(Tool.prototype, VisibilityMixin);\n\n/**\n * Tool view.\n */\nvar ToolView = Backbone.View.extend({\n\n});\n\n/**\n * Wrap collection of tools for fast access/manipulation.\n */\nvar ToolCollection = Backbone.Collection.extend({\n model: Tool\n});\n\n/**\n * Label or section header in tool panel.\n */\nvar ToolSectionLabel = Backbone.Model.extend(VisibilityMixin);\n\n/**\n * Section of tool panel with elements (labels and tools).\n */\nvar ToolSection = Backbone.Model.extend({\n defaults: {\n elems: [],\n open: false\n },\n\n clear_search_results: function() {\n _.each(this.attributes.elems, function(elt) {\n elt.show();\n });\n\n this.show();\n this.set(\"open\", false);\n },\n\n apply_search_results: function(results) {\n var all_hidden = true,\n cur_label;\n _.each(this.attributes.elems, function(elt) {\n if (elt instanceof ToolSectionLabel) {\n cur_label = elt;\n cur_label.hide();\n }\n else if (elt instanceof Tool) {\n if (elt.apply_search_results(results)) {\n all_hidden = false;\n if (cur_label) {\n cur_label.show();\n }\n }\n }\n });\n\n if (all_hidden) {\n this.hide();\n }\n else {\n this.show();\n this.set(\"open\", true);\n }\n }\n});\n_.extend(ToolSection.prototype, VisibilityMixin);\n\n/**\n * Tool search that updates results when query is changed. Result value of null\n * indicates that query was not run; if not null, results are from search using\n * query.\n */\nvar ToolSearch = Backbone.Model.extend({\n defaults: {\n search_hint_string: \"search tools\",\n min_chars_for_search: 3,\n clear_btn_url: \"\",\n visible: true,\n query: \"\",\n results: null,\n // ESC (27) will clear the input field and tool search filters\n clear_key: 27\n },\n\n urlRoot: Galaxy.root + 'api/tools',\n\n initialize: function() {\n this.on(\"change:query\", this.do_search);\n },\n\n /**\n * Do the search and update the results.\n */\n do_search: function() {\n var query = this.attributes.query;\n\n // If query is too short, do not search.\n if (query.length < this.attributes.min_chars_for_search) {\n this.set(\"results\", null);\n return;\n }\n\n // Do search via AJAX.\n var q = query;\n // Stop previous ajax-request\n if (this.timer) {\n clearTimeout(this.timer);\n }\n // Start a new ajax-request in X ms\n $(\"#search-clear-btn\").hide();\n $(\"#search-spinner\").show();\n var self = this;\n this.timer = setTimeout(function () {\n // log the search to analytics if present\n if ( typeof ga !== 'undefined' ) {\n ga( 'send', 'pageview', Galaxy.root + '?q=' + q );\n }\n $.get( self.urlRoot, { q: q }, function (data) {\n self.set(\"results\", data);\n $(\"#search-spinner\").hide();\n $(\"#search-clear-btn\").show();\n }, \"json\" );\n }, 400 );\n },\n\n clear_search: function() {\n this.set(\"query\", \"\");\n this.set(\"results\", null);\n }\n\n});\n_.extend(ToolSearch.prototype, VisibilityMixin);\n\n/**\n * Tool Panel.\n */\nvar ToolPanel = Backbone.Model.extend({\n\n initialize: function(options) {\n this.attributes.tool_search = options.tool_search;\n this.attributes.tool_search.on(\"change:results\", this.apply_search_results, this);\n this.attributes.tools = options.tools;\n this.attributes.layout = new Backbone.Collection( this.parse(options.layout) );\n },\n\n /**\n * Parse tool panel dictionary and return collection of tool panel elements.\n */\n parse: function(response) {\n // Recursive function to parse tool panel elements.\n var self = this,\n // Helper to recursively parse tool panel.\n parse_elt = function(elt_dict) {\n var type = elt_dict.model_class;\n // There are many types of tools; for now, anything that ends in 'Tool'\n // is treated as a generic tool.\n if ( type.indexOf('Tool') === type.length - 4 ) {\n return self.attributes.tools.get(elt_dict.id);\n }\n else if (type === 'ToolSection') {\n // Parse elements.\n var elems = _.map(elt_dict.elems, parse_elt);\n elt_dict.elems = elems;\n return new ToolSection(elt_dict);\n }\n else if (type === 'ToolSectionLabel') {\n return new ToolSectionLabel(elt_dict);\n }\n };\n\n return _.map(response, parse_elt);\n },\n\n clear_search_results: function() {\n this.get('layout').each(function(panel_elt) {\n if (panel_elt instanceof ToolSection) {\n panel_elt.clear_search_results();\n }\n else {\n // Label or tool, so just show.\n panel_elt.show();\n }\n });\n },\n\n apply_search_results: function() {\n var results = this.get('tool_search').get('results');\n if (results === null) {\n this.clear_search_results();\n return;\n }\n\n var cur_label = null;\n this.get('layout').each(function(panel_elt) {\n if (panel_elt instanceof ToolSectionLabel) {\n cur_label = panel_elt;\n cur_label.hide();\n }\n else if (panel_elt instanceof Tool) {\n if (panel_elt.apply_search_results(results)) {\n if (cur_label) {\n cur_label.show();\n }\n }\n }\n else {\n // Starting new section, so clear current label.\n cur_label = null;\n panel_elt.apply_search_results(results);\n }\n });\n }\n});\n\n/**\n * View classes for Galaxy tools and tool panel.\n *\n * Views use the templates defined below for rendering. Views update as needed\n * based on (a) model/collection events and (b) user interactions; in this sense,\n * they are controllers are well and the HTML is the real view in the MVC architecture.\n */\n\n/**\n * Base view that handles visibility based on model's hidden attribute.\n */\nvar BaseView = Backbone.View.extend({\n initialize: function() {\n this.model.on(\"change:hidden\", this.update_visible, this);\n this.update_visible();\n },\n update_visible: function() {\n ( this.model.attributes.hidden ? this.$el.hide() : this.$el.show() );\n }\n});\n\n/**\n * Link to a tool.\n */\nvar ToolLinkView = BaseView.extend({\n tagName: 'div',\n\n render: function() {\n // create element\n var $link = $('
              ');\n $link.append(templates.tool_link(this.model.toJSON()));\n\n var formStyle = this.model.get( 'form_style', null );\n // open upload dialog for upload tool\n if (this.model.id === 'upload1') {\n $link.find('a').on('click', function(e) {\n e.preventDefault();\n Galaxy.upload.show();\n });\n }\n else if ( formStyle === 'regular' ) { // regular tools\n var self = this;\n $link.find('a').on('click', function(e) {\n e.preventDefault();\n Galaxy.router.push( '/', { tool_id : self.model.id, version : self.model.get('version') } );\n });\n }\n\n // add element\n this.$el.append($link);\n return this;\n }\n});\n\n/**\n * Panel label/section header.\n */\nvar ToolSectionLabelView = BaseView.extend({\n tagName: 'div',\n className: 'toolPanelLabel',\n\n render: function() {\n this.$el.append( $(\"\").text(this.model.attributes.text) );\n return this;\n }\n});\n\n/**\n * Panel section.\n */\nvar ToolSectionView = BaseView.extend({\n tagName: 'div',\n className: 'toolSectionWrapper',\n\n initialize: function() {\n BaseView.prototype.initialize.call(this);\n this.model.on(\"change:open\", this.update_open, this);\n },\n\n render: function() {\n // Build using template.\n this.$el.append( templates.panel_section(this.model.toJSON()) );\n\n // Add tools to section.\n var section_body = this.$el.find(\".toolSectionBody\");\n _.each(this.model.attributes.elems, function(elt) {\n if (elt instanceof Tool) {\n var tool_view = new ToolLinkView({model: elt, className: \"toolTitle\"});\n tool_view.render();\n section_body.append(tool_view.$el);\n }\n else if (elt instanceof ToolSectionLabel) {\n var label_view = new ToolSectionLabelView({model: elt});\n label_view.render();\n section_body.append(label_view.$el);\n }\n else {\n // TODO: handle nested section bodies?\n }\n });\n return this;\n },\n\n events: {\n 'click .toolSectionTitle > a': 'toggle'\n },\n\n /**\n * Toggle visibility of tool section.\n */\n toggle: function() {\n this.model.set(\"open\", !this.model.attributes.open);\n },\n\n /**\n * Update whether section is open or close.\n */\n update_open: function() {\n (this.model.attributes.open ?\n this.$el.children(\".toolSectionBody\").slideDown(\"fast\") :\n this.$el.children(\".toolSectionBody\").slideUp(\"fast\")\n );\n }\n});\n\nvar ToolSearchView = Backbone.View.extend({\n tagName: 'div',\n id: 'tool-search',\n className: 'bar',\n\n events: {\n 'click': 'focus_and_select',\n 'keyup :input': 'query_changed',\n 'change :input': 'query_changed',\n 'click #search-clear-btn': 'clear'\n },\n\n render: function() {\n this.$el.append( templates.tool_search(this.model.toJSON()) );\n if (!this.model.is_visible()) {\n this.$el.hide();\n }\n\n // Adjust top for issue 2907 depending on whether the messagebox is visible.\n if ($(\"#messagebox\").is(\":visible\")) {\n this.$el.css(\"top\",\"95px\");\n }\n\n this.$el.find('[title]').tooltip();\n return this;\n },\n\n focus_and_select: function() {\n this.$el.find(\":input\").focus().select();\n },\n\n clear: function() {\n this.model.clear_search();\n this.$el.find(\":input\").val('');\n this.focus_and_select();\n return false;\n },\n\n query_changed: function( evData ) {\n // check for the 'clear key' (ESC) first\n if( ( this.model.attributes.clear_key ) &&\n ( this.model.attributes.clear_key === evData.which ) ){\n this.clear();\n return false;\n }\n this.model.set(\"query\", this.$el.find(\":input\").val());\n }\n});\n\n/**\n * Tool panel view. Events triggered include:\n * tool_link_click(click event, tool_model)\n */\nvar ToolPanelView = Backbone.View.extend({\n tagName: 'div',\n className: 'toolMenu',\n\n /**\n * Set up view.\n */\n initialize: function() {\n this.model.get('tool_search').on(\"change:results\", this.handle_search_results, this);\n },\n\n render: function() {\n var self = this;\n\n // Render search.\n var search_view = new ToolSearchView( { model: this.model.get('tool_search') } );\n search_view.render();\n self.$el.append(search_view.$el);\n\n // Render panel.\n this.model.get('layout').each(function(panel_elt) {\n if (panel_elt instanceof ToolSection) {\n var section_title_view = new ToolSectionView({model: panel_elt});\n section_title_view.render();\n self.$el.append(section_title_view.$el);\n }\n else if (panel_elt instanceof Tool) {\n var tool_view = new ToolLinkView({model: panel_elt, className: \"toolTitleNoSection\"});\n tool_view.render();\n self.$el.append(tool_view.$el);\n }\n else if (panel_elt instanceof ToolSectionLabel) {\n var label_view = new ToolSectionLabelView({model: panel_elt});\n label_view.render();\n self.$el.append(label_view.$el);\n }\n });\n\n // Setup tool link click eventing.\n self.$el.find(\"a.tool-link\").click(function(e) {\n // Tool id is always the first class.\n var\n tool_id = $(this).attr('class').split(/\\s+/)[0],\n tool = self.model.get('tools').get(tool_id);\n\n self.trigger(\"tool_link_click\", e, tool);\n });\n\n return this;\n },\n\n handle_search_results: function() {\n var results = this.model.get('tool_search').get('results');\n if (results && results.length === 0) {\n $(\"#search-no-results\").show();\n }\n else {\n $(\"#search-no-results\").hide();\n }\n }\n});\n\n/**\n * View for working with a tool: setting parameters and inputs and executing the tool.\n */\nvar ToolFormView = Backbone.View.extend({\n className: 'toolForm',\n\n render: function() {\n this.$el.children().remove();\n this.$el.append( templates.tool_form(this.model.toJSON()) );\n }\n});\n\n/**\n * Integrated tool menu + tool execution.\n */\nvar IntegratedToolMenuAndView = Backbone.View.extend({\n className: 'toolMenuAndView',\n\n initialize: function() {\n this.tool_panel_view = new ToolPanelView({collection: this.collection});\n this.tool_form_view = new ToolFormView();\n },\n\n render: function() {\n // Render and append tool panel.\n this.tool_panel_view.render();\n this.tool_panel_view.$el.css(\"float\", \"left\");\n this.$el.append(this.tool_panel_view.$el);\n\n // Append tool form view.\n this.tool_form_view.$el.hide();\n this.$el.append(this.tool_form_view.$el);\n\n // On tool link click, show tool.\n var self = this;\n this.tool_panel_view.on(\"tool_link_click\", function(e, tool) {\n // Prevents click from activating link:\n e.preventDefault();\n // Show tool that was clicked on:\n self.show_tool(tool);\n });\n },\n\n /**\n * Fetch and display tool.\n */\n show_tool: function(tool) {\n var self = this;\n tool.fetch().done( function() {\n self.tool_form_view.model = tool;\n self.tool_form_view.render();\n self.tool_form_view.$el.show();\n $('#left').width(\"650px\");\n });\n }\n});\n\n// TODO: move into relevant views\nvar templates = {\n // the search bar at the top of the tool panel\n tool_search : _.template([\n '\" autocomplete=\"off\" type=\"text\" />',\n ' ',\n //TODO: replace with icon\n '',\n ].join('')),\n\n // the category level container in the tool panel (e.g. 'Get Data', 'Text Manipulation')\n panel_section : _.template([\n '
              \">',\n '<%- name %>',\n '
              ',\n '
              \" class=\"toolSectionBody\" style=\"display: none;\">',\n '
              ',\n '
              '\n ].join('')),\n\n // a single tool's link in the tool panel; will load the tool form in the center panel\n tool_link : _.template([\n ' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">',\n '',\n '<% _.each( labels, function( label ){ %>',\n '\">',\n '<%- label %>',\n '',\n '<% }); %>',\n '',\n '',\n '<%- name %>',\n '',\n ' <%- description %>',\n ''\n ].join('')),\n\n // the tool form for entering tool parameters, viewing help and executing the tool\n // loaded when a tool link is clicked in the tool panel\n tool_form : _.template([\n '
              <%- tool.name %> (version <%- tool.version %>)
              ',\n '
              ',\n '<% _.each( tool.inputs, function( input ){ %>',\n '
              ',\n '',\n '
              ',\n '<%= input.html %>',\n '
              ',\n '
              ',\n '<%- input.help %>',\n '
              ',\n '
              ',\n '
              ',\n '<% }); %>',\n '
              ',\n '
              ',\n '',\n '
              ',\n '
              ',\n '
              <% tool.help %>
              ',\n '
              ',\n // TODO: we need scoping here because 'help' is the dom for the help menu in the masthead\n // which implies a leaky variable that I can't find\n ].join(''), { variable: 'tool' }),\n};\n\n\n// Exports\nreturn {\n ToolParameter: ToolParameter,\n IntegerToolParameter: IntegerToolParameter,\n SelectToolParameter: SelectToolParameter,\n Tool: Tool,\n ToolCollection: ToolCollection,\n ToolSearch: ToolSearch,\n ToolPanel: ToolPanel,\n ToolPanelView: ToolPanelView,\n ToolFormView: ToolFormView\n};\n\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/tool/tools.js","/** This renders the content of the ftp popup **/\ndefine( [ 'utils/utils' ], function( Utils ) {\n return Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.options = Utils.merge( options, {\n class_add : 'upload-icon-button fa fa-square-o',\n class_remove : 'upload-icon-button fa fa-check-square-o',\n class_partial : 'upload-icon-button fa fa-minus-square-o',\n collection : null,\n onchange : function() {},\n onadd : function() {},\n onremove : function() {}\n } );\n this.collection = this.options.collection;\n this.setElement( this._template() );\n this.rows = [];\n Utils.get({\n url : Galaxy.root + 'api/remote_files',\n success : function( ftp_files ) { self._fill( ftp_files ) },\n error : function() { self._fill(); }\n });\n },\n\n /** Fill table with ftp entries */\n _fill: function( ftp_files ) {\n if ( ftp_files && ftp_files.length > 0 ) {\n this.$( '.upload-ftp-content' ).html( $( this._templateTable() ) );\n var size = 0;\n for (var index in ftp_files ) {\n this.rows.push( this._add( ftp_files[ index ] ) );\n size += ftp_files[ index ].size;\n }\n this.$( '.upload-ftp-number' ).html( ftp_files.length + ' files' );\n this.$( '.upload-ftp-disk' ).html( Utils.bytesToString ( size, true ) );\n if ( this.collection ) {\n var self = this;\n this.$( '._has_collection' ).show();\n this.$select_all = this.$( '.upload-selectall' ).addClass( this.options.class_add );\n this.$select_all.on( 'click', function() {\n var add = self.$select_all.hasClass( self.options.class_add );\n for (var index in ftp_files ) {\n var ftp_file = ftp_files[ index ];\n var model_index = self._find( ftp_file );\n if( !model_index && add || model_index && !add ) {\n self.rows[ index ].trigger( 'click' );\n }\n }\n });\n this._refresh();\n }\n } else {\n this.$( '.upload-ftp-content' ).html( $( this._templateInfo() ) );\n }\n this.$( '.upload-ftp-wait' ).hide();\n },\n\n /** Add file to table */\n _add: function( ftp_file ) {\n var self = this;\n var $it = $( this._templateRow( ftp_file ) );\n var $icon = $it.find( '.icon' );\n this.$( 'tbody' ).append( $it );\n if ( this.collection ) {\n $icon.addClass( this._find( ftp_file ) ? this.options.class_remove : this.options.class_add );\n $it.on('click', function() {\n var model_index = self._find( ftp_file );\n $icon.removeClass();\n if ( !model_index ) {\n self.options.onadd( ftp_file );\n $icon.addClass( self.options.class_remove );\n } else {\n self.options.onremove( model_index );\n $icon.addClass( self.options.class_add );\n }\n self._refresh();\n });\n } else {\n $it.on('click', function() { self.options.onchange( ftp_file ) } );\n }\n return $it;\n },\n\n /** Refresh select all button state */\n _refresh: function() {\n var filtered = this.collection.where( { file_mode: 'ftp', enabled: true } );\n this.$select_all.removeClass();\n if ( filtered.length == 0 ) {\n this.$select_all.addClass( this.options.class_add );\n } else {\n this.$select_all.addClass( filtered.length == this.rows.length ? this.options.class_remove : this.options.class_partial );\n }\n },\n\n /** Get model index */\n _find: function( ftp_file ) {\n var item = this.collection.findWhere({\n file_path : ftp_file.path,\n file_mode : 'ftp',\n enabled : true\n });\n return item && item.get('id');\n },\n\n /** Template of row */\n _templateRow: function( options ) {\n return '
              ' + _.escape(options.path) + '' + Utils.bytesToString( options.size ) + '' + options.ctime + '
              ' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '
              NameSizeCreated
              ';\n },\n\n /** Template of info message */\n _templateInfo: function() {\n return '
              ' +\n 'Your FTP directory does not contain any files.' +\n '
              ';\n },\n\n /** Template of main view */\n _template: function() {\n return '
              ' +\n '
              ' +\n '
              This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at ' + this.options.ftp_upload_site + ' using your Galaxy credentials (email address and password).
              ' +\n '
              ' +\n '
              ';\n }\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/upload/upload-ftp.js","/** This renders the content of the settings popup, allowing users to specify flags i.e. for space-to-tab conversion **/\ndefine( [ 'utils/utils' ], function( Utils ) {\n return Backbone.View.extend({\n options: {\n class_check : 'fa-check-square-o',\n class_uncheck : 'fa-square-o',\n parameters : [{\n id : 'space_to_tab',\n title : 'Convert spaces to tabs',\n },{\n id : 'to_posix_lines',\n title : 'Use POSIX standard'\n }]\n },\n\n initialize: function( options ) {\n var self = this;\n this.model = options.model;\n this.setElement( $( '
              ' ).addClass( 'upload-settings' ) );\n this.$el.append( $( '
              ' ).addClass( 'upload-settings-cover' ) );\n this.$el.append( $( '' ).addClass( 'upload-settings-table ui-table-striped' ).append( '' ) );\n this.$cover = this.$( '.upload-settings-cover' );\n this.$table = this.$( '.upload-settings-table > tbody' );\n this.listenTo ( this.model, 'change', this.render, this );\n this.model.trigger( 'change' );\n },\n\n render: function() {\n var self = this;\n this.$table.empty();\n _.each( this.options.parameters, function( parameter ) {\n var $checkbox = $( '
              ' ).addClass( 'upload-' + parameter.id + ' upload-icon-button fa' )\n .addClass( self.model.get( parameter.id ) && self.options.class_check || self.options.class_uncheck )\n .on( 'click', function() {\n self.model.get( 'enabled' ) && self.model.set( parameter.id, !self.model.get( parameter.id ) )\n });\n self.$table.append( $( '
              ' ).append( $( '' +\n '' +\n '' +\n '' );\n });\n $tmpl.append( $table );\n } else {\n $tmpl.append( 'No ' + this.model.get( 'plural' ).toLowerCase() + ' have been shared with you.' );\n }\n return $tmpl;\n }\n });\n\n return {\n View: View\n }\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/grid/grid-shared.js","define([\n \"mvc/dataset/dataset-li-edit\",\n \"mvc/history/hda-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET_LI_EDIT, HDA_LI, BASE_MVC, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = DATASET_LI_EDIT.DatasetListItemEdit;\n/** @class Editing view for HistoryDatasetAssociation.\n */\nvar HDAListItemEdit = _super.extend(\n/** @lends HDAListItemEdit.prototype */{\n\n className : _super.prototype.className + \" history-content\",\n\n /** In this override, only get details if in the ready state, get rerunnable if in other states.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n\n // special case the need for the rerunnable and creating_job attributes\n // needed for rendering re-run button on queued, running datasets\n } else if( !view.model.has( 'rerunnable' ) ){\n return view.model.fetch({ silent: true, data: {\n // only fetch rerunnable and creating_job to keep overhead down\n keys: [ 'rerunnable', 'creating_job' ].join(',')\n }});\n }\n return jQuery.when();\n },\n\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .unhide-link' : function( ev ){ this.model.unhide(); return false; }\n }),\n\n /** string rep */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDAListItemEdit(' + modelString + ')';\n }\n});\n\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nHDAListItemEdit.prototype.templates = (function(){\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n hidden : BASE_MVC.wrapTemplate([\n '<% if( !dataset.visible ){ %>',\n // add a link to unhide a dataset\n '
              ',\n _l( 'This dataset has been hidden' ),\n '
              ', _l( 'Unhide it' ), '',\n '
              ',\n '<% } %>'\n ], 'dataset' )\n });\n\n return _.extend( {}, _super.prototype.templates, {\n //NOTE: *steal* the HDAListItemView titleBar\n titleBar : HDA_LI.HDAListItemView.prototype.templates.titleBar,\n warnings : warnings\n });\n}());\n\n\n//==============================================================================\n return {\n HDAListItemEdit : HDAListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hda-li-edit.js","define([\n \"mvc/history/hdca-li\",\n \"mvc/collection/collection-view-edit\",\n \"ui/fa-icon-button\",\n \"utils/localization\"\n], function( HDCA_LI, DC_VIEW_EDIT, faIconButton, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = HDCA_LI.HDCAListItemView;\n/** @class Editing view for HistoryDatasetCollectionAssociation.\n */\nvar HDCAListItemEdit = _super.extend(\n/** @lends HDCAListItemEdit.prototype */{\n\n /** logger used to record this.log messages, commonly set to console */\n //logger : console,\n\n /** Override to return editable versions of the collection panels */\n _getFoldoutPanelClass : function(){\n switch( this.model.get( 'collection_type' ) ){\n case 'list':\n return DC_VIEW_EDIT.ListCollectionViewEdit;\n case 'paired':\n return DC_VIEW_EDIT.PairCollectionViewEdit;\n case 'list:paired':\n return DC_VIEW_EDIT.ListOfPairsCollectionViewEdit;\n case 'list:list':\n return DC_VIEW_EDIT.ListOfListsCollectionViewEdit;\n }\n throw new TypeError( 'Uknown collection_type: ' + this.model.get( 'collection_type' ) );\n },\n\n // ......................................................................... delete\n /** In this override, add the delete button. */\n _renderPrimaryActions : function(){\n this.log( this + '._renderPrimaryActions' );\n // render the display, edit attr and delete icon-buttons\n return _super.prototype._renderPrimaryActions.call( this )\n .concat([\n this._renderDeleteButton()\n ]);\n },\n\n /** Render icon-button to delete this collection. */\n _renderDeleteButton : function(){\n var self = this,\n deleted = this.model.get( 'deleted' );\n return faIconButton({\n title : deleted? _l( 'Dataset collection is already deleted' ): _l( 'Delete' ),\n classes : 'delete-btn',\n faIcon : 'fa-times',\n disabled : deleted,\n onclick : function() {\n // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n self.$el.find( '.icon-btn.delete-btn' ).trigger( 'mouseout' );\n self.model[ 'delete' ]();\n }\n });\n },\n\n // ......................................................................... misc\n /** string rep */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDCAListItemEdit(' + modelString + ')';\n }\n});\n\n//==============================================================================\n return {\n HDCAListItemEdit : HDCAListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hdca-li-edit.js","/** This class renders the grid list. */\ndefine( [ 'utils/utils', 'mvc/grid/grid-view', 'mvc/history/history-model', 'mvc/history/copy-dialog' ], function( Utils, GridView, HistoryModel, historyCopyDialog ) {\n\n var View = Backbone.View.extend({\n title: \"Histories\",\n initialize: function( options ) {\n var self = this;\n this.setElement( $( '
              ' ) );\n this.model = new Backbone.Model();\n Utils.get({\n url : Galaxy.root + 'history/' + options.action_id,\n success : function( response ) {\n response[ 'dict_format' ] = true;\n _.each( response[ 'operations' ], function( operation ) {\n if ( operation.label == 'Copy' ) {\n operation.onclick = function( id ) { self._showCopyDialog( id ) };\n }\n });\n self.model.set( response );\n self.render();\n }\n });\n },\n\n render: function() {\n var grid = new GridView( this.model.attributes );\n this.$el.empty().append( grid.$el );\n },\n\n _showCopyDialog: function( id ) {\n var history = new HistoryModel.History( { id : id } );\n history.fetch()\n .fail( function() {\n alert( 'History could not be fetched. Please contact an administrator' );\n })\n .done( function(){\n historyCopyDialog( history, {} ).done( function() {\n if( window.parent && window.parent.Galaxy && window.parent.Galaxy.currHistoryPanel ) {\n window.parent.Galaxy.currHistoryPanel.loadCurrentHistory();\n }\n window.location.reload( true );\n } );\n });\n }\n });\n\n return {\n View: View\n }\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-list.js","define([\n \"mvc/history/history-model\",\n \"mvc/history/history-view-edit\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( HISTORY_MODEL, HISTORY_VIEW_EDIT, BASE_MVC, _l ){\n\n'use strict';\n\n// ============================================================================\n/** session storage for history panel preferences (and to maintain state)\n */\nvar HistoryViewPrefs = BASE_MVC.SessionStorageModel.extend(\n/** @lends HistoryViewPrefs.prototype */{\n defaults : {\n /** should the tags editor be shown or hidden initially? */\n tagsEditorShown : false,\n /** should the annotation editor be shown or hidden initially? */\n annotationEditorShown : false,\n ///** what is the currently focused content (dataset or collection) in the current history?\n // * (the history panel will highlight and scroll to the focused content view)\n // */\n //focusedContentId : null\n /** Current scroll position */\n scrollPosition : 0\n },\n toString : function(){\n return 'HistoryViewPrefs(' + JSON.stringify( this.toJSON() ) + ')';\n }\n});\n\n/** key string to store panel prefs (made accessible on class so you can access sessionStorage directly) */\nHistoryViewPrefs.storageKey = function storageKey(){\n return ( 'history-panel' );\n};\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\nvar _super = HISTORY_VIEW_EDIT.HistoryViewEdit;\n// used in root/index.mako\n/** @class View/Controller for the user's current history model as used in the history\n * panel (current right hand panel) of the analysis page.\n *\n * The only history panel that:\n * will poll for updates.\n * displays datasets in reverse hid order.\n */\nvar CurrentHistoryView = _super.extend(/** @lends CurrentHistoryView.prototype */{\n\n className : _super.prototype.className + ' current-history-panel',\n\n /** override to use drilldown (and not foldout) for how collections are displayed */\n HDCAViewClass : _super.prototype.HDCAViewClass.extend({\n foldoutStyle : 'drilldown'\n }),\n\n emptyMsg : [\n _l( 'This history is empty' ), '. ',\n _l( 'You can ' ),\n '',\n _l( 'load your own data' ),\n '',\n _l( ' or ' ),\n '',\n _l( 'get data from an external source' ),\n ''\n ].join(''),\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events */\n initialize : function( attributes ){\n attributes = attributes || {};\n\n // ---- persistent preferences\n /** maintain state / preferences over page loads */\n this.preferences = new HistoryViewPrefs( _.extend({\n id : HistoryViewPrefs.storageKey()\n }, _.pick( attributes, _.keys( HistoryViewPrefs.prototype.defaults ) )));\n\n _super.prototype.initialize.call( this, attributes );\n\n /** sub-views that will overlay this panel (collections) */\n this.panelStack = [];\n\n /** id of currently focused content */\n this.currentContentId = attributes.currentContentId || null;\n //NOTE: purposely not sent to localstorage since panel recreation roughly lines up with a reset of this value\n },\n\n /** Override to cache the current scroll position with a listener */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n\n var panel = this;\n // reset scroll position when there's a new history\n this.on( 'new-model', function(){\n panel.preferences.set( 'scrollPosition', 0 );\n });\n },\n\n // ------------------------------------------------------------------------ loading history/item models\n // TODO: next three more appropriate moved to the app level\n /** (re-)loads the user's current history & contents w/ details */\n loadCurrentHistory : function(){\n return this.loadHistory( null, { url : Galaxy.root + 'history/current_history_json' });\n },\n\n /** loads a history & contents w/ details and makes them the current history */\n switchToHistory : function( historyId, attributes ){\n if( Galaxy.user.isAnonymous() ){\n this.trigger( 'error', _l( 'You must be logged in to switch histories' ), _l( 'Anonymous user' ) );\n return $.when();\n }\n return this.loadHistory( historyId, { url : Galaxy.root + 'history/set_as_current?id=' + historyId });\n },\n\n /** creates a new history on the server and sets it as the user's current history */\n createNewHistory : function( attributes ){\n if( Galaxy.user.isAnonymous() ){\n this.trigger( 'error', _l( 'You must be logged in to create histories' ), _l( 'Anonymous user' ) );\n return $.when();\n }\n return this.loadHistory( null, { url : Galaxy.root + 'history/create_new_current' });\n },\n\n /** release/free/shutdown old models and set up panel for new models */\n setModel : function( model, attributes, render ){\n _super.prototype.setModel.call( this, model, attributes, render );\n if( this.model && this.model.id ){\n this.log( 'checking for updates' );\n this.model.checkForUpdates();\n }\n return this;\n },\n\n // ------------------------------------------------------------------------ history/content event listening\n /** listening for history events */\n _setUpModelListeners : function(){\n _super.prototype._setUpModelListeners.call( this );\n // re-broadcast any model change events so that listeners don't have to re-bind to each history\n return this.listenTo( this.model, {\n 'change:nice_size change:size' : function(){\n this.trigger( 'history-size-change', this, this.model, arguments );\n },\n 'change:id' : function(){\n this.once( 'loading-done', function(){ this.model.checkForUpdates(); });\n }\n });\n },\n\n /** listening for collection events */\n _setUpCollectionListeners : function(){\n _super.prototype._setUpCollectionListeners.call( this );\n // if a hidden item is created (gen. by a workflow), moves thru the updater to the ready state,\n // then: remove it from the collection if the panel is set to NOT show hidden datasets\n this.listenTo( this.collection, 'state:ready', function( model, newState, oldState ){\n if( ( !model.get( 'visible' ) )\n && ( !this.collection.storage.includeHidden() ) ){\n this.removeItemView( model );\n }\n });\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** override to add a handler to capture the scroll position when the parent scrolls */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n // console.log( '_setUpBehaviors', this.$scrollContainer( $where ).get(0), this.$list( $where ) );\n // we need to call this in _setUpBehaviors which is called after render since the $el\n // may not be attached to $el.parent and $scrollContainer() may not work\n var panel = this;\n _super.prototype._setUpBehaviors.call( panel, $where );\n\n // cache the handler to remove and re-add so we don't pile up the handlers\n if( !this._debouncedScrollCaptureHandler ){\n this._debouncedScrollCaptureHandler = _.debounce( function scrollCapture(){\n // cache the scroll position (only if visible)\n if( panel.$el.is( ':visible' ) ){\n panel.preferences.set( 'scrollPosition', $( this ).scrollTop() );\n }\n }, 40 );\n }\n\n panel.$scrollContainer( $where )\n .off( 'scroll', this._debouncedScrollCaptureHandler )\n .on( 'scroll', this._debouncedScrollCaptureHandler );\n return panel;\n },\n\n /** In this override, handle null models and move the search input to the top */\n _buildNewRender : function(){\n if( !this.model ){ return $(); }\n var $newRender = _super.prototype._buildNewRender.call( this );\n $newRender.find( '.search' ).prependTo( $newRender.find( '> .controls' ) );\n this._renderQuotaMessage( $newRender );\n return $newRender;\n },\n\n /** render the message displayed when a user is over quota and can't run jobs */\n _renderQuotaMessage : function( $whereTo ){\n $whereTo = $whereTo || this.$el;\n return $( this.templates.quotaMsg( {}, this ) ).prependTo( $whereTo.find( '.messages' ) );\n },\n\n /** In this override, get and set current panel preferences when editor is used */\n _renderTags : function( $where ){\n var panel = this;\n // render tags and show/hide based on preferences\n _super.prototype._renderTags.call( panel, $where );\n if( panel.preferences.get( 'tagsEditorShown' ) ){\n panel.tagsEditor.toggle( true );\n }\n // store preference when shown or hidden\n panel.listenTo( panel.tagsEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden',\n function( tagsEditor ){\n panel.preferences.set( 'tagsEditorShown', tagsEditor.hidden );\n }\n );\n },\n\n /** In this override, get and set current panel preferences when editor is used */\n _renderAnnotation : function( $where ){\n var panel = this;\n // render annotation and show/hide based on preferences\n _super.prototype._renderAnnotation.call( panel, $where );\n if( panel.preferences.get( 'annotationEditorShown' ) ){\n panel.annotationEditor.toggle( true );\n }\n // store preference when shown or hidden\n panel.listenTo( panel.annotationEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden',\n function( annotationEditor ){\n panel.preferences.set( 'annotationEditorShown', annotationEditor.hidden );\n }\n );\n },\n\n /** Override to scroll to cached position (in prefs) after swapping */\n _swapNewRender : function( $newRender ){\n _super.prototype._swapNewRender.call( this, $newRender );\n var panel = this;\n _.delay( function(){\n var pos = panel.preferences.get( 'scrollPosition' );\n if( pos ){\n panel.scrollTo( pos, 0 );\n }\n }, 10 );\n //TODO: is this enough of a delay on larger histories?\n\n return this;\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** Override to add the current-content highlight class to currentContentId's view */\n _attachItems : function( $whereTo ){\n _super.prototype._attachItems.call( this, $whereTo );\n var panel = this;\n if( panel.currentContentId ){\n panel._setCurrentContentById( panel.currentContentId );\n }\n return this;\n },\n\n /** Override to remove any drill down panels */\n addItemView : function( model, collection, options ){\n var view = _super.prototype.addItemView.call( this, model, collection, options );\n if( !view ){ return view; }\n if( this.panelStack.length ){ return this._collapseDrilldownPanel(); }\n return view;\n },\n\n // ------------------------------------------------------------------------ collection sub-views\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n _super.prototype._setUpItemViewListeners.call( panel, view );\n // use pub-sub to: handle drilldown expansion and collapse\n return panel.listenTo( view, {\n 'expanded:drilldown' : function( v, drilldown ){\n this._expandDrilldownPanel( drilldown );\n },\n 'collapsed:drilldown' : function( v, drilldown ){\n this._collapseDrilldownPanel( drilldown );\n },\n });\n },\n\n /** display 'current content': add a visible highlight and store the id of a content item */\n setCurrentContent : function( view ){\n this.$( '.history-content.current-content' ).removeClass( 'current-content' );\n if( view ){\n view.$el.addClass( 'current-content' );\n this.currentContentId = view.model.id;\n } else {\n this.currentContentId = null;\n }\n },\n\n /** find the view with the id and then call setCurrentContent on it */\n _setCurrentContentById : function( id ){\n var view = this.viewFromModelId( id ) || null;\n this.setCurrentContent( view );\n },\n\n /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n _expandDrilldownPanel : function( drilldown ){\n this.panelStack.push( drilldown );\n // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n this.$controls().add( this.$list() ).hide();\n drilldown.parentName = this.model.get( 'name' );\n drilldown.delegateEvents().render().$el.appendTo( this.$el );\n },\n\n /** Handle drilldown close by freeing the panel and re-rendering this panel */\n _collapseDrilldownPanel : function( drilldown ){\n this.panelStack.pop();\n //TODO: MEM: free the panel\n this.$controls().add( this.$list() ).show();\n },\n\n // ........................................................................ panel events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n // the two links in the empty message\n 'click .uploader-link' : function( ev ){ Galaxy.upload.show( ev ); },\n 'click .get-data-link' : function( ev ){\n var $toolMenu = $( '.toolMenuContainer' );\n $toolMenu.parent().scrollTop( 0 );\n $toolMenu.find( 'span:contains(\"Get Data\")' ).click();\n }\n }),\n\n // ........................................................................ external objects/MVC\n listenToGalaxy : function( galaxy ){\n this.listenTo( galaxy, {\n // when the galaxy_main iframe is loaded with a new page,\n // compare the url to the following list and if there's a match\n // pull the id from url and indicate in the history view that\n // the dataset with that id is the 'current'ly active dataset\n 'center-frame:load': function( data ){\n var pathToMatch = data.fullpath;\n var hdaId = null;\n var useToURLRegexMap = {\n 'display' : /datasets\\/([a-f0-9]+)\\/display/,\n 'edit' : /datasets\\/([a-f0-9]+)\\/edit/,\n 'report_error' : /dataset\\/errors\\?id=([a-f0-9]+)/,\n 'rerun' : /tool_runner\\/rerun\\?id=([a-f0-9]+)/,\n 'show_params' : /datasets\\/([a-f0-9]+)\\/show_params/,\n // no great way to do this here? (leave it in the dataset event handlers above?)\n // 'visualization' : 'visualization',\n };\n _.find( useToURLRegexMap, function( regex, use ){\n // grab the more specific match result (1), save, and use it as the find flag\n hdaId = _.result( pathToMatch.match( regex ), 1 );\n return hdaId;\n });\n // need to type mangle to go from web route to history contents\n this._setCurrentContentById( hdaId? ( 'dataset-' + hdaId ) : null );\n },\n // when the center panel is given a new view, clear the current indicator\n 'center-panel:load': function( view ){\n this._setCurrentContentById();\n }\n });\n },\n\n //TODO: remove quota meter from panel and remove this\n /** add listeners to an external quota meter (mvc/user/user-quotameter.js) */\n connectToQuotaMeter : function( quotaMeter ){\n if( !quotaMeter ){\n return this;\n }\n // show/hide the 'over quota message' in the history when the meter tells it to\n this.listenTo( quotaMeter, 'quota:over', this.showQuotaMessage );\n this.listenTo( quotaMeter, 'quota:under', this.hideQuotaMessage );\n\n // having to add this to handle re-render of hview while overquota (the above do not fire)\n this.on( 'rendered rendered:initial', function(){\n if( quotaMeter && quotaMeter.isOverQuota() ){\n this.showQuotaMessage();\n }\n });\n return this;\n },\n\n /** Override to preserve the quota message */\n clearMessages : function( ev ){\n var $target = !_.isUndefined( ev )?\n $( ev.currentTarget )\n :this.$messages().children( '[class$=\"message\"]' );\n $target = $target.not( '.quota-message' );\n $target.fadeOut( this.fxSpeed, function(){\n $( this ).remove();\n });\n return this;\n },\n\n /** Show the over quota message (which happens to be in the history panel).\n */\n showQuotaMessage : function(){\n var $msg = this.$( '.quota-message' );\n if( $msg.is( ':hidden' ) ){ $msg.slideDown( this.fxSpeed ); }\n },\n\n /** Hide the over quota message (which happens to be in the history panel).\n */\n hideQuotaMessage : function(){\n var $msg = this.$( '.quota-message' );\n if( !$msg.is( ':hidden' ) ){ $msg.slideUp( this.fxSpeed ); }\n },\n\n // ........................................................................ options menu\n //TODO: remove to batch\n /** unhide any hidden datasets */\n unhideHidden : function() {\n var self = this;\n if( confirm( _l( 'Really unhide all hidden datasets?' ) ) ){\n // get all hidden, regardless of deleted/purged\n return self.model.contents._filterAndUpdate(\n { visible: false, deleted: '', purged: '' },\n { visible : true }\n ).done( function(){\n // TODO: would be better to render these as they're unhidden instead of all at once\n if( !self.model.contents.includeHidden ){\n self.renderItems();\n }\n });\n }\n return jQuery.when();\n },\n\n /** delete any hidden datasets */\n deleteHidden : function() {\n var self = this;\n if( confirm( _l( 'Really delete all hidden datasets?' ) ) ){\n return self.model.contents._filterAndUpdate(\n // get all hidden, regardless of deleted/purged\n { visible: false, deleted: '', purged: '' },\n // both delete *and* unhide them\n { deleted : true, visible: true }\n );\n }\n return jQuery.when();\n },\n\n /** Return a string rep of the history */\n toString : function(){\n return 'CurrentHistoryView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//------------------------------------------------------------------------------ TEMPLATES\nCurrentHistoryView.prototype.templates = (function(){\n\n var quotaMsgTemplate = BASE_MVC.wrapTemplate([\n '
              ',\n _l( 'You are over your disk quota' ), '. ',\n _l( 'Tool execution is on hold until your disk usage drops below your allocated quota' ), '.',\n '
              '\n ], 'history' );\n return _.extend( _.clone( _super.prototype.templates ), {\n quotaMsg : quotaMsgTemplate\n });\n\n}());\n\n\n//==============================================================================\n return {\n CurrentHistoryView : CurrentHistoryView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-view-edit-current.js","define([\n \"mvc/history/history-view\",\n \"mvc/history/history-contents\",\n \"mvc/dataset/states\",\n \"mvc/history/hda-model\",\n \"mvc/history/hda-li-edit\",\n \"mvc/history/hdca-li-edit\",\n \"mvc/tag\",\n \"mvc/annotation\",\n \"mvc/collection/list-collection-creator\",\n \"mvc/collection/pair-collection-creator\",\n \"mvc/collection/list-of-pairs-collection-creator\",\n \"ui/fa-icon-button\",\n \"mvc/ui/popup-menu\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function(\n HISTORY_VIEW,\n HISTORY_CONTENTS,\n STATES,\n HDA_MODEL,\n HDA_LI_EDIT,\n HDCA_LI_EDIT,\n TAGS,\n ANNOTATIONS,\n LIST_COLLECTION_CREATOR,\n PAIR_COLLECTION_CREATOR,\n LIST_OF_PAIRS_COLLECTION_CREATOR,\n faIconButton,\n PopupMenu,\n BASE_MVC,\n _l\n){\n\n'use strict';\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\nvar _super = HISTORY_VIEW.HistoryView;\n// base class for history-view-edit-current and used as-is in history/view.mako\n/** @class Editable View/Controller for the history model.\n *\n * Allows:\n * (everything HistoryView allows)\n * changing the name\n * displaying and editing tags and annotations\n * multi-selection and operations on mulitple content items\n */\nvar HistoryViewEdit = _super.extend(\n/** @lends HistoryViewEdit.prototype */{\n\n /** class to use for constructing the HistoryDatasetAssociation views */\n HDAViewClass : HDA_LI_EDIT.HDAListItemEdit,\n /** class to use for constructing the HistoryDatasetCollectionAssociation views */\n HDCAViewClass : HDCA_LI_EDIT.HDCAListItemEdit,\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes\n */\n initialize : function( attributes ){\n attributes = attributes || {};\n _super.prototype.initialize.call( this, attributes );\n\n // ---- set up instance vars\n /** editor for tags - sub-view */\n this.tagsEditor = null;\n\n /** enable drag and drop - sub-view */\n this.dragItems = true;\n\n /** editor for annotations - sub-view */\n this.annotationEditor = null;\n\n /** allow user purge of dataset files? */\n this.purgeAllowed = attributes.purgeAllowed || false;\n\n // states/modes the panel can be in\n /** is the panel currently showing the dataset selection controls? */\n this.annotationEditorShown = attributes.annotationEditorShown || false;\n this.tagsEditorShown = attributes.tagsEditorShown || false;\n },\n\n /** Override to handle history as drag-drop target */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n return this.on({\n 'droptarget:drop': function( ev, data ){\n // process whatever was dropped and re-hide the drop target\n this.dataDropped( data );\n this.dropTargetOff();\n },\n 'view:attached view:removed': function(){\n this._renderCounts();\n },\n 'search:loading-progress': this._renderSearchProgress,\n 'search:searching': this._renderSearchFindings,\n });\n },\n\n // ------------------------------------------------------------------------ listeners\n /** listening for history and HDA events */\n _setUpModelListeners : function(){\n _super.prototype._setUpModelListeners.call( this );\n this.listenTo( this.model, 'change:size', this.updateHistoryDiskSize );\n return this;\n },\n\n /** listening for collection events */\n _setUpCollectionListeners : function(){\n _super.prototype._setUpCollectionListeners.call( this );\n this.listenTo( this.collection, {\n 'change:deleted': this._handleItemDeletedChange,\n 'change:visible': this._handleItemVisibleChange,\n 'change:purged' : function( model ){\n // hafta get the new nice-size w/o the purged model\n this.model.fetch();\n },\n // loading indicators for deleted/hidden\n 'fetching-deleted' : function( collection ){\n this.$( '> .controls .deleted-count' )\n .html( '' + _l( 'loading...' ) + '' );\n },\n 'fetching-hidden' : function( collection ){\n this.$( '> .controls .hidden-count' )\n .html( '' + _l( 'loading...' ) + '' );\n },\n 'fetching-deleted-done fetching-hidden-done' : this._renderCounts,\n });\n return this;\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** In this override, add tag and annotation editors and a btn to toggle the selectors */\n _buildNewRender : function(){\n // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n var $newRender = _super.prototype._buildNewRender.call( this );\n if( !this.model ){ return $newRender; }\n\n if( Galaxy && Galaxy.user && Galaxy.user.id && Galaxy.user.id === this.model.get( 'user_id' ) ){\n this._renderTags( $newRender );\n this._renderAnnotation( $newRender );\n }\n return $newRender;\n },\n\n /** Update the history size display (curr. upper right of panel). */\n updateHistoryDiskSize : function(){\n this.$( '.history-size' ).text( this.model.get( 'nice_size' ) );\n },\n\n /** override to render counts when the items are rendered */\n renderItems : function( $whereTo ){\n var views = _super.prototype.renderItems.call( this, $whereTo );\n if( !this.searchFor ){ this._renderCounts( $whereTo ); }\n else{ this._renderSearchFindings( $whereTo ); }\n return views;\n },\n\n /** override to show counts, what's deleted/hidden, and links to toggle those */\n _renderCounts : function( $whereTo ){\n $whereTo = $whereTo instanceof jQuery? $whereTo : this.$el;\n var html = this.templates.counts( this.model.toJSON(), this );\n return $whereTo.find( '> .controls .subtitle' ).html( html );\n },\n\n /** render the tags sub-view controller */\n _renderTags : function( $where ){\n var panel = this;\n this.tagsEditor = new TAGS.TagsEditor({\n model : this.model,\n el : $where.find( '.controls .tags-display' ),\n onshowFirstTime : function(){ this.render(); },\n // show hide sub-view tag editors when this is shown/hidden\n onshow : function(){\n panel.toggleHDATagEditors( true, panel.fxSpeed );\n },\n onhide : function(){\n panel.toggleHDATagEditors( false, panel.fxSpeed );\n },\n $activator : faIconButton({\n title : _l( 'Edit history tags' ),\n classes : 'history-tag-btn',\n faIcon : 'fa-tags'\n }).appendTo( $where.find( '.controls .actions' ) )\n });\n },\n /** render the annotation sub-view controller */\n _renderAnnotation : function( $where ){\n var panel = this;\n this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n model : this.model,\n el : $where.find( '.controls .annotation-display' ),\n onshowFirstTime : function(){ this.render(); },\n // show hide sub-view view annotation editors when this is shown/hidden\n onshow : function(){\n panel.toggleHDAAnnotationEditors( true, panel.fxSpeed );\n },\n onhide : function(){\n panel.toggleHDAAnnotationEditors( false, panel.fxSpeed );\n },\n $activator : faIconButton({\n title : _l( 'Edit history annotation' ),\n classes : 'history-annotate-btn',\n faIcon : 'fa-comment'\n }).appendTo( $where.find( '.controls .actions' ) )\n });\n },\n\n /** Set up HistoryViewEdit js/widget behaviours\n * In this override, make the name editable\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n _super.prototype._setUpBehaviors.call( this, $where );\n if( !this.model ){ return; }\n\n // anon users shouldn't have access to any of the following\n if( ( !Galaxy.user || Galaxy.user.isAnonymous() )\n || ( Galaxy.user.id !== this.model.get( 'user_id' ) ) ){\n return;\n }\n\n var panel = this,\n nameSelector = '> .controls .name';\n $where.find( nameSelector )\n .attr( 'title', _l( 'Click to rename history' ) )\n .tooltip({ placement: 'bottom' })\n .make_text_editable({\n on_finish: function( newName ){\n var previousName = panel.model.get( 'name' );\n if( newName && newName !== previousName ){\n panel.$el.find( nameSelector ).text( newName );\n panel.model.save({ name: newName })\n .fail( function(){\n panel.$el.find( nameSelector ).text( panel.model.previous( 'name' ) );\n });\n } else {\n panel.$el.find( nameSelector ).text( previousName );\n }\n }\n });\n },\n\n /** return a new popup menu for choosing a multi selection action\n * ajax calls made for multiple datasets are queued\n */\n multiselectActions : function(){\n var panel = this,\n actions = [\n { html: _l( 'Hide datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.hide;\n panel.getSelectedModels().ajaxQueue( action );\n }\n },\n { html: _l( 'Unhide datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.unhide;\n panel.getSelectedModels().ajaxQueue( action );\n }\n },\n { html: _l( 'Delete datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype['delete'];\n panel.getSelectedModels().ajaxQueue( action );\n }\n },\n { html: _l( 'Undelete datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.undelete;\n panel.getSelectedModels().ajaxQueue( action );\n }\n }\n ];\n if( panel.purgeAllowed ){\n actions.push({\n html: _l( 'Permanently delete datasets' ), func: function(){\n if( confirm( _l( 'This will permanently remove the data in your datasets. Are you sure?' ) ) ){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.purge;\n panel.getSelectedModels().ajaxQueue( action );\n }\n }\n });\n }\n actions = actions.concat( panel._collectionActions() );\n return actions;\n },\n\n /** */\n _collectionActions : function(){\n var panel = this;\n return [\n { html: _l( 'Build Dataset List' ), func: function() { panel.buildCollection( \"list\") }\n },\n // TODO: Only show quick pair if two things selected.\n { html: _l( 'Build Dataset Pair' ), func: function() { panel.buildCollection( \"paired\") }\n },\n { html: _l( 'Build List of Dataset Pairs' ), func: function() { panel.buildCollection( \"list:paired\" ) }\n },\n ];\n },\n\n buildCollection : function( collectionType, selection, hideSourceItems ) {\n var panel = this;\n var selection = selection || panel.getSelectedModels();\n var hideSourceItems = hideSourceItems || false;\n var createFunc;\n if( collectionType == \"list\" ) {\n createFunc = LIST_COLLECTION_CREATOR.createListCollection;\n } else if( collectionType == \"paired\" ) {\n createFunc = PAIR_COLLECTION_CREATOR.createPairCollection;\n } else if( collectionType == \"list:paired\" ) {\n createFunc = LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection;\n } else {\n console.warn( \"Unknown collectionType encountered \" + collectionType );\n }\n createFunc( selection, hideSourceItems ).done( function() { panel.model.refresh() } );\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** In this override, add purgeAllowed and whether tags/annotation editors should be shown */\n _getItemViewOptions : function( model ){\n var options = _super.prototype._getItemViewOptions.call( this, model );\n _.extend( options, {\n purgeAllowed : this.purgeAllowed,\n tagsEditorShown : ( this.tagsEditor && !this.tagsEditor.hidden ),\n annotationEditorShown : ( this.annotationEditor && !this.annotationEditor.hidden )\n });\n return options;\n },\n\n /** If this item is deleted and we're not showing deleted items, remove the view\n * @param {Model} the item model to check\n */\n _handleItemDeletedChange : function( itemModel ){\n if( itemModel.get( 'deleted' ) ){\n this._handleItemDeletion( itemModel );\n } else {\n this._handleItemUndeletion( itemModel );\n }\n this._renderCounts();\n },\n\n _handleItemDeletion : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.deleted += 1;\n contentsShown.active -= 1;\n if( !this.model.contents.includeDeleted ){\n this.removeItemView( itemModel );\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n _handleItemUndeletion : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.deleted -= 1;\n if( !this.model.contents.includeDeleted ){\n contentsShown.active -= 1;\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n /** If this item is hidden and we're not showing hidden items, remove the view\n * @param {Model} the item model to check\n */\n _handleItemVisibleChange : function( itemModel ){\n if( itemModel.hidden() ){\n this._handleItemHidden( itemModel );\n } else {\n this._handleItemUnhidden( itemModel );\n }\n this._renderCounts();\n },\n\n _handleItemHidden : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.hidden += 1;\n contentsShown.active -= 1;\n if( !this.model.contents.includeHidden ){\n this.removeItemView( itemModel );\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n _handleItemUnhidden : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.hidden -= 1;\n if( !this.model.contents.includeHidden ){\n contentsShown.active -= 1;\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n /** toggle the visibility of each content's tagsEditor applying all the args sent to this function */\n toggleHDATagEditors : function( showOrHide, speed ){\n _.each( this.views, function( view ){\n if( view.tagsEditor ){\n view.tagsEditor.toggle( showOrHide, speed );\n }\n });\n },\n\n /** toggle the visibility of each content's annotationEditor applying all the args sent to this function */\n toggleHDAAnnotationEditors : function( showOrHide, speed ){\n _.each( this.views, function( view ){\n if( view.annotationEditor ){\n view.annotationEditor.toggle( showOrHide, speed );\n }\n });\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .show-selectors-btn' : 'toggleSelectors',\n 'click .toggle-deleted-link' : function( ev ){ this.toggleShowDeleted(); },\n 'click .toggle-hidden-link' : function( ev ){ this.toggleShowHidden(); }\n }),\n\n // ------------------------------------------------------------------------ search\n _renderSearchProgress : function( limit, offset ){\n var stop = limit + offset;\n return this.$( '> .controls .subtitle' ).html([\n '',\n _l( 'Searching ' ), stop, '/', this.model.contentsShown(),\n ''\n ].join(''));\n },\n\n /** override to display number found in subtitle */\n _renderSearchFindings : function( $whereTo ){\n $whereTo = $whereTo instanceof jQuery? $whereTo : this.$el;\n var html = this.templates.found( this.model.toJSON(), this );\n $whereTo.find( '> .controls .subtitle' ).html( html );\n return this;\n },\n\n // ------------------------------------------------------------------------ as drop target\n /** turn all the drag and drop handlers on and add some help text above the drop area */\n dropTargetOn : function(){\n if( this.dropTarget ){ return this; }\n this.dropTarget = true;\n\n //TODO: to init\n var dropHandlers = {\n 'dragenter' : _.bind( this.dragenter, this ),\n 'dragover' : _.bind( this.dragover, this ),\n 'dragleave' : _.bind( this.dragleave, this ),\n 'drop' : _.bind( this.drop, this )\n };\n\n var $dropTarget = this._renderDropTarget();\n this.$list().before([ this._renderDropTargetHelp(), $dropTarget ]);\n for( var evName in dropHandlers ){\n if( dropHandlers.hasOwnProperty( evName ) ){\n //console.debug( evName, dropHandlers[ evName ] );\n $dropTarget.on( evName, dropHandlers[ evName ] );\n }\n }\n return this;\n },\n\n /** render a box to serve as a 'drop here' area on the history */\n _renderDropTarget : function(){\n this.$( '.history-drop-target' ).remove();\n return $( '
              ' ).addClass( 'history-drop-target' );\n },\n\n /** tell the user how it works */\n _renderDropTargetHelp : function(){\n this.$( '.history-drop-target-help' ).remove();\n return $( '
              ' ).addClass( 'history-drop-target-help' )\n .text( _l( 'Drag datasets here to copy them to the current history' ) );\n },\n\n /** shut down drag and drop event handlers and remove drop target */\n dropTargetOff : function(){\n if( !this.dropTarget ){ return this; }\n //this.log( 'dropTargetOff' );\n this.dropTarget = false;\n var dropTarget = this.$( '.history-drop-target' ).get(0);\n for( var evName in this._dropHandlers ){\n if( this._dropHandlers.hasOwnProperty( evName ) ){\n dropTarget.off( evName, this._dropHandlers[ evName ] );\n }\n }\n this.$( '.history-drop-target' ).remove();\n this.$( '.history-drop-target-help' ).remove();\n return this;\n },\n /** toggle the target on/off */\n dropTargetToggle : function(){\n if( this.dropTarget ){\n this.dropTargetOff();\n } else {\n this.dropTargetOn();\n }\n return this;\n },\n\n dragenter : function( ev ){\n //console.debug( 'dragenter:', this, ev );\n ev.preventDefault();\n ev.stopPropagation();\n this.$( '.history-drop-target' ).css( 'border', '2px solid black' );\n },\n dragover : function( ev ){\n ev.preventDefault();\n ev.stopPropagation();\n },\n dragleave : function( ev ){\n //console.debug( 'dragleave:', this, ev );\n ev.preventDefault();\n ev.stopPropagation();\n this.$( '.history-drop-target' ).css( 'border', '1px dashed black' );\n },\n /** when (text) is dropped try to parse as json and trigger an event */\n drop : function( ev ){\n ev.preventDefault();\n //ev.stopPropagation();\n\n var self = this;\n var dataTransfer = ev.originalEvent.dataTransfer;\n var data = dataTransfer.getData( \"text\" );\n\n dataTransfer.dropEffect = 'move';\n try {\n data = JSON.parse( data );\n } catch( err ){\n self.warn( 'error parsing JSON from drop:', data );\n }\n\n self.trigger( 'droptarget:drop', ev, data, self );\n return false;\n },\n\n /** handler that copies data into the contents */\n dataDropped : function( data ){\n var self = this;\n // HDA: dropping will copy it to the history\n if( _.isObject( data ) && data.model_class === 'HistoryDatasetAssociation' && data.id ){\n if( self.contents.currentPage !== 0 ){\n return self.contents.fetchPage( 0 )\n .then( function(){\n return self.model.contents.copy( data.id );\n });\n }\n return self.model.contents.copy( data.id );\n }\n return jQuery.when();\n },\n\n // ........................................................................ misc\n /** Return a string rep of the history */\n toString : function(){\n return 'HistoryViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n//------------------------------------------------------------------------------ TEMPLATES\nHistoryViewEdit.prototype.templates = (function(){\n\n var countsTemplate = BASE_MVC.wrapTemplate([\n '<% var shown = Math.max( view.views.length, history.contents_active.active ) %>',\n '<% if( shown ){ %>',\n '',\n '<%- shown %> ', _l( 'shown' ),\n '',\n '<% } %>',\n\n '<% if( history.contents_active.deleted ){ %>',\n '',\n '<% if( view.model.contents.includeDeleted ){ %>',\n '',\n _l( 'hide deleted' ),\n '',\n '<% } else { %>',\n '<%- history.contents_active.deleted %> ',\n '',\n _l( 'deleted' ),\n '',\n '<% } %>',\n '',\n '<% } %>',\n\n '<% if( history.contents_active.hidden ){ %>',\n '',\n '<% if( view.model.contents.includeHidden ){ %>',\n '',\n _l( 'hide hidden' ),\n '',\n '<% } else { %>',\n '<%- history.contents_active.hidden %> ',\n '',\n _l( 'hidden' ),\n '',\n '<% } %>',\n '',\n '<% } %>',\n ], 'history' );\n\n var foundTemplate = BASE_MVC.wrapTemplate([\n _l( 'Found' ), ' <%- view.views.length %>, ',\n\n '<% if( history.contents_active.deleted ){ %>',\n '<% if( view.model.contents.includeDeleted ){ %>',\n '',\n _l( 'hide deleted' ),\n ', ',\n '<% } else { %>',\n '',\n _l( 'show deleted' ),\n ', ',\n '<% } %>',\n '<% } %>',\n\n '<% if( history.contents_active.hidden ){ %>',\n '<% if( view.model.contents.includeHidden ){ %>',\n '',\n _l( 'hide hidden' ),\n '',\n '<% } else { %>',\n '',\n _l( 'show hidden' ),\n '',\n '<% } %>',\n '<% } %>',\n ], 'history' );\n\n return _.extend( _.clone( _super.prototype.templates ), {\n counts : countsTemplate,\n found : foundTemplate \n });\n}());\n\n\n//==============================================================================\n return {\n HistoryViewEdit : HistoryViewEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-view-edit.js","define([\n \"mvc/list/list-view\",\n \"mvc/history/history-model\",\n \"mvc/history/history-contents\",\n \"mvc/history/history-preferences\",\n \"mvc/history/hda-li\",\n \"mvc/history/hdca-li\",\n \"mvc/user/user-model\",\n \"mvc/ui/error-modal\",\n \"ui/fa-icon-button\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/search-input\"\n], function(\n LIST_VIEW,\n HISTORY_MODEL,\n HISTORY_CONTENTS,\n HISTORY_PREFS,\n HDA_LI,\n HDCA_LI,\n USER,\n ERROR_MODAL,\n faIconButton,\n BASE_MVC,\n _l\n){\n'use strict';\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a history model.\n * Allows:\n * changing the loaded history\n * displaying data, info, and download\n * tracking history attrs: size, tags, annotations, name, etc.\n * Does not allow:\n * changing the name\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar HistoryView = _super.extend(\n/** @lends HistoryView.prototype */{\n _logNamespace : 'history',\n\n /** class to use for constructing the HDA views */\n HDAViewClass : HDA_LI.HDAListItemView,\n /** class to use for constructing the HDCA views */\n HDCAViewClass : HDCA_LI.HDCAListItemView,\n /** class to used for constructing collection of sub-view models */\n collectionClass : HISTORY_CONTENTS.HistoryContents,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey : 'contents',\n\n tagName : 'div',\n className : _super.prototype.className + ' history-panel',\n\n /** string to display when the collection is empty */\n emptyMsg : _l( 'This history is empty' ),\n /** displayed when no items match the search terms */\n noneFoundMsg : _l( 'No matching datasets found' ),\n /** string used for search placeholder */\n searchPlaceholder : _l( 'search datasets' ),\n\n /** @type {Number} ms to wait after history load to fetch/decorate hdcas with element_count */\n FETCH_COLLECTION_COUNTS_DELAY : 2000,\n\n // ......................................................................... SET UP\n /** Set up the view, bind listeners.\n * @param {Object} attributes optional settings for the panel\n */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n // ---- instance vars\n // control contents/behavior based on where (and in what context) the panel is being used\n /** where should pages from links be displayed? (default to new tab/window) */\n this.linkTarget = attributes.linkTarget || '_blank';\n },\n\n /** create and return a collection for when none is initially passed */\n _createDefaultCollection : function(){\n // override\n return new this.collectionClass([], { history: this.model });\n },\n\n /** In this override, clear the update timer on the model */\n freeModel : function(){\n _super.prototype.freeModel.call( this );\n if( this.model ){\n this.model.clearUpdateTimeout();\n }\n return this;\n },\n\n /** create any event listeners for the panel\n * @fires: rendered:initial on the first render\n * @fires: empty-history when switching to a history with no contents or creating a new history\n */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n this.on({\n error : function( model, xhr, options, msg, details ){\n this.errorHandler( model, xhr, options, msg, details );\n },\n 'loading-done' : function(){\n var self = this;\n // after the initial load, decorate with more time consuming fields (like HDCA element_counts)\n _.delay( function(){\n self.model.contents.fetchCollectionCounts();\n }, self.FETCH_COLLECTION_COUNTS_DELAY );\n },\n 'views:ready view:attached view:removed' : function( view ){\n this._renderSelectButton();\n },\n 'view:attached' : function( view ){\n this.scrollTo(0);\n },\n });\n // this.on( 'all', function(){ console.debug( arguments ); });\n },\n\n // ------------------------------------------------------------------------ loading history/hda models\n /** load the history with the given id then it's contents, sending ajax options to both */\n loadHistory : function( historyId, options, contentsOptions ){\n contentsOptions = _.extend( contentsOptions || { silent: true });\n this.info( 'loadHistory:', historyId, options, contentsOptions );\n var self = this;\n self.setModel( new HISTORY_MODEL.History({ id : historyId }) );\n\n contentsOptions.silent = true;\n self.trigger( 'loading' );\n return self.model\n .fetchWithContents( options, contentsOptions )\n .always( function(){\n self.render();\n self.trigger( 'loading-done' );\n });\n },\n\n /** convenience alias to the model. Updates the item list only (not the history) */\n refreshContents : function( options ){\n if( this.model ){\n return this.model.refresh( options );\n }\n // may have callbacks - so return an empty promise\n return $.when();\n },\n\n /** Override to reset web storage when the id changes (since it needs the id) */\n _setUpCollectionListeners : function(){\n _super.prototype._setUpCollectionListeners.call( this );\n return this.listenTo( this.collection, {\n // 'all' : function(){ console.log( this.collection + ':', arguments ); },\n 'fetching-more' : function(){\n this._toggleContentsLoadingIndicator( true );\n this.$emptyMessage().hide();\n },\n 'fetching-more-done': function(){ this._toggleContentsLoadingIndicator( false ); },\n });\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n _showLoadingIndicator : function( msg, speed, callback ){\n var $indicator = $( '
              ' );\n this.$el.html( $indicator.text( msg ).slideDown( !_.isUndefined( speed )? speed : this.fxSpeed ) );\n },\n\n /** hide the loading indicator */\n _hideLoadingIndicator : function( speed ){\n // make speed a bit slower to compensate for slow rendering of up to 500 contents\n this.$( '.loading-indicator' ).slideUp( !_.isUndefined( speed )? speed : ( this.fxSpeed + 200 ), function(){\n $( this ).remove();\n });\n },\n\n /** In this override, add a btn to toggle the selectors */\n _buildNewRender : function(){\n var $newRender = _super.prototype._buildNewRender.call( this );\n this._renderSelectButton( $newRender );\n return $newRender;\n },\n\n /** button for starting select mode */\n _renderSelectButton : function( $where ){\n $where = $where || this.$el;\n // do not render selector option if no actions\n if( !this.multiselectActions().length ){\n return null;\n }\n // do not render (and remove even) if nothing to select\n if( !this.views.length ){\n this.hideSelectors();\n $where.find( '.controls .actions .show-selectors-btn' ).remove();\n return null;\n }\n // don't bother rendering if there's one already\n var $existing = $where.find( '.controls .actions .show-selectors-btn' );\n if( $existing.length ){\n return $existing;\n }\n\n return faIconButton({\n title : _l( 'Operations on multiple datasets' ),\n classes : 'show-selectors-btn',\n faIcon : 'fa-check-square-o'\n }).prependTo( $where.find( '.controls .actions' ) );\n },\n\n /** override to avoid showing intial empty message using contents_active */\n _renderEmptyMessage : function( $whereTo ){\n var self = this;\n var $emptyMsg = self.$emptyMessage( $whereTo );\n\n var empty = self.model.get( 'contents_active' ).active <= 0;\n if( empty ){\n return $emptyMsg.empty().append( self.emptyMsg ).show();\n\n } else if( self.searchFor && self.model.contents.haveSearchDetails() && !self.views.length ){\n return $emptyMsg.empty().append( self.noneFoundMsg ).show();\n }\n $emptyMsg.hide();\n return $();\n },\n\n /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n $scrollContainer : function( $where ){\n // override or set via attributes.$scrollContainer\n return this.$list( $where );\n },\n\n // ------------------------------------------------------------------------ subviews\n _toggleContentsLoadingIndicator : function( show ){\n if( !show ){\n this.$list().find( '.contents-loading-indicator' ).remove();\n } else {\n this.$list().html( '
              '\n + '
              ' );\n }\n },\n\n /** override to render pagination also */\n renderItems: function( $whereTo ){\n // console.log( this + '.renderItems-----------------', new Date() );\n $whereTo = $whereTo || this.$el;\n var self = this;\n var $list = self.$list( $whereTo );\n\n // TODO: bootstrap hack to remove orphaned tooltips\n $( '.tooltip' ).remove();\n\n $list.empty();\n self.views = [];\n\n var models = self._filterCollection();\n if( models.length ){\n self._renderPagination( $whereTo );\n self.views = self._renderSomeItems( models, $list );\n } else {\n // TODO: consolidate with _renderPagination above by (???) passing in models/length?\n $whereTo.find( '> .controls .list-pagination' ).empty();\n }\n self._renderEmptyMessage( $whereTo ).toggle( !models.length );\n\n self.trigger( 'views:ready', self.views );\n return self.views;\n },\n\n /** render pagination controls if not searching and contents says we're paginating */\n _renderPagination: function( $whereTo ){\n var $paginationControls = $whereTo.find( '> .controls .list-pagination' );\n if( this.searchFor || !this.model.contents.shouldPaginate() ) return $paginationControls.empty();\n\n $paginationControls.html( this.templates.pagination({\n // pagination is 1-based for the user\n current : this.model.contents.currentPage + 1,\n last : this.model.contents.getLastPage() + 1,\n }, this ));\n $paginationControls.find( 'select.pages' ).tooltip();\n return $paginationControls;\n },\n\n /** render a subset of the entire collection (client-side pagination) */\n _renderSomeItems: function( models, $list ){\n var self = this;\n var views = [];\n $list.append( models.map( function( m ){\n var view = self._createItemView( m );\n views.push( view );\n return self._renderItemView$el( view );\n }));\n return views;\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** in this override, check if the contents would also display based on includeDeleted/hidden */\n _filterItem : function( model ){\n var self = this;\n var contents = self.model.contents;\n return ( contents.includeHidden || !model.hidden() )\n && ( contents.includeDeleted || !model.isDeletedOrPurged() )\n && ( _super.prototype._filterItem.call( self, model ) );\n },\n\n /** In this override, since history contents are mixed,\n * get the appropo view class based on history_content_type\n */\n _getItemViewClass : function( model ){\n var contentType = model.get( \"history_content_type\" );\n switch( contentType ){\n case 'dataset':\n return this.HDAViewClass;\n case 'dataset_collection':\n return this.HDCAViewClass;\n }\n throw new TypeError( 'Unknown history_content_type: ' + contentType );\n },\n\n /** in this override, add a linktarget, and expand if id is in web storage */\n _getItemViewOptions : function( model ){\n var options = _super.prototype._getItemViewOptions.call( this, model );\n return _.extend( options, {\n linkTarget : this.linkTarget,\n expanded : this.model.contents.storage.isExpanded( model.id ),\n hasUser : this.model.ownedByCurrUser()\n });\n },\n\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n _super.prototype._setUpItemViewListeners.call( panel, view );\n //TODO: send from content view: this.model.collection.storage.addExpanded\n // maintain a list of items whose bodies are expanded\n return panel.listenTo( view, {\n 'expanded': function( v ){\n panel.model.contents.storage.addExpanded( v.model );\n },\n 'collapsed': function( v ){\n panel.model.contents.storage.removeExpanded( v.model );\n }\n });\n },\n\n /** override to remove expandedIds from webstorage */\n collapseAll : function(){\n this.model.contents.storage.clearExpanded();\n _super.prototype.collapseAll.call( this );\n },\n\n // ------------------------------------------------------------------------ selection\n /** Override to correctly set the historyId of the new collection */\n getSelectedModels : function(){\n var collection = _super.prototype.getSelectedModels.call( this );\n collection.historyId = this.collection.historyId;\n return collection;\n },\n\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .show-selectors-btn' : 'toggleSelectors',\n 'click > .controls .prev' : '_clickPrevPage',\n 'click > .controls .next' : '_clickNextPage',\n 'change > .controls .pages' : '_changePageSelect',\n // allow (error) messages to be clicked away\n 'click .messages [class$=message]' : 'clearMessages',\n }),\n\n _clickPrevPage : function( ev ){\n this.model.clearUpdateTimeout();\n this.model.contents.fetchPrevPage();\n },\n\n _clickNextPage : function( ev ){\n this.model.clearUpdateTimeout();\n this.model.contents.fetchNextPage();\n },\n\n _changePageSelect : function( ev ){\n this.model.clearUpdateTimeout();\n var page = $( ev.currentTarget ).val();\n this.model.contents.fetchPage( page );\n },\n\n /** Toggle and store the deleted visibility and re-render items\n * @returns {Boolean} new setting\n */\n toggleShowDeleted : function( show, options ){\n show = ( show !== undefined )?( show ):( !this.model.contents.includeDeleted );\n var self = this;\n var contents = self.model.contents;\n contents.setIncludeDeleted( show, options );\n self.trigger( 'show-deleted', show );\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** Toggle and store whether to render explicity hidden contents\n * @returns {Boolean} new setting\n */\n toggleShowHidden : function( show, store, options ){\n // console.log( 'toggleShowHidden', show, store );\n show = ( show !== undefined )?( show ):( !this.model.contents.includeHidden );\n var self = this;\n var contents = self.model.contents;\n contents.setIncludeHidden( show, options );\n self.trigger( 'show-hidden', show );\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** On the first search, if there are no details - load them, then search */\n _firstSearch : function( searchFor ){\n var self = this;\n var inputSelector = '> .controls .search-input';\n this.log( 'onFirstSearch', searchFor );\n\n // if the contents already have enough details to search, search and return now\n if( self.model.contents.haveSearchDetails() ){\n self.searchItems( searchFor );\n return;\n }\n\n // otherwise, load the details progressively here\n self.$( inputSelector ).searchInput( 'toggle-loading' );\n // set this now so that only results will show during progress\n self.searchFor = searchFor;\n var xhr = self.model.contents.progressivelyFetchDetails({ silent: true })\n .progress( function( response, limit, offset ){\n self.renderItems();\n self.trigger( 'search:loading-progress', limit, offset );\n })\n .always( function(){\n self.$el.find( inputSelector ).searchInput( 'toggle-loading' );\n })\n .done( function(){\n self.searchItems( searchFor, 'force' );\n });\n },\n\n /** clear the search filters and show all views that are normally shown */\n clearSearch : function( searchFor ){\n var self = this;\n if( !self.searchFor ) return self;\n //self.log( 'onSearchClear', self );\n self.searchFor = '';\n self.trigger( 'search:clear', self );\n self.$( '> .controls .search-query' ).val( '' );\n // NOTE: silent + render prevents collection update event with merge only\n // - which causes an empty page due to event handler above\n self.model.contents.fetchCurrentPage({ silent: true })\n .done( function(){\n self.renderItems();\n });\n return self;\n },\n\n // ........................................................................ error handling\n /** Event handler for errors (from the panel, the history, or the history's contents)\n * Alternately use two strings for model and xhr to use custom message and title (respectively)\n * @param {Model or View} model the (Backbone) source of the error\n * @param {XMLHTTPRequest} xhr any ajax obj. assoc. with the error\n * @param {Object} options the options map commonly used with bbone ajax\n */\n errorHandler : function( model, xhr, options ){\n //TODO: to mixin or base model\n // interrupted ajax or no connection\n if( xhr && xhr.status === 0 && xhr.readyState === 0 ){\n // return ERROR_MODAL.offlineErrorModal();\n // fail silently\n return;\n }\n // otherwise, leave something to report in the console\n this.error( model, xhr, options );\n // and feedback to a modal\n // if sent two strings (and possibly details as 'options'), use those as message and title\n if( _.isString( model ) && _.isString( xhr ) ){\n var message = model;\n var title = xhr;\n return ERROR_MODAL.errorModal( message, title, options );\n }\n // bad gateway\n // TODO: possibly to global handler\n if( xhr && xhr.status === 502 ){\n return ERROR_MODAL.badGatewayErrorModal();\n }\n return ERROR_MODAL.ajaxErrorModal( model, xhr, options );\n },\n\n /** Remove all messages from the panel. */\n clearMessages : function( ev ){\n var $target = !_.isUndefined( ev )?\n $( ev.currentTarget )\n :this.$messages().children( '[class$=\"message\"]' );\n $target.fadeOut( this.fxSpeed, function(){\n $( this ).remove();\n });\n return this;\n },\n\n // ........................................................................ scrolling\n /** Scrolls the panel to show the content sub-view with the given hid.\n * @param {Integer} hid the hid of item to scroll into view\n * @returns {HistoryView} the panel\n */\n scrollToHid : function( hid ){\n return this.scrollToItem( _.first( this.viewsWhereModel({ hid: hid }) ) );\n },\n\n // ........................................................................ misc\n /** utility for adding -st, -nd, -rd, -th to numbers */\n ordinalIndicator : function( number ){\n var numStr = number + '';\n switch( numStr.charAt( numStr.length - 1 )){\n case '1': return numStr + 'st';\n case '2': return numStr + 'nd';\n case '3': return numStr + 'rd';\n default : return numStr + 'th';\n }\n },\n\n /** Return a string rep of the history */\n toString : function(){\n return 'HistoryView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//------------------------------------------------------------------------------ TEMPLATES\nHistoryView.prototype.templates = (function(){\n\n var mainTemplate = BASE_MVC.wrapTemplate([\n // temp container\n '
              ',\n '
              ',\n '
                ',\n '
                ',\n '
                '\n ]);\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                ',\n '
                ',\n '
                <%- history.name %>
                ',\n '
                ',\n '
                ',\n '
                <%- history.nice_size %>
                ',\n\n '
                ',\n\n '
                ',\n '<% if( history.deleted && history.purged ){ %>',\n '
                ',\n _l( 'This history has been purged and deleted' ),\n '
                ',\n '<% } else if( history.deleted ){ %>',\n '
                ',\n _l( 'This history has been deleted' ),\n '
                ',\n '<% } else if( history.purged ){ %>',\n '
                ',\n _l( 'This history has been purged' ),\n '
                ',\n '<% } %>',\n\n '<% if( history.message ){ %>',\n // should already be localized\n '
                messagesmall\">',\n '<%= history.message.text %>',\n '
                ',\n '<% } %>',\n '
                ',\n\n // add tags and annotations\n '
                ',\n '
                ',\n\n '
                ',\n '
                ',\n '
                ',\n\n '
                ',\n '
                ',\n '',\n '',\n '
                ',\n '
                ',\n '
                ',\n '
                ',\n '
                ',\n '
                '\n ], 'history' );\n\n var paginationTemplate = BASE_MVC.wrapTemplate([\n '',\n '',\n '',\n ], 'pages' );\n\n return _.extend( _.clone( _super.prototype.templates ), {\n el : mainTemplate,\n controls : controlsTemplate,\n pagination : paginationTemplate,\n });\n}());\n\n\n//==============================================================================\n return {\n HistoryView: HistoryView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-view.js","define([\n \"mvc/ui/popup-menu\",\n \"mvc/history/copy-dialog\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"mvc/webhooks\"\n], function( PopupMenu, historyCopyDialog, BASE_MVC, _l, Webhooks ){\n\n'use strict';\n\n// ============================================================================\nvar menu = [\n {\n html : _l( 'History Lists' ),\n header : true\n },\n {\n html : _l( 'Saved Histories' ),\n href : 'histories/list',\n target : '_top'\n\n },\n {\n html : _l( 'Histories Shared with Me' ),\n href : 'histories/list_shared',\n target : '_top'\n },\n {\n html : _l( 'Current History' ),\n header : true,\n anon : true\n },\n {\n html : _l( 'Create New' ),\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel ){\n Galaxy.currHistoryPanel.createNewHistory();\n }\n },\n },\n {\n html : _l( 'Copy History' ),\n func : function() {\n historyCopyDialog( Galaxy.currHistoryPanel.model )\n .done( function(){\n Galaxy.currHistoryPanel.loadCurrentHistory();\n });\n },\n },\n {\n html : _l( 'Share or Publish' ),\n href : 'history/sharing',\n },\n {\n html : _l( 'Show Structure' ),\n href : 'history/display_structured',\n anon : true,\n },\n {\n html : _l( 'Extract Workflow' ),\n href : 'workflow/build_from_current_history',\n },\n {\n html : _l( 'Delete' ),\n anon : true,\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really delete the current history?' ) ) ){\n Galaxy.currHistoryPanel.model._delete().done(function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n {\n html : _l( 'Delete Permanently' ),\n purge : true,\n anon : true,\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel\n && confirm( _l( 'Really delete the current history permanently? This cannot be undone.' ) ) ){\n Galaxy.currHistoryPanel.model.purge().done(function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n\n\n {\n html : _l( 'Dataset Actions' ),\n header : true,\n anon : true\n },\n {\n html : _l( 'Copy Datasets' ),\n href : 'dataset/copy_datasets',\n },\n {\n html : _l( 'Dataset Security' ),\n href : 'root/history_set_default_permissions',\n },\n {\n html : _l( 'Resume Paused Jobs' ),\n href : 'history/resume_paused_jobs?current=True',\n anon : true,\n },\n {\n html : _l( 'Collapse Expanded Datasets' ),\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel ){\n Galaxy.currHistoryPanel.collapseAll();\n }\n },\n },\n {\n html : _l( 'Unhide Hidden Datasets' ),\n anon : true,\n func : function() {\n // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really unhide all hidden datasets?' ) ) ){\n $.post(Galaxy.root + \"history/adjust_hidden\",\n { 'user_action' : 'unhide' },\n function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n {\n html : _l( 'Delete Hidden Datasets' ),\n anon : true,\n func : function() {\n // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really delete all hidden datasets?' ) ) ){\n $.post(Galaxy.root + \"history/adjust_hidden\",\n { 'user_action' : 'delete' },\n function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n {\n html : _l( 'Purge Deleted Datasets' ),\n confirm : _l( 'Really delete all deleted datasets permanently? This cannot be undone.' ),\n href : 'history/purge_deleted_datasets',\n purge : true,\n anon : true,\n },\n\n\n {\n html : _l( 'Downloads' ),\n header : true\n },\n {\n html : _l( 'Export Tool Citations' ),\n href : 'history/citations',\n anon : true,\n },\n {\n html : _l( 'Export History to File' ),\n href : 'history/export_archive?preview=True',\n anon : true,\n },\n\n {\n html : _l( 'Other Actions' ),\n header : true\n },\n {\n html : _l( 'Import from File' ),\n href : 'history/import_archive',\n }\n];\n\n// Webhooks\nWebhooks.add({\n url: 'api/webhooks/history-menu/all',\n async: false, // (hypothetically) slows down the performance\n callback: function(webhooks) {\n var webhooks_menu = [];\n\n $.each(webhooks.models, function(index, model) {\n var webhook = model.toJSON();\n if (webhook.activate) {\n webhooks_menu.push({\n html : _l( webhook.config.title ),\n // func: function() {},\n anon : true\n });\n }\n });\n\n if (webhooks_menu.length > 0) {\n webhooks_menu.unshift({\n html : _l( 'Webhooks' ),\n header : true\n });\n $.merge(menu, webhooks_menu);\n }\n }\n});\n\n\nfunction buildMenu( isAnon, purgeAllowed, urlRoot ){\n return _.clone( menu ).filter( function( menuOption ){\n if( isAnon && !menuOption.anon ){\n return false;\n }\n if( !purgeAllowed && menuOption.purge ){\n return false;\n }\n\n //TODO:?? hard-coded galaxy_main\n if( menuOption.href ){\n menuOption.href = urlRoot + menuOption.href;\n menuOption.target = menuOption.target || 'galaxy_main';\n }\n\n if( menuOption.confirm ){\n menuOption.func = function(){\n if( confirm( menuOption.confirm ) ){\n galaxy_main.location = menuOption.href;\n }\n };\n }\n return true;\n });\n}\n\nvar create = function( $button, options ){\n options = options || {};\n var isAnon = options.anonymous === undefined? true : options.anonymous,\n purgeAllowed = options.purgeAllowed || false,\n menu = buildMenu( isAnon, purgeAllowed, Galaxy.root );\n //console.debug( 'menu:', menu );\n return new PopupMenu( $button, menu );\n};\n\n\n// ============================================================================\n return create;\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/options-menu.js","/** Renders the collection uploader rows */\ndefine( [ 'utils/utils', 'mvc/upload/upload-model', 'mvc/upload/upload-settings', 'mvc/ui/ui-popover', 'mvc/ui/ui-select' ],\nfunction( Utils, UploadModel, UploadSettings, Popover, Select ) {\n return Backbone.View.extend({\n /** Dictionary of upload states and associated icons */\n status_classes : {\n init : 'upload-icon-button fa fa-trash-o',\n queued : 'upload-icon fa fa-spinner fa-spin',\n running : 'upload-icon fa fa-spinner fa-spin',\n success : 'upload-icon-button fa fa-check',\n error : 'upload-icon-button fa fa-exclamation-triangle'\n },\n\n initialize: function( app, options ) {\n var self = this;\n this.app = app;\n this.model = options.model;\n this.setElement( this._template( options.model ) );\n this.$mode = this.$( '.upload-mode' );\n this.$title = this.$( '.upload-title-extended' );\n this.$text = this.$( '.upload-text' );\n this.$size = this.$( '.upload-size' );\n this.$info_text = this.$( '.upload-info-text' );\n this.$info_progress = this.$( '.upload-info-progress' );\n this.$text_content = this.$( '.upload-text-content' );\n this.$symbol = this.$( '.upload-symbol' );\n this.$progress_bar = this.$( '.upload-progress-bar' );\n this.$percentage = this.$( '.upload-percentage' );\n\n // append popup to settings icon\n this.settings = new Popover.View({\n title : 'Upload configuration',\n container : this.$( '.upload-settings' ),\n placement : 'bottom'\n });\n\n // identify default genome and extension values\n var default_genome = this.app.select_genome.value();\n var default_extension = this.app.select_extension.value();\n\n // handle click event\n this.$symbol.on('click', function() { self._removeRow(); });\n\n // handle text editing event\n this.$text_content.on( 'change input', function( e ) {\n self.model.set( { 'url_paste': $( e.target ).val(),\n 'file_size': $( e.target ).val().length } );\n });\n\n // model events\n this.listenTo( this.model, 'change:percentage', function() { self._refreshPercentage() } );\n this.listenTo( this.model, 'change:status', function() { self._refreshStatus() } );\n this.listenTo( this.model, 'change:info', function() { self._refreshInfo() } );\n this.listenTo( this.model, 'change:file_size', function() { self._refreshFileSize() } );\n this.listenTo( this.model, 'remove', function() { self.remove() } );\n this.app.collection.on('reset', function() { self.remove() } );\n },\n\n render: function() {\n var options = this.model.attributes;\n this.$title.html( _.escape( options.file_name ) );\n this.$size.html( Utils.bytesToString ( options.file_size ) );\n this.$mode.removeClass().addClass( 'upload-mode' ).addClass( 'text-primary' );\n if ( options.file_mode == 'new' ) {\n this.$text.css( { 'width' : this.$el.width() - 16 + 'px', 'top' : this.$el.height() - 8 + 'px' } ).show();\n this.$el.height( this.$el.height() - 8 + this.$text.height() + 16 );\n this.$mode.addClass( 'fa fa-edit' );\n } else if ( options.file_mode == 'local' ) {\n this.$mode.addClass( 'fa fa-laptop' );\n } else if ( options.file_mode == 'ftp' ) {\n this.$mode.addClass( 'fa fa-folder-open-o' );\n }\n },\n\n /** Refresh info text */\n _refreshInfo: function() {\n var info = this.model.get( 'info' );\n if ( info ) {\n this.$info_text.html( 'Failed: ' + info ).show();\n } else {\n this.$info_text.hide();\n }\n },\n\n /** Refresh percentage status */\n _refreshPercentage : function() {\n var percentage = parseInt( this.model.get( 'percentage' ) );\n this.$progress_bar.css( { width : percentage + '%' } );\n this.$percentage.html( percentage != 100 ? percentage + '%' : 'Adding to history...' );\n },\n\n /** Refresh status */\n _refreshStatus : function() {\n var status = this.model.get( 'status' );\n this.$symbol.removeClass().addClass( 'upload-symbol' ).addClass( this.status_classes[ status ] );\n this.model.set( 'enabled', status == 'init' );\n var enabled = this.model.get( 'enabled' );\n this.$text_content.attr( 'disabled', !enabled );\n if ( status == 'success' ) {\n this.$el.addClass( 'success' );\n this.$percentage.html( '100%' );\n }\n if ( status == 'error' ) {\n this.$el.addClass( 'danger' );\n this.$info_progress.hide();\n }\n },\n\n /** Refresh file size */\n _refreshFileSize: function() {\n this.$size.html( Utils.bytesToString ( this.model.get( 'file_size' ) ) );\n },\n\n /** Remove row */\n _removeRow: function() {\n if ( [ 'init', 'success', 'error' ].indexOf( this.model.get( 'status' ) ) !== -1 ) {\n this.app.collection.remove( this.model );\n }\n },\n\n /** Attach file info popup */\n _showSettings : function() {\n if ( !this.settings.visible ) {\n this.settings.empty();\n this.settings.append( ( new UploadSettings( this ) ).$el );\n this.settings.show();\n } else {\n this.settings.hide();\n }\n },\n\n /** View template */\n _template: function( options ) {\n return '
                ' +\n '' + '' + '' + '' + '' + '';\n\t },\n\t\n\t /** Template of table */\n\t _templateTable: function () {\n\t return 'Available files: ' + '' + '' + '  ' + '' + '' + '' + '
                ' ).append( $checkbox ) )\n .append( $( '' ).append( parameter.title ) ) )\n });\n this.$cover[ this.model.get( 'enabled' ) && 'hide' || 'show' ]();\n }\n });\n});\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/upload/upload-settings.js","/*\n galaxy upload plugins - requires FormData and XMLHttpRequest\n*/\n;(function($){\n // add event properties\n jQuery.event.props.push(\"dataTransfer\");\n\n /**\n Posts file data to the API\n */\n $.uploadpost = function (config) {\n // parse options\n var cnf = $.extend({}, {\n data : {},\n success : function() {},\n error : function() {},\n progress : function() {},\n url : null,\n maxfilesize : 2048,\n error_filesize : 'File exceeds 2GB. Please use a FTP client.',\n error_default : 'Please make sure the file is available.',\n error_server : 'Upload request failed.',\n error_login : 'Uploads require you to log in.'\n }, config);\n\n // link data\n var data = cnf.data;\n\n // check errors\n if (data.error_message) {\n cnf.error(data.error_message);\n return;\n }\n\n // construct form data\n var form = new FormData();\n for (var key in data.payload) {\n form.append(key, data.payload[key]);\n }\n\n // add files to submission\n var sizes = 0;\n for (var key in data.files) {\n var d = data.files[key];\n form.append(d.name, d.file, d.file.name);\n sizes += d.file.size;\n }\n\n // check file size, unless it's an ftp file\n if (sizes > 1048576 * cnf.maxfilesize) {\n cnf.error(cnf.error_filesize);\n return;\n }\n\n // prepare request\n var xhr = new XMLHttpRequest();\n xhr.open('POST', cnf.url, true);\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.setRequestHeader('Cache-Control', 'no-cache');\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\n // captures state changes\n xhr.onreadystatechange = function() {\n // check for request completed, server connection closed\n if (xhr.readyState == xhr.DONE) {\n // parse response\n var response = null;\n var extra_info = \"\";\n if (xhr.responseText) {\n try {\n response = jQuery.parseJSON(xhr.responseText);\n extra_info = response.err_msg;\n } catch (e) {\n response = xhr.responseText;\n extra_info = response;\n }\n }\n // pass any error to the error option\n if (xhr.status < 200 || xhr.status > 299) {\n var text = xhr.statusText;\n if (xhr.status == 403) {\n text = cnf.error_login;\n } else if (xhr.status == 0) {\n text = cnf.error_server;\n } else if (!text) {\n text = cnf.error_default;\n }\n cnf.error(text + ' (' + xhr.status + '). ' + extra_info);\n } else {\n cnf.success(response);\n }\n }\n }\n\n // prepare upload progress\n xhr.upload.addEventListener('progress', function(e) {\n if (e.lengthComputable) {\n cnf.progress(Math.round((e.loaded * 100) / e.total));\n }\n }, false);\n\n // send request\n Galaxy.emit.debug('uploadbox::uploadpost()', 'Posting following data.', cnf);\n xhr.send(form);\n }\n\n /**\n Handles the upload events drag/drop etc.\n */\n $.fn.uploadinput = function(options) {\n // initialize\n var el = this;\n var opts = $.extend({}, {\n ondragover : function() {},\n ondragleave : function() {},\n onchange : function() {},\n multiple : false\n }, options);\n\n // append hidden upload field\n var $input = $('');\n el.append($input.change(function (e) {\n opts.onchange(e.target.files);\n $(this).val('');\n }));\n\n // drag/drop events\n el.on('drop', function (e) {\n opts.ondragleave(e);\n if(e.dataTransfer) {\n opts.onchange(e.dataTransfer.files);\n e.preventDefault();\n }\n });\n el.on('dragover', function (e) {\n e.preventDefault();\n opts.ondragover(e);\n });\n el.on('dragleave', function (e) {\n e.stopPropagation();\n opts.ondragleave(e);\n });\n\n // exports\n return {\n dialog: function () {\n $input.trigger('click');\n }\n }\n }\n\n /**\n Handles the upload queue and events such as drag/drop etc.\n */\n $.fn.uploadbox = function(options) {\n // parse options\n var opts = $.extend({}, {\n dragover : function() {},\n dragleave : function() {},\n announce : function(d) {},\n initialize : function(d) {},\n progress : function(d, m) {},\n success : function(d, m) {},\n error : function(d, m) { alert(m); },\n complete : function() {}\n }, options);\n\n // file queue\n var queue = {};\n\n // queue index/length counter\n var queue_index = 0;\n var queue_length = 0;\n\n // indicates if queue is currently running\n var queue_running = false;\n var queue_stop = false;\n\n // element\n var uploadinput = $(this).uploadinput({\n multiple : true,\n onchange : function(files) { add(files); },\n ondragover : options.ondragover,\n ondragleave : options.ondragleave\n });\n\n // add new files to upload queue\n function add(files) {\n if (files && files.length && !queue_running) {\n var current_index = queue_index;\n _.each(files, function(file, key) {\n if (file.mode !== 'new' && _.filter(queue, function(f) {\n return f.name === file.name && f.size === file.size;\n }).length) {\n file.duplicate = true;\n }\n });\n _.each(files, function(file) {\n if (!file.duplicate) {\n var index = String(queue_index++);\n queue[index] = file;\n opts.announce(index, queue[index]);\n queue_length++;\n }\n });\n return current_index;\n }\n }\n\n // remove file from queue\n function remove(index) {\n if (queue[index]) {\n delete queue[index];\n queue_length--;\n }\n }\n\n // process an upload, recursive\n function process() {\n // validate\n if (queue_length == 0 || queue_stop) {\n queue_stop = false;\n queue_running = false;\n opts.complete();\n return;\n } else {\n queue_running = true;\n }\n\n // get an identifier from the queue\n var index = -1;\n for (var key in queue) {\n index = key;\n break;\n }\n\n // get current file from queue\n var file = queue[index];\n\n // remove from queue\n remove(index)\n\n // create and submit data\n $.uploadpost({\n url : opts.url,\n data : opts.initialize(index),\n success : function(message) { opts.success(index, message); process();},\n error : function(message) { opts.error(index, message); process();},\n progress : function(percentage) { opts.progress(index, percentage); }\n });\n }\n\n /*\n public interface\n */\n\n // open file browser for selection\n function select() {\n uploadinput.dialog();\n }\n\n // remove all entries from queue\n function reset(index) {\n for (index in queue) {\n remove(index);\n }\n }\n\n // initiate upload process\n function start() {\n if (!queue_running) {\n queue_running = true;\n process();\n }\n }\n\n // stop upload process\n function stop() {\n queue_stop = true;\n }\n\n // set options\n function configure(options) {\n opts = $.extend({}, opts, options);\n return opts;\n }\n\n // verify browser compatibility\n function compatible() {\n return window.File && window.FormData && window.XMLHttpRequest && window.FileList;\n }\n\n // export functions\n return {\n 'select' : select,\n 'add' : add,\n 'remove' : remove,\n 'start' : start,\n 'stop' : stop,\n 'reset' : reset,\n 'configure' : configure,\n 'compatible' : compatible\n };\n }\n})(jQuery);\n\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/utils/uploadbox.js","define([\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function( baseMVC, _l ){\n// =============================================================================\n/** A view on any model that has a 'annotation' attribute\n */\nvar AnnotationEditor = Backbone.View\n .extend( baseMVC.LoggableMixin )\n .extend( baseMVC.HiddenUntilActivatedViewMixin ).extend({\n\n tagName : 'div',\n className : 'annotation-display',\n\n /** Set up listeners, parse options */\n initialize : function( options ){\n options = options || {};\n this.tooltipConfig = options.tooltipConfig || { placement: 'bottom' };\n //console.debug( this, options );\n // only listen to the model only for changes to annotations\n this.listenTo( this.model, 'change:annotation', function(){\n this.render();\n });\n this.hiddenUntilActivated( options.$activator, options );\n },\n\n /** Build the DOM elements, call select to on the created input, and set up behaviors */\n render : function(){\n var view = this;\n this.$el.html( this._template() );\n\n //TODO: handle empties better\n this.$annotation().make_text_editable({\n use_textarea: true,\n on_finish: function( newAnnotation ){\n view.$annotation().text( newAnnotation );\n view.model.save({ annotation: newAnnotation }, { silent: true })\n .fail( function(){\n view.$annotation().text( view.model.previous( 'annotation' ) );\n });\n }\n });\n return this;\n },\n\n /** @returns {String} the html text used to build the view's DOM */\n _template : function(){\n var annotation = this.model.get( 'annotation' );\n return [\n //TODO: make prompt optional\n '',\n // set up initial tags by adding as CSV to input vals (necc. to init select2)\n '
                ',\n _.escape( annotation ),\n '
                '\n ].join( '' );\n },\n\n /** @returns {jQuery} the main element for this view */\n $annotation : function(){\n return this.$el.find( '.annotation' );\n },\n\n /** shut down event listeners and remove this view's DOM */\n remove : function(){\n this.$annotation.off();\n this.stopListening( this.model );\n Backbone.View.prototype.remove.call( this );\n },\n\n /** string rep */\n toString : function(){ return [ 'AnnotationEditor(', this.model + '', ')' ].join(''); }\n});\n// =============================================================================\nreturn {\n AnnotationEditor : AnnotationEditor\n};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/annotation.js","define([\n 'libs/underscore',\n 'libs/backbone',\n 'mvc/base-mvc',\n], function( _, Backbone, BASE_MVC ){\n'use strict';\n\n//=============================================================================\n/**\n * A Collection that can be limited/offset/re-ordered/filtered.\n * @type {Backbone.Collection}\n */\nvar ControlledFetchCollection = Backbone.Collection.extend({\n\n /** call setOrder on initialization to build the comparator based on options */\n initialize : function( models, options ){\n Backbone.Collection.prototype.initialize.call( this, models, options );\n this.setOrder( options.order || this.order, { silent: true });\n },\n\n /** set up to track order changes and re-sort when changed */\n _setUpListeners : function(){\n return this.on({\n 'changed-order' : this.sort\n });\n },\n\n /** override to provide order and offsets based on instance vars, set limit if passed,\n * and set allFetched/fire 'all-fetched' when xhr returns\n */\n fetch : function( options ){\n options = this._buildFetchOptions( options );\n // console.log( 'fetch options:', options );\n return Backbone.Collection.prototype.fetch.call( this, options );\n },\n\n /** build ajax data/parameters from options */\n _buildFetchOptions : function( options ){\n // note: we normally want options passed in to override the defaults built here\n // so most of these fns will generate defaults\n options = _.clone( options ) || {};\n var self = this;\n\n // jquery ajax option; allows multiple q/qv for filters (instead of 'q[]')\n options.traditional = true;\n\n // options.data\n // we keep limit, offset, etc. in options *as well as move it into data* because:\n // - it makes fetch calling convenient to add it to a single options map (instead of as mult. args)\n // - it allows the std. event handlers (for fetch, etc.) to have access\n // to the pagination options too\n // (i.e. this.on( 'sync', function( options ){ if( options.limit ){ ... } }))\n // however, when we send to xhr/jquery we copy them to data also so that they become API query params\n options.data = options.data || self._buildFetchData( options );\n // console.log( 'data:', options.data );\n\n // options.data.filters --> options.data.q, options.data.qv\n var filters = this._buildFetchFilters( options );\n // console.log( 'filters:', filters );\n if( !_.isEmpty( filters ) ){\n _.extend( options.data, this._fetchFiltersToAjaxData( filters ) );\n }\n // console.log( 'data:', options.data );\n return options;\n },\n\n /** Build the dictionary to send to fetch's XHR as data */\n _buildFetchData : function( options ){\n var defaults = {};\n if( this.order ){ defaults.order = this.order; }\n return _.defaults( _.pick( options, this._fetchParams ), defaults );\n },\n\n /** These attribute keys are valid params to fetch/API-index */\n _fetchParams : [\n /** model dependent string to control the order of models returned */\n 'order',\n /** limit the number of models returned from a fetch */\n 'limit',\n /** skip this number of models when fetching */\n 'offset',\n /** what series of attributes to return (model dependent) */\n 'view',\n /** individual keys to return for the models (see api/histories.index) */\n 'keys'\n ],\n\n /** add any needed filters here based on collection state */\n _buildFetchFilters : function( options ){\n // override\n return _.clone( options.filters || {} );\n },\n\n /** Convert dictionary filters to qqv style arrays */\n _fetchFiltersToAjaxData : function( filters ){\n // return as a map so ajax.data can extend from it\n var filterMap = {\n q : [],\n qv : []\n };\n _.each( filters, function( v, k ){\n // don't send if filter value is empty\n if( v === undefined || v === '' ){ return; }\n // json to python\n if( v === true ){ v = 'True'; }\n if( v === false ){ v = 'False'; }\n if( v === null ){ v = 'None'; }\n // map to k/v arrays (q/qv)\n filterMap.q.push( k );\n filterMap.qv.push( v );\n });\n return filterMap;\n },\n\n /** override to reset allFetched flag to false */\n reset : function( models, options ){\n this.allFetched = false;\n return Backbone.Collection.prototype.reset.call( this, models, options );\n },\n\n // ........................................................................ order\n order : null,\n\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators : {\n 'update_time' : BASE_MVC.buildComparator( 'update_time', { ascending: false }),\n 'update_time-asc' : BASE_MVC.buildComparator( 'update_time', { ascending: true }),\n 'create_time' : BASE_MVC.buildComparator( 'create_time', { ascending: false }),\n 'create_time-asc' : BASE_MVC.buildComparator( 'create_time', { ascending: true }),\n },\n\n /** set the order and comparator for this collection then sort with the new order\n * @event 'changed-order' passed the new order and the collection\n */\n setOrder : function( order, options ){\n options = options || {};\n var collection = this;\n var comparator = collection.comparators[ order ];\n if( _.isUndefined( comparator ) ){ throw new Error( 'unknown order: ' + order ); }\n // if( _.isUndefined( comparator ) ){ return; }\n if( comparator === collection.comparator ){ return; }\n\n var oldOrder = collection.order;\n collection.order = order;\n collection.comparator = comparator;\n\n if( !options.silent ){\n collection.trigger( 'changed-order', options );\n }\n return collection;\n },\n\n});\n\n\n//=============================================================================\n/**\n *\n */\nvar PaginatedCollection = ControlledFetchCollection.extend({\n\n /** @type {Number} limit used for each page's fetch */\n limitPerPage : 500,\n\n initialize : function( models, options ){\n ControlledFetchCollection.prototype.initialize.call( this, models, options );\n this.currentPage = options.currentPage || 0;\n },\n\n getTotalItemCount : function(){\n return this.length;\n },\n\n shouldPaginate : function(){\n return this.getTotalItemCount() >= this.limitPerPage;\n },\n\n getLastPage : function(){\n return Math.floor( this.getTotalItemCount() / this.limitPerPage );\n },\n\n getPageCount : function(){\n return this.getLastPage() + 1;\n },\n\n getPageLimitOffset : function( pageNum ){\n pageNum = this.constrainPageNum( pageNum );\n return {\n limit : this.limitPerPage,\n offset: pageNum * this.limitPerPage\n };\n },\n\n constrainPageNum : function( pageNum ){\n return Math.max( 0, Math.min( pageNum, this.getLastPage() ));\n },\n\n /** fetch the next page of data */\n fetchPage : function( pageNum, options ){\n var self = this;\n pageNum = self.constrainPageNum( pageNum );\n self.currentPage = pageNum;\n options = _.defaults( options || {}, self.getPageLimitOffset( pageNum ) );\n\n self.trigger( 'fetching-more' );\n return self.fetch( options )\n .always( function(){\n self.trigger( 'fetching-more-done' );\n });\n },\n\n fetchCurrentPage : function( options ){\n return this.fetchPage( this.currentPage, options );\n },\n\n fetchPrevPage : function( options ){\n return this.fetchPage( this.currentPage - 1, options );\n },\n\n fetchNextPage : function( options ){\n return this.fetchPage( this.currentPage + 1, options );\n },\n});\n\n\n//=============================================================================\n/**\n * A Collection that will load more elements without reseting.\n */\nvar InfinitelyScrollingCollection = ControlledFetchCollection.extend({\n\n /** @type {Number} limit used for the first fetch (or a reset) */\n limitOnFirstFetch : null,\n /** @type {Number} limit used for each subsequent fetch */\n limitPerFetch : 100,\n\n initialize : function( models, options ){\n ControlledFetchCollection.prototype.initialize.call( this, models, options );\n /** @type {Integer} number of contents to return from the first fetch */\n this.limitOnFirstFetch = options.limitOnFirstFetch || this.limitOnFirstFetch;\n /** @type {Integer} limit for every fetch after the first */\n this.limitPerFetch = options.limitPerFetch || this.limitPerFetch;\n /** @type {Boolean} are all contents fetched? */\n this.allFetched = false;\n /** @type {Integer} what was the offset of the last content returned */\n this.lastFetched = options.lastFetched || 0;\n },\n\n /** build ajax data/parameters from options */\n _buildFetchOptions : function( options ){\n // options (options for backbone.fetch and jquery.ajax generally)\n // backbone option; false here to make fetching an addititive process\n options.remove = options.remove || false;\n return ControlledFetchCollection.prototype._buildFetchOptions.call( this, options );\n },\n\n /** fetch the first 'page' of data */\n fetchFirst : function( options ){\n // console.log( 'ControlledFetchCollection.fetchFirst:', options );\n options = options? _.clone( options ) : {};\n this.allFetched = false;\n this.lastFetched = 0;\n return this.fetchMore( _.defaults( options, {\n reset : true,\n limit : this.limitOnFirstFetch,\n }));\n },\n\n /** fetch the next page of data */\n fetchMore : function( options ){\n // console.log( 'ControlledFetchCollection.fetchMore:', options );\n options = _.clone( options || {} );\n var collection = this;\n\n // console.log( 'fetchMore, options.reset:', options.reset );\n if( ( !options.reset && collection.allFetched ) ){\n return jQuery.when();\n }\n\n // TODO: this fails in the edge case where\n // the first fetch offset === limit (limit 4, offset 4, collection.length 4)\n options.offset = options.reset? 0 : ( options.offset || collection.lastFetched );\n var limit = options.limit = options.limit || collection.limitPerFetch || null;\n // console.log( 'fetchMore, limit:', limit, 'offset:', options.offset );\n\n collection.trigger( 'fetching-more' );\n return collection.fetch( options )\n .always( function(){\n collection.trigger( 'fetching-more-done' );\n })\n // maintain allFetched flag and trigger if all were fetched this time\n .done( function _postFetchMore( fetchedData ){\n var numFetched = _.isArray( fetchedData )? fetchedData.length : 0;\n collection.lastFetched += numFetched;\n // console.log( 'fetchMore, lastFetched:', collection.lastFetched );\n // anything less than a full page means we got all there is to get\n if( !limit || numFetched < limit ){\n collection.allFetched = true;\n collection.trigger( 'all-fetched', this );\n }\n }\n );\n },\n\n /** fetch all the collection */\n fetchAll : function( options ){\n // whitelist options to prevent allowing limit/offset/filters\n // (use vanilla fetch instead)\n options = options || {};\n var self = this;\n options = _.pick( options, 'silent' );\n options.filters = {};\n return self.fetch( options ).done( function( fetchData ){\n self.allFetched = true;\n self.trigger( 'all-fetched', self );\n });\n },\n});\n\n\n//==============================================================================\n return {\n ControlledFetchCollection : ControlledFetchCollection,\n PaginatedCollection : PaginatedCollection,\n InfinitelyScrollingCollection : InfinitelyScrollingCollection,\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/base/controlled-fetch-collection.js","define([\n], function( ){\n\n/* For presentation-related functionality shared across collection creators.\n Particularily overlapping functionality related to name processing and help.\n*/\nvar CollectionCreatorMixin = {\n\n /** add (or clear if clear is truthy) a validation warning to the DOM element described in what */\n _validationWarning : function( what, clear ){\n var VALIDATION_CLASS = 'validation-warning';\n if( what === 'name' ){\n what = this.$( '.collection-name' ).add( this.$( '.collection-name-prompt' ) );\n this.$( '.collection-name' ).focus().select();\n }\n if( clear ){\n what = what || this.$( '.' + VALIDATION_CLASS );\n what.removeClass( VALIDATION_CLASS );\n } else {\n what.addClass( VALIDATION_CLASS );\n }\n },\n\n _changeHideOriginals: function( ev ) {\n this.hideOriginals = this.$( '.hide-originals' ).prop(\"checked\");\n },\n\n // ........................................................................ footer\n /** handle a collection name change */\n _changeName : function( ev ){\n this._validationWarning( 'name', !!this._getName() );\n },\n\n /** check for enter key press when in the collection name and submit */\n _nameCheckForEnter : function( ev ){\n if( ev.keyCode === 13 && !this.blocking ){\n this._clickCreate();\n }\n },\n\n /** get the current collection name */\n _getName : function(){\n return _.escape( this.$( '.collection-name' ).val() );\n },\n\n // ........................................................................ header\n /** expand help */\n _clickMoreHelp : function( ev ){\n ev.stopPropagation();\n this.$( '.main-help' ).addClass( 'expanded' );\n this.$( '.more-help' ).hide();\n },\n /** collapse help */\n _clickLessHelp : function( ev ){\n ev.stopPropagation();\n this.$( '.main-help' ).removeClass( 'expanded' );\n this.$( '.more-help' ).show();\n },\n /** toggle help */\n _toggleHelp : function( ev ){\n ev.stopPropagation();\n this.$( '.main-help' ).toggleClass( 'expanded' );\n this.$( '.more-help' ).toggle();\n },\n\n /** show an alert on the top of the interface containing message (alertClass is bootstrap's alert-*) */\n _showAlert : function( message, alertClass ){\n alertClass = alertClass || 'alert-danger';\n this.$( '.main-help' ).hide();\n this.$( '.header .alert' )\n .attr( 'class', 'alert alert-dismissable' ).addClass( alertClass ).show()\n .find( '.alert-message' ).html( message );\n },\n /** hide the alerts at the top */\n _hideAlert : function( message ){\n this.$( '.main-help' ).show();\n this.$( '.header .alert' ).hide();\n },\n\n _cancelCreate: function( ev ){\n if( typeof this.oncancel === 'function' ){\n this.oncancel.call( this );\n }\n },\n\n /** attempt to create the current collection */\n _clickCreate : function( ev ){\n var name = this._getName();\n if( !name ){\n this._validationWarning( 'name' );\n } else if( !this.blocking ){\n this.createList( name );\n }\n },\n\n _setUpCommonSettings : function( attributes ) {\n this.hideOriginals = attributes.defaultHideSourceItems || false;\n },\n\n /** render the footer, completion controls, and cancel controls */\n _renderFooter : function( speed, callback ){\n var instance = this;\n var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );\n _.each( this.footerSettings, function( property, selector ) {\n this.$( selector ).prop( 'checked', instance[ property ] );\n });\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n return $footer;\n },\n\n _creatorTemplates: {\n main : _.template([\n '
                ',\n '
                ',\n '
                '\n ].join('')),\n }\n\n}\n\n//==============================================================================\n return {\n CollectionCreatorMixin: CollectionCreatorMixin\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/base-creator.js","define([\n \"mvc/list/list-view\",\n \"mvc/collection/collection-model\",\n \"mvc/collection/collection-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_VIEW, DC_MODEL, DC_LI, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a dataset collection.\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar CollectionView = _super.extend(\n/** @lends CollectionView.prototype */{\n //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n _logNamespace : logNamespace,\n\n className : _super.prototype.className + ' dataset-collection-panel',\n\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_LI.DatasetDCEListItemView,\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey : 'elements',\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the panel\n */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n this.linkTarget = attributes.linkTarget || '_blank';\n\n this.hasUser = attributes.hasUser;\n /** A stack of panels that currently cover or hide this panel */\n this.panelStack = [];\n /** The text of the link to go back to the panel containing this one */\n this.parentName = attributes.parentName;\n /** foldout or drilldown */\n this.foldoutStyle = attributes.foldoutStyle || 'foldout';\n this.downloadUrl = this.model.attributes.url + '/download';\n },\n\n _queueNewRender : function( $newRender, speed ) {\n speed = ( speed === undefined )?( this.fxSpeed ):( speed );\n var panel = this;\n panel.log( '_queueNewRender:', $newRender, speed );\n\n // TODO: jquery@1.12 doesn't change display when the elem has display: flex\n // this causes display: block for those elems after the use of show/hide animations\n // animations are removed from this view for now until fixed\n panel._swapNewRender( $newRender );\n panel.trigger( 'rendered', panel );\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** In this override, use model.getVisibleContents */\n _filterCollection : function(){\n //TODO: should *not* be model.getVisibleContents - visibility is not model related\n return this.model.getVisibleContents();\n },\n\n /** override to return proper view class based on element_type */\n _getItemViewClass : function( model ){\n //this.debug( this + '._getItemViewClass:', model );\n //TODO: subclasses use DCEViewClass - but are currently unused - decide\n switch( model.get( 'element_type' ) ){\n case 'hda':\n return this.DatasetDCEViewClass;\n case 'dataset_collection':\n return this.NestedDCDCEViewClass;\n }\n throw new TypeError( 'Unknown element type:', model.get( 'element_type' ) );\n },\n\n /** override to add link target and anon */\n _getItemViewOptions : function( model ){\n var options = _super.prototype._getItemViewOptions.call( this, model );\n return _.extend( options, {\n linkTarget : this.linkTarget,\n hasUser : this.hasUser,\n //TODO: could move to only nested: list:paired\n foldoutStyle : this.foldoutStyle\n });\n },\n\n // ------------------------------------------------------------------------ collection sub-views\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n _super.prototype._setUpItemViewListeners.call( panel, view );\n\n // use pub-sub to: handle drilldown expansion and collapse\n panel.listenTo( view, {\n 'expanded:drilldown': function( v, drilldown ){\n this._expandDrilldownPanel( drilldown );\n },\n 'collapsed:drilldown': function( v, drilldown ){\n this._collapseDrilldownPanel( drilldown );\n }\n });\n return this;\n },\n\n /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n _expandDrilldownPanel : function( drilldown ){\n this.panelStack.push( drilldown );\n // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n this.$( '> .controls' ).add( this.$list() ).hide();\n drilldown.parentName = this.model.get( 'name' );\n this.$el.append( drilldown.render().$el );\n },\n\n /** Handle drilldown close by freeing the panel and re-rendering this panel */\n _collapseDrilldownPanel : function( drilldown ){\n this.panelStack.pop();\n this.render();\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : {\n 'click .navigation .back' : 'close'\n },\n\n /** close/remove this collection panel */\n close : function( event ){\n this.remove();\n this.trigger( 'close' );\n },\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'CollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//------------------------------------------------------------------------------ TEMPLATES\nCollectionView.prototype.templates = (function(){\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                ',\n '',\n\n '
                ',\n '
                <%- collection.name || collection.element_identifier %>
                ',\n '
                ',\n '<% if( collection.collection_type === \"list\" ){ %>',\n _l( 'a list of datasets' ),\n '<% } else if( collection.collection_type === \"paired\" ){ %>',\n _l( 'a pair of datasets' ),\n '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n _l( 'a list of paired datasets' ),\n '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n _l( 'a list of dataset lists' ),\n '<% } %>',\n '
                ',\n '
                ',\n\n '
                ',\n\n '',\n '
                ',\n ], 'collection' );\n\n return _.extend( _.clone( _super.prototype.templates ), {\n controls : controlsTemplate\n });\n}());\n\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListCollectionView = CollectionView.extend(\n/** @lends ListCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_LI.DatasetDCEListItemView,\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar PairCollectionView = ListCollectionView.extend(\n/** @lends PairCollectionView.prototype */{\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'PairCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListOfPairsCollectionView = CollectionView.extend(\n/** @lends ListOfPairsCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass : PairCollectionView\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListOfPairsCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\nvar ListOfListsCollectionView = CollectionView.extend({\n\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass : PairCollectionView\n }),\n\n /** string rep */\n toString : function(){\n return 'ListOfListsCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//==============================================================================\n return {\n CollectionView : CollectionView,\n ListCollectionView : ListCollectionView,\n PairCollectionView : PairCollectionView,\n ListOfPairsCollectionView : ListOfPairsCollectionView,\n ListOfListsCollectionView : ListOfListsCollectionView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-view.js","define([\n \"mvc/dataset/states\",\n \"mvc/dataset/dataset-li\",\n \"mvc/tag\",\n \"mvc/annotation\",\n \"ui/fa-icon-button\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, DATASET_LI, TAGS, ANNOTATIONS, faIconButton, BASE_MVC, _l ){\n\n'use strict';\n//==============================================================================\nvar _super = DATASET_LI.DatasetListItemView;\n/** @class Editing view for DatasetAssociation.\n */\nvar DatasetListItemEdit = _super.extend(\n/** @lends DatasetListItemEdit.prototype */{\n\n /** set up: options */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n this.hasUser = attributes.hasUser;\n\n /** allow user purge of dataset files? */\n this.purgeAllowed = attributes.purgeAllowed || false;\n\n //TODO: move to HiddenUntilActivatedViewMixin\n /** should the tags editor be shown or hidden initially? */\n this.tagsEditorShown = attributes.tagsEditorShown || false;\n /** should the tags editor be shown or hidden initially? */\n this.annotationEditorShown = attributes.annotationEditorShown || false;\n },\n\n // ......................................................................... titlebar actions\n /** In this override, add the other two primary actions: edit and delete */\n _renderPrimaryActions : function(){\n var actions = _super.prototype._renderPrimaryActions.call( this );\n if( this.model.get( 'state' ) === STATES.NOT_VIEWABLE ){\n return actions;\n }\n // render the display, edit attr and delete icon-buttons\n return _super.prototype._renderPrimaryActions.call( this ).concat([\n this._renderEditButton(),\n this._renderDeleteButton()\n ]);\n },\n\n //TODO: move titleButtons into state renderers, remove state checks in the buttons\n\n /** Render icon-button to edit the attributes (format, permissions, etc.) this dataset. */\n _renderEditButton : function(){\n // don't show edit while uploading, in-accessible\n // DO show if in error (ala previous history panel)\n if( ( this.model.get( 'state' ) === STATES.DISCARDED )\n || ( !this.model.get( 'accessible' ) ) ){\n return null;\n }\n\n var purged = this.model.get( 'purged' ),\n deleted = this.model.get( 'deleted' ),\n editBtnData = {\n title : _l( 'Edit attributes' ),\n href : Galaxy.root + 'datasets/edit?dataset_id=' + this.model.attributes.id,\n faIcon : 'fa-pencil',\n classes : 'edit-btn'\n };\n // disable if purged or deleted and explain why in the tooltip\n if( deleted || purged ){\n editBtnData.disabled = true;\n if( purged ){\n editBtnData.title = _l( 'Cannot edit attributes of datasets removed from disk' );\n } else if( deleted ){\n editBtnData.title = _l( 'Undelete dataset to edit attributes' );\n }\n\n // disable if still uploading or new\n } else if( _.contains( [ STATES.UPLOAD, STATES.NEW ], this.model.get( 'state' ) ) ){\n editBtnData.disabled = true;\n editBtnData.title = _l( 'This dataset is not yet editable' );\n }\n return faIconButton( editBtnData );\n },\n\n /** Render icon-button to delete this hda. */\n _renderDeleteButton : function(){\n // don't show delete if...\n if( ( !this.model.get( 'accessible' ) ) ){\n return null;\n }\n\n var self = this,\n deletedAlready = this.model.isDeletedOrPurged();\n return faIconButton({\n title : !deletedAlready? _l( 'Delete' ) : _l( 'Dataset is already deleted' ),\n disabled : deletedAlready,\n faIcon : 'fa-times',\n classes : 'delete-btn',\n onclick : function() {\n // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n self.$el.find( '.icon-btn.delete-btn' ).trigger( 'mouseout' );\n self.model[ 'delete' ]();\n }\n });\n },\n\n // ......................................................................... details\n /** In this override, add tags and annotations controls, make the ? dbkey a link to editing page */\n _renderDetails : function(){\n //TODO: generalize to be allow different details for each state\n var $details = _super.prototype._renderDetails.call( this ),\n state = this.model.get( 'state' );\n\n if( !this.model.isDeletedOrPurged() && _.contains([ STATES.OK, STATES.FAILED_METADATA ], state ) ){\n this._renderTags( $details );\n this._renderAnnotation( $details );\n this._makeDbkeyEditLink( $details );\n }\n\n this._setUpBehaviors( $details );\n return $details;\n },\n\n /**************************************************************************\n * Render help button to show tool help text without rerunning the tool.\n * Issue #2100\n */\n _renderToolHelpButton : function() {\n var datasetID = this.model.attributes.dataset_id;\n var jobID = this.model.attributes.creating_job;\n var self = this;\n\n var parseToolBuild = function(data) {\n var helpString = '
                '\n if (data.name && data.help){\n helpString += 'Tool help for ' + data.name + '
                ';\n helpString += data.help;\n } else {\n helpString += 'Tool help is unavailable for this dataset.
                ';\n }\n helpString += '
                ';\n self.$el.find( '.details' ).append($.parseHTML(helpString));\n };\n var parseToolID = function(data) {\n $.ajax({\n url: Galaxy.root + 'api/tools/' + data.tool_id + '/build'\n }).done(function(data){\n parseToolBuild(data);\n }).fail(function(){\n parseToolBuild({})\n });\n };\n if (Galaxy.user.id === null){\n return null\n }\n return faIconButton({\n title: _l('Tool Help'),\n classes: 'icon-btn',\n href: '#',\n faIcon: 'fa-question',\n onclick: function() {\n var divString = 'thdiv-' + datasetID;\n if (self.$el.find(\".toolhelp\").length > 0){\n self.$el.find(\".toolhelp\").toggle();\n } else {\n $.ajax({\n url: Galaxy.root + 'api/jobs/' + jobID\n }).done(function(data){\n parseToolID(data);\n }).fail(function(){\n console.log('Failed at recovering job information from the Galaxy API for job id \"' + jobID + '\".');\n });\n }\n }\n });\n },\n //*************************************************************************\n\n /** Add less commonly used actions in the details section based on state */\n _renderSecondaryActions : function(){\n var actions = _super.prototype._renderSecondaryActions.call( this );\n switch( this.model.get( 'state' ) ){\n case STATES.UPLOAD:\n case STATES.NOT_VIEWABLE:\n return actions;\n case STATES.ERROR:\n // error button comes first\n actions.unshift( this._renderErrButton() );\n return actions.concat([ this._renderRerunButton(), this._renderToolHelpButton() ]);\n case STATES.OK:\n case STATES.FAILED_METADATA:\n return actions.concat([ this._renderRerunButton(), this._renderVisualizationsButton(), this._renderToolHelpButton() ]);\n }\n return actions.concat([ this._renderRerunButton(), this._renderToolHelpButton() ]);\n },\n\n /** Render icon-button to report an error on this dataset to the galaxy admin. */\n _renderErrButton : function(){\n return faIconButton({\n title : _l( 'View or report this error' ),\n href : Galaxy.root + 'datasets/error?dataset_id=' + this.model.attributes.id,\n classes : 'report-error-btn',\n faIcon : 'fa-bug'\n });\n },\n\n /** Render icon-button to re-run the job that created this dataset. */\n _renderRerunButton : function(){\n var creating_job = this.model.get( 'creating_job' );\n if( this.model.get( 'rerunnable' ) ){\n return faIconButton({\n title : _l( 'Run this job again' ),\n href : this.model.urls.rerun,\n classes : 'rerun-btn',\n target : this.linkTarget,\n faIcon : 'fa-refresh',\n onclick : function( ev ) {\n ev.preventDefault();\n Galaxy.router.push( '/', { job_id : creating_job } );\n }\n });\n }\n },\n\n /** Render an icon-button or popupmenu of links based on the applicable visualizations */\n _renderVisualizationsButton : function(){\n //TODO: someday - lazyload visualizations\n var visualizations = this.model.get( 'visualizations' );\n if( ( this.model.isDeletedOrPurged() )\n || ( !this.hasUser )\n || ( !this.model.hasData() )\n || ( _.isEmpty( visualizations ) ) ){\n return null;\n }\n if( !_.isObject( visualizations[0] ) ){\n this.warn( 'Visualizations have been switched off' );\n return null;\n }\n\n var $visualizations = $( this.templates.visualizations( visualizations, this ) );\n //HACK: need to re-write those directed at galaxy_main with linkTarget\n $visualizations.find( '[target=\"galaxy_main\"]').attr( 'target', this.linkTarget );\n // use addBack here to include the root $visualizations elem (for the case of 1 visualization)\n this._addScratchBookFn( $visualizations.find( '.visualization-link' ).addBack( '.visualization-link' ) );\n return $visualizations;\n },\n\n /** add scratchbook functionality to visualization links */\n _addScratchBookFn : function( $links ){\n var li = this;\n $links.click( function( ev ){\n if( Galaxy.frame && Galaxy.frame.active ){\n Galaxy.frame.add({\n title : 'Visualization',\n url : $( this ).attr( 'href' )\n });\n ev.preventDefault();\n ev.stopPropagation();\n }\n });\n },\n\n //TODO: if possible move these to readonly view - but display the owner's tags/annotation (no edit)\n /** Render the tags list/control */\n _renderTags : function( $where ){\n if( !this.hasUser ){ return; }\n var view = this;\n this.tagsEditor = new TAGS.TagsEditor({\n model : this.model,\n el : $where.find( '.tags-display' ),\n onshowFirstTime : function(){ this.render(); },\n // persist state on the hda view (and not the editor) since these are currently re-created each time\n onshow : function(){ view.tagsEditorShown = true; },\n onhide : function(){ view.tagsEditorShown = false; },\n $activator : faIconButton({\n title : _l( 'Edit dataset tags' ),\n classes : 'tag-btn',\n faIcon : 'fa-tags'\n }).appendTo( $where.find( '.actions .right' ) )\n });\n if( this.tagsEditorShown ){ this.tagsEditor.toggle( true ); }\n },\n\n /** Render the annotation display/control */\n _renderAnnotation : function( $where ){\n if( !this.hasUser ){ return; }\n var view = this;\n this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n model : this.model,\n el : $where.find( '.annotation-display' ),\n onshowFirstTime : function(){ this.render(); },\n // persist state on the hda view (and not the editor) since these are currently re-created each time\n onshow : function(){ view.annotationEditorShown = true; },\n onhide : function(){ view.annotationEditorShown = false; },\n $activator : faIconButton({\n title : _l( 'Edit dataset annotation' ),\n classes : 'annotate-btn',\n faIcon : 'fa-comment'\n }).appendTo( $where.find( '.actions .right' ) )\n });\n if( this.annotationEditorShown ){ this.annotationEditor.toggle( true ); }\n },\n\n /** If the format/dbkey/genome_build isn't set, make the display a link to the edit page */\n _makeDbkeyEditLink : function( $details ){\n // make the dbkey a link to editing\n if( this.model.get( 'metadata_dbkey' ) === '?'\n && !this.model.isDeletedOrPurged() ){\n var editableDbkey = $( '?' )\n .attr( 'href', this.model.urls.edit )\n .attr( 'target', this.linkTarget );\n $details.find( '.dbkey .value' ).replaceWith( editableDbkey );\n }\n },\n\n // ......................................................................... events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .undelete-link' : '_clickUndeleteLink',\n 'click .purge-link' : '_clickPurgeLink',\n\n 'click .edit-btn' : function( ev ){ this.trigger( 'edit', this, ev ); },\n 'click .delete-btn' : function( ev ){ this.trigger( 'delete', this, ev ); },\n 'click .rerun-btn' : function( ev ){ this.trigger( 'rerun', this, ev ); },\n 'click .report-err-btn' : function( ev ){ this.trigger( 'report-err', this, ev ); },\n 'click .visualization-btn' : function( ev ){ this.trigger( 'visualize', this, ev ); },\n 'click .dbkey a' : function( ev ){ this.trigger( 'edit', this, ev ); }\n }),\n\n /** listener for item undelete (in the messages section) */\n _clickUndeleteLink : function( ev ){\n this.model.undelete();\n return false;\n },\n\n /** listener for item purge (in the messages section) */\n _clickPurgeLink : function( ev ){\n if( confirm( _l( 'This will permanently remove the data in your dataset. Are you sure?' ) ) ){\n this.model.purge();\n }\n return false;\n },\n\n // ......................................................................... misc\n /** string rep */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDAEditView(' + modelString + ')';\n }\n});\n\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetListItemEdit.prototype.templates = (function(){\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n failed_metadata : BASE_MVC.wrapTemplate([\n // in this override, provide a link to the edit page\n '<% if( dataset.state === \"failed_metadata\" ){ %>',\n '',\n '<% } %>'\n ], 'dataset' ),\n\n deleted : BASE_MVC.wrapTemplate([\n // in this override, provide links to undelete or purge the dataset\n '<% if( dataset.deleted && !dataset.purged ){ %>',\n // deleted not purged\n '
                ',\n _l( 'This dataset has been deleted' ),\n '
                ', _l( 'Undelete it' ), '',\n '<% if( view.purgeAllowed ){ %>',\n '
                ',\n _l( 'Permanently remove it from disk' ),\n '',\n '<% } %>',\n '
                ',\n '<% } %>'\n ], 'dataset' )\n });\n\n var visualizationsTemplate = BASE_MVC.wrapTemplate([\n '<% if( visualizations.length === 1 ){ %>',\n '\"',\n ' target=\"<%- visualizations[0].target %>\" title=\"', _l( 'Visualize in' ),\n ' <%- visualizations[0].html %>\">',\n '',\n '',\n\n '<% } else { %>',\n '
                ',\n '',\n '',\n '',\n '',\n '
                ',\n '<% } %>'\n ], 'visualizations' );\n\n return _.extend( {}, _super.prototype.templates, {\n warnings : warnings,\n visualizations : visualizationsTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n DatasetListItemEdit : DatasetListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-li-edit.js","define([\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, BASE_MVC, _l ){\n'use strict';\n\nvar logNamespace = 'dataset';\n//==============================================================================\nvar searchableMixin = BASE_MVC.SearchableModelMixin;\n/** @class base model for any DatasetAssociation (HDAs, LDDAs, DatasetCollectionDAs).\n * No knowledge of what type (HDA/LDDA/DCDA) should be needed here.\n * The DA's are made searchable (by attribute) by mixing in SearchableModelMixin.\n */\nvar DatasetAssociation = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( BASE_MVC.mixin( searchableMixin, /** @lends DatasetAssociation.prototype */{\n _logNamespace : logNamespace,\n\n /** default attributes for a model */\n defaults : {\n state : STATES.NEW,\n deleted : false,\n purged : false,\n name : '(unnamed dataset)',\n accessible : true,\n // sniffed datatype (sam, tabular, bed, etc.)\n data_type : '',\n file_ext : '',\n file_size : 0,\n\n // array of associated file types (eg. [ 'bam_index', ... ])\n meta_files : [],\n\n misc_blurb : '',\n misc_info : '',\n\n tags : []\n // do NOT default on annotation, as this default is valid and will be passed on 'save'\n // which is incorrect behavior when the model is only partially fetched (annos are not passed in summary data)\n //annotation : ''\n },\n\n /** instance vars and listeners */\n initialize : function( attributes, options ){\n this.debug( this + '(Dataset).initialize', attributes, options );\n\n //!! this state is not in trans.app.model.Dataset.states - set it here -\n if( !this.get( 'accessible' ) ){\n this.set( 'state', STATES.NOT_VIEWABLE );\n }\n\n /** Datasets rely/use some web controllers - have the model generate those URLs on startup */\n this.urls = this._generateUrls();\n\n this._setUpListeners();\n },\n\n /** returns misc. web urls for rendering things like re-run, display, etc. */\n _generateUrls : function(){\n var id = this.get( 'id' );\n if( !id ){ return {}; }\n var urls = {\n 'purge' : 'datasets/' + id + '/purge_async',\n 'display' : 'datasets/' + id + '/display/?preview=True',\n 'edit' : 'datasets/' + id + '/edit',\n 'download' : 'datasets/' + id + '/display' + this._downloadQueryParameters(),\n 'report_error' : 'dataset/errors?id=' + id,\n 'rerun' : 'tool_runner/rerun?id=' + id,\n 'show_params' : 'datasets/' + id + '/show_params',\n 'visualization' : 'visualization',\n 'meta_download' : 'dataset/get_metadata_file?hda_id=' + id + '&metadata_name='\n };\n _.each( urls, function( value, key ){\n urls[ key ] = Galaxy.root + value;\n });\n this.urls = urls;\n return urls;\n },\n\n _downloadQueryParameters : function() {\n return '?to_ext=' + this.get( 'file_ext' );\n },\n\n /** set up any event listeners\n * event: state:ready fired when this DA moves into/is already in a ready state\n */\n _setUpListeners : function(){\n // if the state has changed and the new state is a ready state, fire an event\n this.on( 'change:state', function( currModel, newState ){\n this.log( this + ' has changed state:', currModel, newState );\n if( this.inReadyState() ){\n this.trigger( 'state:ready', currModel, newState, this.previous( 'state' ) );\n }\n });\n // the download url (currently) relies on having a correct file extension\n this.on( 'change:id change:file_ext', function( currModel ){\n this._generateUrls();\n });\n },\n\n // ........................................................................ common queries\n /** override to add urls */\n toJSON : function(){\n var json = Backbone.Model.prototype.toJSON.call( this );\n //console.warn( 'returning json?' );\n //return json;\n return _.extend( json, {\n urls : this.urls\n });\n },\n\n /** Is this dataset deleted or purged? */\n isDeletedOrPurged : function(){\n return ( this.get( 'deleted' ) || this.get( 'purged' ) );\n },\n\n /** Is this dataset in a 'ready' state; where 'Ready' states are states where no\n * processing (for the ds) is left to do on the server.\n */\n inReadyState : function(){\n var ready = _.contains( STATES.READY_STATES, this.get( 'state' ) );\n return ( this.isDeletedOrPurged() || ready );\n },\n\n /** Does this model already contain detailed data (as opposed to just summary level data)? */\n hasDetails : function(){\n // if it's inaccessible assume it has everything it needs\n if( !this.get( 'accessible' ) ){ return true; }\n return this.has( 'annotation' );\n },\n\n /** Convenience function to match dataset.has_data. */\n hasData : function(){\n return ( this.get( 'file_size' ) > 0 );\n },\n\n // ........................................................................ ajax\n fetch : function( options ){\n var dataset = this;\n return Backbone.Model.prototype.fetch.call( this, options )\n .always( function(){\n dataset._generateUrls();\n });\n },\n\n /** override to use actual Dates objects for create/update times */\n parse : function( response, options ){\n var parsed = Backbone.Model.prototype.parse.call( this, response, options );\n if( parsed.create_time ){\n parsed.create_time = new Date( parsed.create_time );\n }\n if( parsed.update_time ){\n parsed.update_time = new Date( parsed.update_time );\n }\n return parsed;\n },\n\n /** override to wait by default */\n save : function( attrs, options ){\n options = options || {};\n options.wait = _.isUndefined( options.wait ) ? true : options.wait;\n return Backbone.Model.prototype.save.call( this, attrs, options );\n },\n\n //NOTE: subclasses of DA's will need to implement url and urlRoot in order to have these work properly\n /** save this dataset, _Mark_ing it as deleted (just a flag) */\n 'delete' : function( options ){\n if( this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: true }, options );\n },\n /** save this dataset, _Mark_ing it as undeleted */\n undelete : function( options ){\n if( !this.get( 'deleted' ) || this.get( 'purged' ) ){ return jQuery.when(); }\n return this.save( { deleted: false }, options );\n },\n\n /** remove the file behind this dataset from the filesystem (if permitted) */\n purge : function _purge( options ){\n //TODO: use, override model.destroy, HDA.delete({ purge: true })\n if( this.get( 'purged' ) ){ return jQuery.when(); }\n options = options || {};\n options.url = this.urls.purge;\n\n //TODO: ideally this would be a DELETE call to the api\n // using purge async for now\n var hda = this,\n xhr = jQuery.ajax( options );\n xhr.done( function( message, status, responseObj ){\n hda.set({ deleted: true, purged: true });\n });\n xhr.fail( function( xhr, status, message ){\n // Exception messages are hidden within error page including: '...not allowed in this Galaxy instance.'\n // unbury and re-add to xhr\n var error = _l( \"Unable to purge dataset\" );\n var messageBuriedInUnfortunatelyFormattedError = ( 'Removal of datasets by users '\n + 'is not allowed in this Galaxy instance' );\n if( xhr.responseJSON && xhr.responseJSON.error ){\n error = xhr.responseJSON.error;\n } else if( xhr.responseText.indexOf( messageBuriedInUnfortunatelyFormattedError ) !== -1 ){\n error = messageBuriedInUnfortunatelyFormattedError;\n }\n xhr.responseText = error;\n hda.trigger( 'error', hda, xhr, options, _l( error ), { error: error } );\n });\n return xhr;\n },\n\n // ........................................................................ searching\n /** what attributes of an HDA will be used in a text search */\n searchAttributes : [\n 'name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'\n ],\n\n /** our attr keys don't often match the labels we display to the user - so, when using\n * attribute specifiers ('name=\"bler\"') in a term, allow passing in aliases for the\n * following attr keys.\n */\n searchAliases : {\n title : 'name',\n format : 'file_ext',\n database : 'genome_build',\n blurb : 'misc_blurb',\n description : 'misc_blurb',\n info : 'misc_info',\n tag : 'tags'\n },\n\n // ........................................................................ misc\n /** String representation */\n toString : function(){\n var nameAndId = this.get( 'id' ) || '';\n if( this.get( 'name' ) ){\n nameAndId = '\"' + this.get( 'name' ) + '\",' + nameAndId;\n }\n return 'Dataset(' + nameAndId + ')';\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection for dataset associations.\n */\nvar DatasetAssociationCollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).extend(\n/** @lends HistoryContents.prototype */{\n _logNamespace : logNamespace,\n\n model : DatasetAssociation,\n\n /** root api url */\n urlRoot : Galaxy.root + 'api/datasets',\n\n /** url fn */\n url : function(){\n return this.urlRoot;\n },\n\n // ........................................................................ common queries\n /** Get the ids of every item in this collection\n * @returns array of encoded ids\n */\n ids : function(){\n return this.map( function( item ){ return item.get('id'); });\n },\n\n /** Get contents that are not ready\n * @returns array of content models\n */\n notReady : function(){\n return this.filter( function( content ){\n return !content.inReadyState();\n });\n },\n\n /** return true if any datasets don't have details */\n haveDetails : function(){\n return this.all( function( dataset ){ return dataset.hasDetails(); });\n },\n\n // ........................................................................ ajax\n /** using a queue, perform ajaxFn on each of the models in this collection */\n ajaxQueue : function( ajaxFn, options ){\n var deferred = jQuery.Deferred(),\n startingLength = this.length,\n responses = [];\n\n if( !startingLength ){\n deferred.resolve([]);\n return deferred;\n }\n\n // use reverse order (stylistic choice)\n var ajaxFns = this.chain().reverse().map( function( dataset, i ){\n return function(){\n var xhr = ajaxFn.call( dataset, options );\n // if successful, notify using the deferred to allow tracking progress\n xhr.done( function( response ){\n deferred.notify({ curr: i, total: startingLength, response: response, model: dataset });\n });\n // (regardless of previous error or success) if not last ajax call, shift and call the next\n // if last fn, resolve deferred\n xhr.always( function( response ){\n responses.push( response );\n if( ajaxFns.length ){\n ajaxFns.shift()();\n } else {\n deferred.resolve( responses );\n }\n });\n };\n }).value();\n // start the queue\n ajaxFns.shift()();\n\n return deferred;\n },\n\n // ........................................................................ sorting/filtering\n /** return a new collection of datasets whose attributes contain the substring matchesWhat */\n matches : function( matchesWhat ){\n return this.filter( function( dataset ){\n return dataset.matches( matchesWhat );\n });\n },\n\n /** String representation. */\n toString : function(){\n return ([ 'DatasetAssociationCollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n DatasetAssociation : DatasetAssociation,\n DatasetAssociationCollection : DatasetAssociationCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-model.js","define([\n \"mvc/ui/ui-modal\",\n \"mvc/ui/error-modal\",\n \"utils/localization\"\n], function( MODAL, ERROR_MODAL, _l ){\n\n'use strict';\n\n//==============================================================================\n/**\n * A dialog/modal that allows copying a user history or 'importing' from user\n * another. Generally called via historyCopyDialog below.\n * @type {Object}\n */\nvar CopyDialog = {\n\n // language related strings/fns\n defaultName : _.template( \"Copy of '<%- name %>'\" ),\n title : _.template( _l( 'Copying history' ) + ' \"<%- name %>\"' ),\n submitLabel : _l( 'Copy' ),\n errorMessage : _l( 'History could not be copied.' ),\n progressive : _l( 'Copying history' ),\n activeLabel : _l( 'Copy only the active, non-deleted datasets' ),\n allLabel : _l( 'Copy all datasets including deleted ones' ),\n anonWarning : _l( 'As an anonymous user, unless you login or register, you will lose your current history ' ) +\n _l( 'after copying this history. ' ),\n\n // template for modal body\n _template : _.template([\n //TODO: remove inline styles\n // show a warning message for losing current to anon users\n '<% if( isAnon ){ %>',\n '
                ',\n '<%- anonWarning %>',\n _l( 'You can' ),\n ' ', _l( 'login here' ), ' ', _l( 'or' ), ' ',\n ' ', _l( 'register here' ), '.',\n '
                ',\n '<% } %>',\n '
                ',\n '
                ',\n // TODO: could use required here and the form validators\n // NOTE: use unescaped here if escaped in the modal function below\n '\" />',\n '

                ',\n _l( 'Please enter a valid history title' ),\n '

                ',\n // if allowAll, add the option to copy deleted datasets, too\n '<% if( allowAll ){ %>',\n '
                ',\n '

                ', _l( 'Choose which datasets from the original history to include:' ), '

                ',\n // copy non-deleted is the default\n '/>',\n '',\n '
                ',\n '/>',\n '',\n '<% } %>',\n '
                '\n ].join( '' )),\n\n // empty modal body and let the user know the copy is happening\n _showAjaxIndicator : function _showAjaxIndicator(){\n var indicator = '

                ' + this.progressive + '...

                ';\n this.modal.$( '.modal-body' ).empty().append( indicator ).css({ 'margin-top': '8px' });\n },\n\n // (sorta) public interface - display the modal, render the form, and potentially copy the history\n // returns a jQuery.Deferred done->history copied, fail->user cancelled\n dialog : function _dialog( modal, history, options ){\n options = options || {};\n\n var dialog = this,\n deferred = jQuery.Deferred(),\n // TODO: getting a little byzantine here\n defaultCopyNameFn = options.nameFn || this.defaultName,\n defaultCopyName = defaultCopyNameFn({ name: history.get( 'name' ) }),\n // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n defaultCopyWhat = options.allDatasets? 'copy-all' : 'copy-non-deleted',\n allowAll = !_.isUndefined( options.allowAll )? options.allowAll : true,\n autoClose = !_.isUndefined( options.autoClose )? options.autoClose : true;\n\n this.modal = modal;\n\n\n // validate the name and copy if good\n function checkNameAndCopy(){\n var name = modal.$( '#copy-modal-title' ).val();\n if( !name ){\n modal.$( '.invalid-title' ).show();\n return;\n }\n // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n var copyAllDatasets = modal.$( 'input[name=\"copy-what\"]:checked' ).val() === 'copy-all';\n modal.$( 'button' ).prop( 'disabled', true );\n dialog._showAjaxIndicator();\n history.copy( true, name, copyAllDatasets )\n .done( function( response ){\n deferred.resolve( response );\n })\n .fail( function( xhr, status, message ){\n var options = { name: name, copyAllDatasets: copyAllDatasets };\n ERROR_MODAL.ajaxErrorModal( history, xhr, options, dialog.errorMessage );\n deferred.rejectWith( deferred, arguments );\n })\n .done( function(){\n if( autoClose ){ modal.hide(); }\n });\n }\n\n var originalClosingCallback = options.closing_callback;\n modal.show( _.extend( options, {\n title : this.title({ name: history.get( 'name' ) }),\n body : $( dialog._template({\n name : defaultCopyName,\n isAnon : Galaxy.user.isAnonymous(),\n allowAll : allowAll,\n copyWhat : defaultCopyWhat,\n activeLabel : this.activeLabel,\n allLabel : this.allLabel,\n anonWarning : this.anonWarning,\n })),\n buttons : _.object([\n [ _l( 'Cancel' ), function(){ modal.hide(); } ],\n [ this.submitLabel, checkNameAndCopy ]\n ]),\n height : 'auto',\n closing_events : true,\n closing_callback: function _historyCopyClose( cancelled ){\n if( cancelled ){\n deferred.reject({ cancelled : true });\n }\n if( originalClosingCallback ){\n originalClosingCallback( cancelled );\n }\n }\n }));\n\n // set the default dataset copy, autofocus the title, and set up for a simple return\n modal.$( '#copy-modal-title' ).focus().select();\n modal.$( '#copy-modal-title' ).on( 'keydown', function( ev ){\n if( ev.keyCode === 13 ){\n ev.preventDefault();\n checkNameAndCopy();\n }\n });\n\n return deferred;\n },\n};\n\n//==============================================================================\n// maintain the (slight) distinction between copy and import\n/**\n * Subclass CopyDialog to use the import language.\n */\nvar ImportDialog = _.extend( {}, CopyDialog, {\n defaultName : _.template( \"imported: <%- name %>\" ),\n title : _.template( _l( 'Importing history' ) + ' \"<%- name %>\"' ),\n submitLabel : _l( 'Import' ),\n errorMessage : _l( 'History could not be imported.' ),\n progressive : _l( 'Importing history' ),\n activeLabel : _l( 'Import only the active, non-deleted datasets' ),\n allLabel : _l( 'Import all datasets including deleted ones' ),\n anonWarning : _l( 'As an anonymous user, unless you login or register, you will lose your current history ' ) +\n _l( 'after importing this history. ' ),\n\n});\n\n//==============================================================================\n/**\n * Main interface for both history import and history copy dialogs.\n * @param {Backbone.Model} history the history to copy\n * @param {Object} options a hash\n * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n *\n * options:\n * (this object is also passed to the modal used to display the dialog and accepts modal options)\n * {Function} nameFn if defined, use this to build the default name shown to the user\n * (the fn is passed: {name: })\n * {bool} useImport if true, use the 'import' language (instead of Copy)\n * {bool} allowAll if true, allow the user to choose between copying all datasets and\n * only non-deleted datasets\n * {String} allDatasets default initial checked radio button: 'copy-all' or 'copy-non-deleted',\n */\nvar historyCopyDialog = function( history, options ){\n options = options || {};\n // create our own modal if Galaxy doesn't have one (mako tab without use_panels)\n var modal = window.parent.Galaxy.modal || new MODAL.View({});\n return options.useImport?\n ImportDialog.dialog( modal, history, options ):\n CopyDialog.dialog( modal, history, options );\n};\n\n\n//==============================================================================\n return historyCopyDialog;\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/copy-dialog.js","define([\n \"mvc/dataset/dataset-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET_LI, BASE_MVC, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = DATASET_LI.DatasetListItemView;\n/** @class Read only view for HistoryDatasetAssociation.\n * Since there are no controls on the HDAView to hide the dataset,\n * the primary thing this class does (currently) is override templates\n * to render the HID.\n */\nvar HDAListItemView = _super.extend(\n/** @lends HDAListItemView.prototype */{\n\n className : _super.prototype.className + \" history-content\",\n\n initialize : function( attributes, options ){\n _super.prototype.initialize.call( this, attributes, options );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDAListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nHDAListItemView.prototype.templates = (function(){\n\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n // adding the hid display to the title\n '
                ',\n '',\n '
                ',\n //TODO: remove whitespace and use margin-right\n '<%- dataset.hid %> ',\n '<%- dataset.name %>',\n '
                ',\n '
                ',\n '',\n '<% _.each(_.sortBy(_.uniq(dataset.tags), function(x) { return x }), function(tag){ %>',\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n '<% } %>',\n '<% }); %>',\n '',\n '
                '\n ], 'dataset' );\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n hidden : BASE_MVC.wrapTemplate([\n // add a warning when hidden\n '<% if( !dataset.visible ){ %>',\n '
                ',\n _l( 'This dataset has been hidden' ),\n '
                ',\n '<% } %>'\n ], 'dataset' )\n });\n\n return _.extend( {}, _super.prototype.templates, {\n titleBar : titleBarTemplate,\n warnings : warnings\n });\n}());\n\n\n\n//==============================================================================\n return {\n HDAListItemView : HDAListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hda-li.js","define([\n \"mvc/dataset/dataset-model\",\n \"mvc/history/history-content-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET, HISTORY_CONTENT, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\nvar _super = DATASET.DatasetAssociation,\n hcontentMixin = HISTORY_CONTENT.HistoryContentMixin;\n/** @class (HDA) model for a Galaxy dataset contained in and related to a history.\n */\nvar HistoryDatasetAssociation = _super.extend( BASE_MVC.mixin( hcontentMixin,\n/** @lends HistoryDatasetAssociation.prototype */{\n\n /** default attributes for a model */\n defaults : _.extend( {}, _super.prototype.defaults, hcontentMixin.defaults, {\n history_content_type: 'dataset',\n model_class : 'HistoryDatasetAssociation'\n }),\n}));\n\n//==============================================================================\n return {\n HistoryDatasetAssociation : HistoryDatasetAssociation\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hda-model.js","define([\n \"mvc/dataset/states\",\n \"mvc/collection/collection-li\",\n \"mvc/collection/collection-view\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, DC_LI, DC_VIEW, BASE_MVC, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = DC_LI.DCListItemView;\n/** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n */\nvar HDCAListItemView = _super.extend(\n/** @lends HDCAListItemView.prototype */{\n\n className : _super.prototype.className + \" history-content\",\n\n /** event listeners */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n this.listenTo( this.model, {\n 'change:tags change:populated change:visible' : function( model, options ){ this.render(); },\n });\n },\n\n /** Override to provide the proper collections panels as the foldout */\n _getFoldoutPanelClass : function(){\n switch( this.model.get( 'collection_type' ) ){\n case 'list':\n return DC_VIEW.ListCollectionView;\n case 'paired':\n return DC_VIEW.PairCollectionView;\n case 'list:paired':\n return DC_VIEW.ListOfPairsCollectionView;\n case 'list:list':\n return DC_VIEW.ListOfListsCollectionView;\n }\n throw new TypeError( 'Uknown collection_type: ' + this.model.get( 'collection_type' ) );\n },\n\n /** In this override, add the state as a class for use with state-based CSS */\n _swapNewRender : function( $newRender ){\n _super.prototype._swapNewRender.call( this, $newRender );\n //TODO: model currently has no state\n var state = !this.model.get( 'populated' ) ? STATES.RUNNING : STATES.OK;\n //if( this.model.has( 'state' ) ){\n this.$el.addClass( 'state-' + state );\n //}\n return this.$el;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDCAListItemView(' + modelString + ')';\n }\n});\n\n/** underscore templates */\nHDCAListItemView.prototype.templates = (function(){\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n hidden : BASE_MVC.wrapTemplate([\n // add a warning when hidden\n '<% if( !collection.visible ){ %>',\n '
                ',\n _l( 'This collection has been hidden' ),\n '
                ',\n '<% } %>'\n ], 'collection' )\n });\n\n// could steal this from hda-base (or use mixed content)\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n // adding the hid display to the title\n '
                ',\n '',\n '
                ',\n //TODO: remove whitespace and use margin-right\n '<%- collection.hid %> ',\n '<%- collection.name %>',\n '
                ',\n '
                ',\n '',\n '<% _.each(_.sortBy(_.uniq(collection.tags), function(x) { return x }), function(tag){ %>',\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n '<% } %>',\n '<% }); %>',\n '',\n '
                '\n ], 'collection' );\n\n return _.extend( {}, _super.prototype.templates, {\n warnings : warnings,\n titleBar : titleBarTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n HDCAListItemView : HDCAListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hdca-li.js","define([\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\n/** @class Mixin for HistoryContents content (HDAs, HDCAs).\n */\nvar HistoryContentMixin = {\n\n /** default attributes for a model */\n defaults : {\n /** parent (containing) history */\n history_id : null,\n /** some content_type (HistoryContents can contain mixed model classes) */\n history_content_type: null,\n /** indicating when/what order the content was generated in the context of the history */\n hid : null,\n /** whether the user wants the content shown (visible) */\n visible : true\n },\n\n // ........................................................................ mixed content element\n // In order to be part of a MIXED bbone collection, we can't rely on the id\n // (which may collide btwn models of different classes)\n // Instead, use type_id which prefixes the history_content_type so the bbone collection can differentiate\n idAttribute : 'type_id',\n\n // ........................................................................ common queries\n /** the more common alias of visible */\n hidden : function(){\n return !this.get( 'visible' );\n },\n\n//TODO: remove\n /** based on includeDeleted, includeHidden (gen. from the container control),\n * would this ds show in the list of ds's?\n * @param {Boolean} includeDeleted are we showing deleted hdas?\n * @param {Boolean} includeHidden are we showing hidden hdas?\n */\n isVisible : function( includeDeleted, includeHidden ){\n var isVisible = true;\n if( ( !includeDeleted )\n && ( this.get( 'deleted' ) || this.get( 'purged' ) ) ){\n isVisible = false;\n }\n if( ( !includeHidden )\n && ( !this.get( 'visible' ) ) ){\n isVisible = false;\n }\n return isVisible;\n },\n\n // ........................................................................ ajax\n //TODO?: these are probably better done on the leaf classes\n /** history content goes through the 'api/histories' API */\n urlRoot: Galaxy.root + 'api/histories/',\n\n /** full url spec. for this content */\n url : function(){\n var url = this.urlRoot + this.get( 'history_id' ) + '/contents/'\n + this.get('history_content_type') + 's/' + this.get( 'id' );\n return url;\n },\n\n /** save this content as not visible */\n hide : function( options ){\n if( !this.get( 'visible' ) ){ return jQuery.when(); }\n return this.save( { visible: false }, options );\n },\n /** save this content as visible */\n unhide : function( options ){\n if( this.get( 'visible' ) ){ return jQuery.when(); }\n return this.save( { visible: true }, options );\n },\n\n // ........................................................................ misc\n toString : function(){\n return ([ this.get( 'type_id' ), this.get( 'hid' ), this.get( 'name' ) ].join(':'));\n }\n};\n\n\n//==============================================================================\n return {\n HistoryContentMixin : HistoryContentMixin\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-content-model.js","define([\n \"mvc/list/list-item\",\n \"ui/loading-indicator\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/search-input\"\n], function( LIST_ITEM, LoadingIndicator, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'list';\n/* ============================================================================\nTODO:\n\n============================================================================ */\n/** @class View for a list/collection of models and the sub-views of those models.\n * Sub-views must (at least have the interface if not) inherit from ListItemView.\n * (For a list panel that also includes some 'container' model (History->HistoryContents)\n * use ModelWithListPanel)\n *\n * Allows for:\n * searching collection/sub-views\n * selecting/multi-selecting sub-views\n *\n * Currently used:\n * for dataset/dataset-choice\n * as superclass of ModelListPanel\n */\nvar ListPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(/** @lends ListPanel.prototype */{\n _logNamespace : logNamespace,\n\n /** class to use for constructing the sub-views */\n viewClass : LIST_ITEM.ListItemView,\n /** class to used for constructing collection of sub-view models */\n collectionClass : Backbone.Collection,\n\n tagName : 'div',\n className : 'list-panel',\n\n /** (in ms) that jquery effects will use */\n fxSpeed : 'fast',\n\n /** string to display when the collection has no contents */\n emptyMsg : _l( 'This list is empty' ),\n /** displayed when no items match the search terms */\n noneFoundMsg : _l( 'No matching items found' ),\n /** string used for search placeholder */\n searchPlaceholder : _l( 'search' ),\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the list\n */\n initialize : function( attributes, options ){\n attributes = attributes || {};\n // set the logger if requested\n if( attributes.logger ){\n this.logger = attributes.logger;\n }\n this.log( this + '.initialize:', attributes );\n\n // ---- instance vars\n /** how quickly should jquery fx run? */\n this.fxSpeed = _.has( attributes, 'fxSpeed' )?( attributes.fxSpeed ):( this.fxSpeed );\n\n /** filters for displaying subviews */\n this.filters = [];\n /** current search terms */\n this.searchFor = attributes.searchFor || '';\n\n /** loading indicator */\n // this.indicator = new LoadingIndicator( this.$el );\n\n /** currently showing selectors on items? */\n this.selecting = ( attributes.selecting !== undefined )? attributes.selecting : true;\n //this.selecting = false;\n\n /** cached selected item.model.ids to persist btwn renders */\n this.selected = attributes.selected || [];\n /** the last selected item.model.id */\n this.lastSelected = null;\n\n /** are sub-views draggable */\n this.dragItems = attributes.dragItems || false;\n\n /** list item view class (when passed models) */\n this.viewClass = attributes.viewClass || this.viewClass;\n\n /** list item views */\n this.views = [];\n /** list item models */\n this.collection = attributes.collection || this._createDefaultCollection();\n\n /** filter fns run over collection items to see if they should show in the list */\n this.filters = attributes.filters || [];\n\n /** override $scrollContainer fn via attributes - fn should return jq for elem to call scrollTo on */\n this.$scrollContainer = attributes.$scrollContainer || this.$scrollContainer;\n\n /** @type {String} generic title */\n this.title = attributes.title || '';\n /** @type {String} generic subtitle */\n this.subtitle = attributes.subtitle || '';\n\n this._setUpListeners();\n },\n\n // ------------------------------------------------------------------------ listeners\n /** create any event listeners for the list */\n _setUpListeners : function(){\n this.off();\n\n //TODO: move errorHandler down into list-view from history-view or\n // pass to global error handler (Galaxy)\n this.on({\n error: function( model, xhr, options, msg, details ){\n //this.errorHandler( model, xhr, options, msg, details );\n console.error( model, xhr, options, msg, details );\n },\n // show hide the loading indicator\n loading: function(){\n this._showLoadingIndicator( 'loading...', 40 );\n },\n 'loading-done': function(){\n this._hideLoadingIndicator( 40 );\n },\n });\n\n // throw the first render up as a diff namespace using once (for outside consumption)\n this.once( 'rendered', function(){\n this.trigger( 'rendered:initial', this );\n });\n\n this._setUpCollectionListeners();\n this._setUpViewListeners();\n return this;\n },\n\n /** create and return a collection for when none is initially passed */\n _createDefaultCollection : function(){\n // override\n return new this.collectionClass([]);\n },\n\n /** listening for collection events */\n _setUpCollectionListeners : function(){\n this.log( this + '._setUpCollectionListeners', this.collection );\n this.stopListening( this.collection );\n\n // bubble up error events\n this.listenTo( this.collection, {\n error : function( model, xhr, options, msg, details ){\n this.trigger( 'error', model, xhr, options, msg, details );\n },\n update : function( collection, options ){\n var changes = options.changes;\n // console.info( collection + ', update:', changes, '\\noptions:', options );\n // more than one: render everything\n if( options.renderAll || ( changes.added.length + changes.removed.length > 1 ) ){\n return this.renderItems();\n }\n // otherwise, let the single add/remove handlers do it\n if( changes.added.length === 1 ){\n return this.addItemView( _.first( changes.added ), collection, options );\n }\n if( changes.removed.length === 1 ){\n return this.removeItemView( _.first( changes.removed ), collection, options );\n }\n }\n });\n return this;\n },\n\n /** listening for sub-view events that bubble up with the 'view:' prefix */\n _setUpViewListeners : function(){\n this.log( this + '._setUpViewListeners' );\n\n // shift to select a range\n this.on({\n 'view:selected': function( view, ev ){\n if( ev && ev.shiftKey && this.lastSelected ){\n var lastSelectedView = this.viewFromModelId( this.lastSelected );\n if( lastSelectedView ){\n this.selectRange( view, lastSelectedView );\n }\n } else if( ev && ev.altKey && !this.selecting ){\n this.showSelectors();\n }\n this.selected.push( view.model.id );\n this.lastSelected = view.model.id;\n },\n\n 'view:de-selected': function( view, ev ){\n this.selected = _.without( this.selected, view.model.id );\n }\n });\n },\n\n // ------------------------------------------------------------------------ rendering\n /** Render this content, set up ui.\n * @param {Number or String} speed the speed of the render\n */\n render : function( speed ){\n this.log( this + '.render', speed );\n var $newRender = this._buildNewRender();\n this._setUpBehaviors( $newRender );\n this._queueNewRender( $newRender, speed );\n return this;\n },\n\n /** Build a temp div containing the new children for the view's $el. */\n _buildNewRender : function(){\n this.debug( this + '(ListPanel)._buildNewRender' );\n var $newRender = $( this.templates.el( {}, this ) );\n this._renderControls( $newRender );\n this._renderTitle( $newRender );\n this._renderSubtitle( $newRender );\n this._renderSearch( $newRender );\n this.renderItems( $newRender );\n return $newRender;\n },\n\n /** Build a temp div containing the new children for the view's $el. */\n _renderControls : function( $newRender ){\n this.debug( this + '(ListPanel)._renderControls' );\n var $controls = $( this.templates.controls( {}, this ) );\n $newRender.find( '.controls' ).replaceWith( $controls );\n return $controls;\n },\n\n /** return a jQuery object containing the title DOM */\n _renderTitle : function( $where ){\n //$where = $where || this.$el;\n //$where.find( '.title' ).replaceWith( ... )\n },\n\n /** return a jQuery object containing the subtitle DOM (if any) */\n _renderSubtitle : function( $where ){\n //$where = $where || this.$el;\n //$where.find( '.title' ).replaceWith( ... )\n },\n\n /** Fade out the old el, swap in the new contents, then fade in.\n * @param {Number or String} speed jq speed to use for rendering effects\n * @fires rendered when rendered\n */\n _queueNewRender : function( $newRender, speed ) {\n speed = ( speed === undefined )?( this.fxSpeed ):( speed );\n var panel = this;\n panel.log( '_queueNewRender:', $newRender, speed );\n\n $( panel ).queue( 'fx', [\n function( next ){\n panel.$el.fadeOut( speed, next );\n },\n function( next ){\n panel._swapNewRender( $newRender );\n next();\n },\n function( next ){\n panel.$el.fadeIn( speed, next );\n },\n function( next ){\n panel.trigger( 'rendered', panel );\n next();\n }\n ]);\n },\n\n /** empty out the current el, move the $newRender's children in */\n _swapNewRender : function( $newRender ){\n this.$el.empty().attr( 'class', this.className ).append( $newRender.children() );\n if( this.selecting ){ this.showSelectors( 0 ); }\n return this;\n },\n\n /** Set up any behaviors, handlers (ep. plugins) that need to be called when the entire view has been built but\n * not attached to the page yet.\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n this.$controls( $where ).find('[title]').tooltip();\n // set up the pupup for actions available when multi selecting\n this._renderMultiselectActionMenu( $where );\n return this;\n },\n\n /** render a menu containing the actions available to sets of selected items */\n _renderMultiselectActionMenu : function( $where ){\n $where = $where || this.$el;\n var $menu = $where.find( '.list-action-menu' ),\n actions = this.multiselectActions();\n if( !actions.length ){\n return $menu.empty();\n }\n\n var $newMenu = $([\n '
                ',\n '',\n '
                  ', '
                ',\n '
                '\n ].join(''));\n var $actions = actions.map( function( action ){\n var html = [ '
              • ', action.html, '
              • ' ].join( '' );\n return $( html ).click( function( ev ){\n ev.preventDefault();\n return action.func( ev );\n });\n });\n $newMenu.find( 'ul' ).append( $actions );\n $menu.replaceWith( $newMenu );\n return $newMenu;\n },\n\n /** return a list of plain objects used to render multiselect actions menu. Each object should have:\n * html: an html string used as the anchor contents\n * func: a function called when the anchor is clicked (passed the click event)\n */\n multiselectActions : function(){\n return [];\n },\n\n // ------------------------------------------------------------------------ sub-$element shortcuts\n /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n $scrollContainer : function( $where ){\n // override or set via attributes.$scrollContainer\n return ( $where || this.$el ).parent().parent();\n },\n /** convenience selector for the section that displays the list controls */\n $controls : function( $where ){\n return ( $where || this.$el ).find( '> .controls' );\n },\n /** list-items: where the subviews are contained in the view's dom */\n $list : function( $where ){\n return ( $where || this.$el ).find( '> .list-items' );\n },\n /** container where list messages are attached */\n $messages : function( $where ){\n //TODO: controls isn't really correct here (only for ModelListPanel)\n return ( $where || this.$el ).find( '> .controls .messages' );\n },\n /** the message displayed when no views can be shown (no views, none matching search) */\n $emptyMessage : function( $where ){\n return ( $where || this.$el ).find( '> .empty-message' );\n },\n\n // ------------------------------------------------------------------------ hda sub-views\n /** render the subviews for the list's collection */\n renderItems : function( $whereTo ){\n $whereTo = $whereTo || this.$el;\n var panel = this;\n panel.log( this + '.renderItems', $whereTo );\n\n var $list = panel.$list( $whereTo );\n panel.freeViews();\n // console.log( 'views freed' );\n //TODO:? cache and re-use views?\n var shownModels = panel._filterCollection();\n // console.log( 'models filtered:', shownModels );\n\n panel.views = shownModels.map( function( itemModel ){\n var view = panel._createItemView( itemModel );\n return view;\n });\n\n $list.empty();\n // console.log( 'list emptied' );\n if( panel.views.length ){\n panel._attachItems( $whereTo );\n // console.log( 'items attached' );\n }\n panel._renderEmptyMessage( $whereTo ).toggle( !panel.views.length );\n panel.trigger( 'views:ready', panel.views );\n\n // console.log( '------------------------------------------- rendering items' );\n return panel.views;\n },\n\n /** Filter the collection to only those models that should be currently viewed */\n _filterCollection : function(){\n // override this\n var panel = this;\n return panel.collection.filter( _.bind( panel._filterItem, panel ) );\n },\n\n /** Should the model be viewable in the current state?\n * Checks against this.filters and this.searchFor\n */\n _filterItem : function( model ){\n // override this\n var panel = this;\n return ( _.every( panel.filters.map( function( fn ){ return fn.call( model ); }) ) )\n && ( !panel.searchFor || model.matchesAll( panel.searchFor ) );\n },\n\n /** Create a view for a model and set up it's listeners */\n _createItemView : function( model ){\n var ViewClass = this._getItemViewClass( model );\n var options = _.extend( this._getItemViewOptions( model ), {\n model : model\n });\n var view = new ViewClass( options );\n this._setUpItemViewListeners( view );\n return view;\n },\n\n /** Free a view for a model. Note: does not remove it from the DOM */\n _destroyItemView : function( view ){\n this.stopListening( view );\n this.views = _.without( this.views, view );\n },\n\n _destroyItemViews : function( view ){\n var self = this;\n self.views.forEach( function( v ){\n self.stopListening( v );\n });\n self.views = [];\n return self;\n },\n\n /** free any sub-views the list has */\n freeViews : function(){\n return this._destroyItemViews();\n },\n\n /** Get the bbone view class based on the model */\n _getItemViewClass : function( model ){\n // override this\n return this.viewClass;\n },\n\n /** Get the options passed to the new view based on the model */\n _getItemViewOptions : function( model ){\n // override this\n return {\n //logger : this.logger,\n fxSpeed : this.fxSpeed,\n expanded : false,\n selectable : this.selecting,\n selected : _.contains( this.selected, model.id ),\n draggable : this.dragItems\n };\n },\n\n /** Set up listeners for new models */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n // send all events to the panel, re-namspaceing them with the view prefix\n this.listenTo( view, 'all', function(){\n var args = Array.prototype.slice.call( arguments, 0 );\n args[0] = 'view:' + args[0];\n panel.trigger.apply( panel, args );\n });\n\n // drag multiple - hijack ev.setData to add all selected items\n this.listenTo( view, 'draggable:dragstart', function( ev, v ){\n //TODO: set multiple drag data here\n var json = {},\n selected = this.getSelectedModels();\n if( selected.length ){\n json = selected.toJSON();\n } else {\n json = [ v.model.toJSON() ];\n }\n ev.dataTransfer.setData( 'text', JSON.stringify( json ) );\n //ev.dataTransfer.setDragImage( v.el, 60, 60 );\n }, this );\n\n return panel;\n },\n\n /** Attach views in this.views to the model based on $whereTo */\n _attachItems : function( $whereTo ){\n var self = this;\n // console.log( '_attachItems:', $whereTo, this.$list( $whereTo ) );\n //ASSUMES: $list has been emptied\n this.$list( $whereTo ).append( this.views.map( function( view ){\n return self._renderItemView$el( view );\n }));\n return this;\n },\n\n /** get a given subview's $el (or whatever may wrap it) and return it */\n _renderItemView$el : function( view ){\n // useful to wrap and override\n return view.render(0).$el;\n },\n\n /** render the empty/none-found message */\n _renderEmptyMessage : function( $whereTo ){\n this.debug( '_renderEmptyMessage', $whereTo, this.searchFor );\n var text = this.searchFor? this.noneFoundMsg : this.emptyMsg;\n return this.$emptyMessage( $whereTo ).text( text );\n },\n\n /** expand all item views */\n expandAll : function(){\n _.each( this.views, function( view ){\n view.expand();\n });\n },\n\n /** collapse all item views */\n collapseAll : function(){\n _.each( this.views, function( view ){\n view.collapse();\n });\n },\n\n // ------------------------------------------------------------------------ collection/views syncing\n /** Add a view (if the model should be viewable) to the panel */\n addItemView : function( model, collection, options ){\n // console.log( this + '.addItemView:', model );\n var panel = this;\n // get the index of the model in the list of filtered models shown by this list\n // in order to insert the view in the proper place\n //TODO:? potentially expensive\n var modelIndex = panel._filterCollection().indexOf( model );\n if( modelIndex === -1 ){ return undefined; }\n var view = panel._createItemView( model );\n // console.log( 'adding and rendering:', modelIndex, view.toString() );\n\n $( view ).queue( 'fx', [\n function( next ){\n // hide the empty message first if only view\n if( panel.$emptyMessage().is( ':visible' ) ){\n panel.$emptyMessage().fadeOut( panel.fxSpeed, next );\n } else {\n next();\n }\n },\n function( next ){\n panel._attachView( view, modelIndex );\n next();\n }\n ]);\n return view;\n },\n\n /** internal fn to add view (to both panel.views and panel.$list) */\n _attachView : function( view, modelIndex, useFx ){\n // console.log( this + '._attachView:', view, modelIndex, useFx );\n useFx = _.isUndefined( useFx )? true : useFx;\n modelIndex = modelIndex || 0;\n var panel = this;\n\n // use the modelIndex to splice into views and insert at the proper index in the DOM\n panel.views.splice( modelIndex, 0, view );\n panel._insertIntoListAt( modelIndex, panel._renderItemView$el( view ).hide() );\n\n panel.trigger( 'view:attached', view );\n if( useFx ){\n view.$el.slideDown( panel.fxSpeed, function(){\n panel.trigger( 'view:attached:rendered' );\n });\n } else {\n view.$el.show();\n panel.trigger( 'view:attached:rendered' );\n }\n return view;\n },\n\n /** insert a jq object as a child of list-items at the specified *DOM index* */\n _insertIntoListAt : function( index, $what ){\n // console.log( this + '._insertIntoListAt:', index, $what );\n var $list = this.$list();\n if( index === 0 ){\n $list.prepend( $what );\n } else {\n $list.children().eq( index - 1 ).after( $what );\n }\n return $what;\n },\n\n /** Remove a view from the panel (if found) */\n removeItemView : function( model, collection, options ){\n var panel = this;\n var view = _.find( panel.views, function( v ){ return v.model === model; });\n if( !view ){ return undefined; }\n panel.views = _.without( panel.views, view );\n panel.trigger( 'view:removed', view );\n\n // potentially show the empty message if no views left\n // use anonymous queue here - since remove can happen multiple times\n $({}).queue( 'fx', [\n function( next ){\n view.$el.fadeOut( panel.fxSpeed, next );\n },\n function( next ){\n view.remove();\n panel.trigger( 'view:removed:rendered' );\n if( !panel.views.length ){\n panel._renderEmptyMessage().fadeIn( panel.fxSpeed, next );\n } else {\n next();\n }\n }\n ]);\n return view;\n },\n\n /** get views based on model.id */\n viewFromModelId : function( id ){\n return _.find( this.views, function( v ){ return v.model.id === id; });\n },\n\n /** get views based on model */\n viewFromModel : function( model ){\n return model ? this.viewFromModelId( model.id ) : undefined;\n },\n\n /** get views based on model properties */\n viewsWhereModel : function( properties ){\n return this.views.filter( function( view ){\n return _.isMatch( view.model.attributes, properties );\n });\n },\n\n /** A range of views between (and including) viewA and viewB */\n viewRange : function( viewA, viewB ){\n if( viewA === viewB ){ return ( viewA )?( [ viewA ] ):( [] ); }\n\n var indexA = this.views.indexOf( viewA ),\n indexB = this.views.indexOf( viewB );\n\n // handle not found\n if( indexA === -1 || indexB === -1 ){\n if( indexA === indexB ){ return []; }\n return ( indexA === -1 )?( [ viewB ] ):( [ viewA ] );\n }\n // reverse if indeces are\n //note: end inclusive\n return ( indexA < indexB )?\n this.views.slice( indexA, indexB + 1 ) :\n this.views.slice( indexB, indexA + 1 );\n },\n\n // ------------------------------------------------------------------------ searching\n /** render a search input for filtering datasets shown\n * (see SearchableMixin in base-mvc for implementation of the actual searching)\n * return will start the search\n * esc will clear the search\n * clicking the clear button will clear the search\n * uses searchInput in ui.js\n */\n _renderSearch : function( $where ){\n $where.find( '.controls .search-input' ).searchInput({\n placeholder : this.searchPlaceholder,\n initialVal : this.searchFor,\n onfirstsearch : _.bind( this._firstSearch, this ),\n onsearch : _.bind( this.searchItems, this ),\n onclear : _.bind( this.clearSearch, this )\n });\n return $where;\n },\n\n /** What to do on the first search entered */\n _firstSearch : function( searchFor ){\n // override to load model details if necc.\n this.log( 'onFirstSearch', searchFor );\n return this.searchItems( searchFor );\n },\n\n /** filter view list to those that contain the searchFor terms */\n searchItems : function( searchFor, force ){\n this.log( 'searchItems', searchFor, this.searchFor, force );\n if( !force && this.searchFor === searchFor ){ return this; }\n this.searchFor = searchFor;\n this.renderItems();\n this.trigger( 'search:searching', searchFor, this );\n var $search = this.$( '> .controls .search-query' );\n if( $search.val() !== searchFor ){\n $search.val( searchFor );\n }\n return this;\n },\n\n /** clear the search filters and show all views that are normally shown */\n clearSearch : function( searchFor ){\n //this.log( 'onSearchClear', this );\n this.searchFor = '';\n this.trigger( 'search:clear', this );\n this.$( '> .controls .search-query' ).val( '' );\n this.renderItems();\n return this;\n },\n\n // ------------------------------------------------------------------------ selection\n /** @type Integer when the number of list item views is >= to this, don't animate selectors */\n THROTTLE_SELECTOR_FX_AT : 20,\n\n /** show selectors on all visible itemViews and associated controls */\n showSelectors : function( speed ){\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n this.selecting = true;\n this.$( '.list-actions' ).slideDown( speed );\n speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT? 0 : speed;\n _.each( this.views, function( view ){\n view.showSelector( speed );\n });\n //this.selected = [];\n //this.lastSelected = null;\n },\n\n /** hide selectors on all visible itemViews and associated controls */\n hideSelectors : function( speed ){\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n this.selecting = false;\n this.$( '.list-actions' ).slideUp( speed );\n speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT? 0 : speed;\n _.each( this.views, function( view ){\n view.hideSelector( speed );\n });\n this.selected = [];\n this.lastSelected = null;\n },\n\n /** show or hide selectors on all visible itemViews and associated controls */\n toggleSelectors : function(){\n if( !this.selecting ){\n this.showSelectors();\n } else {\n this.hideSelectors();\n }\n },\n\n /** select all visible items */\n selectAll : function( event ){\n _.each( this.views, function( view ){\n view.select( event );\n });\n },\n\n /** deselect all visible items */\n deselectAll : function( event ){\n this.lastSelected = null;\n _.each( this.views, function( view ){\n view.deselect( event );\n });\n },\n\n /** select a range of datasets between A and B */\n selectRange : function( viewA, viewB ){\n var range = this.viewRange( viewA, viewB );\n _.each( range, function( view ){\n view.select();\n });\n return range;\n },\n\n /** return an array of all currently selected itemViews */\n getSelectedViews : function(){\n return _.filter( this.views, function( v ){\n return v.selected;\n });\n },\n\n /** return a collection of the models of all currenly selected items */\n getSelectedModels : function(){\n // console.log( '(getSelectedModels)' );\n return new this.collection.constructor( _.map( this.getSelectedViews(), function( view ){\n return view.model;\n }));\n },\n\n // ------------------------------------------------------------------------ loading indicator\n /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n _showLoadingIndicator : function( msg, speed, callback ){\n this.debug( '_showLoadingIndicator', this.indicator, msg, speed, callback );\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n if( !this.indicator ){\n this.indicator = new LoadingIndicator( this.$el );\n this.debug( '\\t created', this.indicator );\n }\n if( !this.$el.is( ':visible' ) ){\n this.indicator.show( 0, callback );\n } else {\n this.$el.fadeOut( speed );\n this.indicator.show( msg, speed, callback );\n }\n },\n\n /** hide the loading indicator */\n _hideLoadingIndicator : function( speed, callback ){\n this.debug( '_hideLoadingIndicator', this.indicator, speed, callback );\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n if( this.indicator ){\n this.indicator.hide( speed, callback );\n }\n },\n\n // ------------------------------------------------------------------------ scrolling\n /** get the current scroll position of the panel in its parent */\n scrollPosition : function(){\n return this.$scrollContainer().scrollTop();\n },\n\n /** set the current scroll position of the panel in its parent */\n scrollTo : function( pos, speed ){\n speed = speed || 0;\n this.$scrollContainer().animate({ scrollTop: pos }, speed );\n return this;\n },\n\n /** Scrolls the panel to the top. */\n scrollToTop : function( speed ){\n return this.scrollTo( 0, speed );\n },\n\n /** scroll to the given view in list-items */\n scrollToItem : function( view, speed ){\n if( !view ){ return this; }\n return this;\n },\n\n /** Scrolls the panel to show the content with the given id. */\n scrollToId : function( id, speed ){\n return this.scrollToItem( this.viewFromModelId( id ), speed );\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : {\n 'click .select-all' : 'selectAll',\n 'click .deselect-all' : 'deselectAll'\n },\n\n // ------------------------------------------------------------------------ misc\n /** Return a string rep of the panel */\n toString : function(){\n return 'ListPanel(' + this.collection + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nListPanel.prototype.templates = (function(){\n\n var elTemplate = BASE_MVC.wrapTemplate([\n // temp container\n '
                ',\n '
                ',\n '
                ',\n '
                ',\n '
                '\n ]);\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                ',\n '
                ',\n '
                <%- view.title %>
                ',\n '
                ',\n '
                <%- view.subtitle %>
                ',\n // buttons, controls go here\n '
                ',\n // deleted msg, etc.\n '
                ',\n\n '
                ',\n '
                ',\n '
                ',\n\n // show when selectors are shown\n '
                ',\n '
                ',\n '',\n '',\n '
                ',\n '
                ',\n '
                ',\n '
                ',\n '
                '\n ]);\n\n return {\n el : elTemplate,\n controls : controlsTemplate\n };\n}());\n\n\n//=============================================================================\n/** View for a model that has a sub-collection (e.g. History, DatasetCollection)\n * Allows:\n * the model to be reset\n * auto assign panel.collection to panel.model[ panel.modelCollectionKey ]\n *\n */\nvar ModelListPanel = ListPanel.extend({\n\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey : 'contents',\n\n initialize : function( attributes ){\n ListPanel.prototype.initialize.call( this, attributes );\n this.selecting = ( attributes.selecting !== undefined )? attributes.selecting : false;\n\n this.setModel( this.model, attributes );\n },\n\n /** release/free/shutdown old models and set up panel for new models\n * @fires new-model with the panel as parameter\n */\n setModel : function( model, attributes ){\n attributes = attributes || {};\n this.debug( this + '.setModel:', model, attributes );\n\n this.freeModel();\n this.freeViews();\n\n if( model ){\n var oldModelId = this.model? this.model.get( 'id' ): null;\n\n // set up the new model with user, logger, storage, events\n this.model = model;\n if( this.logger ){\n this.model.logger = this.logger;\n }\n this._setUpModelListeners();\n\n //TODO: relation btwn model, collection becoming tangled here\n // free the collection, and assign the new collection to either\n // the model[ modelCollectionKey ], attributes.collection, or an empty vanilla collection\n this.stopListening( this.collection );\n this.collection = this.model[ this.modelCollectionKey ]\n || attributes.collection\n || this._createDefaultCollection();\n this._setUpCollectionListeners();\n\n if( oldModelId && model.get( 'id' ) !== oldModelId ){\n this.trigger( 'new-model', this );\n }\n }\n return this;\n },\n\n /** free the current model and all listeners for it, free any views for the model */\n freeModel : function(){\n // stop/release the previous model, and clear cache to sub-views\n if( this.model ){\n this.stopListening( this.model );\n //TODO: see base-mvc\n //this.model.free();\n //this.model = null;\n }\n return this;\n },\n\n // ------------------------------------------------------------------------ listening\n /** listening for model events */\n _setUpModelListeners : function(){\n // override\n this.log( this + '._setUpModelListeners', this.model );\n // bounce model errors up to the panel\n this.listenTo( this.model, 'error', function(){\n var args = Array.prototype.slice.call( arguments, 0 );\n //args.unshift( 'model:error' );\n args.unshift( 'error' );\n this.trigger.apply( this, args );\n }, this );\n\n // debugging\n if( this.logger ){\n this.listenTo( this.model, 'all', function( event ){\n this.info( this + '(model)', event, arguments );\n });\n }\n return this;\n },\n\n /** Build a temp div containing the new children for the view's $el.\n */\n _renderControls : function( $newRender ){\n this.debug( this + '(ModelListPanel)._renderControls' );\n var json = this.model? this.model.toJSON() : {},\n $controls = $( this.templates.controls( json, this ) );\n $newRender.find( '.controls' ).replaceWith( $controls );\n return $controls;\n },\n\n // ------------------------------------------------------------------------ misc\n /** Return a string rep of the panel */\n toString : function(){\n return 'ModelListPanel(' + this.model + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nModelListPanel.prototype.templates = (function(){\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                ',\n '
                ',\n //TODO: this is really the only difference - consider factoring titlebar out\n '
                <%- model.name %>
                ',\n '
                ',\n '
                <%- view.subtitle %>
                ',\n '
                ',\n '
                ',\n\n '
                ',\n '
                ',\n '
                ',\n\n '
                ',\n '
                ',\n '',\n '',\n '
                ',\n '
                ',\n '
                ',\n '
                ',\n '
                '\n ]);\n\n return _.extend( _.clone( ListPanel.prototype.templates ), {\n controls : controlsTemplate\n });\n}());\n\n\n//=============================================================================\n return {\n ListPanel : ListPanel,\n ModelListPanel : ModelListPanel\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/list/list-view.js","/** This is the run workflow tool form view. */\ndefine([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view', 'mvc/form/form-data', 'mvc/tool/tool-form-base', 'mvc/ui/ui-modal', 'mvc/webhooks', 'mvc/workflow/workflow-icons' ],\n function( Utils, Deferred, Ui, Form, FormData, ToolFormBase, Modal, Webhooks, WorkflowIcons ) {\n\n var View = Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.modal = parent.Galaxy.modal || new Modal.View();\n this.model = options && options.model || new Backbone.Model( options );\n this.deferred = new Deferred();\n this.setElement( $( '
                ' ).addClass( 'ui-form-composite' )\n .append( this.$message = $( '
                ' ) )\n .append( this.$header = $( '
                ' ) )\n .append( this.$steps = $( '
                ' ) ) );\n $( 'body' ).append( this.$el );\n this._configure();\n this.render();\n $( window ).resize( function() { self._refresh() } );\n },\n\n /** Refresh height of scrollable div below header, handle scrolling by lazy loading steps */\n _refresh: function( step_index ) {\n var margin = _.reduce( this.$el.children(), function( memo, child ) {\n return memo + $( child ).outerHeight();\n }, 0 ) - this.$steps.height() + 90;\n this.$steps.css( 'height', $( window ).height() - margin );\n },\n\n /** Configures form/step options for each workflow step */\n _configure: function() {\n var self = this;\n this.forms = [];\n this.steps = [];\n this.links = [];\n this.parms = [];\n _.each( this.model.get( 'steps' ), function( step, i ) {\n Galaxy.emit.debug( 'tool-form-composite::initialize()', i + ' : Preparing workflow step.' );\n var icon = WorkflowIcons[ step.step_type ];\n var title = parseInt( i + 1 ) + ': ' + ( step.step_label || step.step_name );\n if ( step.annotation ) {\n title += ' - ' + step.annotation;\n }\n if ( step.step_version ) {\n title += ' (Galaxy Version ' + step.step_version + ')';\n }\n step = Utils.merge( {\n index : i,\n fixed_title : _.escape( title ),\n icon : icon || '',\n help : null,\n citations : null,\n collapsible : true,\n collapsed : i > 0 && !self._isDataStep( step ),\n sustain_version : true,\n sustain_repeats : true,\n sustain_conditionals : true,\n narrow : true,\n text_enable : 'Edit',\n text_disable : 'Undo',\n cls_enable : 'fa fa-edit',\n cls_disable : 'fa fa-undo',\n errors : step.messages,\n initial_errors : true,\n cls : 'ui-portlet-narrow',\n hide_operations : true,\n needs_refresh : false,\n always_refresh : step.step_type != 'tool'\n }, step );\n self.steps[ i ] = step;\n self.links[ i ] = [];\n self.parms[ i ] = {};\n });\n\n // build linear index of step input pairs\n _.each( this.steps, function( step, i ) {\n FormData.visitInputs( step.inputs, function( input, name ) {\n self.parms[ i ][ name ] = input;\n });\n });\n\n // iterate through data input modules and collect linked sub steps\n _.each( this.steps, function( step, i ) {\n _.each( step.output_connections, function( output_connection ) {\n _.each( self.steps, function( sub_step, j ) {\n sub_step.step_index === output_connection.input_step_index && self.links[ i ].push( sub_step );\n });\n });\n });\n\n // convert all connected data inputs to hidden fields with proper labels,\n // and track the linked source step\n _.each( this.steps, function( step, i ) {\n _.each( self.steps, function( sub_step, j ) {\n var connections_by_name = {};\n _.each( step.output_connections, function( connection ) {\n sub_step.step_index === connection.input_step_index && ( connections_by_name[ connection.input_name ] = connection );\n });\n _.each( self.parms[ j ], function( input, name ) {\n var connection = connections_by_name[ name ];\n if ( connection ) {\n input.type = 'hidden';\n input.help = input.step_linked ? input.help + ', ' : '';\n input.help += 'Output dataset \\'' + connection.output_name + '\\' from step ' + ( parseInt( i ) + 1 );\n input.step_linked = input.step_linked || [];\n input.step_linked.push( step );\n }\n });\n });\n });\n\n // identify and configure workflow parameters\n var wp_count = 0;\n this.wp_inputs = {};\n function _handleWorkflowParameter( value, callback ) {\n var re = /\\$\\{(.+?)\\}/g, match;\n while ( match = re.exec( String( value ) ) ) {\n var wp_name = match[ 1 ];\n callback( self.wp_inputs[ wp_name ] = self.wp_inputs[ wp_name ] || {\n label : wp_name,\n name : wp_name,\n type : 'text',\n color : 'hsl( ' + ( ++wp_count * 100 ) + ', 70%, 30% )',\n style : 'ui-form-wp-source',\n links : []\n });\n }\n }\n _.each( this.steps, function( step, i ) {\n _.each( self.parms[ i ], function( input, name ) {\n _handleWorkflowParameter( input.value, function( wp_input ) {\n wp_input.links.push( step );\n input.wp_linked = true;\n input.type = 'text';\n input.backdrop = true;\n input.style = 'ui-form-wp-target';\n });\n });\n _.each( step.post_job_actions, function( pja ) {\n _.each( pja.action_arguments, function( arg ) {\n _handleWorkflowParameter( arg, function() {} );\n });\n });\n });\n\n // select fields are shown for dynamic fields if all putative data inputs are available,\n // or if an explicit reference is specified as data_ref and available\n _.each( this.steps, function( step, i ) {\n if ( step.step_type == 'tool' ) {\n var data_resolved = true;\n FormData.visitInputs( step.inputs, function ( input, name, context ) {\n var is_runtime_value = input.value && input.value.__class__ == 'RuntimeValue';\n var is_data_input = ([ 'data', 'data_collection' ]).indexOf( input.type ) != -1;\n var data_ref = context[ input.data_ref ];\n input.step_linked && !self._isDataStep( input.step_linked ) && ( data_resolved = false );\n input.options && ( ( input.options.length == 0 && !data_resolved ) || input.wp_linked ) && ( input.is_workflow = true );\n data_ref && ( input.is_workflow = ( data_ref.step_linked && !self._isDataStep( data_ref.step_linked ) ) || input.wp_linked );\n ( is_data_input || ( input.value && input.value.__class__ == 'RuntimeValue' && !input.step_linked ) ) && ( step.collapsed = false );\n is_runtime_value && ( input.value = input.default_value );\n input.flavor = 'workflow';\n if ( !is_runtime_value && !is_data_input && input.type !== 'hidden' && !input.wp_linked ) {\n if ( input.optional || ( !Utils.isEmpty( input.value ) && input.value !== '' ) ) {\n input.collapsible_value = input.value;\n input.collapsible_preview = true;\n }\n }\n });\n }\n });\n },\n\n render: function() {\n var self = this;\n this.deferred.reset();\n this._renderHeader();\n this._renderMessage();\n this._renderParameters();\n this._renderHistory();\n _.each ( this.steps, function( step ) { self._renderStep( step ) } );\n },\n\n /** Render header */\n _renderHeader: function() {\n var self = this;\n this.execute_btn = new Ui.Button({\n icon : 'fa-check',\n title : 'Run workflow',\n cls : 'btn btn-primary',\n onclick : function() { self._execute() }\n });\n this.$header.addClass( 'ui-form-header' ).empty()\n .append( new Ui.Label( { title: 'Workflow: ' + this.model.get( 'name' ) } ).$el )\n .append( this.execute_btn.$el );\n },\n\n /** Render message */\n _renderMessage: function() {\n this.$message.empty();\n if ( this.model.get( 'has_upgrade_messages' ) ) {\n this.$message.append( new Ui.Message( {\n message : 'Some tools in this workflow may have changed since it was last saved or some errors were found. The workflow may still run, but any new options will have default values. Please review the messages below to make a decision about whether the changes will affect your analysis.',\n status : 'warning',\n persistent : true,\n fade : false\n } ).$el );\n }\n var step_version_changes = this.model.get( 'step_version_changes' );\n if ( step_version_changes && step_version_changes.length > 0 ) {\n this.$message.append( new Ui.Message( {\n message : 'Some tools are being executed with different versions compared to those available when this workflow was last saved because the other versions are not or no longer available on this Galaxy instance. To upgrade your workflow and dismiss this message simply edit the workflow and re-save it.',\n status : 'warning',\n persistent : true,\n fade : false\n } ).$el );\n }\n },\n\n /** Render workflow parameters */\n _renderParameters: function() {\n var self = this;\n this.wp_form = null;\n if ( !_.isEmpty( this.wp_inputs ) ) {\n this.wp_form = new Form({ title: 'Workflow Parameters', inputs: this.wp_inputs, cls: 'ui-portlet-narrow', onchange: function() {\n _.each( self.wp_form.input_list, function( input_def, i ) {\n _.each( input_def.links, function( step ) { self._refreshStep( step ) } );\n });\n }\n });\n this._append( this.$steps.empty(), this.wp_form.$el );\n }\n },\n\n /** Render workflow parameters */\n _renderHistory: function() {\n this.history_form = new Form({\n cls : 'ui-portlet-narrow',\n title : 'History Options',\n inputs : [{\n type : 'conditional',\n name : 'new_history',\n test_param : {\n name : 'check',\n label : 'Send results to a new history',\n type : 'boolean',\n value : 'false',\n help : ''\n },\n cases : [{\n value : 'true',\n inputs : [{\n name : 'name',\n label : 'History name',\n type : 'text',\n value : this.model.get( 'name' )\n }]\n }]\n }]\n });\n this._append( this.$steps, this.history_form.$el );\n },\n\n /** Render step */\n _renderStep: function( step ) {\n var self = this;\n var form = null;\n this.deferred.execute( function( promise ) {\n self.$steps.addClass( 'ui-steps' );\n if ( step.step_type == 'tool' ) {\n step.postchange = function( process, form ) {\n var self = this;\n var current_state = {\n tool_id : step.id,\n tool_version : step.version,\n inputs : $.extend( true, {}, form.data.create() )\n }\n form.wait( true );\n Galaxy.emit.debug( 'tool-form-composite::postchange()', 'Sending current state.', current_state );\n Utils.request({\n type : 'POST',\n url : Galaxy.root + 'api/tools/' + step.id + '/build',\n data : current_state,\n success : function( data ) {\n form.update( data );\n form.wait( false );\n Galaxy.emit.debug( 'tool-form-composite::postchange()', 'Received new model.', data );\n process.resolve();\n },\n error : function( response ) {\n Galaxy.emit.debug( 'tool-form-composite::postchange()', 'Refresh request failed.', response );\n process.reject();\n }\n });\n };\n form = new ToolFormBase( step );\n if ( step.post_job_actions && step.post_job_actions.length ) {\n form.portlet.append( $( '
                ' ).addClass( 'ui-form-element-disabled' )\n .append( $( '
                ' ).addClass( 'ui-form-title' ).html( 'Job Post Actions' ) )\n .append( $( '
                ' ).addClass( 'ui-form-preview' ).html(\n _.reduce( step.post_job_actions, function( memo, value ) {\n return memo + ' ' + value.short_str;\n }, '' ) ) )\n );\n }\n } else {\n var is_simple_input = ([ 'data_input', 'data_collection_input' ]).indexOf( step.step_type ) != -1;\n _.each( step.inputs, function( input ) { input.flavor = 'module'; input.hide_label = is_simple_input; } );\n form = new Form( Utils.merge({\n title : step.fixed_title,\n onchange : function() { _.each( self.links[ step.index ], function( link ) { self._refreshStep( link ) } ) },\n inputs : step.inputs && step.inputs.length > 0 ? step.inputs : [ { type: 'hidden', name: 'No options available.', ignore: null } ]\n }, step ) );\n }\n self.forms[ step.index ] = form;\n self._append( self.$steps, form.$el );\n self._refresh();\n step.needs_refresh && self._refreshStep( step );\n form.portlet[ !self.show_progress ? 'enable' : 'disable' ]();\n self.show_progress && self.execute_btn.model.set( { wait : true,\n wait_text : 'Preparing...',\n percentage : ( step.index + 1 ) * 100.0 / self.steps.length } );\n Galaxy.emit.debug( 'tool-form-composite::initialize()', step.index + ' : Workflow step state ready.', step );\n setTimeout( function() { promise.resolve() }, 0 );\n });\n },\n\n /** Refreshes step values from source step values */\n _refreshStep: function( step ) {\n var self = this;\n var form = this.forms[ step.index ];\n if ( form ) {\n _.each( self.parms[ step.index ], function( input, name ) {\n if ( input.step_linked || input.wp_linked ) {\n var field = form.field_list[ form.data.match( name ) ];\n if ( field ) {\n var new_value = undefined;\n if ( input.step_linked ) {\n new_value = { values: [] };\n _.each( input.step_linked, function( source_step ) {\n if ( self._isDataStep( source_step ) ) {\n var value = self.forms[ source_step.index ].data.create().input;\n value && _.each( value.values, function( v ) { new_value.values.push( v ) } );\n }\n });\n if ( !input.multiple && new_value.values.length > 0 ) {\n new_value = { values: [ new_value.values[ 0 ] ] };\n }\n } else if ( input.wp_linked ) {\n new_value = input.value;\n var re = /\\$\\{(.+?)\\}/g, match;\n while ( match = re.exec( input.value ) ) {\n var wp_field = self.wp_form.field_list[ self.wp_form.data.match( match[ 1 ] ) ];\n var wp_value = wp_field && wp_field.value();\n if ( wp_value ) {\n new_value = new_value.split( match[ 0 ] ).join( wp_value );\n }\n }\n }\n if ( new_value !== undefined ) {\n field.value( new_value );\n }\n }\n }\n });\n form.trigger( 'change' );\n } else {\n step.needs_refresh = true;\n }\n },\n\n /** Refresh the history after job submission while form is shown */\n _refreshHistory: function() {\n var self = this;\n var history = parent.Galaxy && parent.Galaxy.currHistoryPanel && parent.Galaxy.currHistoryPanel.model;\n this._refresh_history && clearTimeout( this._refresh_history );\n if ( history ) {\n history.refresh().success( function() {\n if ( history.numOfUnfinishedShownContents() === 0 ) {\n self._refresh_history = setTimeout( function() { self._refreshHistory() }, history.UPDATE_DELAY );\n }\n });\n }\n },\n\n /** Build remaining steps */\n _execute: function() {\n var self = this;\n this.show_progress = true;\n this._enabled( false );\n this.deferred.execute( function( promise ) {\n setTimeout( function() { promise.resolve(); self._submit(); }, 0 );\n });\n },\n\n /** Validate and submit workflow */\n _submit: function() {\n var self = this;\n var history_form_data = this.history_form.data.create();\n var job_def = {\n new_history_name : history_form_data[ 'new_history|name' ] ? history_form_data[ 'new_history|name' ] : null,\n history_id : !history_form_data[ 'new_history|name' ] ? this.model.get( 'history_id' ) : null,\n replacement_params : this.wp_form ? this.wp_form.data.create() : {},\n parameters : {},\n // Tool form will submit flat maps for each parameter\n // (e.g. \"repeat_0|cond|param\": \"foo\" instead of nested\n // data structures).\n parameters_normalized : true,\n // Tool form always wants a list of invocations back\n // so that inputs can be batched.\n batch : true\n };\n var validated = true;\n for ( var i in this.forms ) {\n var form = this.forms[ i ];\n var job_inputs = form.data.create();\n var step = self.steps[ i ];\n var step_index = step.step_index;\n form.trigger( 'reset' );\n for ( var job_input_id in job_inputs ) {\n var input_value = job_inputs[ job_input_id ];\n var input_id = form.data.match( job_input_id );\n var input_field = form.field_list[ input_id ];\n var input_def = form.input_list[ input_id ];\n if ( !input_def.step_linked ) {\n if ( this._isDataStep( step ) ) {\n validated = input_value && input_value.values && input_value.values.length > 0;\n } else {\n validated = input_def.optional || ( input_def.is_workflow && input_value !== '' ) || ( !input_def.is_workflow && input_value !== null );\n }\n if ( !validated ) {\n form.highlight( input_id );\n break;\n }\n job_def.parameters[ step_index ] = job_def.parameters[ step_index ] || {};\n job_def.parameters[ step_index ][ job_input_id ] = job_inputs[ job_input_id ];\n }\n }\n if ( !validated ) {\n break;\n }\n }\n if ( !validated ) {\n self._enabled( true );\n Galaxy.emit.debug( 'tool-form-composite::submit()', 'Validation failed.', job_def );\n } else {\n Galaxy.emit.debug( 'tool-form-composite::submit()', 'Validation complete.', job_def );\n Utils.request({\n type : 'POST',\n url : Galaxy.root + 'api/workflows/' + this.model.id + '/invocations',\n data : job_def,\n success : function( response ) {\n Galaxy.emit.debug( 'tool-form-composite::submit', 'Submission successful.', response );\n self.$el.children().hide();\n self.$el.append( self._templateSuccess( response ) );\n\n // Show Webhook if job is running\n if ($.isArray( response ) && response.length > 0) {\n self.$el.append( $( '
                ', { id: 'webhook-view' } ) );\n var WebhookApp = new Webhooks.WebhookView({\n urlRoot: Galaxy.root + 'api/webhooks/workflow',\n toolId: job_def.tool_id,\n toolVersion: job_def.tool_version,\n });\n }\n\n self._refreshHistory();\n },\n error : function( response ) {\n Galaxy.emit.debug( 'tool-form-composite::submit', 'Submission failed.', response );\n var input_found = false;\n if ( response && response.err_data ) {\n for ( var i in self.forms ) {\n var form = self.forms[ i ];\n var step_related_errors = response.err_data[ form.model.get( 'step_index' ) ];\n if ( step_related_errors ) {\n var error_messages = form.data.matchResponse( step_related_errors );\n for ( var input_id in error_messages ) {\n form.highlight( input_id, error_messages[ input_id ] );\n input_found = true;\n break;\n }\n }\n }\n }\n if ( !input_found ) {\n self.modal.show({\n title : 'Workflow submission failed',\n body : self._templateError( job_def, response && response.err_msg ),\n buttons : {\n 'Close' : function() {\n self.modal.hide();\n }\n }\n });\n }\n },\n complete: function() {\n self._enabled( true );\n }\n });\n }\n },\n\n /** Append new dom to body */\n _append: function( $container, $el ) {\n $container.append( '

                ' ).append( $el );\n },\n\n /** Set enabled/disabled state */\n _enabled: function( enabled ) {\n this.execute_btn.model.set( { wait: !enabled, wait_text: 'Sending...', percentage: -1 } );\n this.wp_form && this.wp_form.portlet[ enabled ? 'enable' : 'disable' ]();\n this.history_form && this.history_form.portlet[ enabled ? 'enable' : 'disable' ]();\n _.each( this.forms, function( form ) { form && form.portlet[ enabled ? 'enable' : 'disable' ]() } );\n },\n\n /** Is data input module/step */\n _isDataStep: function( steps ) {\n var lst = $.isArray( steps ) ? steps : [ steps ] ;\n for ( var i = 0; i < lst.length; i++ ) {\n var step = lst[ i ];\n if ( !step || !step.step_type || !step.step_type.startsWith( 'data' ) ) {\n return false;\n }\n }\n return true;\n },\n\n /** Templates */\n _templateSuccess: function( response ) {\n if ( $.isArray( response ) && response.length > 0 ) {\n return $( '

                ' ).addClass( 'donemessagelarge' )\n .append( $( '

                ' ).html( 'Successfully invoked workflow ' + Utils.sanitize( this.model.get( 'name' ) ) + '' + ( response.length > 1 ? ' ' + response.length + ' times' : '' ) + '.' ) )\n .append( $( '

                ' ).append( '' ).text( 'You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from \\'running\\' to \\'finished\\' if completed successfully or \\'error\\' if problems were encountered.' ) );\n } else {\n return this._templateError( response, 'Invalid success response. No invocations found.' );\n }\n },\n\n _templateError: function( response, err_msg ) {\n return $( '

                ' ).addClass( 'errormessagelarge' )\n .append( $( '

                ' ).text( 'The server could not complete the request. Please contact the Galaxy Team if this error persists. ' + ( JSON.stringify( err_msg ) || '' ) ) )\n .append( $( '

                ' ).text( JSON.stringify( response, null, 4 ) ) );\n        }\n    });\n    return {\n        View: View\n    };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/tool/tool-form-composite.js","define([\n    \"utils/localization\"\n], function( _l ){\n'use strict';\n\n//TODO: toastr is another possibility - I didn't see where I might add details, tho\n\n/* ============================================================================\nError modals meant to replace the o-so-easy alerts.\n\nThese are currently styled as errormessages but use the Galaxy.modal\ninfrastructure to be shown/closed. They're capable of showing details in a\ntogglable dropdown and the details are formatted in a pre.\n\nExample:\n    errorModal( 'Heres a message', 'A Title', { some_details: 'here' });\n    errorModal( 'Heres a message' ); // no details, title is 'Error'\n\nThere are three specialized forms:\n    offlineErrorModal       a canned response for when there's no connection\n    badGatewayErrorModal    canned response for when Galaxy is restarting\n    ajaxErrorModal          plugable into any Backbone class as an\n        error event handler by accepting the error args: model, xhr, options\n\nExamples:\n    if( navigator.offLine ){ offlineErrorModal(); }\n    if( xhr.status === 502 ){ badGatewayErrorModal(); }\n    this.listenTo( this.model, 'error', ajaxErrorModal );\n\n============================================================================ */\n\nvar CONTACT_MSG = _l( 'Please contact a Galaxy administrator if the problem persists.' );\nvar DEFAULT_AJAX_ERR_MSG = _l( 'An error occurred while updating information with the server.' );\nvar DETAILS_MSG = _l( 'The following information can assist the developers in finding the source of the error:' );\n\n/** private helper that builds the modal and handles adding details */\nfunction _errorModal( message, title, details ){\n    // create and return the modal, adding details button only if needed\n    Galaxy.modal.show({\n        title           : title,\n        body            : message,\n        closing_events  : true,\n        buttons         : { Ok: function(){ Galaxy.modal.hide(); } },\n    });\n    Galaxy.modal.$el.addClass( 'error-modal' );\n\n    if( details ){\n        Galaxy.modal.$( '.error-details' ).add( Galaxy.modal.$( 'button:contains(\"Details\")' ) ).remove();\n        $( '
                ' ).addClass( 'error-details' )\n .hide().appendTo( Galaxy.modal.$( '.modal-content' ) )\n .append([\n $( '

                ' ).text( DETAILS_MSG ),\n $( '

                ' ).text( JSON.stringify( details, null, '  ' ) )\n            ]);\n\n        $( '' )\n            .appendTo( Galaxy.modal.$( '.buttons' ) )\n            .click( function(){ Galaxy.modal.$( '.error-details' ).toggle(); });\n    }\n    return Galaxy.modal;\n}\n\n/** Display a modal showing an error message but fallback to alert if there's no modal */\nfunction errorModal( message, title, details ){\n    if( !message ){ return; }\n\n    message = _l( message );\n    title = _l( title ) || _l( 'Error:' );\n    if( window.Galaxy && Galaxy.modal ){\n        return _errorModal( message, title, details );\n    }\n\n    alert( title + '\\n\\n' + message );\n    console.log( 'error details:', JSON.stringify( details ) );\n}\n\n\n// ----------------------------------------------------------------------------\n/** display a modal when the user may be offline */\nfunction offlineErrorModal(){\n    return errorModal(\n        _l( 'You appear to be offline. Please check your connection and try again.' ),\n        _l( 'Offline?' )\n    );\n}\n\n\n// ----------------------------------------------------------------------------\n/** 502 messages that should be displayed when galaxy is restarting */\nfunction badGatewayErrorModal(){\n    return errorModal(\n        _l( 'Galaxy is currently unreachable. Please try again in a few minutes.' ) + ' ' + CONTACT_MSG,\n        _l( 'Cannot connect to Galaxy' )\n    );\n}\n\n\n// ----------------------------------------------------------------------------\n/** display a modal (with details) about a failed Backbone ajax operation */\nfunction ajaxErrorModal( model, xhr, options, message, title ){\n    message = message || DEFAULT_AJAX_ERR_MSG;\n    message += ' ' + CONTACT_MSG;\n    title = title || _l( 'An error occurred' );\n    var details = _ajaxDetails( model, xhr, options );\n    return errorModal( message, title, details );\n}\n\n/** build details which may help debugging the ajax call */\nfunction _ajaxDetails( model, xhr, options ){\n    return {\n//TODO: still can't manage Raven id\n        raven       : _.result( window.Raven, 'lastEventId' ),\n        userAgent   : navigator.userAgent,\n        onLine      : navigator.onLine,\n        version     : _.result( Galaxy.config, 'version_major' ),\n        xhr         : _.omit( xhr, _.functions( xhr ) ),\n        options     : _.omit( options, 'xhr' ),\n        // add ajax data from Galaxy object cache\n        url         : _.result( Galaxy.lastAjax, 'url' ),\n        data        : _.result( Galaxy.lastAjax, 'data' ),\n        // backbone stuff (auto-redacting email for user)\n        model       : _.result( model, 'toJSON' , model + '' ),\n        user        : _.omit( _.result( Galaxy.user, 'toJSON' ), 'email' ),\n    };\n}\n\n\n//=============================================================================\n    return {\n        errorModal          : errorModal,\n        offlineErrorModal   : offlineErrorModal,\n        badGatewayErrorModal: badGatewayErrorModal,\n        ajaxErrorModal      : ajaxErrorModal\n    };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/ui/error-modal.js","(function (factory) {\n    if (typeof define === 'function' && define.amd) {\n        define([], factory);\n    } else {\n        // Browser globals\n        factory(jQuery);\n    }\n\n}(function () {\n//=============================================================================\n\n    jQuery.fn.extend({\n        hoverhighlight : function $hoverhighlight( scope, color ){\n            scope = scope || 'body';\n            if( !this.length ){ return this; }\n\n            $( this ).each( function(){\n                var $this = $( this ),\n                    targetSelector = $this.data( 'target' );\n\n                if( targetSelector ){\n                    $this.mouseover( function( ev ){\n                        $( targetSelector, scope ).css({\n                            background: color\n                        });\n                    })\n                    .mouseout( function( ev ){\n                        $( targetSelector ).css({\n                            background: ''\n                        });\n                    });\n                }\n            });\n            return this;\n        }\n    });\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/ui/hoverhighlight.js","// from: https://raw.githubusercontent.com/umdjs/umd/master/jqueryPlugin.js\n// Uses AMD or browser globals to create a jQuery plugin.\n(function (factory) {\n    if (typeof define === 'function' && define.amd) {\n        //TODO: So...this turns out to be an all or nothing thing. If I load jQuery in the define below, it will\n        //  (of course) wipe the old jquery *and all the plugins loaded into it*. So the define below *is still\n        //  relying on jquery being loaded globally* in order to preserve plugins.\n        define([], factory);\n    } else {\n        // Browser globals\n        factory(jQuery);\n    }\n\n}(function () {\n    var _l = window._l || function( s ){ return s; };\n\n    //TODO: consolidate with tool menu functionality, use there\n\n    /** searchInput: (jQuery plugin)\n     *      Creates a search input, a clear button, and loading indicator\n     *      within the selected node.\n     *\n     *      When the user either presses return or enters some minimal number\n     *      of characters, a callback is called. Pressing ESC when the input\n     *      is focused will clear the input and call a separate callback.\n     */\n    function searchInput( parentNode, options ){\n        var KEYCODE_ESC     = 27,\n            KEYCODE_RETURN  = 13,\n            $parentNode     = $( parentNode ),\n            firstSearch     = true,\n            defaults = {\n                initialVal      : '',\n                name            : 'search',\n                placeholder     : 'search',\n                classes         : '',\n                onclear         : function(){},\n                onfirstsearch   : null,\n                onsearch        : function( inputVal ){},\n                minSearchLen    : 0,\n                escWillClear    : true,\n                oninit          : function(){}\n            };\n\n        // .................................................................... input rendering and events\n        // visually clear the search, trigger an event, and call the callback\n        function clearSearchInput( event ){\n            var $input = $( this ).parent().children( 'input' );\n            $input.val( '' ).trigger( 'searchInput.clear' ).blur();\n            options.onclear();\n        }\n\n        // search for searchTerms, trigger an event, call the appropo callback (based on whether this is the first)\n        function search( event, searchTerms ){\n            if( !searchTerms ){\n                return clearSearchInput();\n            }\n            $( this ).trigger( 'search.search', searchTerms );\n            if( typeof options.onfirstsearch === 'function' && firstSearch ){\n                firstSearch = false;\n                options.onfirstsearch( searchTerms );\n            } else {\n                options.onsearch( searchTerms );\n            }\n        }\n\n        // .................................................................... input rendering and events\n        function inputTemplate(){\n            // class search-query is bootstrap 2.3 style that now lives in base.less\n            return [ '' ].join( '' );\n        }\n\n        // the search input that responds to keyboard events and displays the search value\n        function $input(){\n            return $( inputTemplate() )\n                // select all text on a focus\n                .focus( function( event ){\n                    $( this ).select();\n                })\n                // attach behaviors to esc, return if desired, search on some min len string\n                .keyup( function( event ){\n                    event.preventDefault();\n                    event.stopPropagation();\n\n                    // esc key will clear if desired\n                    if( event.which === KEYCODE_ESC && options.escWillClear ){\n                        clearSearchInput.call( this, event );\n\n                    } else {\n                        var searchTerms = $( this ).val();\n                        // return key or the search string len > minSearchLen (if not 0) triggers search\n                        if( ( event.which === KEYCODE_RETURN )\n                        ||  ( options.minSearchLen && searchTerms.length >= options.minSearchLen ) ){\n                            search.call( this, event, searchTerms );\n                        }\n                    }\n                })\n                .val( options.initialVal );\n        }\n\n        // .................................................................... clear button rendering and events\n        // a button for clearing the search bar, placed on the right hand side\n        function $clearBtn(){\n            return $([ '' ].join('') )\n            .tooltip({ placement: 'bottom' })\n            .click( function( event ){\n                clearSearchInput.call( this, event );\n            });\n        }\n\n        // .................................................................... loadingIndicator rendering\n        // a button for clearing the search bar, placed on the right hand side\n        function $loadingIndicator(){\n            return $([ '' ].join('') )\n                .hide().tooltip({ placement: 'bottom' });\n        }\n\n        // .................................................................... commands\n        // visually swap the load, clear buttons\n        function toggleLoadingIndicator(){\n            $parentNode.find( '.search-loading' ).toggle();\n            $parentNode.find( '.search-clear' ).toggle();\n        }\n\n        // .................................................................... init\n        // string command (not constructor)\n        if( jQuery.type( options ) === 'string' ){\n            if( options === 'toggle-loading' ){\n                toggleLoadingIndicator();\n            }\n            return $parentNode;\n        }\n\n        // initial render\n        if( jQuery.type( options ) === 'object' ){\n            options = jQuery.extend( true, {}, defaults, options );\n        }\n        //NOTE: prepended\n        return $parentNode.addClass( 'search-input' ).prepend([ $input(), $clearBtn(), $loadingIndicator() ]);\n    }\n\n    // as jq plugin\n    jQuery.fn.extend({\n        searchInput : function $searchInput( options ){\n            return this.each( function(){\n                return searchInput( this, options );\n            });\n        }\n    });\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/ui/search-input.js","define([], function(){\n// Alphanumeric/natural sort fn\nfunction naturalSort(a, b) {\n    // setup temp-scope variables for comparison evauluation\n    var re = /(-?[0-9\\.]+)/g,\n        x = a.toString().toLowerCase() || '',\n        y = b.toString().toLowerCase() || '',\n        nC = String.fromCharCode(0),\n        xN = x.replace( re, nC + '$1' + nC ).split(nC),\n        yN = y.replace( re, nC + '$1' + nC ).split(nC),\n        xD = (new Date(x)).getTime(),\n        yD = xD ? (new Date(y)).getTime() : null;\n    // natural sorting of dates\n    if ( yD ) {\n        if ( xD < yD ) { return -1; }\n        else if ( xD > yD ) { return 1; }\n    }\n    // natural sorting through split numeric strings and default strings\n    var oFxNcL, oFyNcL;\n    for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {\n        oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];\n        oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];\n        if (oFxNcL < oFyNcL) { return -1; }\n        else if (oFxNcL > oFyNcL) { return 1; }\n    }\n    return 0;\n}\n\nreturn naturalSort;\n})\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/utils/natural-sort.js","var Ui = require( 'mvc/ui/ui-misc' ),\n    historyOptionsMenu = require( 'mvc/history/options-menu' );\n    CurrentHistoryView = require( 'mvc/history/history-view-edit-current' ).CurrentHistoryView,\n    _l = require( 'utils/localization' );\n\n/** the right hand panel in the analysis page that shows the current history */\nvar HistoryPanel = Backbone.View.extend({\n\n    initialize : function( page, options ) {\n        var self = this;\n        this.userIsAnonymous            = Galaxy.user.isAnonymous();\n        this.allow_user_dataset_purge   = options.config.allow_user_dataset_purge;\n        this.root                       = options.root;\n\n        // view of the current history\n        this.historyView = new CurrentHistoryView({\n            className       : CurrentHistoryView.prototype.className + ' middle',\n            purgeAllowed    : this.allow_user_dataset_purge,\n            linkTarget      : 'galaxy_main'\n        });\n\n        // add history panel to Galaxy object\n        Galaxy.currHistoryPanel = this.historyView;\n        Galaxy.currHistoryPanel.listenToGalaxy( Galaxy );\n\n        // build buttons\n        this.buttonRefresh = new Ui.ButtonLink({\n            id      : 'history-refresh-button',\n            title   : 'Refresh history',\n            cls     : 'panel-header-button',\n            icon    : 'fa fa-refresh',\n            onclick : function() {\n                self.historyView.loadCurrentHistory();\n            }\n        });\n        this.buttonOptions = new Ui.ButtonLink({\n            id      : 'history-options-button',\n            title   : 'History options',\n            cls     : 'panel-header-button',\n            target  : 'galaxy_main',\n            icon    : 'fa fa-cog',\n            href    : this.root + 'root/history_options'\n        });\n        this.buttonViewMulti = new Ui.ButtonLink({\n            id      : 'history-view-multi-button',\n            title   : 'View all histories',\n            cls     : 'panel-header-button',\n            icon    : 'fa fa-columns',\n            href    : this.root + 'history/view_multiple'\n        });\n\n        // define components\n        this.model = new Backbone.Model({\n            cls     : 'history-right-panel',\n            title   : _l( 'History' ),\n            buttons : [ this.buttonRefresh, this.buttonOptions, this.buttonViewMulti ]\n        });\n\n        // build body template and connect history view\n        this.setElement( this._template() );\n        this.historyView.setElement( this.$el );\n        this.historyView.connectToQuotaMeter( Galaxy.quotaMeter );\n        this.historyView.loadCurrentHistory();\n\n        // fetch to update the quota meter adding 'current' for any anon-user's id\n        Galaxy.listenTo( this.historyView, 'history-size-change', function(){\n            Galaxy.user.fetch({ url: Galaxy.user.urlRoot() + '/' + ( Galaxy.user.id || 'current' ) });\n        });\n    },\n\n    render : function() {\n        this.optionsMenu = historyOptionsMenu( this.buttonOptions.$el, {\n            anonymous    : this.userIsAnonymous,\n            purgeAllowed : this.allow_user_dataset_purge,\n            root         : this.root\n        });\n        this.buttonViewMulti.$el[ !this.userIsAnonymous ? 'show' : 'hide' ]();\n    },\n\n    /** add history view div */\n    _template : function( data ){\n        return [\n            '
                ',\n ].join('');\n },\n\n toString : function() { return 'historyPanel' }\n});\n\nmodule.exports = HistoryPanel;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/panels/history-panel.js","var Tools = require( 'mvc/tool/tools' ),\n Upload = require( 'mvc/upload/upload-view' ),\n _l = require( 'utils/localization' ),\n ToolForm = require( 'mvc/tool/tool-form-composite' );\n\nvar ToolPanel = Backbone.View.extend({\n initialize: function( page, options ) {\n // access configuration options\n var config = options.config;\n this.root = options.root;\n\n /** @type {Object[]} descriptions of user's workflows to be shown in the tool menu */\n this.stored_workflow_menu_entries = config.stored_workflow_menu_entries || [];\n\n // create tool search, tool panel, and tool panel view.\n var tool_search = new Tools.ToolSearch({\n hidden : false\n });\n var tools = new Tools.ToolCollection( config.toolbox );\n this.tool_panel = new Tools.ToolPanel({\n tool_search : tool_search,\n tools : tools,\n layout : config.toolbox_in_panel\n });\n this.tool_panel_view = new Tools.ToolPanelView({ model: this.tool_panel });\n\n // add upload modal\n this.upload_button = new Upload({\n nginx_upload_path : config.nginx_upload_path,\n ftp_upload_site : config.ftp_upload_site,\n default_genome : config.default_genome,\n default_extension : config.default_extension,\n });\n\n // add uploader button to Galaxy object\n Galaxy.upload = this.upload_button;\n\n // components for panel definition\n this.model = new Backbone.Model({\n title : _l( 'Tools' ),\n buttons : [ this.upload_button ]\n });\n\n // build body template\n this.setElement( this._template() );\n },\n\n render : function(){\n // if there are tools, render panel and display everything\n var self = this;\n if ( this.tool_panel.get( 'layout' ).size() > 0 ) {\n this.$el.prepend( this.tool_panel_view.$el );\n this.tool_panel_view.render();\n }\n // build the dom for the workflow portion of the tool menu\n // add internal workflow list\n self.$( '#internal-workflows' ).append( self._templateAllWorkflow({\n title : _l( 'All workflows' ),\n href : 'workflow'\n }));\n _.each( this.stored_workflow_menu_entries, function( menu_entry ){\n self.$( '#internal-workflows' ).append( self._templateWorkflowLink({\n title : menu_entry.stored_workflow.name,\n href : 'workflow/run?id=' + menu_entry.encoded_stored_workflow_id\n }));\n });\n },\n\n /** build a link to one tool */\n _templateTool: function( tool ) {\n return [\n '
                ',\n '', tool.title, '',\n '
                '\n ].join('');\n },\n\n /** build a link to 'All Workflows' */\n _templateAllWorkflow: function( tool ) {\n return [\n '
                ',\n // global\n '', tool.title, '',\n '
                '\n ].join('');\n },\n\n /** build links to workflows in toolpanel */\n _templateWorkflowLink: function( wf ) {\n return [\n '
                ',\n '', wf.title, '',\n '
                '\n ].join('');\n },\n\n /** override to include inital menu dom and workflow section */\n _template : function() {\n return [\n '
                ',\n '
                ',\n '
                ',\n '', _l( 'Search did not match any tools.' ), '',\n '
                ',\n '
                ',\n '
                ',\n '
                ',\n '
                ',\n '', _l( 'Workflows' ), '',\n '
                ',\n '
                ',\n '
                ',\n '
                ',\n '
                '\n ].join('');\n },\n\n toString : function() { return 'toolPanel' }\n});\n\nmodule.exports = ToolPanel;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/panels/tool-panel.js","/*\n * Toastr\n * Version 2.0.1\n * Copyright 2012 John Papa and Hans Fjällemark. \n * All Rights Reserved. \n * Use, reproduction, distribution, and modification of this code is subject to the terms and \n * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php\n *\n * Author: John Papa and Hans Fjällemark\n * Project: https://github.com/CodeSeven/toastr\n */\n; (function (define) {\n\tdefine([], function () {\n\t\tvar $ = jQuery;\n\t\treturn (function () {\n\t\t\tvar version = '2.0.1';\n\t\t\tvar $container;\n\t\t\tvar listener;\n\t\t\tvar toastId = 0;\n\t\t\tvar toastType = {\n\t\t\t\terror: 'error',\n\t\t\t\tinfo: 'info',\n\t\t\t\tsuccess: 'success',\n\t\t\t\twarning: 'warning'\n\t\t\t};\n\n\t\t\tvar toastr = {\n\t\t\t\tclear: clear,\n\t\t\t\terror: error,\n\t\t\t\tgetContainer: getContainer,\n\t\t\t\tinfo: info,\n\t\t\t\toptions: {},\n\t\t\t\tsubscribe: subscribe,\n\t\t\t\tsuccess: success,\n\t\t\t\tversion: version,\n\t\t\t\twarning: warning\n\t\t\t};\n\n\t\t\treturn toastr;\n\n\t\t\t//#region Accessible Methods\n\t\t\tfunction error(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.error,\n\t\t\t\t\ticonClass: getOptions().iconClasses.error,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction info(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.info,\n\t\t\t\t\ticonClass: getOptions().iconClasses.info,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction subscribe(callback) {\n\t\t\t\tlistener = callback;\n\t\t\t}\n\n\t\t\tfunction success(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.success,\n\t\t\t\t\ticonClass: getOptions().iconClasses.success,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction warning(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.warning,\n\t\t\t\t\ticonClass: getOptions().iconClasses.warning,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction clear($toastElement) {\n\t\t\t\tvar options = getOptions();\n\t\t\t\tif (!$container) { getContainer(options); }\n\t\t\t\tif ($toastElement && $(':focus', $toastElement).length === 0) {\n\t\t\t\t\t$toastElement[options.hideMethod]({\n\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\tcomplete: function () { removeToast($toastElement); }\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ($container.children().length) {\n\t\t\t\t\t$container[options.hideMethod]({\n\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\tcomplete: function () { $container.remove(); }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\t//#endregion\n\n\t\t\t//#region Internal Methods\n\n\t\t\tfunction getDefaults() {\n\t\t\t\treturn {\n\t\t\t\t\ttapToDismiss: true,\n\t\t\t\t\ttoastClass: 'toast',\n\t\t\t\t\tcontainerId: 'toast-container',\n\t\t\t\t\tdebug: false,\n\n\t\t\t\t\tshowMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery\n\t\t\t\t\tshowDuration: 300,\n\t\t\t\t\tshowEasing: 'swing', //swing and linear are built into jQuery\n\t\t\t\t\tonShown: undefined,\n\t\t\t\t\thideMethod: 'fadeOut',\n\t\t\t\t\thideDuration: 1000,\n\t\t\t\t\thideEasing: 'swing',\n\t\t\t\t\tonHidden: undefined,\n\n\t\t\t\t\textendedTimeOut: 1000,\n\t\t\t\t\ticonClasses: {\n\t\t\t\t\t\terror: 'toast-error',\n\t\t\t\t\t\tinfo: 'toast-info',\n\t\t\t\t\t\tsuccess: 'toast-success',\n\t\t\t\t\t\twarning: 'toast-warning'\n\t\t\t\t\t},\n\t\t\t\t\ticonClass: 'toast-info',\n\t\t\t\t\tpositionClass: 'toast-top-right',\n\t\t\t\t\ttimeOut: 5000, // Set timeOut and extendedTimeout to 0 to make it sticky\n\t\t\t\t\ttitleClass: 'toast-title',\n\t\t\t\t\tmessageClass: 'toast-message',\n\t\t\t\t\ttarget: 'body',\n\t\t\t\t\tcloseHtml: '',\n\t\t\t\t\tnewestOnTop: true\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfunction publish(args) {\n\t\t\t\tif (!listener) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlistener(args);\n\t\t\t}\n\n\t\t\tfunction notify(map) {\n\t\t\t\tvar\n\t\t\t\t\toptions = getOptions(),\n\t\t\t\t\ticonClass = map.iconClass || options.iconClass;\n\n\t\t\t\tif (typeof (map.optionsOverride) !== 'undefined') {\n\t\t\t\t\toptions = $.extend(options, map.optionsOverride);\n\t\t\t\t\ticonClass = map.optionsOverride.iconClass || iconClass;\n\t\t\t\t}\n\n\t\t\t\ttoastId++;\n\n\t\t\t\t$container = getContainer(options);\n\t\t\t\tvar\n\t\t\t\t\tintervalId = null,\n\t\t\t\t\t$toastElement = $('
                '),\n\t\t\t\t\t$titleElement = $('
                '),\n\t\t\t\t\t$messageElement = $('
                '),\n\t\t\t\t\t$closeElement = $(options.closeHtml),\n\t\t\t\t\tresponse = {\n\t\t\t\t\t\ttoastId: toastId,\n\t\t\t\t\t\tstate: 'visible',\n\t\t\t\t\t\tstartTime: new Date(),\n\t\t\t\t\t\toptions: options,\n\t\t\t\t\t\tmap: map\n\t\t\t\t\t};\n\n\t\t\t\tif (map.iconClass) {\n\t\t\t\t\t$toastElement.addClass(options.toastClass).addClass(iconClass);\n\t\t\t\t}\n\n\t\t\t\tif (map.title) {\n\t\t\t\t\t$titleElement.append(map.title).addClass(options.titleClass);\n\t\t\t\t\t$toastElement.append($titleElement);\n\t\t\t\t}\n\n\t\t\t\tif (map.message) {\n\t\t\t\t\t$messageElement.append(map.message).addClass(options.messageClass);\n\t\t\t\t\t$toastElement.append($messageElement);\n\t\t\t\t}\n\n\t\t\t\tif (options.closeButton) {\n\t\t\t\t\t$closeElement.addClass('toast-close-button');\n\t\t\t\t\t$toastElement.prepend($closeElement);\n\t\t\t\t}\n\n\t\t\t\t$toastElement.hide();\n\t\t\t\tif (options.newestOnTop) {\n\t\t\t\t\t$container.prepend($toastElement);\n\t\t\t\t} else {\n\t\t\t\t\t$container.append($toastElement);\n\t\t\t\t}\n\n\n\t\t\t\t$toastElement[options.showMethod](\n\t\t\t\t\t{ duration: options.showDuration, easing: options.showEasing, complete: options.onShown }\n\t\t\t\t);\n\t\t\t\tif (options.timeOut > 0) {\n\t\t\t\t\tintervalId = setTimeout(hideToast, options.timeOut);\n\t\t\t\t}\n\n\t\t\t\t$toastElement.hover(stickAround, delayedhideToast);\n\t\t\t\tif (!options.onclick && options.tapToDismiss) {\n\t\t\t\t\t$toastElement.click(hideToast);\n\t\t\t\t}\n\t\t\t\tif (options.closeButton && $closeElement) {\n\t\t\t\t\t$closeElement.click(function (event) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\thideToast(true);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (options.onclick) {\n\t\t\t\t\t$toastElement.click(function () {\n\t\t\t\t\t\toptions.onclick();\n\t\t\t\t\t\thideToast();\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tpublish(response);\n\n\t\t\t\tif (options.debug && console) {\n\t\t\t\t\tconsole.log(response);\n\t\t\t\t}\n\n\t\t\t\treturn $toastElement;\n\n\t\t\t\tfunction hideToast(override) {\n\t\t\t\t\tif ($(':focus', $toastElement).length && !override) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\treturn $toastElement[options.hideMethod]({\n\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\tremoveToast($toastElement);\n\t\t\t\t\t\t\tif (options.onHidden) {\n\t\t\t\t\t\t\t\toptions.onHidden();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresponse.state = 'hidden';\n\t\t\t\t\t\t\tresponse.endTime = new Date(),\n\t\t\t\t\t\t\tpublish(response);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfunction delayedhideToast() {\n\t\t\t\t\tif (options.timeOut > 0 || options.extendedTimeOut > 0) {\n\t\t\t\t\t\tintervalId = setTimeout(hideToast, options.extendedTimeOut);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction stickAround() {\n\t\t\t\t\tclearTimeout(intervalId);\n\t\t\t\t\t$toastElement.stop(true, true)[options.showMethod](\n\t\t\t\t\t\t{ duration: options.showDuration, easing: options.showEasing }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfunction getContainer(options) {\n\t\t\t\tif (!options) { options = getOptions(); }\n\t\t\t\t$container = $('#' + options.containerId);\n\t\t\t\tif ($container.length) {\n\t\t\t\t\treturn $container;\n\t\t\t\t}\n\t\t\t\t$container = $('
                ')\n\t\t\t\t\t.attr('id', options.containerId)\n\t\t\t\t\t.addClass(options.positionClass);\n\t\t\t\t$container.appendTo($(options.target));\n\t\t\t\treturn $container;\n\t\t\t}\n\n\t\t\tfunction getOptions() {\n\t\t\t\treturn $.extend({}, getDefaults(), toastr.options);\n\t\t\t}\n\n\t\t\tfunction removeToast($toastElement) {\n\t\t\t\tif (!$container) { $container = getContainer(); }\n\t\t\t\tif ($toastElement.is(':visible')) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$toastElement.remove();\n\t\t\t\t$toastElement = null;\n\t\t\t\tif ($container.children().length === 0) {\n\t\t\t\t\t$container.remove();\n\t\t\t\t}\n\t\t\t}\n\t\t\t//#endregion\n\n\t\t})();\n\t});\n}(typeof define === 'function' && define.amd ? define : function (deps, factory) {\n\tif (typeof module !== 'undefined' && module.exports) { //Node\n\t\tmodule.exports = factory(require(deps[0]));\n\t} else {\n\t\twindow['toastr'] = factory(window['jQuery']);\n\t}\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/libs/toastr.js","define([\n \"mvc/collection/collection-li\",\n \"mvc/dataset/dataset-li-edit\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DC_LI, DATASET_LI_EDIT, BASE_MVC, _l ){\n\n'use strict';\n//==============================================================================\nvar DCListItemView = DC_LI.DCListItemView;\n/** @class Edit view for DatasetCollection.\n */\nvar DCListItemEdit = DCListItemView.extend(\n/** @lends DCListItemEdit.prototype */{\n\n /** override to add linkTarget */\n initialize : function( attributes ){\n DCListItemView.prototype.initialize.call( this, attributes );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCListItemEdit(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\nvar DCEListItemView = DC_LI.DCEListItemView;\n/** @class Read only view for DatasetCollectionElement.\n */\nvar DCEListItemEdit = DCEListItemView.extend(\n/** @lends DCEListItemEdit.prototype */{\n//TODO: this might be expendable - compacted with HDAListItemView\n\n /** set up */\n initialize : function( attributes ){\n DCEListItemView.prototype.initialize.call( this, attributes );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCEListItemEdit(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\n// NOTE: this does not inherit from DatasetDCEListItemView as you would expect\n//TODO: but should - if we can find something simpler than using diamond\n/** @class Editable view for a DatasetCollectionElement that is also an DatasetAssociation\n * (a dataset contained in a dataset collection).\n */\nvar DatasetDCEListItemEdit = DATASET_LI_EDIT.DatasetListItemEdit.extend(\n/** @lends DatasetDCEListItemEdit.prototype */{\n\n /** set up */\n initialize : function( attributes ){\n DATASET_LI_EDIT.DatasetListItemEdit.prototype.initialize.call( this, attributes );\n },\n\n // NOTE: this does not inherit from DatasetDCEListItemView - so we duplicate this here\n //TODO: fix\n /** In this override, only get details if in the ready state.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n }\n return jQuery.when();\n },\n\n /** Override to remove delete button */\n _renderDeleteButton : function(){\n return null;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DatasetDCEListItemEdit(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetDCEListItemEdit.prototype.templates = (function(){\n\n return _.extend( {}, DATASET_LI_EDIT.DatasetListItemEdit.prototype.templates, {\n titleBar : DC_LI.DatasetDCEListItemView.prototype.templates.titleBar\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n * (a nested DC).\n */\nvar NestedDCDCEListItemEdit = DC_LI.NestedDCDCEListItemView.extend(\n/** @lends NestedDCDCEListItemEdit.prototype */{\n\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'NestedDCDCEListItemEdit(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\n return {\n DCListItemEdit : DCListItemEdit,\n DCEListItemEdit : DCEListItemEdit,\n DatasetDCEListItemEdit : DatasetDCEListItemEdit,\n NestedDCDCEListItemEdit : NestedDCDCEListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-li-edit.js","define([\n \"mvc/collection/collection-view\",\n \"mvc/collection/collection-model\",\n \"mvc/collection/collection-li-edit\",\n \"mvc/base-mvc\",\n \"mvc/tag\",\n \"ui/fa-icon-button\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function( DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, TAGS, faIconButton, _l ){\n\n'use strict';\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class editable View/Controller for a dataset collection.\n */\nvar _super = DC_VIEW.CollectionView;\nvar CollectionViewEdit = _super.extend(\n/** @lends CollectionView.prototype */{\n //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n\n /** logger used to record this.log messages, commonly set to console */\n //logger : console,\n\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_EDIT.DatasetDCEListItemEdit,\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit,\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the panel\n */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n },\n\n /** In this override, make the collection name editable\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n _super.prototype._setUpBehaviors.call( this, $where );\n if( !this.model ){ return; }\n\n // anon users shouldn't have access to any of the following\n if( !Galaxy.user || Galaxy.user.isAnonymous() ){\n return;\n }\n\n this.tagsEditorShown = true;\n\n //TODO: extract\n var panel = this,\n nameSelector = '> .controls .name';\n $where.find( nameSelector )\n .attr( 'title', _l( 'Click to rename collection' ) )\n .tooltip({ placement: 'bottom' })\n .make_text_editable({\n on_finish: function( newName ){\n var previousName = panel.model.get( 'name' );\n if( newName && newName !== previousName ){\n panel.$el.find( nameSelector ).text( newName );\n panel.model.save({ name: newName })\n .fail( function(){\n panel.$el.find( nameSelector ).text( panel.model.previous( 'name' ) );\n });\n } else {\n panel.$el.find( nameSelector ).text( previousName );\n }\n }\n });\n this.tagsEditor = new TAGS.TagsEditor({\n model : this.model,\n el : $where.find( '.tags-display' ),\n onshowFirstTime : function(){ this.render(); },\n usePrompt : false\n });\n this.tagsEditor.toggle( true );\n },\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'CollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListCollectionViewEdit = CollectionViewEdit.extend(\n/** @lends ListCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_EDIT.DatasetDCEListItemEdit,\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class Editable, read-only View/Controller for a dataset collection. */\nvar PairCollectionViewEdit = ListCollectionViewEdit.extend(\n/** @lends PairCollectionViewEdit.prototype */{\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'PairCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class Editable (roughly since these collections are immutable),\n * View/Controller for a dataset collection.\n */\nvar NestedPairCollectionViewEdit = PairCollectionViewEdit.extend(\n/** @lends NestedPairCollectionViewEdit.prototype */{\n\n /** Override to remove the editable text from the name/identifier - these collections are considered immutable */\n _setUpBehaviors : function( $where ){\n _super.prototype._setUpBehaviors.call( this, $where );\n },\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'NestedPairCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class editable, View/Controller for a list of pairs dataset collection. */\nvar ListOfPairsCollectionViewEdit = CollectionViewEdit.extend(\n/** @lends ListOfPairsCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_EDIT.NestedDCDCEListItemEdit.extend({\n foldoutPanelClass : NestedPairCollectionViewEdit\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListOfPairsCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class View/Controller for a list of lists dataset collection. */\nvar ListOfListsCollectionViewEdit = CollectionViewEdit.extend(\n/** @lends ListOfListsCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_EDIT.NestedDCDCEListItemEdit.extend({\n foldoutPanelClass : NestedPairCollectionViewEdit\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListOfListsCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//==============================================================================\n return {\n CollectionViewEdit : CollectionViewEdit,\n ListCollectionViewEdit : ListCollectionViewEdit,\n PairCollectionViewEdit : PairCollectionViewEdit,\n ListOfPairsCollectionViewEdit : ListOfPairsCollectionViewEdit,\n ListOfListsCollectionViewEdit : ListOfListsCollectionViewEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-view-edit.js","define([\n \"utils/levenshtein\",\n \"utils/natural-sort\",\n \"mvc/collection/base-creator\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( levenshteinDistance, naturalSort, baseCreator, baseMVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/* ============================================================================\nTODO:\n\n\nPROGRAMMATICALLY:\ncurrPanel.once( 'rendered', function(){\n currPanel.showSelectors();\n currPanel.selectAll();\n _.last( currPanel.actionsPopup.options ).func();\n});\n\n============================================================================ */\n/** A view for paired datasets in the collections creator.\n */\nvar PairView = Backbone.View.extend( baseMVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n tagName : 'li',\n className : 'dataset paired',\n\n initialize : function( attributes ){\n this.pair = attributes.pair || {};\n },\n\n template : _.template([\n '<%- pair.forward.name %>',\n '',\n '<%- pair.name %>',\n '',\n '<%- pair.reverse.name %>'\n ].join('')),\n\n render : function(){\n this.$el\n .attr( 'draggable', true )\n .data( 'pair', this.pair )\n .html( this.template({ pair: this.pair }) )\n .addClass( 'flex-column-container' );\n return this;\n },\n\n events : {\n 'dragstart' : '_dragstart',\n 'dragend' : '_dragend',\n 'dragover' : '_sendToParent',\n 'drop' : '_sendToParent'\n },\n\n /** dragging pairs for re-ordering */\n _dragstart : function( ev ){\n ev.currentTarget.style.opacity = '0.4';\n if( ev.originalEvent ){ ev = ev.originalEvent; }\n\n ev.dataTransfer.effectAllowed = 'move';\n ev.dataTransfer.setData( 'text/plain', JSON.stringify( this.pair ) );\n\n this.$el.parent().trigger( 'pair.dragstart', [ this ] );\n },\n\n /** dragging pairs for re-ordering */\n _dragend : function( ev ){\n ev.currentTarget.style.opacity = '1.0';\n this.$el.parent().trigger( 'pair.dragend', [ this ] );\n },\n\n /** manually bubble up an event to the parent/container */\n _sendToParent : function( ev ){\n this.$el.parent().trigger( ev );\n },\n\n /** string rep */\n toString : function(){\n return 'PairView(' + this.pair.name + ')';\n }\n});\n\n\n// ============================================================================\n/** returns an autopair function that uses the provided options.match function */\nfunction autoPairFnBuilder( options ){\n options = options || {};\n options.createPair = options.createPair || function _defaultCreatePair( params ){\n params = params || {};\n var a = params.listA.splice( params.indexA, 1 )[0],\n b = params.listB.splice( params.indexB, 1 )[0],\n aInBIndex = params.listB.indexOf( a ),\n bInAIndex = params.listA.indexOf( b );\n if( aInBIndex !== -1 ){ params.listB.splice( aInBIndex, 1 ); }\n if( bInAIndex !== -1 ){ params.listA.splice( bInAIndex, 1 ); }\n return this._pair( a, b, { silent: true });\n };\n // compile these here outside of the loop\n var _regexps = [];\n function getRegExps(){\n if( !_regexps.length ){\n _regexps = [\n new RegExp( this.filters[0] ),\n new RegExp( this.filters[1] )\n ];\n }\n return _regexps;\n }\n // mangle params as needed\n options.preprocessMatch = options.preprocessMatch || function _defaultPreprocessMatch( params ){\n var regexps = getRegExps.call( this );\n return _.extend( params, {\n matchTo : params.matchTo.name.replace( regexps[0], '' ),\n possible : params.possible.name.replace( regexps[1], '' )\n });\n };\n\n return function _strategy( params ){\n this.debug( 'autopair _strategy ---------------------------' );\n params = params || {};\n var listA = params.listA,\n listB = params.listB,\n indexA = 0, indexB,\n bestMatch = {\n score : 0.0,\n index : null\n },\n paired = [];\n //console.debug( 'params:', JSON.stringify( params, null, ' ' ) );\n this.debug( 'starting list lens:', listA.length, listB.length );\n this.debug( 'bestMatch (starting):', JSON.stringify( bestMatch, null, ' ' ) );\n\n while( indexA < listA.length ){\n var matchTo = listA[ indexA ];\n bestMatch.score = 0.0;\n\n for( indexB=0; indexB= scoreThreshold ){\n //console.debug( 'autoPairFnBuilder.strategy', listA[ indexA ].name, listB[ bestMatch.index ].name );\n paired.push( options.createPair.call( this, {\n listA : listA,\n indexA : indexA,\n listB : listB,\n indexB : bestMatch.index\n }));\n //console.debug( 'list lens now:', listA.length, listB.length );\n } else {\n indexA += 1;\n }\n if( !listA.length || !listB.length ){\n return paired;\n }\n }\n this.debug( 'paired:', JSON.stringify( paired, null, ' ' ) );\n this.debug( 'autopair _strategy ---------------------------' );\n return paired;\n };\n}\n\n\n// ============================================================================\n/** An interface for building collections of paired datasets.\n */\nvar PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).extend( baseCreator.CollectionCreatorMixin ).extend({\n _logNamespace : logNamespace,\n\n className: 'list-of-pairs-collection-creator collection-creator flex-row-container',\n\n /** set up initial options, instance vars, behaviors, and autopair (if set to do so) */\n initialize : function( attributes ){\n this.metric( 'PairedCollectionCreator.initialize', attributes );\n //this.debug( '-- PairedCollectionCreator:', attributes );\n\n attributes = _.defaults( attributes, {\n datasets : [],\n filters : this.DEFAULT_FILTERS,\n automaticallyPair : true,\n strategy : 'lcs',\n matchPercentage : 0.9,\n twoPassAutopairing : true\n });\n\n /** unordered, original list */\n this.initialList = attributes.datasets;\n\n /** is this from a history? if so, what's its id? */\n this.historyId = attributes.historyId;\n\n /** which filters should be used initially? (String[2] or name in commonFilters) */\n this.filters = this.commonFilters[ attributes.filters ] || this.commonFilters[ this.DEFAULT_FILTERS ];\n if( _.isArray( attributes.filters ) ){\n this.filters = attributes.filters;\n }\n\n /** try to auto pair the unpaired datasets on load? */\n this.automaticallyPair = attributes.automaticallyPair;\n\n /** what method to use for auto pairing (will be passed aggression level) */\n this.strategy = this.strategies[ attributes.strategy ] || this.strategies[ this.DEFAULT_STRATEGY ];\n if( _.isFunction( attributes.strategy ) ){\n this.strategy = attributes.strategy;\n }\n\n /** distance/mismatch level allowed for autopairing */\n this.matchPercentage = attributes.matchPercentage;\n\n /** try to autopair using simple first, then this.strategy on the remainder */\n this.twoPassAutopairing = attributes.twoPassAutopairing;\n\n /** remove file extensions (\\.*) from created pair names? */\n this.removeExtensions = true;\n //this.removeExtensions = false;\n\n /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n this.oncancel = attributes.oncancel;\n /** fn to call when the collection is created (scoped to this) */\n this.oncreate = attributes.oncreate;\n\n /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n this.autoscrollDist = attributes.autoscrollDist || 24;\n\n /** is the unpaired panel shown? */\n this.unpairedPanelHidden = false;\n /** is the paired panel shown? */\n this.pairedPanelHidden = false;\n\n /** DOM elements currently being dragged */\n this.$dragging = null;\n\n /** Used for blocking UI events during ajax/operations (don't post twice) */\n this.blocking = false;\n\n this._setUpCommonSettings( attributes );\n this._setUpBehaviors();\n this._dataSetUp();\n },\n\n /** map of common filter pairs by name */\n commonFilters : {\n illumina : [ '_1', '_2' ],\n Rs : [ '_R1', '_R2' ]\n },\n /** which commonFilter to use by default */\n DEFAULT_FILTERS : 'illumina',\n\n /** map of name->fn for autopairing */\n strategies : {\n 'simple' : 'autopairSimple',\n 'lcs' : 'autopairLCS',\n 'levenshtein' : 'autopairLevenshtein'\n },\n /** default autopair strategy name */\n DEFAULT_STRATEGY : 'lcs',\n\n // ------------------------------------------------------------------------ process raw list\n /** set up main data: cache initialList, sort, and autopair */\n _dataSetUp : function(){\n //this.debug( '-- _dataSetUp' );\n\n this.paired = [];\n this.unpaired = [];\n\n this.selectedIds = [];\n\n // sort initial list, add ids if needed, and save new working copy to unpaired\n this._sortInitialList();\n this._ensureIds();\n this.unpaired = this.initialList.slice( 0 );\n\n if( this.automaticallyPair ){\n this.autoPair();\n this.once( 'rendered:initial', function(){\n this.trigger( 'autopair' );\n });\n }\n },\n\n /** sort initial list */\n _sortInitialList : function(){\n //this.debug( '-- _sortInitialList' );\n this._sortDatasetList( this.initialList );\n },\n\n /** sort a list of datasets */\n _sortDatasetList : function( list ){\n // currently only natural sort by name\n list.sort( function( a, b ){ return naturalSort( a.name, b.name ); });\n return list;\n },\n\n /** add ids to dataset objs in initial list if none */\n _ensureIds : function(){\n this.initialList.forEach( function( dataset ){\n if( !dataset.hasOwnProperty( 'id' ) ){\n dataset.id = _.uniqueId();\n }\n });\n return this.initialList;\n },\n\n /** split initial list into two lists, those that pass forward filters & those passing reverse */\n _splitByFilters : function(){\n var regexFilters = this.filters.map( function( stringFilter ){\n return new RegExp( stringFilter );\n }),\n split = [ [], [] ];\n\n function _filter( unpaired, filter ){\n return filter.test( unpaired.name );\n //return dataset.name.indexOf( filter ) >= 0;\n }\n this.unpaired.forEach( function _filterEach( unpaired ){\n // 90% of the time this seems to work, but:\n //TODO: this treats *all* strings as regex which may confuse people - possibly check for // surrounding?\n // would need explanation in help as well\n regexFilters.forEach( function( filter, i ){\n if( _filter( unpaired, filter ) ){\n split[i].push( unpaired );\n }\n });\n });\n return split;\n },\n\n /** add a dataset to the unpaired list in it's proper order */\n _addToUnpaired : function( dataset ){\n // currently, unpaired is natural sorted by name, use binary search to find insertion point\n var binSearchSortedIndex = function( low, hi ){\n if( low === hi ){ return low; }\n\n var mid = Math.floor( ( hi - low ) / 2 ) + low,\n compared = naturalSort( dataset.name, this.unpaired[ mid ].name );\n\n if( compared < 0 ){\n return binSearchSortedIndex( low, mid );\n } else if( compared > 0 ){\n return binSearchSortedIndex( mid + 1, hi );\n }\n // walk the equal to find the last\n while( this.unpaired[ mid ] && this.unpaired[ mid ].name === dataset.name ){ mid++; }\n return mid;\n\n }.bind( this );\n\n this.unpaired.splice( binSearchSortedIndex( 0, this.unpaired.length ), 0, dataset );\n },\n\n // ------------------------------------------------------------------------ auto pairing\n /** two passes to automatically create pairs:\n * use both simpleAutoPair, then the fn mentioned in strategy\n */\n autoPair : function( strategy ){\n // split first using exact matching\n var split = this._splitByFilters(),\n paired = [];\n if( this.twoPassAutopairing ){\n paired = this.autopairSimple({\n listA : split[0],\n listB : split[1]\n });\n split = this._splitByFilters();\n }\n\n // uncomment to see printlns while running tests\n //this.debug = function(){ console.log.apply( console, arguments ); };\n\n // then try the remainder with something less strict\n strategy = strategy || this.strategy;\n split = this._splitByFilters();\n paired = paired.concat( this[ strategy ].call( this, {\n listA : split[0],\n listB : split[1]\n }));\n return paired;\n },\n\n /** autopair by exact match */\n autopairSimple : autoPairFnBuilder({\n scoreThreshold: function(){ return 0.6; },\n match : function _match( params ){\n params = params || {};\n if( params.matchTo === params.possible ){\n return {\n index: params.index,\n score: 1.0\n };\n }\n return params.bestMatch;\n }\n }),\n\n /** autopair by levenshtein edit distance scoring */\n autopairLevenshtein : autoPairFnBuilder({\n scoreThreshold: function(){ return this.matchPercentage; },\n match : function _matches( params ){\n params = params || {};\n var distance = levenshteinDistance( params.matchTo, params.possible ),\n score = 1.0 - ( distance / ( Math.max( params.matchTo.length, params.possible.length ) ) );\n if( score > params.bestMatch.score ){\n return {\n index: params.index,\n score: score\n };\n }\n return params.bestMatch;\n }\n }),\n\n /** autopair by longest common substrings scoring */\n autopairLCS : autoPairFnBuilder({\n scoreThreshold: function(){ return this.matchPercentage; },\n match : function _matches( params ){\n params = params || {};\n var match = this._naiveStartingAndEndingLCS( params.matchTo, params.possible ).length,\n score = match / ( Math.max( params.matchTo.length, params.possible.length ) );\n if( score > params.bestMatch.score ){\n return {\n index: params.index,\n score: score\n };\n }\n return params.bestMatch;\n }\n }),\n\n /** return the concat'd longest common prefix and suffix from two strings */\n _naiveStartingAndEndingLCS : function( s1, s2 ){\n var fwdLCS = '',\n revLCS = '',\n i = 0, j = 0;\n while( i < s1.length && i < s2.length ){\n if( s1[ i ] !== s2[ i ] ){\n break;\n }\n fwdLCS += s1[ i ];\n i += 1;\n }\n if( i === s1.length ){ return s1; }\n if( i === s2.length ){ return s2; }\n\n i = ( s1.length - 1 );\n j = ( s2.length - 1 );\n while( i >= 0 && j >= 0 ){\n if( s1[ i ] !== s2[ j ] ){\n break;\n }\n revLCS = [ s1[ i ], revLCS ].join( '' );\n i -= 1;\n j -= 1;\n }\n return fwdLCS + revLCS;\n },\n\n // ------------------------------------------------------------------------ pairing / unpairing\n /** create a pair from fwd and rev, removing them from unpaired, and placing the new pair in paired */\n _pair : function( fwd, rev, options ){\n options = options || {};\n this.debug( '_pair:', fwd, rev );\n var pair = this._createPair( fwd, rev, options.name );\n this.paired.push( pair );\n this.unpaired = _.without( this.unpaired, fwd, rev );\n if( !options.silent ){\n this.trigger( 'pair:new', pair );\n }\n return pair;\n },\n\n /** create a pair Object from fwd and rev, adding the name attribute (will guess if not given) */\n _createPair : function( fwd, rev, name ){\n // ensure existance and don't pair something with itself\n if( !( fwd && rev ) || ( fwd === rev ) ){\n throw new Error( 'Bad pairing: ' + [ JSON.stringify( fwd ), JSON.stringify( rev ) ] );\n }\n name = name || this._guessNameForPair( fwd, rev );\n return { forward : fwd, name : name, reverse : rev };\n },\n\n /** try to find a good pair name for the given fwd and rev datasets */\n _guessNameForPair : function( fwd, rev, removeExtensions ){\n removeExtensions = ( removeExtensions !== undefined )?( removeExtensions ):( this.removeExtensions );\n var fwdName = fwd.name,\n revName = rev.name,\n lcs = this._naiveStartingAndEndingLCS(\n fwdName.replace( new RegExp( this.filters[0] ), '' ),\n revName.replace( new RegExp( this.filters[1] ), '' )\n );\n if( removeExtensions ){\n var lastDotIndex = lcs.lastIndexOf( '.' );\n if( lastDotIndex > 0 ){\n var extension = lcs.slice( lastDotIndex, lcs.length );\n lcs = lcs.replace( extension, '' );\n fwdName = fwdName.replace( extension, '' );\n revName = revName.replace( extension, '' );\n }\n }\n return lcs || ( fwdName + ' & ' + revName );\n },\n\n /** unpair a pair, removing it from paired, and adding the fwd,rev datasets back into unpaired */\n _unpair : function( pair, options ){\n options = options || {};\n if( !pair ){\n throw new Error( 'Bad pair: ' + JSON.stringify( pair ) );\n }\n this.paired = _.without( this.paired, pair );\n this._addToUnpaired( pair.forward );\n this._addToUnpaired( pair.reverse );\n\n if( !options.silent ){\n this.trigger( 'pair:unpair', [ pair ] );\n }\n return pair;\n },\n\n /** unpair all paired datasets */\n unpairAll : function(){\n var pairs = [];\n while( this.paired.length ){\n pairs.push( this._unpair( this.paired[ 0 ], { silent: true }) );\n }\n this.trigger( 'pair:unpair', pairs );\n },\n\n // ------------------------------------------------------------------------ API\n /** convert a pair into JSON compatible with the collections API */\n _pairToJSON : function( pair, src ){\n src = src || 'hda';\n //TODO: consider making this the pair structure when created instead\n return {\n collection_type : 'paired',\n src : 'new_collection',\n name : pair.name,\n element_identifiers : [{\n name : 'forward',\n id : pair.forward.id,\n src : src\n }, {\n name : 'reverse',\n id : pair.reverse.id,\n src : src\n }]\n };\n },\n\n /** create the collection via the API\n * @returns {jQuery.xhr Object} the jquery ajax request\n */\n createList : function( name ){\n var creator = this,\n url = Galaxy.root + 'api/histories/' + this.historyId + '/contents/dataset_collections';\n\n //TODO: use ListPairedCollection.create()\n var ajaxData = {\n type : 'dataset_collection',\n collection_type : 'list:paired',\n hide_source_items : creator.hideOriginals || false,\n name : _.escape( name || creator.$( '.collection-name' ).val() ),\n element_identifiers : creator.paired.map( function( pair ){\n return creator._pairToJSON( pair );\n })\n\n };\n //this.debug( JSON.stringify( ajaxData ) );\n creator.blocking = true;\n return jQuery.ajax( url, {\n type : 'POST',\n contentType : 'application/json',\n dataType : 'json',\n data : JSON.stringify( ajaxData )\n })\n .always( function(){\n creator.blocking = false;\n })\n .fail( function( xhr, status, message ){\n creator._ajaxErrHandler( xhr, status, message );\n })\n .done( function( response, message, xhr ){\n //this.info( 'ok', response, message, xhr );\n creator.trigger( 'collection:created', response, message, xhr );\n creator.metric( 'collection:created', response );\n if( typeof creator.oncreate === 'function' ){\n creator.oncreate.call( this, response, message, xhr );\n }\n });\n },\n\n /** handle ajax errors with feedback and details to the user (if available) */\n _ajaxErrHandler : function( xhr, status, message ){\n this.error( xhr, status, message );\n var content = _l( 'An error occurred while creating this collection' );\n if( xhr ){\n if( xhr.readyState === 0 && xhr.status === 0 ){\n content += ': ' + _l( 'Galaxy could not be reached and may be updating.' )\n + _l( ' Try again in a few minutes.' );\n } else if( xhr.responseJSON ){\n content += '
                ' + JSON.stringify( xhr.responseJSON ) + '
                ';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n // ------------------------------------------------------------------------ rendering\n /** render the entire interface */\n render : function( speed, callback ){\n //this.debug( '-- _render' );\n //this.$el.empty().html( this.templates.main() );\n this.$el.empty().html( this.templates.main() );\n this._renderHeader( speed );\n this._renderMiddle( speed );\n this._renderFooter( speed );\n this._addPluginComponents();\n this.trigger( 'rendered', this );\n return this;\n },\n\n /** render the header section */\n _renderHeader : function( speed, callback ){\n //this.debug( '-- _renderHeader' );\n var $header = this.$( '.header' ).empty().html( this.templates.header() )\n .find( '.help-content' ).prepend( $( this.templates.helpContent() ) );\n\n this._renderFilters();\n return $header;\n },\n /** fill the filter inputs with the filter values */\n _renderFilters : function(){\n return this.$( '.forward-column .column-header input' ).val( this.filters[0] )\n .add( this.$( '.reverse-column .column-header input' ).val( this.filters[1] ) );\n },\n\n /** render the middle including unpaired and paired sections (which may be hidden) */\n _renderMiddle : function( speed, callback ){\n var $middle = this.$( '.middle' ).empty().html( this.templates.middle() );\n\n // (re-) hide the un/paired panels based on instance vars\n if( this.unpairedPanelHidden ){\n this.$( '.unpaired-columns' ).hide();\n } else if( this.pairedPanelHidden ){\n this.$( '.paired-columns' ).hide();\n }\n\n this._renderUnpaired();\n this._renderPaired();\n return $middle;\n },\n /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n _renderUnpaired : function( speed, callback ){\n //this.debug( '-- _renderUnpaired' );\n var creator = this,\n $fwd, $rev, $prd = [],\n split = this._splitByFilters();\n // update unpaired counts\n this.$( '.forward-column .title' )\n .text([ split[0].length, _l( 'unpaired forward' ) ].join( ' ' ));\n this.$( '.forward-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[0].length ) );\n this.$( '.reverse-column .title' )\n .text([ split[1].length, _l( 'unpaired reverse' ) ].join( ' ' ));\n this.$( '.reverse-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[1].length ) );\n\n this.$( '.unpaired-columns .column-datasets' ).empty();\n\n // show/hide the auto pair button if any unpaired are left\n this.$( '.autopair-link' ).toggle( this.unpaired.length !== 0 );\n if( this.unpaired.length === 0 ){\n this._renderUnpairedEmpty();\n return;\n }\n\n // create the dataset dom arrays\n $rev = split[1].map( function( dataset, i ){\n // if there'll be a fwd dataset across the way, add a button to pair the row\n if( ( split[0][ i ] !== undefined )\n && ( split[0][ i ] !== dataset ) ){\n $prd.push( creator._renderPairButton() );\n }\n return creator._renderUnpairedDataset( dataset );\n });\n $fwd = split[0].map( function( dataset ){\n return creator._renderUnpairedDataset( dataset );\n });\n\n if( !$fwd.length && !$rev.length ){\n this._renderUnpairedNotShown();\n return;\n }\n // add to appropo cols\n //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n // and swapping out that\n this.$( '.unpaired-columns .forward-column .column-datasets' ).append( $fwd )\n .add( this.$( '.unpaired-columns .paired-column .column-datasets' ).append( $prd ) )\n .add( this.$( '.unpaired-columns .reverse-column .column-datasets' ).append( $rev ) );\n this._adjUnpairedOnScrollbar();\n },\n /** return a string to display the count of filtered out datasets */\n _renderUnpairedDisplayStr : function( numFiltered ){\n return [ '(', numFiltered, ' ', _l( 'filtered out' ), ')' ].join('');\n },\n /** return an unattached jQuery DOM element to represent an unpaired dataset */\n _renderUnpairedDataset : function( dataset ){\n //TODO: to underscore template\n return $( '
              • ')\n .attr( 'id', 'dataset-' + dataset.id )\n .addClass( 'dataset unpaired' )\n .attr( 'draggable', true )\n .addClass( dataset.selected? 'selected': '' )\n .append( $( '' ).addClass( 'dataset-name' ).text( dataset.name ) )\n //??\n .data( 'dataset', dataset );\n },\n /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n _renderPairButton : function(){\n //TODO: *not* a dataset - don't pretend like it is\n return $( '
              • ').addClass( 'dataset unpaired' )\n .append( $( '' ).addClass( 'dataset-name' ).text( _l( 'Pair these datasets' ) ) );\n },\n /** a message to display when no unpaired left */\n _renderUnpairedEmpty : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '
                ' )\n .text( '(' + _l( 'no remaining unpaired datasets' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** a message to display when no unpaired can be shown with the current filters */\n _renderUnpairedNotShown : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '
                ' )\n .text( '(' + _l( 'no datasets were found matching the current filters' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n _adjUnpairedOnScrollbar : function(){\n var $unpairedColumns = this.$( '.unpaired-columns' ).last(),\n $firstDataset = this.$( '.unpaired-columns .reverse-column .dataset' ).first();\n if( !$firstDataset.length ){ return; }\n var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n rightDiff = Math.floor( ucRight ) - Math.floor( dsRight );\n //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n this.$( '.unpaired-columns .forward-column' )\n .css( 'margin-left', ( rightDiff > 0 )? rightDiff: 0 );\n },\n\n /** render the paired section and update counts of paired datasets */\n _renderPaired : function( speed, callback ){\n //this.debug( '-- _renderPaired' );\n this.$( '.paired-column-title .title' ).text([ this.paired.length, _l( 'paired' ) ].join( ' ' ) );\n // show/hide the unpair all link\n this.$( '.unpair-all-link' ).toggle( this.paired.length !== 0 );\n if( this.paired.length === 0 ){\n this._renderPairedEmpty();\n return;\n //TODO: would be best to return here (the $columns)\n } else {\n // show/hide 'remove extensions link' when any paired and they seem to have extensions\n this.$( '.remove-extensions-link' ).show();\n }\n\n this.$( '.paired-columns .column-datasets' ).empty();\n var creator = this;\n this.paired.forEach( function( pair, i ){\n //TODO: cache these?\n var pairView = new PairView({ pair: pair });\n creator.$( '.paired-columns .column-datasets' )\n .append( pairView.render().$el )\n .append([\n ''\n ].join( '' ));\n });\n },\n /** a message to display when none paired */\n _renderPairedEmpty : function(){\n var $msg = $( '
                ' )\n .text( '(' + _l( 'no paired datasets yet' ) + ')' );\n this.$( '.paired-columns .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n\n footerSettings : {\n '.hide-originals': 'hideOriginals',\n '.remove-extensions': 'removeExtensions'\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents : function(){\n this._chooseFiltersPopover( '.choose-filters-link' );\n this.$( '.help-content i' ).hoverhighlight( '.collection-creator', 'rgba( 64, 255, 255, 1.0 )' );\n },\n\n /** build a filter selection popover allowing selection of common filter pairs */\n _chooseFiltersPopover : function( selector ){\n function filterChoice( val1, val2 ){\n return [\n ''\n ].join('');\n }\n var $popoverContent = $( _.template([\n '
                ',\n '
                ',\n _l( 'Choose from the following filters to change which unpaired reads are shown in the display' ),\n ':
                ',\n _.values( this.commonFilters ).map( function( filterSet ){\n return filterChoice( filterSet[0], filterSet[1] );\n }).join( '' ),\n '
                '\n ].join(''))({}));\n\n return this.$( selector ).popover({\n container : '.collection-creator',\n placement : 'bottom',\n html : true,\n //animation : false,\n content : $popoverContent\n });\n },\n\n /** add (or clear if clear is truthy) a validation warning to what */\n _validationWarning : function( what, clear ){\n var VALIDATION_CLASS = 'validation-warning';\n if( what === 'name' ){\n what = this.$( '.collection-name' ).add( this.$( '.collection-name-prompt' ) );\n this.$( '.collection-name' ).focus().select();\n }\n if( clear ){\n what = what || this.$( '.' + VALIDATION_CLASS );\n what.removeClass( VALIDATION_CLASS );\n } else {\n what.addClass( VALIDATION_CLASS );\n }\n },\n\n // ------------------------------------------------------------------------ events\n /** set up event handlers on self */\n _setUpBehaviors : function(){\n this.once( 'rendered', function(){\n this.trigger( 'rendered:initial', this );\n });\n\n this.on( 'pair:new', function(){\n //TODO: ideally only re-render the columns (or even elements) involved\n this._renderUnpaired();\n this._renderPaired();\n\n // scroll to bottom where new pairs are added\n //TODO: this doesn't seem to work - innerHeight sticks at 133...\n // may have to do with improper flex columns\n //var $pairedView = this.$( '.paired-columns' );\n //$pairedView.scrollTop( $pairedView.innerHeight() );\n //this.debug( $pairedView.height() )\n this.$( '.paired-columns' ).scrollTop( 8000000 );\n });\n this.on( 'pair:unpair', function( pairs ){\n //TODO: ideally only re-render the columns (or even elements) involved\n this._renderUnpaired();\n this._renderPaired();\n this.splitView();\n });\n\n this.on( 'filter-change', function(){\n this.filters = [\n this.$( '.forward-unpaired-filter input' ).val(),\n this.$( '.reverse-unpaired-filter input' ).val()\n ];\n this.metric( 'filter-change', this.filters );\n this._renderFilters();\n this._renderUnpaired();\n });\n\n this.on( 'autopair', function(){\n this._renderUnpaired();\n this._renderPaired();\n\n var message, msgClass = null;\n if( this.paired.length ){\n msgClass = 'alert-success';\n message = this.paired.length + ' ' + _l( 'pairs created' );\n if( !this.unpaired.length ){\n message += ': ' + _l( 'all datasets have been successfully paired' );\n this.hideUnpaired();\n this.$( '.collection-name' ).focus();\n }\n } else {\n message = _l([\n 'Could not automatically create any pairs from the given dataset names.',\n 'You may want to choose or enter different filters and try auto-pairing again.',\n 'Close this message using the X on the right to view more help.'\n ].join( ' ' ));\n }\n this._showAlert( message, msgClass );\n });\n\n //this.on( 'all', function(){\n // this.info( arguments );\n //});\n return this;\n },\n\n events : {\n // header\n 'click .more-help' : '_clickMoreHelp',\n 'click .less-help' : '_clickLessHelp',\n 'click .main-help' : '_toggleHelp',\n 'click .header .alert button' : '_hideAlert',\n 'click .forward-column .column-title' : '_clickShowOnlyUnpaired',\n 'click .reverse-column .column-title' : '_clickShowOnlyUnpaired',\n 'click .unpair-all-link' : '_clickUnpairAll',\n //TODO: this seems kinda backasswards - re-sending jq event as a backbone event, can we listen directly?\n 'change .forward-unpaired-filter input' : function( ev ){ this.trigger( 'filter-change' ); },\n 'focus .forward-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\n 'click .autopair-link' : '_clickAutopair',\n 'click .choose-filters .filter-choice' : '_clickFilterChoice',\n 'click .clear-filters-link' : '_clearFilters',\n 'change .reverse-unpaired-filter input' : function( ev ){ this.trigger( 'filter-change' ); },\n 'focus .reverse-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\n // unpaired\n 'click .forward-column .dataset.unpaired' : '_clickUnpairedDataset',\n 'click .reverse-column .dataset.unpaired' : '_clickUnpairedDataset',\n 'click .paired-column .dataset.unpaired' : '_clickPairRow',\n 'click .unpaired-columns' : 'clearSelectedUnpaired',\n 'mousedown .unpaired-columns .dataset' : '_mousedownUnpaired',\n // divider\n 'click .paired-column-title' : '_clickShowOnlyPaired',\n 'mousedown .flexible-partition-drag' : '_startPartitionDrag',\n // paired\n 'click .paired-columns .dataset.paired' : 'selectPair',\n 'click .paired-columns' : 'clearSelectedPaired',\n 'click .paired-columns .pair-name' : '_clickPairName',\n 'click .unpair-btn' : '_clickUnpair',\n // paired - drop target\n //'dragenter .paired-columns' : '_dragenterPairedColumns',\n //'dragleave .paired-columns .column-datasets': '_dragleavePairedColumns',\n 'dragover .paired-columns .column-datasets' : '_dragoverPairedColumns',\n 'drop .paired-columns .column-datasets' : '_dropPairedColumns',\n\n 'pair.dragstart .paired-columns .column-datasets' : '_pairDragstart',\n 'pair.dragend .paired-columns .column-datasets' : '_pairDragend',\n\n // footer\n 'change .remove-extensions' : function( ev ){ this.toggleExtensions(); },\n 'change .collection-name' : '_changeName',\n 'keydown .collection-name' : '_nameCheckForEnter',\n 'change .hide-originals' : '_changeHideOriginals',\n 'click .cancel-create' : '_cancelCreate',\n 'click .create-collection' : '_clickCreate'//,\n },\n\n /** toggle between showing only unpaired and split view */\n _clickShowOnlyUnpaired : function( ev ){\n //this.debug( 'click unpaired', ev.currentTarget );\n if( this.$( '.paired-columns' ).is( ':visible' ) ){\n this.hidePaired();\n } else {\n this.splitView();\n }\n },\n /** toggle between showing only paired and split view */\n _clickShowOnlyPaired : function( ev ){\n //this.debug( 'click paired' );\n if( this.$( '.unpaired-columns' ).is( ':visible' ) ){\n this.hideUnpaired();\n } else {\n this.splitView();\n }\n },\n\n /** hide unpaired, show paired */\n hideUnpaired : function( speed, callback ){\n this.unpairedPanelHidden = true;\n this.pairedPanelHidden = false;\n this._renderMiddle( speed, callback );\n },\n /** hide paired, show unpaired */\n hidePaired : function( speed, callback ){\n this.unpairedPanelHidden = false;\n this.pairedPanelHidden = true;\n this._renderMiddle( speed, callback );\n },\n /** show both paired and unpaired (splitting evenly) */\n splitView : function( speed, callback ){\n this.unpairedPanelHidden = this.pairedPanelHidden = false;\n this._renderMiddle( speed, callback );\n return this;\n },\n\n /** unpair all paired and do other super neat stuff which I'm not really sure about yet... */\n _clickUnpairAll : function( ev ){\n this.metric( 'unpairAll' );\n this.unpairAll();\n },\n\n /** attempt to autopair */\n _clickAutopair : function( ev ){\n var paired = this.autoPair();\n this.metric( 'autopair', paired.length, this.unpaired.length );\n this.trigger( 'autopair' );\n },\n\n /** set the filters based on the data attributes of the button click target */\n _clickFilterChoice : function( ev ){\n var $selected = $( ev.currentTarget );\n this.$( '.forward-unpaired-filter input' ).val( $selected.data( 'forward' ) );\n this.$( '.reverse-unpaired-filter input' ).val( $selected.data( 'reverse' ) );\n this._hideChooseFilters();\n this.trigger( 'filter-change' );\n },\n\n /** hide the choose filters popover */\n _hideChooseFilters : function(){\n //TODO: update bootstrap and remove the following hack\n // see also: https://github.com/twbs/bootstrap/issues/10260\n this.$( '.choose-filters-link' ).popover( 'hide' );\n this.$( '.popover' ).css( 'display', 'none' );\n },\n\n /** clear both filters */\n _clearFilters : function( ev ){\n this.$( '.forward-unpaired-filter input' ).val( '' );\n this.$( '.reverse-unpaired-filter input' ).val( '' );\n this.trigger( 'filter-change' );\n },\n\n // ........................................................................ unpaired\n /** select an unpaired dataset */\n _clickUnpairedDataset : function( ev ){\n ev.stopPropagation();\n return this.toggleSelectUnpaired( $( ev.currentTarget ) );\n },\n\n /** Toggle the selection of an unpaired dataset representation.\n * @param [jQuery] $dataset the unpaired dataset dom rep to select\n * @param [Boolean] options.force if defined, force selection based on T/F; otherwise, toggle\n */\n toggleSelectUnpaired : function( $dataset, options ){\n options = options || {};\n var dataset = $dataset.data( 'dataset' ),\n select = options.force !== undefined? options.force: !$dataset.hasClass( 'selected' );\n //this.debug( id, options.force, $dataset, dataset );\n if( !$dataset.length || dataset === undefined ){ return $dataset; }\n\n if( select ){\n $dataset.addClass( 'selected' );\n if( !options.waitToPair ){\n this.pairAllSelected();\n }\n\n } else {\n $dataset.removeClass( 'selected' );\n //delete dataset.selected;\n }\n return $dataset;\n },\n\n /** pair all the currently selected unpaired datasets */\n pairAllSelected : function( options ){\n options = options || {};\n var creator = this,\n fwds = [],\n revs = [],\n pairs = [];\n creator.$( '.unpaired-columns .forward-column .dataset.selected' ).each( function(){\n fwds.push( $( this ).data( 'dataset' ) );\n });\n creator.$( '.unpaired-columns .reverse-column .dataset.selected' ).each( function(){\n revs.push( $( this ).data( 'dataset' ) );\n });\n fwds.length = revs.length = Math.min( fwds.length, revs.length );\n //this.debug( fwds );\n //this.debug( revs );\n fwds.forEach( function( fwd, i ){\n try {\n pairs.push( creator._pair( fwd, revs[i], { silent: true }) );\n\n } catch( err ){\n //TODO: preserve selected state of those that couldn't be paired\n //TODO: warn that some could not be paired\n creator.error( err );\n }\n });\n if( pairs.length && !options.silent ){\n this.trigger( 'pair:new', pairs );\n }\n return pairs;\n },\n\n /** clear the selection on all unpaired datasets */\n clearSelectedUnpaired : function(){\n this.$( '.unpaired-columns .dataset.selected' ).removeClass( 'selected' );\n },\n\n /** when holding down the shift key on a click, 'paint' the moused over datasets as selected */\n _mousedownUnpaired : function( ev ){\n if( ev.shiftKey ){\n var creator = this,\n $startTarget = $( ev.target ).addClass( 'selected' ),\n moveListener = function( ev ){\n creator.$( ev.target ).filter( '.dataset' ).addClass( 'selected' );\n };\n $startTarget.parent().on( 'mousemove', moveListener );\n\n // on any mouseup, stop listening to the move and try to pair any selected\n $( document ).one( 'mouseup', function( ev ){\n $startTarget.parent().off( 'mousemove', moveListener );\n creator.pairAllSelected();\n });\n }\n },\n\n /** attempt to pair two datasets directly across from one another */\n _clickPairRow : function( ev ){\n //if( !ev.currentTarget ){ return true; }\n var rowIndex = $( ev.currentTarget ).index(),\n fwd = $( '.unpaired-columns .forward-column .dataset' ).eq( rowIndex ).data( 'dataset' ),\n rev = $( '.unpaired-columns .reverse-column .dataset' ).eq( rowIndex ).data( 'dataset' );\n //this.debug( 'row:', rowIndex, fwd, rev );\n this._pair( fwd, rev );\n },\n\n // ........................................................................ divider/partition\n /** start dragging the visible divider/partition between unpaired and paired panes */\n _startPartitionDrag : function( ev ){\n var creator = this,\n startingY = ev.pageY;\n //this.debug( 'partition drag START:', ev );\n $( 'body' ).css( 'cursor', 'ns-resize' );\n creator.$( '.flexible-partition-drag' ).css( 'color', 'black' );\n\n function endDrag( ev ){\n //creator.debug( 'partition drag STOP:', ev );\n // doing this by an added class didn't really work well - kept flashing still\n creator.$( '.flexible-partition-drag' ).css( 'color', '' );\n $( 'body' ).css( 'cursor', '' ).unbind( 'mousemove', trackMouse );\n }\n function trackMouse( ev ){\n var offset = ev.pageY - startingY;\n //creator.debug( 'partition:', startingY, offset );\n if( !creator.adjPartition( offset ) ){\n //creator.debug( 'mouseup triggered' );\n $( 'body' ).trigger( 'mouseup' );\n }\n creator._adjUnpairedOnScrollbar();\n startingY += offset;\n }\n $( 'body' ).mousemove( trackMouse );\n $( 'body' ).one( 'mouseup', endDrag );\n },\n\n /** adjust the parition up/down +/-adj pixels */\n adjPartition : function( adj ){\n var $unpaired = this.$( '.unpaired-columns' ),\n $paired = this.$( '.paired-columns' ),\n unpairedHi = parseInt( $unpaired.css( 'height' ), 10 ),\n pairedHi = parseInt( $paired.css( 'height' ), 10 );\n //this.debug( adj, 'hi\\'s:', unpairedHi, pairedHi, unpairedHi + adj, pairedHi - adj );\n\n unpairedHi = Math.max( 10, unpairedHi + adj );\n pairedHi = pairedHi - adj;\n\n var movingUpwards = adj < 0;\n // when the divider gets close to the top - lock into hiding the unpaired section\n if( movingUpwards ){\n if( this.unpairedPanelHidden ){\n return false;\n } else if( unpairedHi <= 10 ){\n this.hideUnpaired();\n return false;\n }\n } else {\n if( this.unpairedPanelHidden ){\n $unpaired.show();\n this.unpairedPanelHidden = false;\n }\n }\n\n // when the divider gets close to the bottom - lock into hiding the paired section\n if( !movingUpwards ){\n if( this.pairedPanelHidden ){\n return false;\n } else if( pairedHi <= 15 ){\n this.hidePaired();\n return false;\n }\n\n } else {\n if( this.pairedPanelHidden ){\n $paired.show();\n this.pairedPanelHidden = false;\n }\n }\n\n $unpaired.css({\n height : unpairedHi + 'px',\n flex : '0 0 auto'\n });\n return true;\n },\n\n // ........................................................................ paired\n /** select a pair when clicked */\n selectPair : function( ev ){\n ev.stopPropagation();\n $( ev.currentTarget ).toggleClass( 'selected' );\n },\n\n /** deselect all pairs */\n clearSelectedPaired : function( ev ){\n this.$( '.paired-columns .dataset.selected' ).removeClass( 'selected' );\n },\n\n /** rename a pair when the pair name is clicked */\n _clickPairName : function( ev ){\n ev.stopPropagation();\n var $name = $( ev.currentTarget ),\n $pair = $name.parent().parent(),\n index = $pair.index( '.dataset.paired' ),\n pair = this.paired[ index ],\n response = prompt( 'Enter a new name for the pair:', pair.name );\n if( response ){\n pair.name = response;\n // set a flag (which won't be passed in json creation) for manual naming so we don't overwrite these\n // when adding/removing extensions\n //hackish\n pair.customizedName = true;\n $name.text( pair.name );\n }\n },\n\n /** unpair this pair */\n _clickUnpair : function( ev ){\n //if( !ev.currentTarget ){ return true; }\n var pairIndex = Math.floor( $( ev.currentTarget ).index( '.unpair-btn' ) );\n //this.debug( 'pair:', pairIndex );\n this._unpair( this.paired[ pairIndex ] );\n },\n\n // ........................................................................ paired - drag and drop re-ordering\n //_dragenterPairedColumns : function( ev ){\n // this.debug( '_dragenterPairedColumns:', ev );\n //},\n //_dragleavePairedColumns : function( ev ){\n // //this.debug( '_dragleavePairedColumns:', ev );\n //},\n /** track the mouse drag over the paired list adding a placeholder to show where the drop would occur */\n _dragoverPairedColumns : function( ev ){\n //this.debug( '_dragoverPairedColumns:', ev );\n ev.preventDefault();\n\n var $list = this.$( '.paired-columns .column-datasets' );\n this._checkForAutoscroll( $list, ev.originalEvent.clientY );\n //this.debug( ev.originalEvent.clientX, ev.originalEvent.clientY );\n var $nearest = this._getNearestPairedDatasetLi( ev.originalEvent.clientY );\n\n $( '.element-drop-placeholder' ).remove();\n var $placeholder = $( '
                ' );\n if( !$nearest.length ){\n $list.append( $placeholder );\n } else {\n $nearest.before( $placeholder );\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll : function( $element, y ){\n var AUTOSCROLL_SPEED = 2;\n var offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = ( offset.top + $element.outerHeight() ) - y;\n //this.debug( '_checkForAutoscroll:', scrollTop, upperDist, lowerDist );\n if( upperDist >= 0 && upperDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop - AUTOSCROLL_SPEED );\n } else if( lowerDist >= 0 && lowerDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop + AUTOSCROLL_SPEED );\n }\n },\n\n /** get the nearest *previous* paired dataset PairView based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestPairedDatasetLi : function( y ){\n var WIGGLE = 4,\n lis = this.$( '.paired-columns .column-datasets li' ).toArray();\n for( var i=0; i y && top - halfHeight < y ){\n //this.debug( y, top + halfHeight, top - halfHeight )\n return $li;\n }\n }\n return $();\n },\n /** drop (dragged/selected PairViews) onto the list, re-ordering both the DOM and the internal array of pairs */\n _dropPairedColumns : function( ev ){\n // both required for firefox\n ev.preventDefault();\n ev.dataTransfer.dropEffect = 'move';\n\n var $nearest = this._getNearestPairedDatasetLi( ev.originalEvent.clientY );\n if( $nearest.length ){\n this.$dragging.insertBefore( $nearest );\n\n } else {\n // no nearest before - insert after last element (unpair button)\n this.$dragging.insertAfter( this.$( '.paired-columns .unpair-btn' ).last() );\n }\n // resync the creator's list of paired based on the new DOM order\n this._syncPairsToDom();\n return false;\n },\n /** resync the creator's list of paired based on the DOM order of pairs */\n _syncPairsToDom : function(){\n var newPaired = [];\n //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n this.$( '.paired-columns .dataset.paired' ).each( function(){\n newPaired.push( $( this ).data( 'pair' ) );\n });\n //this.debug( newPaired );\n this.paired = newPaired;\n this._renderPaired();\n },\n /** drag communication with pair sub-views: dragstart */\n _pairDragstart : function( ev, pair ){\n //this.debug( '_pairDragstart', ev, pair )\n // auto select the pair causing the event and move all selected\n pair.$el.addClass( 'selected' );\n var $selected = this.$( '.paired-columns .dataset.selected' );\n this.$dragging = $selected;\n },\n /** drag communication with pair sub-views: dragend - remove the placeholder */\n _pairDragend : function( ev, pair ){\n //this.debug( '_pairDragend', ev, pair )\n $( '.element-drop-placeholder' ).remove();\n this.$dragging = null;\n },\n\n // ........................................................................ footer\n toggleExtensions : function( force ){\n var creator = this;\n creator.removeExtensions = ( force !== undefined )?( force ):( !creator.removeExtensions );\n\n _.each( creator.paired, function( pair ){\n // don't overwrite custom names\n if( pair.customizedName ){ return; }\n pair.name = creator._guessNameForPair( pair.forward, pair.reverse );\n });\n\n creator._renderPaired();\n creator._renderFooter();\n },\n\n // ------------------------------------------------------------------------ misc\n /** debug a dataset list */\n _printList : function( list ){\n var creator = this;\n _.each( list, function( e ){\n if( list === creator.paired ){\n creator._printPair( e );\n } else {\n //creator.debug( e );\n }\n });\n },\n\n /** print a pair Object */\n _printPair : function( pair ){\n this.debug( pair.forward.name, pair.reverse.name, ': ->', pair.name );\n },\n\n /** string rep */\n toString : function(){ return 'PairedCollectionCreator'; },\n\n templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\n /** the header (not including help text) */\n header : _.template([\n '
                ',\n '', _l( 'More help' ), '',\n '
                ',\n '', _l( 'Less' ), '',\n '
                ',\n '
                ',\n '
                ',\n '',\n '',\n '
                ',\n\n '
                ',\n '
                ',\n '
                ',\n '
                ',\n '', _l( 'Unpaired forward' ), '',\n '',\n '
                ',\n '
                ',\n '',\n '
                ',\n '
                ',\n '
                ',\n '',\n '
                ',\n '
                ',\n '
                ',\n '', _l( 'Unpaired reverse' ), '',\n '',\n '
                ',\n '
                ',\n '',\n '
                ',\n '
                ',\n '
                ',\n '
                '\n ].join('')),\n\n /** the middle: unpaired, divider, and paired */\n middle : _.template([\n // contains two flex rows (rows that fill available space) and a divider btwn\n '
                ',\n '
                ',\n '
                  ',\n '
                  ',\n '
                  ',\n '
                    ',\n '
                    ',\n '
                    ',\n '
                      ',\n '
                      ',\n '
                      ',\n '
                      ',\n '
                      ',\n '
                      ',\n '
                      ',\n '',\n '
                      ',\n '',\n _l( 'Unpair all' ),\n '',\n '
                      ',\n '
                      ',\n '
                      ',\n '
                        ',\n '
                        '\n ].join('')),\n\n /** creation and cancel controls */\n footer : _.template([\n '
                        ',\n '
                        ',\n '',\n '',\n '
                        ',\n '
                        ',\n '',\n '
                        ', _l( 'Name' ), ':
                        ',\n '
                        ',\n '
                        ',\n\n '
                        ',\n '
                        ',\n '',\n '
                        ',\n '',\n '',\n '
                        ',\n '
                        ',\n\n '
                        ',\n '',\n '
                        ',\n '
                        '\n ].join('')),\n\n /** help content */\n helpContent : _.template([\n '

                        ', _l([\n 'Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ',\n 'These collections can be passed to tools and workflows in order to have analyses done on each member of ',\n 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ',\n 'and re-order the final collection.'\n ].join( '' )), '

                        ',\n '

                        ', _l([\n 'Unpaired datasets are shown in the unpaired section ',\n '(hover over the underlined words to highlight below). ',\n 'Paired datasets are shown in the paired section.',\n '

                          To pair datasets, you can:',\n '
                        • Click a dataset in the ',\n 'forward column ',\n 'to select it then click a dataset in the ',\n 'reverse column.',\n '
                        • ',\n '
                        • Click one of the \"Pair these datasets\" buttons in the ',\n 'middle column ',\n 'to pair the datasets in a particular row.',\n '
                        • ',\n '
                        • Click \"Auto-pair\" ',\n 'to have your datasets automatically paired based on name.',\n '
                        • ',\n '
                        '\n ].join( '' )), '

                        ',\n '

                        ', _l([\n '

                          You can filter what is shown in the unpaired sections by:',\n '
                        • Entering partial dataset names in either the ',\n 'forward filter or ',\n 'reverse filter.',\n '
                        • ',\n '
                        • Choosing from a list of preset filters by clicking the ',\n '\"Choose filters\" link.',\n '
                        • ',\n '
                        • Entering regular expressions to match dataset names. See: ',\n 'MDN\\'s JavaScript Regular Expression Tutorial. ',\n 'Note: forward slashes (\\\\) are not needed.',\n '
                        • ',\n '
                        • Clearing the filters by clicking the ',\n '\"Clear filters\" link.',\n '
                        • ',\n '
                        '\n ].join( '' )), '

                        ',\n '

                        ', _l([\n 'To unpair individual dataset pairs, click the ',\n 'unpair buttons ( ). ',\n 'Click the \"Unpair all\" link to unpair all pairs.'\n ].join( '' )), '

                        ',\n '

                        ', _l([\n 'You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ',\n '\"Remove file extensions from pair names?\" control.'\n ].join( '' )), '

                        ',\n '

                        ', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\". ',\n '(Note: you do not have to pair all unpaired datasets to finish.)'\n ].join( '' )), '

                        '\n ].join(''))\n })\n});\n\n//=============================================================================\n/** a modal version of the paired collection creator */\nvar pairedCollectionCreatorModal = function _pairedCollectionCreatorModal( datasets, options ){\n\n var deferred = jQuery.Deferred(),\n creator;\n\n options = _.defaults( options || {}, {\n datasets : datasets,\n oncancel : function(){\n Galaxy.modal.hide();\n deferred.reject( 'cancelled' );\n },\n oncreate : function( creator, response ){\n Galaxy.modal.hide();\n deferred.resolve( response );\n }\n });\n\n if( !window.Galaxy || !Galaxy.modal ){\n throw new Error( 'Galaxy or Galaxy.modal not found' );\n }\n\n creator = new PairedCollectionCreator( options );\n Galaxy.modal.show({\n title : 'Create a collection of paired datasets',\n body : creator.$el,\n width : '80%',\n height : '800px',\n closing_events: true\n });\n creator.render();\n window.creator = creator;\n\n //TODO: remove modal header\n return deferred;\n};\n\n\n//=============================================================================\nfunction createListOfPairsCollection( collection, defaultHideSourceItems ){\n var elements = collection.toJSON();\n//TODO: validate elements\n return pairedCollectionCreatorModal( elements, {\n historyId : collection.historyId,\n defaultHideSourceItems: defaultHideSourceItems\n });\n}\n\n\n//=============================================================================\n return {\n PairedCollectionCreator : PairedCollectionCreator,\n pairedCollectionCreatorModal : pairedCollectionCreatorModal,\n createListOfPairsCollection : createListOfPairsCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js","define([\n \"mvc/collection/list-collection-creator\",\n \"mvc/history/hdca-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_CREATOR, HDCA, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/*==============================================================================\nTODO:\n the paired creator doesn't really mesh with the list creator as parent\n it may be better to make an abstract super class for both\n composites may inherit from this (or vis-versa)\n PairedDatasetCollectionElementView doesn't make a lot of sense\n\n==============================================================================*/\n/** */\nvar PairedDatasetCollectionElementView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n//TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName : 'li',\n className : 'collection-element',\n\n initialize : function( attributes ){\n this.element = attributes.element || {};\n this.identifier = attributes.identifier;\n },\n\n render : function(){\n this.$el\n .attr( 'data-element-id', this.element.id )\n .html( this.template({ identifier: this.identifier, element: this.element }) );\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template : _.template([\n '<%- identifier %>',\n '<%- element.name %>',\n ].join('')),\n\n /** remove the DOM and any listeners */\n destroy : function(){\n this.off();\n this.$el.remove();\n },\n\n /** string rep */\n toString : function(){\n return 'DatasetCollectionElementView()';\n }\n});\n\n\n// ============================================================================\nvar _super = LIST_CREATOR.ListCollectionCreator;\n\n/** An interface for building collections.\n */\nvar PairCollectionCreator = _super.extend({\n\n /** the class used to display individual elements */\n elementViewClass : PairedDatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass : HDCA.HistoryPairDatasetCollection,\n className : 'pair-collection-creator collection-creator flex-row-container',\n\n /** override to no-op */\n _mangleDuplicateNames : function(){},\n\n // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n // bad inital choices and\n // when the user has painted his/her self into a corner during creation/use-of-the-creator\n /** render the entire interface */\n render : function( speed, callback ){\n if( this.workingElements.length === 2 ){\n return _super.prototype.render.call( this, speed, callback );\n }\n return this._renderInvalid( speed, callback );\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** render forward/reverse */\n _renderList : function( speed, callback ){\n //this.debug( '-- _renderList' );\n //precondition: there are two valid elements in workingElements\n var creator = this,\n $tmp = jQuery( '
                        ' ),\n $list = creator.$list();\n\n // lose the original views, create the new, append all at once, then call their renders\n _.each( this.elementViews, function( view ){\n view.destroy();\n creator.removeElementView( view );\n });\n $tmp.append( creator._createForwardElementView().$el );\n $tmp.append( creator._createReverseElementView().$el );\n $list.empty().append( $tmp.children() );\n _.invoke( creator.elementViews, 'render' );\n },\n\n /** create the forward element view */\n _createForwardElementView : function(){\n return this._createElementView( this.workingElements[0], { identifier: 'forward' } );\n },\n\n /** create the forward element view */\n _createReverseElementView : function(){\n return this._createElementView( this.workingElements[1], { identifier: 'reverse' } );\n },\n\n /** create an element view, cache in elementViews, and return */\n _createElementView : function( element, options ){\n var elementView = new this.elementViewClass( _.extend( options, {\n element : element,\n }));\n this.elementViews.push( elementView );\n return elementView;\n },\n\n /** swap the forward, reverse elements and re-render */\n swap : function(){\n this.workingElements = [\n this.workingElements[1],\n this.workingElements[0],\n ];\n this._renderList();\n },\n\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .swap' : 'swap',\n }),\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates : _.extend( _.clone( _super.prototype.templates ), {\n /** the middle: element list */\n middle : _.template([\n '',\n '
                        ',\n '
                        '\n ].join('')),\n\n /** help content */\n helpContent : _.template([\n '

                        ', _l([\n 'Pair collections are permanent collections containing two datasets: one forward and one reverse. ',\n 'Often these are forward and reverse reads. The pair collections can be passed to tools and ',\n 'workflows in order to have analyses done on both datasets. This interface allows ',\n 'you to create a pair, name it, and swap which is forward and which reverse.'\n ].join( '' )), '

                        ',\n '
                          ',\n '
                        • ', _l([\n 'Click the \"Swap\" link to make your forward dataset the reverse ',\n 'and the reverse dataset forward.'\n ].join( '' )), '
                        • ',\n '
                        • ', _l([\n 'Click the \"Cancel\" button to exit the interface.'\n ].join( '' )), '
                        • ',\n '

                        ',\n '

                        ', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '

                        '\n ].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial : _.template([\n '
                        ',\n '
                        ',\n '',\n '<% if( _.size( problems ) ){ %>',\n _l( 'The following selections could not be included due to problems' ),\n '
                          <% _.each( problems, function( problem ){ %>',\n '
                        • <%- problem.element.name %>: <%- problem.text %>
                        • ',\n '<% }); %>
                        ',\n '<% } else if( _.size( elements ) === 0 ){ %>',\n _l( 'No datasets were selected' ), '.',\n '<% } else if( _.size( elements ) === 1 ){ %>',\n _l( 'Only one dataset was selected' ), ': <%- elements[0].name %>',\n '<% } else if( _.size( elements ) > 2 ){ %>',\n _l( 'Too many datasets were selected' ),\n ': <%- _.pluck( elements, \"name\" ).join( \", \") %>',\n '<% } %>',\n '
                        ',\n _l( 'Two (and only two) elements are needed for the pair' ), '. ',\n _l( 'You may need to ' ),\n '', _l( 'cancel' ), ' ',\n _l( 'and reselect new elements' ), '.',\n '
                        ',\n '
                        ',\n '
                        ',\n '
                        ',\n '
                        ',\n '
                        ',\n '',\n // _l( 'Create a different kind of collection' ),\n '
                        ',\n '
                        ',\n '
                        '\n ].join('')),\n }),\n\n // ------------------------------------------------------------------------ misc\n /** string rep */\n toString : function(){ return 'PairCollectionCreator'; }\n});\n\n\n//==============================================================================\n/** List collection flavor of collectionCreatorModal. */\nvar pairCollectionCreatorModal = function _pairCollectionCreatorModal( elements, options ){\n options = options || {};\n options.title = _l( 'Create a collection from a pair of datasets' );\n return LIST_CREATOR.collectionCreatorModal( elements, options, PairCollectionCreator );\n};\n\n\n//==============================================================================\n/** Use a modal to create a pair collection, then add it to the given history contents.\n * @returns {Deferred} resolved when the collection is added to the history.\n */\nfunction createPairCollection( contents, defaultHideSourceItems ){\n var elements = contents.toJSON(),\n promise = pairCollectionCreatorModal( elements, {\n defaultHideSourceItems: defaultHideSourceItems,\n creationFn : function( elements, name, hideSourceItems ){\n elements = [\n { name: \"forward\", src: \"hda\", id: elements[0].id },\n { name: \"reverse\", src: \"hda\", id: elements[1].id }\n ];\n return contents.createHDCA( elements, 'paired', name, hideSourceItems );\n }\n });\n return promise;\n}\n\n//==============================================================================\n return {\n PairCollectionCreator : PairCollectionCreator,\n pairCollectionCreatorModal : pairCollectionCreatorModal,\n createPairCollection : createPairCollection,\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/pair-collection-creator.js","\ndefine( [ 'utils/utils', 'mvc/ui/ui-tabs', 'mvc/ui/ui-misc', 'mvc/form/form-view' ], function( Utils, Tabs, Ui, Form ) {\n\n /** Dataset edit attributes view */\n var View = Backbone.View.extend({\n initialize: function() {\n this.setElement( '
                        ' );\n this.model = new Backbone.Model( { 'dataset_id': Galaxy.params.dataset_id } );\n this.render();\n },\n\n // Fetch data for the selected dataset and \n // build tabs for editing its attributes\n render: function() {\n var url = Galaxy.root + 'dataset/edit',\n self = this;\n Utils.get({\n url : url,\n data : { 'dataset_id' : self.model.get( 'dataset_id' ) },\n success : function( response ) {\n self.render_attribute_page( self, response );\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while loading the dataset.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n\n /** Render all the tabs view */\n render_attribute_page: function( self, response ) {\n var message = {\n 'message' : response.message,\n 'status' : response.status,\n 'persistent' : true,\n 'cls' : response.status + 'message'\n };\n self.$el.empty().append( self._templateHeader() );\n self.display_message( message, self.$( '.response-message' ) );\n // Create all tabs\n self.create_tabs( response, self.$( '.edit-attr' ) );\n },\n\n /** Perform AJAX post call */\n call_ajax: function( self, data, tab_name ) {\n var post_url = Galaxy.root + 'dataset/edit';\n $.ajax({\n type: \"PUT\",\n url: post_url,\n data: data,\n success: function( response ) {\n self.render_attribute_page( self, response );\n self.reload_history();\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n\n /** Display actions messages */\n display_message: function( response, $el ) {\n $el.empty().html( new Ui.Message( response ).$el );\n },\n\n /** Create tabs for different attributes of dataset*/\n create_tabs: function( response, $el_edit_attr ) {\n var self = this;\n self.tabs = new Tabs.View();\n self.tabs.add({\n id : 'attributes',\n title : 'Attributes',\n icon : 'fa fa-bars',\n tooltip : 'Edit dataset attributes',\n $el : self._getAttributesFormTemplate( response )\n });\n\n self.tabs.add({\n id : 'convert',\n title : 'Convert',\n icon : 'fa-gear',\n tooltip : 'Convert to new format',\n $el : self._getConvertFormTemplate( response )\n });\n\n self.tabs.add({\n id : 'datatype',\n title : 'Datatypes',\n icon : 'fa-database',\n tooltip : 'Change data type',\n $el : self._getChangeDataTypeFormTemplate( response )\n });\n\n self.tabs.add({\n id : 'permissions',\n title : 'Permissions',\n icon : 'fa-user',\n tooltip : 'Permissions',\n $el : self._getPermissionsFormTemplate( response )\n });\n $el_edit_attr.append( self.tabs.$el );\n self.tabs.showTab( 'attributes' );\n },\n\n /** Main template */\n _templateHeader: function() {\n return '
                        ' +\n '
                        ' +\n '

                        Edit Dataset Attributes

                        ' +\n '
                        ';\n },\n\n /** Attributes tab template */\n _getAttributesFormTemplate: function( response ) {\n var self = this;\n var form = new Form({\n title : 'Edit attributes',\n inputs : response.edit_attributes_inputs,\n operations: {\n 'submit_editattr' : new Ui.ButtonIcon({\n tooltip : 'Save attributes of the dataset.',\n icon : 'fa-floppy-o ',\n title : 'Save attributes',\n onclick : function() { self._submit( self, form, response, \"edit_attributes\" ) }\n }),\n 'submit_autocorrect' : new Ui.ButtonIcon({\n tooltip : 'This will inspect the dataset and attempt to correct the values of fields if they are not accurate.',\n icon : 'fa-undo ',\n title : 'Auto-detect',\n onclick : function() { self._submit( self, form, response, \"auto-detect\" ) }\n })\n }\n });\n return form.$el;\n },\n\n /** Convert tab template */\n _getConvertFormTemplate: function( response ) {\n var self = this;\n var form = new Form({\n title : 'Convert to new format',\n inputs : response.convert_inputs,\n operations: {\n 'submit' : new Ui.ButtonIcon({\n tooltip : 'Convert the datatype to a new format.',\n title : 'Convert datatype',\n icon : 'fa-exchange ',\n onclick : function() { self._submit( self, form, response, \"convert\" ) }\n })\n }\n });\n return form.$el;\n },\n\n /** Change datatype template */\n _getChangeDataTypeFormTemplate: function( response ) {\n var self = this;\n var form = new Form({\n title : 'Change datatype',\n inputs : response.convert_datatype_inputs,\n operations: {\n 'submit' : new Ui.ButtonIcon({\n tooltip : 'Change the datatype to a new type.',\n title : 'Change datatype',\n icon : 'fa-exchange ',\n onclick : function() { self._submit( self, form, response, \"change\" ) }\n })\n }\n });\n return form.$el;\n },\n\n /** Permissions template */\n _getPermissionsFormTemplate: function( response ) {\n var template = \"\",\n self = this;\n if( response.can_manage_dataset ) {\n var form = new Form({\n title : 'Manage dataset permissions on ' + response.display_name,\n inputs : response.permission_inputs,\n operations: {\n 'submit': new Ui.ButtonIcon({\n tooltip : 'Save permissions.',\n title : 'Save permissions',\n icon : 'fa-floppy-o ',\n onclick : function() { self._submit( self, form, response, \"permissions\" ) }\n })\n }\n });\n return form.$el;\n }\n else {\n var form = new Form({\n title : 'View permissions',\n inputs : response.permission_inputs\n });\n return form.$el;\n }\n },\n\n /** Submit action */\n _submit: function( self, form, response, type ) {\n var form_data = form.data.create();\n form_data.dataset_id = response.dataset_id;\n switch( type ) {\n case \"edit_attributes\":\n form_data.save = 'Save';\n break;\n\n case \"auto-detect\":\n form_data.detect = 'Auto-detect';\n break;\n \n case \"convert\":\n if ( form_data.target_type !== null && form_data.target_type ) {\n form_data.dataset_id = response.dataset_id;\n form_data.convert_data = 'Convert';\n }\n break;\n\n case \"change\":\n form_data.change = 'Save';\n break;\n\n case \"permissions\":\n var post_data = {};\n post_data.permissions = JSON.stringify( form_data );\n post_data.update_roles_button = \"Save\";\n post_data.dataset_id = response.dataset_id;\n form_data = post_data;\n break; \n }\n self.call_ajax( self, form_data );\n },\n\n /** Reload Galaxy's history after updating dataset's attributes */\n reload_history: function() {\n if ( window.Galaxy ) {\n window.Galaxy.currHistoryPanel.loadCurrentHistory();\n }\n }\n });\n\n return {\n View : View\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-edit-attributes.js","define( [ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/form/form-view' ], function( Utils, Ui, Form ) {\n\n /** Dataset edit attributes view */\n var View = Backbone.View.extend({\n initialize: function() {\n this.setElement( '
                        ' );\n this.model = new Backbone.Model( { 'dataset_id': Galaxy.params.dataset_id } );\n this.render();\n },\n\n // Fetch data for the selected dataset and\n render: function() {\n var data_url = Galaxy.root + 'api/datasets/' + this.model.get( 'dataset_id' ),\n self = this;\n\n Utils.get({\n url : data_url,\n success : function( dataset ) {\n var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n Utils.get({\n url : job_url,\n success : function( job ) {\n var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n self.render_error_page( self, dataset, job );\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while loading the job.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while loading the dataset.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n\n /** Render the view */\n render_error_page: function( self, dataset, job ) {\n self.$el.empty().append( self._templateHeader() );\n self.$el.append('

                        Dataset Error

                        ');\n self.$el.append('

                        An error occured while running the tool ' + job.tool_id + '.

                        ');\n self.$el.append('

                        Tool execution generated the following messages:

                        ');\n self.$el.append('
                        ' + job.stderr + '
                        ');\n self.$el.append('

                        Report This Error

                      1. ');\n self.$el.append('

                        Usually the local Galaxy administrators regularly review errors that occur on the server. However, if you would like to provide additional information (such as what you were trying to do when the error occurred) and a contact e-mail address, we will be better able to investigate your problem and get back to you.

                        ');\n self.$el.append(self._getBugFormTemplate(dataset, job));\n },\n\n /** Display actions messages */\n display_message: function( response, $el, doNotClear, safe ) {\n if(!safe){\n if(doNotClear) {\n $el.append( new Ui.Message( response ).$el );\n } else {\n $el.empty().html( new Ui.Message( response ).$el );\n }\n } else {\n if(doNotClear) {\n $el.append( new Ui.UnescapedMessage( response ).$el );\n } else {\n $el.empty().html( new Ui.UnescapedMessage( response ).$el );\n }\n }\n },\n\n /** Main template */\n _templateHeader: function() {\n return '
                        ' +\n '
                        ' +\n '
                        ';\n },\n\n /** Convert tab template */\n _getBugFormTemplate: function(dataset, job) {\n var self = this;\n var inputs = [\n {\n \"help\": \"Your email address\",\n \"options\": [],\n \"type\": \"text\",\n \"name\": \"email\",\n \"label\": \"Your email\",\n \"value\": Galaxy.user.get('email')\n },\n {\n \"help\": \"Any additional comments you can provide regarding what you were doing at the time of the bug.\",\n \"options\": [],\n \"type\": \"text\",\n \"area\": true,\n \"name\": \"message\",\n \"label\": \"Message\"\n }\n ];\n\n // TODO\n if(false && response.any_public){\n inputs.push({\n \"name\": \"public_consent\",\n \"label\": \"Public Disclosure Consent\",\n \"help\": \"This Galaxy is configured to report to one or more error reporting backends that public to the world. By selecting 'yes', you acknowledge that this bug report will be made public.\",\n \"value\": String( Boolean( false ) ),\n \"options\": [],\n \"type\": \"boolean\",\n })\n }\n\n var form = new Form({\n title : 'Error Report',\n inputs : inputs,\n buttons : {\n save : new Ui.Button({\n icon : 'fa-bug',\n title : 'Report',\n cls : 'ui-button btn btn-primary',\n floating : 'clear',\n onclick : function() {\n var form_data = form.data.create();\n var url = Galaxy.root + 'api/jobs/' + job.id + '/error'\n form_data.dataset_id = dataset.id;\n self.submit(form_data, url)\n }\n })\n },\n });\n return form.$el;\n },\n\n /** Make ajax request */\n submit : function(form_data, url){\n var self = this;\n // Some required metadata\n $.ajax({\n type: \"POST\",\n url: url,\n data: form_data,\n success: function( response ) {\n // Clear out the div\n self.$el.empty().append( self._templateHeader() );\n // And display the messages.\n response.messages.forEach(function(message){\n self.display_message( {\n 'status': message[1],\n 'message': message[0],\n 'persistent': true,\n }, self.$( '.response-message' ), true, true );\n });\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n }\n });\n\n return {\n View : View\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-error.js","/** This class renders the grid list with shared section. */\ndefine( [ 'mvc/grid/grid-view' ], function( GridView ) {\n var View = Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.setElement( $( '
                        ' ) );\n this.model = new Backbone.Model( options );\n this.item = this.model.get( 'item' );\n this.title = this.model.get('plural');\n $.ajax({\n url : Galaxy.root + this.item + '/' + this.model.get( 'action_id' ),\n success : function( response ) {\n response[ 'dict_format' ] = true;\n self.model.set( response );\n self.render();\n }\n });\n },\n\n render: function() {\n var grid = new GridView( this.model.attributes );\n this.$el.empty().append( grid.$el );\n this.$el.append( this._templateShared() );\n },\n\n _templateShared: function() {\n var self = this;\n var $tmpl = $( '
                        ' +\n '

                        ' + this.model.get( 'plural' ) + ' shared with you by others

                        ' +\n '
                        ' );\n var options = this.model.attributes;\n if ( options.shared_by_others && options.shared_by_others.length > 0 ) {\n var $table = $( '' +\n '' +\n '' +\n '' +\n '' +\n '
                        TitleOwner
                        ' );\n _.each( options.shared_by_others, function( it, index ) {\n var display_url = Galaxy.root + self.item + '/display_by_username_and_slug?username=' + it.username + '&slug=' + it.slug;\n $table.append( '
                        ' +\n '' + _.escape( it.title ) + '' +\n '' + _.escape( it.username ) + '
                        ' +\n '
                        ' +\n '
                        ' +\n '
                        ' +\n '
                        ' +\n '
                        You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.
                        ' +\n '', '
                        ', '
                        '].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t CitationView: CitationView,\n\t CitationListView: CitationListView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 58 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(67), __webpack_require__(61), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_ITEM, DATASET_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t //==============================================================================\n\t\n\t var FoldoutListItemView = LIST_ITEM.FoldoutListItemView,\n\t ListItemView = LIST_ITEM.ListItemView;\n\t /** @class Read only view for DatasetCollection.\n\t */\n\t var DCListItemView = FoldoutListItemView.extend(\n\t /** @lends DCListItemView.prototype */{\n\t\n\t className: FoldoutListItemView.prototype.className + \" dataset-collection\",\n\t id: function () {\n\t return ['dataset_collection', this.model.get('id')].join('-');\n\t },\n\t\n\t /** override to add linkTarget */\n\t initialize: function (attributes) {\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t this.hasUser = attributes.hasUser;\n\t FoldoutListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t FoldoutListItemView.prototype._setUpListeners.call(this);\n\t this.listenTo(this.model, 'change', function (model, options) {\n\t // if the model has changed deletion status render it entirely\n\t if (_.has(model.changed, 'deleted')) {\n\t this.render();\n\t\n\t // if the model has been decorated after the fact with the element count,\n\t // render the subtitle where the count is displayed\n\t } else if (_.has(model.changed, 'element_count')) {\n\t this.$('> .title-bar .subtitle').replaceWith(this._renderSubtitle());\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... rendering\n\t /** render a subtitle to show the user what sort of collection this is */\n\t _renderSubtitle: function () {\n\t return $(this.templates.subtitle(this.model.toJSON(), this));\n\t },\n\t\n\t // ......................................................................... foldout\n\t /** override to add linktarget to sub-panel */\n\t _getFoldoutPanelOptions: function () {\n\t var options = FoldoutListItemView.prototype._getFoldoutPanelOptions.call(this);\n\t return _.extend(options, {\n\t linkTarget: this.linkTarget,\n\t hasUser: this.hasUser\n\t });\n\t },\n\t\n\t /** override to not catch sub-panel selectors */\n\t $selector: function () {\n\t return this.$('> .selector');\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DCListItemView.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, FoldoutListItemView.prototype.templates.warnings, {\n\t error: BASE_MVC.wrapTemplate([\n\t // error during index fetch - show error on dataset\n\t '<% if( model.error ){ %>', '
                        ', _l('There was an error getting the data for this collection'), ': <%- model.error %>', '
                        ', '<% } %>']),\n\t purged: BASE_MVC.wrapTemplate(['<% if( model.purged ){ %>', '
                        ', _l('This collection has been deleted and removed from disk'), '
                        ', '<% } %>']),\n\t deleted: BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>', '
                        ', _l('This collection has been deleted'), '
                        ', '<% } %>'])\n\t });\n\t\n\t // use element identifier\n\t var titleBarTemplate = BASE_MVC.wrapTemplate(['
                        ', '
                        ', '<%- collection.element_identifier || collection.name %>', '
                        ', '
                        ', '
                        '], 'collection');\n\t\n\t // use element identifier\n\t var subtitleTemplate = BASE_MVC.wrapTemplate(['
                        ', '<% var countText = collection.element_count? ( collection.element_count + \" \" ) : \"\"; %>', '<% if( collection.collection_type === \"list\" ){ %>', _l('a list of <%- countText %>datasets'), '<% } else if( collection.collection_type === \"paired\" ){ %>', _l('a pair of datasets'), '<% } else if( collection.collection_type === \"list:paired\" ){ %>', _l('a list of <%- countText %>dataset pairs'), '<% } else if( collection.collection_type === \"list:list\" ){ %>', _l('a list of <%- countText %>dataset lists'), '<% } %>', '
                        '], 'collection');\n\t\n\t return _.extend({}, FoldoutListItemView.prototype.templates, {\n\t warnings: warnings,\n\t titleBar: titleBarTemplate,\n\t subtitle: subtitleTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for DatasetCollectionElement.\n\t */\n\t var DCEListItemView = ListItemView.extend(\n\t /** @lends DCEListItemView.prototype */{\n\t\n\t /** add the DCE class to the list item */\n\t className: ListItemView.prototype.className + \" dataset-collection-element\",\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t if (attributes.logger) {\n\t this.logger = this.model.logger = attributes.logger;\n\t }\n\t this.log('DCEListItemView.initialize:', attributes);\n\t ListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCEListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DCEListItemView.prototype.templates = function () {\n\t\n\t // use the element identifier here - since that will persist and the user will need it\n\t var titleBarTemplate = BASE_MVC.wrapTemplate(['
                        ', '
                        ', '<%- element.element_identifier %>', '
                        ', '
                        ', '
                        '], 'element');\n\t\n\t return _.extend({}, ListItemView.prototype.templates, {\n\t titleBar: titleBarTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for a DatasetCollectionElement that is also an DatasetAssociation\n\t * (a dataset contained in a dataset collection).\n\t */\n\t var DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend(\n\t /** @lends DatasetDCEListItemView.prototype */{\n\t\n\t className: DATASET_LI.DatasetListItemView.prototype.className + \" dataset-collection-element\",\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t if (attributes.logger) {\n\t this.logger = this.model.logger = attributes.logger;\n\t }\n\t this.log('DatasetDCEListItemView.initialize:', attributes);\n\t DATASET_LI.DatasetListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t /** In this override, only get details if in the ready state.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DatasetDCEListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetDCEListItemView.prototype.templates = function () {\n\t\n\t // use the element identifier here and not the dataset name\n\t //TODO:?? can we steal the DCE titlebar?\n\t var titleBarTemplate = BASE_MVC.wrapTemplate(['
                        ', '', '
                        ', '<%- element.element_identifier %>', '
                        ', '
                        '], 'element');\n\t\n\t return _.extend({}, DATASET_LI.DatasetListItemView.prototype.templates, {\n\t titleBar: titleBarTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\t var NestedDCDCEListItemView = DCListItemView.extend(\n\t /** @lends NestedDCDCEListItemView.prototype */{\n\t\n\t className: DCListItemView.prototype.className + \" dataset-collection-element\",\n\t\n\t /** In this override, add the state as a class for use with state-based CSS */\n\t _swapNewRender: function ($newRender) {\n\t DCListItemView.prototype._swapNewRender.call(this, $newRender);\n\t var state = this.model.get('state') || 'ok';\n\t this.$el.addClass('state-' + state);\n\t return this.$el;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'NestedDCDCEListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t DCListItemView: DCListItemView,\n\t DCEListItemView: DCEListItemView,\n\t DatasetDCEListItemView: DatasetDCEListItemView,\n\t NestedDCDCEListItemView: NestedDCDCEListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 59 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, Backbone, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(85), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET_MODEL, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /*\n\t Notes:\n\t \n\t Terminology:\n\t DatasetCollection/DC : a container of datasets or nested DatasetCollections\n\t Element/DatasetCollectionElement/DCE : an item contained in a DatasetCollection\n\t HistoryDatasetCollectionAssociation/HDCA: a DatasetCollection contained in a history\n\t \n\t \n\t This all seems too complex unfortunately:\n\t \n\t - Terminology collision between DatasetCollections (DCs) and Backbone Collections.\n\t - In the DatasetCollections API JSON, DC Elements use a 'Has A' stucture to *contain*\n\t either a dataset or a nested DC. This would make the hierarchy much taller. I've\n\t decided to merge the contained JSON with the DC element json - making the 'has a'\n\t relation into an 'is a' relation. This seems simpler to me and allowed a lot of\n\t DRY in both models and views, but may make tracking or tracing within these models\n\t more difficult (since DatasetCollectionElements are now *also* DatasetAssociations\n\t or DatasetCollections (nested)). This also violates the rule of thumb about\n\t favoring aggregation over inheritance.\n\t - Currently, there are three DatasetCollection subclasses: List, Pair, and ListPaired.\n\t These each should a) be usable on their own, b) be usable in the context of\n\t nesting within a collection model (at least in the case of ListPaired), and\n\t c) be usable within the context of other container models (like History or\n\t LibraryFolder, etc.). I've tried to separate/extract classes in order to\n\t handle those three situations, but it's proven difficult to do in a simple,\n\t readable manner.\n\t - Ideally, histories and libraries would inherit from the same server models as\n\t dataset collections do since they are (in essence) dataset collections themselves -\n\t making the whole nested structure simpler. This would be a large, error-prone\n\t refactoring and migration.\n\t \n\t Many of the classes and heirarchy are meant as extension points so, while the\n\t relations and flow may be difficult to understand initially, they'll allow us to\n\t handle the growth or flux dataset collection in the future (w/o actually implementing\n\t any YAGNI).\n\t \n\t */\n\t //_________________________________________________________________________________________________ ELEMENTS\n\t /** @class mixin for Dataset collection elements.\n\t * When collection elements are passed from the API, the underlying element is\n\t * in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).\n\t * This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues\n\t * effectively changing a DCE from a container to a subclass (has a --> is a).\n\t */\n\t\n\t var DatasetCollectionElementMixin = {\n\t\n\t /** default attributes used by elements in a dataset collection */\n\t defaults: {\n\t model_class: 'DatasetCollectionElement',\n\t element_identifier: null,\n\t element_index: null,\n\t element_type: null\n\t },\n\t\n\t /** merge the attributes of the sub-object 'object' into this model */\n\t _mergeObject: function (attributes) {\n\t // if we don't preserve and correct ids here, the element id becomes the object id\n\t // and collision in backbone's _byId will occur and only\n\t _.extend(attributes, attributes.object, { element_id: attributes.id });\n\t delete attributes.object;\n\t return attributes;\n\t },\n\t\n\t /** override to merge this.object into this */\n\t constructor: function (attributes, options) {\n\t // console.debug( '\\t DatasetCollectionElement.constructor:', attributes, options );\n\t attributes = this._mergeObject(attributes);\n\t this.idAttribute = 'element_id';\n\t Backbone.Model.apply(this, arguments);\n\t },\n\t\n\t /** when the model is fetched, merge this.object into this */\n\t parse: function (response, options) {\n\t var attributes = response;\n\t attributes = this._mergeObject(attributes);\n\t return attributes;\n\t }\n\t };\n\t\n\t /** @class Concrete class of Generic DatasetCollectionElement */\n\t var DatasetCollectionElement = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(DatasetCollectionElementMixin).extend({ _logNamespace: 'collections' });\n\t\n\t //==============================================================================\n\t /** @class Base/Abstract Backbone collection for Generic DCEs. */\n\t var DCECollection = Backbone.Collection.extend(BASE_MVC.LoggableMixin).extend(\n\t /** @lends DCECollection.prototype */{\n\t _logNamespace: 'collections',\n\t\n\t model: DatasetCollectionElement,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['DatasetCollectionElementCollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for a dataset collection element that is a dataset (HDA).\n\t */\n\t var DatasetDCE = DATASET_MODEL.DatasetAssociation.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends DatasetDCE.prototype */{\n\t\n\t /** url fn */\n\t url: function () {\n\t // won't always be an hda\n\t if (!this.has('history_id')) {\n\t console.warn('no endpoint for non-hdas within a collection yet');\n\t // (a little silly since this api endpoint *also* points at hdas)\n\t return Galaxy.root + 'api/datasets';\n\t }\n\t return Galaxy.root + 'api/histories/' + this.get('history_id') + '/contents/' + this.get('id');\n\t },\n\t\n\t defaults: _.extend({}, DATASET_MODEL.DatasetAssociation.prototype.defaults, DatasetCollectionElementMixin.defaults),\n\t\n\t _downloadQueryParameters: function () {\n\t return '?to_ext=' + this.get('file_ext') + '&hdca_id=' + this.get('parent_hdca_id') + '&element_identifier=' + this.get('element_identifier');\n\t },\n\t\n\t // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n\t // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n\t // - re-apply manually for now\n\t /** call the mixin constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t DatasetDCE.constructor:', attributes, options);\n\t //DATASET_MODEL.DatasetAssociation.prototype.constructor.call( this, attributes, options );\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** Does this model already contain detailed data (as opposed to just summary level data)? */\n\t hasDetails: function () {\n\t return this.elements && this.elements.length;\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.get('element_identifier');\n\t return ['DatasetDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n\t */\n\t var DatasetDCECollection = DCECollection.extend(\n\t /** @lends DatasetDCECollection.prototype */{\n\t model: DatasetDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['DatasetDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //_________________________________________________________________________________________________ COLLECTIONS\n\t /** @class Backbone model for Dataset Collections.\n\t * The DC API returns an array of JSON objects under the attribute elements.\n\t * This model:\n\t * - removes that array/attribute ('elements') from the model,\n\t * - creates a bbone collection (of the class defined in the 'collectionClass' attribute),\n\t * - passes that json onto the bbone collection\n\t * - caches the bbone collection in this.elements\n\t */\n\t var DatasetCollection = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(BASE_MVC.SearchableModelMixin).extend( /** @lends DatasetCollection.prototype */{\n\t _logNamespace: 'collections',\n\t\n\t /** default attributes for a model */\n\t defaults: {\n\t /* 'list', 'paired', or 'list:paired' */\n\t collection_type: null,\n\t //??\n\t deleted: false\n\t },\n\t\n\t /** Which class to use for elements */\n\t collectionClass: DCECollection,\n\t\n\t /** set up: create elements instance var and (on changes to elements) update them */\n\t initialize: function (model, options) {\n\t this.debug(this + '(DatasetCollection).initialize:', model, options, this);\n\t this.elements = this._createElementsModel();\n\t this.on('change:elements', function () {\n\t this.log('change:elements');\n\t //TODO: prob. better to update the collection instead of re-creating it\n\t this.elements = this._createElementsModel();\n\t });\n\t },\n\t\n\t /** move elements model attribute to full collection */\n\t _createElementsModel: function () {\n\t this.debug(this + '._createElementsModel', this.collectionClass, this.get('elements'), this.elements);\n\t //TODO: same patterns as DatasetCollectionElement _createObjectModel - refactor to BASE_MVC.hasSubModel?\n\t var elements = this.get('elements') || [];\n\t this.unset('elements', { silent: true });\n\t var self = this;\n\t _.each(elements, function (element, index) {\n\t _.extend(element, { \"parent_hdca_id\": self.get(\"id\") });\n\t });\n\t this.elements = new this.collectionClass(elements);\n\t //this.debug( 'collectionClass:', this.collectionClass + '', this.elements );\n\t return this.elements;\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** pass the elements back within the model json when this is serialized */\n\t toJSON: function () {\n\t var json = Backbone.Model.prototype.toJSON.call(this);\n\t if (this.elements) {\n\t json.elements = this.elements.toJSON();\n\t }\n\t return json;\n\t },\n\t\n\t /** Is this collection in a 'ready' state no processing (for the collection) is left\n\t * to do on the server.\n\t */\n\t inReadyState: function () {\n\t var populated = this.get('populated');\n\t return this.isDeletedOrPurged() || populated;\n\t },\n\t\n\t //TODO:?? the following are the same interface as DatasetAssociation - can we combine?\n\t /** Does the DC contain any elements yet? Is a fetch() required? */\n\t hasDetails: function () {\n\t return this.elements.length !== 0;\n\t },\n\t\n\t /** Given the filters, what models in this.elements would be returned? */\n\t getVisibleContents: function (filters) {\n\t // filters unused for now\n\t return this.elements;\n\t },\n\t\n\t // ........................................................................ ajax\n\t /** override to use actual Dates objects for create/update times */\n\t parse: function (response, options) {\n\t var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n\t if (parsed.create_time) {\n\t parsed.create_time = new Date(parsed.create_time);\n\t }\n\t if (parsed.update_time) {\n\t parsed.update_time = new Date(parsed.update_time);\n\t }\n\t return parsed;\n\t },\n\t\n\t /** save this dataset, _Mark_ing it as deleted (just a flag) */\n\t 'delete': function (options) {\n\t if (this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true }, options);\n\t },\n\t /** save this dataset, _Mark_ing it as undeleted */\n\t undelete: function (options) {\n\t if (!this.get('deleted') || this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: false }, options);\n\t },\n\t\n\t /** Is this collection deleted or purged? */\n\t isDeletedOrPurged: function () {\n\t return this.get('deleted') || this.get('purged');\n\t },\n\t\n\t // ........................................................................ searchable\n\t /** searchable attributes for collections */\n\t searchAttributes: ['name', 'tags'],\n\t\n\t // ........................................................................ misc\n\t /** String representation */\n\t toString: function () {\n\t var idAndName = [this.get('id'), this.get('name') || this.get('element_identifier')];\n\t return 'DatasetCollection(' + idAndName.join(',') + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** Model for a DatasetCollection containing datasets (non-nested).\n\t */\n\t var ListDatasetCollection = DatasetCollection.extend(\n\t /** @lends ListDatasetCollection.prototype */{\n\t\n\t /** override since we know the collection will only contain datasets */\n\t collectionClass: DatasetDCECollection,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'List' + DatasetCollection.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** Model for a DatasetCollection containing fwd/rev datasets (a list of 2).\n\t */\n\t var PairDatasetCollection = ListDatasetCollection.extend(\n\t /** @lends PairDatasetCollection.prototype */{\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'Pair' + DatasetCollection.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //_________________________________________________________________________________________________ NESTED COLLECTIONS\n\t // this is where things get weird, man. Weird.\n\t //TODO: it might be possible to compact all the following...I think.\n\t //==============================================================================\n\t /** @class Backbone model for a Generic DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested collection). Currently only list:paired.\n\t */\n\t var NestedDCDCE = DatasetCollection.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends NestedDCDCE.prototype */{\n\t\n\t // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n\t // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n\t // - re-apply manually it now\n\t /** call the mixin constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t NestedDCDCE.constructor:', attributes, options);\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.object ? '' + this.object : this.get('element_identifier');\n\t return ['NestedDCDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n\t */\n\t var NestedDCDCECollection = DCECollection.extend(\n\t /** @lends NestedDCDCECollection.prototype */{\n\t\n\t /** This is a collection of nested collections */\n\t model: NestedDCDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['NestedDCDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n\t */\n\t var NestedPairDCDCE = PairDatasetCollection.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends NestedPairDCDCE.prototype */{\n\t //TODO:?? possibly rename to NestedDatasetCollection?\n\t\n\t // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n\t // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n\t // - re-apply manually it now\n\t /** This is both a collection and a collection element - call the constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t NestedPairDCDCE.constructor:', attributes, options);\n\t //DatasetCollection.constructor.call( this, attributes, options );\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.object ? '' + this.object : this.get('element_identifier');\n\t return ['NestedPairDCDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection for a backbone collection containing paired dataset collections.\n\t */\n\t var NestedPairDCDCECollection = NestedDCDCECollection.extend(\n\t /** @lends PairDCDCECollection.prototype */{\n\t\n\t /** We know this collection is composed of only nested pair collections */\n\t model: NestedPairDCDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['NestedPairDCDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n\t */\n\t var ListPairedDatasetCollection = DatasetCollection.extend(\n\t /** @lends ListPairedDatasetCollection.prototype */{\n\t\n\t /** list:paired is the only collection that itself contains collections */\n\t collectionClass: NestedPairDCDCECollection,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['ListPairedDatasetCollection(', this.get('name'), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for a list dataset collection within a list:list dataset collection. */\n\t var NestedListDCDCE = ListDatasetCollection.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends NestedListDCDCE.prototype */{\n\t\n\t /** This is both a collection and a collection element - call the constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t NestedListDCDCE.constructor:', attributes, options);\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.object ? '' + this.object : this.get('element_identifier');\n\t return ['NestedListDCDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection containing list dataset collections. */\n\t var NestedListDCDCECollection = NestedDCDCECollection.extend({\n\t\n\t /** We know this collection is composed of only nested pair collections */\n\t model: NestedListDCDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['NestedListDCDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\n\t var ListOfListsDatasetCollection = DatasetCollection.extend({\n\t\n\t /** list:paired is the only collection that itself contains collections */\n\t collectionClass: NestedListDCDCECollection,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['ListOfListsDatasetCollection(', this.get('name'), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t ListDatasetCollection: ListDatasetCollection,\n\t PairDatasetCollection: PairDatasetCollection,\n\t ListPairedDatasetCollection: ListPairedDatasetCollection,\n\t ListOfListsDatasetCollection: ListOfListsDatasetCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 60 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, $, jQuery) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(63), __webpack_require__(17), __webpack_require__(7), __webpack_require__(82), __webpack_require__(8), __webpack_require__(100), __webpack_require__(6), __webpack_require__(97)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HDCA, STATES, BASE_MVC, baseCreator, UI_MODAL, naturalSort, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t\n\t /*==============================================================================\n\t TODO:\n\t use proper Element model and not just json\n\t straighten out createFn, collection.createHDCA\n\t possibly stop using modals for this\n\t It would be neat to do a drag and drop\n\t \n\t ==============================================================================*/\n\t /** A view for both DatasetDCEs and NestedDCDCEs\n\t * (things that implement collection-model:DatasetCollectionElementMixin)\n\t */\n\t var DatasetCollectionElementView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t //TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n\t tagName: 'li',\n\t className: 'collection-element',\n\t\n\t initialize: function (attributes) {\n\t this.element = attributes.element || {};\n\t this.selected = attributes.selected || false;\n\t },\n\t\n\t render: function () {\n\t this.$el.attr('data-element-id', this.element.id).attr('draggable', true).html(this.template({ element: this.element }));\n\t if (this.selected) {\n\t this.$el.addClass('selected');\n\t }\n\t return this;\n\t },\n\t\n\t //TODO: lots of unused space in the element - possibly load details and display them horiz.\n\t template: _.template(['', '<%- element.name %>', '', ''].join('')),\n\t\n\t /** select this element and pub */\n\t select: function (toggle) {\n\t this.$el.toggleClass('selected', toggle);\n\t this.trigger('select', {\n\t source: this,\n\t selected: this.$el.hasClass('selected')\n\t });\n\t },\n\t\n\t /** animate the removal of this element and pub */\n\t discard: function () {\n\t var view = this,\n\t parentWidth = this.$el.parent().width();\n\t this.$el.animate({ 'margin-right': parentWidth }, 'fast', function () {\n\t view.trigger('discard', {\n\t source: view\n\t });\n\t view.destroy();\n\t });\n\t },\n\t\n\t /** remove the DOM and any listeners */\n\t destroy: function () {\n\t this.off();\n\t this.$el.remove();\n\t },\n\t\n\t events: {\n\t 'click': '_click',\n\t 'click .name': '_clickName',\n\t 'click .discard': '_clickDiscard',\n\t\n\t 'dragstart': '_dragstart',\n\t 'dragend': '_dragend',\n\t 'dragover': '_sendToParent',\n\t 'drop': '_sendToParent'\n\t },\n\t\n\t /** select when the li is clicked */\n\t _click: function (ev) {\n\t ev.stopPropagation();\n\t this.select(ev);\n\t },\n\t\n\t /** rename a pair when the name is clicked */\n\t _clickName: function (ev) {\n\t ev.stopPropagation();\n\t ev.preventDefault();\n\t var promptString = [_l('Enter a new name for the element'), ':\\n(', _l('Note that changing the name here will not rename the dataset'), ')'].join(''),\n\t response = prompt(_l('Enter a new name for the element') + ':', this.element.name);\n\t if (response) {\n\t this.element.name = response;\n\t this.render();\n\t }\n\t //TODO: cancelling with ESC leads to closure of the creator...\n\t },\n\t\n\t /** discard when the discard button is clicked */\n\t _clickDiscard: function (ev) {\n\t ev.stopPropagation();\n\t this.discard();\n\t },\n\t\n\t /** dragging pairs for re-ordering */\n\t _dragstart: function (ev) {\n\t if (ev.originalEvent) {\n\t ev = ev.originalEvent;\n\t }\n\t ev.dataTransfer.effectAllowed = 'move';\n\t ev.dataTransfer.setData('text/plain', JSON.stringify(this.element));\n\t\n\t this.$el.addClass('dragging');\n\t this.$el.parent().trigger('collection-element.dragstart', [this]);\n\t },\n\t\n\t /** dragging for re-ordering */\n\t _dragend: function (ev) {\n\t this.$el.removeClass('dragging');\n\t this.$el.parent().trigger('collection-element.dragend', [this]);\n\t },\n\t\n\t /** manually bubble up an event to the parent/container */\n\t _sendToParent: function (ev) {\n\t this.$el.parent().trigger(ev);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'DatasetCollectionElementView()';\n\t }\n\t });\n\t\n\t // ============================================================================\n\t /** An interface for building collections.\n\t */\n\t var ListCollectionCreator = Backbone.View.extend(BASE_MVC.LoggableMixin).extend(baseCreator.CollectionCreatorMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t /** the class used to display individual elements */\n\t elementViewClass: DatasetCollectionElementView,\n\t /** the class this creator will create and save */\n\t collectionClass: HDCA.HistoryListDatasetCollection,\n\t className: 'list-collection-creator collection-creator flex-row-container',\n\t\n\t /** minimum number of valid elements to start with in order to build a collection of this type */\n\t minElements: 1,\n\t\n\t defaultAttributes: {\n\t //TODO: remove - use new collectionClass().save()\n\t /** takes elements and creates the proper collection - returns a promise */\n\t creationFn: function () {\n\t throw new TypeError('no creation fn for creator');\n\t },\n\t /** fn to call when the collection is created (scoped to this) */\n\t oncreate: function () {},\n\t /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n\t oncancel: function () {},\n\t /** distance from list edge to begin autoscrolling list */\n\t autoscrollDist: 24,\n\t /** Color passed to hoverhighlight */\n\t highlightClr: 'rgba( 64, 255, 255, 1.0 )'\n\t },\n\t\n\t footerSettings: {\n\t '.hide-originals': 'hideOriginals'\n\t },\n\t\n\t /** set up initial options, instance vars, behaviors */\n\t initialize: function (attributes) {\n\t this.metric('ListCollectionCreator.initialize', attributes);\n\t var creator = this;\n\t _.each(this.defaultAttributes, function (value, key) {\n\t value = attributes[key] || value;\n\t creator[key] = value;\n\t });\n\t\n\t /** unordered, original list - cache to allow reversal */\n\t creator.initialElements = attributes.elements || [];\n\t\n\t this._setUpCommonSettings(attributes);\n\t this._instanceSetUp();\n\t this._elementsSetUp();\n\t this._setUpBehaviors();\n\t },\n\t\n\t /** set up instance vars */\n\t _instanceSetUp: function () {\n\t /** Ids of elements that have been selected by the user - to preserve over renders */\n\t this.selectedIds = {};\n\t /** DOM elements currently being dragged */\n\t this.$dragging = null;\n\t /** Used for blocking UI events during ajax/operations (don't post twice) */\n\t this.blocking = false;\n\t },\n\t\n\t // ------------------------------------------------------------------------ process raw list\n\t /** set up main data */\n\t _elementsSetUp: function () {\n\t //this.debug( '-- _dataSetUp' );\n\t /** a list of invalid elements and the reasons they aren't valid */\n\t this.invalidElements = [];\n\t //TODO: handle fundamental problem of syncing DOM, views, and list here\n\t /** data for list in progress */\n\t this.workingElements = [];\n\t /** views for workingElements */\n\t this.elementViews = [];\n\t\n\t // copy initial list, sort, add ids if needed\n\t this.workingElements = this.initialElements.slice(0);\n\t this._ensureElementIds();\n\t this._validateElements();\n\t this._mangleDuplicateNames();\n\t this._sortElements();\n\t },\n\t\n\t /** add ids to dataset objs in initial list if none */\n\t _ensureElementIds: function () {\n\t this.workingElements.forEach(function (element) {\n\t if (!element.hasOwnProperty('id')) {\n\t element.id = _.uniqueId();\n\t }\n\t });\n\t return this.workingElements;\n\t },\n\t\n\t /** separate working list into valid and invalid elements for this collection */\n\t _validateElements: function () {\n\t var creator = this,\n\t existingNames = {};\n\t creator.invalidElements = [];\n\t\n\t this.workingElements = this.workingElements.filter(function (element) {\n\t var problem = creator._isElementInvalid(element);\n\t if (problem) {\n\t creator.invalidElements.push({\n\t element: element,\n\t text: problem\n\t });\n\t }\n\t return !problem;\n\t });\n\t return this.workingElements;\n\t },\n\t\n\t /** describe what is wrong with a particular element if anything */\n\t _isElementInvalid: function (element) {\n\t if (element.history_content_type !== 'dataset') {\n\t return _l(\"is not a dataset\");\n\t }\n\t var validState = element.state === STATES.OK || _.contains(STATES.NOT_READY_STATES, element.state);\n\t if (!validState) {\n\t return _l(\"has errored, is paused, or is not accessible\");\n\t }\n\t if (element.deleted || element.purged) {\n\t return _l(\"has been deleted or purged\");\n\t }\n\t return null;\n\t },\n\t\n\t /** mangle duplicate names using a mac-like '(counter)' addition to any duplicates */\n\t _mangleDuplicateNames: function () {\n\t var SAFETY = 900,\n\t counter = 1,\n\t existingNames = {};\n\t this.workingElements.forEach(function (element) {\n\t var currName = element.name;\n\t while (existingNames.hasOwnProperty(currName)) {\n\t currName = element.name + ' (' + counter + ')';\n\t counter += 1;\n\t if (counter >= SAFETY) {\n\t throw new Error('Safety hit in while loop - thats impressive');\n\t }\n\t }\n\t element.name = currName;\n\t existingNames[element.name] = true;\n\t });\n\t },\n\t\n\t /** sort a list of elements */\n\t _sortElements: function (list) {\n\t // // currently only natural sort by name\n\t // this.workingElements.sort( function( a, b ){ return naturalSort( a.name, b.name ); });\n\t // return this.workingElements;\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering\n\t // templates : ListCollectionCreator.templates,\n\t /** render the entire interface */\n\t render: function (speed, callback) {\n\t //this.debug( '-- _render' );\n\t if (this.workingElements.length < this.minElements) {\n\t return this._renderInvalid(speed, callback);\n\t }\n\t\n\t this.$el.empty().html(this.templates.main());\n\t this._renderHeader(speed);\n\t this._renderMiddle(speed);\n\t this._renderFooter(speed);\n\t this._addPluginComponents();\n\t this.$('.collection-name').focus();\n\t this.trigger('rendered', this);\n\t return this;\n\t },\n\t\n\t /** render a simplified interface aimed at telling the user why they can't move forward */\n\t _renderInvalid: function (speed, callback) {\n\t //this.debug( '-- _render' );\n\t this.$el.empty().html(this.templates.invalidInitial({\n\t problems: this.invalidElements,\n\t elements: this.workingElements\n\t }));\n\t if (typeof this.oncancel === 'function') {\n\t this.$('.cancel-create.btn').show();\n\t }\n\t this.trigger('rendered', this);\n\t return this;\n\t },\n\t\n\t /** render the header section */\n\t _renderHeader: function (speed, callback) {\n\t var $header = this.$('.header').empty().html(this.templates.header()).find('.help-content').prepend($(this.templates.helpContent()));\n\t //TODO: should only show once despite calling _renderHeader again\n\t if (this.invalidElements.length) {\n\t this._invalidElementsAlert();\n\t }\n\t return $header;\n\t },\n\t\n\t /** render the middle including the elements */\n\t _renderMiddle: function (speed, callback) {\n\t var $middle = this.$('.middle').empty().html(this.templates.middle());\n\t this._renderList(speed);\n\t return $middle;\n\t },\n\t\n\t /** add any jQuery/bootstrap/custom plugins to elements rendered */\n\t _addPluginComponents: function () {\n\t this.$('.help-content i').hoverhighlight('.collection-creator', this.highlightClr);\n\t },\n\t\n\t /** build and show an alert describing any elements that could not be included due to problems */\n\t _invalidElementsAlert: function () {\n\t this._showAlert(this.templates.invalidElements({ problems: this.invalidElements }), 'alert-warning');\n\t },\n\t\n\t _disableNameAndCreate: function (disable) {\n\t disable = !_.isUndefined(disable) ? disable : true;\n\t if (disable) {\n\t this.$('.collection-name').prop('disabled', true);\n\t this.$('.create-collection').toggleClass('disabled', true);\n\t // } else {\n\t // this.$( '.collection-name' ).prop( 'disabled', false );\n\t // this.$( '.create-collection' ).removeClass( 'disable' );\n\t }\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering elements\n\t /** conv. to the main list display DOM */\n\t $list: function () {\n\t return this.$('.collection-elements');\n\t },\n\t\n\t /** show or hide the clear selected control based on the num of selected elements */\n\t _renderClearSelected: function () {\n\t if (_.size(this.selectedIds)) {\n\t this.$('.collection-elements-controls > .clear-selected').show();\n\t } else {\n\t this.$('.collection-elements-controls > .clear-selected').hide();\n\t }\n\t },\n\t\n\t /** render the elements in order (or a warning if no elements found) */\n\t _renderList: function (speed, callback) {\n\t //this.debug( '-- _renderList' );\n\t var creator = this,\n\t $tmp = jQuery('
                        '),\n\t $list = creator.$list();\n\t\n\t _.each(this.elementViews, function (view) {\n\t view.destroy();\n\t creator.removeElementView(view);\n\t });\n\t\n\t // if( !this.workingElements.length ){\n\t // this._renderNoValidElements();\n\t // return;\n\t // }\n\t\n\t creator.workingElements.forEach(function (element) {\n\t var elementView = creator._createElementView(element);\n\t $tmp.append(elementView.$el);\n\t });\n\t\n\t creator._renderClearSelected();\n\t $list.empty().append($tmp.children());\n\t _.invoke(creator.elementViews, 'render');\n\t\n\t if ($list.height() > $list.css('max-height')) {\n\t $list.css('border-width', '1px 0px 1px 0px');\n\t } else {\n\t $list.css('border-width', '0px');\n\t }\n\t },\n\t\n\t /** create an element view, cache in elementViews, set up listeners, and return */\n\t _createElementView: function (element) {\n\t var elementView = new this.elementViewClass({\n\t //TODO: use non-generic class or not all\n\t // model : COLLECTION.DatasetDCE( element )\n\t element: element,\n\t selected: _.has(this.selectedIds, element.id)\n\t });\n\t this.elementViews.push(elementView);\n\t this._listenToElementView(elementView);\n\t return elementView;\n\t },\n\t\n\t /** listen to any element events */\n\t _listenToElementView: function (view) {\n\t var creator = this;\n\t creator.listenTo(view, {\n\t select: function (data) {\n\t var element = data.source.element;\n\t if (data.selected) {\n\t creator.selectedIds[element.id] = true;\n\t } else {\n\t delete creator.selectedIds[element.id];\n\t }\n\t creator.trigger('elements:select', data);\n\t },\n\t discard: function (data) {\n\t creator.trigger('elements:discard', data);\n\t }\n\t });\n\t },\n\t\n\t /** add a new element view based on the json in element */\n\t addElementView: function (element) {\n\t //TODO: workingElements is sorted, add element in appropo index\n\t // add element, sort elements, find element index\n\t // var view = this._createElementView( element );\n\t // return view;\n\t },\n\t\n\t /** stop listening to view and remove from caches */\n\t removeElementView: function (view) {\n\t delete this.selectedIds[view.element.id];\n\t this._renderClearSelected();\n\t\n\t this.elementViews = _.without(this.elementViews, view);\n\t this.stopListening(view);\n\t },\n\t\n\t /** render a message in the list that no elements remain to create a collection */\n\t _renderNoElementsLeft: function () {\n\t this._disableNameAndCreate(true);\n\t this.$('.collection-elements').append(this.templates.noElementsLeft());\n\t },\n\t\n\t // /** render a message in the list that no valid elements were found to create a collection */\n\t // _renderNoValidElements : function(){\n\t // this._disableNameAndCreate( true );\n\t // this.$( '.collection-elements' ).append( this.templates.noValidElements() );\n\t // },\n\t\n\t // ------------------------------------------------------------------------ API\n\t /** convert element into JSON compatible with the collections API */\n\t _elementToJSON: function (element) {\n\t // return element.toJSON();\n\t return element;\n\t },\n\t\n\t /** create the collection via the API\n\t * @returns {jQuery.xhr Object} the jquery ajax request\n\t */\n\t createList: function (name) {\n\t if (!this.workingElements.length) {\n\t var message = _l('No valid elements for final list') + '. ';\n\t message += '' + _l('Cancel') + ' ';\n\t message += _l('or');\n\t message += ' ' + _l('start over') + '.';\n\t this._showAlert(message);\n\t return;\n\t }\n\t\n\t var creator = this,\n\t elements = this.workingElements.map(function (element) {\n\t return creator._elementToJSON(element);\n\t });\n\t\n\t creator.blocking = true;\n\t return creator.creationFn(elements, name, creator.hideOriginals).always(function () {\n\t creator.blocking = false;\n\t }).fail(function (xhr, status, message) {\n\t creator.trigger('error', {\n\t xhr: xhr,\n\t status: status,\n\t message: _l('An error occurred while creating this collection')\n\t });\n\t }).done(function (response, message, xhr) {\n\t creator.trigger('collection:created', response, message, xhr);\n\t creator.metric('collection:created', response);\n\t if (typeof creator.oncreate === 'function') {\n\t creator.oncreate.call(this, response, message, xhr);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ events\n\t /** set up event handlers on self */\n\t _setUpBehaviors: function () {\n\t this.on('error', this._errorHandler);\n\t\n\t this.once('rendered', function () {\n\t this.trigger('rendered:initial', this);\n\t });\n\t\n\t this.on('elements:select', function (data) {\n\t this._renderClearSelected();\n\t });\n\t\n\t this.on('elements:discard', function (data) {\n\t var element = data.source.element;\n\t this.removeElementView(data.source);\n\t\n\t this.workingElements = _.without(this.workingElements, element);\n\t if (!this.workingElements.length) {\n\t this._renderNoElementsLeft();\n\t }\n\t });\n\t\n\t //this.on( 'all', function(){\n\t // this.info( arguments );\n\t //});\n\t return this;\n\t },\n\t\n\t /** handle errors with feedback and details to the user (if available) */\n\t _errorHandler: function (data) {\n\t this.error(data);\n\t\n\t var creator = this,\n\t content = data.message || _l('An error occurred');\n\t if (data.xhr) {\n\t var xhr = data.xhr,\n\t message = data.message;\n\t if (xhr.readyState === 0 && xhr.status === 0) {\n\t content += ': ' + _l('Galaxy could not be reached and may be updating.') + _l(' Try again in a few minutes.');\n\t } else if (xhr.responseJSON) {\n\t content += ':
                        ' + JSON.stringify(xhr.responseJSON) + '
                        ';\n\t } else {\n\t content += ': ' + message;\n\t }\n\t }\n\t creator._showAlert(content, 'alert-danger');\n\t },\n\t\n\t events: {\n\t // header\n\t 'click .more-help': '_clickMoreHelp',\n\t 'click .less-help': '_clickLessHelp',\n\t 'click .main-help': '_toggleHelp',\n\t 'click .header .alert button': '_hideAlert',\n\t\n\t 'click .reset': 'reset',\n\t 'click .clear-selected': 'clearSelectedElements',\n\t\n\t // elements - selection\n\t 'click .collection-elements': 'clearSelectedElements',\n\t\n\t // elements - drop target\n\t // 'dragenter .collection-elements': '_dragenterElements',\n\t // 'dragleave .collection-elements': '_dragleaveElements',\n\t 'dragover .collection-elements': '_dragoverElements',\n\t 'drop .collection-elements': '_dropElements',\n\t\n\t // these bubble up from the elements as custom events\n\t 'collection-element.dragstart .collection-elements': '_elementDragstart',\n\t 'collection-element.dragend .collection-elements': '_elementDragend',\n\t\n\t // footer\n\t 'change .collection-name': '_changeName',\n\t 'keydown .collection-name': '_nameCheckForEnter',\n\t 'change .hide-originals': '_changeHideOriginals',\n\t 'click .cancel-create': '_cancelCreate',\n\t 'click .create-collection': '_clickCreate' //,\n\t },\n\t\n\t // ........................................................................ elements\n\t /** reset all data to the initial state */\n\t reset: function () {\n\t this._instanceSetUp();\n\t this._elementsSetUp();\n\t this.render();\n\t },\n\t\n\t /** deselect all elements */\n\t clearSelectedElements: function (ev) {\n\t this.$('.collection-elements .collection-element').removeClass('selected');\n\t this.$('.collection-elements-controls > .clear-selected').hide();\n\t },\n\t\n\t //_dragenterElements : function( ev ){\n\t // //this.debug( '_dragenterElements:', ev );\n\t //},\n\t //TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n\t // _dragleaveElements : function( ev ){\n\t // //this.debug( '_dragleaveElements:', ev );\n\t // },\n\t\n\t /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n\t _dragoverElements: function (ev) {\n\t //this.debug( '_dragoverElements:', ev );\n\t ev.preventDefault();\n\t\n\t var $list = this.$list();\n\t this._checkForAutoscroll($list, ev.originalEvent.clientY);\n\t var $nearest = this._getNearestElement(ev.originalEvent.clientY);\n\t\n\t //TODO: no need to re-create - move instead\n\t this.$('.element-drop-placeholder').remove();\n\t var $placeholder = $('
                        ');\n\t if (!$nearest.length) {\n\t $list.append($placeholder);\n\t } else {\n\t $nearest.before($placeholder);\n\t }\n\t },\n\t\n\t /** If the mouse is near enough to the list's top or bottom, scroll the list */\n\t _checkForAutoscroll: function ($element, y) {\n\t var AUTOSCROLL_SPEED = 2,\n\t offset = $element.offset(),\n\t scrollTop = $element.scrollTop(),\n\t upperDist = y - offset.top,\n\t lowerDist = offset.top + $element.outerHeight() - y;\n\t if (upperDist >= 0 && upperDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop - AUTOSCROLL_SPEED);\n\t } else if (lowerDist >= 0 && lowerDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop + AUTOSCROLL_SPEED);\n\t }\n\t },\n\t\n\t /** get the nearest element based on the mouse's Y coordinate.\n\t * If the y is at the end of the list, return an empty jQuery object.\n\t */\n\t _getNearestElement: function (y) {\n\t var WIGGLE = 4,\n\t lis = this.$('.collection-elements li.collection-element').toArray();\n\t for (var i = 0; i < lis.length; i++) {\n\t var $li = $(lis[i]),\n\t top = $li.offset().top,\n\t halfHeight = Math.floor($li.outerHeight() / 2) + WIGGLE;\n\t if (top + halfHeight > y && top - halfHeight < y) {\n\t return $li;\n\t }\n\t }\n\t return $();\n\t },\n\t\n\t /** drop (dragged/selected elements) onto the list, re-ordering the internal list */\n\t _dropElements: function (ev) {\n\t if (ev.originalEvent) {\n\t ev = ev.originalEvent;\n\t }\n\t // both required for firefox\n\t ev.preventDefault();\n\t ev.dataTransfer.dropEffect = 'move';\n\t\n\t // insert before the nearest element or after the last.\n\t var $nearest = this._getNearestElement(ev.clientY);\n\t if ($nearest.length) {\n\t this.$dragging.insertBefore($nearest);\n\t } else {\n\t // no nearest before - insert after last element\n\t this.$dragging.insertAfter(this.$('.collection-elements .collection-element').last());\n\t }\n\t // resync the creator's list based on the new DOM order\n\t this._syncOrderToDom();\n\t return false;\n\t },\n\t\n\t /** resync the creator's list of elements based on the DOM order */\n\t _syncOrderToDom: function () {\n\t var creator = this,\n\t newElements = [];\n\t //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n\t this.$('.collection-elements .collection-element').each(function () {\n\t var id = $(this).attr('data-element-id'),\n\t element = _.findWhere(creator.workingElements, { id: id });\n\t if (element) {\n\t newElements.push(element);\n\t } else {\n\t console.error('missing element: ', id);\n\t }\n\t });\n\t this.workingElements = newElements;\n\t this._renderList();\n\t },\n\t\n\t /** drag communication with element sub-views: dragstart */\n\t _elementDragstart: function (ev, element) {\n\t // auto select the element causing the event and move all selected\n\t element.select(true);\n\t this.$dragging = this.$('.collection-elements .collection-element.selected');\n\t },\n\t\n\t /** drag communication with element sub-views: dragend - remove the placeholder */\n\t _elementDragend: function (ev, element) {\n\t $('.element-drop-placeholder').remove();\n\t this.$dragging = null;\n\t },\n\t\n\t // ------------------------------------------------------------------------ templates\n\t //TODO: move to require text plugin and load these as text\n\t //TODO: underscore currently unnecc. bc no vars are used\n\t //TODO: better way of localizing text-nodes in long strings\n\t /** underscore template fns attached to class */\n\t templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\t\n\t /** the header (not including help text) */\n\t header: _.template(['', '
                        ', '', '', '
                        '].join('')),\n\t\n\t /** the middle: element list */\n\t middle: _.template(['', '
                        ', '
                        '].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer: _.template(['
                        ', '
                        ', '', '
                        ', '
                        ', '', '
                        ', _l('Name'), ':
                        ', '
                        ', '
                        ', '
                        ', '
                        ', '', '
                        ', '', '', '
                        ', '
                        ', '
                        ', '', '
                        ', '
                        '].join('')),\n\t\n\t /** help content */\n\t helpContent: _.template(['

                        ', _l(['Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ', 'workflows in order to have analyses done on each member of the entire group. This interface allows ', 'you to create a collection and re-order the final collection.'].join('')), '

                        ', '
                          ', '
                        • ', _l(['Rename elements in the list by clicking on ', 'the existing name.'].join('')), '
                        • ', '
                        • ', _l(['Discard elements from the final created list by clicking on the ', '\"Discard\" button.'].join('')), '
                        • ', '
                        • ', _l(['Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ', 'them and you can then move those selected by dragging the ', 'entire group. Deselect them by clicking them again or by clicking the ', 'the \"Clear selected\" link.'].join('')), '
                        • ', '
                        • ', _l(['Click the \"Start over\" link to begin again as if you had just opened ', 'the interface.'].join('')), '
                        • ', '
                        • ', _l(['Click the \"Cancel\" button to exit the interface.'].join('')), '
                        • ', '

                        ', '

                        ', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '

                        '].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t invalidElements: _.template([_l('The following selections could not be included due to problems:'), '
                          <% _.each( problems, function( problem ){ %>', '
                        • <%- problem.element.name %>: <%- problem.text %>
                        • ', '<% }); %>
                        '].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t noElementsLeft: _.template(['
                      2. ', _l('No elements left! '), _l('Would you like to '), '', _l('start over'), '?', '
                      3. '].join('')),\n\t\n\t /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n\t invalidInitial: _.template(['
                        ', '
                        ', '', '<% if( _.size( problems ) ){ %>', _l('The following selections could not be included due to problems'), ':', '
                          <% _.each( problems, function( problem ){ %>', '
                        • <%- problem.element.name %>: <%- problem.text %>
                        • ', '<% }); %>
                        ', '<% } else if( _.size( elements ) < 1 ){ %>', _l('No datasets were selected'), '.', '<% } %>', '
                        ', _l('At least one element is needed for the collection'), '. ', _l('You may need to '), '', _l('cancel'), ' ', _l('and reselect new elements'), '.', '
                        ', '
                        ', '
                        ', '
                        ', '
                        ', '
                        ', '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
                        ', '
                        ', '
                        '].join(''))\n\t }),\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListCollectionCreator';\n\t }\n\t });\n\t\n\t //=============================================================================\n\t /** Create a modal and load its body with the given CreatorClass creator type\n\t * @returns {Deferred} resolved when creator has built a collection.\n\t */\n\t var collectionCreatorModal = function _collectionCreatorModal(elements, options, CreatorClass) {\n\t\n\t var deferred = jQuery.Deferred(),\n\t modal = Galaxy.modal || new UI_MODAL.View(),\n\t creator;\n\t\n\t options = _.defaults(options || {}, {\n\t elements: elements,\n\t oncancel: function () {\n\t modal.hide();\n\t deferred.reject('cancelled');\n\t },\n\t oncreate: function (creator, response) {\n\t modal.hide();\n\t deferred.resolve(response);\n\t }\n\t });\n\t\n\t creator = new CreatorClass(options);\n\t modal.show({\n\t title: options.title || _l('Create a collection'),\n\t body: creator.$el,\n\t width: '80%',\n\t height: '100%',\n\t closing_events: true\n\t });\n\t creator.render();\n\t window._collectionCreator = creator;\n\t\n\t //TODO: remove modal header\n\t return deferred;\n\t };\n\t\n\t /** List collection flavor of collectionCreatorModal. */\n\t var listCollectionCreatorModal = function _listCollectionCreatorModal(elements, options) {\n\t options = options || {};\n\t options.title = _l('Create a collection from a list of datasets');\n\t return collectionCreatorModal(elements, options, ListCollectionCreator);\n\t };\n\t\n\t //==============================================================================\n\t /** Use a modal to create a list collection, then add it to the given history contents.\n\t * @returns {Deferred} resolved when the collection is added to the history.\n\t */\n\t function createListCollection(contents, defaultHideSourceItems) {\n\t var elements = contents.toJSON(),\n\t promise = listCollectionCreatorModal(elements, {\n\t defaultHideSourceItems: defaultHideSourceItems,\n\t creationFn: function (elements, name, hideSourceItems) {\n\t elements = elements.map(function (element) {\n\t return {\n\t id: element.id,\n\t name: element.name,\n\t //TODO: this allows for list:list even if the filter above does not - reconcile\n\t src: element.history_content_type === 'dataset' ? 'hda' : 'hdca'\n\t };\n\t });\n\t return contents.createHDCA(elements, 'list', name, hideSourceItems);\n\t }\n\t });\n\t return promise;\n\t }\n\t\n\t //==============================================================================\n\t return {\n\t DatasetCollectionElementView: DatasetCollectionElementView,\n\t ListCollectionCreator: ListCollectionCreator,\n\t\n\t collectionCreatorModal: collectionCreatorModal,\n\t listCollectionCreatorModal: listCollectionCreatorModal,\n\t createListCollection: createListCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 61 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, jQuery, Backbone, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(67), __webpack_require__(17), __webpack_require__(25), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_ITEM, STATES, faIconButton, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t var logNamespace = 'dataset';\n\t /*==============================================================================\n\t TODO:\n\t straighten out state rendering and templates used\n\t inaccessible/STATES.NOT_VIEWABLE is a special case\n\t simplify button rendering\n\t \n\t ==============================================================================*/\n\t var _super = LIST_ITEM.ListItemView;\n\t /** @class Read only list view for either LDDAs, HDAs, or HDADCEs.\n\t * Roughly, any DatasetInstance (and not a raw Dataset).\n\t */\n\t var DatasetListItemView = _super.extend(\n\t /** @lends DatasetListItemView.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t className: _super.prototype.className + \" dataset\",\n\t //TODO:?? doesn't exactly match an hda's type_id\n\t id: function () {\n\t return ['dataset', this.model.get('id')].join('-');\n\t },\n\t\n\t /** Set up: instance vars, options, and event handlers */\n\t initialize: function (attributes) {\n\t if (attributes.logger) {\n\t this.logger = this.model.logger = attributes.logger;\n\t }\n\t this.log(this + '.initialize:', attributes);\n\t _super.prototype.initialize.call(this, attributes);\n\t\n\t /** where should pages from links be displayed? (default to new tab/window) */\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t },\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t var self = this;\n\t\n\t // re-rendering on any model changes\n\t return self.listenTo(self.model, {\n\t 'change': function (model) {\n\t // if the model moved into the ready state and is expanded without details, fetch those details now\n\t if (self.model.changedAttributes().state && self.model.inReadyState() && self.expanded && !self.model.hasDetails()) {\n\t // normally, will render automatically (due to fetch -> change),\n\t // but! setting_metadata sometimes doesn't cause any other changes besides state\n\t // so, not rendering causes it to seem frozen in setting_metadata state\n\t self.model.fetch({ silent: true }).done(function () {\n\t self.render();\n\t });\n\t } else {\n\t if (_.has(model.changed, 'tags') && _.keys(model.changed).length === 1) {\n\t // If only the tags have changed, rerender specifically\n\t // the titlebar region. Otherwise default to the full\n\t // render.\n\t self.$('.nametags').html(self._renderNametags());\n\t } else {\n\t self.render();\n\t }\n\t }\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... expandable\n\t /** In this override, only get details if in the ready state, get rerunnable if in other states.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t // ......................................................................... removal\n\t /** Remove this view's html from the DOM and remove all event listeners.\n\t * @param {Number or String} speed jq effect speed\n\t * @param {Function} callback an optional function called when removal is done (scoped to this view)\n\t */\n\t remove: function (speed, callback) {\n\t var view = this;\n\t speed = speed || this.fxSpeed;\n\t this.$el.fadeOut(speed, function () {\n\t Backbone.View.prototype.remove.call(view);\n\t if (callback) {\n\t callback.call(view);\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... rendering\n\t /* TODO:\n\t dataset states are the issue primarily making dataset rendering complex\n\t each state should have it's own way of displaying/set of details\n\t often with different actions that can be applied\n\t throw in deleted/purged/visible and things get complicated easily\n\t I've considered (a couple of times) - creating a view for each state\n\t - but recreating the view during an update...seems wrong\n\t */\n\t /** In this override, add the dataset state as a class for use with state-based CSS */\n\t _swapNewRender: function ($newRender) {\n\t _super.prototype._swapNewRender.call(this, $newRender);\n\t if (this.model.has('state')) {\n\t this.$el.addClass('state-' + this.model.get('state'));\n\t }\n\t return this.$el;\n\t },\n\t\n\t // ................................................................................ titlebar\n\t /** In this override, add the dataset display button. */\n\t _renderPrimaryActions: function () {\n\t // render just the display for read-only\n\t return [this._renderDisplayButton()];\n\t },\n\t\n\t /** Render icon-button to display dataset data */\n\t _renderDisplayButton: function () {\n\t // don't show display if not viewable or not accessible\n\t var state = this.model.get('state');\n\t if (state === STATES.NOT_VIEWABLE || state === STATES.DISCARDED || !this.model.get('accessible')) {\n\t return null;\n\t }\n\t\n\t var displayBtnData = {\n\t target: this.linkTarget,\n\t classes: 'display-btn'\n\t };\n\t\n\t // show a disabled display if the data's been purged\n\t if (this.model.get('purged')) {\n\t displayBtnData.disabled = true;\n\t displayBtnData.title = _l('Cannot display datasets removed from disk');\n\t\n\t // disable if still uploading\n\t } else if (state === STATES.UPLOAD) {\n\t displayBtnData.disabled = true;\n\t displayBtnData.title = _l('This dataset must finish uploading before it can be viewed');\n\t\n\t // disable if still new\n\t } else if (state === STATES.NEW) {\n\t displayBtnData.disabled = true;\n\t displayBtnData.title = _l('This dataset is not yet viewable');\n\t } else {\n\t displayBtnData.title = _l('View data');\n\t\n\t // default link for dataset\n\t displayBtnData.href = this.model.urls.display;\n\t\n\t // add frame manager option onclick event\n\t var self = this;\n\t displayBtnData.onclick = function (ev) {\n\t if (Galaxy.frame && Galaxy.frame.active) {\n\t // Add dataset to frames.\n\t Galaxy.frame.addDataset(self.model.get('id'));\n\t ev.preventDefault();\n\t }\n\t };\n\t }\n\t displayBtnData.faIcon = 'fa-eye';\n\t return faIconButton(displayBtnData);\n\t },\n\t\n\t // ......................................................................... rendering details\n\t /** Render the enclosing div of the hda body and, if expanded, the html in the body\n\t * @returns {jQuery} rendered DOM\n\t */\n\t _renderDetails: function () {\n\t //TODO: generalize to be allow different details for each state\n\t\n\t // no access - render nothing but a message\n\t if (this.model.get('state') === STATES.NOT_VIEWABLE) {\n\t return $(this.templates.noAccess(this.model.toJSON(), this));\n\t }\n\t\n\t var $details = _super.prototype._renderDetails.call(this);\n\t $details.find('.actions .left').empty().append(this._renderSecondaryActions());\n\t $details.find('.summary').html(this._renderSummary()).prepend(this._renderDetailMessages());\n\t $details.find('.display-applications').html(this._renderDisplayApplications());\n\t\n\t this._setUpBehaviors($details);\n\t return $details;\n\t },\n\t\n\t /** Defer to the appropo summary rendering fn based on state */\n\t _renderSummary: function () {\n\t var json = this.model.toJSON(),\n\t summaryRenderFn = this.templates.summaries[json.state];\n\t summaryRenderFn = summaryRenderFn || this.templates.summaries.unknown;\n\t return summaryRenderFn(json, this);\n\t },\n\t\n\t /** Render messages to be displayed only when the details are shown */\n\t _renderDetailMessages: function () {\n\t var view = this,\n\t $warnings = $('
                        '),\n\t json = view.model.toJSON();\n\t //TODO:! unordered (map)\n\t _.each(view.templates.detailMessages, function (templateFn) {\n\t $warnings.append($(templateFn(json, view)));\n\t });\n\t return $warnings;\n\t },\n\t\n\t /** Render the external display application links */\n\t _renderDisplayApplications: function () {\n\t if (this.model.isDeletedOrPurged()) {\n\t return '';\n\t }\n\t // render both old and new display apps using the same template\n\t return [this.templates.displayApplications(this.model.get('display_apps'), this), this.templates.displayApplications(this.model.get('display_types'), this)].join('');\n\t },\n\t\n\t // ......................................................................... secondary/details actions\n\t /** A series of links/buttons for less commonly used actions: re-run, info, etc. */\n\t _renderSecondaryActions: function () {\n\t this.debug('_renderSecondaryActions');\n\t switch (this.model.get('state')) {\n\t case STATES.NOT_VIEWABLE:\n\t return [];\n\t case STATES.OK:\n\t case STATES.FAILED_METADATA:\n\t case STATES.ERROR:\n\t return [this._renderDownloadButton(), this._renderShowParamsButton()];\n\t }\n\t return [this._renderShowParamsButton()];\n\t },\n\t\n\t /** Render icon-button to show the input and output (stdout/err) for the job that created this.\n\t * @returns {jQuery} rendered DOM\n\t */\n\t _renderShowParamsButton: function () {\n\t // gen. safe to show in all cases\n\t return faIconButton({\n\t title: _l('View details'),\n\t classes: 'params-btn',\n\t href: this.model.urls.show_params,\n\t target: this.linkTarget,\n\t faIcon: 'fa-info-circle',\n\t onclick: function (ev) {\n\t if (Galaxy.frame && Galaxy.frame.active) {\n\t Galaxy.frame.add({ title: 'Dataset details', url: this.href });\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** Render icon-button/popupmenu to download the data (and/or the associated meta files (bai, etc.)) for this.\n\t * @returns {jQuery} rendered DOM\n\t */\n\t _renderDownloadButton: function () {\n\t // don't show anything if the data's been purged\n\t if (this.model.get('purged') || !this.model.hasData()) {\n\t return null;\n\t }\n\t\n\t // return either: a popupmenu with links to download assoc. meta files (if there are meta files)\n\t // or a single download icon-button (if there are no meta files)\n\t if (!_.isEmpty(this.model.get('meta_files'))) {\n\t return this._renderMetaFileDownloadButton();\n\t }\n\t\n\t return $(['', '', ''].join(''));\n\t },\n\t\n\t /** Render the download button which opens a dropdown with links to download assoc. meta files (indeces, etc.) */\n\t _renderMetaFileDownloadButton: function () {\n\t var urls = this.model.urls;\n\t return $(['
                        ', '', '', '', '', '
                        '].join('\\n'));\n\t },\n\t\n\t _renderNametags: function () {\n\t var tpl = _.template(['<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>', '<% if (tag.indexOf(\"name:\") == 0){ %>', '<%- tag.slice(5) %>', '<% } %>', '<% }); %>'].join(''));\n\t return tpl({ tags: this.model.get('tags') });\n\t },\n\t\n\t // ......................................................................... misc\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .display-btn': function (ev) {\n\t this.trigger('display', this, ev);\n\t },\n\t 'click .params-btn': function (ev) {\n\t this.trigger('params', this, ev);\n\t },\n\t 'click .download-btn': function (ev) {\n\t this.trigger('download', this, ev);\n\t }\n\t }),\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DatasetListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetListItemView.prototype.templates = function () {\n\t //TODO: move to require text! plugin\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t failed_metadata: BASE_MVC.wrapTemplate([\n\t // failed metadata is rendered as a warning on an otherwise ok dataset view\n\t '<% if( model.state === \"failed_metadata\" ){ %>', '
                        ', _l('An error occurred setting the metadata for this dataset'), '
                        ', '<% } %>']),\n\t error: BASE_MVC.wrapTemplate([\n\t // error during index fetch - show error on dataset\n\t '<% if( model.error ){ %>', '
                        ', _l('There was an error getting the data for this dataset'), ': <%- model.error %>', '
                        ', '<% } %>']),\n\t purged: BASE_MVC.wrapTemplate(['<% if( model.purged ){ %>', '
                        ', _l('This dataset has been deleted and removed from disk'), '
                        ', '<% } %>']),\n\t deleted: BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>', '
                        ', _l('This dataset has been deleted'), '
                        ', '<% } %>'])\n\t\n\t //NOTE: hidden warning is only needed for HDAs\n\t });\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate(['
                        ', '
                        ', '
                        ', '
                        ', '
                        ', '
                        ',\n\t\n\t // do not display tags, annotation, display apps, or peek when deleted\n\t '<% if( !dataset.deleted && !dataset.purged ){ %>', '
                        ', '
                        ', '
                        ', '<% if( dataset.peek ){ %>', '
                        <%= dataset.peek %>
                        ', '<% } %>', '<% } %>', '
                        '], 'dataset');\n\t\n\t var noAccessTemplate = BASE_MVC.wrapTemplate(['
                        ', '
                        ', _l('You do not have permission to view this dataset'), '
                        ', '
                        '], 'dataset');\n\t\n\t //TODO: still toooooooooooooo complex - rework\n\t var summaryTemplates = {};\n\t summaryTemplates[STATES.OK] = summaryTemplates[STATES.FAILED_METADATA] = BASE_MVC.wrapTemplate(['<% if( dataset.misc_blurb ){ %>', '
                        ', '<%- dataset.misc_blurb %>', '
                        ', '<% } %>', '<% if( dataset.file_ext ){ %>', '
                        ', '', '<%- dataset.file_ext %>', '
                        ', '<% } %>', '<% if( dataset.metadata_dbkey ){ %>', '
                        ', '', '', '<%- dataset.metadata_dbkey %>', '', '
                        ', '<% } %>', '<% if( dataset.misc_info ){ %>', '
                        ', '<%- dataset.misc_info %>', '
                        ', '<% } %>'], 'dataset');\n\t summaryTemplates[STATES.NEW] = BASE_MVC.wrapTemplate(['
                        ', _l('This is a new dataset and not all of its data are available yet'), '
                        '], 'dataset');\n\t summaryTemplates[STATES.NOT_VIEWABLE] = BASE_MVC.wrapTemplate(['
                        ', _l('You do not have permission to view this dataset'), '
                        '], 'dataset');\n\t summaryTemplates[STATES.DISCARDED] = BASE_MVC.wrapTemplate(['
                        ', _l('The job creating this dataset was cancelled before completion'), '
                        '], 'dataset');\n\t summaryTemplates[STATES.QUEUED] = BASE_MVC.wrapTemplate(['
                        ', _l('This job is waiting to run'), '
                        '], 'dataset');\n\t summaryTemplates[STATES.RUNNING] = BASE_MVC.wrapTemplate(['
                        ', _l('This job is currently running'), '
                        '], 'dataset');\n\t summaryTemplates[STATES.UPLOAD] = BASE_MVC.wrapTemplate(['
                        ', _l('This dataset is currently uploading'), '
                        '], 'dataset');\n\t summaryTemplates[STATES.SETTING_METADATA] = BASE_MVC.wrapTemplate(['
                        ', _l('Metadata is being auto-detected'), '
                        '], 'dataset');\n\t summaryTemplates[STATES.PAUSED] = BASE_MVC.wrapTemplate(['
                        ', _l('This job is paused. Use the \"Resume Paused Jobs\" in the history menu to resume'), '
                        '], 'dataset');\n\t summaryTemplates[STATES.ERROR] = BASE_MVC.wrapTemplate(['<% if( !dataset.purged ){ %>', '
                        <%- dataset.misc_blurb %>
                        ', '<% } %>', '', _l('An error occurred with this dataset'), ':', '
                        <%- dataset.misc_info %>
                        '], 'dataset');\n\t summaryTemplates[STATES.EMPTY] = BASE_MVC.wrapTemplate(['
                        ', _l('No data'), ': <%- dataset.misc_blurb %>
                        '], 'dataset');\n\t summaryTemplates.unknown = BASE_MVC.wrapTemplate(['
                        Error: unknown dataset state: \"<%- dataset.state %>\"
                        '], 'dataset');\n\t\n\t // messages to be displayed only within the details section ('below the fold')\n\t var detailMessageTemplates = {\n\t resubmitted: BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.resubmitted ){ %>', '
                        ', _l('The job creating this dataset has been resubmitted'), '
                        ', '<% } %>'])\n\t };\n\t\n\t // this is applied to both old and new style display apps\n\t var displayApplicationsTemplate = BASE_MVC.wrapTemplate(['<% _.each( apps, function( app ){ %>', '
                        ', '<%- app.label %> ', '', '<% _.each( app.links, function( link ){ %>', '\" href=\"<%- link.href %>\">', '<% print( _l( link.text ) ); %>', ' ', '<% }); %>', '', '
                        ', '<% }); %>'], 'apps');\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t warnings: warnings,\n\t details: detailsTemplate,\n\t noAccess: noAccessTemplate,\n\t summaries: summaryTemplates,\n\t detailMessages: detailMessageTemplates,\n\t displayApplications: displayApplicationsTemplate\n\t });\n\t }();\n\t\n\t // ============================================================================\n\t return {\n\t DatasetListItemView: DatasetListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 62 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {/** Generic form view */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(10), __webpack_require__(5)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Form, Ui) {\n\t\n\t var View = Backbone.View.extend({\n\t\n\t initialize: function (options) {\n\t this.model = new Backbone.Model(options);\n\t this.url = this.model.get('url');\n\t this.redirect = this.model.get('redirect');\n\t this.setElement('
                        ');\n\t this.render();\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t $.ajax({\n\t url: Galaxy.root + this.url,\n\t type: 'GET'\n\t }).done(function (response) {\n\t var options = $.extend({}, self.model.attributes, response);\n\t var form = new Form({\n\t title: options.title,\n\t message: options.message,\n\t status: options.status || 'warning',\n\t icon: options.icon,\n\t inputs: options.inputs,\n\t buttons: {\n\t 'submit': new Ui.Button({\n\t tooltip: options.submit_tooltip,\n\t title: options.submit_title || 'Save',\n\t icon: options.submit_icon || 'fa-save',\n\t cls: 'btn btn-primary ui-clear-float',\n\t onclick: function () {\n\t self._submit(form);\n\t }\n\t })\n\t }\n\t });\n\t self.$el.empty().append(form.$el);\n\t }).fail(function (response) {\n\t self.$el.empty().append(new Ui.Message({\n\t message: 'Failed to load resource ' + self.url + '.',\n\t status: 'danger',\n\t persistent: true\n\t }).$el);\n\t });\n\t },\n\t\n\t _submit: function (form) {\n\t var self = this;\n\t $.ajax({\n\t url: Galaxy.root + self.url,\n\t data: JSON.stringify(form.data.create()),\n\t type: 'PUT',\n\t contentType: 'application/json'\n\t }).done(function (response) {\n\t var success_message = { message: response.message, status: 'success', persistent: false };\n\t if (self.redirect) {\n\t window.location = Galaxy.root + self.redirect + '?' + $.param(success_message);\n\t } else {\n\t form.data.matchModel(response, function (input, input_id) {\n\t form.field_list[input_id].value(input.value);\n\t });\n\t self._showMessage(form, success_message);\n\t }\n\t }).fail(function (response) {\n\t self._showMessage(form, { message: response.responseJSON.err_msg, status: 'danger', persistent: false });\n\t });\n\t },\n\t\n\t _showMessage: function (form, options) {\n\t var $panel = form.$el.parents().filter(function () {\n\t return ['auto', 'scroll'].indexOf($(this).css('overflow')) != -1;\n\t }).first();\n\t $panel.animate({ scrollTop: 0 }, 500);\n\t form.message.update(options);\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 63 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(59), __webpack_require__(90), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DC_MODEL, HISTORY_CONTENT, _l) {\n\t\n\t 'use strict';\n\t\n\t /*==============================================================================\n\t \n\t Models for DatasetCollections contained within a history.\n\t \n\t TODO:\n\t these might be compactable to one class if some duplication with\n\t collection-model is used.\n\t \n\t ==============================================================================*/\n\t\n\t var hcontentMixin = HISTORY_CONTENT.HistoryContentMixin,\n\t ListDC = DC_MODEL.ListDatasetCollection,\n\t PairDC = DC_MODEL.PairDatasetCollection,\n\t ListPairedDC = DC_MODEL.ListPairedDatasetCollection,\n\t ListOfListsDC = DC_MODEL.ListOfListsDatasetCollection;\n\t\n\t //==============================================================================\n\t /** Override to post to contents route w/o id. */\n\t function buildHDCASave(_super) {\n\t return function _save(attributes, options) {\n\t if (this.isNew()) {\n\t options = options || {};\n\t options.url = this.urlRoot + this.get('history_id') + '/contents';\n\t attributes = attributes || {};\n\t attributes.type = 'dataset_collection';\n\t }\n\t return _super.call(this, attributes, options);\n\t };\n\t }\n\t\n\t //==============================================================================\n\t /** @class Backbone model for List Dataset Collection within a History.\n\t */\n\t var HistoryListDatasetCollection = ListDC.extend(hcontentMixin).extend(\n\t /** @lends HistoryListDatasetCollection.prototype */{\n\t\n\t defaults: _.extend(_.clone(ListDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'list',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(ListDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'History' + ListDC.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for Pair Dataset Collection within a History.\n\t * @constructs\n\t */\n\t var HistoryPairDatasetCollection = PairDC.extend(hcontentMixin).extend(\n\t /** @lends HistoryPairDatasetCollection.prototype */{\n\t\n\t defaults: _.extend(_.clone(PairDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'paired',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(PairDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'History' + PairDC.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for List of Pairs Dataset Collection within a History. */\n\t var HistoryListPairedDatasetCollection = ListPairedDC.extend(hcontentMixin).extend({\n\t\n\t defaults: _.extend(_.clone(ListPairedDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'list:paired',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(ListPairedDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'History' + ListPairedDC.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for List of Lists Dataset Collection within a History. */\n\t var HistoryListOfListsDatasetCollection = ListOfListsDC.extend(hcontentMixin).extend({\n\t\n\t defaults: _.extend(_.clone(ListOfListsDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'list:list',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(ListOfListsDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['HistoryListOfListsDatasetCollection(', this.get('name'), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HistoryListDatasetCollection: HistoryListDatasetCollection,\n\t HistoryPairDatasetCollection: HistoryPairDatasetCollection,\n\t HistoryListPairedDatasetCollection: HistoryListPairedDatasetCollection,\n\t HistoryListOfListsDatasetCollection: HistoryListOfListsDatasetCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 64 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, jQuery, Backbone) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(81), __webpack_require__(88), __webpack_require__(63), __webpack_require__(66), __webpack_require__(7), __webpack_require__(154)], __WEBPACK_AMD_DEFINE_RESULT__ = function (CONTROLLED_FETCH_COLLECTION, HDA_MODEL, HDCA_MODEL, HISTORY_PREFS, BASE_MVC, AJAX_QUEUE) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = CONTROLLED_FETCH_COLLECTION.PaginatedCollection;\n\t /** @class Backbone collection for history content.\n\t * NOTE: history content seems like a dataset collection, but differs in that it is mixed:\n\t * each element can be either an HDA (dataset) or a DatasetCollection and co-exist on\n\t * the same level.\n\t * Dataset collections on the other hand are not mixed and (so far) can only contain either\n\t * HDAs or child dataset collections on one level.\n\t * This is why this does not inherit from any of the DatasetCollections (currently).\n\t */\n\t var HistoryContents = _super.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: 'history',\n\t\n\t // ........................................................................ composite collection\n\t /** since history content is a mix, override model fn into a factory, creating based on history_content_type */\n\t model: function (attrs, options) {\n\t if (attrs.history_content_type === \"dataset\") {\n\t return new HDA_MODEL.HistoryDatasetAssociation(attrs, options);\n\t } else if (attrs.history_content_type === \"dataset_collection\") {\n\t switch (attrs.collection_type) {\n\t case 'list':\n\t return new HDCA_MODEL.HistoryListDatasetCollection(attrs, options);\n\t case 'paired':\n\t return new HDCA_MODEL.HistoryPairDatasetCollection(attrs, options);\n\t case 'list:paired':\n\t return new HDCA_MODEL.HistoryListPairedDatasetCollection(attrs, options);\n\t case 'list:list':\n\t return new HDCA_MODEL.HistoryListOfListsDatasetCollection(attrs, options);\n\t }\n\t // This is a hack inside a hack:\n\t // Raise a plain object with validationError to fake a model.validationError\n\t // (since we don't have a model to use validate with)\n\t // (the outer hack being the mixed content/model function in this collection)\n\t var msg = 'Unknown collection_type: ' + attrs.collection_type;\n\t console.warn(msg, attrs);\n\t return { validationError: msg };\n\t }\n\t return { validationError: 'Unknown history_content_type: ' + attrs.history_content_type };\n\t },\n\t\n\t // ........................................................................ set up\n\t limitPerPage: 500,\n\t\n\t /** @type {Integer} how many contents per call to fetch when using progressivelyFetchDetails */\n\t limitPerProgressiveFetch: 500,\n\t\n\t /** @type {String} order used here and when fetching from server */\n\t order: 'hid',\n\t\n\t /** root api url */\n\t urlRoot: Galaxy.root + 'api/histories',\n\t\n\t /** complete api url */\n\t url: function () {\n\t return this.urlRoot + '/' + this.historyId + '/contents';\n\t },\n\t\n\t /** Set up */\n\t initialize: function (models, options) {\n\t options = options || {};\n\t _super.prototype.initialize.call(this, models, options);\n\t\n\t this.history = options.history || null;\n\t this.setHistoryId(options.historyId || null);\n\t /** @type {Boolean} does this collection contain and fetch deleted elements */\n\t this.includeDeleted = options.includeDeleted || this.includeDeleted;\n\t /** @type {Boolean} does this collection contain and fetch non-visible elements */\n\t this.includeHidden = options.includeHidden || this.includeHidden;\n\t\n\t // backbonejs uses collection.model.prototype.idAttribute to determine if a model is *already* in a collection\n\t // and either merged or replaced. In this case, our 'model' is a function so we need to add idAttribute\n\t // manually here - if we don't, contents will not merge but be replaced/swapped.\n\t this.model.prototype.idAttribute = 'type_id';\n\t },\n\t\n\t setHistoryId: function (newId) {\n\t this.historyId = newId;\n\t this._setUpWebStorage();\n\t },\n\t\n\t /** Set up client side storage. Currently PersistanStorage keyed under 'history:' */\n\t _setUpWebStorage: function (initialSettings) {\n\t // TODO: use initialSettings\n\t if (!this.historyId) {\n\t return;\n\t }\n\t this.storage = new HISTORY_PREFS.HistoryPrefs({\n\t id: HISTORY_PREFS.HistoryPrefs.historyStorageKey(this.historyId)\n\t });\n\t this.trigger('new-storage', this.storage, this);\n\t\n\t this.on({\n\t 'include-deleted': function (newVal) {\n\t this.storage.includeDeleted(newVal);\n\t },\n\t 'include-hidden': function (newVal) {\n\t this.storage.includeHidden(newVal);\n\t }\n\t });\n\t\n\t this.includeDeleted = this.storage.includeDeleted() || false;\n\t this.includeHidden = this.storage.includeHidden() || false;\n\t return this;\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** @type {Object} map of collection available sorting orders containing comparator fns */\n\t comparators: _.extend(_.clone(_super.prototype.comparators), {\n\t 'name': BASE_MVC.buildComparator('name', { ascending: true }),\n\t 'name-dsc': BASE_MVC.buildComparator('name', { ascending: false }),\n\t 'hid': BASE_MVC.buildComparator('hid', { ascending: false }),\n\t 'hid-asc': BASE_MVC.buildComparator('hid', { ascending: true })\n\t }),\n\t\n\t /** Get every model in this collection not in a 'ready' state (running). */\n\t running: function () {\n\t return this.filter(function (c) {\n\t return !c.inReadyState();\n\t });\n\t },\n\t\n\t /** return contents that are not ready and not deleted/hidden */\n\t runningAndActive: function () {\n\t return this.filter(function (c) {\n\t return !c.inReadyState() && c.get('visible')\n\t // TODO: deletedOrPurged?\n\t && !c.get('deleted');\n\t });\n\t },\n\t\n\t /** Get the model with the given hid\n\t * @param {Int} hid the hid to search for\n\t * @returns {HistoryDatasetAssociation} the model with the given hid or undefined if not found\n\t */\n\t getByHid: function (hid) {\n\t // note: there *can* be more than one content with a given hid, this finds the first based on order\n\t return this.findWhere({ hid: hid });\n\t },\n\t\n\t /** return true if all contents have details */\n\t haveDetails: function () {\n\t return this.all(function (c) {\n\t return c.hasDetails();\n\t });\n\t },\n\t\n\t // ........................................................................ hidden / deleted\n\t /** return a new contents collection of only hidden items */\n\t hidden: function () {\n\t return this.filter(function (c) {\n\t return c.hidden();\n\t });\n\t },\n\t\n\t /** return a new contents collection of only hidden items */\n\t deleted: function () {\n\t return this.filter(function (c) {\n\t return c.get('deleted');\n\t });\n\t },\n\t\n\t /** return a new contents collection of only hidden items */\n\t visibleAndUndeleted: function () {\n\t return this.filter(function (c) {\n\t return c.get('visible') &&\n\t // TODO: deletedOrPurged?\n\t !c.get('deleted');\n\t });\n\t },\n\t\n\t /** create a setter in order to publish the change */\n\t setIncludeDeleted: function (setting, options) {\n\t if (_.isBoolean(setting) && setting !== this.includeDeleted) {\n\t this.includeDeleted = setting;\n\t if (_.result(options, 'silent')) {\n\t return;\n\t }\n\t this.trigger('include-deleted', setting, this);\n\t }\n\t },\n\t\n\t /** create a setter in order to publish the change */\n\t setIncludeHidden: function (setting, options) {\n\t if (_.isBoolean(setting) && setting !== this.includeHidden) {\n\t this.includeHidden = setting;\n\t options = options || {};\n\t if (_.result(options, 'silent')) {\n\t return;\n\t }\n\t this.trigger('include-hidden', setting, this);\n\t }\n\t },\n\t\n\t // ........................................................................ ajax\n\t // ............ controlled fetch collection\n\t /** override to get expanded ids from sessionStorage and pass to API as details */\n\t fetch: function (options) {\n\t options = options || {};\n\t if (this.historyId && !options.details) {\n\t var prefs = HISTORY_PREFS.HistoryPrefs.get(this.historyId).toJSON();\n\t if (!_.isEmpty(prefs.expandedIds)) {\n\t options.details = _.values(prefs.expandedIds).join(',');\n\t }\n\t }\n\t return _super.prototype.fetch.call(this, options);\n\t },\n\t\n\t // ............. ControlledFetch stuff\n\t /** override to include the API versioning flag */\n\t _buildFetchData: function (options) {\n\t return _.extend(_super.prototype._buildFetchData.call(this, options), {\n\t v: 'dev'\n\t });\n\t },\n\t\n\t /** Extend to include details and version */\n\t _fetchParams: _super.prototype._fetchParams.concat([\n\t // TODO: remove (the need for) both\n\t /** version */\n\t 'v',\n\t /** dataset ids to get full details of */\n\t 'details']),\n\t\n\t /** override to add deleted/hidden filters */\n\t _buildFetchFilters: function (options) {\n\t var superFilters = _super.prototype._buildFetchFilters.call(this, options) || {};\n\t var filters = {};\n\t if (!this.includeDeleted) {\n\t filters.deleted = false;\n\t filters.purged = false;\n\t }\n\t if (!this.includeHidden) {\n\t filters.visible = true;\n\t }\n\t return _.defaults(superFilters, filters);\n\t },\n\t\n\t // ............ paginated collection\n\t getTotalItemCount: function () {\n\t return this.history.contentsShown();\n\t },\n\t\n\t // ............ history contents specific ajax\n\t /** override to filter requested contents to those updated after the Date 'since' */\n\t fetchUpdated: function (since, options) {\n\t if (since) {\n\t options = options || { filters: {} };\n\t options.remove = false;\n\t options.filters = {\n\t 'update_time-ge': since.toISOString(),\n\t // workflows will produce hidden datasets (non-output datasets) that still\n\t // need to be updated in the collection or they'll update forever\n\t // we can remove the default visible filter by using an 'empty' value\n\t visible: ''\n\t };\n\t }\n\t return this.fetch(options);\n\t },\n\t\n\t /** fetch all the deleted==true contents of this collection */\n\t fetchDeleted: function (options) {\n\t options = options || {};\n\t var self = this;\n\t options.filters = _.extend(options.filters, {\n\t // all deleted, purged or not\n\t deleted: true,\n\t purged: undefined\n\t });\n\t options.remove = false;\n\t\n\t self.trigger('fetching-deleted', self);\n\t return self.fetch(options).always(function () {\n\t self.trigger('fetching-deleted-done', self);\n\t });\n\t },\n\t\n\t /** fetch all the visible==false contents of this collection */\n\t fetchHidden: function (options) {\n\t options = options || {};\n\t var self = this;\n\t options.filters = _.extend(options.filters, {\n\t visible: false\n\t });\n\t options.remove = false;\n\t\n\t self.trigger('fetching-hidden', self);\n\t return self.fetch(options).always(function () {\n\t self.trigger('fetching-hidden-done', self);\n\t });\n\t },\n\t\n\t /** fetch detailed model data for all contents in this collection */\n\t fetchAllDetails: function (options) {\n\t options = options || {};\n\t var detailsFlag = { details: 'all' };\n\t options.data = _.extend(options.data || {}, detailsFlag);\n\t return this.fetch(options);\n\t },\n\t\n\t /** specialty fetch method for retrieving the element_counts of all hdcas in the history */\n\t fetchCollectionCounts: function (options) {\n\t options = options || {};\n\t options.keys = ['type_id', 'element_count'].join(',');\n\t options.filters = _.extend(options.filters || {}, {\n\t history_content_type: 'dataset_collection'\n\t });\n\t options.remove = false;\n\t return this.fetch(options);\n\t },\n\t\n\t // ............. quasi-batch ops\n\t // TODO: to batch\n\t /** helper that fetches using filterParams then calls save on each fetched using updateWhat as the save params */\n\t _filterAndUpdate: function (filterParams, updateWhat) {\n\t var self = this;\n\t var idAttribute = self.model.prototype.idAttribute;\n\t var updateArgs = [updateWhat];\n\t\n\t return self.fetch({ filters: filterParams, remove: false }).then(function (fetched) {\n\t // convert filtered json array to model array\n\t fetched = fetched.reduce(function (modelArray, currJson, i) {\n\t var model = self.get(currJson[idAttribute]);\n\t return model ? modelArray.concat(model) : modelArray;\n\t }, []);\n\t return self.ajaxQueue('save', updateArgs, fetched);\n\t });\n\t },\n\t\n\t /** using a queue, perform ajaxFn on each of the models in this collection */\n\t ajaxQueue: function (ajaxFn, args, collection) {\n\t collection = collection || this.models;\n\t return new AJAX_QUEUE.AjaxQueue(collection.slice().reverse().map(function (content, i) {\n\t var fn = _.isString(ajaxFn) ? content[ajaxFn] : ajaxFn;\n\t return function () {\n\t return fn.apply(content, args);\n\t };\n\t })).deferred;\n\t },\n\t\n\t /** fetch contents' details in batches of limitPerCall - note: only get searchable details here */\n\t progressivelyFetchDetails: function (options) {\n\t options = options || {};\n\t var deferred = jQuery.Deferred();\n\t var self = this;\n\t var limit = options.limitPerCall || self.limitPerProgressiveFetch;\n\t // TODO: only fetch tags and annotations if specifically requested\n\t var searchAttributes = HDA_MODEL.HistoryDatasetAssociation.prototype.searchAttributes;\n\t var detailKeys = searchAttributes.join(',');\n\t\n\t function _recursivelyFetch(offset) {\n\t offset = offset || 0;\n\t var _options = _.extend(_.clone(options), {\n\t view: 'summary',\n\t keys: detailKeys,\n\t limit: limit,\n\t offset: offset,\n\t reset: offset === 0,\n\t remove: false\n\t });\n\t\n\t _.defer(function () {\n\t self.fetch.call(self, _options).fail(deferred.reject).done(function (response) {\n\t deferred.notify(response, limit, offset);\n\t if (response.length !== limit) {\n\t self.allFetched = true;\n\t deferred.resolve(response, limit, offset);\n\t } else {\n\t _recursivelyFetch(offset + limit);\n\t }\n\t });\n\t });\n\t }\n\t _recursivelyFetch();\n\t return deferred;\n\t },\n\t\n\t /** does some bit of JSON represent something that can be copied into this contents collection */\n\t isCopyable: function (contentsJSON) {\n\t var copyableModelClasses = ['HistoryDatasetAssociation', 'HistoryDatasetCollectionAssociation'];\n\t return _.isObject(contentsJSON) && contentsJSON.id && _.contains(copyableModelClasses, contentsJSON.model_class);\n\t },\n\t\n\t /** copy an existing, accessible hda into this collection */\n\t copy: function (json) {\n\t // TODO: somehow showhorn all this into 'save'\n\t var id, type, contentType;\n\t if (_.isString(json)) {\n\t id = json;\n\t contentType = 'hda';\n\t type = 'dataset';\n\t } else {\n\t id = json.id;\n\t contentType = {\n\t 'HistoryDatasetAssociation': 'hda',\n\t 'LibraryDatasetDatasetAssociation': 'ldda',\n\t 'HistoryDatasetCollectionAssociation': 'hdca'\n\t }[json.model_class] || 'hda';\n\t type = contentType === 'hdca' ? 'dataset_collection' : 'dataset';\n\t }\n\t var collection = this,\n\t xhr = jQuery.ajax(this.url(), {\n\t method: 'POST',\n\t contentType: 'application/json',\n\t data: JSON.stringify({\n\t content: id,\n\t source: contentType,\n\t type: type\n\t })\n\t }).done(function (response) {\n\t collection.add([response], { parse: true });\n\t }).fail(function (error, status, message) {\n\t collection.trigger('error', collection, xhr, {}, 'Error copying contents', { type: type, id: id, source: contentType });\n\t });\n\t return xhr;\n\t },\n\t\n\t /** create a new HDCA in this collection */\n\t createHDCA: function (elementIdentifiers, collectionType, name, hideSourceItems, options) {\n\t // normally collection.create returns the new model, but we need the promise from the ajax, so we fake create\n\t //precondition: elementIdentifiers is an array of plain js objects\n\t // in the proper form to create the collectionType\n\t var hdca = this.model({\n\t history_content_type: 'dataset_collection',\n\t collection_type: collectionType,\n\t history_id: this.historyId,\n\t name: name,\n\t hide_source_items: hideSourceItems || false,\n\t // should probably be able to just send in a bunch of json here and restruct per class\n\t // note: element_identifiers is now (incorrectly) an attribute\n\t element_identifiers: elementIdentifiers\n\t // do not create the model on the client until the ajax returns\n\t });\n\t return hdca.save(options);\n\t },\n\t\n\t // ........................................................................ searching\n\t /** return true if all contents have the searchable attributes */\n\t haveSearchDetails: function () {\n\t return this.allFetched && this.all(function (content) {\n\t // null (which is a valid returned annotation value)\n\t // will return false when using content.has( 'annotation' )\n\t //TODO: a bit hacky - formalize\n\t return _.has(content.attributes, 'annotation');\n\t });\n\t },\n\t\n\t /** return a new collection of contents whose attributes contain the substring matchesWhat */\n\t matches: function (matchesWhat) {\n\t return this.filter(function (content) {\n\t return content.matches(matchesWhat);\n\t });\n\t },\n\t\n\t // ........................................................................ misc\n\t /** In this override, copy the historyId to the clone */\n\t clone: function () {\n\t var clone = Backbone.Collection.prototype.clone.call(this);\n\t clone.historyId = this.historyId;\n\t return clone;\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['HistoryContents(', [this.historyId, this.length].join(), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HistoryContents: HistoryContents\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 65 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, jQuery, _, $) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(64), __webpack_require__(66), __webpack_require__(81), __webpack_require__(4), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HISTORY_CONTENTS, HISTORY_PREFS, CONTROLLED_FETCH_COLLECTION, UTILS, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /** @class Model for a Galaxy history resource - both a record of user\n\t * tool use and a collection of the datasets those tools produced.\n\t * @name History\n\t * @augments Backbone.Model\n\t */\n\t\n\t var History = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(BASE_MVC.mixin(BASE_MVC.SearchableModelMixin, /** @lends History.prototype */{\n\t _logNamespace: 'history',\n\t\n\t /** ms between fetches when checking running jobs/datasets for updates */\n\t UPDATE_DELAY: 4000,\n\t\n\t // values from api (may need more)\n\t defaults: {\n\t model_class: 'History',\n\t id: null,\n\t name: 'Unnamed History',\n\t state: 'new',\n\t\n\t deleted: false,\n\t contents_active: {},\n\t contents_states: {}\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/histories',\n\t\n\t contentsClass: HISTORY_CONTENTS.HistoryContents,\n\t\n\t /** What model fields to search with */\n\t searchAttributes: ['name', 'annotation', 'tags'],\n\t\n\t /** Adding title and singular tag */\n\t searchAliases: {\n\t title: 'name',\n\t tag: 'tags'\n\t },\n\t\n\t // ........................................................................ set up/tear down\n\t /** Set up the model\n\t * @param {Object} historyJSON model data for this History\n\t * @param {Object} options any extra settings including logger\n\t */\n\t initialize: function (historyJSON, options) {\n\t options = options || {};\n\t this.logger = options.logger || null;\n\t this.log(this + \".initialize:\", historyJSON, options);\n\t\n\t /** HistoryContents collection of the HDAs contained in this history. */\n\t this.contents = new this.contentsClass([], {\n\t history: this,\n\t historyId: this.get('id'),\n\t order: options.order\n\t });\n\t\n\t this._setUpListeners();\n\t this._setUpCollectionListeners();\n\t\n\t /** cached timeout id for the dataset updater */\n\t this.updateTimeoutId = null;\n\t },\n\t\n\t /** set up any event listeners for this history including those to the contained HDAs\n\t * events: error:contents if an error occurred with the contents collection\n\t */\n\t _setUpListeners: function () {\n\t // if the model's id changes ('current' or null -> an actual id), update the contents history_id\n\t return this.on({\n\t 'error': function (model, xhr, options, msg, details) {\n\t this.clearUpdateTimeout();\n\t },\n\t 'change:id': function (model, newId) {\n\t if (this.contents) {\n\t this.contents.historyId = newId;\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** event handlers for the contents submodels */\n\t _setUpCollectionListeners: function () {\n\t if (!this.contents) {\n\t return this;\n\t }\n\t // bubble up errors\n\t return this.listenTo(this.contents, {\n\t 'error': function () {\n\t this.trigger.apply(this, jQuery.makeArray(arguments));\n\t }\n\t });\n\t },\n\t\n\t // ........................................................................ derived attributes\n\t /** */\n\t contentsShown: function () {\n\t var contentsActive = this.get('contents_active');\n\t var shown = contentsActive.active || 0;\n\t shown += this.contents.includeDeleted ? contentsActive.deleted : 0;\n\t shown += this.contents.includeHidden ? contentsActive.hidden : 0;\n\t return shown;\n\t },\n\t\n\t /** convert size in bytes to a more human readable version */\n\t nice_size: function () {\n\t var size = this.get('size');\n\t return size ? UTILS.bytesToString(size, true, 2) : _l('(empty)');\n\t },\n\t\n\t /** override to add nice_size */\n\t toJSON: function () {\n\t return _.extend(Backbone.Model.prototype.toJSON.call(this), {\n\t nice_size: this.nice_size()\n\t });\n\t },\n\t\n\t /** override to allow getting nice_size */\n\t get: function (key) {\n\t if (key === 'nice_size') {\n\t return this.nice_size();\n\t }\n\t return Backbone.Model.prototype.get.apply(this, arguments);\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** T/F is this history owned by the current user (Galaxy.user)\n\t * Note: that this will return false for an anon user even if the history is theirs.\n\t */\n\t ownedByCurrUser: function () {\n\t // no currUser\n\t if (!Galaxy || !Galaxy.user) {\n\t return false;\n\t }\n\t // user is anon or history isn't owned\n\t if (Galaxy.user.isAnonymous() || Galaxy.user.id !== this.get('user_id')) {\n\t return false;\n\t }\n\t return true;\n\t },\n\t\n\t /** Return the number of running jobs assoc with this history (note: unknown === 0) */\n\t numOfUnfinishedJobs: function () {\n\t var unfinishedJobIds = this.get('non_ready_jobs');\n\t return unfinishedJobIds ? unfinishedJobIds.length : 0;\n\t },\n\t\n\t /** Return the number of running hda/hdcas in this history (note: unknown === 0) */\n\t numOfUnfinishedShownContents: function () {\n\t return this.contents.runningAndActive().length || 0;\n\t },\n\t\n\t // ........................................................................ updates\n\t _fetchContentRelatedAttributes: function () {\n\t var contentRelatedAttrs = ['size', 'non_ready_jobs', 'contents_active', 'hid_counter'];\n\t return this.fetch({ data: $.param({ keys: contentRelatedAttrs.join(',') }) });\n\t },\n\t\n\t /** check for any changes since the last time we updated (or fetch all if ) */\n\t refresh: function (options) {\n\t // console.log( this + '.refresh' );\n\t options = options || {};\n\t var self = this;\n\t\n\t // note if there was no previous update time, all summary contents will be fetched\n\t var lastUpdateTime = self.lastUpdateTime;\n\t // if we don't flip this, then a fully-fetched list will not be re-checked via fetch\n\t this.contents.allFetched = false;\n\t var fetchFn = self.contents.currentPage !== 0 ? function () {\n\t return self.contents.fetchPage(self.contents.currentPage);\n\t } : function () {\n\t return self.contents.fetchUpdated(lastUpdateTime);\n\t };\n\t // note: if there was no previous update time, all summary contents will be fetched\n\t return fetchFn().done(function (response, status, xhr) {\n\t var serverResponseDatetime;\n\t try {\n\t serverResponseDatetime = new Date(xhr.getResponseHeader('Date'));\n\t } catch (err) {}\n\t self.lastUpdateTime = serverResponseDatetime || new Date();\n\t self.checkForUpdates(options);\n\t });\n\t },\n\t\n\t /** continuously fetch updated contents every UPDATE_DELAY ms if this history's datasets or jobs are unfinished */\n\t checkForUpdates: function (options) {\n\t // console.log( this + '.checkForUpdates' );\n\t options = options || {};\n\t var delay = this.UPDATE_DELAY;\n\t var self = this;\n\t if (!self.id) {\n\t return;\n\t }\n\t\n\t function _delayThenUpdate() {\n\t // prevent buildup of updater timeouts by clearing previous if any, then set new and cache id\n\t self.clearUpdateTimeout();\n\t self.updateTimeoutId = setTimeout(function () {\n\t self.refresh(options);\n\t }, delay);\n\t }\n\t\n\t // if there are still datasets in the non-ready state, recurse into this function with the new time\n\t var nonReadyContentCount = this.numOfUnfinishedShownContents();\n\t // console.log( 'nonReadyContentCount:', nonReadyContentCount );\n\t if (nonReadyContentCount > 0) {\n\t _delayThenUpdate();\n\t } else {\n\t // no datasets are running, but currently runnning jobs may still produce new datasets\n\t // see if the history has any running jobs and continue to update if so\n\t // (also update the size for the user in either case)\n\t self._fetchContentRelatedAttributes().done(function (historyData) {\n\t // console.log( 'non_ready_jobs:', historyData.non_ready_jobs );\n\t if (self.numOfUnfinishedJobs() > 0) {\n\t _delayThenUpdate();\n\t } else {\n\t // otherwise, let listeners know that all updates have stopped\n\t self.trigger('ready');\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** clear the timeout and the cached timeout id */\n\t clearUpdateTimeout: function () {\n\t if (this.updateTimeoutId) {\n\t clearTimeout(this.updateTimeoutId);\n\t this.updateTimeoutId = null;\n\t }\n\t },\n\t\n\t // ........................................................................ ajax\n\t /** override to use actual Dates objects for create/update times */\n\t parse: function (response, options) {\n\t var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n\t if (parsed.create_time) {\n\t parsed.create_time = new Date(parsed.create_time);\n\t }\n\t if (parsed.update_time) {\n\t parsed.update_time = new Date(parsed.update_time);\n\t }\n\t return parsed;\n\t },\n\t\n\t /** fetch this histories data (using options) then it's contents (using contentsOptions) */\n\t fetchWithContents: function (options, contentsOptions) {\n\t options = options || {};\n\t var self = this;\n\t\n\t // console.log( this + '.fetchWithContents' );\n\t // TODO: push down to a base class\n\t options.view = 'dev-detailed';\n\t\n\t // fetch history then use history data to fetch (paginated) contents\n\t return this.fetch(options).then(function getContents(history) {\n\t self.contents.history = self;\n\t self.contents.setHistoryId(history.id);\n\t return self.fetchContents(contentsOptions);\n\t });\n\t },\n\t\n\t /** fetch this histories contents, adjusting options based on the stored history preferences */\n\t fetchContents: function (options) {\n\t options = options || {};\n\t var self = this;\n\t\n\t // we're updating, reset the update time\n\t self.lastUpdateTime = new Date();\n\t return self.contents.fetchCurrentPage(options);\n\t },\n\t\n\t /** save this history, _Mark_ing it as deleted (just a flag) */\n\t _delete: function (options) {\n\t if (this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true }, options);\n\t },\n\t /** purge this history, _Mark_ing it as purged and removing all dataset data from the server */\n\t purge: function (options) {\n\t if (this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true, purged: true }, options);\n\t },\n\t /** save this history, _Mark_ing it as undeleted */\n\t undelete: function (options) {\n\t if (!this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: false }, options);\n\t },\n\t\n\t /** Make a copy of this history on the server\n\t * @param {Boolean} current if true, set the copy as the new current history (default: true)\n\t * @param {String} name name of new history (default: none - server sets to: Copy of )\n\t * @fires copied passed this history and the response JSON from the copy\n\t * @returns {xhr}\n\t */\n\t copy: function (current, name, allDatasets) {\n\t current = current !== undefined ? current : true;\n\t if (!this.id) {\n\t throw new Error('You must set the history ID before copying it.');\n\t }\n\t\n\t var postData = { history_id: this.id };\n\t if (current) {\n\t postData.current = true;\n\t }\n\t if (name) {\n\t postData.name = name;\n\t }\n\t if (!allDatasets) {\n\t postData.all_datasets = false;\n\t }\n\t postData.view = 'dev-detailed';\n\t\n\t var history = this;\n\t var copy = jQuery.post(this.urlRoot, postData);\n\t // if current - queue to setAsCurrent before firing 'copied'\n\t if (current) {\n\t return copy.then(function (response) {\n\t var newHistory = new History(response);\n\t return newHistory.setAsCurrent().done(function () {\n\t history.trigger('copied', history, response);\n\t });\n\t });\n\t }\n\t return copy.done(function (response) {\n\t history.trigger('copied', history, response);\n\t });\n\t },\n\t\n\t setAsCurrent: function () {\n\t var history = this,\n\t xhr = jQuery.getJSON(Galaxy.root + 'history/set_as_current?id=' + this.id);\n\t\n\t xhr.done(function () {\n\t history.trigger('set-as-current', history);\n\t });\n\t return xhr;\n\t },\n\t\n\t // ........................................................................ misc\n\t toString: function () {\n\t return 'History(' + this.get('id') + ',' + this.get('name') + ')';\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t var _collectionSuper = CONTROLLED_FETCH_COLLECTION.InfinitelyScrollingCollection;\n\t /** @class A collection of histories (per user)\n\t * that maintains the current history as the first in the collection.\n\t * New or copied histories become the current history.\n\t */\n\t var HistoryCollection = _collectionSuper.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: 'history',\n\t\n\t model: History,\n\t /** @type {String} initial order used by collection */\n\t order: 'update_time',\n\t /** @type {Number} limit used for the first fetch (or a reset) */\n\t limitOnFirstFetch: 10,\n\t /** @type {Number} limit used for each subsequent fetch */\n\t limitPerFetch: 10,\n\t\n\t initialize: function (models, options) {\n\t options = options || {};\n\t this.log('HistoryCollection.initialize', models, options);\n\t _collectionSuper.prototype.initialize.call(this, models, options);\n\t\n\t /** @type {boolean} should deleted histories be included */\n\t this.includeDeleted = options.includeDeleted || false;\n\t\n\t /** @type {String} encoded id of the history that's current */\n\t this.currentHistoryId = options.currentHistoryId;\n\t\n\t this.setUpListeners();\n\t // note: models are sent to reset *after* this fn ends; up to this point\n\t // the collection *is empty*\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/histories',\n\t url: function () {\n\t return this.urlRoot;\n\t },\n\t\n\t /** set up reflexive event handlers */\n\t setUpListeners: function setUpListeners() {\n\t return this.on({\n\t // when a history is deleted, remove it from the collection (if optionally set to do so)\n\t 'change:deleted': function (history) {\n\t // TODO: this becomes complicated when more filters are used\n\t this.debug('change:deleted', this.includeDeleted, history.get('deleted'));\n\t if (!this.includeDeleted && history.get('deleted')) {\n\t this.remove(history);\n\t }\n\t },\n\t // listen for a history copy, setting it to current\n\t 'copied': function (original, newData) {\n\t this.setCurrent(new History(newData, []));\n\t },\n\t // when a history is made current, track the id in the collection\n\t 'set-as-current': function (history) {\n\t var oldCurrentId = this.currentHistoryId;\n\t this.trigger('no-longer-current', oldCurrentId);\n\t this.currentHistoryId = history.id;\n\t }\n\t });\n\t },\n\t\n\t /** override to change view */\n\t _buildFetchData: function (options) {\n\t return _.extend(_collectionSuper.prototype._buildFetchData.call(this, options), {\n\t view: 'dev-detailed'\n\t });\n\t },\n\t\n\t /** override to filter out deleted and purged */\n\t _buildFetchFilters: function (options) {\n\t var superFilters = _collectionSuper.prototype._buildFetchFilters.call(this, options) || {};\n\t var filters = {};\n\t if (!this.includeDeleted) {\n\t filters.deleted = false;\n\t filters.purged = false;\n\t } else {\n\t // force API to return both deleted and non\n\t //TODO: when the API is updated, remove this\n\t filters.deleted = null;\n\t }\n\t return _.defaults(superFilters, filters);\n\t },\n\t\n\t /** override to fetch current as well (as it may be outside the first 10, etc.) */\n\t fetchFirst: function (options) {\n\t var self = this;\n\t // TODO: batch?\n\t var xhr = $.when();\n\t if (this.currentHistoryId) {\n\t xhr = _collectionSuper.prototype.fetchFirst.call(self, {\n\t silent: true,\n\t limit: 1,\n\t filters: {\n\t // without these a deleted current history will return [] here and block the other xhr\n\t 'purged': '',\n\t 'deleted': '',\n\t 'encoded_id-in': this.currentHistoryId\n\t }\n\t });\n\t }\n\t return xhr.then(function () {\n\t options = options || {};\n\t options.offset = 0;\n\t return self.fetchMore(options);\n\t });\n\t },\n\t\n\t /** @type {Object} map of collection available sorting orders containing comparator fns */\n\t comparators: _.extend(_.clone(_collectionSuper.prototype.comparators), {\n\t 'name': BASE_MVC.buildComparator('name', { ascending: true }),\n\t 'name-dsc': BASE_MVC.buildComparator('name', { ascending: false }),\n\t 'size': BASE_MVC.buildComparator('size', { ascending: false }),\n\t 'size-asc': BASE_MVC.buildComparator('size', { ascending: true })\n\t }),\n\t\n\t /** override to always have the current history first */\n\t sort: function (options) {\n\t options = options || {};\n\t var silent = options.silent;\n\t var currentHistory = this.remove(this.get(this.currentHistoryId));\n\t _collectionSuper.prototype.sort.call(this, _.defaults({ silent: true }, options));\n\t this.unshift(currentHistory, { silent: true });\n\t if (!silent) {\n\t this.trigger('sort', this, options);\n\t }\n\t return this;\n\t },\n\t\n\t /** create a new history and by default set it to be the current history */\n\t create: function create(data, hdas, historyOptions, xhrOptions) {\n\t //TODO: .create is actually a collection function that's overridden here\n\t var collection = this,\n\t xhr = jQuery.getJSON(Galaxy.root + 'history/create_new_current');\n\t return xhr.done(function (newData) {\n\t collection.setCurrent(new History(newData, [], historyOptions || {}));\n\t });\n\t },\n\t\n\t /** set the current history to the given history, placing it first in the collection.\n\t * Pass standard bbone options for use in unshift.\n\t * @triggers new-current passed history and this collection\n\t */\n\t setCurrent: function (history, options) {\n\t options = options || {};\n\t // new histories go in the front\n\t this.unshift(history, options);\n\t this.currentHistoryId = history.get('id');\n\t if (!options.silent) {\n\t this.trigger('new-current', history, this);\n\t }\n\t return this;\n\t },\n\t\n\t toString: function toString() {\n\t return 'HistoryCollection(' + this.length + ',current:' + this.currentHistoryId + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t History: History,\n\t HistoryCollection: HistoryCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 66 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(7)], __WEBPACK_AMD_DEFINE_RESULT__ = function (BASE_MVC) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'history';\n\t\n\t // ============================================================================\n\t /** session storage for individual history preferences */\n\t var HistoryPrefs = BASE_MVC.SessionStorageModel.extend(\n\t /** @lends HistoryPrefs.prototype */{\n\t //TODO:?? move to user prefs?\n\t defaults: {\n\t //TODO:?? expandedIds to array?\n\t expandedIds: {},\n\t show_deleted: false,\n\t show_hidden: false\n\t },\n\t\n\t /** add an hda id to the hash of expanded hdas */\n\t addExpanded: function (model) {\n\t //TODO: use type_id and not model\n\t var current = this.get('expandedIds');\n\t current[model.id] = model.get('id');\n\t this.save('expandedIds', current);\n\t },\n\t\n\t /** remove an hda id from the hash of expanded hdas */\n\t removeExpanded: function (model) {\n\t var current = this.get('expandedIds');\n\t delete current[model.id];\n\t this.save('expandedIds', current);\n\t },\n\t\n\t isExpanded: function (contentId) {\n\t return _.result(this.get('expandedIds'), contentId, false);\n\t },\n\t\n\t allExpanded: function () {\n\t return _.values(this.get('expandedIds'));\n\t },\n\t\n\t clearExpanded: function () {\n\t this.set('expandedIds', {});\n\t },\n\t\n\t includeDeleted: function (val) {\n\t // moving the invocation here so other components don't need to know the key\n\t // TODO: change this key later\n\t if (!_.isUndefined(val)) {\n\t this.set('show_deleted', val);\n\t }\n\t return this.get('show_deleted');\n\t },\n\t\n\t includeHidden: function (val) {\n\t // TODO: change this key later\n\t if (!_.isUndefined(val)) {\n\t this.set('show_hidden', val);\n\t }\n\t return this.get('show_hidden');\n\t },\n\t\n\t toString: function () {\n\t return 'HistoryPrefs(' + this.id + ')';\n\t }\n\t\n\t }, {\n\t // ........................................................................ class vars\n\t // class lvl for access w/o instantiation\n\t storageKeyPrefix: 'history:',\n\t\n\t /** key string to store each histories settings under */\n\t historyStorageKey: function historyStorageKey(historyId) {\n\t if (!historyId) {\n\t throw new Error('HistoryPrefs.historyStorageKey needs valid id: ' + historyId);\n\t }\n\t // single point of change\n\t return HistoryPrefs.storageKeyPrefix + historyId;\n\t },\n\t\n\t /** return the existing storage for the history with the given id (or create one if it doesn't exist) */\n\t get: function get(historyId) {\n\t return new HistoryPrefs({ id: HistoryPrefs.historyStorageKey(historyId) });\n\t },\n\t\n\t /** clear all history related items in sessionStorage */\n\t clearAll: function clearAll(historyId) {\n\t for (var key in sessionStorage) {\n\t if (key.indexOf(HistoryPrefs.storageKeyPrefix) === 0) {\n\t sessionStorage.removeItem(key);\n\t }\n\t }\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HistoryPrefs: HistoryPrefs\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 67 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'list';\n\t //==============================================================================\n\t /** A view which, when first rendered, shows only summary data/attributes, but\n\t * can be expanded to show further details (and optionally fetch those\n\t * details from the server).\n\t */\n\t var ExpandableView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t //TODO: Although the reasoning behind them is different, this shares a lot with HiddenUntilActivated above: combine them\n\t //PRECONDITION: model must have method hasDetails\n\t //PRECONDITION: subclasses must have templates.el and templates.details\n\t\n\t initialize: function (attributes) {\n\t /** are the details of this view expanded/shown or not? */\n\t this.expanded = attributes.expanded || false;\n\t this.log('\\t expanded:', this.expanded);\n\t this.fxSpeed = attributes.fxSpeed !== undefined ? attributes.fxSpeed : this.fxSpeed;\n\t },\n\t\n\t // ........................................................................ render main\n\t /** jq fx speed */\n\t fxSpeed: 'fast',\n\t\n\t /** Render this content, set up ui.\n\t * @param {Number or String} speed the speed of the render\n\t */\n\t render: function (speed) {\n\t var $newRender = this._buildNewRender();\n\t this._setUpBehaviors($newRender);\n\t this._queueNewRender($newRender, speed);\n\t return this;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el.\n\t * If the view is already expanded, build the details as well.\n\t */\n\t _buildNewRender: function () {\n\t // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n\t var $newRender = $(this.templates.el(this.model.toJSON(), this));\n\t if (this.expanded) {\n\t this.$details($newRender).replaceWith(this._renderDetails().show());\n\t }\n\t return $newRender;\n\t },\n\t\n\t /** Fade out the old el, swap in the new contents, then fade in.\n\t * @param {Number or String} speed jq speed to use for rendering effects\n\t * @fires rendered when rendered\n\t */\n\t _queueNewRender: function ($newRender, speed) {\n\t speed = speed === undefined ? this.fxSpeed : speed;\n\t var view = this;\n\t\n\t if (speed === 0) {\n\t view._swapNewRender($newRender);\n\t view.trigger('rendered', view);\n\t } else {\n\t $(view).queue('fx', [function (next) {\n\t view.$el.fadeOut(speed, next);\n\t }, function (next) {\n\t view._swapNewRender($newRender);\n\t next();\n\t }, function (next) {\n\t view.$el.fadeIn(speed, next);\n\t }, function (next) {\n\t view.trigger('rendered', view);\n\t next();\n\t }]);\n\t }\n\t },\n\t\n\t /** empty out the current el, move the $newRender's children in */\n\t _swapNewRender: function ($newRender) {\n\t return this.$el.empty().attr('class', _.isFunction(this.className) ? this.className() : this.className).append($newRender.children());\n\t },\n\t\n\t /** set up js behaviors, event handlers for elements within the given container\n\t * @param {jQuery} $container jq object that contains the elements to process (defaults to this.$el)\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t // set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)\n\t //make_popup_menus( $where );\n\t $where.find('[title]').tooltip({ placement: 'bottom' });\n\t },\n\t\n\t // ......................................................................... details\n\t /** shortcut to details DOM (as jQ) */\n\t $details: function ($where) {\n\t $where = $where || this.$el;\n\t return $where.find('> .details');\n\t },\n\t\n\t /** build the DOM for the details and set up behaviors on it */\n\t _renderDetails: function () {\n\t var $newDetails = $(this.templates.details(this.model.toJSON(), this));\n\t this._setUpBehaviors($newDetails);\n\t return $newDetails;\n\t },\n\t\n\t // ......................................................................... expansion/details\n\t /** Show or hide the details\n\t * @param {Boolean} expand if true, expand; if false, collapse\n\t */\n\t toggleExpanded: function (expand) {\n\t expand = expand === undefined ? !this.expanded : expand;\n\t if (expand) {\n\t this.expand();\n\t } else {\n\t this.collapse();\n\t }\n\t return this;\n\t },\n\t\n\t /** Render and show the full, detailed body of this view including extra data and controls.\n\t * note: if the model does not have detailed data, fetch that data before showing the body\n\t * @fires expanded when a body has been expanded\n\t */\n\t expand: function () {\n\t var view = this;\n\t return view._fetchModelDetails().always(function () {\n\t view._expand();\n\t });\n\t },\n\t\n\t /** Check for model details and, if none, fetch them.\n\t * @returns {jQuery.promise} the model.fetch.xhr if details are being fetched, an empty promise if not\n\t */\n\t _fetchModelDetails: function () {\n\t if (!this.model.hasDetails()) {\n\t return this.model.fetch();\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** Inner fn called when expand (public) has fetched the details */\n\t _expand: function () {\n\t var view = this,\n\t $newDetails = view._renderDetails();\n\t view.$details().replaceWith($newDetails);\n\t // needs to be set after the above or the slide will not show\n\t view.expanded = true;\n\t view.$details().slideDown(view.fxSpeed, function () {\n\t view.trigger('expanded', view);\n\t });\n\t },\n\t\n\t /** Hide the body/details of an HDA.\n\t * @fires collapsed when a body has been collapsed\n\t */\n\t collapse: function () {\n\t this.debug(this + '(ExpandableView).collapse');\n\t var view = this;\n\t view.expanded = false;\n\t this.$details().slideUp(view.fxSpeed, function () {\n\t view.trigger('collapsed', view);\n\t });\n\t }\n\t\n\t });\n\t\n\t //==============================================================================\n\t /** A view that is displayed in some larger list/grid/collection.\n\t * Inherits from Expandable, Selectable, Draggable.\n\t * The DOM contains warnings, a title bar, and a series of primary action controls.\n\t * Primary actions are meant to be easily accessible item functions (such as delete)\n\t * that are rendered in the title bar.\n\t *\n\t * Details are rendered when the user clicks the title bar or presses enter/space when\n\t * the title bar is in focus.\n\t *\n\t * Designed as a base class for history panel contents - but usable elsewhere (I hope).\n\t */\n\t var ListItemView = ExpandableView.extend(BASE_MVC.mixin(BASE_MVC.SelectableViewMixin, BASE_MVC.DraggableViewMixin, {\n\t\n\t tagName: 'div',\n\t className: 'list-item',\n\t\n\t /** Set up the base class and all mixins */\n\t initialize: function (attributes) {\n\t ExpandableView.prototype.initialize.call(this, attributes);\n\t BASE_MVC.SelectableViewMixin.initialize.call(this, attributes);\n\t BASE_MVC.DraggableViewMixin.initialize.call(this, attributes);\n\t this._setUpListeners();\n\t },\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t // hide the primary actions in the title bar when selectable and narrow\n\t this.on('selectable', function (isSelectable) {\n\t if (isSelectable) {\n\t this.$('.primary-actions').hide();\n\t } else {\n\t this.$('.primary-actions').show();\n\t }\n\t }, this);\n\t return this;\n\t },\n\t\n\t // ........................................................................ rendering\n\t /** In this override, call methods to build warnings, titlebar and primary actions */\n\t _buildNewRender: function () {\n\t var $newRender = ExpandableView.prototype._buildNewRender.call(this);\n\t $newRender.children('.warnings').replaceWith(this._renderWarnings());\n\t $newRender.children('.title-bar').replaceWith(this._renderTitleBar());\n\t $newRender.children('.primary-actions').append(this._renderPrimaryActions());\n\t $newRender.find('> .title-bar .subtitle').replaceWith(this._renderSubtitle());\n\t return $newRender;\n\t },\n\t\n\t /** In this override, render the selector controls and set up dragging before the swap */\n\t _swapNewRender: function ($newRender) {\n\t ExpandableView.prototype._swapNewRender.call(this, $newRender);\n\t if (this.selectable) {\n\t this.showSelector(0);\n\t }\n\t if (this.draggable) {\n\t this.draggableOn();\n\t }\n\t return this.$el;\n\t },\n\t\n\t /** Render any warnings the item may need to show (e.g. \"I'm deleted\") */\n\t _renderWarnings: function () {\n\t var view = this,\n\t $warnings = $('
                        '),\n\t json = view.model.toJSON();\n\t //TODO:! unordered (map)\n\t _.each(view.templates.warnings, function (templateFn) {\n\t $warnings.append($(templateFn(json, view)));\n\t });\n\t return $warnings;\n\t },\n\t\n\t /** Render the title bar (the main/exposed SUMMARY dom element) */\n\t _renderTitleBar: function () {\n\t return $(this.templates.titleBar(this.model.toJSON(), this));\n\t },\n\t\n\t /** Return an array of jQ objects containing common/easily-accessible item controls */\n\t _renderPrimaryActions: function () {\n\t // override this\n\t return [];\n\t },\n\t\n\t /** Render the title bar (the main/exposed SUMMARY dom element) */\n\t _renderSubtitle: function () {\n\t return $(this.templates.subtitle(this.model.toJSON(), this));\n\t },\n\t\n\t // ......................................................................... events\n\t /** event map */\n\t events: {\n\t // expand the body when the title is clicked or when in focus and space or enter is pressed\n\t 'click .title-bar': '_clickTitleBar',\n\t 'keydown .title-bar': '_keyDownTitleBar',\n\t 'click .selector': 'toggleSelect'\n\t },\n\t\n\t /** expand when the title bar is clicked */\n\t _clickTitleBar: function (event) {\n\t event.stopPropagation();\n\t if (event.altKey) {\n\t this.toggleSelect(event);\n\t if (!this.selectable) {\n\t this.showSelector();\n\t }\n\t } else {\n\t this.toggleExpanded();\n\t }\n\t },\n\t\n\t /** expand when the title bar is in focus and enter or space is pressed */\n\t _keyDownTitleBar: function (event) {\n\t // bail (with propagation) if keydown and not space or enter\n\t var KEYCODE_SPACE = 32,\n\t KEYCODE_RETURN = 13;\n\t if (event && event.type === 'keydown' && (event.keyCode === KEYCODE_SPACE || event.keyCode === KEYCODE_RETURN)) {\n\t this.toggleExpanded();\n\t event.stopPropagation();\n\t return false;\n\t }\n\t return true;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'ListItemView(' + modelString + ')';\n\t }\n\t }));\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t ListItemView.prototype.templates = function () {\n\t\n\t var elTemplato = BASE_MVC.wrapTemplate(['
                        ',\n\t // errors, messages, etc.\n\t '
                        ',\n\t\n\t // multi-select checkbox\n\t '
                        ', '', '
                        ',\n\t // space for title bar buttons - gen. floated to the right\n\t '
                        ', '
                        ',\n\t\n\t // expandable area for more details\n\t '
                        ', '
                        ']);\n\t\n\t var warnings = {};\n\t\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t // adding a tabindex here allows focusing the title bar and the use of keydown to expand the dataset display\n\t '
                        ',\n\t //TODO: prob. belongs in dataset-list-item\n\t '', '
                        ', '<%- element.name %>', '
                        ', '
                        ', '
                        '], 'element');\n\t\n\t var subtitleTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
                        ']);\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
                        ']);\n\t\n\t return {\n\t el: elTemplato,\n\t warnings: warnings,\n\t titleBar: titleBarTemplate,\n\t subtitle: subtitleTemplate,\n\t details: detailsTemplate\n\t };\n\t }();\n\t\n\t //==============================================================================\n\t /** A view that is displayed in some larger list/grid/collection.\n\t * *AND* can display some sub-list of it's own when expanded (e.g. dataset collections).\n\t * This list will 'foldout' when the item is expanded depending on this.foldoutStyle:\n\t * If 'foldout': will expand vertically to show the nested list\n\t * If 'drilldown': will overlay the parent list\n\t *\n\t * Inherits from ListItemView.\n\t *\n\t * _renderDetails does the work of creating this.details: a sub-view that shows the nested list\n\t */\n\t var FoldoutListItemView = ListItemView.extend({\n\t\n\t /** If 'foldout': show the sub-panel inside the expanded item\n\t * If 'drilldown': only fire events and handle by pub-sub\n\t * (allow the panel containing this item to attach it, hide itself, etc.)\n\t */\n\t foldoutStyle: 'foldout',\n\t /** Panel view class to instantiate for the sub-panel */\n\t foldoutPanelClass: null,\n\t\n\t /** override to:\n\t * add attributes foldoutStyle and foldoutPanelClass for config poly\n\t * disrespect attributes.expanded if drilldown\n\t */\n\t initialize: function (attributes) {\n\t if (this.foldoutStyle === 'drilldown') {\n\t this.expanded = false;\n\t }\n\t this.foldoutStyle = attributes.foldoutStyle || this.foldoutStyle;\n\t this.foldoutPanelClass = attributes.foldoutPanelClass || this.foldoutPanelClass;\n\t\n\t ListItemView.prototype.initialize.call(this, attributes);\n\t this.foldout = this._createFoldoutPanel();\n\t },\n\t\n\t /** in this override, attach the foldout panel when rendering details */\n\t _renderDetails: function () {\n\t if (this.foldoutStyle === 'drilldown') {\n\t return $();\n\t }\n\t var $newDetails = ListItemView.prototype._renderDetails.call(this);\n\t return this._attachFoldout(this.foldout, $newDetails);\n\t },\n\t\n\t /** In this override, handle collection expansion. */\n\t _createFoldoutPanel: function () {\n\t var model = this.model;\n\t var FoldoutClass = this._getFoldoutPanelClass(model),\n\t options = this._getFoldoutPanelOptions(model),\n\t foldout = new FoldoutClass(_.extend(options, {\n\t model: model\n\t }));\n\t return foldout;\n\t },\n\t\n\t /** Stub to return proper foldout panel class */\n\t _getFoldoutPanelClass: function () {\n\t // override\n\t return this.foldoutPanelClass;\n\t },\n\t\n\t /** Stub to return proper foldout panel options */\n\t _getFoldoutPanelOptions: function () {\n\t return {\n\t // propagate foldout style down\n\t foldoutStyle: this.foldoutStyle,\n\t fxSpeed: this.fxSpeed\n\t };\n\t },\n\t\n\t /** Render the foldout panel inside the view, hiding controls */\n\t _attachFoldout: function (foldout, $whereTo) {\n\t $whereTo = $whereTo || this.$('> .details');\n\t this.foldout = foldout.render(0);\n\t foldout.$('> .controls').hide();\n\t return $whereTo.append(foldout.$el);\n\t },\n\t\n\t /** In this override, branch on foldoutStyle to show expanded */\n\t expand: function () {\n\t var view = this;\n\t return view._fetchModelDetails().always(function () {\n\t if (view.foldoutStyle === 'foldout') {\n\t view._expand();\n\t } else if (view.foldoutStyle === 'drilldown') {\n\t view._expandByDrilldown();\n\t }\n\t });\n\t },\n\t\n\t /** For drilldown, set up close handler and fire expanded:drilldown\n\t * containing views can listen to this and handle other things\n\t * (like hiding themselves) by listening for expanded/collapsed:drilldown\n\t */\n\t _expandByDrilldown: function () {\n\t var view = this;\n\t // attachment and rendering done by listener\n\t view.listenTo(view.foldout, 'close', function () {\n\t view.trigger('collapsed:drilldown', view, view.foldout);\n\t });\n\t view.trigger('expanded:drilldown', view, view.foldout);\n\t }\n\t\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t FoldoutListItemView.prototype.templates = function () {\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate(['
                        ',\n\t // override with more info (that goes above the panel)\n\t '
                        '], 'collection');\n\t\n\t return _.extend({}, ListItemView.prototype.templates, {\n\t details: detailsTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t ExpandableView: ExpandableView,\n\t ListItemView: ListItemView,\n\t FoldoutListItemView: FoldoutListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 68 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {/**\n\t * Model, view, and controller objects for Galaxy tools and tool panel.\n\t */\n\t\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3), __webpack_require__(27), __webpack_require__(16), __webpack_require__(47)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_, util, data, ToolForm) {\n\t 'use strict';\n\t\n\t /**\n\t * Mixin for tracking model visibility.\n\t */\n\t\n\t var VisibilityMixin = {\n\t hidden: false,\n\t\n\t show: function () {\n\t this.set(\"hidden\", false);\n\t },\n\t\n\t hide: function () {\n\t this.set(\"hidden\", true);\n\t },\n\t\n\t toggle: function () {\n\t this.set(\"hidden\", !this.get(\"hidden\"));\n\t },\n\t\n\t is_visible: function () {\n\t return !this.attributes.hidden;\n\t }\n\t\n\t };\n\t\n\t /**\n\t * A tool parameter.\n\t */\n\t var ToolParameter = Backbone.Model.extend({\n\t defaults: {\n\t name: null,\n\t label: null,\n\t type: null,\n\t value: null,\n\t html: null,\n\t num_samples: 5\n\t },\n\t\n\t initialize: function (options) {\n\t this.attributes.html = unescape(this.attributes.html);\n\t },\n\t\n\t copy: function () {\n\t return new ToolParameter(this.toJSON());\n\t },\n\t\n\t set_value: function (value) {\n\t this.set('value', value || '');\n\t }\n\t });\n\t\n\t var ToolParameterCollection = Backbone.Collection.extend({\n\t model: ToolParameter\n\t });\n\t\n\t /**\n\t * A data tool parameter.\n\t */\n\t var DataToolParameter = ToolParameter.extend({});\n\t\n\t /**\n\t * An integer tool parameter.\n\t */\n\t var IntegerToolParameter = ToolParameter.extend({\n\t set_value: function (value) {\n\t this.set('value', parseInt(value, 10));\n\t },\n\t\n\t /**\n\t * Returns samples from a tool input.\n\t */\n\t get_samples: function () {\n\t return d3.scale.linear().domain([this.get('min'), this.get('max')]).ticks(this.get('num_samples'));\n\t }\n\t });\n\t\n\t var FloatToolParameter = IntegerToolParameter.extend({\n\t set_value: function (value) {\n\t this.set('value', parseFloat(value));\n\t }\n\t });\n\t\n\t /**\n\t * A select tool parameter.\n\t */\n\t var SelectToolParameter = ToolParameter.extend({\n\t /**\n\t * Returns tool options.\n\t */\n\t get_samples: function () {\n\t return _.map(this.get('options'), function (option) {\n\t return option[0];\n\t });\n\t }\n\t });\n\t\n\t // Set up dictionary of parameter types.\n\t ToolParameter.subModelTypes = {\n\t 'integer': IntegerToolParameter,\n\t 'float': FloatToolParameter,\n\t 'data': DataToolParameter,\n\t 'select': SelectToolParameter\n\t };\n\t\n\t /**\n\t * A Galaxy tool.\n\t */\n\t var Tool = Backbone.Model.extend({\n\t // Default attributes.\n\t defaults: {\n\t id: null,\n\t name: null,\n\t description: null,\n\t target: null,\n\t inputs: [],\n\t outputs: []\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/tools',\n\t\n\t initialize: function (options) {\n\t\n\t // Set parameters.\n\t this.set('inputs', new ToolParameterCollection(_.map(options.inputs, function (p) {\n\t var p_class = ToolParameter.subModelTypes[p.type] || ToolParameter;\n\t return new p_class(p);\n\t })));\n\t },\n\t\n\t /**\n\t *\n\t */\n\t toJSON: function () {\n\t var rval = Backbone.Model.prototype.toJSON.call(this);\n\t\n\t // Convert inputs to JSON manually.\n\t rval.inputs = this.get('inputs').map(function (i) {\n\t return i.toJSON();\n\t });\n\t return rval;\n\t },\n\t\n\t /**\n\t * Removes inputs of a particular type; this is useful because not all inputs can be handled by\n\t * client and server yet.\n\t */\n\t remove_inputs: function (types) {\n\t var tool = this,\n\t incompatible_inputs = tool.get('inputs').filter(function (input) {\n\t return types.indexOf(input.get('type')) !== -1;\n\t });\n\t tool.get('inputs').remove(incompatible_inputs);\n\t },\n\t\n\t /**\n\t * Returns object copy, optionally including only inputs that can be sampled.\n\t */\n\t copy: function (only_samplable_inputs) {\n\t var copy = new Tool(this.toJSON());\n\t\n\t // Return only samplable inputs if flag is set.\n\t if (only_samplable_inputs) {\n\t var valid_inputs = new Backbone.Collection();\n\t copy.get('inputs').each(function (input) {\n\t if (input.get_samples()) {\n\t valid_inputs.push(input);\n\t }\n\t });\n\t copy.set('inputs', valid_inputs);\n\t }\n\t\n\t return copy;\n\t },\n\t\n\t apply_search_results: function (results) {\n\t _.indexOf(results, this.attributes.id) !== -1 ? this.show() : this.hide();\n\t return this.is_visible();\n\t },\n\t\n\t /**\n\t * Set a tool input's value.\n\t */\n\t set_input_value: function (name, value) {\n\t this.get('inputs').find(function (input) {\n\t return input.get('name') === name;\n\t }).set('value', value);\n\t },\n\t\n\t /**\n\t * Set many input values at once.\n\t */\n\t set_input_values: function (inputs_dict) {\n\t var self = this;\n\t _.each(_.keys(inputs_dict), function (input_name) {\n\t self.set_input_value(input_name, inputs_dict[input_name]);\n\t });\n\t },\n\t\n\t /**\n\t * Run tool; returns a Deferred that resolves to the tool's output(s).\n\t */\n\t run: function () {\n\t return this._run();\n\t },\n\t\n\t /**\n\t * Rerun tool using regions and a target dataset.\n\t */\n\t rerun: function (target_dataset, regions) {\n\t return this._run({\n\t action: 'rerun',\n\t target_dataset_id: target_dataset.id,\n\t regions: regions\n\t });\n\t },\n\t\n\t /**\n\t * Returns input dict for tool's inputs.\n\t */\n\t get_inputs_dict: function () {\n\t var input_dict = {};\n\t this.get('inputs').each(function (input) {\n\t input_dict[input.get('name')] = input.get('value');\n\t });\n\t return input_dict;\n\t },\n\t\n\t /**\n\t * Run tool; returns a Deferred that resolves to the tool's output(s).\n\t * NOTE: this method is a helper method and should not be called directly.\n\t */\n\t _run: function (additional_params) {\n\t // Create payload.\n\t var payload = _.extend({\n\t tool_id: this.id,\n\t inputs: this.get_inputs_dict()\n\t }, additional_params);\n\t\n\t // Because job may require indexing datasets, use server-side\n\t // deferred to ensure that job is run. Also use deferred that\n\t // resolves to outputs from tool.\n\t var run_deferred = $.Deferred(),\n\t ss_deferred = new util.ServerStateDeferred({\n\t ajax_settings: {\n\t url: this.urlRoot,\n\t data: JSON.stringify(payload),\n\t dataType: \"json\",\n\t contentType: 'application/json',\n\t type: \"POST\"\n\t },\n\t interval: 2000,\n\t success_fn: function (response) {\n\t return response !== \"pending\";\n\t }\n\t });\n\t\n\t // Run job and resolve run_deferred to tool outputs.\n\t $.when(ss_deferred.go()).then(function (result) {\n\t run_deferred.resolve(new data.DatasetCollection(result));\n\t });\n\t return run_deferred;\n\t }\n\t });\n\t _.extend(Tool.prototype, VisibilityMixin);\n\t\n\t /**\n\t * Tool view.\n\t */\n\t var ToolView = Backbone.View.extend({});\n\t\n\t /**\n\t * Wrap collection of tools for fast access/manipulation.\n\t */\n\t var ToolCollection = Backbone.Collection.extend({\n\t model: Tool\n\t });\n\t\n\t /**\n\t * Label or section header in tool panel.\n\t */\n\t var ToolSectionLabel = Backbone.Model.extend(VisibilityMixin);\n\t\n\t /**\n\t * Section of tool panel with elements (labels and tools).\n\t */\n\t var ToolSection = Backbone.Model.extend({\n\t defaults: {\n\t elems: [],\n\t open: false\n\t },\n\t\n\t clear_search_results: function () {\n\t _.each(this.attributes.elems, function (elt) {\n\t elt.show();\n\t });\n\t\n\t this.show();\n\t this.set(\"open\", false);\n\t },\n\t\n\t apply_search_results: function (results) {\n\t var all_hidden = true,\n\t cur_label;\n\t _.each(this.attributes.elems, function (elt) {\n\t if (elt instanceof ToolSectionLabel) {\n\t cur_label = elt;\n\t cur_label.hide();\n\t } else if (elt instanceof Tool) {\n\t if (elt.apply_search_results(results)) {\n\t all_hidden = false;\n\t if (cur_label) {\n\t cur_label.show();\n\t }\n\t }\n\t }\n\t });\n\t\n\t if (all_hidden) {\n\t this.hide();\n\t } else {\n\t this.show();\n\t this.set(\"open\", true);\n\t }\n\t }\n\t });\n\t _.extend(ToolSection.prototype, VisibilityMixin);\n\t\n\t /**\n\t * Tool search that updates results when query is changed. Result value of null\n\t * indicates that query was not run; if not null, results are from search using\n\t * query.\n\t */\n\t var ToolSearch = Backbone.Model.extend({\n\t defaults: {\n\t search_hint_string: \"search tools\",\n\t min_chars_for_search: 3,\n\t clear_btn_url: \"\",\n\t visible: true,\n\t query: \"\",\n\t results: null,\n\t // ESC (27) will clear the input field and tool search filters\n\t clear_key: 27\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/tools',\n\t\n\t initialize: function () {\n\t this.on(\"change:query\", this.do_search);\n\t },\n\t\n\t /**\n\t * Do the search and update the results.\n\t */\n\t do_search: function () {\n\t var query = this.attributes.query;\n\t\n\t // If query is too short, do not search.\n\t if (query.length < this.attributes.min_chars_for_search) {\n\t this.set(\"results\", null);\n\t return;\n\t }\n\t\n\t // Do search via AJAX.\n\t var q = query;\n\t // Stop previous ajax-request\n\t if (this.timer) {\n\t clearTimeout(this.timer);\n\t }\n\t // Start a new ajax-request in X ms\n\t $(\"#search-clear-btn\").hide();\n\t $(\"#search-spinner\").show();\n\t var self = this;\n\t this.timer = setTimeout(function () {\n\t // log the search to analytics if present\n\t if (typeof ga !== 'undefined') {\n\t ga('send', 'pageview', Galaxy.root + '?q=' + q);\n\t }\n\t $.get(self.urlRoot, { q: q }, function (data) {\n\t self.set(\"results\", data);\n\t $(\"#search-spinner\").hide();\n\t $(\"#search-clear-btn\").show();\n\t }, \"json\");\n\t }, 400);\n\t },\n\t\n\t clear_search: function () {\n\t this.set(\"query\", \"\");\n\t this.set(\"results\", null);\n\t }\n\t\n\t });\n\t _.extend(ToolSearch.prototype, VisibilityMixin);\n\t\n\t /**\n\t * Tool Panel.\n\t */\n\t var ToolPanel = Backbone.Model.extend({\n\t\n\t initialize: function (options) {\n\t this.attributes.tool_search = options.tool_search;\n\t this.attributes.tool_search.on(\"change:results\", this.apply_search_results, this);\n\t this.attributes.tools = options.tools;\n\t this.attributes.layout = new Backbone.Collection(this.parse(options.layout));\n\t },\n\t\n\t /**\n\t * Parse tool panel dictionary and return collection of tool panel elements.\n\t */\n\t parse: function (response) {\n\t // Recursive function to parse tool panel elements.\n\t var self = this,\n\t\n\t // Helper to recursively parse tool panel.\n\t parse_elt = function (elt_dict) {\n\t var type = elt_dict.model_class;\n\t // There are many types of tools; for now, anything that ends in 'Tool'\n\t // is treated as a generic tool.\n\t if (type.indexOf('Tool') === type.length - 4) {\n\t return self.attributes.tools.get(elt_dict.id);\n\t } else if (type === 'ToolSection') {\n\t // Parse elements.\n\t var elems = _.map(elt_dict.elems, parse_elt);\n\t elt_dict.elems = elems;\n\t return new ToolSection(elt_dict);\n\t } else if (type === 'ToolSectionLabel') {\n\t return new ToolSectionLabel(elt_dict);\n\t }\n\t };\n\t\n\t return _.map(response, parse_elt);\n\t },\n\t\n\t clear_search_results: function () {\n\t this.get('layout').each(function (panel_elt) {\n\t if (panel_elt instanceof ToolSection) {\n\t panel_elt.clear_search_results();\n\t } else {\n\t // Label or tool, so just show.\n\t panel_elt.show();\n\t }\n\t });\n\t },\n\t\n\t apply_search_results: function () {\n\t var results = this.get('tool_search').get('results');\n\t if (results === null) {\n\t this.clear_search_results();\n\t return;\n\t }\n\t\n\t var cur_label = null;\n\t this.get('layout').each(function (panel_elt) {\n\t if (panel_elt instanceof ToolSectionLabel) {\n\t cur_label = panel_elt;\n\t cur_label.hide();\n\t } else if (panel_elt instanceof Tool) {\n\t if (panel_elt.apply_search_results(results)) {\n\t if (cur_label) {\n\t cur_label.show();\n\t }\n\t }\n\t } else {\n\t // Starting new section, so clear current label.\n\t cur_label = null;\n\t panel_elt.apply_search_results(results);\n\t }\n\t });\n\t }\n\t });\n\t\n\t /**\n\t * View classes for Galaxy tools and tool panel.\n\t *\n\t * Views use the templates defined below for rendering. Views update as needed\n\t * based on (a) model/collection events and (b) user interactions; in this sense,\n\t * they are controllers are well and the HTML is the real view in the MVC architecture.\n\t */\n\t\n\t /**\n\t * Base view that handles visibility based on model's hidden attribute.\n\t */\n\t var BaseView = Backbone.View.extend({\n\t initialize: function () {\n\t this.model.on(\"change:hidden\", this.update_visible, this);\n\t this.update_visible();\n\t },\n\t update_visible: function () {\n\t this.model.attributes.hidden ? this.$el.hide() : this.$el.show();\n\t }\n\t });\n\t\n\t /**\n\t * Link to a tool.\n\t */\n\t var ToolLinkView = BaseView.extend({\n\t tagName: 'div',\n\t\n\t render: function () {\n\t // create element\n\t var $link = $('
                        ');\n\t $link.append(templates.tool_link(this.model.toJSON()));\n\t\n\t var formStyle = this.model.get('form_style', null);\n\t // open upload dialog for upload tool\n\t if (this.model.id === 'upload1') {\n\t $link.find('a').on('click', function (e) {\n\t e.preventDefault();\n\t Galaxy.upload.show();\n\t });\n\t } else if (formStyle === 'regular') {\n\t // regular tools\n\t var self = this;\n\t $link.find('a').on('click', function (e) {\n\t e.preventDefault();\n\t Galaxy.router.push('/', { tool_id: self.model.id, version: self.model.get('version') });\n\t });\n\t }\n\t\n\t // add element\n\t this.$el.append($link);\n\t return this;\n\t }\n\t });\n\t\n\t /**\n\t * Panel label/section header.\n\t */\n\t var ToolSectionLabelView = BaseView.extend({\n\t tagName: 'div',\n\t className: 'toolPanelLabel',\n\t\n\t render: function () {\n\t this.$el.append($(\"\").text(this.model.attributes.text));\n\t return this;\n\t }\n\t });\n\t\n\t /**\n\t * Panel section.\n\t */\n\t var ToolSectionView = BaseView.extend({\n\t tagName: 'div',\n\t className: 'toolSectionWrapper',\n\t\n\t initialize: function () {\n\t BaseView.prototype.initialize.call(this);\n\t this.model.on(\"change:open\", this.update_open, this);\n\t },\n\t\n\t render: function () {\n\t // Build using template.\n\t this.$el.append(templates.panel_section(this.model.toJSON()));\n\t\n\t // Add tools to section.\n\t var section_body = this.$el.find(\".toolSectionBody\");\n\t _.each(this.model.attributes.elems, function (elt) {\n\t if (elt instanceof Tool) {\n\t var tool_view = new ToolLinkView({ model: elt, className: \"toolTitle\" });\n\t tool_view.render();\n\t section_body.append(tool_view.$el);\n\t } else if (elt instanceof ToolSectionLabel) {\n\t var label_view = new ToolSectionLabelView({ model: elt });\n\t label_view.render();\n\t section_body.append(label_view.$el);\n\t } else {\n\t // TODO: handle nested section bodies?\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t events: {\n\t 'click .toolSectionTitle > a': 'toggle'\n\t },\n\t\n\t /**\n\t * Toggle visibility of tool section.\n\t */\n\t toggle: function () {\n\t this.model.set(\"open\", !this.model.attributes.open);\n\t },\n\t\n\t /**\n\t * Update whether section is open or close.\n\t */\n\t update_open: function () {\n\t this.model.attributes.open ? this.$el.children(\".toolSectionBody\").slideDown(\"fast\") : this.$el.children(\".toolSectionBody\").slideUp(\"fast\");\n\t }\n\t });\n\t\n\t var ToolSearchView = Backbone.View.extend({\n\t tagName: 'div',\n\t id: 'tool-search',\n\t className: 'bar',\n\t\n\t events: {\n\t 'click': 'focus_and_select',\n\t 'keyup :input': 'query_changed',\n\t 'change :input': 'query_changed',\n\t 'click #search-clear-btn': 'clear'\n\t },\n\t\n\t render: function () {\n\t this.$el.append(templates.tool_search(this.model.toJSON()));\n\t if (!this.model.is_visible()) {\n\t this.$el.hide();\n\t }\n\t\n\t // Adjust top for issue 2907 depending on whether the messagebox is visible.\n\t if ($(\"#messagebox\").is(\":visible\")) {\n\t this.$el.css(\"top\", \"95px\");\n\t }\n\t\n\t this.$el.find('[title]').tooltip();\n\t return this;\n\t },\n\t\n\t focus_and_select: function () {\n\t this.$el.find(\":input\").focus().select();\n\t },\n\t\n\t clear: function () {\n\t this.model.clear_search();\n\t this.$el.find(\":input\").val('');\n\t this.focus_and_select();\n\t return false;\n\t },\n\t\n\t query_changed: function (evData) {\n\t // check for the 'clear key' (ESC) first\n\t if (this.model.attributes.clear_key && this.model.attributes.clear_key === evData.which) {\n\t this.clear();\n\t return false;\n\t }\n\t this.model.set(\"query\", this.$el.find(\":input\").val());\n\t }\n\t });\n\t\n\t /**\n\t * Tool panel view. Events triggered include:\n\t * tool_link_click(click event, tool_model)\n\t */\n\t var ToolPanelView = Backbone.View.extend({\n\t tagName: 'div',\n\t className: 'toolMenu',\n\t\n\t /**\n\t * Set up view.\n\t */\n\t initialize: function () {\n\t this.model.get('tool_search').on(\"change:results\", this.handle_search_results, this);\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t\n\t // Render search.\n\t var search_view = new ToolSearchView({ model: this.model.get('tool_search') });\n\t search_view.render();\n\t self.$el.append(search_view.$el);\n\t\n\t // Render panel.\n\t this.model.get('layout').each(function (panel_elt) {\n\t if (panel_elt instanceof ToolSection) {\n\t var section_title_view = new ToolSectionView({ model: panel_elt });\n\t section_title_view.render();\n\t self.$el.append(section_title_view.$el);\n\t } else if (panel_elt instanceof Tool) {\n\t var tool_view = new ToolLinkView({ model: panel_elt, className: \"toolTitleNoSection\" });\n\t tool_view.render();\n\t self.$el.append(tool_view.$el);\n\t } else if (panel_elt instanceof ToolSectionLabel) {\n\t var label_view = new ToolSectionLabelView({ model: panel_elt });\n\t label_view.render();\n\t self.$el.append(label_view.$el);\n\t }\n\t });\n\t\n\t // Setup tool link click eventing.\n\t self.$el.find(\"a.tool-link\").click(function (e) {\n\t // Tool id is always the first class.\n\t var tool_id = $(this).attr('class').split(/\\s+/)[0],\n\t tool = self.model.get('tools').get(tool_id);\n\t\n\t self.trigger(\"tool_link_click\", e, tool);\n\t });\n\t\n\t return this;\n\t },\n\t\n\t handle_search_results: function () {\n\t var results = this.model.get('tool_search').get('results');\n\t if (results && results.length === 0) {\n\t $(\"#search-no-results\").show();\n\t } else {\n\t $(\"#search-no-results\").hide();\n\t }\n\t }\n\t });\n\t\n\t /**\n\t * View for working with a tool: setting parameters and inputs and executing the tool.\n\t */\n\t var ToolFormView = Backbone.View.extend({\n\t className: 'toolForm',\n\t\n\t render: function () {\n\t this.$el.children().remove();\n\t this.$el.append(templates.tool_form(this.model.toJSON()));\n\t }\n\t });\n\t\n\t /**\n\t * Integrated tool menu + tool execution.\n\t */\n\t var IntegratedToolMenuAndView = Backbone.View.extend({\n\t className: 'toolMenuAndView',\n\t\n\t initialize: function () {\n\t this.tool_panel_view = new ToolPanelView({ collection: this.collection });\n\t this.tool_form_view = new ToolFormView();\n\t },\n\t\n\t render: function () {\n\t // Render and append tool panel.\n\t this.tool_panel_view.render();\n\t this.tool_panel_view.$el.css(\"float\", \"left\");\n\t this.$el.append(this.tool_panel_view.$el);\n\t\n\t // Append tool form view.\n\t this.tool_form_view.$el.hide();\n\t this.$el.append(this.tool_form_view.$el);\n\t\n\t // On tool link click, show tool.\n\t var self = this;\n\t this.tool_panel_view.on(\"tool_link_click\", function (e, tool) {\n\t // Prevents click from activating link:\n\t e.preventDefault();\n\t // Show tool that was clicked on:\n\t self.show_tool(tool);\n\t });\n\t },\n\t\n\t /**\n\t * Fetch and display tool.\n\t */\n\t show_tool: function (tool) {\n\t var self = this;\n\t tool.fetch().done(function () {\n\t self.tool_form_view.model = tool;\n\t self.tool_form_view.render();\n\t self.tool_form_view.$el.show();\n\t $('#left').width(\"650px\");\n\t });\n\t }\n\t });\n\t\n\t // TODO: move into relevant views\n\t var templates = {\n\t // the search bar at the top of the tool panel\n\t tool_search: _.template(['\" autocomplete=\"off\" type=\"text\" />', ' ',\n\t //TODO: replace with icon\n\t ''].join('')),\n\t\n\t // the category level container in the tool panel (e.g. 'Get Data', 'Text Manipulation')\n\t panel_section: _.template(['
                        \">', '<%- name %>', '
                        ', '
                        \" class=\"toolSectionBody\" style=\"display: none;\">', '
                        ', '
                        '].join('')),\n\t\n\t // a single tool's link in the tool panel; will load the tool form in the center panel\n\t tool_link: _.template([' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">', '', '<% _.each( labels, function( label ){ %>', '\">', '<%- label %>', '', '<% }); %>', '', '', '<%- name %>', '', ' <%- description %>', ''].join('')),\n\t\n\t // the tool form for entering tool parameters, viewing help and executing the tool\n\t // loaded when a tool link is clicked in the tool panel\n\t tool_form: _.template(['
                        <%- tool.name %> (version <%- tool.version %>)
                        ', '
                        ', '<% _.each( tool.inputs, function( input ){ %>', '
                        ', '', '
                        ', '<%= input.html %>', '
                        ', '
                        ', '<%- input.help %>', '
                        ', '
                        ', '
                        ', '<% }); %>', '
                        ', '
                        ', '', '
                        ', '
                        ', '
                        <% tool.help %>
                        ', '
                        '].join(''), { variable: 'tool' })\n\t };\n\t\n\t // Exports\n\t return {\n\t ToolParameter: ToolParameter,\n\t IntegerToolParameter: IntegerToolParameter,\n\t SelectToolParameter: SelectToolParameter,\n\t Tool: Tool,\n\t ToolCollection: ToolCollection,\n\t ToolSearch: ToolSearch,\n\t ToolPanel: ToolPanel,\n\t ToolPanelView: ToolPanelView,\n\t ToolFormView: ToolFormView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 69 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This renders the content of the ftp popup **/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils) {\n\t return Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.options = Utils.merge(options, {\n\t class_add: 'upload-icon-button fa fa-square-o',\n\t class_remove: 'upload-icon-button fa fa-check-square-o',\n\t class_partial: 'upload-icon-button fa fa-minus-square-o',\n\t collection: null,\n\t onchange: function () {},\n\t onadd: function () {},\n\t onremove: function () {}\n\t });\n\t this.collection = this.options.collection;\n\t this.setElement(this._template());\n\t this.rows = [];\n\t Utils.get({\n\t url: Galaxy.root + 'api/remote_files',\n\t success: function (ftp_files) {\n\t self._fill(ftp_files);\n\t },\n\t error: function () {\n\t self._fill();\n\t }\n\t });\n\t },\n\t\n\t /** Fill table with ftp entries */\n\t _fill: function (ftp_files) {\n\t if (ftp_files && ftp_files.length > 0) {\n\t this.$('.upload-ftp-content').html($(this._templateTable()));\n\t var size = 0;\n\t for (var index in ftp_files) {\n\t this.rows.push(this._add(ftp_files[index]));\n\t size += ftp_files[index].size;\n\t }\n\t this.$('.upload-ftp-number').html(ftp_files.length + ' files');\n\t this.$('.upload-ftp-disk').html(Utils.bytesToString(size, true));\n\t if (this.collection) {\n\t var self = this;\n\t this.$('._has_collection').show();\n\t this.$select_all = this.$('.upload-selectall').addClass(this.options.class_add);\n\t this.$select_all.on('click', function () {\n\t var add = self.$select_all.hasClass(self.options.class_add);\n\t for (var index in ftp_files) {\n\t var ftp_file = ftp_files[index];\n\t var model_index = self._find(ftp_file);\n\t if (!model_index && add || model_index && !add) {\n\t self.rows[index].trigger('click');\n\t }\n\t }\n\t });\n\t this._refresh();\n\t }\n\t } else {\n\t this.$('.upload-ftp-content').html($(this._templateInfo()));\n\t }\n\t this.$('.upload-ftp-wait').hide();\n\t },\n\t\n\t /** Add file to table */\n\t _add: function (ftp_file) {\n\t var self = this;\n\t var $it = $(this._templateRow(ftp_file));\n\t var $icon = $it.find('.icon');\n\t this.$('tbody').append($it);\n\t if (this.collection) {\n\t $icon.addClass(this._find(ftp_file) ? this.options.class_remove : this.options.class_add);\n\t $it.on('click', function () {\n\t var model_index = self._find(ftp_file);\n\t $icon.removeClass();\n\t if (!model_index) {\n\t self.options.onadd(ftp_file);\n\t $icon.addClass(self.options.class_remove);\n\t } else {\n\t self.options.onremove(model_index);\n\t $icon.addClass(self.options.class_add);\n\t }\n\t self._refresh();\n\t });\n\t } else {\n\t $it.on('click', function () {\n\t self.options.onchange(ftp_file);\n\t });\n\t }\n\t return $it;\n\t },\n\t\n\t /** Refresh select all button state */\n\t _refresh: function () {\n\t var filtered = this.collection.where({ file_mode: 'ftp', enabled: true });\n\t this.$select_all.removeClass();\n\t if (filtered.length == 0) {\n\t this.$select_all.addClass(this.options.class_add);\n\t } else {\n\t this.$select_all.addClass(filtered.length == this.rows.length ? this.options.class_remove : this.options.class_partial);\n\t }\n\t },\n\t\n\t /** Get model index */\n\t _find: function (ftp_file) {\n\t var item = this.collection.findWhere({\n\t file_path: ftp_file.path,\n\t file_mode: 'ftp',\n\t enabled: true\n\t });\n\t return item && item.get('id');\n\t },\n\t\n\t /** Template of row */\n\t _templateRow: function (options) {\n\t return '
                        ' + _.escape(options.path) + '' + Utils.bytesToString(options.size) + '' + options.ctime + '
                        ' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
                        NameSizeCreated
                        ';\n\t },\n\t\n\t /** Template of info message */\n\t _templateInfo: function () {\n\t return '
                        ' + 'Your FTP directory does not contain any files.' + '
                        ';\n\t },\n\t\n\t /** Template of main view */\n\t _template: function () {\n\t return '
                        ' + '
                        ' + '
                        This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at ' + this.options.ftp_upload_site + ' using your Galaxy credentials (email address and password).
                        ' + '
                        ' + '
                        ';\n\t }\n\t });\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 70 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This renders the content of the settings popup, allowing users to specify flags i.e. for space-to-tab conversion **/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils) {\n\t return Backbone.View.extend({\n\t options: {\n\t class_check: 'fa-check-square-o',\n\t class_uncheck: 'fa-square-o',\n\t parameters: [{\n\t id: 'space_to_tab',\n\t title: 'Convert spaces to tabs'\n\t }, {\n\t id: 'to_posix_lines',\n\t title: 'Use POSIX standard'\n\t }]\n\t },\n\t\n\t initialize: function (options) {\n\t var self = this;\n\t this.model = options.model;\n\t this.setElement($('
                        ').addClass('upload-settings'));\n\t this.$el.append($('
                        ').addClass('upload-settings-cover'));\n\t this.$el.append($('').addClass('upload-settings-table ui-table-striped').append(''));\n\t this.$cover = this.$('.upload-settings-cover');\n\t this.$table = this.$('.upload-settings-table > tbody');\n\t this.listenTo(this.model, 'change', this.render, this);\n\t this.model.trigger('change');\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t this.$table.empty();\n\t _.each(this.options.parameters, function (parameter) {\n\t var $checkbox = $('
                        ').addClass('upload-' + parameter.id + ' upload-icon-button fa').addClass(self.model.get(parameter.id) && self.options.class_check || self.options.class_uncheck).on('click', function () {\n\t self.model.get('enabled') && self.model.set(parameter.id, !self.model.get(parameter.id));\n\t });\n\t self.$table.append($('
                        ').append($('' + '' + '' + '');\n\t });\n\t $tmpl.append($table);\n\t } else {\n\t $tmpl.append('No ' + this.model.get('plural').toLowerCase() + ' have been shared with you.');\n\t }\n\t return $tmpl;\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 129 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(84), __webpack_require__(87), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET_LI_EDIT, HDA_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DATASET_LI_EDIT.DatasetListItemEdit;\n\t /** @class Editing view for HistoryDatasetAssociation.\n\t */\n\t var HDAListItemEdit = _super.extend(\n\t /** @lends HDAListItemEdit.prototype */{\n\t\n\t className: _super.prototype.className + \" history-content\",\n\t\n\t /** In this override, only get details if in the ready state, get rerunnable if in other states.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t\n\t // special case the need for the rerunnable and creating_job attributes\n\t // needed for rendering re-run button on queued, running datasets\n\t } else if (!view.model.has('rerunnable')) {\n\t return view.model.fetch({ silent: true, data: {\n\t // only fetch rerunnable and creating_job to keep overhead down\n\t keys: ['rerunnable', 'creating_job'].join(',')\n\t } });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .unhide-link': function (ev) {\n\t this.model.unhide();return false;\n\t }\n\t }),\n\t\n\t /** string rep */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDAListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t HDAListItemEdit.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t hidden: BASE_MVC.wrapTemplate(['<% if( !dataset.visible ){ %>',\n\t // add a link to unhide a dataset\n\t '
                        ', _l('This dataset has been hidden'), '
                        ', _l('Unhide it'), '', '
                        ', '<% } %>'], 'dataset')\n\t });\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t //NOTE: *steal* the HDAListItemView titleBar\n\t titleBar: HDA_LI.HDAListItemView.prototype.templates.titleBar,\n\t warnings: warnings\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HDAListItemEdit: HDAListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 130 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(89), __webpack_require__(123), __webpack_require__(25), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HDCA_LI, DC_VIEW_EDIT, faIconButton, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = HDCA_LI.HDCAListItemView;\n\t /** @class Editing view for HistoryDatasetCollectionAssociation.\n\t */\n\t var HDCAListItemEdit = _super.extend(\n\t /** @lends HDCAListItemEdit.prototype */{\n\t\n\t /** logger used to record this.log messages, commonly set to console */\n\t //logger : console,\n\t\n\t /** Override to return editable versions of the collection panels */\n\t _getFoldoutPanelClass: function () {\n\t switch (this.model.get('collection_type')) {\n\t case 'list':\n\t return DC_VIEW_EDIT.ListCollectionViewEdit;\n\t case 'paired':\n\t return DC_VIEW_EDIT.PairCollectionViewEdit;\n\t case 'list:paired':\n\t return DC_VIEW_EDIT.ListOfPairsCollectionViewEdit;\n\t case 'list:list':\n\t return DC_VIEW_EDIT.ListOfListsCollectionViewEdit;\n\t }\n\t throw new TypeError('Uknown collection_type: ' + this.model.get('collection_type'));\n\t },\n\t\n\t // ......................................................................... delete\n\t /** In this override, add the delete button. */\n\t _renderPrimaryActions: function () {\n\t this.log(this + '._renderPrimaryActions');\n\t // render the display, edit attr and delete icon-buttons\n\t return _super.prototype._renderPrimaryActions.call(this).concat([this._renderDeleteButton()]);\n\t },\n\t\n\t /** Render icon-button to delete this collection. */\n\t _renderDeleteButton: function () {\n\t var self = this,\n\t deleted = this.model.get('deleted');\n\t return faIconButton({\n\t title: deleted ? _l('Dataset collection is already deleted') : _l('Delete'),\n\t classes: 'delete-btn',\n\t faIcon: 'fa-times',\n\t disabled: deleted,\n\t onclick: function () {\n\t // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n\t self.$el.find('.icon-btn.delete-btn').trigger('mouseout');\n\t self.model['delete']();\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... misc\n\t /** string rep */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDCAListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HDCAListItemEdit: HDCAListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ },\n/* 131 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This class renders the grid list. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(12), __webpack_require__(65), __webpack_require__(86)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, GridView, HistoryModel, historyCopyDialog) {\n\t\n\t var View = Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.setElement($('
                        '));\n\t this.model = new Backbone.Model();\n\t Utils.get({\n\t url: Galaxy.root + 'history/' + options.action_id,\n\t success: function (response) {\n\t response['dict_format'] = true;\n\t _.each(response['operations'], function (operation) {\n\t if (operation.label == 'Copy') {\n\t operation.onclick = function (id) {\n\t self._showCopyDialog(id);\n\t };\n\t }\n\t });\n\t self.model.set(response);\n\t self.render();\n\t }\n\t });\n\t },\n\t\n\t render: function () {\n\t var grid = new GridView(this.model.attributes);\n\t this.$el.empty().append(grid.$el);\n\t },\n\t\n\t _showCopyDialog: function (id) {\n\t var history = new HistoryModel.History({ id: id });\n\t history.fetch().fail(function () {\n\t alert('History could not be fetched. Please contact an administrator');\n\t }).done(function () {\n\t historyCopyDialog(history, {}).done(function () {\n\t if (window.parent && window.parent.Galaxy && window.parent.Galaxy.currHistoryPanel) {\n\t window.parent.Galaxy.currHistoryPanel.loadCurrentHistory();\n\t }\n\t window.location.reload(true);\n\t });\n\t });\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 132 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(65), __webpack_require__(133), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HISTORY_MODEL, HISTORY_VIEW_EDIT, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t // ============================================================================\n\t /** session storage for history panel preferences (and to maintain state)\n\t */\n\t\n\t var HistoryViewPrefs = BASE_MVC.SessionStorageModel.extend(\n\t /** @lends HistoryViewPrefs.prototype */{\n\t defaults: {\n\t /** should the tags editor be shown or hidden initially? */\n\t tagsEditorShown: false,\n\t /** should the annotation editor be shown or hidden initially? */\n\t annotationEditorShown: false,\n\t ///** what is the currently focused content (dataset or collection) in the current history?\n\t // * (the history panel will highlight and scroll to the focused content view)\n\t // */\n\t //focusedContentId : null\n\t /** Current scroll position */\n\t scrollPosition: 0\n\t },\n\t toString: function () {\n\t return 'HistoryViewPrefs(' + JSON.stringify(this.toJSON()) + ')';\n\t }\n\t });\n\t\n\t /** key string to store panel prefs (made accessible on class so you can access sessionStorage directly) */\n\t HistoryViewPrefs.storageKey = function storageKey() {\n\t return 'history-panel';\n\t };\n\t\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t var _super = HISTORY_VIEW_EDIT.HistoryViewEdit;\n\t // used in root/index.mako\n\t /** @class View/Controller for the user's current history model as used in the history\n\t * panel (current right hand panel) of the analysis page.\n\t *\n\t * The only history panel that:\n\t * will poll for updates.\n\t * displays datasets in reverse hid order.\n\t */\n\t var CurrentHistoryView = _super.extend( /** @lends CurrentHistoryView.prototype */{\n\t\n\t className: _super.prototype.className + ' current-history-panel',\n\t\n\t /** override to use drilldown (and not foldout) for how collections are displayed */\n\t HDCAViewClass: _super.prototype.HDCAViewClass.extend({\n\t foldoutStyle: 'drilldown'\n\t }),\n\t\n\t emptyMsg: [_l('This history is empty'), '. ', _l('You can '), '', _l('load your own data'), '', _l(' or '), '', _l('get data from an external source'), ''].join(''),\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events */\n\t initialize: function (attributes) {\n\t attributes = attributes || {};\n\t\n\t // ---- persistent preferences\n\t /** maintain state / preferences over page loads */\n\t this.preferences = new HistoryViewPrefs(_.extend({\n\t id: HistoryViewPrefs.storageKey()\n\t }, _.pick(attributes, _.keys(HistoryViewPrefs.prototype.defaults))));\n\t\n\t _super.prototype.initialize.call(this, attributes);\n\t\n\t /** sub-views that will overlay this panel (collections) */\n\t this.panelStack = [];\n\t\n\t /** id of currently focused content */\n\t this.currentContentId = attributes.currentContentId || null;\n\t //NOTE: purposely not sent to localstorage since panel recreation roughly lines up with a reset of this value\n\t },\n\t\n\t /** Override to cache the current scroll position with a listener */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t\n\t var panel = this;\n\t // reset scroll position when there's a new history\n\t this.on('new-model', function () {\n\t panel.preferences.set('scrollPosition', 0);\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ loading history/item models\n\t // TODO: next three more appropriate moved to the app level\n\t /** (re-)loads the user's current history & contents w/ details */\n\t loadCurrentHistory: function () {\n\t return this.loadHistory(null, { url: Galaxy.root + 'history/current_history_json' });\n\t },\n\t\n\t /** loads a history & contents w/ details and makes them the current history */\n\t switchToHistory: function (historyId, attributes) {\n\t if (Galaxy.user.isAnonymous()) {\n\t this.trigger('error', _l('You must be logged in to switch histories'), _l('Anonymous user'));\n\t return $.when();\n\t }\n\t return this.loadHistory(historyId, { url: Galaxy.root + 'history/set_as_current?id=' + historyId });\n\t },\n\t\n\t /** creates a new history on the server and sets it as the user's current history */\n\t createNewHistory: function (attributes) {\n\t if (Galaxy.user.isAnonymous()) {\n\t this.trigger('error', _l('You must be logged in to create histories'), _l('Anonymous user'));\n\t return $.when();\n\t }\n\t return this.loadHistory(null, { url: Galaxy.root + 'history/create_new_current' });\n\t },\n\t\n\t /** release/free/shutdown old models and set up panel for new models */\n\t setModel: function (model, attributes, render) {\n\t _super.prototype.setModel.call(this, model, attributes, render);\n\t if (this.model && this.model.id) {\n\t this.log('checking for updates');\n\t this.model.checkForUpdates();\n\t }\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ history/content event listening\n\t /** listening for history events */\n\t _setUpModelListeners: function () {\n\t _super.prototype._setUpModelListeners.call(this);\n\t // re-broadcast any model change events so that listeners don't have to re-bind to each history\n\t return this.listenTo(this.model, {\n\t 'change:nice_size change:size': function () {\n\t this.trigger('history-size-change', this, this.model, arguments);\n\t },\n\t 'change:id': function () {\n\t this.once('loading-done', function () {\n\t this.model.checkForUpdates();\n\t });\n\t }\n\t });\n\t },\n\t\n\t /** listening for collection events */\n\t _setUpCollectionListeners: function () {\n\t _super.prototype._setUpCollectionListeners.call(this);\n\t // if a hidden item is created (gen. by a workflow), moves thru the updater to the ready state,\n\t // then: remove it from the collection if the panel is set to NOT show hidden datasets\n\t this.listenTo(this.collection, 'state:ready', function (model, newState, oldState) {\n\t if (!model.get('visible') && !this.collection.storage.includeHidden()) {\n\t this.removeItemView(model);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel rendering\n\t /** override to add a handler to capture the scroll position when the parent scrolls */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t // console.log( '_setUpBehaviors', this.$scrollContainer( $where ).get(0), this.$list( $where ) );\n\t // we need to call this in _setUpBehaviors which is called after render since the $el\n\t // may not be attached to $el.parent and $scrollContainer() may not work\n\t var panel = this;\n\t _super.prototype._setUpBehaviors.call(panel, $where);\n\t\n\t // cache the handler to remove and re-add so we don't pile up the handlers\n\t if (!this._debouncedScrollCaptureHandler) {\n\t this._debouncedScrollCaptureHandler = _.debounce(function scrollCapture() {\n\t // cache the scroll position (only if visible)\n\t if (panel.$el.is(':visible')) {\n\t panel.preferences.set('scrollPosition', $(this).scrollTop());\n\t }\n\t }, 40);\n\t }\n\t\n\t panel.$scrollContainer($where).off('scroll', this._debouncedScrollCaptureHandler).on('scroll', this._debouncedScrollCaptureHandler);\n\t return panel;\n\t },\n\t\n\t /** In this override, handle null models and move the search input to the top */\n\t _buildNewRender: function () {\n\t if (!this.model) {\n\t return $();\n\t }\n\t var $newRender = _super.prototype._buildNewRender.call(this);\n\t $newRender.find('.search').prependTo($newRender.find('> .controls'));\n\t this._renderQuotaMessage($newRender);\n\t return $newRender;\n\t },\n\t\n\t /** render the message displayed when a user is over quota and can't run jobs */\n\t _renderQuotaMessage: function ($whereTo) {\n\t $whereTo = $whereTo || this.$el;\n\t return $(this.templates.quotaMsg({}, this)).prependTo($whereTo.find('.messages'));\n\t },\n\t\n\t /** In this override, get and set current panel preferences when editor is used */\n\t _renderTags: function ($where) {\n\t var panel = this;\n\t // render tags and show/hide based on preferences\n\t _super.prototype._renderTags.call(panel, $where);\n\t if (panel.preferences.get('tagsEditorShown')) {\n\t panel.tagsEditor.toggle(true);\n\t }\n\t // store preference when shown or hidden\n\t panel.listenTo(panel.tagsEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden', function (tagsEditor) {\n\t panel.preferences.set('tagsEditorShown', tagsEditor.hidden);\n\t });\n\t },\n\t\n\t /** In this override, get and set current panel preferences when editor is used */\n\t _renderAnnotation: function ($where) {\n\t var panel = this;\n\t // render annotation and show/hide based on preferences\n\t _super.prototype._renderAnnotation.call(panel, $where);\n\t if (panel.preferences.get('annotationEditorShown')) {\n\t panel.annotationEditor.toggle(true);\n\t }\n\t // store preference when shown or hidden\n\t panel.listenTo(panel.annotationEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden', function (annotationEditor) {\n\t panel.preferences.set('annotationEditorShown', annotationEditor.hidden);\n\t });\n\t },\n\t\n\t /** Override to scroll to cached position (in prefs) after swapping */\n\t _swapNewRender: function ($newRender) {\n\t _super.prototype._swapNewRender.call(this, $newRender);\n\t var panel = this;\n\t _.delay(function () {\n\t var pos = panel.preferences.get('scrollPosition');\n\t if (pos) {\n\t panel.scrollTo(pos, 0);\n\t }\n\t }, 10);\n\t //TODO: is this enough of a delay on larger histories?\n\t\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** Override to add the current-content highlight class to currentContentId's view */\n\t _attachItems: function ($whereTo) {\n\t _super.prototype._attachItems.call(this, $whereTo);\n\t var panel = this;\n\t if (panel.currentContentId) {\n\t panel._setCurrentContentById(panel.currentContentId);\n\t }\n\t return this;\n\t },\n\t\n\t /** Override to remove any drill down panels */\n\t addItemView: function (model, collection, options) {\n\t var view = _super.prototype.addItemView.call(this, model, collection, options);\n\t if (!view) {\n\t return view;\n\t }\n\t if (this.panelStack.length) {\n\t return this._collapseDrilldownPanel();\n\t }\n\t return view;\n\t },\n\t\n\t // ------------------------------------------------------------------------ collection sub-views\n\t /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t _super.prototype._setUpItemViewListeners.call(panel, view);\n\t // use pub-sub to: handle drilldown expansion and collapse\n\t return panel.listenTo(view, {\n\t 'expanded:drilldown': function (v, drilldown) {\n\t this._expandDrilldownPanel(drilldown);\n\t },\n\t 'collapsed:drilldown': function (v, drilldown) {\n\t this._collapseDrilldownPanel(drilldown);\n\t }\n\t });\n\t },\n\t\n\t /** display 'current content': add a visible highlight and store the id of a content item */\n\t setCurrentContent: function (view) {\n\t this.$('.history-content.current-content').removeClass('current-content');\n\t if (view) {\n\t view.$el.addClass('current-content');\n\t this.currentContentId = view.model.id;\n\t } else {\n\t this.currentContentId = null;\n\t }\n\t },\n\t\n\t /** find the view with the id and then call setCurrentContent on it */\n\t _setCurrentContentById: function (id) {\n\t var view = this.viewFromModelId(id) || null;\n\t this.setCurrentContent(view);\n\t },\n\t\n\t /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n\t _expandDrilldownPanel: function (drilldown) {\n\t this.panelStack.push(drilldown);\n\t // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n\t this.$controls().add(this.$list()).hide();\n\t drilldown.parentName = this.model.get('name');\n\t drilldown.delegateEvents().render().$el.appendTo(this.$el);\n\t },\n\t\n\t /** Handle drilldown close by freeing the panel and re-rendering this panel */\n\t _collapseDrilldownPanel: function (drilldown) {\n\t this.panelStack.pop();\n\t //TODO: MEM: free the panel\n\t this.$controls().add(this.$list()).show();\n\t },\n\t\n\t // ........................................................................ panel events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t // the two links in the empty message\n\t 'click .uploader-link': function (ev) {\n\t Galaxy.upload.show(ev);\n\t },\n\t 'click .get-data-link': function (ev) {\n\t var $toolMenu = $('.toolMenuContainer');\n\t $toolMenu.parent().scrollTop(0);\n\t $toolMenu.find('span:contains(\"Get Data\")').click();\n\t }\n\t }),\n\t\n\t // ........................................................................ external objects/MVC\n\t listenToGalaxy: function (galaxy) {\n\t this.listenTo(galaxy, {\n\t // when the galaxy_main iframe is loaded with a new page,\n\t // compare the url to the following list and if there's a match\n\t // pull the id from url and indicate in the history view that\n\t // the dataset with that id is the 'current'ly active dataset\n\t 'center-frame:load': function (data) {\n\t var pathToMatch = data.fullpath;\n\t var hdaId = null;\n\t var useToURLRegexMap = {\n\t 'display': /datasets\\/([a-f0-9]+)\\/display/,\n\t 'edit': /datasets\\/([a-f0-9]+)\\/edit/,\n\t 'report_error': /dataset\\/errors\\?id=([a-f0-9]+)/,\n\t 'rerun': /tool_runner\\/rerun\\?id=([a-f0-9]+)/,\n\t 'show_params': /datasets\\/([a-f0-9]+)\\/show_params/\n\t };\n\t _.find(useToURLRegexMap, function (regex, use) {\n\t // grab the more specific match result (1), save, and use it as the find flag\n\t hdaId = _.result(pathToMatch.match(regex), 1);\n\t return hdaId;\n\t });\n\t // need to type mangle to go from web route to history contents\n\t this._setCurrentContentById(hdaId ? 'dataset-' + hdaId : null);\n\t },\n\t // when the center panel is given a new view, clear the current indicator\n\t 'center-panel:load': function (view) {\n\t this._setCurrentContentById();\n\t }\n\t });\n\t },\n\t\n\t //TODO: remove quota meter from panel and remove this\n\t /** add listeners to an external quota meter (mvc/user/user-quotameter.js) */\n\t connectToQuotaMeter: function (quotaMeter) {\n\t if (!quotaMeter) {\n\t return this;\n\t }\n\t // show/hide the 'over quota message' in the history when the meter tells it to\n\t this.listenTo(quotaMeter, 'quota:over', this.showQuotaMessage);\n\t this.listenTo(quotaMeter, 'quota:under', this.hideQuotaMessage);\n\t\n\t // having to add this to handle re-render of hview while overquota (the above do not fire)\n\t this.on('rendered rendered:initial', function () {\n\t if (quotaMeter && quotaMeter.isOverQuota()) {\n\t this.showQuotaMessage();\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** Override to preserve the quota message */\n\t clearMessages: function (ev) {\n\t var $target = !_.isUndefined(ev) ? $(ev.currentTarget) : this.$messages().children('[class$=\"message\"]');\n\t $target = $target.not('.quota-message');\n\t $target.fadeOut(this.fxSpeed, function () {\n\t $(this).remove();\n\t });\n\t return this;\n\t },\n\t\n\t /** Show the over quota message (which happens to be in the history panel).\n\t */\n\t showQuotaMessage: function () {\n\t var $msg = this.$('.quota-message');\n\t if ($msg.is(':hidden')) {\n\t $msg.slideDown(this.fxSpeed);\n\t }\n\t },\n\t\n\t /** Hide the over quota message (which happens to be in the history panel).\n\t */\n\t hideQuotaMessage: function () {\n\t var $msg = this.$('.quota-message');\n\t if (!$msg.is(':hidden')) {\n\t $msg.slideUp(this.fxSpeed);\n\t }\n\t },\n\t\n\t // ........................................................................ options menu\n\t //TODO: remove to batch\n\t /** unhide any hidden datasets */\n\t unhideHidden: function () {\n\t var self = this;\n\t if (confirm(_l('Really unhide all hidden datasets?'))) {\n\t // get all hidden, regardless of deleted/purged\n\t return self.model.contents._filterAndUpdate({ visible: false, deleted: '', purged: '' }, { visible: true }).done(function () {\n\t // TODO: would be better to render these as they're unhidden instead of all at once\n\t if (!self.model.contents.includeHidden) {\n\t self.renderItems();\n\t }\n\t });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** delete any hidden datasets */\n\t deleteHidden: function () {\n\t var self = this;\n\t if (confirm(_l('Really delete all hidden datasets?'))) {\n\t return self.model.contents._filterAndUpdate(\n\t // get all hidden, regardless of deleted/purged\n\t { visible: false, deleted: '', purged: '' },\n\t // both delete *and* unhide them\n\t { deleted: true, visible: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** Return a string rep of the history */\n\t toString: function () {\n\t return 'CurrentHistoryView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t CurrentHistoryView.prototype.templates = function () {\n\t\n\t var quotaMsgTemplate = BASE_MVC.wrapTemplate(['
                        ', _l('You are over your disk quota'), '. ', _l('Tool execution is on hold until your disk usage drops below your allocated quota'), '.', '
                        '], 'history');\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t quotaMsg: quotaMsgTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t CurrentHistoryView: CurrentHistoryView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 133 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, _, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(134), __webpack_require__(64), __webpack_require__(17), __webpack_require__(88), __webpack_require__(129), __webpack_require__(130), __webpack_require__(45), __webpack_require__(80), __webpack_require__(60), __webpack_require__(125), __webpack_require__(124), __webpack_require__(25), __webpack_require__(18), __webpack_require__(7), __webpack_require__(6), __webpack_require__(24)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HISTORY_VIEW, HISTORY_CONTENTS, STATES, HDA_MODEL, HDA_LI_EDIT, HDCA_LI_EDIT, TAGS, ANNOTATIONS, LIST_COLLECTION_CREATOR, PAIR_COLLECTION_CREATOR, LIST_OF_PAIRS_COLLECTION_CREATOR, faIconButton, PopupMenu, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t\n\t var _super = HISTORY_VIEW.HistoryView;\n\t // base class for history-view-edit-current and used as-is in history/view.mako\n\t /** @class Editable View/Controller for the history model.\n\t *\n\t * Allows:\n\t * (everything HistoryView allows)\n\t * changing the name\n\t * displaying and editing tags and annotations\n\t * multi-selection and operations on mulitple content items\n\t */\n\t var HistoryViewEdit = _super.extend(\n\t /** @lends HistoryViewEdit.prototype */{\n\t\n\t /** class to use for constructing the HistoryDatasetAssociation views */\n\t HDAViewClass: HDA_LI_EDIT.HDAListItemEdit,\n\t /** class to use for constructing the HistoryDatasetCollectionAssociation views */\n\t HDCAViewClass: HDCA_LI_EDIT.HDCAListItemEdit,\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes\n\t */\n\t initialize: function (attributes) {\n\t attributes = attributes || {};\n\t _super.prototype.initialize.call(this, attributes);\n\t\n\t // ---- set up instance vars\n\t /** editor for tags - sub-view */\n\t this.tagsEditor = null;\n\t\n\t /** enable drag and drop - sub-view */\n\t this.dragItems = true;\n\t\n\t /** editor for annotations - sub-view */\n\t this.annotationEditor = null;\n\t\n\t /** allow user purge of dataset files? */\n\t this.purgeAllowed = attributes.purgeAllowed || false;\n\t\n\t // states/modes the panel can be in\n\t /** is the panel currently showing the dataset selection controls? */\n\t this.annotationEditorShown = attributes.annotationEditorShown || false;\n\t this.tagsEditorShown = attributes.tagsEditorShown || false;\n\t },\n\t\n\t /** Override to handle history as drag-drop target */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t return this.on({\n\t 'droptarget:drop': function (ev, data) {\n\t // process whatever was dropped and re-hide the drop target\n\t this.dataDropped(data);\n\t this.dropTargetOff();\n\t },\n\t 'view:attached view:removed': function () {\n\t this._renderCounts();\n\t },\n\t 'search:loading-progress': this._renderSearchProgress,\n\t 'search:searching': this._renderSearchFindings\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ listeners\n\t /** listening for history and HDA events */\n\t _setUpModelListeners: function () {\n\t _super.prototype._setUpModelListeners.call(this);\n\t this.listenTo(this.model, 'change:size', this.updateHistoryDiskSize);\n\t return this;\n\t },\n\t\n\t /** listening for collection events */\n\t _setUpCollectionListeners: function () {\n\t _super.prototype._setUpCollectionListeners.call(this);\n\t this.listenTo(this.collection, {\n\t 'change:deleted': this._handleItemDeletedChange,\n\t 'change:visible': this._handleItemVisibleChange,\n\t 'change:purged': function (model) {\n\t // hafta get the new nice-size w/o the purged model\n\t this.model.fetch();\n\t },\n\t // loading indicators for deleted/hidden\n\t 'fetching-deleted': function (collection) {\n\t this.$('> .controls .deleted-count').html('' + _l('loading...') + '');\n\t },\n\t 'fetching-hidden': function (collection) {\n\t this.$('> .controls .hidden-count').html('' + _l('loading...') + '');\n\t },\n\t 'fetching-deleted-done fetching-hidden-done': this._renderCounts\n\t });\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel rendering\n\t /** In this override, add tag and annotation editors and a btn to toggle the selectors */\n\t _buildNewRender: function () {\n\t // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n\t var $newRender = _super.prototype._buildNewRender.call(this);\n\t if (!this.model) {\n\t return $newRender;\n\t }\n\t\n\t if (Galaxy && Galaxy.user && Galaxy.user.id && Galaxy.user.id === this.model.get('user_id')) {\n\t this._renderTags($newRender);\n\t this._renderAnnotation($newRender);\n\t }\n\t return $newRender;\n\t },\n\t\n\t /** Update the history size display (curr. upper right of panel). */\n\t updateHistoryDiskSize: function () {\n\t this.$('.history-size').text(this.model.get('nice_size'));\n\t },\n\t\n\t /** override to render counts when the items are rendered */\n\t renderItems: function ($whereTo) {\n\t var views = _super.prototype.renderItems.call(this, $whereTo);\n\t if (!this.searchFor) {\n\t this._renderCounts($whereTo);\n\t }\n\t return views;\n\t },\n\t\n\t /** override to show counts, what's deleted/hidden, and links to toggle those */\n\t _renderCounts: function ($whereTo) {\n\t $whereTo = $whereTo instanceof jQuery ? $whereTo : this.$el;\n\t var html = this.templates.counts(this.model.toJSON(), this);\n\t return $whereTo.find('> .controls .subtitle').html(html);\n\t },\n\t\n\t /** render the tags sub-view controller */\n\t _renderTags: function ($where) {\n\t var panel = this;\n\t this.tagsEditor = new TAGS.TagsEditor({\n\t model: this.model,\n\t el: $where.find('.controls .tags-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // show hide sub-view tag editors when this is shown/hidden\n\t onshow: function () {\n\t panel.toggleHDATagEditors(true, panel.fxSpeed);\n\t },\n\t onhide: function () {\n\t panel.toggleHDATagEditors(false, panel.fxSpeed);\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit history tags'),\n\t classes: 'history-tag-btn',\n\t faIcon: 'fa-tags'\n\t }).appendTo($where.find('.controls .actions'))\n\t });\n\t },\n\t /** render the annotation sub-view controller */\n\t _renderAnnotation: function ($where) {\n\t var panel = this;\n\t this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n\t model: this.model,\n\t el: $where.find('.controls .annotation-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // show hide sub-view view annotation editors when this is shown/hidden\n\t onshow: function () {\n\t panel.toggleHDAAnnotationEditors(true, panel.fxSpeed);\n\t },\n\t onhide: function () {\n\t panel.toggleHDAAnnotationEditors(false, panel.fxSpeed);\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit history annotation'),\n\t classes: 'history-annotate-btn',\n\t faIcon: 'fa-comment'\n\t }).appendTo($where.find('.controls .actions'))\n\t });\n\t },\n\t\n\t /** Set up HistoryViewEdit js/widget behaviours\n\t * In this override, make the name editable\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t _super.prototype._setUpBehaviors.call(this, $where);\n\t if (!this.model) {\n\t return;\n\t }\n\t\n\t // anon users shouldn't have access to any of the following\n\t if (!Galaxy.user || Galaxy.user.isAnonymous() || Galaxy.user.id !== this.model.get('user_id')) {\n\t return;\n\t }\n\t\n\t var panel = this,\n\t nameSelector = '> .controls .name';\n\t $where.find(nameSelector).attr('title', _l('Click to rename history')).tooltip({ placement: 'bottom' }).make_text_editable({\n\t on_finish: function (newName) {\n\t var previousName = panel.model.get('name');\n\t if (newName && newName !== previousName) {\n\t panel.$el.find(nameSelector).text(newName);\n\t panel.model.save({ name: newName }).fail(function () {\n\t panel.$el.find(nameSelector).text(panel.model.previous('name'));\n\t });\n\t } else {\n\t panel.$el.find(nameSelector).text(previousName);\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** return a new popup menu for choosing a multi selection action\n\t * ajax calls made for multiple datasets are queued\n\t */\n\t multiselectActions: function () {\n\t var panel = this,\n\t actions = [{ html: _l('Hide datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.hide;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }, { html: _l('Unhide datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.unhide;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }, { html: _l('Delete datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype['delete'];\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }, { html: _l('Undelete datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.undelete;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }];\n\t if (panel.purgeAllowed) {\n\t actions.push({\n\t html: _l('Permanently delete datasets'), func: function () {\n\t if (confirm(_l('This will permanently remove the data in your datasets. Are you sure?'))) {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.purge;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }\n\t });\n\t }\n\t actions = actions.concat(panel._collectionActions());\n\t return actions;\n\t },\n\t\n\t /** */\n\t _collectionActions: function () {\n\t var panel = this;\n\t return [{ html: _l('Build Dataset List'), func: function () {\n\t panel.buildCollection(\"list\");\n\t }\n\t },\n\t // TODO: Only show quick pair if two things selected.\n\t { html: _l('Build Dataset Pair'), func: function () {\n\t panel.buildCollection(\"paired\");\n\t }\n\t }, { html: _l('Build List of Dataset Pairs'), func: function () {\n\t panel.buildCollection(\"list:paired\");\n\t }\n\t }];\n\t },\n\t\n\t buildCollection: function (collectionType, selection, hideSourceItems) {\n\t var panel = this;\n\t var selection = selection || panel.getSelectedModels();\n\t var hideSourceItems = hideSourceItems || false;\n\t var createFunc;\n\t if (collectionType == \"list\") {\n\t createFunc = LIST_COLLECTION_CREATOR.createListCollection;\n\t } else if (collectionType == \"paired\") {\n\t createFunc = PAIR_COLLECTION_CREATOR.createPairCollection;\n\t } else if (collectionType == \"list:paired\") {\n\t createFunc = LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection;\n\t } else {\n\t console.warn(\"Unknown collectionType encountered \" + collectionType);\n\t }\n\t createFunc(selection, hideSourceItems).done(function () {\n\t panel.model.refresh();\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** In this override, add purgeAllowed and whether tags/annotation editors should be shown */\n\t _getItemViewOptions: function (model) {\n\t var options = _super.prototype._getItemViewOptions.call(this, model);\n\t _.extend(options, {\n\t purgeAllowed: this.purgeAllowed,\n\t tagsEditorShown: this.tagsEditor && !this.tagsEditor.hidden,\n\t annotationEditorShown: this.annotationEditor && !this.annotationEditor.hidden\n\t });\n\t return options;\n\t },\n\t\n\t /** If this item is deleted and we're not showing deleted items, remove the view\n\t * @param {Model} the item model to check\n\t */\n\t _handleItemDeletedChange: function (itemModel) {\n\t if (itemModel.get('deleted')) {\n\t this._handleItemDeletion(itemModel);\n\t } else {\n\t this._handleItemUndeletion(itemModel);\n\t }\n\t this._renderCounts();\n\t },\n\t\n\t _handleItemDeletion: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.deleted += 1;\n\t contentsShown.active -= 1;\n\t if (!this.model.contents.includeDeleted) {\n\t this.removeItemView(itemModel);\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t _handleItemUndeletion: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.deleted -= 1;\n\t if (!this.model.contents.includeDeleted) {\n\t contentsShown.active -= 1;\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t /** If this item is hidden and we're not showing hidden items, remove the view\n\t * @param {Model} the item model to check\n\t */\n\t _handleItemVisibleChange: function (itemModel) {\n\t if (itemModel.hidden()) {\n\t this._handleItemHidden(itemModel);\n\t } else {\n\t this._handleItemUnhidden(itemModel);\n\t }\n\t this._renderCounts();\n\t },\n\t\n\t _handleItemHidden: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.hidden += 1;\n\t contentsShown.active -= 1;\n\t if (!this.model.contents.includeHidden) {\n\t this.removeItemView(itemModel);\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t _handleItemUnhidden: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.hidden -= 1;\n\t if (!this.model.contents.includeHidden) {\n\t contentsShown.active -= 1;\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t /** toggle the visibility of each content's tagsEditor applying all the args sent to this function */\n\t toggleHDATagEditors: function (showOrHide, speed) {\n\t _.each(this.views, function (view) {\n\t if (view.tagsEditor) {\n\t view.tagsEditor.toggle(showOrHide, speed);\n\t }\n\t });\n\t },\n\t\n\t /** toggle the visibility of each content's annotationEditor applying all the args sent to this function */\n\t toggleHDAAnnotationEditors: function (showOrHide, speed) {\n\t _.each(this.views, function (view) {\n\t if (view.annotationEditor) {\n\t view.annotationEditor.toggle(showOrHide, speed);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .show-selectors-btn': 'toggleSelectors',\n\t 'click .toggle-deleted-link': function (ev) {\n\t this.toggleShowDeleted();\n\t },\n\t 'click .toggle-hidden-link': function (ev) {\n\t this.toggleShowHidden();\n\t }\n\t }),\n\t\n\t // ------------------------------------------------------------------------ search\n\t _renderSearchProgress: function (limit, offset) {\n\t var stop = limit + offset;\n\t return this.$('> .controls .subtitle').html(['', _l('Searching '), stop, '/', this.model.contentsShown(), ''].join(''));\n\t },\n\t\n\t /** override to display number found in subtitle */\n\t _renderSearchFindings: function () {\n\t this.$('> .controls .subtitle').html([_l('Found'), this.views.length].join(' '));\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ as drop target\n\t /** turn all the drag and drop handlers on and add some help text above the drop area */\n\t dropTargetOn: function () {\n\t if (this.dropTarget) {\n\t return this;\n\t }\n\t this.dropTarget = true;\n\t\n\t //TODO: to init\n\t var dropHandlers = {\n\t 'dragenter': _.bind(this.dragenter, this),\n\t 'dragover': _.bind(this.dragover, this),\n\t 'dragleave': _.bind(this.dragleave, this),\n\t 'drop': _.bind(this.drop, this)\n\t };\n\t\n\t var $dropTarget = this._renderDropTarget();\n\t this.$list().before([this._renderDropTargetHelp(), $dropTarget]);\n\t for (var evName in dropHandlers) {\n\t if (dropHandlers.hasOwnProperty(evName)) {\n\t //console.debug( evName, dropHandlers[ evName ] );\n\t $dropTarget.on(evName, dropHandlers[evName]);\n\t }\n\t }\n\t return this;\n\t },\n\t\n\t /** render a box to serve as a 'drop here' area on the history */\n\t _renderDropTarget: function () {\n\t this.$('.history-drop-target').remove();\n\t return $('
                        ').addClass('history-drop-target');\n\t },\n\t\n\t /** tell the user how it works */\n\t _renderDropTargetHelp: function () {\n\t this.$('.history-drop-target-help').remove();\n\t return $('
                        ').addClass('history-drop-target-help').text(_l('Drag datasets here to copy them to the current history'));\n\t },\n\t\n\t /** shut down drag and drop event handlers and remove drop target */\n\t dropTargetOff: function () {\n\t if (!this.dropTarget) {\n\t return this;\n\t }\n\t //this.log( 'dropTargetOff' );\n\t this.dropTarget = false;\n\t var dropTarget = this.$('.history-drop-target').get(0);\n\t for (var evName in this._dropHandlers) {\n\t if (this._dropHandlers.hasOwnProperty(evName)) {\n\t dropTarget.off(evName, this._dropHandlers[evName]);\n\t }\n\t }\n\t this.$('.history-drop-target').remove();\n\t this.$('.history-drop-target-help').remove();\n\t return this;\n\t },\n\t /** toggle the target on/off */\n\t dropTargetToggle: function () {\n\t if (this.dropTarget) {\n\t this.dropTargetOff();\n\t } else {\n\t this.dropTargetOn();\n\t }\n\t return this;\n\t },\n\t\n\t dragenter: function (ev) {\n\t //console.debug( 'dragenter:', this, ev );\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t this.$('.history-drop-target').css('border', '2px solid black');\n\t },\n\t dragover: function (ev) {\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t },\n\t dragleave: function (ev) {\n\t //console.debug( 'dragleave:', this, ev );\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t this.$('.history-drop-target').css('border', '1px dashed black');\n\t },\n\t /** when (text) is dropped try to parse as json and trigger an event */\n\t drop: function (ev) {\n\t ev.preventDefault();\n\t //ev.stopPropagation();\n\t\n\t var self = this;\n\t var dataTransfer = ev.originalEvent.dataTransfer;\n\t var data = dataTransfer.getData(\"text\");\n\t\n\t dataTransfer.dropEffect = 'move';\n\t try {\n\t data = JSON.parse(data);\n\t } catch (err) {\n\t self.warn('error parsing JSON from drop:', data);\n\t }\n\t\n\t self.trigger('droptarget:drop', ev, data, self);\n\t return false;\n\t },\n\t\n\t /** handler that copies data into the contents */\n\t dataDropped: function (data) {\n\t var self = this;\n\t // HDA: dropping will copy it to the history\n\t if (_.isObject(data) && data.model_class === 'HistoryDatasetAssociation' && data.id) {\n\t if (self.contents.currentPage !== 0) {\n\t return self.contents.fetchPage(0).then(function () {\n\t return self.model.contents.copy(data.id);\n\t });\n\t }\n\t return self.model.contents.copy(data.id);\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t // ........................................................................ misc\n\t /** Return a string rep of the history */\n\t toString: function () {\n\t return 'HistoryViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t HistoryViewEdit.prototype.templates = function () {\n\t\n\t var countsTemplate = BASE_MVC.wrapTemplate(['<% var shown = Math.max( view.views.length, history.contents_active.active ) %>', '<% if( shown ){ %>', '', '<%- shown %> ', _l('shown'), '', '<% } %>', '<% if( history.contents_active.deleted ){ %>', '', '<% if( view.model.contents.includeDeleted ){ %>', '', _l('hide deleted'), '', '<% } else { %>', '<%- history.contents_active.deleted %> ', '', _l('deleted'), '', '<% } %>', '', '<% } %>', '<% if( history.contents_active.hidden ){ %>', '', '<% if( view.model.contents.includeHidden ){ %>', '', _l('hide hidden'), '', '<% } else { %>', '<%- history.contents_active.hidden %> ', '', _l('hidden'), '', '<% } %>', '', '<% } %>'], 'history');\n\t\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t counts: countsTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HistoryViewEdit: HistoryViewEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 134 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(91), __webpack_require__(65), __webpack_require__(64), __webpack_require__(66), __webpack_require__(87), __webpack_require__(89), __webpack_require__(95), __webpack_require__(94), __webpack_require__(25), __webpack_require__(7), __webpack_require__(6), __webpack_require__(98)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_VIEW, HISTORY_MODEL, HISTORY_CONTENTS, HISTORY_PREFS, HDA_LI, HDCA_LI, USER, ERROR_MODAL, faIconButton, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t /** @class non-editable, read-only View/Controller for a history model.\n\t * Allows:\n\t * changing the loaded history\n\t * displaying data, info, and download\n\t * tracking history attrs: size, tags, annotations, name, etc.\n\t * Does not allow:\n\t * changing the name\n\t */\n\t\n\t var _super = LIST_VIEW.ModelListPanel;\n\t var HistoryView = _super.extend(\n\t /** @lends HistoryView.prototype */{\n\t _logNamespace: 'history',\n\t\n\t /** class to use for constructing the HDA views */\n\t HDAViewClass: HDA_LI.HDAListItemView,\n\t /** class to use for constructing the HDCA views */\n\t HDCAViewClass: HDCA_LI.HDCAListItemView,\n\t /** class to used for constructing collection of sub-view models */\n\t collectionClass: HISTORY_CONTENTS.HistoryContents,\n\t /** key of attribute in model to assign to this.collection */\n\t modelCollectionKey: 'contents',\n\t\n\t tagName: 'div',\n\t className: _super.prototype.className + ' history-panel',\n\t\n\t /** string to display when the collection is empty */\n\t emptyMsg: _l('This history is empty'),\n\t /** displayed when no items match the search terms */\n\t noneFoundMsg: _l('No matching datasets found'),\n\t /** string used for search placeholder */\n\t searchPlaceholder: _l('search datasets'),\n\t\n\t /** @type {Number} ms to wait after history load to fetch/decorate hdcas with element_count */\n\t FETCH_COLLECTION_COUNTS_DELAY: 2000,\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, bind listeners.\n\t * @param {Object} attributes optional settings for the panel\n\t */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t // ---- instance vars\n\t // control contents/behavior based on where (and in what context) the panel is being used\n\t /** where should pages from links be displayed? (default to new tab/window) */\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t },\n\t\n\t /** create and return a collection for when none is initially passed */\n\t _createDefaultCollection: function () {\n\t // override\n\t return new this.collectionClass([], { history: this.model });\n\t },\n\t\n\t /** In this override, clear the update timer on the model */\n\t freeModel: function () {\n\t _super.prototype.freeModel.call(this);\n\t if (this.model) {\n\t this.model.clearUpdateTimeout();\n\t }\n\t return this;\n\t },\n\t\n\t /** create any event listeners for the panel\n\t * @fires: rendered:initial on the first render\n\t * @fires: empty-history when switching to a history with no contents or creating a new history\n\t */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t this.on({\n\t error: function (model, xhr, options, msg, details) {\n\t this.errorHandler(model, xhr, options, msg, details);\n\t },\n\t 'loading-done': function () {\n\t var self = this;\n\t // after the initial load, decorate with more time consuming fields (like HDCA element_counts)\n\t _.delay(function () {\n\t self.model.contents.fetchCollectionCounts();\n\t }, self.FETCH_COLLECTION_COUNTS_DELAY);\n\t },\n\t 'views:ready view:attached view:removed': function (view) {\n\t this._renderSelectButton();\n\t },\n\t 'view:attached': function (view) {\n\t this.scrollTo(0);\n\t }\n\t });\n\t // this.on( 'all', function(){ console.debug( arguments ); });\n\t },\n\t\n\t // ------------------------------------------------------------------------ loading history/hda models\n\t /** load the history with the given id then it's contents, sending ajax options to both */\n\t loadHistory: function (historyId, options, contentsOptions) {\n\t contentsOptions = _.extend(contentsOptions || { silent: true });\n\t this.info('loadHistory:', historyId, options, contentsOptions);\n\t var self = this;\n\t self.setModel(new HISTORY_MODEL.History({ id: historyId }));\n\t\n\t contentsOptions.silent = true;\n\t self.trigger('loading');\n\t return self.model.fetchWithContents(options, contentsOptions).always(function () {\n\t self.render();\n\t self.trigger('loading-done');\n\t });\n\t },\n\t\n\t /** convenience alias to the model. Updates the item list only (not the history) */\n\t refreshContents: function (options) {\n\t if (this.model) {\n\t return this.model.refresh(options);\n\t }\n\t // may have callbacks - so return an empty promise\n\t return $.when();\n\t },\n\t\n\t /** Override to reset web storage when the id changes (since it needs the id) */\n\t _setUpCollectionListeners: function () {\n\t _super.prototype._setUpCollectionListeners.call(this);\n\t return this.listenTo(this.collection, {\n\t // 'all' : function(){ console.log( this.collection + ':', arguments ); },\n\t 'fetching-more': function () {\n\t this._toggleContentsLoadingIndicator(true);\n\t this.$emptyMessage().hide();\n\t },\n\t 'fetching-more-done': function () {\n\t this._toggleContentsLoadingIndicator(false);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel rendering\n\t /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n\t _showLoadingIndicator: function (msg, speed, callback) {\n\t var $indicator = $('
                        ');\n\t this.$el.html($indicator.text(msg).slideDown(!_.isUndefined(speed) ? speed : this.fxSpeed));\n\t },\n\t\n\t /** hide the loading indicator */\n\t _hideLoadingIndicator: function (speed) {\n\t // make speed a bit slower to compensate for slow rendering of up to 500 contents\n\t this.$('.loading-indicator').slideUp(!_.isUndefined(speed) ? speed : this.fxSpeed + 200, function () {\n\t $(this).remove();\n\t });\n\t },\n\t\n\t /** In this override, add a btn to toggle the selectors */\n\t _buildNewRender: function () {\n\t var $newRender = _super.prototype._buildNewRender.call(this);\n\t this._renderSelectButton($newRender);\n\t return $newRender;\n\t },\n\t\n\t /** button for starting select mode */\n\t _renderSelectButton: function ($where) {\n\t $where = $where || this.$el;\n\t // do not render selector option if no actions\n\t if (!this.multiselectActions().length) {\n\t return null;\n\t }\n\t // do not render (and remove even) if nothing to select\n\t if (!this.views.length) {\n\t this.hideSelectors();\n\t $where.find('.controls .actions .show-selectors-btn').remove();\n\t return null;\n\t }\n\t // don't bother rendering if there's one already\n\t var $existing = $where.find('.controls .actions .show-selectors-btn');\n\t if ($existing.length) {\n\t return $existing;\n\t }\n\t\n\t return faIconButton({\n\t title: _l('Operations on multiple datasets'),\n\t classes: 'show-selectors-btn',\n\t faIcon: 'fa-check-square-o'\n\t }).prependTo($where.find('.controls .actions'));\n\t },\n\t\n\t /** override to avoid showing intial empty message using contents_active */\n\t _renderEmptyMessage: function ($whereTo) {\n\t var self = this;\n\t var $emptyMsg = self.$emptyMessage($whereTo);\n\t\n\t var empty = self.model.get('contents_active').active <= 0;\n\t if (empty) {\n\t return $emptyMsg.empty().append(self.emptyMsg).show();\n\t } else if (self.searchFor && self.model.contents.haveSearchDetails() && !self.views.length) {\n\t return $emptyMsg.empty().append(self.noneFoundMsg).show();\n\t }\n\t $emptyMsg.hide();\n\t return $();\n\t },\n\t\n\t /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n\t $scrollContainer: function ($where) {\n\t // override or set via attributes.$scrollContainer\n\t return this.$list($where);\n\t },\n\t\n\t // ------------------------------------------------------------------------ subviews\n\t _toggleContentsLoadingIndicator: function (show) {\n\t if (!show) {\n\t this.$list().find('.contents-loading-indicator').remove();\n\t } else {\n\t this.$list().html('
                        ' + '
                        ');\n\t }\n\t },\n\t\n\t /** override to render pagination also */\n\t renderItems: function ($whereTo) {\n\t // console.log( this + '.renderItems-----------------', new Date() );\n\t $whereTo = $whereTo || this.$el;\n\t var self = this;\n\t var $list = self.$list($whereTo);\n\t\n\t // TODO: bootstrap hack to remove orphaned tooltips\n\t $('.tooltip').remove();\n\t\n\t $list.empty();\n\t self.views = [];\n\t\n\t var models = self._filterCollection();\n\t if (models.length) {\n\t self._renderPagination($whereTo);\n\t self.views = self._renderSomeItems(models, $list);\n\t } else {\n\t // TODO: consolidate with _renderPagination above by (???) passing in models/length?\n\t $whereTo.find('> .controls .list-pagination').empty();\n\t }\n\t self._renderEmptyMessage($whereTo).toggle(!models.length);\n\t\n\t self.trigger('views:ready', self.views);\n\t return self.views;\n\t },\n\t\n\t /** render pagination controls if not searching and contents says we're paginating */\n\t _renderPagination: function ($whereTo) {\n\t var $paginationControls = $whereTo.find('> .controls .list-pagination');\n\t if (this.searchFor || !this.model.contents.shouldPaginate()) return $paginationControls.empty();\n\t\n\t $paginationControls.html(this.templates.pagination({\n\t // pagination is 1-based for the user\n\t current: this.model.contents.currentPage + 1,\n\t last: this.model.contents.getLastPage() + 1\n\t }, this));\n\t $paginationControls.find('select.pages').tooltip();\n\t return $paginationControls;\n\t },\n\t\n\t /** render a subset of the entire collection (client-side pagination) */\n\t _renderSomeItems: function (models, $list) {\n\t var self = this;\n\t var views = [];\n\t $list.append(models.map(function (m) {\n\t var view = self._createItemView(m);\n\t views.push(view);\n\t return self._renderItemView$el(view);\n\t }));\n\t return views;\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** in this override, check if the contents would also display based on includeDeleted/hidden */\n\t _filterItem: function (model) {\n\t var self = this;\n\t var contents = self.model.contents;\n\t return (contents.includeHidden || !model.hidden()) && (contents.includeDeleted || !model.isDeletedOrPurged()) && _super.prototype._filterItem.call(self, model);\n\t },\n\t\n\t /** In this override, since history contents are mixed,\n\t * get the appropo view class based on history_content_type\n\t */\n\t _getItemViewClass: function (model) {\n\t var contentType = model.get(\"history_content_type\");\n\t switch (contentType) {\n\t case 'dataset':\n\t return this.HDAViewClass;\n\t case 'dataset_collection':\n\t return this.HDCAViewClass;\n\t }\n\t throw new TypeError('Unknown history_content_type: ' + contentType);\n\t },\n\t\n\t /** in this override, add a linktarget, and expand if id is in web storage */\n\t _getItemViewOptions: function (model) {\n\t var options = _super.prototype._getItemViewOptions.call(this, model);\n\t return _.extend(options, {\n\t linkTarget: this.linkTarget,\n\t expanded: this.model.contents.storage.isExpanded(model.id),\n\t hasUser: this.model.ownedByCurrUser()\n\t });\n\t },\n\t\n\t /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t _super.prototype._setUpItemViewListeners.call(panel, view);\n\t //TODO: send from content view: this.model.collection.storage.addExpanded\n\t // maintain a list of items whose bodies are expanded\n\t return panel.listenTo(view, {\n\t 'expanded': function (v) {\n\t panel.model.contents.storage.addExpanded(v.model);\n\t },\n\t 'collapsed': function (v) {\n\t panel.model.contents.storage.removeExpanded(v.model);\n\t }\n\t });\n\t },\n\t\n\t /** override to remove expandedIds from webstorage */\n\t collapseAll: function () {\n\t this.model.contents.storage.clearExpanded();\n\t _super.prototype.collapseAll.call(this);\n\t },\n\t\n\t // ------------------------------------------------------------------------ selection\n\t /** Override to correctly set the historyId of the new collection */\n\t getSelectedModels: function () {\n\t var collection = _super.prototype.getSelectedModels.call(this);\n\t collection.historyId = this.collection.historyId;\n\t return collection;\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .show-selectors-btn': 'toggleSelectors',\n\t 'click > .controls .prev': '_clickPrevPage',\n\t 'click > .controls .next': '_clickNextPage',\n\t 'change > .controls .pages': '_changePageSelect',\n\t // allow (error) messages to be clicked away\n\t 'click .messages [class$=message]': 'clearMessages'\n\t }),\n\t\n\t _clickPrevPage: function (ev) {\n\t this.model.clearUpdateTimeout();\n\t this.model.contents.fetchPrevPage();\n\t },\n\t\n\t _clickNextPage: function (ev) {\n\t this.model.clearUpdateTimeout();\n\t this.model.contents.fetchNextPage();\n\t },\n\t\n\t _changePageSelect: function (ev) {\n\t this.model.clearUpdateTimeout();\n\t var page = $(ev.currentTarget).val();\n\t this.model.contents.fetchPage(page);\n\t },\n\t\n\t /** Toggle and store the deleted visibility and re-render items\n\t * @returns {Boolean} new setting\n\t */\n\t toggleShowDeleted: function (show, options) {\n\t show = show !== undefined ? show : !this.model.contents.includeDeleted;\n\t var self = this;\n\t var contents = self.model.contents;\n\t contents.setIncludeDeleted(show, options);\n\t self.trigger('show-deleted', show);\n\t\n\t contents.fetchCurrentPage({ renderAll: true });\n\t return show;\n\t },\n\t\n\t /** Toggle and store whether to render explicity hidden contents\n\t * @returns {Boolean} new setting\n\t */\n\t toggleShowHidden: function (show, store, options) {\n\t // console.log( 'toggleShowHidden', show, store );\n\t show = show !== undefined ? show : !this.model.contents.includeHidden;\n\t var self = this;\n\t var contents = self.model.contents;\n\t contents.setIncludeHidden(show, options);\n\t self.trigger('show-hidden', show);\n\t\n\t contents.fetchCurrentPage({ renderAll: true });\n\t return show;\n\t },\n\t\n\t /** On the first search, if there are no details - load them, then search */\n\t _firstSearch: function (searchFor) {\n\t var self = this;\n\t var inputSelector = '> .controls .search-input';\n\t this.log('onFirstSearch', searchFor);\n\t\n\t // if the contents already have enough details to search, search and return now\n\t if (self.model.contents.haveSearchDetails()) {\n\t self.searchItems(searchFor);\n\t return;\n\t }\n\t\n\t // otherwise, load the details progressively here\n\t self.$(inputSelector).searchInput('toggle-loading');\n\t // set this now so that only results will show during progress\n\t self.searchFor = searchFor;\n\t var xhr = self.model.contents.progressivelyFetchDetails({ silent: true }).progress(function (response, limit, offset) {\n\t self.renderItems();\n\t self.trigger('search:loading-progress', limit, offset);\n\t }).always(function () {\n\t self.$el.find(inputSelector).searchInput('toggle-loading');\n\t }).done(function () {\n\t self.searchItems(searchFor, 'force');\n\t });\n\t },\n\t\n\t /** clear the search filters and show all views that are normally shown */\n\t clearSearch: function (searchFor) {\n\t var self = this;\n\t if (!self.searchFor) return self;\n\t //self.log( 'onSearchClear', self );\n\t self.searchFor = '';\n\t self.trigger('search:clear', self);\n\t self.$('> .controls .search-query').val('');\n\t // NOTE: silent + render prevents collection update event with merge only\n\t // - which causes an empty page due to event handler above\n\t self.model.contents.fetchCurrentPage({ silent: true }).done(function () {\n\t self.renderItems();\n\t });\n\t return self;\n\t },\n\t\n\t // ........................................................................ error handling\n\t /** Event handler for errors (from the panel, the history, or the history's contents)\n\t * Alternately use two strings for model and xhr to use custom message and title (respectively)\n\t * @param {Model or View} model the (Backbone) source of the error\n\t * @param {XMLHTTPRequest} xhr any ajax obj. assoc. with the error\n\t * @param {Object} options the options map commonly used with bbone ajax\n\t */\n\t errorHandler: function (model, xhr, options) {\n\t //TODO: to mixin or base model\n\t // interrupted ajax or no connection\n\t if (xhr && xhr.status === 0 && xhr.readyState === 0) {\n\t // return ERROR_MODAL.offlineErrorModal();\n\t // fail silently\n\t return;\n\t }\n\t // otherwise, leave something to report in the console\n\t this.error(model, xhr, options);\n\t // and feedback to a modal\n\t // if sent two strings (and possibly details as 'options'), use those as message and title\n\t if (_.isString(model) && _.isString(xhr)) {\n\t var message = model;\n\t var title = xhr;\n\t return ERROR_MODAL.errorModal(message, title, options);\n\t }\n\t // bad gateway\n\t // TODO: possibly to global handler\n\t if (xhr && xhr.status === 502) {\n\t return ERROR_MODAL.badGatewayErrorModal();\n\t }\n\t return ERROR_MODAL.ajaxErrorModal(model, xhr, options);\n\t },\n\t\n\t /** Remove all messages from the panel. */\n\t clearMessages: function (ev) {\n\t var $target = !_.isUndefined(ev) ? $(ev.currentTarget) : this.$messages().children('[class$=\"message\"]');\n\t $target.fadeOut(this.fxSpeed, function () {\n\t $(this).remove();\n\t });\n\t return this;\n\t },\n\t\n\t // ........................................................................ scrolling\n\t /** Scrolls the panel to show the content sub-view with the given hid.\n\t * @param {Integer} hid the hid of item to scroll into view\n\t * @returns {HistoryView} the panel\n\t */\n\t scrollToHid: function (hid) {\n\t return this.scrollToItem(_.first(this.viewsWhereModel({ hid: hid })));\n\t },\n\t\n\t // ........................................................................ misc\n\t /** utility for adding -st, -nd, -rd, -th to numbers */\n\t ordinalIndicator: function (number) {\n\t var numStr = number + '';\n\t switch (numStr.charAt(numStr.length - 1)) {\n\t case '1':\n\t return numStr + 'st';\n\t case '2':\n\t return numStr + 'nd';\n\t case '3':\n\t return numStr + 'rd';\n\t default:\n\t return numStr + 'th';\n\t }\n\t },\n\t\n\t /** Return a string rep of the history */\n\t toString: function () {\n\t return 'HistoryView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t HistoryView.prototype.templates = function () {\n\t\n\t var mainTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
                        ', '
                        ', '
                          ', '
                          ', '
                          ']);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
                          ', '
                          ', '
                          <%- history.name %>
                          ', '
                          ', '
                          ', '
                          <%- history.nice_size %>
                          ', '
                          ', '
                          ', '<% if( history.deleted && history.purged ){ %>', '
                          ', _l('This history has been purged and deleted'), '
                          ', '<% } else if( history.deleted ){ %>', '
                          ', _l('This history has been deleted'), '
                          ', '<% } else if( history.purged ){ %>', '
                          ', _l('This history has been purged'), '
                          ', '<% } %>', '<% if( history.message ){ %>',\n\t // should already be localized\n\t '
                          messagesmall\">', '<%= history.message.text %>', '
                          ', '<% } %>', '
                          ',\n\t\n\t // add tags and annotations\n\t '
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '', '', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '
                          '], 'history');\n\t\n\t var paginationTemplate = BASE_MVC.wrapTemplate(['', '', ''], 'pages');\n\t\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t el: mainTemplate,\n\t controls: controlsTemplate,\n\t pagination: paginationTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HistoryView: HistoryView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 135 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(18), __webpack_require__(86), __webpack_require__(7), __webpack_require__(6), __webpack_require__(44)], __WEBPACK_AMD_DEFINE_RESULT__ = function (PopupMenu, historyCopyDialog, BASE_MVC, _l, Webhooks) {\n\t\n\t 'use strict';\n\t\n\t // ============================================================================\n\t\n\t var menu = [{\n\t html: _l('History Lists'),\n\t header: true\n\t }, {\n\t html: _l('Saved Histories'),\n\t href: 'histories/list',\n\t target: '_top'\n\t\n\t }, {\n\t html: _l('Histories Shared with Me'),\n\t href: 'histories/list_shared',\n\t target: '_top'\n\t }, {\n\t html: _l('Current History'),\n\t header: true,\n\t anon: true\n\t }, {\n\t html: _l('Create New'),\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel) {\n\t Galaxy.currHistoryPanel.createNewHistory();\n\t }\n\t }\n\t }, {\n\t html: _l('Copy History'),\n\t func: function () {\n\t historyCopyDialog(Galaxy.currHistoryPanel.model).done(function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }, {\n\t html: _l('Share or Publish'),\n\t href: 'history/sharing'\n\t }, {\n\t html: _l('Show Structure'),\n\t href: 'history/display_structured',\n\t anon: true\n\t }, {\n\t html: _l('Extract Workflow'),\n\t href: 'workflow/build_from_current_history'\n\t }, {\n\t html: _l('Delete'),\n\t anon: true,\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really delete the current history?'))) {\n\t Galaxy.currHistoryPanel.model._delete().done(function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Delete Permanently'),\n\t purge: true,\n\t anon: true,\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really delete the current history permanently? This cannot be undone.'))) {\n\t Galaxy.currHistoryPanel.model.purge().done(function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Dataset Actions'),\n\t header: true,\n\t anon: true\n\t }, {\n\t html: _l('Copy Datasets'),\n\t href: 'dataset/copy_datasets'\n\t }, {\n\t html: _l('Dataset Security'),\n\t href: 'root/history_set_default_permissions'\n\t }, {\n\t html: _l('Resume Paused Jobs'),\n\t href: 'history/resume_paused_jobs?current=True',\n\t anon: true\n\t }, {\n\t html: _l('Collapse Expanded Datasets'),\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel) {\n\t Galaxy.currHistoryPanel.collapseAll();\n\t }\n\t }\n\t }, {\n\t html: _l('Unhide Hidden Datasets'),\n\t anon: true,\n\t func: function () {\n\t // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really unhide all hidden datasets?'))) {\n\t $.post(Galaxy.root + \"history/adjust_hidden\", { 'user_action': 'unhide' }, function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Delete Hidden Datasets'),\n\t anon: true,\n\t func: function () {\n\t // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really delete all hidden datasets?'))) {\n\t $.post(Galaxy.root + \"history/adjust_hidden\", { 'user_action': 'delete' }, function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Purge Deleted Datasets'),\n\t confirm: _l('Really delete all deleted datasets permanently? This cannot be undone.'),\n\t href: 'history/purge_deleted_datasets',\n\t purge: true,\n\t anon: true\n\t }, {\n\t html: _l('Downloads'),\n\t header: true\n\t }, {\n\t html: _l('Export Tool Citations'),\n\t href: 'history/citations',\n\t anon: true\n\t }, {\n\t html: _l('Export History to File'),\n\t href: 'history/export_archive?preview=True',\n\t anon: true\n\t }, {\n\t html: _l('Other Actions'),\n\t header: true\n\t }, {\n\t html: _l('Import from File'),\n\t href: 'history/import_archive'\n\t }];\n\t\n\t // Webhooks\n\t Webhooks.add({\n\t url: 'api/webhooks/history-menu/all',\n\t async: false, // (hypothetically) slows down the performance\n\t callback: function (webhooks) {\n\t var webhooks_menu = [];\n\t\n\t $.each(webhooks.models, function (index, model) {\n\t var webhook = model.toJSON();\n\t if (webhook.activate) {\n\t webhooks_menu.push({\n\t html: _l(webhook.config.title),\n\t // func: function() {},\n\t anon: true\n\t });\n\t }\n\t });\n\t\n\t if (webhooks_menu.length > 0) {\n\t webhooks_menu.unshift({\n\t html: _l('Webhooks'),\n\t header: true\n\t });\n\t $.merge(menu, webhooks_menu);\n\t }\n\t }\n\t });\n\t\n\t function buildMenu(isAnon, purgeAllowed, urlRoot) {\n\t return _.clone(menu).filter(function (menuOption) {\n\t if (isAnon && !menuOption.anon) {\n\t return false;\n\t }\n\t if (!purgeAllowed && menuOption.purge) {\n\t return false;\n\t }\n\t\n\t //TODO:?? hard-coded galaxy_main\n\t if (menuOption.href) {\n\t menuOption.href = urlRoot + menuOption.href;\n\t menuOption.target = menuOption.target || 'galaxy_main';\n\t }\n\t\n\t if (menuOption.confirm) {\n\t menuOption.func = function () {\n\t if (confirm(menuOption.confirm)) {\n\t galaxy_main.location = menuOption.href;\n\t }\n\t };\n\t }\n\t return true;\n\t });\n\t }\n\t\n\t var create = function ($button, options) {\n\t options = options || {};\n\t var isAnon = options.anonymous === undefined ? true : options.anonymous,\n\t purgeAllowed = options.purgeAllowed || false,\n\t menu = buildMenu(isAnon, purgeAllowed, Galaxy.root);\n\t //console.debug( 'menu:', menu );\n\t return new PopupMenu($button, menu);\n\t };\n\t\n\t // ============================================================================\n\t return create;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 136 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** Renders the collection uploader rows */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(43), __webpack_require__(70), __webpack_require__(21), __webpack_require__(22)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, UploadModel, UploadSettings, Popover, Select) {\n\t return Backbone.View.extend({\n\t /** Dictionary of upload states and associated icons */\n\t status_classes: {\n\t init: 'upload-icon-button fa fa-trash-o',\n\t queued: 'upload-icon fa fa-spinner fa-spin',\n\t running: 'upload-icon fa fa-spinner fa-spin',\n\t success: 'upload-icon-button fa fa-check',\n\t error: 'upload-icon-button fa fa-exclamation-triangle'\n\t },\n\t\n\t initialize: function (app, options) {\n\t var self = this;\n\t this.app = app;\n\t this.model = options.model;\n\t this.setElement(this._template(options.model));\n\t this.$mode = this.$('.upload-mode');\n\t this.$title = this.$('.upload-title-extended');\n\t this.$text = this.$('.upload-text');\n\t this.$size = this.$('.upload-size');\n\t this.$info_text = this.$('.upload-info-text');\n\t this.$info_progress = this.$('.upload-info-progress');\n\t this.$text_content = this.$('.upload-text-content');\n\t this.$symbol = this.$('.upload-symbol');\n\t this.$progress_bar = this.$('.upload-progress-bar');\n\t this.$percentage = this.$('.upload-percentage');\n\t\n\t // append popup to settings icon\n\t this.settings = new Popover.View({\n\t title: 'Upload configuration',\n\t container: this.$('.upload-settings'),\n\t placement: 'bottom'\n\t });\n\t\n\t // identify default genome and extension values\n\t var default_genome = this.app.select_genome.value();\n\t var default_extension = this.app.select_extension.value();\n\t\n\t // handle click event\n\t this.$symbol.on('click', function () {\n\t self._removeRow();\n\t });\n\t\n\t // handle text editing event\n\t this.$text_content.on('change input', function (e) {\n\t self.model.set({ 'url_paste': $(e.target).val(),\n\t 'file_size': $(e.target).val().length });\n\t });\n\t\n\t // model events\n\t this.listenTo(this.model, 'change:percentage', function () {\n\t self._refreshPercentage();\n\t });\n\t this.listenTo(this.model, 'change:status', function () {\n\t self._refreshStatus();\n\t });\n\t this.listenTo(this.model, 'change:info', function () {\n\t self._refreshInfo();\n\t });\n\t this.listenTo(this.model, 'change:file_size', function () {\n\t self._refreshFileSize();\n\t });\n\t this.listenTo(this.model, 'remove', function () {\n\t self.remove();\n\t });\n\t this.app.collection.on('reset', function () {\n\t self.remove();\n\t });\n\t },\n\t\n\t render: function () {\n\t var options = this.model.attributes;\n\t this.$title.html(_.escape(options.file_name));\n\t this.$size.html(Utils.bytesToString(options.file_size));\n\t this.$mode.removeClass().addClass('upload-mode').addClass('text-primary');\n\t if (options.file_mode == 'new') {\n\t this.$text.css({ 'width': this.$el.width() - 16 + 'px', 'top': this.$el.height() - 8 + 'px' }).show();\n\t this.$el.height(this.$el.height() - 8 + this.$text.height() + 16);\n\t this.$mode.addClass('fa fa-edit');\n\t } else if (options.file_mode == 'local') {\n\t this.$mode.addClass('fa fa-laptop');\n\t } else if (options.file_mode == 'ftp') {\n\t this.$mode.addClass('fa fa-folder-open-o');\n\t }\n\t },\n\t\n\t /** Refresh info text */\n\t _refreshInfo: function () {\n\t var info = this.model.get('info');\n\t if (info) {\n\t this.$info_text.html('Failed: ' + info).show();\n\t } else {\n\t this.$info_text.hide();\n\t }\n\t },\n\t\n\t /** Refresh percentage status */\n\t _refreshPercentage: function () {\n\t var percentage = parseInt(this.model.get('percentage'));\n\t this.$progress_bar.css({ width: percentage + '%' });\n\t this.$percentage.html(percentage != 100 ? percentage + '%' : 'Adding to history...');\n\t },\n\t\n\t /** Refresh status */\n\t _refreshStatus: function () {\n\t var status = this.model.get('status');\n\t this.$symbol.removeClass().addClass('upload-symbol').addClass(this.status_classes[status]);\n\t this.model.set('enabled', status == 'init');\n\t var enabled = this.model.get('enabled');\n\t this.$text_content.attr('disabled', !enabled);\n\t if (status == 'success') {\n\t this.$el.addClass('success');\n\t this.$percentage.html('100%');\n\t }\n\t if (status == 'error') {\n\t this.$el.addClass('danger');\n\t this.$info_progress.hide();\n\t }\n\t },\n\t\n\t /** Refresh file size */\n\t _refreshFileSize: function () {\n\t this.$size.html(Utils.bytesToString(this.model.get('file_size')));\n\t },\n\t\n\t /** Remove row */\n\t _removeRow: function () {\n\t if (['init', 'success', 'error'].indexOf(this.model.get('status')) !== -1) {\n\t this.app.collection.remove(this.model);\n\t }\n\t },\n\t\n\t /** Attach file info popup */\n\t _showSettings: function () {\n\t if (!this.settings.visible) {\n\t this.settings.empty();\n\t this.settings.append(new UploadSettings(this).$el);\n\t this.settings.show();\n\t } else {\n\t this.settings.hide();\n\t }\n\t },\n\t\n\t /** View template */\n\t _template: function (options) {\n\t return '
                          ' + '' +\n '' +\n '' +\n '' +\n '' +\n '';\n },\n\n /** Template of table */\n _templateTable: function() {\n return 'Available files: ' +\n '' +\n '' +\n '  ' +\n '' +\n '' +\n '' +\n '
                          ').append($checkbox)).append($('').append(parameter.title)));\n\t });\n\t this.$cover[this.model.get('enabled') && 'hide' || 'show']();\n\t }\n\t });\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 71 */,\n/* 72 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(jQuery, _) {/*\n\t galaxy upload plugins - requires FormData and XMLHttpRequest\n\t*/\n\t;(function ($) {\n\t // add event properties\n\t jQuery.event.props.push(\"dataTransfer\");\n\t\n\t /**\n\t Posts file data to the API\n\t */\n\t $.uploadpost = function (config) {\n\t // parse options\n\t var cnf = $.extend({}, {\n\t data: {},\n\t success: function () {},\n\t error: function () {},\n\t progress: function () {},\n\t url: null,\n\t maxfilesize: 2048,\n\t error_filesize: 'File exceeds 2GB. Please use a FTP client.',\n\t error_default: 'Please make sure the file is available.',\n\t error_server: 'Upload request failed.',\n\t error_login: 'Uploads require you to log in.'\n\t }, config);\n\t\n\t // link data\n\t var data = cnf.data;\n\t\n\t // check errors\n\t if (data.error_message) {\n\t cnf.error(data.error_message);\n\t return;\n\t }\n\t\n\t // construct form data\n\t var form = new FormData();\n\t for (var key in data.payload) {\n\t form.append(key, data.payload[key]);\n\t }\n\t\n\t // add files to submission\n\t var sizes = 0;\n\t for (var key in data.files) {\n\t var d = data.files[key];\n\t form.append(d.name, d.file, d.file.name);\n\t sizes += d.file.size;\n\t }\n\t\n\t // check file size, unless it's an ftp file\n\t if (sizes > 1048576 * cnf.maxfilesize) {\n\t cnf.error(cnf.error_filesize);\n\t return;\n\t }\n\t\n\t // prepare request\n\t var xhr = new XMLHttpRequest();\n\t xhr.open('POST', cnf.url, true);\n\t xhr.setRequestHeader('Accept', 'application/json');\n\t xhr.setRequestHeader('Cache-Control', 'no-cache');\n\t xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\t\n\t // captures state changes\n\t xhr.onreadystatechange = function () {\n\t // check for request completed, server connection closed\n\t if (xhr.readyState == xhr.DONE) {\n\t // parse response\n\t var response = null;\n\t var extra_info = \"\";\n\t if (xhr.responseText) {\n\t try {\n\t response = jQuery.parseJSON(xhr.responseText);\n\t extra_info = response.err_msg;\n\t } catch (e) {\n\t response = xhr.responseText;\n\t extra_info = response;\n\t }\n\t }\n\t // pass any error to the error option\n\t if (xhr.status < 200 || xhr.status > 299) {\n\t var text = xhr.statusText;\n\t if (xhr.status == 403) {\n\t text = cnf.error_login;\n\t } else if (xhr.status == 0) {\n\t text = cnf.error_server;\n\t } else if (!text) {\n\t text = cnf.error_default;\n\t }\n\t cnf.error(text + ' (' + xhr.status + '). ' + extra_info);\n\t } else {\n\t cnf.success(response);\n\t }\n\t }\n\t };\n\t\n\t // prepare upload progress\n\t xhr.upload.addEventListener('progress', function (e) {\n\t if (e.lengthComputable) {\n\t cnf.progress(Math.round(e.loaded * 100 / e.total));\n\t }\n\t }, false);\n\t\n\t // send request\n\t Galaxy.emit.debug('uploadbox::uploadpost()', 'Posting following data.', cnf);\n\t xhr.send(form);\n\t };\n\t\n\t /**\n\t Handles the upload events drag/drop etc.\n\t */\n\t $.fn.uploadinput = function (options) {\n\t // initialize\n\t var el = this;\n\t var opts = $.extend({}, {\n\t ondragover: function () {},\n\t ondragleave: function () {},\n\t onchange: function () {},\n\t multiple: false\n\t }, options);\n\t\n\t // append hidden upload field\n\t var $input = $('');\n\t el.append($input.change(function (e) {\n\t opts.onchange(e.target.files);\n\t $(this).val('');\n\t }));\n\t\n\t // drag/drop events\n\t el.on('drop', function (e) {\n\t opts.ondragleave(e);\n\t if (e.dataTransfer) {\n\t opts.onchange(e.dataTransfer.files);\n\t e.preventDefault();\n\t }\n\t });\n\t el.on('dragover', function (e) {\n\t e.preventDefault();\n\t opts.ondragover(e);\n\t });\n\t el.on('dragleave', function (e) {\n\t e.stopPropagation();\n\t opts.ondragleave(e);\n\t });\n\t\n\t // exports\n\t return {\n\t dialog: function () {\n\t $input.trigger('click');\n\t }\n\t };\n\t };\n\t\n\t /**\n\t Handles the upload queue and events such as drag/drop etc.\n\t */\n\t $.fn.uploadbox = function (options) {\n\t // parse options\n\t var opts = $.extend({}, {\n\t dragover: function () {},\n\t dragleave: function () {},\n\t announce: function (d) {},\n\t initialize: function (d) {},\n\t progress: function (d, m) {},\n\t success: function (d, m) {},\n\t error: function (d, m) {\n\t alert(m);\n\t },\n\t complete: function () {}\n\t }, options);\n\t\n\t // file queue\n\t var queue = {};\n\t\n\t // queue index/length counter\n\t var queue_index = 0;\n\t var queue_length = 0;\n\t\n\t // indicates if queue is currently running\n\t var queue_running = false;\n\t var queue_stop = false;\n\t\n\t // element\n\t var uploadinput = $(this).uploadinput({\n\t multiple: true,\n\t onchange: function (files) {\n\t add(files);\n\t },\n\t ondragover: options.ondragover,\n\t ondragleave: options.ondragleave\n\t });\n\t\n\t // add new files to upload queue\n\t function add(files) {\n\t if (files && files.length && !queue_running) {\n\t var current_index = queue_index;\n\t _.each(files, function (file, key) {\n\t if (file.mode !== 'new' && _.filter(queue, function (f) {\n\t return f.name === file.name && f.size === file.size;\n\t }).length) {\n\t file.duplicate = true;\n\t }\n\t });\n\t _.each(files, function (file) {\n\t if (!file.duplicate) {\n\t var index = String(queue_index++);\n\t queue[index] = file;\n\t opts.announce(index, queue[index]);\n\t queue_length++;\n\t }\n\t });\n\t return current_index;\n\t }\n\t }\n\t\n\t // remove file from queue\n\t function remove(index) {\n\t if (queue[index]) {\n\t delete queue[index];\n\t queue_length--;\n\t }\n\t }\n\t\n\t // process an upload, recursive\n\t function process() {\n\t // validate\n\t if (queue_length == 0 || queue_stop) {\n\t queue_stop = false;\n\t queue_running = false;\n\t opts.complete();\n\t return;\n\t } else {\n\t queue_running = true;\n\t }\n\t\n\t // get an identifier from the queue\n\t var index = -1;\n\t for (var key in queue) {\n\t index = key;\n\t break;\n\t }\n\t\n\t // get current file from queue\n\t var file = queue[index];\n\t\n\t // remove from queue\n\t remove(index);\n\t\n\t // create and submit data\n\t $.uploadpost({\n\t url: opts.url,\n\t data: opts.initialize(index),\n\t success: function (message) {\n\t opts.success(index, message);process();\n\t },\n\t error: function (message) {\n\t opts.error(index, message);process();\n\t },\n\t progress: function (percentage) {\n\t opts.progress(index, percentage);\n\t }\n\t });\n\t }\n\t\n\t /*\n\t public interface\n\t */\n\t\n\t // open file browser for selection\n\t function select() {\n\t uploadinput.dialog();\n\t }\n\t\n\t // remove all entries from queue\n\t function reset(index) {\n\t for (index in queue) {\n\t remove(index);\n\t }\n\t }\n\t\n\t // initiate upload process\n\t function start() {\n\t if (!queue_running) {\n\t queue_running = true;\n\t process();\n\t }\n\t }\n\t\n\t // stop upload process\n\t function stop() {\n\t queue_stop = true;\n\t }\n\t\n\t // set options\n\t function configure(options) {\n\t opts = $.extend({}, opts, options);\n\t return opts;\n\t }\n\t\n\t // verify browser compatibility\n\t function compatible() {\n\t return window.File && window.FormData && window.XMLHttpRequest && window.FileList;\n\t }\n\t\n\t // export functions\n\t return {\n\t 'select': select,\n\t 'add': add,\n\t 'remove': remove,\n\t 'start': start,\n\t 'stop': stop,\n\t 'reset': reset,\n\t 'configure': configure,\n\t 'compatible': compatible\n\t };\n\t };\n\t})(jQuery);\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 73 */,\n/* 74 */,\n/* 75 */,\n/* 76 */,\n/* 77 */,\n/* 78 */,\n/* 79 */,\n/* 80 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(7), __webpack_require__(6), __webpack_require__(24)], __WEBPACK_AMD_DEFINE_RESULT__ = function (baseMVC, _l) {\n\t // =============================================================================\n\t /** A view on any model that has a 'annotation' attribute\n\t */\n\t var AnnotationEditor = Backbone.View.extend(baseMVC.LoggableMixin).extend(baseMVC.HiddenUntilActivatedViewMixin).extend({\n\t\n\t tagName: 'div',\n\t className: 'annotation-display',\n\t\n\t /** Set up listeners, parse options */\n\t initialize: function (options) {\n\t options = options || {};\n\t this.tooltipConfig = options.tooltipConfig || { placement: 'bottom' };\n\t //console.debug( this, options );\n\t // only listen to the model only for changes to annotations\n\t this.listenTo(this.model, 'change:annotation', function () {\n\t this.render();\n\t });\n\t this.hiddenUntilActivated(options.$activator, options);\n\t },\n\t\n\t /** Build the DOM elements, call select to on the created input, and set up behaviors */\n\t render: function () {\n\t var view = this;\n\t this.$el.html(this._template());\n\t\n\t //TODO: handle empties better\n\t this.$annotation().make_text_editable({\n\t use_textarea: true,\n\t on_finish: function (newAnnotation) {\n\t view.$annotation().text(newAnnotation);\n\t view.model.save({ annotation: newAnnotation }, { silent: true }).fail(function () {\n\t view.$annotation().text(view.model.previous('annotation'));\n\t });\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** @returns {String} the html text used to build the view's DOM */\n\t _template: function () {\n\t var annotation = this.model.get('annotation');\n\t return [\n\t //TODO: make prompt optional\n\t '',\n\t // set up initial tags by adding as CSV to input vals (necc. to init select2)\n\t '
                          ', _.escape(annotation), '
                          '].join('');\n\t },\n\t\n\t /** @returns {jQuery} the main element for this view */\n\t $annotation: function () {\n\t return this.$el.find('.annotation');\n\t },\n\t\n\t /** shut down event listeners and remove this view's DOM */\n\t remove: function () {\n\t this.$annotation.off();\n\t this.stopListening(this.model);\n\t Backbone.View.prototype.remove.call(this);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return ['AnnotationEditor(', this.model + '', ')'].join('');\n\t }\n\t });\n\t // =============================================================================\n\t return {\n\t AnnotationEditor: AnnotationEditor\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3)))\n\n/***/ },\n/* 81 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3), __webpack_require__(2), __webpack_require__(7)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_, Backbone, BASE_MVC) {\n\t 'use strict';\n\t\n\t //=============================================================================\n\t /**\n\t * A Collection that can be limited/offset/re-ordered/filtered.\n\t * @type {Backbone.Collection}\n\t */\n\t\n\t var ControlledFetchCollection = Backbone.Collection.extend({\n\t\n\t /** call setOrder on initialization to build the comparator based on options */\n\t initialize: function (models, options) {\n\t Backbone.Collection.prototype.initialize.call(this, models, options);\n\t this.setOrder(options.order || this.order, { silent: true });\n\t },\n\t\n\t /** set up to track order changes and re-sort when changed */\n\t _setUpListeners: function () {\n\t return this.on({\n\t 'changed-order': this.sort\n\t });\n\t },\n\t\n\t /** override to provide order and offsets based on instance vars, set limit if passed,\n\t * and set allFetched/fire 'all-fetched' when xhr returns\n\t */\n\t fetch: function (options) {\n\t options = this._buildFetchOptions(options);\n\t // console.log( 'fetch options:', options );\n\t return Backbone.Collection.prototype.fetch.call(this, options);\n\t },\n\t\n\t /** build ajax data/parameters from options */\n\t _buildFetchOptions: function (options) {\n\t // note: we normally want options passed in to override the defaults built here\n\t // so most of these fns will generate defaults\n\t options = _.clone(options) || {};\n\t var self = this;\n\t\n\t // jquery ajax option; allows multiple q/qv for filters (instead of 'q[]')\n\t options.traditional = true;\n\t\n\t // options.data\n\t // we keep limit, offset, etc. in options *as well as move it into data* because:\n\t // - it makes fetch calling convenient to add it to a single options map (instead of as mult. args)\n\t // - it allows the std. event handlers (for fetch, etc.) to have access\n\t // to the pagination options too\n\t // (i.e. this.on( 'sync', function( options ){ if( options.limit ){ ... } }))\n\t // however, when we send to xhr/jquery we copy them to data also so that they become API query params\n\t options.data = options.data || self._buildFetchData(options);\n\t // console.log( 'data:', options.data );\n\t\n\t // options.data.filters --> options.data.q, options.data.qv\n\t var filters = this._buildFetchFilters(options);\n\t // console.log( 'filters:', filters );\n\t if (!_.isEmpty(filters)) {\n\t _.extend(options.data, this._fetchFiltersToAjaxData(filters));\n\t }\n\t // console.log( 'data:', options.data );\n\t return options;\n\t },\n\t\n\t /** Build the dictionary to send to fetch's XHR as data */\n\t _buildFetchData: function (options) {\n\t var defaults = {};\n\t if (this.order) {\n\t defaults.order = this.order;\n\t }\n\t return _.defaults(_.pick(options, this._fetchParams), defaults);\n\t },\n\t\n\t /** These attribute keys are valid params to fetch/API-index */\n\t _fetchParams: [\n\t /** model dependent string to control the order of models returned */\n\t 'order',\n\t /** limit the number of models returned from a fetch */\n\t 'limit',\n\t /** skip this number of models when fetching */\n\t 'offset',\n\t /** what series of attributes to return (model dependent) */\n\t 'view',\n\t /** individual keys to return for the models (see api/histories.index) */\n\t 'keys'],\n\t\n\t /** add any needed filters here based on collection state */\n\t _buildFetchFilters: function (options) {\n\t // override\n\t return _.clone(options.filters || {});\n\t },\n\t\n\t /** Convert dictionary filters to qqv style arrays */\n\t _fetchFiltersToAjaxData: function (filters) {\n\t // return as a map so ajax.data can extend from it\n\t var filterMap = {\n\t q: [],\n\t qv: []\n\t };\n\t _.each(filters, function (v, k) {\n\t // don't send if filter value is empty\n\t if (v === undefined || v === '') {\n\t return;\n\t }\n\t // json to python\n\t if (v === true) {\n\t v = 'True';\n\t }\n\t if (v === false) {\n\t v = 'False';\n\t }\n\t if (v === null) {\n\t v = 'None';\n\t }\n\t // map to k/v arrays (q/qv)\n\t filterMap.q.push(k);\n\t filterMap.qv.push(v);\n\t });\n\t return filterMap;\n\t },\n\t\n\t /** override to reset allFetched flag to false */\n\t reset: function (models, options) {\n\t this.allFetched = false;\n\t return Backbone.Collection.prototype.reset.call(this, models, options);\n\t },\n\t\n\t // ........................................................................ order\n\t order: null,\n\t\n\t /** @type {Object} map of collection available sorting orders containing comparator fns */\n\t comparators: {\n\t 'update_time': BASE_MVC.buildComparator('update_time', { ascending: false }),\n\t 'update_time-asc': BASE_MVC.buildComparator('update_time', { ascending: true }),\n\t 'create_time': BASE_MVC.buildComparator('create_time', { ascending: false }),\n\t 'create_time-asc': BASE_MVC.buildComparator('create_time', { ascending: true })\n\t },\n\t\n\t /** set the order and comparator for this collection then sort with the new order\n\t * @event 'changed-order' passed the new order and the collection\n\t */\n\t setOrder: function (order, options) {\n\t options = options || {};\n\t var collection = this;\n\t var comparator = collection.comparators[order];\n\t if (_.isUndefined(comparator)) {\n\t throw new Error('unknown order: ' + order);\n\t }\n\t // if( _.isUndefined( comparator ) ){ return; }\n\t if (comparator === collection.comparator) {\n\t return;\n\t }\n\t\n\t var oldOrder = collection.order;\n\t collection.order = order;\n\t collection.comparator = comparator;\n\t\n\t if (!options.silent) {\n\t collection.trigger('changed-order', options);\n\t }\n\t return collection;\n\t }\n\t\n\t });\n\t\n\t //=============================================================================\n\t /**\n\t *\n\t */\n\t var PaginatedCollection = ControlledFetchCollection.extend({\n\t\n\t /** @type {Number} limit used for each page's fetch */\n\t limitPerPage: 500,\n\t\n\t initialize: function (models, options) {\n\t ControlledFetchCollection.prototype.initialize.call(this, models, options);\n\t this.currentPage = options.currentPage || 0;\n\t },\n\t\n\t getTotalItemCount: function () {\n\t return this.length;\n\t },\n\t\n\t shouldPaginate: function () {\n\t return this.getTotalItemCount() >= this.limitPerPage;\n\t },\n\t\n\t getLastPage: function () {\n\t return Math.floor(this.getTotalItemCount() / this.limitPerPage);\n\t },\n\t\n\t getPageCount: function () {\n\t return this.getLastPage() + 1;\n\t },\n\t\n\t getPageLimitOffset: function (pageNum) {\n\t pageNum = this.constrainPageNum(pageNum);\n\t return {\n\t limit: this.limitPerPage,\n\t offset: pageNum * this.limitPerPage\n\t };\n\t },\n\t\n\t constrainPageNum: function (pageNum) {\n\t return Math.max(0, Math.min(pageNum, this.getLastPage()));\n\t },\n\t\n\t /** fetch the next page of data */\n\t fetchPage: function (pageNum, options) {\n\t var self = this;\n\t pageNum = self.constrainPageNum(pageNum);\n\t self.currentPage = pageNum;\n\t options = _.defaults(options || {}, self.getPageLimitOffset(pageNum));\n\t\n\t self.trigger('fetching-more');\n\t return self.fetch(options).always(function () {\n\t self.trigger('fetching-more-done');\n\t });\n\t },\n\t\n\t fetchCurrentPage: function (options) {\n\t return this.fetchPage(this.currentPage, options);\n\t },\n\t\n\t fetchPrevPage: function (options) {\n\t return this.fetchPage(this.currentPage - 1, options);\n\t },\n\t\n\t fetchNextPage: function (options) {\n\t return this.fetchPage(this.currentPage + 1, options);\n\t }\n\t });\n\t\n\t //=============================================================================\n\t /**\n\t * A Collection that will load more elements without reseting.\n\t */\n\t var InfinitelyScrollingCollection = ControlledFetchCollection.extend({\n\t\n\t /** @type {Number} limit used for the first fetch (or a reset) */\n\t limitOnFirstFetch: null,\n\t /** @type {Number} limit used for each subsequent fetch */\n\t limitPerFetch: 100,\n\t\n\t initialize: function (models, options) {\n\t ControlledFetchCollection.prototype.initialize.call(this, models, options);\n\t /** @type {Integer} number of contents to return from the first fetch */\n\t this.limitOnFirstFetch = options.limitOnFirstFetch || this.limitOnFirstFetch;\n\t /** @type {Integer} limit for every fetch after the first */\n\t this.limitPerFetch = options.limitPerFetch || this.limitPerFetch;\n\t /** @type {Boolean} are all contents fetched? */\n\t this.allFetched = false;\n\t /** @type {Integer} what was the offset of the last content returned */\n\t this.lastFetched = options.lastFetched || 0;\n\t },\n\t\n\t /** build ajax data/parameters from options */\n\t _buildFetchOptions: function (options) {\n\t // options (options for backbone.fetch and jquery.ajax generally)\n\t // backbone option; false here to make fetching an addititive process\n\t options.remove = options.remove || false;\n\t return ControlledFetchCollection.prototype._buildFetchOptions.call(this, options);\n\t },\n\t\n\t /** fetch the first 'page' of data */\n\t fetchFirst: function (options) {\n\t // console.log( 'ControlledFetchCollection.fetchFirst:', options );\n\t options = options ? _.clone(options) : {};\n\t this.allFetched = false;\n\t this.lastFetched = 0;\n\t return this.fetchMore(_.defaults(options, {\n\t reset: true,\n\t limit: this.limitOnFirstFetch\n\t }));\n\t },\n\t\n\t /** fetch the next page of data */\n\t fetchMore: function (options) {\n\t // console.log( 'ControlledFetchCollection.fetchMore:', options );\n\t options = _.clone(options || {});\n\t var collection = this;\n\t\n\t // console.log( 'fetchMore, options.reset:', options.reset );\n\t if (!options.reset && collection.allFetched) {\n\t return jQuery.when();\n\t }\n\t\n\t // TODO: this fails in the edge case where\n\t // the first fetch offset === limit (limit 4, offset 4, collection.length 4)\n\t options.offset = options.reset ? 0 : options.offset || collection.lastFetched;\n\t var limit = options.limit = options.limit || collection.limitPerFetch || null;\n\t // console.log( 'fetchMore, limit:', limit, 'offset:', options.offset );\n\t\n\t collection.trigger('fetching-more');\n\t return collection.fetch(options).always(function () {\n\t collection.trigger('fetching-more-done');\n\t })\n\t // maintain allFetched flag and trigger if all were fetched this time\n\t .done(function _postFetchMore(fetchedData) {\n\t var numFetched = _.isArray(fetchedData) ? fetchedData.length : 0;\n\t collection.lastFetched += numFetched;\n\t // console.log( 'fetchMore, lastFetched:', collection.lastFetched );\n\t // anything less than a full page means we got all there is to get\n\t if (!limit || numFetched < limit) {\n\t collection.allFetched = true;\n\t collection.trigger('all-fetched', this);\n\t }\n\t });\n\t },\n\t\n\t /** fetch all the collection */\n\t fetchAll: function (options) {\n\t // whitelist options to prevent allowing limit/offset/filters\n\t // (use vanilla fetch instead)\n\t options = options || {};\n\t var self = this;\n\t options = _.pick(options, 'silent');\n\t options.filters = {};\n\t return self.fetch(options).done(function (fetchData) {\n\t self.allFetched = true;\n\t self.trigger('all-fetched', self);\n\t });\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t ControlledFetchCollection: ControlledFetchCollection,\n\t PaginatedCollection: PaginatedCollection,\n\t InfinitelyScrollingCollection: InfinitelyScrollingCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 82 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t\n\t /* For presentation-related functionality shared across collection creators.\n\t Particularily overlapping functionality related to name processing and help.\n\t */\n\t var CollectionCreatorMixin = {\n\t\n\t /** add (or clear if clear is truthy) a validation warning to the DOM element described in what */\n\t _validationWarning: function (what, clear) {\n\t var VALIDATION_CLASS = 'validation-warning';\n\t if (what === 'name') {\n\t what = this.$('.collection-name').add(this.$('.collection-name-prompt'));\n\t this.$('.collection-name').focus().select();\n\t }\n\t if (clear) {\n\t what = what || this.$('.' + VALIDATION_CLASS);\n\t what.removeClass(VALIDATION_CLASS);\n\t } else {\n\t what.addClass(VALIDATION_CLASS);\n\t }\n\t },\n\t\n\t _changeHideOriginals: function (ev) {\n\t this.hideOriginals = this.$('.hide-originals').prop(\"checked\");\n\t },\n\t\n\t // ........................................................................ footer\n\t /** handle a collection name change */\n\t _changeName: function (ev) {\n\t this._validationWarning('name', !!this._getName());\n\t },\n\t\n\t /** check for enter key press when in the collection name and submit */\n\t _nameCheckForEnter: function (ev) {\n\t if (ev.keyCode === 13 && !this.blocking) {\n\t this._clickCreate();\n\t }\n\t },\n\t\n\t /** get the current collection name */\n\t _getName: function () {\n\t return _.escape(this.$('.collection-name').val());\n\t },\n\t\n\t // ........................................................................ header\n\t /** expand help */\n\t _clickMoreHelp: function (ev) {\n\t ev.stopPropagation();\n\t this.$('.main-help').addClass('expanded');\n\t this.$('.more-help').hide();\n\t },\n\t /** collapse help */\n\t _clickLessHelp: function (ev) {\n\t ev.stopPropagation();\n\t this.$('.main-help').removeClass('expanded');\n\t this.$('.more-help').show();\n\t },\n\t /** toggle help */\n\t _toggleHelp: function (ev) {\n\t ev.stopPropagation();\n\t this.$('.main-help').toggleClass('expanded');\n\t this.$('.more-help').toggle();\n\t },\n\t\n\t /** show an alert on the top of the interface containing message (alertClass is bootstrap's alert-*) */\n\t _showAlert: function (message, alertClass) {\n\t alertClass = alertClass || 'alert-danger';\n\t this.$('.main-help').hide();\n\t this.$('.header .alert').attr('class', 'alert alert-dismissable').addClass(alertClass).show().find('.alert-message').html(message);\n\t },\n\t /** hide the alerts at the top */\n\t _hideAlert: function (message) {\n\t this.$('.main-help').show();\n\t this.$('.header .alert').hide();\n\t },\n\t\n\t _cancelCreate: function (ev) {\n\t if (typeof this.oncancel === 'function') {\n\t this.oncancel.call(this);\n\t }\n\t },\n\t\n\t /** attempt to create the current collection */\n\t _clickCreate: function (ev) {\n\t var name = this._getName();\n\t if (!name) {\n\t this._validationWarning('name');\n\t } else if (!this.blocking) {\n\t this.createList(name);\n\t }\n\t },\n\t\n\t _setUpCommonSettings: function (attributes) {\n\t this.hideOriginals = attributes.defaultHideSourceItems || false;\n\t },\n\t\n\t /** render the footer, completion controls, and cancel controls */\n\t _renderFooter: function (speed, callback) {\n\t var instance = this;\n\t var $footer = this.$('.footer').empty().html(this.templates.footer());\n\t _.each(this.footerSettings, function (property, selector) {\n\t this.$(selector).prop('checked', instance[property]);\n\t });\n\t if (typeof this.oncancel === 'function') {\n\t this.$('.cancel-create.btn').show();\n\t }\n\t return $footer;\n\t },\n\t\n\t _creatorTemplates: {\n\t main: _.template(['
                          ', '
                          ', '
                          '].join(''))\n\t }\n\t\n\t };\n\t\n\t //==============================================================================\n\t return {\n\t CollectionCreatorMixin: CollectionCreatorMixin\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 83 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(91), __webpack_require__(59), __webpack_require__(58), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_VIEW, DC_MODEL, DC_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t /** @class non-editable, read-only View/Controller for a dataset collection.\n\t */\n\t var _super = LIST_VIEW.ModelListPanel;\n\t var CollectionView = _super.extend(\n\t /** @lends CollectionView.prototype */{\n\t //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n\t _logNamespace: logNamespace,\n\t\n\t className: _super.prototype.className + ' dataset-collection-panel',\n\t\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView,\n\t /** key of attribute in model to assign to this.collection */\n\t modelCollectionKey: 'elements',\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes optional settings for the panel\n\t */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t\n\t this.hasUser = attributes.hasUser;\n\t /** A stack of panels that currently cover or hide this panel */\n\t this.panelStack = [];\n\t /** The text of the link to go back to the panel containing this one */\n\t this.parentName = attributes.parentName;\n\t /** foldout or drilldown */\n\t this.foldoutStyle = attributes.foldoutStyle || 'foldout';\n\t this.downloadUrl = this.model.attributes.url + '/download';\n\t },\n\t\n\t _queueNewRender: function ($newRender, speed) {\n\t speed = speed === undefined ? this.fxSpeed : speed;\n\t var panel = this;\n\t panel.log('_queueNewRender:', $newRender, speed);\n\t\n\t // TODO: jquery@1.12 doesn't change display when the elem has display: flex\n\t // this causes display: block for those elems after the use of show/hide animations\n\t // animations are removed from this view for now until fixed\n\t panel._swapNewRender($newRender);\n\t panel.trigger('rendered', panel);\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** In this override, use model.getVisibleContents */\n\t _filterCollection: function () {\n\t //TODO: should *not* be model.getVisibleContents - visibility is not model related\n\t return this.model.getVisibleContents();\n\t },\n\t\n\t /** override to return proper view class based on element_type */\n\t _getItemViewClass: function (model) {\n\t //this.debug( this + '._getItemViewClass:', model );\n\t //TODO: subclasses use DCEViewClass - but are currently unused - decide\n\t switch (model.get('element_type')) {\n\t case 'hda':\n\t return this.DatasetDCEViewClass;\n\t case 'dataset_collection':\n\t return this.NestedDCDCEViewClass;\n\t }\n\t throw new TypeError('Unknown element type:', model.get('element_type'));\n\t },\n\t\n\t /** override to add link target and anon */\n\t _getItemViewOptions: function (model) {\n\t var options = _super.prototype._getItemViewOptions.call(this, model);\n\t return _.extend(options, {\n\t linkTarget: this.linkTarget,\n\t hasUser: this.hasUser,\n\t //TODO: could move to only nested: list:paired\n\t foldoutStyle: this.foldoutStyle\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ collection sub-views\n\t /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t _super.prototype._setUpItemViewListeners.call(panel, view);\n\t\n\t // use pub-sub to: handle drilldown expansion and collapse\n\t panel.listenTo(view, {\n\t 'expanded:drilldown': function (v, drilldown) {\n\t this._expandDrilldownPanel(drilldown);\n\t },\n\t 'collapsed:drilldown': function (v, drilldown) {\n\t this._collapseDrilldownPanel(drilldown);\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n\t _expandDrilldownPanel: function (drilldown) {\n\t this.panelStack.push(drilldown);\n\t // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n\t this.$('> .controls').add(this.$list()).hide();\n\t drilldown.parentName = this.model.get('name');\n\t this.$el.append(drilldown.render().$el);\n\t },\n\t\n\t /** Handle drilldown close by freeing the panel and re-rendering this panel */\n\t _collapseDrilldownPanel: function (drilldown) {\n\t this.panelStack.pop();\n\t this.render();\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: {\n\t 'click .navigation .back': 'close'\n\t },\n\t\n\t /** close/remove this collection panel */\n\t close: function (event) {\n\t this.remove();\n\t this.trigger('close');\n\t },\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'CollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t CollectionView.prototype.templates = function () {\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
                          ', '', '
                          ', '
                          <%- collection.name || collection.element_identifier %>
                          ', '
                          ', '<% if( collection.collection_type === \"list\" ){ %>', _l('a list of datasets'), '<% } else if( collection.collection_type === \"paired\" ){ %>', _l('a pair of datasets'), '<% } else if( collection.collection_type === \"list:paired\" ){ %>', _l('a list of paired datasets'), '<% } else if( collection.collection_type === \"list:list\" ){ %>', _l('a list of dataset lists'), '<% } %>', '
                          ', '
                          ', '
                          ', '', '
                          '], 'collection');\n\t\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t controls: controlsTemplate\n\t });\n\t }();\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var ListCollectionView = CollectionView.extend(\n\t /** @lends ListCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var PairCollectionView = ListCollectionView.extend(\n\t /** @lends PairCollectionView.prototype */{\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'PairCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var ListOfPairsCollectionView = CollectionView.extend(\n\t /** @lends ListOfPairsCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n\t foldoutPanelClass: PairCollectionView\n\t }),\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfPairsCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\n\t var ListOfListsCollectionView = CollectionView.extend({\n\t\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n\t foldoutPanelClass: PairCollectionView\n\t }),\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfListsCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t CollectionView: CollectionView,\n\t ListCollectionView: ListCollectionView,\n\t PairCollectionView: PairCollectionView,\n\t ListOfPairsCollectionView: ListOfPairsCollectionView,\n\t ListOfListsCollectionView: ListOfListsCollectionView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 84 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(61), __webpack_require__(45), __webpack_require__(80), __webpack_require__(25), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, DATASET_LI, TAGS, ANNOTATIONS, faIconButton, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t //==============================================================================\n\t\n\t var _super = DATASET_LI.DatasetListItemView;\n\t /** @class Editing view for DatasetAssociation.\n\t */\n\t var DatasetListItemEdit = _super.extend(\n\t /** @lends DatasetListItemEdit.prototype */{\n\t\n\t /** set up: options */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t this.hasUser = attributes.hasUser;\n\t\n\t /** allow user purge of dataset files? */\n\t this.purgeAllowed = attributes.purgeAllowed || false;\n\t\n\t //TODO: move to HiddenUntilActivatedViewMixin\n\t /** should the tags editor be shown or hidden initially? */\n\t this.tagsEditorShown = attributes.tagsEditorShown || false;\n\t /** should the tags editor be shown or hidden initially? */\n\t this.annotationEditorShown = attributes.annotationEditorShown || false;\n\t },\n\t\n\t // ......................................................................... titlebar actions\n\t /** In this override, add the other two primary actions: edit and delete */\n\t _renderPrimaryActions: function () {\n\t var actions = _super.prototype._renderPrimaryActions.call(this);\n\t if (this.model.get('state') === STATES.NOT_VIEWABLE) {\n\t return actions;\n\t }\n\t // render the display, edit attr and delete icon-buttons\n\t return _super.prototype._renderPrimaryActions.call(this).concat([this._renderEditButton(), this._renderDeleteButton()]);\n\t },\n\t\n\t //TODO: move titleButtons into state renderers, remove state checks in the buttons\n\t\n\t /** Render icon-button to edit the attributes (format, permissions, etc.) this dataset. */\n\t _renderEditButton: function () {\n\t // don't show edit while uploading, in-accessible\n\t // DO show if in error (ala previous history panel)\n\t if (this.model.get('state') === STATES.DISCARDED || !this.model.get('accessible')) {\n\t return null;\n\t }\n\t\n\t var purged = this.model.get('purged'),\n\t deleted = this.model.get('deleted'),\n\t editBtnData = {\n\t title: _l('Edit attributes'),\n\t href: Galaxy.root + 'datasets/edit?dataset_id=' + this.model.attributes.id,\n\t faIcon: 'fa-pencil',\n\t classes: 'edit-btn'\n\t };\n\t // disable if purged or deleted and explain why in the tooltip\n\t if (deleted || purged) {\n\t editBtnData.disabled = true;\n\t if (purged) {\n\t editBtnData.title = _l('Cannot edit attributes of datasets removed from disk');\n\t } else if (deleted) {\n\t editBtnData.title = _l('Undelete dataset to edit attributes');\n\t }\n\t\n\t // disable if still uploading or new\n\t } else if (_.contains([STATES.UPLOAD, STATES.NEW], this.model.get('state'))) {\n\t editBtnData.disabled = true;\n\t editBtnData.title = _l('This dataset is not yet editable');\n\t }\n\t return faIconButton(editBtnData);\n\t },\n\t\n\t /** Render icon-button to delete this hda. */\n\t _renderDeleteButton: function () {\n\t // don't show delete if...\n\t if (!this.model.get('accessible')) {\n\t return null;\n\t }\n\t\n\t var self = this,\n\t deletedAlready = this.model.isDeletedOrPurged();\n\t return faIconButton({\n\t title: !deletedAlready ? _l('Delete') : _l('Dataset is already deleted'),\n\t disabled: deletedAlready,\n\t faIcon: 'fa-times',\n\t classes: 'delete-btn',\n\t onclick: function () {\n\t // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n\t self.$el.find('.icon-btn.delete-btn').trigger('mouseout');\n\t self.model['delete']();\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... details\n\t /** In this override, add tags and annotations controls, make the ? dbkey a link to editing page */\n\t _renderDetails: function () {\n\t //TODO: generalize to be allow different details for each state\n\t var $details = _super.prototype._renderDetails.call(this),\n\t state = this.model.get('state');\n\t\n\t if (!this.model.isDeletedOrPurged() && _.contains([STATES.OK, STATES.FAILED_METADATA], state)) {\n\t this._renderTags($details);\n\t this._renderAnnotation($details);\n\t this._makeDbkeyEditLink($details);\n\t }\n\t\n\t this._setUpBehaviors($details);\n\t return $details;\n\t },\n\t\n\t /**************************************************************************\n\t * Render help button to show tool help text without rerunning the tool.\n\t * Issue #2100\n\t */\n\t _renderToolHelpButton: function () {\n\t var datasetID = this.model.attributes.dataset_id;\n\t var jobID = this.model.attributes.creating_job;\n\t var self = this;\n\t\n\t var parseToolBuild = function (data) {\n\t var helpString = '
                          ';\n\t if (data.name && data.help) {\n\t helpString += 'Tool help for ' + data.name + '
                          ';\n\t helpString += data.help;\n\t } else {\n\t helpString += 'Tool help is unavailable for this dataset.
                          ';\n\t }\n\t helpString += '
                          ';\n\t self.$el.find('.details').append($.parseHTML(helpString));\n\t };\n\t var parseToolID = function (data) {\n\t $.ajax({\n\t url: Galaxy.root + 'api/tools/' + data.tool_id + '/build'\n\t }).done(function (data) {\n\t parseToolBuild(data);\n\t }).fail(function () {\n\t parseToolBuild({});\n\t });\n\t };\n\t if (Galaxy.user.id === null) {\n\t return null;\n\t }\n\t return faIconButton({\n\t title: _l('Tool Help'),\n\t classes: 'icon-btn',\n\t href: '#',\n\t faIcon: 'fa-question',\n\t onclick: function () {\n\t var divString = 'thdiv-' + datasetID;\n\t if (self.$el.find(\".toolhelp\").length > 0) {\n\t self.$el.find(\".toolhelp\").toggle();\n\t } else {\n\t $.ajax({\n\t url: Galaxy.root + 'api/jobs/' + jobID\n\t }).done(function (data) {\n\t parseToolID(data);\n\t }).fail(function () {\n\t console.log('Failed at recovering job information from the Galaxy API for job id \"' + jobID + '\".');\n\t });\n\t }\n\t }\n\t });\n\t },\n\t //*************************************************************************\n\t\n\t /** Add less commonly used actions in the details section based on state */\n\t _renderSecondaryActions: function () {\n\t var actions = _super.prototype._renderSecondaryActions.call(this);\n\t switch (this.model.get('state')) {\n\t case STATES.UPLOAD:\n\t case STATES.NOT_VIEWABLE:\n\t return actions;\n\t case STATES.ERROR:\n\t // error button comes first\n\t actions.unshift(this._renderErrButton());\n\t return actions.concat([this._renderRerunButton(), this._renderToolHelpButton()]);\n\t case STATES.OK:\n\t case STATES.FAILED_METADATA:\n\t return actions.concat([this._renderRerunButton(), this._renderVisualizationsButton(), this._renderToolHelpButton()]);\n\t }\n\t return actions.concat([this._renderRerunButton(), this._renderToolHelpButton()]);\n\t },\n\t\n\t /** Render icon-button to report an error on this dataset to the galaxy admin. */\n\t _renderErrButton: function () {\n\t return faIconButton({\n\t title: _l('View or report this error'),\n\t href: Galaxy.root + 'datasets/error?dataset_id=' + this.model.attributes.id,\n\t classes: 'report-error-btn',\n\t faIcon: 'fa-bug'\n\t });\n\t },\n\t\n\t /** Render icon-button to re-run the job that created this dataset. */\n\t _renderRerunButton: function () {\n\t var creating_job = this.model.get('creating_job');\n\t if (this.model.get('rerunnable')) {\n\t return faIconButton({\n\t title: _l('Run this job again'),\n\t href: this.model.urls.rerun,\n\t classes: 'rerun-btn',\n\t target: this.linkTarget,\n\t faIcon: 'fa-refresh',\n\t onclick: function (ev) {\n\t ev.preventDefault();\n\t Galaxy.router.push('/', { job_id: creating_job });\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** Render an icon-button or popupmenu of links based on the applicable visualizations */\n\t _renderVisualizationsButton: function () {\n\t //TODO: someday - lazyload visualizations\n\t var visualizations = this.model.get('visualizations');\n\t if (this.model.isDeletedOrPurged() || !this.hasUser || !this.model.hasData() || _.isEmpty(visualizations)) {\n\t return null;\n\t }\n\t if (!_.isObject(visualizations[0])) {\n\t this.warn('Visualizations have been switched off');\n\t return null;\n\t }\n\t\n\t var $visualizations = $(this.templates.visualizations(visualizations, this));\n\t //HACK: need to re-write those directed at galaxy_main with linkTarget\n\t $visualizations.find('[target=\"galaxy_main\"]').attr('target', this.linkTarget);\n\t // use addBack here to include the root $visualizations elem (for the case of 1 visualization)\n\t this._addScratchBookFn($visualizations.find('.visualization-link').addBack('.visualization-link'));\n\t return $visualizations;\n\t },\n\t\n\t /** add scratchbook functionality to visualization links */\n\t _addScratchBookFn: function ($links) {\n\t var li = this;\n\t $links.click(function (ev) {\n\t if (Galaxy.frame && Galaxy.frame.active) {\n\t Galaxy.frame.add({\n\t title: 'Visualization',\n\t url: $(this).attr('href')\n\t });\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t }\n\t });\n\t },\n\t\n\t //TODO: if possible move these to readonly view - but display the owner's tags/annotation (no edit)\n\t /** Render the tags list/control */\n\t _renderTags: function ($where) {\n\t if (!this.hasUser) {\n\t return;\n\t }\n\t var view = this;\n\t this.tagsEditor = new TAGS.TagsEditor({\n\t model: this.model,\n\t el: $where.find('.tags-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow: function () {\n\t view.tagsEditorShown = true;\n\t },\n\t onhide: function () {\n\t view.tagsEditorShown = false;\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit dataset tags'),\n\t classes: 'tag-btn',\n\t faIcon: 'fa-tags'\n\t }).appendTo($where.find('.actions .right'))\n\t });\n\t if (this.tagsEditorShown) {\n\t this.tagsEditor.toggle(true);\n\t }\n\t },\n\t\n\t /** Render the annotation display/control */\n\t _renderAnnotation: function ($where) {\n\t if (!this.hasUser) {\n\t return;\n\t }\n\t var view = this;\n\t this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n\t model: this.model,\n\t el: $where.find('.annotation-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow: function () {\n\t view.annotationEditorShown = true;\n\t },\n\t onhide: function () {\n\t view.annotationEditorShown = false;\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit dataset annotation'),\n\t classes: 'annotate-btn',\n\t faIcon: 'fa-comment'\n\t }).appendTo($where.find('.actions .right'))\n\t });\n\t if (this.annotationEditorShown) {\n\t this.annotationEditor.toggle(true);\n\t }\n\t },\n\t\n\t /** If the format/dbkey/genome_build isn't set, make the display a link to the edit page */\n\t _makeDbkeyEditLink: function ($details) {\n\t // make the dbkey a link to editing\n\t if (this.model.get('metadata_dbkey') === '?' && !this.model.isDeletedOrPurged()) {\n\t var editableDbkey = $('?').attr('href', this.model.urls.edit).attr('target', this.linkTarget);\n\t $details.find('.dbkey .value').replaceWith(editableDbkey);\n\t }\n\t },\n\t\n\t // ......................................................................... events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .undelete-link': '_clickUndeleteLink',\n\t 'click .purge-link': '_clickPurgeLink',\n\t\n\t 'click .edit-btn': function (ev) {\n\t this.trigger('edit', this, ev);\n\t },\n\t 'click .delete-btn': function (ev) {\n\t this.trigger('delete', this, ev);\n\t },\n\t 'click .rerun-btn': function (ev) {\n\t this.trigger('rerun', this, ev);\n\t },\n\t 'click .report-err-btn': function (ev) {\n\t this.trigger('report-err', this, ev);\n\t },\n\t 'click .visualization-btn': function (ev) {\n\t this.trigger('visualize', this, ev);\n\t },\n\t 'click .dbkey a': function (ev) {\n\t this.trigger('edit', this, ev);\n\t }\n\t }),\n\t\n\t /** listener for item undelete (in the messages section) */\n\t _clickUndeleteLink: function (ev) {\n\t this.model.undelete();\n\t return false;\n\t },\n\t\n\t /** listener for item purge (in the messages section) */\n\t _clickPurgeLink: function (ev) {\n\t if (confirm(_l('This will permanently remove the data in your dataset. Are you sure?'))) {\n\t this.model.purge();\n\t }\n\t return false;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** string rep */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDAEditView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetListItemEdit.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t failed_metadata: BASE_MVC.wrapTemplate([\n\t // in this override, provide a link to the edit page\n\t '<% if( dataset.state === \"failed_metadata\" ){ %>', '', '<% } %>'], 'dataset'),\n\t\n\t deleted: BASE_MVC.wrapTemplate([\n\t // in this override, provide links to undelete or purge the dataset\n\t '<% if( dataset.deleted && !dataset.purged ){ %>',\n\t // deleted not purged\n\t '
                          ', _l('This dataset has been deleted'), '
                          ', _l('Undelete it'), '', '<% if( view.purgeAllowed ){ %>', '
                          ', _l('Permanently remove it from disk'), '', '<% } %>', '
                          ', '<% } %>'], 'dataset')\n\t });\n\t\n\t var visualizationsTemplate = BASE_MVC.wrapTemplate(['<% if( visualizations.length === 1 ){ %>', '\"', ' target=\"<%- visualizations[0].target %>\" title=\"', _l('Visualize in'), ' <%- visualizations[0].html %>\">', '', '', '<% } else { %>', '
                          ', '', '', '', '', '
                          ', '<% } %>'], 'visualizations');\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t warnings: warnings,\n\t visualizations: visualizationsTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t DatasetListItemEdit: DatasetListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 85 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t var logNamespace = 'dataset';\n\t //==============================================================================\n\t var searchableMixin = BASE_MVC.SearchableModelMixin;\n\t /** @class base model for any DatasetAssociation (HDAs, LDDAs, DatasetCollectionDAs).\n\t * No knowledge of what type (HDA/LDDA/DCDA) should be needed here.\n\t * The DA's are made searchable (by attribute) by mixing in SearchableModelMixin.\n\t */\n\t var DatasetAssociation = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(BASE_MVC.mixin(searchableMixin, /** @lends DatasetAssociation.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t /** default attributes for a model */\n\t defaults: {\n\t state: STATES.NEW,\n\t deleted: false,\n\t purged: false,\n\t name: '(unnamed dataset)',\n\t accessible: true,\n\t // sniffed datatype (sam, tabular, bed, etc.)\n\t data_type: '',\n\t file_ext: '',\n\t file_size: 0,\n\t\n\t // array of associated file types (eg. [ 'bam_index', ... ])\n\t meta_files: [],\n\t\n\t misc_blurb: '',\n\t misc_info: '',\n\t\n\t tags: []\n\t // do NOT default on annotation, as this default is valid and will be passed on 'save'\n\t // which is incorrect behavior when the model is only partially fetched (annos are not passed in summary data)\n\t //annotation : ''\n\t },\n\t\n\t /** instance vars and listeners */\n\t initialize: function (attributes, options) {\n\t this.debug(this + '(Dataset).initialize', attributes, options);\n\t\n\t //!! this state is not in trans.app.model.Dataset.states - set it here -\n\t if (!this.get('accessible')) {\n\t this.set('state', STATES.NOT_VIEWABLE);\n\t }\n\t\n\t /** Datasets rely/use some web controllers - have the model generate those URLs on startup */\n\t this.urls = this._generateUrls();\n\t\n\t this._setUpListeners();\n\t },\n\t\n\t /** returns misc. web urls for rendering things like re-run, display, etc. */\n\t _generateUrls: function () {\n\t var id = this.get('id');\n\t if (!id) {\n\t return {};\n\t }\n\t var urls = {\n\t 'purge': 'datasets/' + id + '/purge_async',\n\t 'display': 'datasets/' + id + '/display/?preview=True',\n\t 'edit': 'datasets/' + id + '/edit',\n\t 'download': 'datasets/' + id + '/display' + this._downloadQueryParameters(),\n\t 'report_error': 'dataset/errors?id=' + id,\n\t 'rerun': 'tool_runner/rerun?id=' + id,\n\t 'show_params': 'datasets/' + id + '/show_params',\n\t 'visualization': 'visualization',\n\t 'meta_download': 'dataset/get_metadata_file?hda_id=' + id + '&metadata_name='\n\t };\n\t _.each(urls, function (value, key) {\n\t urls[key] = Galaxy.root + value;\n\t });\n\t this.urls = urls;\n\t return urls;\n\t },\n\t\n\t _downloadQueryParameters: function () {\n\t return '?to_ext=' + this.get('file_ext');\n\t },\n\t\n\t /** set up any event listeners\n\t * event: state:ready fired when this DA moves into/is already in a ready state\n\t */\n\t _setUpListeners: function () {\n\t // if the state has changed and the new state is a ready state, fire an event\n\t this.on('change:state', function (currModel, newState) {\n\t this.log(this + ' has changed state:', currModel, newState);\n\t if (this.inReadyState()) {\n\t this.trigger('state:ready', currModel, newState, this.previous('state'));\n\t }\n\t });\n\t // the download url (currently) relies on having a correct file extension\n\t this.on('change:id change:file_ext', function (currModel) {\n\t this._generateUrls();\n\t });\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** override to add urls */\n\t toJSON: function () {\n\t var json = Backbone.Model.prototype.toJSON.call(this);\n\t //console.warn( 'returning json?' );\n\t //return json;\n\t return _.extend(json, {\n\t urls: this.urls\n\t });\n\t },\n\t\n\t /** Is this dataset deleted or purged? */\n\t isDeletedOrPurged: function () {\n\t return this.get('deleted') || this.get('purged');\n\t },\n\t\n\t /** Is this dataset in a 'ready' state; where 'Ready' states are states where no\n\t * processing (for the ds) is left to do on the server.\n\t */\n\t inReadyState: function () {\n\t var ready = _.contains(STATES.READY_STATES, this.get('state'));\n\t return this.isDeletedOrPurged() || ready;\n\t },\n\t\n\t /** Does this model already contain detailed data (as opposed to just summary level data)? */\n\t hasDetails: function () {\n\t // if it's inaccessible assume it has everything it needs\n\t if (!this.get('accessible')) {\n\t return true;\n\t }\n\t return this.has('annotation');\n\t },\n\t\n\t /** Convenience function to match dataset.has_data. */\n\t hasData: function () {\n\t return this.get('file_size') > 0;\n\t },\n\t\n\t // ........................................................................ ajax\n\t fetch: function (options) {\n\t var dataset = this;\n\t return Backbone.Model.prototype.fetch.call(this, options).always(function () {\n\t dataset._generateUrls();\n\t });\n\t },\n\t\n\t /** override to use actual Dates objects for create/update times */\n\t parse: function (response, options) {\n\t var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n\t if (parsed.create_time) {\n\t parsed.create_time = new Date(parsed.create_time);\n\t }\n\t if (parsed.update_time) {\n\t parsed.update_time = new Date(parsed.update_time);\n\t }\n\t return parsed;\n\t },\n\t\n\t /** override to wait by default */\n\t save: function (attrs, options) {\n\t options = options || {};\n\t options.wait = _.isUndefined(options.wait) ? true : options.wait;\n\t return Backbone.Model.prototype.save.call(this, attrs, options);\n\t },\n\t\n\t //NOTE: subclasses of DA's will need to implement url and urlRoot in order to have these work properly\n\t /** save this dataset, _Mark_ing it as deleted (just a flag) */\n\t 'delete': function (options) {\n\t if (this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true }, options);\n\t },\n\t /** save this dataset, _Mark_ing it as undeleted */\n\t undelete: function (options) {\n\t if (!this.get('deleted') || this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: false }, options);\n\t },\n\t\n\t /** remove the file behind this dataset from the filesystem (if permitted) */\n\t purge: function _purge(options) {\n\t //TODO: use, override model.destroy, HDA.delete({ purge: true })\n\t if (this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t options = options || {};\n\t options.url = this.urls.purge;\n\t\n\t //TODO: ideally this would be a DELETE call to the api\n\t // using purge async for now\n\t var hda = this,\n\t xhr = jQuery.ajax(options);\n\t xhr.done(function (message, status, responseObj) {\n\t hda.set({ deleted: true, purged: true });\n\t });\n\t xhr.fail(function (xhr, status, message) {\n\t // Exception messages are hidden within error page including: '...not allowed in this Galaxy instance.'\n\t // unbury and re-add to xhr\n\t var error = _l(\"Unable to purge dataset\");\n\t var messageBuriedInUnfortunatelyFormattedError = 'Removal of datasets by users ' + 'is not allowed in this Galaxy instance';\n\t if (xhr.responseJSON && xhr.responseJSON.error) {\n\t error = xhr.responseJSON.error;\n\t } else if (xhr.responseText.indexOf(messageBuriedInUnfortunatelyFormattedError) !== -1) {\n\t error = messageBuriedInUnfortunatelyFormattedError;\n\t }\n\t xhr.responseText = error;\n\t hda.trigger('error', hda, xhr, options, _l(error), { error: error });\n\t });\n\t return xhr;\n\t },\n\t\n\t // ........................................................................ searching\n\t /** what attributes of an HDA will be used in a text search */\n\t searchAttributes: ['name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'],\n\t\n\t /** our attr keys don't often match the labels we display to the user - so, when using\n\t * attribute specifiers ('name=\"bler\"') in a term, allow passing in aliases for the\n\t * following attr keys.\n\t */\n\t searchAliases: {\n\t title: 'name',\n\t format: 'file_ext',\n\t database: 'genome_build',\n\t blurb: 'misc_blurb',\n\t description: 'misc_blurb',\n\t info: 'misc_info',\n\t tag: 'tags'\n\t },\n\t\n\t // ........................................................................ misc\n\t /** String representation */\n\t toString: function () {\n\t var nameAndId = this.get('id') || '';\n\t if (this.get('name')) {\n\t nameAndId = '\"' + this.get('name') + '\",' + nameAndId;\n\t }\n\t return 'Dataset(' + nameAndId + ')';\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection for dataset associations.\n\t */\n\t var DatasetAssociationCollection = Backbone.Collection.extend(BASE_MVC.LoggableMixin).extend(\n\t /** @lends HistoryContents.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t model: DatasetAssociation,\n\t\n\t /** root api url */\n\t urlRoot: Galaxy.root + 'api/datasets',\n\t\n\t /** url fn */\n\t url: function () {\n\t return this.urlRoot;\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** Get the ids of every item in this collection\n\t * @returns array of encoded ids\n\t */\n\t ids: function () {\n\t return this.map(function (item) {\n\t return item.get('id');\n\t });\n\t },\n\t\n\t /** Get contents that are not ready\n\t * @returns array of content models\n\t */\n\t notReady: function () {\n\t return this.filter(function (content) {\n\t return !content.inReadyState();\n\t });\n\t },\n\t\n\t /** return true if any datasets don't have details */\n\t haveDetails: function () {\n\t return this.all(function (dataset) {\n\t return dataset.hasDetails();\n\t });\n\t },\n\t\n\t // ........................................................................ ajax\n\t /** using a queue, perform ajaxFn on each of the models in this collection */\n\t ajaxQueue: function (ajaxFn, options) {\n\t var deferred = jQuery.Deferred(),\n\t startingLength = this.length,\n\t responses = [];\n\t\n\t if (!startingLength) {\n\t deferred.resolve([]);\n\t return deferred;\n\t }\n\t\n\t // use reverse order (stylistic choice)\n\t var ajaxFns = this.chain().reverse().map(function (dataset, i) {\n\t return function () {\n\t var xhr = ajaxFn.call(dataset, options);\n\t // if successful, notify using the deferred to allow tracking progress\n\t xhr.done(function (response) {\n\t deferred.notify({ curr: i, total: startingLength, response: response, model: dataset });\n\t });\n\t // (regardless of previous error or success) if not last ajax call, shift and call the next\n\t // if last fn, resolve deferred\n\t xhr.always(function (response) {\n\t responses.push(response);\n\t if (ajaxFns.length) {\n\t ajaxFns.shift()();\n\t } else {\n\t deferred.resolve(responses);\n\t }\n\t });\n\t };\n\t }).value();\n\t // start the queue\n\t ajaxFns.shift()();\n\t\n\t return deferred;\n\t },\n\t\n\t // ........................................................................ sorting/filtering\n\t /** return a new collection of datasets whose attributes contain the substring matchesWhat */\n\t matches: function (matchesWhat) {\n\t return this.filter(function (dataset) {\n\t return dataset.matches(matchesWhat);\n\t });\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['DatasetAssociationCollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t DatasetAssociation: DatasetAssociation,\n\t DatasetAssociationCollection: DatasetAssociationCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 86 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, jQuery, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(8), __webpack_require__(94), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (MODAL, ERROR_MODAL, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /**\n\t * A dialog/modal that allows copying a user history or 'importing' from user\n\t * another. Generally called via historyCopyDialog below.\n\t * @type {Object}\n\t */\n\t\n\t var CopyDialog = {\n\t\n\t // language related strings/fns\n\t defaultName: _.template(\"Copy of '<%- name %>'\"),\n\t title: _.template(_l('Copying history') + ' \"<%- name %>\"'),\n\t submitLabel: _l('Copy'),\n\t errorMessage: _l('History could not be copied.'),\n\t progressive: _l('Copying history'),\n\t activeLabel: _l('Copy only the active, non-deleted datasets'),\n\t allLabel: _l('Copy all datasets including deleted ones'),\n\t anonWarning: _l('As an anonymous user, unless you login or register, you will lose your current history ') + _l('after copying this history. '),\n\t\n\t // template for modal body\n\t _template: _.template([\n\t //TODO: remove inline styles\n\t // show a warning message for losing current to anon users\n\t '<% if( isAnon ){ %>', '
                          ', '<%- anonWarning %>', _l('You can'), ' ', _l('login here'), ' ', _l('or'), ' ', ' ', _l('register here'), '.', '
                          ', '<% } %>', '
                          ', '
                          ',\n\t // TODO: could use required here and the form validators\n\t // NOTE: use unescaped here if escaped in the modal function below\n\t '\" />', '

                          ', _l('Please enter a valid history title'), '

                          ',\n\t // if allowAll, add the option to copy deleted datasets, too\n\t '<% if( allowAll ){ %>', '
                          ', '

                          ', _l('Choose which datasets from the original history to include:'), '

                          ',\n\t // copy non-deleted is the default\n\t '/>', '', '
                          ', '/>', '', '<% } %>', '
                          '].join('')),\n\t\n\t // empty modal body and let the user know the copy is happening\n\t _showAjaxIndicator: function _showAjaxIndicator() {\n\t var indicator = '

                          ' + this.progressive + '...

                          ';\n\t this.modal.$('.modal-body').empty().append(indicator).css({ 'margin-top': '8px' });\n\t },\n\t\n\t // (sorta) public interface - display the modal, render the form, and potentially copy the history\n\t // returns a jQuery.Deferred done->history copied, fail->user cancelled\n\t dialog: function _dialog(modal, history, options) {\n\t options = options || {};\n\t\n\t var dialog = this,\n\t deferred = jQuery.Deferred(),\n\t\n\t // TODO: getting a little byzantine here\n\t defaultCopyNameFn = options.nameFn || this.defaultName,\n\t defaultCopyName = defaultCopyNameFn({ name: history.get('name') }),\n\t\n\t // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n\t defaultCopyWhat = options.allDatasets ? 'copy-all' : 'copy-non-deleted',\n\t allowAll = !_.isUndefined(options.allowAll) ? options.allowAll : true,\n\t autoClose = !_.isUndefined(options.autoClose) ? options.autoClose : true;\n\t\n\t this.modal = modal;\n\t\n\t // validate the name and copy if good\n\t function checkNameAndCopy() {\n\t var name = modal.$('#copy-modal-title').val();\n\t if (!name) {\n\t modal.$('.invalid-title').show();\n\t return;\n\t }\n\t // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n\t var copyAllDatasets = modal.$('input[name=\"copy-what\"]:checked').val() === 'copy-all';\n\t modal.$('button').prop('disabled', true);\n\t dialog._showAjaxIndicator();\n\t history.copy(true, name, copyAllDatasets).done(function (response) {\n\t deferred.resolve(response);\n\t }).fail(function (xhr, status, message) {\n\t var options = { name: name, copyAllDatasets: copyAllDatasets };\n\t ERROR_MODAL.ajaxErrorModal(history, xhr, options, dialog.errorMessage);\n\t deferred.rejectWith(deferred, arguments);\n\t }).done(function () {\n\t if (autoClose) {\n\t modal.hide();\n\t }\n\t });\n\t }\n\t\n\t var originalClosingCallback = options.closing_callback;\n\t modal.show(_.extend(options, {\n\t title: this.title({ name: history.get('name') }),\n\t body: $(dialog._template({\n\t name: defaultCopyName,\n\t isAnon: Galaxy.user.isAnonymous(),\n\t allowAll: allowAll,\n\t copyWhat: defaultCopyWhat,\n\t activeLabel: this.activeLabel,\n\t allLabel: this.allLabel,\n\t anonWarning: this.anonWarning\n\t })),\n\t buttons: _.object([[_l('Cancel'), function () {\n\t modal.hide();\n\t }], [this.submitLabel, checkNameAndCopy]]),\n\t height: 'auto',\n\t closing_events: true,\n\t closing_callback: function _historyCopyClose(cancelled) {\n\t if (cancelled) {\n\t deferred.reject({ cancelled: true });\n\t }\n\t if (originalClosingCallback) {\n\t originalClosingCallback(cancelled);\n\t }\n\t }\n\t }));\n\t\n\t // set the default dataset copy, autofocus the title, and set up for a simple return\n\t modal.$('#copy-modal-title').focus().select();\n\t modal.$('#copy-modal-title').on('keydown', function (ev) {\n\t if (ev.keyCode === 13) {\n\t ev.preventDefault();\n\t checkNameAndCopy();\n\t }\n\t });\n\t\n\t return deferred;\n\t }\n\t };\n\t\n\t //==============================================================================\n\t // maintain the (slight) distinction between copy and import\n\t /**\n\t * Subclass CopyDialog to use the import language.\n\t */\n\t var ImportDialog = _.extend({}, CopyDialog, {\n\t defaultName: _.template(\"imported: <%- name %>\"),\n\t title: _.template(_l('Importing history') + ' \"<%- name %>\"'),\n\t submitLabel: _l('Import'),\n\t errorMessage: _l('History could not be imported.'),\n\t progressive: _l('Importing history'),\n\t activeLabel: _l('Import only the active, non-deleted datasets'),\n\t allLabel: _l('Import all datasets including deleted ones'),\n\t anonWarning: _l('As an anonymous user, unless you login or register, you will lose your current history ') + _l('after importing this history. ')\n\t\n\t });\n\t\n\t //==============================================================================\n\t /**\n\t * Main interface for both history import and history copy dialogs.\n\t * @param {Backbone.Model} history the history to copy\n\t * @param {Object} options a hash\n\t * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n\t *\n\t * options:\n\t * (this object is also passed to the modal used to display the dialog and accepts modal options)\n\t * {Function} nameFn if defined, use this to build the default name shown to the user\n\t * (the fn is passed: {name: })\n\t * {bool} useImport if true, use the 'import' language (instead of Copy)\n\t * {bool} allowAll if true, allow the user to choose between copying all datasets and\n\t * only non-deleted datasets\n\t * {String} allDatasets default initial checked radio button: 'copy-all' or 'copy-non-deleted',\n\t */\n\t var historyCopyDialog = function (history, options) {\n\t options = options || {};\n\t // create our own modal if Galaxy doesn't have one (mako tab without use_panels)\n\t var modal = window.parent.Galaxy.modal || new MODAL.View({});\n\t return options.useImport ? ImportDialog.dialog(modal, history, options) : CopyDialog.dialog(modal, history, options);\n\t };\n\t\n\t //==============================================================================\n\t return historyCopyDialog;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 87 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(61), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DATASET_LI.DatasetListItemView;\n\t /** @class Read only view for HistoryDatasetAssociation.\n\t * Since there are no controls on the HDAView to hide the dataset,\n\t * the primary thing this class does (currently) is override templates\n\t * to render the HID.\n\t */\n\t var HDAListItemView = _super.extend(\n\t /** @lends HDAListItemView.prototype */{\n\t\n\t className: _super.prototype.className + \" history-content\",\n\t\n\t initialize: function (attributes, options) {\n\t _super.prototype.initialize.call(this, attributes, options);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDAListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t HDAListItemView.prototype.templates = function () {\n\t\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t // adding the hid display to the title\n\t '
                          ', '', '
                          ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- dataset.hid %> ', '<%- dataset.name %>', '
                          ', '
                          ', '', '<% _.each(_.sortBy(_.uniq(dataset.tags), function(x) { return x }), function(tag){ %>', '<% if (tag.indexOf(\"name:\") == 0){ %>', '<%- tag.slice(5) %>', '<% } %>', '<% }); %>', '', '
                          '], 'dataset');\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t hidden: BASE_MVC.wrapTemplate([\n\t // add a warning when hidden\n\t '<% if( !dataset.visible ){ %>', '
                          ', _l('This dataset has been hidden'), '
                          ', '<% } %>'], 'dataset')\n\t });\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t titleBar: titleBarTemplate,\n\t warnings: warnings\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HDAListItemView: HDAListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 88 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(85), __webpack_require__(90), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET, HISTORY_CONTENT, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DATASET.DatasetAssociation,\n\t hcontentMixin = HISTORY_CONTENT.HistoryContentMixin;\n\t /** @class (HDA) model for a Galaxy dataset contained in and related to a history.\n\t */\n\t var HistoryDatasetAssociation = _super.extend(BASE_MVC.mixin(hcontentMixin,\n\t /** @lends HistoryDatasetAssociation.prototype */{\n\t\n\t /** default attributes for a model */\n\t defaults: _.extend({}, _super.prototype.defaults, hcontentMixin.defaults, {\n\t history_content_type: 'dataset',\n\t model_class: 'HistoryDatasetAssociation'\n\t })\n\t }));\n\t\n\t //==============================================================================\n\t return {\n\t HistoryDatasetAssociation: HistoryDatasetAssociation\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 89 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(58), __webpack_require__(83), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, DC_LI, DC_VIEW, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DC_LI.DCListItemView;\n\t /** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n\t */\n\t var HDCAListItemView = _super.extend(\n\t /** @lends HDCAListItemView.prototype */{\n\t\n\t className: _super.prototype.className + \" history-content\",\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t this.listenTo(this.model, {\n\t 'change:tags change:populated change:visible': function (model, options) {\n\t this.render();\n\t }\n\t });\n\t },\n\t\n\t /** Override to provide the proper collections panels as the foldout */\n\t _getFoldoutPanelClass: function () {\n\t switch (this.model.get('collection_type')) {\n\t case 'list':\n\t return DC_VIEW.ListCollectionView;\n\t case 'paired':\n\t return DC_VIEW.PairCollectionView;\n\t case 'list:paired':\n\t return DC_VIEW.ListOfPairsCollectionView;\n\t case 'list:list':\n\t return DC_VIEW.ListOfListsCollectionView;\n\t }\n\t throw new TypeError('Uknown collection_type: ' + this.model.get('collection_type'));\n\t },\n\t\n\t /** In this override, add the state as a class for use with state-based CSS */\n\t _swapNewRender: function ($newRender) {\n\t _super.prototype._swapNewRender.call(this, $newRender);\n\t //TODO: model currently has no state\n\t var state = !this.model.get('populated') ? STATES.RUNNING : STATES.OK;\n\t //if( this.model.has( 'state' ) ){\n\t this.$el.addClass('state-' + state);\n\t //}\n\t return this.$el;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDCAListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t /** underscore templates */\n\t HDCAListItemView.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t hidden: BASE_MVC.wrapTemplate([\n\t // add a warning when hidden\n\t '<% if( !collection.visible ){ %>', '
                          ', _l('This collection has been hidden'), '
                          ', '<% } %>'], 'collection')\n\t });\n\t\n\t // could steal this from hda-base (or use mixed content)\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t // adding the hid display to the title\n\t '
                          ', '', '
                          ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- collection.hid %> ', '<%- collection.name %>', '
                          ', '
                          ', '', '<% _.each(_.sortBy(_.uniq(collection.tags), function(x) { return x }), function(tag){ %>', '<% if (tag.indexOf(\"name:\") == 0){ %>', '<%- tag.slice(5) %>', '<% } %>', '<% }); %>', '', '
                          '], 'collection');\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t warnings: warnings,\n\t titleBar: titleBarTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HDCAListItemView: HDCAListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 90 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /** @class Mixin for HistoryContents content (HDAs, HDCAs).\n\t */\n\t\n\t var HistoryContentMixin = {\n\t\n\t /** default attributes for a model */\n\t defaults: {\n\t /** parent (containing) history */\n\t history_id: null,\n\t /** some content_type (HistoryContents can contain mixed model classes) */\n\t history_content_type: null,\n\t /** indicating when/what order the content was generated in the context of the history */\n\t hid: null,\n\t /** whether the user wants the content shown (visible) */\n\t visible: true\n\t },\n\t\n\t // ........................................................................ mixed content element\n\t // In order to be part of a MIXED bbone collection, we can't rely on the id\n\t // (which may collide btwn models of different classes)\n\t // Instead, use type_id which prefixes the history_content_type so the bbone collection can differentiate\n\t idAttribute: 'type_id',\n\t\n\t // ........................................................................ common queries\n\t /** the more common alias of visible */\n\t hidden: function () {\n\t return !this.get('visible');\n\t },\n\t\n\t //TODO: remove\n\t /** based on includeDeleted, includeHidden (gen. from the container control),\n\t * would this ds show in the list of ds's?\n\t * @param {Boolean} includeDeleted are we showing deleted hdas?\n\t * @param {Boolean} includeHidden are we showing hidden hdas?\n\t */\n\t isVisible: function (includeDeleted, includeHidden) {\n\t var isVisible = true;\n\t if (!includeDeleted && (this.get('deleted') || this.get('purged'))) {\n\t isVisible = false;\n\t }\n\t if (!includeHidden && !this.get('visible')) {\n\t isVisible = false;\n\t }\n\t return isVisible;\n\t },\n\t\n\t // ........................................................................ ajax\n\t //TODO?: these are probably better done on the leaf classes\n\t /** history content goes through the 'api/histories' API */\n\t urlRoot: Galaxy.root + 'api/histories/',\n\t\n\t /** full url spec. for this content */\n\t url: function () {\n\t var url = this.urlRoot + this.get('history_id') + '/contents/' + this.get('history_content_type') + 's/' + this.get('id');\n\t return url;\n\t },\n\t\n\t /** save this content as not visible */\n\t hide: function (options) {\n\t if (!this.get('visible')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ visible: false }, options);\n\t },\n\t /** save this content as visible */\n\t unhide: function (options) {\n\t if (this.get('visible')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ visible: true }, options);\n\t },\n\t\n\t // ........................................................................ misc\n\t toString: function () {\n\t return [this.get('type_id'), this.get('hid'), this.get('name')].join(':');\n\t }\n\t };\n\t\n\t //==============================================================================\n\t return {\n\t HistoryContentMixin: HistoryContentMixin\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 91 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(67), __webpack_require__(152), __webpack_require__(7), __webpack_require__(6), __webpack_require__(98)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_ITEM, LoadingIndicator, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'list';\n\t /* ============================================================================\n\t TODO:\n\t \n\t ============================================================================ */\n\t /** @class View for a list/collection of models and the sub-views of those models.\n\t * Sub-views must (at least have the interface if not) inherit from ListItemView.\n\t * (For a list panel that also includes some 'container' model (History->HistoryContents)\n\t * use ModelWithListPanel)\n\t *\n\t * Allows for:\n\t * searching collection/sub-views\n\t * selecting/multi-selecting sub-views\n\t *\n\t * Currently used:\n\t * for dataset/dataset-choice\n\t * as superclass of ModelListPanel\n\t */\n\t var ListPanel = Backbone.View.extend(BASE_MVC.LoggableMixin).extend( /** @lends ListPanel.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t /** class to use for constructing the sub-views */\n\t viewClass: LIST_ITEM.ListItemView,\n\t /** class to used for constructing collection of sub-view models */\n\t collectionClass: Backbone.Collection,\n\t\n\t tagName: 'div',\n\t className: 'list-panel',\n\t\n\t /** (in ms) that jquery effects will use */\n\t fxSpeed: 'fast',\n\t\n\t /** string to display when the collection has no contents */\n\t emptyMsg: _l('This list is empty'),\n\t /** displayed when no items match the search terms */\n\t noneFoundMsg: _l('No matching items found'),\n\t /** string used for search placeholder */\n\t searchPlaceholder: _l('search'),\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes optional settings for the list\n\t */\n\t initialize: function (attributes, options) {\n\t attributes = attributes || {};\n\t // set the logger if requested\n\t if (attributes.logger) {\n\t this.logger = attributes.logger;\n\t }\n\t this.log(this + '.initialize:', attributes);\n\t\n\t // ---- instance vars\n\t /** how quickly should jquery fx run? */\n\t this.fxSpeed = _.has(attributes, 'fxSpeed') ? attributes.fxSpeed : this.fxSpeed;\n\t\n\t /** filters for displaying subviews */\n\t this.filters = [];\n\t /** current search terms */\n\t this.searchFor = attributes.searchFor || '';\n\t\n\t /** loading indicator */\n\t // this.indicator = new LoadingIndicator( this.$el );\n\t\n\t /** currently showing selectors on items? */\n\t this.selecting = attributes.selecting !== undefined ? attributes.selecting : true;\n\t //this.selecting = false;\n\t\n\t /** cached selected item.model.ids to persist btwn renders */\n\t this.selected = attributes.selected || [];\n\t /** the last selected item.model.id */\n\t this.lastSelected = null;\n\t\n\t /** are sub-views draggable */\n\t this.dragItems = attributes.dragItems || false;\n\t\n\t /** list item view class (when passed models) */\n\t this.viewClass = attributes.viewClass || this.viewClass;\n\t\n\t /** list item views */\n\t this.views = [];\n\t /** list item models */\n\t this.collection = attributes.collection || this._createDefaultCollection();\n\t\n\t /** filter fns run over collection items to see if they should show in the list */\n\t this.filters = attributes.filters || [];\n\t\n\t /** override $scrollContainer fn via attributes - fn should return jq for elem to call scrollTo on */\n\t this.$scrollContainer = attributes.$scrollContainer || this.$scrollContainer;\n\t\n\t /** @type {String} generic title */\n\t this.title = attributes.title || '';\n\t /** @type {String} generic subtitle */\n\t this.subtitle = attributes.subtitle || '';\n\t\n\t this._setUpListeners();\n\t },\n\t\n\t // ------------------------------------------------------------------------ listeners\n\t /** create any event listeners for the list */\n\t _setUpListeners: function () {\n\t this.off();\n\t\n\t //TODO: move errorHandler down into list-view from history-view or\n\t // pass to global error handler (Galaxy)\n\t this.on({\n\t error: function (model, xhr, options, msg, details) {\n\t //this.errorHandler( model, xhr, options, msg, details );\n\t console.error(model, xhr, options, msg, details);\n\t },\n\t // show hide the loading indicator\n\t loading: function () {\n\t this._showLoadingIndicator('loading...', 40);\n\t },\n\t 'loading-done': function () {\n\t this._hideLoadingIndicator(40);\n\t }\n\t });\n\t\n\t // throw the first render up as a diff namespace using once (for outside consumption)\n\t this.once('rendered', function () {\n\t this.trigger('rendered:initial', this);\n\t });\n\t\n\t this._setUpCollectionListeners();\n\t this._setUpViewListeners();\n\t return this;\n\t },\n\t\n\t /** create and return a collection for when none is initially passed */\n\t _createDefaultCollection: function () {\n\t // override\n\t return new this.collectionClass([]);\n\t },\n\t\n\t /** listening for collection events */\n\t _setUpCollectionListeners: function () {\n\t this.log(this + '._setUpCollectionListeners', this.collection);\n\t this.stopListening(this.collection);\n\t\n\t // bubble up error events\n\t this.listenTo(this.collection, {\n\t error: function (model, xhr, options, msg, details) {\n\t this.trigger('error', model, xhr, options, msg, details);\n\t },\n\t update: function (collection, options) {\n\t var changes = options.changes;\n\t // console.info( collection + ', update:', changes, '\\noptions:', options );\n\t // more than one: render everything\n\t if (options.renderAll || changes.added.length + changes.removed.length > 1) {\n\t return this.renderItems();\n\t }\n\t // otherwise, let the single add/remove handlers do it\n\t if (changes.added.length === 1) {\n\t return this.addItemView(_.first(changes.added), collection, options);\n\t }\n\t if (changes.removed.length === 1) {\n\t return this.removeItemView(_.first(changes.removed), collection, options);\n\t }\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** listening for sub-view events that bubble up with the 'view:' prefix */\n\t _setUpViewListeners: function () {\n\t this.log(this + '._setUpViewListeners');\n\t\n\t // shift to select a range\n\t this.on({\n\t 'view:selected': function (view, ev) {\n\t if (ev && ev.shiftKey && this.lastSelected) {\n\t var lastSelectedView = this.viewFromModelId(this.lastSelected);\n\t if (lastSelectedView) {\n\t this.selectRange(view, lastSelectedView);\n\t }\n\t } else if (ev && ev.altKey && !this.selecting) {\n\t this.showSelectors();\n\t }\n\t this.selected.push(view.model.id);\n\t this.lastSelected = view.model.id;\n\t },\n\t\n\t 'view:de-selected': function (view, ev) {\n\t this.selected = _.without(this.selected, view.model.id);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering\n\t /** Render this content, set up ui.\n\t * @param {Number or String} speed the speed of the render\n\t */\n\t render: function (speed) {\n\t this.log(this + '.render', speed);\n\t var $newRender = this._buildNewRender();\n\t this._setUpBehaviors($newRender);\n\t this._queueNewRender($newRender, speed);\n\t return this;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el. */\n\t _buildNewRender: function () {\n\t this.debug(this + '(ListPanel)._buildNewRender');\n\t var $newRender = $(this.templates.el({}, this));\n\t this._renderControls($newRender);\n\t this._renderTitle($newRender);\n\t this._renderSubtitle($newRender);\n\t this._renderSearch($newRender);\n\t this.renderItems($newRender);\n\t return $newRender;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el. */\n\t _renderControls: function ($newRender) {\n\t this.debug(this + '(ListPanel)._renderControls');\n\t var $controls = $(this.templates.controls({}, this));\n\t $newRender.find('.controls').replaceWith($controls);\n\t return $controls;\n\t },\n\t\n\t /** return a jQuery object containing the title DOM */\n\t _renderTitle: function ($where) {\n\t //$where = $where || this.$el;\n\t //$where.find( '.title' ).replaceWith( ... )\n\t },\n\t\n\t /** return a jQuery object containing the subtitle DOM (if any) */\n\t _renderSubtitle: function ($where) {\n\t //$where = $where || this.$el;\n\t //$where.find( '.title' ).replaceWith( ... )\n\t },\n\t\n\t /** Fade out the old el, swap in the new contents, then fade in.\n\t * @param {Number or String} speed jq speed to use for rendering effects\n\t * @fires rendered when rendered\n\t */\n\t _queueNewRender: function ($newRender, speed) {\n\t speed = speed === undefined ? this.fxSpeed : speed;\n\t var panel = this;\n\t panel.log('_queueNewRender:', $newRender, speed);\n\t\n\t $(panel).queue('fx', [function (next) {\n\t panel.$el.fadeOut(speed, next);\n\t }, function (next) {\n\t panel._swapNewRender($newRender);\n\t next();\n\t }, function (next) {\n\t panel.$el.fadeIn(speed, next);\n\t }, function (next) {\n\t panel.trigger('rendered', panel);\n\t next();\n\t }]);\n\t },\n\t\n\t /** empty out the current el, move the $newRender's children in */\n\t _swapNewRender: function ($newRender) {\n\t this.$el.empty().attr('class', this.className).append($newRender.children());\n\t if (this.selecting) {\n\t this.showSelectors(0);\n\t }\n\t return this;\n\t },\n\t\n\t /** Set up any behaviors, handlers (ep. plugins) that need to be called when the entire view has been built but\n\t * not attached to the page yet.\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t this.$controls($where).find('[title]').tooltip();\n\t // set up the pupup for actions available when multi selecting\n\t this._renderMultiselectActionMenu($where);\n\t return this;\n\t },\n\t\n\t /** render a menu containing the actions available to sets of selected items */\n\t _renderMultiselectActionMenu: function ($where) {\n\t $where = $where || this.$el;\n\t var $menu = $where.find('.list-action-menu'),\n\t actions = this.multiselectActions();\n\t if (!actions.length) {\n\t return $menu.empty();\n\t }\n\t\n\t var $newMenu = $(['
                          ', '', '
                            ', '
                          ', '
                          '].join(''));\n\t var $actions = actions.map(function (action) {\n\t var html = ['
                        • ', action.html, '
                        • '].join('');\n\t return $(html).click(function (ev) {\n\t ev.preventDefault();\n\t return action.func(ev);\n\t });\n\t });\n\t $newMenu.find('ul').append($actions);\n\t $menu.replaceWith($newMenu);\n\t return $newMenu;\n\t },\n\t\n\t /** return a list of plain objects used to render multiselect actions menu. Each object should have:\n\t * html: an html string used as the anchor contents\n\t * func: a function called when the anchor is clicked (passed the click event)\n\t */\n\t multiselectActions: function () {\n\t return [];\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-$element shortcuts\n\t /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n\t $scrollContainer: function ($where) {\n\t // override or set via attributes.$scrollContainer\n\t return ($where || this.$el).parent().parent();\n\t },\n\t /** convenience selector for the section that displays the list controls */\n\t $controls: function ($where) {\n\t return ($where || this.$el).find('> .controls');\n\t },\n\t /** list-items: where the subviews are contained in the view's dom */\n\t $list: function ($where) {\n\t return ($where || this.$el).find('> .list-items');\n\t },\n\t /** container where list messages are attached */\n\t $messages: function ($where) {\n\t //TODO: controls isn't really correct here (only for ModelListPanel)\n\t return ($where || this.$el).find('> .controls .messages');\n\t },\n\t /** the message displayed when no views can be shown (no views, none matching search) */\n\t $emptyMessage: function ($where) {\n\t return ($where || this.$el).find('> .empty-message');\n\t },\n\t\n\t // ------------------------------------------------------------------------ hda sub-views\n\t /** render the subviews for the list's collection */\n\t renderItems: function ($whereTo) {\n\t $whereTo = $whereTo || this.$el;\n\t var panel = this;\n\t panel.log(this + '.renderItems', $whereTo);\n\t\n\t var $list = panel.$list($whereTo);\n\t panel.freeViews();\n\t // console.log( 'views freed' );\n\t //TODO:? cache and re-use views?\n\t var shownModels = panel._filterCollection();\n\t // console.log( 'models filtered:', shownModels );\n\t\n\t panel.views = shownModels.map(function (itemModel) {\n\t var view = panel._createItemView(itemModel);\n\t return view;\n\t });\n\t\n\t $list.empty();\n\t // console.log( 'list emptied' );\n\t if (panel.views.length) {\n\t panel._attachItems($whereTo);\n\t // console.log( 'items attached' );\n\t }\n\t panel._renderEmptyMessage($whereTo).toggle(!panel.views.length);\n\t panel.trigger('views:ready', panel.views);\n\t\n\t // console.log( '------------------------------------------- rendering items' );\n\t return panel.views;\n\t },\n\t\n\t /** Filter the collection to only those models that should be currently viewed */\n\t _filterCollection: function () {\n\t // override this\n\t var panel = this;\n\t return panel.collection.filter(_.bind(panel._filterItem, panel));\n\t },\n\t\n\t /** Should the model be viewable in the current state?\n\t * Checks against this.filters and this.searchFor\n\t */\n\t _filterItem: function (model) {\n\t // override this\n\t var panel = this;\n\t return _.every(panel.filters.map(function (fn) {\n\t return fn.call(model);\n\t })) && (!panel.searchFor || model.matchesAll(panel.searchFor));\n\t },\n\t\n\t /** Create a view for a model and set up it's listeners */\n\t _createItemView: function (model) {\n\t var ViewClass = this._getItemViewClass(model);\n\t var options = _.extend(this._getItemViewOptions(model), {\n\t model: model\n\t });\n\t var view = new ViewClass(options);\n\t this._setUpItemViewListeners(view);\n\t return view;\n\t },\n\t\n\t /** Free a view for a model. Note: does not remove it from the DOM */\n\t _destroyItemView: function (view) {\n\t this.stopListening(view);\n\t this.views = _.without(this.views, view);\n\t },\n\t\n\t _destroyItemViews: function (view) {\n\t var self = this;\n\t self.views.forEach(function (v) {\n\t self.stopListening(v);\n\t });\n\t self.views = [];\n\t return self;\n\t },\n\t\n\t /** free any sub-views the list has */\n\t freeViews: function () {\n\t return this._destroyItemViews();\n\t },\n\t\n\t /** Get the bbone view class based on the model */\n\t _getItemViewClass: function (model) {\n\t // override this\n\t return this.viewClass;\n\t },\n\t\n\t /** Get the options passed to the new view based on the model */\n\t _getItemViewOptions: function (model) {\n\t // override this\n\t return {\n\t //logger : this.logger,\n\t fxSpeed: this.fxSpeed,\n\t expanded: false,\n\t selectable: this.selecting,\n\t selected: _.contains(this.selected, model.id),\n\t draggable: this.dragItems\n\t };\n\t },\n\t\n\t /** Set up listeners for new models */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t // send all events to the panel, re-namspaceing them with the view prefix\n\t this.listenTo(view, 'all', function () {\n\t var args = Array.prototype.slice.call(arguments, 0);\n\t args[0] = 'view:' + args[0];\n\t panel.trigger.apply(panel, args);\n\t });\n\t\n\t // drag multiple - hijack ev.setData to add all selected items\n\t this.listenTo(view, 'draggable:dragstart', function (ev, v) {\n\t //TODO: set multiple drag data here\n\t var json = {},\n\t selected = this.getSelectedModels();\n\t if (selected.length) {\n\t json = selected.toJSON();\n\t } else {\n\t json = [v.model.toJSON()];\n\t }\n\t ev.dataTransfer.setData('text', JSON.stringify(json));\n\t //ev.dataTransfer.setDragImage( v.el, 60, 60 );\n\t }, this);\n\t\n\t return panel;\n\t },\n\t\n\t /** Attach views in this.views to the model based on $whereTo */\n\t _attachItems: function ($whereTo) {\n\t var self = this;\n\t // console.log( '_attachItems:', $whereTo, this.$list( $whereTo ) );\n\t //ASSUMES: $list has been emptied\n\t this.$list($whereTo).append(this.views.map(function (view) {\n\t return self._renderItemView$el(view);\n\t }));\n\t return this;\n\t },\n\t\n\t /** get a given subview's $el (or whatever may wrap it) and return it */\n\t _renderItemView$el: function (view) {\n\t // useful to wrap and override\n\t return view.render(0).$el;\n\t },\n\t\n\t /** render the empty/none-found message */\n\t _renderEmptyMessage: function ($whereTo) {\n\t this.debug('_renderEmptyMessage', $whereTo, this.searchFor);\n\t var text = this.searchFor ? this.noneFoundMsg : this.emptyMsg;\n\t return this.$emptyMessage($whereTo).text(text);\n\t },\n\t\n\t /** expand all item views */\n\t expandAll: function () {\n\t _.each(this.views, function (view) {\n\t view.expand();\n\t });\n\t },\n\t\n\t /** collapse all item views */\n\t collapseAll: function () {\n\t _.each(this.views, function (view) {\n\t view.collapse();\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ collection/views syncing\n\t /** Add a view (if the model should be viewable) to the panel */\n\t addItemView: function (model, collection, options) {\n\t // console.log( this + '.addItemView:', model );\n\t var panel = this;\n\t // get the index of the model in the list of filtered models shown by this list\n\t // in order to insert the view in the proper place\n\t //TODO:? potentially expensive\n\t var modelIndex = panel._filterCollection().indexOf(model);\n\t if (modelIndex === -1) {\n\t return undefined;\n\t }\n\t var view = panel._createItemView(model);\n\t // console.log( 'adding and rendering:', modelIndex, view.toString() );\n\t\n\t $(view).queue('fx', [function (next) {\n\t // hide the empty message first if only view\n\t if (panel.$emptyMessage().is(':visible')) {\n\t panel.$emptyMessage().fadeOut(panel.fxSpeed, next);\n\t } else {\n\t next();\n\t }\n\t }, function (next) {\n\t panel._attachView(view, modelIndex);\n\t next();\n\t }]);\n\t return view;\n\t },\n\t\n\t /** internal fn to add view (to both panel.views and panel.$list) */\n\t _attachView: function (view, modelIndex, useFx) {\n\t // console.log( this + '._attachView:', view, modelIndex, useFx );\n\t useFx = _.isUndefined(useFx) ? true : useFx;\n\t modelIndex = modelIndex || 0;\n\t var panel = this;\n\t\n\t // use the modelIndex to splice into views and insert at the proper index in the DOM\n\t panel.views.splice(modelIndex, 0, view);\n\t panel._insertIntoListAt(modelIndex, panel._renderItemView$el(view).hide());\n\t\n\t panel.trigger('view:attached', view);\n\t if (useFx) {\n\t view.$el.slideDown(panel.fxSpeed, function () {\n\t panel.trigger('view:attached:rendered');\n\t });\n\t } else {\n\t view.$el.show();\n\t panel.trigger('view:attached:rendered');\n\t }\n\t return view;\n\t },\n\t\n\t /** insert a jq object as a child of list-items at the specified *DOM index* */\n\t _insertIntoListAt: function (index, $what) {\n\t // console.log( this + '._insertIntoListAt:', index, $what );\n\t var $list = this.$list();\n\t if (index === 0) {\n\t $list.prepend($what);\n\t } else {\n\t $list.children().eq(index - 1).after($what);\n\t }\n\t return $what;\n\t },\n\t\n\t /** Remove a view from the panel (if found) */\n\t removeItemView: function (model, collection, options) {\n\t var panel = this;\n\t var view = _.find(panel.views, function (v) {\n\t return v.model === model;\n\t });\n\t if (!view) {\n\t return undefined;\n\t }\n\t panel.views = _.without(panel.views, view);\n\t panel.trigger('view:removed', view);\n\t\n\t // potentially show the empty message if no views left\n\t // use anonymous queue here - since remove can happen multiple times\n\t $({}).queue('fx', [function (next) {\n\t view.$el.fadeOut(panel.fxSpeed, next);\n\t }, function (next) {\n\t view.remove();\n\t panel.trigger('view:removed:rendered');\n\t if (!panel.views.length) {\n\t panel._renderEmptyMessage().fadeIn(panel.fxSpeed, next);\n\t } else {\n\t next();\n\t }\n\t }]);\n\t return view;\n\t },\n\t\n\t /** get views based on model.id */\n\t viewFromModelId: function (id) {\n\t return _.find(this.views, function (v) {\n\t return v.model.id === id;\n\t });\n\t },\n\t\n\t /** get views based on model */\n\t viewFromModel: function (model) {\n\t return model ? this.viewFromModelId(model.id) : undefined;\n\t },\n\t\n\t /** get views based on model properties */\n\t viewsWhereModel: function (properties) {\n\t return this.views.filter(function (view) {\n\t return _.isMatch(view.model.attributes, properties);\n\t });\n\t },\n\t\n\t /** A range of views between (and including) viewA and viewB */\n\t viewRange: function (viewA, viewB) {\n\t if (viewA === viewB) {\n\t return viewA ? [viewA] : [];\n\t }\n\t\n\t var indexA = this.views.indexOf(viewA),\n\t indexB = this.views.indexOf(viewB);\n\t\n\t // handle not found\n\t if (indexA === -1 || indexB === -1) {\n\t if (indexA === indexB) {\n\t return [];\n\t }\n\t return indexA === -1 ? [viewB] : [viewA];\n\t }\n\t // reverse if indeces are\n\t //note: end inclusive\n\t return indexA < indexB ? this.views.slice(indexA, indexB + 1) : this.views.slice(indexB, indexA + 1);\n\t },\n\t\n\t // ------------------------------------------------------------------------ searching\n\t /** render a search input for filtering datasets shown\n\t * (see SearchableMixin in base-mvc for implementation of the actual searching)\n\t * return will start the search\n\t * esc will clear the search\n\t * clicking the clear button will clear the search\n\t * uses searchInput in ui.js\n\t */\n\t _renderSearch: function ($where) {\n\t $where.find('.controls .search-input').searchInput({\n\t placeholder: this.searchPlaceholder,\n\t initialVal: this.searchFor,\n\t onfirstsearch: _.bind(this._firstSearch, this),\n\t onsearch: _.bind(this.searchItems, this),\n\t onclear: _.bind(this.clearSearch, this)\n\t });\n\t return $where;\n\t },\n\t\n\t /** What to do on the first search entered */\n\t _firstSearch: function (searchFor) {\n\t // override to load model details if necc.\n\t this.log('onFirstSearch', searchFor);\n\t return this.searchItems(searchFor);\n\t },\n\t\n\t /** filter view list to those that contain the searchFor terms */\n\t searchItems: function (searchFor, force) {\n\t this.log('searchItems', searchFor, this.searchFor, force);\n\t if (!force && this.searchFor === searchFor) {\n\t return this;\n\t }\n\t this.searchFor = searchFor;\n\t this.renderItems();\n\t this.trigger('search:searching', searchFor, this);\n\t var $search = this.$('> .controls .search-query');\n\t if ($search.val() !== searchFor) {\n\t $search.val(searchFor);\n\t }\n\t return this;\n\t },\n\t\n\t /** clear the search filters and show all views that are normally shown */\n\t clearSearch: function (searchFor) {\n\t //this.log( 'onSearchClear', this );\n\t this.searchFor = '';\n\t this.trigger('search:clear', this);\n\t this.$('> .controls .search-query').val('');\n\t this.renderItems();\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ selection\n\t /** @type Integer when the number of list item views is >= to this, don't animate selectors */\n\t THROTTLE_SELECTOR_FX_AT: 20,\n\t\n\t /** show selectors on all visible itemViews and associated controls */\n\t showSelectors: function (speed) {\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t this.selecting = true;\n\t this.$('.list-actions').slideDown(speed);\n\t speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT ? 0 : speed;\n\t _.each(this.views, function (view) {\n\t view.showSelector(speed);\n\t });\n\t //this.selected = [];\n\t //this.lastSelected = null;\n\t },\n\t\n\t /** hide selectors on all visible itemViews and associated controls */\n\t hideSelectors: function (speed) {\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t this.selecting = false;\n\t this.$('.list-actions').slideUp(speed);\n\t speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT ? 0 : speed;\n\t _.each(this.views, function (view) {\n\t view.hideSelector(speed);\n\t });\n\t this.selected = [];\n\t this.lastSelected = null;\n\t },\n\t\n\t /** show or hide selectors on all visible itemViews and associated controls */\n\t toggleSelectors: function () {\n\t if (!this.selecting) {\n\t this.showSelectors();\n\t } else {\n\t this.hideSelectors();\n\t }\n\t },\n\t\n\t /** select all visible items */\n\t selectAll: function (event) {\n\t _.each(this.views, function (view) {\n\t view.select(event);\n\t });\n\t },\n\t\n\t /** deselect all visible items */\n\t deselectAll: function (event) {\n\t this.lastSelected = null;\n\t _.each(this.views, function (view) {\n\t view.deselect(event);\n\t });\n\t },\n\t\n\t /** select a range of datasets between A and B */\n\t selectRange: function (viewA, viewB) {\n\t var range = this.viewRange(viewA, viewB);\n\t _.each(range, function (view) {\n\t view.select();\n\t });\n\t return range;\n\t },\n\t\n\t /** return an array of all currently selected itemViews */\n\t getSelectedViews: function () {\n\t return _.filter(this.views, function (v) {\n\t return v.selected;\n\t });\n\t },\n\t\n\t /** return a collection of the models of all currenly selected items */\n\t getSelectedModels: function () {\n\t // console.log( '(getSelectedModels)' );\n\t return new this.collection.constructor(_.map(this.getSelectedViews(), function (view) {\n\t return view.model;\n\t }));\n\t },\n\t\n\t // ------------------------------------------------------------------------ loading indicator\n\t /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n\t _showLoadingIndicator: function (msg, speed, callback) {\n\t this.debug('_showLoadingIndicator', this.indicator, msg, speed, callback);\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t if (!this.indicator) {\n\t this.indicator = new LoadingIndicator(this.$el);\n\t this.debug('\\t created', this.indicator);\n\t }\n\t if (!this.$el.is(':visible')) {\n\t this.indicator.show(0, callback);\n\t } else {\n\t this.$el.fadeOut(speed);\n\t this.indicator.show(msg, speed, callback);\n\t }\n\t },\n\t\n\t /** hide the loading indicator */\n\t _hideLoadingIndicator: function (speed, callback) {\n\t this.debug('_hideLoadingIndicator', this.indicator, speed, callback);\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t if (this.indicator) {\n\t this.indicator.hide(speed, callback);\n\t }\n\t },\n\t\n\t // ------------------------------------------------------------------------ scrolling\n\t /** get the current scroll position of the panel in its parent */\n\t scrollPosition: function () {\n\t return this.$scrollContainer().scrollTop();\n\t },\n\t\n\t /** set the current scroll position of the panel in its parent */\n\t scrollTo: function (pos, speed) {\n\t speed = speed || 0;\n\t this.$scrollContainer().animate({ scrollTop: pos }, speed);\n\t return this;\n\t },\n\t\n\t /** Scrolls the panel to the top. */\n\t scrollToTop: function (speed) {\n\t return this.scrollTo(0, speed);\n\t },\n\t\n\t /** scroll to the given view in list-items */\n\t scrollToItem: function (view, speed) {\n\t if (!view) {\n\t return this;\n\t }\n\t return this;\n\t },\n\t\n\t /** Scrolls the panel to show the content with the given id. */\n\t scrollToId: function (id, speed) {\n\t return this.scrollToItem(this.viewFromModelId(id), speed);\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: {\n\t 'click .select-all': 'selectAll',\n\t 'click .deselect-all': 'deselectAll'\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** Return a string rep of the panel */\n\t toString: function () {\n\t return 'ListPanel(' + this.collection + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t ListPanel.prototype.templates = function () {\n\t\n\t var elTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
                          ', '
                          ', '
                          ', '
                          ', '
                          ']);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
                          ', '
                          ', '
                          <%- view.title %>
                          ', '
                          ', '
                          <%- view.subtitle %>
                          ',\n\t // buttons, controls go here\n\t '
                          ',\n\t // deleted msg, etc.\n\t '
                          ', '
                          ', '
                          ', '
                          ',\n\t\n\t // show when selectors are shown\n\t '
                          ', '
                          ', '', '', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ']);\n\t\n\t return {\n\t el: elTemplate,\n\t controls: controlsTemplate\n\t };\n\t }();\n\t\n\t //=============================================================================\n\t /** View for a model that has a sub-collection (e.g. History, DatasetCollection)\n\t * Allows:\n\t * the model to be reset\n\t * auto assign panel.collection to panel.model[ panel.modelCollectionKey ]\n\t *\n\t */\n\t var ModelListPanel = ListPanel.extend({\n\t\n\t /** key of attribute in model to assign to this.collection */\n\t modelCollectionKey: 'contents',\n\t\n\t initialize: function (attributes) {\n\t ListPanel.prototype.initialize.call(this, attributes);\n\t this.selecting = attributes.selecting !== undefined ? attributes.selecting : false;\n\t\n\t this.setModel(this.model, attributes);\n\t },\n\t\n\t /** release/free/shutdown old models and set up panel for new models\n\t * @fires new-model with the panel as parameter\n\t */\n\t setModel: function (model, attributes) {\n\t attributes = attributes || {};\n\t this.debug(this + '.setModel:', model, attributes);\n\t\n\t this.freeModel();\n\t this.freeViews();\n\t\n\t if (model) {\n\t var oldModelId = this.model ? this.model.get('id') : null;\n\t\n\t // set up the new model with user, logger, storage, events\n\t this.model = model;\n\t if (this.logger) {\n\t this.model.logger = this.logger;\n\t }\n\t this._setUpModelListeners();\n\t\n\t //TODO: relation btwn model, collection becoming tangled here\n\t // free the collection, and assign the new collection to either\n\t // the model[ modelCollectionKey ], attributes.collection, or an empty vanilla collection\n\t this.stopListening(this.collection);\n\t this.collection = this.model[this.modelCollectionKey] || attributes.collection || this._createDefaultCollection();\n\t this._setUpCollectionListeners();\n\t\n\t if (oldModelId && model.get('id') !== oldModelId) {\n\t this.trigger('new-model', this);\n\t }\n\t }\n\t return this;\n\t },\n\t\n\t /** free the current model and all listeners for it, free any views for the model */\n\t freeModel: function () {\n\t // stop/release the previous model, and clear cache to sub-views\n\t if (this.model) {\n\t this.stopListening(this.model);\n\t //TODO: see base-mvc\n\t //this.model.free();\n\t //this.model = null;\n\t }\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ listening\n\t /** listening for model events */\n\t _setUpModelListeners: function () {\n\t // override\n\t this.log(this + '._setUpModelListeners', this.model);\n\t // bounce model errors up to the panel\n\t this.listenTo(this.model, 'error', function () {\n\t var args = Array.prototype.slice.call(arguments, 0);\n\t //args.unshift( 'model:error' );\n\t args.unshift('error');\n\t this.trigger.apply(this, args);\n\t }, this);\n\t\n\t // debugging\n\t if (this.logger) {\n\t this.listenTo(this.model, 'all', function (event) {\n\t this.info(this + '(model)', event, arguments);\n\t });\n\t }\n\t return this;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el.\n\t */\n\t _renderControls: function ($newRender) {\n\t this.debug(this + '(ModelListPanel)._renderControls');\n\t var json = this.model ? this.model.toJSON() : {},\n\t $controls = $(this.templates.controls(json, this));\n\t $newRender.find('.controls').replaceWith($controls);\n\t return $controls;\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** Return a string rep of the panel */\n\t toString: function () {\n\t return 'ModelListPanel(' + this.model + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t ModelListPanel.prototype.templates = function () {\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
                          ', '
                          ',\n\t //TODO: this is really the only difference - consider factoring titlebar out\n\t '
                          <%- model.name %>
                          ', '
                          ', '
                          <%- view.subtitle %>
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '', '', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ']);\n\t\n\t return _.extend(_.clone(ListPanel.prototype.templates), {\n\t controls: controlsTemplate\n\t });\n\t }();\n\t\n\t //=============================================================================\n\t return {\n\t ListPanel: ListPanel,\n\t ModelListPanel: ModelListPanel\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 92 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This is the run workflow tool form view. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(50), __webpack_require__(5), __webpack_require__(10), __webpack_require__(19), __webpack_require__(46), __webpack_require__(8), __webpack_require__(44), __webpack_require__(147)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Deferred, Ui, Form, FormData, ToolFormBase, Modal, Webhooks, WorkflowIcons) {\n\t\n\t var View = Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.modal = parent.Galaxy.modal || new Modal.View();\n\t this.model = options && options.model || new Backbone.Model(options);\n\t this.deferred = new Deferred();\n\t this.setElement($('
                          ').addClass('ui-form-composite').append(this.$message = $('
                          ')).append(this.$header = $('
                          ')).append(this.$steps = $('
                          ')));\n\t $('body').append(this.$el);\n\t this._configure();\n\t this.render();\n\t $(window).resize(function () {\n\t self._refresh();\n\t });\n\t },\n\t\n\t /** Refresh height of scrollable div below header, handle scrolling by lazy loading steps */\n\t _refresh: function (step_index) {\n\t var margin = _.reduce(this.$el.children(), function (memo, child) {\n\t return memo + $(child).outerHeight();\n\t }, 0) - this.$steps.height() + 90;\n\t this.$steps.css('height', $(window).height() - margin);\n\t },\n\t\n\t /** Configures form/step options for each workflow step */\n\t _configure: function () {\n\t var self = this;\n\t this.forms = [];\n\t this.steps = [];\n\t this.links = [];\n\t this.parms = [];\n\t _.each(this.model.get('steps'), function (step, i) {\n\t Galaxy.emit.debug('tool-form-composite::initialize()', i + ' : Preparing workflow step.');\n\t var icon = WorkflowIcons[step.step_type];\n\t var title = parseInt(i + 1) + ': ' + (step.step_label || step.step_name);\n\t if (step.annotation) {\n\t title += ' - ' + step.annotation;\n\t }\n\t if (step.step_version) {\n\t title += ' (Galaxy Version ' + step.step_version + ')';\n\t }\n\t step = Utils.merge({\n\t index: i,\n\t fixed_title: _.escape(title),\n\t icon: icon || '',\n\t help: null,\n\t citations: null,\n\t collapsible: true,\n\t collapsed: i > 0 && !self._isDataStep(step),\n\t sustain_version: true,\n\t sustain_repeats: true,\n\t sustain_conditionals: true,\n\t narrow: true,\n\t text_enable: 'Edit',\n\t text_disable: 'Undo',\n\t cls_enable: 'fa fa-edit',\n\t cls_disable: 'fa fa-undo',\n\t errors: step.messages,\n\t initial_errors: true,\n\t cls: 'ui-portlet-narrow',\n\t hide_operations: true,\n\t needs_refresh: false,\n\t always_refresh: step.step_type != 'tool'\n\t }, step);\n\t self.steps[i] = step;\n\t self.links[i] = [];\n\t self.parms[i] = {};\n\t });\n\t\n\t // build linear index of step input pairs\n\t _.each(this.steps, function (step, i) {\n\t FormData.visitInputs(step.inputs, function (input, name) {\n\t self.parms[i][name] = input;\n\t });\n\t });\n\t\n\t // iterate through data input modules and collect linked sub steps\n\t _.each(this.steps, function (step, i) {\n\t _.each(step.output_connections, function (output_connection) {\n\t _.each(self.steps, function (sub_step, j) {\n\t sub_step.step_index === output_connection.input_step_index && self.links[i].push(sub_step);\n\t });\n\t });\n\t });\n\t\n\t // convert all connected data inputs to hidden fields with proper labels,\n\t // and track the linked source step\n\t _.each(this.steps, function (step, i) {\n\t _.each(self.steps, function (sub_step, j) {\n\t var connections_by_name = {};\n\t _.each(step.output_connections, function (connection) {\n\t sub_step.step_index === connection.input_step_index && (connections_by_name[connection.input_name] = connection);\n\t });\n\t _.each(self.parms[j], function (input, name) {\n\t var connection = connections_by_name[name];\n\t if (connection) {\n\t input.type = 'hidden';\n\t input.help = input.step_linked ? input.help + ', ' : '';\n\t input.help += 'Output dataset \\'' + connection.output_name + '\\' from step ' + (parseInt(i) + 1);\n\t input.step_linked = input.step_linked || [];\n\t input.step_linked.push(step);\n\t }\n\t });\n\t });\n\t });\n\t\n\t // identify and configure workflow parameters\n\t var wp_count = 0;\n\t this.wp_inputs = {};\n\t function _handleWorkflowParameter(value, callback) {\n\t var re = /\\$\\{(.+?)\\}/g,\n\t match;\n\t while (match = re.exec(String(value))) {\n\t var wp_name = match[1];\n\t callback(self.wp_inputs[wp_name] = self.wp_inputs[wp_name] || {\n\t label: wp_name,\n\t name: wp_name,\n\t type: 'text',\n\t color: 'hsl( ' + ++wp_count * 100 + ', 70%, 30% )',\n\t style: 'ui-form-wp-source',\n\t links: []\n\t });\n\t }\n\t }\n\t _.each(this.steps, function (step, i) {\n\t _.each(self.parms[i], function (input, name) {\n\t _handleWorkflowParameter(input.value, function (wp_input) {\n\t wp_input.links.push(step);\n\t input.wp_linked = true;\n\t input.type = 'text';\n\t input.backdrop = true;\n\t input.style = 'ui-form-wp-target';\n\t });\n\t });\n\t _.each(step.post_job_actions, function (pja) {\n\t _.each(pja.action_arguments, function (arg) {\n\t _handleWorkflowParameter(arg, function () {});\n\t });\n\t });\n\t });\n\t\n\t // select fields are shown for dynamic fields if all putative data inputs are available,\n\t // or if an explicit reference is specified as data_ref and available\n\t _.each(this.steps, function (step, i) {\n\t if (step.step_type == 'tool') {\n\t var data_resolved = true;\n\t FormData.visitInputs(step.inputs, function (input, name, context) {\n\t var is_runtime_value = input.value && input.value.__class__ == 'RuntimeValue';\n\t var is_data_input = ['data', 'data_collection'].indexOf(input.type) != -1;\n\t var data_ref = context[input.data_ref];\n\t input.step_linked && !self._isDataStep(input.step_linked) && (data_resolved = false);\n\t input.options && (input.options.length == 0 && !data_resolved || input.wp_linked) && (input.is_workflow = true);\n\t data_ref && (input.is_workflow = data_ref.step_linked && !self._isDataStep(data_ref.step_linked) || input.wp_linked);\n\t (is_data_input || input.value && input.value.__class__ == 'RuntimeValue' && !input.step_linked) && (step.collapsed = false);\n\t is_runtime_value && (input.value = input.default_value);\n\t input.flavor = 'workflow';\n\t if (!is_runtime_value && !is_data_input && input.type !== 'hidden' && !input.wp_linked) {\n\t if (input.optional || !Utils.isEmpty(input.value) && input.value !== '') {\n\t input.collapsible_value = input.value;\n\t input.collapsible_preview = true;\n\t }\n\t }\n\t });\n\t }\n\t });\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t this.deferred.reset();\n\t this._renderHeader();\n\t this._renderMessage();\n\t this._renderParameters();\n\t this._renderHistory();\n\t _.each(this.steps, function (step) {\n\t self._renderStep(step);\n\t });\n\t },\n\t\n\t /** Render header */\n\t _renderHeader: function () {\n\t var self = this;\n\t this.execute_btn = new Ui.Button({\n\t icon: 'fa-check',\n\t title: 'Run workflow',\n\t cls: 'btn btn-primary',\n\t onclick: function () {\n\t self._execute();\n\t }\n\t });\n\t this.$header.addClass('ui-form-header').empty().append(new Ui.Label({ title: 'Workflow: ' + this.model.get('name') }).$el).append(this.execute_btn.$el);\n\t },\n\t\n\t /** Render message */\n\t _renderMessage: function () {\n\t this.$message.empty();\n\t if (this.model.get('has_upgrade_messages')) {\n\t this.$message.append(new Ui.Message({\n\t message: 'Some tools in this workflow may have changed since it was last saved or some errors were found. The workflow may still run, but any new options will have default values. Please review the messages below to make a decision about whether the changes will affect your analysis.',\n\t status: 'warning',\n\t persistent: true,\n\t fade: false\n\t }).$el);\n\t }\n\t var step_version_changes = this.model.get('step_version_changes');\n\t if (step_version_changes && step_version_changes.length > 0) {\n\t this.$message.append(new Ui.Message({\n\t message: 'Some tools are being executed with different versions compared to those available when this workflow was last saved because the other versions are not or no longer available on this Galaxy instance. To upgrade your workflow and dismiss this message simply edit the workflow and re-save it.',\n\t status: 'warning',\n\t persistent: true,\n\t fade: false\n\t }).$el);\n\t }\n\t },\n\t\n\t /** Render workflow parameters */\n\t _renderParameters: function () {\n\t var self = this;\n\t this.wp_form = null;\n\t if (!_.isEmpty(this.wp_inputs)) {\n\t this.wp_form = new Form({ title: 'Workflow Parameters', inputs: this.wp_inputs, cls: 'ui-portlet-narrow', onchange: function () {\n\t _.each(self.wp_form.input_list, function (input_def, i) {\n\t _.each(input_def.links, function (step) {\n\t self._refreshStep(step);\n\t });\n\t });\n\t }\n\t });\n\t this._append(this.$steps.empty(), this.wp_form.$el);\n\t }\n\t },\n\t\n\t /** Render workflow parameters */\n\t _renderHistory: function () {\n\t this.history_form = new Form({\n\t cls: 'ui-portlet-narrow',\n\t title: 'History Options',\n\t inputs: [{\n\t type: 'conditional',\n\t name: 'new_history',\n\t test_param: {\n\t name: 'check',\n\t label: 'Send results to a new history',\n\t type: 'boolean',\n\t value: 'false',\n\t help: ''\n\t },\n\t cases: [{\n\t value: 'true',\n\t inputs: [{\n\t name: 'name',\n\t label: 'History name',\n\t type: 'text',\n\t value: this.model.get('name')\n\t }]\n\t }]\n\t }]\n\t });\n\t this._append(this.$steps, this.history_form.$el);\n\t },\n\t\n\t /** Render step */\n\t _renderStep: function (step) {\n\t var self = this;\n\t var form = null;\n\t this.deferred.execute(function (promise) {\n\t self.$steps.addClass('ui-steps');\n\t if (step.step_type == 'tool') {\n\t step.postchange = function (process, form) {\n\t var self = this;\n\t var current_state = {\n\t tool_id: step.id,\n\t tool_version: step.version,\n\t inputs: $.extend(true, {}, form.data.create())\n\t };\n\t form.wait(true);\n\t Galaxy.emit.debug('tool-form-composite::postchange()', 'Sending current state.', current_state);\n\t Utils.request({\n\t type: 'POST',\n\t url: Galaxy.root + 'api/tools/' + step.id + '/build',\n\t data: current_state,\n\t success: function (data) {\n\t form.update(data);\n\t form.wait(false);\n\t Galaxy.emit.debug('tool-form-composite::postchange()', 'Received new model.', data);\n\t process.resolve();\n\t },\n\t error: function (response) {\n\t Galaxy.emit.debug('tool-form-composite::postchange()', 'Refresh request failed.', response);\n\t process.reject();\n\t }\n\t });\n\t };\n\t form = new ToolFormBase(step);\n\t if (step.post_job_actions && step.post_job_actions.length) {\n\t form.portlet.append($('
                          ').addClass('ui-form-element-disabled').append($('
                          ').addClass('ui-form-title').html('Job Post Actions')).append($('
                          ').addClass('ui-form-preview').html(_.reduce(step.post_job_actions, function (memo, value) {\n\t return memo + ' ' + value.short_str;\n\t }, ''))));\n\t }\n\t } else {\n\t var is_simple_input = ['data_input', 'data_collection_input'].indexOf(step.step_type) != -1;\n\t _.each(step.inputs, function (input) {\n\t input.flavor = 'module';input.hide_label = is_simple_input;\n\t });\n\t form = new Form(Utils.merge({\n\t title: step.fixed_title,\n\t onchange: function () {\n\t _.each(self.links[step.index], function (link) {\n\t self._refreshStep(link);\n\t });\n\t },\n\t inputs: step.inputs && step.inputs.length > 0 ? step.inputs : [{ type: 'hidden', name: 'No options available.', ignore: null }]\n\t }, step));\n\t }\n\t self.forms[step.index] = form;\n\t self._append(self.$steps, form.$el);\n\t self._refresh();\n\t step.needs_refresh && self._refreshStep(step);\n\t form.portlet[!self.show_progress ? 'enable' : 'disable']();\n\t self.show_progress && self.execute_btn.model.set({ wait: true,\n\t wait_text: 'Preparing...',\n\t percentage: (step.index + 1) * 100.0 / self.steps.length });\n\t Galaxy.emit.debug('tool-form-composite::initialize()', step.index + ' : Workflow step state ready.', step);\n\t setTimeout(function () {\n\t promise.resolve();\n\t }, 0);\n\t });\n\t },\n\t\n\t /** Refreshes step values from source step values */\n\t _refreshStep: function (step) {\n\t var self = this;\n\t var form = this.forms[step.index];\n\t if (form) {\n\t _.each(self.parms[step.index], function (input, name) {\n\t if (input.step_linked || input.wp_linked) {\n\t var field = form.field_list[form.data.match(name)];\n\t if (field) {\n\t var new_value = undefined;\n\t if (input.step_linked) {\n\t new_value = { values: [] };\n\t _.each(input.step_linked, function (source_step) {\n\t if (self._isDataStep(source_step)) {\n\t var value = self.forms[source_step.index].data.create().input;\n\t value && _.each(value.values, function (v) {\n\t new_value.values.push(v);\n\t });\n\t }\n\t });\n\t if (!input.multiple && new_value.values.length > 0) {\n\t new_value = { values: [new_value.values[0]] };\n\t }\n\t } else if (input.wp_linked) {\n\t new_value = input.value;\n\t var re = /\\$\\{(.+?)\\}/g,\n\t match;\n\t while (match = re.exec(input.value)) {\n\t var wp_field = self.wp_form.field_list[self.wp_form.data.match(match[1])];\n\t var wp_value = wp_field && wp_field.value();\n\t if (wp_value) {\n\t new_value = new_value.split(match[0]).join(wp_value);\n\t }\n\t }\n\t }\n\t if (new_value !== undefined) {\n\t field.value(new_value);\n\t }\n\t }\n\t }\n\t });\n\t form.trigger('change');\n\t } else {\n\t step.needs_refresh = true;\n\t }\n\t },\n\t\n\t /** Refresh the history after job submission while form is shown */\n\t _refreshHistory: function () {\n\t var self = this;\n\t var history = parent.Galaxy && parent.Galaxy.currHistoryPanel && parent.Galaxy.currHistoryPanel.model;\n\t this._refresh_history && clearTimeout(this._refresh_history);\n\t if (history) {\n\t history.refresh().success(function () {\n\t if (history.numOfUnfinishedShownContents() === 0) {\n\t self._refresh_history = setTimeout(function () {\n\t self._refreshHistory();\n\t }, history.UPDATE_DELAY);\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** Build remaining steps */\n\t _execute: function () {\n\t var self = this;\n\t this.show_progress = true;\n\t this._enabled(false);\n\t this.deferred.execute(function (promise) {\n\t setTimeout(function () {\n\t promise.resolve();self._submit();\n\t }, 0);\n\t });\n\t },\n\t\n\t /** Validate and submit workflow */\n\t _submit: function () {\n\t var self = this;\n\t var history_form_data = this.history_form.data.create();\n\t var job_def = {\n\t new_history_name: history_form_data['new_history|name'] ? history_form_data['new_history|name'] : null,\n\t history_id: !history_form_data['new_history|name'] ? this.model.get('history_id') : null,\n\t replacement_params: this.wp_form ? this.wp_form.data.create() : {},\n\t parameters: {},\n\t // Tool form will submit flat maps for each parameter\n\t // (e.g. \"repeat_0|cond|param\": \"foo\" instead of nested\n\t // data structures).\n\t parameters_normalized: true,\n\t // Tool form always wants a list of invocations back\n\t // so that inputs can be batched.\n\t batch: true\n\t };\n\t var validated = true;\n\t for (var i in this.forms) {\n\t var form = this.forms[i];\n\t var job_inputs = form.data.create();\n\t var step = self.steps[i];\n\t var step_index = step.step_index;\n\t form.trigger('reset');\n\t for (var job_input_id in job_inputs) {\n\t var input_value = job_inputs[job_input_id];\n\t var input_id = form.data.match(job_input_id);\n\t var input_field = form.field_list[input_id];\n\t var input_def = form.input_list[input_id];\n\t if (!input_def.step_linked) {\n\t if (this._isDataStep(step)) {\n\t validated = input_value && input_value.values && input_value.values.length > 0;\n\t } else {\n\t validated = input_def.optional || input_def.is_workflow && input_value !== '' || !input_def.is_workflow && input_value !== null;\n\t }\n\t if (!validated) {\n\t form.highlight(input_id);\n\t break;\n\t }\n\t job_def.parameters[step_index] = job_def.parameters[step_index] || {};\n\t job_def.parameters[step_index][job_input_id] = job_inputs[job_input_id];\n\t }\n\t }\n\t if (!validated) {\n\t break;\n\t }\n\t }\n\t if (!validated) {\n\t self._enabled(true);\n\t Galaxy.emit.debug('tool-form-composite::submit()', 'Validation failed.', job_def);\n\t } else {\n\t Galaxy.emit.debug('tool-form-composite::submit()', 'Validation complete.', job_def);\n\t Utils.request({\n\t type: 'POST',\n\t url: Galaxy.root + 'api/workflows/' + this.model.id + '/invocations',\n\t data: job_def,\n\t success: function (response) {\n\t Galaxy.emit.debug('tool-form-composite::submit', 'Submission successful.', response);\n\t self.$el.children().hide();\n\t self.$el.append(self._templateSuccess(response));\n\t\n\t // Show Webhook if job is running\n\t if ($.isArray(response) && response.length > 0) {\n\t self.$el.append($('
                          ', { id: 'webhook-view' }));\n\t var WebhookApp = new Webhooks.WebhookView({\n\t urlRoot: Galaxy.root + 'api/webhooks/workflow',\n\t toolId: job_def.tool_id,\n\t toolVersion: job_def.tool_version\n\t });\n\t }\n\t\n\t self._refreshHistory();\n\t },\n\t error: function (response) {\n\t Galaxy.emit.debug('tool-form-composite::submit', 'Submission failed.', response);\n\t var input_found = false;\n\t if (response && response.err_data) {\n\t for (var i in self.forms) {\n\t var form = self.forms[i];\n\t var step_related_errors = response.err_data[form.model.get('step_index')];\n\t if (step_related_errors) {\n\t var error_messages = form.data.matchResponse(step_related_errors);\n\t for (var input_id in error_messages) {\n\t form.highlight(input_id, error_messages[input_id]);\n\t input_found = true;\n\t break;\n\t }\n\t }\n\t }\n\t }\n\t if (!input_found) {\n\t self.modal.show({\n\t title: 'Workflow submission failed',\n\t body: self._templateError(job_def, response && response.err_msg),\n\t buttons: {\n\t 'Close': function () {\n\t self.modal.hide();\n\t }\n\t }\n\t });\n\t }\n\t },\n\t complete: function () {\n\t self._enabled(true);\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** Append new dom to body */\n\t _append: function ($container, $el) {\n\t $container.append('

                          ').append($el);\n\t },\n\t\n\t /** Set enabled/disabled state */\n\t _enabled: function (enabled) {\n\t this.execute_btn.model.set({ wait: !enabled, wait_text: 'Sending...', percentage: -1 });\n\t this.wp_form && this.wp_form.portlet[enabled ? 'enable' : 'disable']();\n\t this.history_form && this.history_form.portlet[enabled ? 'enable' : 'disable']();\n\t _.each(this.forms, function (form) {\n\t form && form.portlet[enabled ? 'enable' : 'disable']();\n\t });\n\t },\n\t\n\t /** Is data input module/step */\n\t _isDataStep: function (steps) {\n\t var lst = $.isArray(steps) ? steps : [steps];\n\t for (var i = 0; i < lst.length; i++) {\n\t var step = lst[i];\n\t if (!step || !step.step_type || !step.step_type.startsWith('data')) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t },\n\t\n\t /** Templates */\n\t _templateSuccess: function (response) {\n\t if ($.isArray(response) && response.length > 0) {\n\t return $('

                          ').addClass('donemessagelarge').append($('

                          ').html('Successfully invoked workflow ' + Utils.sanitize(this.model.get('name')) + '' + (response.length > 1 ? ' ' + response.length + ' times' : '') + '.')).append($('

                          ').append('').text('You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from \\'running\\' to \\'finished\\' if completed successfully or \\'error\\' if problems were encountered.'));\n\t } else {\n\t return this._templateError(response, 'Invalid success response. No invocations found.');\n\t }\n\t },\n\t\n\t _templateError: function (response, err_msg) {\n\t return $('

                          ').addClass('errormessagelarge').append($('

                          ').text('The server could not complete the request. Please contact the Galaxy Team if this error persists. ' + (JSON.stringify(err_msg) || ''))).append($('

                          ').text(JSON.stringify(response, null, 4)));\n\t        }\n\t    });\n\t    return {\n\t        View: View\n\t    };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 93 */,\n/* 94 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_l) {\n\t    'use strict';\n\t\n\t    //TODO: toastr is another possibility - I didn't see where I might add details, tho\n\t\n\t    /* ============================================================================\n\t    Error modals meant to replace the o-so-easy alerts.\n\t    \n\t    These are currently styled as errormessages but use the Galaxy.modal\n\t    infrastructure to be shown/closed. They're capable of showing details in a\n\t    togglable dropdown and the details are formatted in a pre.\n\t    \n\t    Example:\n\t        errorModal( 'Heres a message', 'A Title', { some_details: 'here' });\n\t        errorModal( 'Heres a message' ); // no details, title is 'Error'\n\t    \n\t    There are three specialized forms:\n\t        offlineErrorModal       a canned response for when there's no connection\n\t        badGatewayErrorModal    canned response for when Galaxy is restarting\n\t        ajaxErrorModal          plugable into any Backbone class as an\n\t            error event handler by accepting the error args: model, xhr, options\n\t    \n\t    Examples:\n\t        if( navigator.offLine ){ offlineErrorModal(); }\n\t        if( xhr.status === 502 ){ badGatewayErrorModal(); }\n\t        this.listenTo( this.model, 'error', ajaxErrorModal );\n\t    \n\t    ============================================================================ */\n\t\n\t    var CONTACT_MSG = _l('Please contact a Galaxy administrator if the problem persists.');\n\t    var DEFAULT_AJAX_ERR_MSG = _l('An error occurred while updating information with the server.');\n\t    var DETAILS_MSG = _l('The following information can assist the developers in finding the source of the error:');\n\t\n\t    /** private helper that builds the modal and handles adding details */\n\t    function _errorModal(message, title, details) {\n\t        // create and return the modal, adding details button only if needed\n\t        Galaxy.modal.show({\n\t            title: title,\n\t            body: message,\n\t            closing_events: true,\n\t            buttons: { Ok: function () {\n\t                    Galaxy.modal.hide();\n\t                } }\n\t        });\n\t        Galaxy.modal.$el.addClass('error-modal');\n\t\n\t        if (details) {\n\t            Galaxy.modal.$('.error-details').add(Galaxy.modal.$('button:contains(\"Details\")')).remove();\n\t            $('
                          ').addClass('error-details').hide().appendTo(Galaxy.modal.$('.modal-content')).append([$('

                          ').text(DETAILS_MSG), $('

                          ').text(JSON.stringify(details, null, '  '))]);\n\t\n\t            $('').appendTo(Galaxy.modal.$('.buttons')).click(function () {\n\t                Galaxy.modal.$('.error-details').toggle();\n\t            });\n\t        }\n\t        return Galaxy.modal;\n\t    }\n\t\n\t    /** Display a modal showing an error message but fallback to alert if there's no modal */\n\t    function errorModal(message, title, details) {\n\t        if (!message) {\n\t            return;\n\t        }\n\t\n\t        message = _l(message);\n\t        title = _l(title) || _l('Error:');\n\t        if (window.Galaxy && Galaxy.modal) {\n\t            return _errorModal(message, title, details);\n\t        }\n\t\n\t        alert(title + '\\n\\n' + message);\n\t        console.log('error details:', JSON.stringify(details));\n\t    }\n\t\n\t    // ----------------------------------------------------------------------------\n\t    /** display a modal when the user may be offline */\n\t    function offlineErrorModal() {\n\t        return errorModal(_l('You appear to be offline. Please check your connection and try again.'), _l('Offline?'));\n\t    }\n\t\n\t    // ----------------------------------------------------------------------------\n\t    /** 502 messages that should be displayed when galaxy is restarting */\n\t    function badGatewayErrorModal() {\n\t        return errorModal(_l('Galaxy is currently unreachable. Please try again in a few minutes.') + ' ' + CONTACT_MSG, _l('Cannot connect to Galaxy'));\n\t    }\n\t\n\t    // ----------------------------------------------------------------------------\n\t    /** display a modal (with details) about a failed Backbone ajax operation */\n\t    function ajaxErrorModal(model, xhr, options, message, title) {\n\t        message = message || DEFAULT_AJAX_ERR_MSG;\n\t        message += ' ' + CONTACT_MSG;\n\t        title = title || _l('An error occurred');\n\t        var details = _ajaxDetails(model, xhr, options);\n\t        return errorModal(message, title, details);\n\t    }\n\t\n\t    /** build details which may help debugging the ajax call */\n\t    function _ajaxDetails(model, xhr, options) {\n\t        return {\n\t            //TODO: still can't manage Raven id\n\t            raven: _.result(window.Raven, 'lastEventId'),\n\t            userAgent: navigator.userAgent,\n\t            onLine: navigator.onLine,\n\t            version: _.result(Galaxy.config, 'version_major'),\n\t            xhr: _.omit(xhr, _.functions(xhr)),\n\t            options: _.omit(options, 'xhr'),\n\t            // add ajax data from Galaxy object cache\n\t            url: _.result(Galaxy.lastAjax, 'url'),\n\t            data: _.result(Galaxy.lastAjax, 'data'),\n\t            // backbone stuff (auto-redacting email for user)\n\t            model: _.result(model, 'toJSON', model + ''),\n\t            user: _.omit(_.result(Galaxy.user, 'toJSON'), 'email')\n\t        };\n\t    }\n\t\n\t    //=============================================================================\n\t    return {\n\t        errorModal: errorModal,\n\t        offlineErrorModal: offlineErrorModal,\n\t        badGatewayErrorModal: badGatewayErrorModal,\n\t        ajaxErrorModal: ajaxErrorModal\n\t    };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 95 */,\n/* 96 */,\n/* 97 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, $) {(function (factory) {\n\t    if (true) {\n\t        !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t    } else {\n\t        // Browser globals\n\t        factory(jQuery);\n\t    }\n\t})(function () {\n\t    //=============================================================================\n\t\n\t    jQuery.fn.extend({\n\t        hoverhighlight: function $hoverhighlight(scope, color) {\n\t            scope = scope || 'body';\n\t            if (!this.length) {\n\t                return this;\n\t            }\n\t\n\t            $(this).each(function () {\n\t                var $this = $(this),\n\t                    targetSelector = $this.data('target');\n\t\n\t                if (targetSelector) {\n\t                    $this.mouseover(function (ev) {\n\t                        $(targetSelector, scope).css({\n\t                            background: color\n\t                        });\n\t                    }).mouseout(function (ev) {\n\t                        $(targetSelector).css({\n\t                            background: ''\n\t                        });\n\t                    });\n\t                }\n\t            });\n\t            return this;\n\t        }\n\t    });\n\t});\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 98 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, jQuery) {// from: https://raw.githubusercontent.com/umdjs/umd/master/jqueryPlugin.js\n\t// Uses AMD or browser globals to create a jQuery plugin.\n\t(function (factory) {\n\t    if (true) {\n\t        //TODO: So...this turns out to be an all or nothing thing. If I load jQuery in the define below, it will\n\t        //  (of course) wipe the old jquery *and all the plugins loaded into it*. So the define below *is still\n\t        //  relying on jquery being loaded globally* in order to preserve plugins.\n\t        !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t    } else {\n\t        // Browser globals\n\t        factory(jQuery);\n\t    }\n\t})(function () {\n\t    var _l = window._l || function (s) {\n\t        return s;\n\t    };\n\t\n\t    //TODO: consolidate with tool menu functionality, use there\n\t\n\t    /** searchInput: (jQuery plugin)\n\t     *      Creates a search input, a clear button, and loading indicator\n\t     *      within the selected node.\n\t     *\n\t     *      When the user either presses return or enters some minimal number\n\t     *      of characters, a callback is called. Pressing ESC when the input\n\t     *      is focused will clear the input and call a separate callback.\n\t     */\n\t    function searchInput(parentNode, options) {\n\t        var KEYCODE_ESC = 27,\n\t            KEYCODE_RETURN = 13,\n\t            $parentNode = $(parentNode),\n\t            firstSearch = true,\n\t            defaults = {\n\t            initialVal: '',\n\t            name: 'search',\n\t            placeholder: 'search',\n\t            classes: '',\n\t            onclear: function () {},\n\t            onfirstsearch: null,\n\t            onsearch: function (inputVal) {},\n\t            minSearchLen: 0,\n\t            escWillClear: true,\n\t            oninit: function () {}\n\t        };\n\t\n\t        // .................................................................... input rendering and events\n\t        // visually clear the search, trigger an event, and call the callback\n\t        function clearSearchInput(event) {\n\t            var $input = $(this).parent().children('input');\n\t            $input.val('').trigger('searchInput.clear').blur();\n\t            options.onclear();\n\t        }\n\t\n\t        // search for searchTerms, trigger an event, call the appropo callback (based on whether this is the first)\n\t        function search(event, searchTerms) {\n\t            if (!searchTerms) {\n\t                return clearSearchInput();\n\t            }\n\t            $(this).trigger('search.search', searchTerms);\n\t            if (typeof options.onfirstsearch === 'function' && firstSearch) {\n\t                firstSearch = false;\n\t                options.onfirstsearch(searchTerms);\n\t            } else {\n\t                options.onsearch(searchTerms);\n\t            }\n\t        }\n\t\n\t        // .................................................................... input rendering and events\n\t        function inputTemplate() {\n\t            // class search-query is bootstrap 2.3 style that now lives in base.less\n\t            return [''].join('');\n\t        }\n\t\n\t        // the search input that responds to keyboard events and displays the search value\n\t        function $input() {\n\t            return $(inputTemplate())\n\t            // select all text on a focus\n\t            .focus(function (event) {\n\t                $(this).select();\n\t            })\n\t            // attach behaviors to esc, return if desired, search on some min len string\n\t            .keyup(function (event) {\n\t                event.preventDefault();\n\t                event.stopPropagation();\n\t\n\t                // esc key will clear if desired\n\t                if (event.which === KEYCODE_ESC && options.escWillClear) {\n\t                    clearSearchInput.call(this, event);\n\t                } else {\n\t                    var searchTerms = $(this).val();\n\t                    // return key or the search string len > minSearchLen (if not 0) triggers search\n\t                    if (event.which === KEYCODE_RETURN || options.minSearchLen && searchTerms.length >= options.minSearchLen) {\n\t                        search.call(this, event, searchTerms);\n\t                    }\n\t                }\n\t            }).val(options.initialVal);\n\t        }\n\t\n\t        // .................................................................... clear button rendering and events\n\t        // a button for clearing the search bar, placed on the right hand side\n\t        function $clearBtn() {\n\t            return $([''].join('')).tooltip({ placement: 'bottom' }).click(function (event) {\n\t                clearSearchInput.call(this, event);\n\t            });\n\t        }\n\t\n\t        // .................................................................... loadingIndicator rendering\n\t        // a button for clearing the search bar, placed on the right hand side\n\t        function $loadingIndicator() {\n\t            return $([''].join('')).hide().tooltip({ placement: 'bottom' });\n\t        }\n\t\n\t        // .................................................................... commands\n\t        // visually swap the load, clear buttons\n\t        function toggleLoadingIndicator() {\n\t            $parentNode.find('.search-loading').toggle();\n\t            $parentNode.find('.search-clear').toggle();\n\t        }\n\t\n\t        // .................................................................... init\n\t        // string command (not constructor)\n\t        if (jQuery.type(options) === 'string') {\n\t            if (options === 'toggle-loading') {\n\t                toggleLoadingIndicator();\n\t            }\n\t            return $parentNode;\n\t        }\n\t\n\t        // initial render\n\t        if (jQuery.type(options) === 'object') {\n\t            options = jQuery.extend(true, {}, defaults, options);\n\t        }\n\t        //NOTE: prepended\n\t        return $parentNode.addClass('search-input').prepend([$input(), $clearBtn(), $loadingIndicator()]);\n\t    }\n\t\n\t    // as jq plugin\n\t    jQuery.fn.extend({\n\t        searchInput: function $searchInput(options) {\n\t            return this.each(function () {\n\t                return searchInput(this, options);\n\t            });\n\t        }\n\t    });\n\t});\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 99 */,\n/* 100 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t    // Alphanumeric/natural sort fn\n\t    function naturalSort(a, b) {\n\t        // setup temp-scope variables for comparison evauluation\n\t        var re = /(-?[0-9\\.]+)/g,\n\t            x = a.toString().toLowerCase() || '',\n\t            y = b.toString().toLowerCase() || '',\n\t            nC = String.fromCharCode(0),\n\t            xN = x.replace(re, nC + '$1' + nC).split(nC),\n\t            yN = y.replace(re, nC + '$1' + nC).split(nC),\n\t            xD = new Date(x).getTime(),\n\t            yD = xD ? new Date(y).getTime() : null;\n\t        // natural sorting of dates\n\t        if (yD) {\n\t            if (xD < yD) {\n\t                return -1;\n\t            } else if (xD > yD) {\n\t                return 1;\n\t            }\n\t        }\n\t        // natural sorting through split numeric strings and default strings\n\t        var oFxNcL, oFyNcL;\n\t        for (var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {\n\t            oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];\n\t            oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];\n\t            if (oFxNcL < oFyNcL) {\n\t                return -1;\n\t            } else if (oFxNcL > oFyNcL) {\n\t                return 1;\n\t            }\n\t        }\n\t        return 0;\n\t    }\n\t\n\t    return naturalSort;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ },\n/* 101 */,\n/* 102 */,\n/* 103 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Backbone) {var Ui = __webpack_require__(5),\n\t    historyOptionsMenu = __webpack_require__(135);\n\tCurrentHistoryView = __webpack_require__(132).CurrentHistoryView, _l = __webpack_require__(6);\n\t\n\t/** the right hand panel in the analysis page that shows the current history */\n\tvar HistoryPanel = Backbone.View.extend({\n\t\n\t    initialize: function (page, options) {\n\t        var self = this;\n\t        this.userIsAnonymous = Galaxy.user.isAnonymous();\n\t        this.allow_user_dataset_purge = options.config.allow_user_dataset_purge;\n\t        this.root = options.root;\n\t\n\t        // view of the current history\n\t        this.historyView = new CurrentHistoryView({\n\t            className: CurrentHistoryView.prototype.className + ' middle',\n\t            purgeAllowed: this.allow_user_dataset_purge,\n\t            linkTarget: 'galaxy_main'\n\t        });\n\t\n\t        // add history panel to Galaxy object\n\t        Galaxy.currHistoryPanel = this.historyView;\n\t        Galaxy.currHistoryPanel.listenToGalaxy(Galaxy);\n\t\n\t        // build buttons\n\t        this.buttonRefresh = new Ui.ButtonLink({\n\t            id: 'history-refresh-button',\n\t            title: 'Refresh history',\n\t            cls: 'panel-header-button',\n\t            icon: 'fa fa-refresh',\n\t            onclick: function () {\n\t                self.historyView.loadCurrentHistory();\n\t            }\n\t        });\n\t        this.buttonOptions = new Ui.ButtonLink({\n\t            id: 'history-options-button',\n\t            title: 'History options',\n\t            cls: 'panel-header-button',\n\t            target: 'galaxy_main',\n\t            icon: 'fa fa-cog',\n\t            href: this.root + 'root/history_options'\n\t        });\n\t        this.buttonViewMulti = new Ui.ButtonLink({\n\t            id: 'history-view-multi-button',\n\t            title: 'View all histories',\n\t            cls: 'panel-header-button',\n\t            icon: 'fa fa-columns',\n\t            href: this.root + 'history/view_multiple'\n\t        });\n\t\n\t        // define components\n\t        this.model = new Backbone.Model({\n\t            cls: 'history-right-panel',\n\t            title: _l('History'),\n\t            buttons: [this.buttonRefresh, this.buttonOptions, this.buttonViewMulti]\n\t        });\n\t\n\t        // build body template and connect history view\n\t        this.setElement(this._template());\n\t        this.historyView.setElement(this.$el);\n\t        this.historyView.connectToQuotaMeter(Galaxy.quotaMeter);\n\t        this.historyView.loadCurrentHistory();\n\t\n\t        // fetch to update the quota meter adding 'current' for any anon-user's id\n\t        Galaxy.listenTo(this.historyView, 'history-size-change', function () {\n\t            Galaxy.user.fetch({ url: Galaxy.user.urlRoot() + '/' + (Galaxy.user.id || 'current') });\n\t        });\n\t    },\n\t\n\t    render: function () {\n\t        this.optionsMenu = historyOptionsMenu(this.buttonOptions.$el, {\n\t            anonymous: this.userIsAnonymous,\n\t            purgeAllowed: this.allow_user_dataset_purge,\n\t            root: this.root\n\t        });\n\t        this.buttonViewMulti.$el[!this.userIsAnonymous ? 'show' : 'hide']();\n\t    },\n\t\n\t    /** add history view div */\n\t    _template: function (data) {\n\t        return ['
                          '].join('');\n\t },\n\t\n\t toString: function () {\n\t return 'historyPanel';\n\t }\n\t});\n\t\n\tmodule.exports = HistoryPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 104 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Backbone, _) {var Tools = __webpack_require__(68),\n\t Upload = __webpack_require__(143),\n\t _l = __webpack_require__(6),\n\t ToolForm = __webpack_require__(92);\n\t\n\tvar ToolPanel = Backbone.View.extend({\n\t initialize: function (page, options) {\n\t // access configuration options\n\t var config = options.config;\n\t this.root = options.root;\n\t\n\t /** @type {Object[]} descriptions of user's workflows to be shown in the tool menu */\n\t this.stored_workflow_menu_entries = config.stored_workflow_menu_entries || [];\n\t\n\t // create tool search, tool panel, and tool panel view.\n\t var tool_search = new Tools.ToolSearch({\n\t hidden: false\n\t });\n\t var tools = new Tools.ToolCollection(config.toolbox);\n\t this.tool_panel = new Tools.ToolPanel({\n\t tool_search: tool_search,\n\t tools: tools,\n\t layout: config.toolbox_in_panel\n\t });\n\t this.tool_panel_view = new Tools.ToolPanelView({ model: this.tool_panel });\n\t\n\t // add upload modal\n\t this.upload_button = new Upload({\n\t nginx_upload_path: config.nginx_upload_path,\n\t ftp_upload_site: config.ftp_upload_site,\n\t default_genome: config.default_genome,\n\t default_extension: config.default_extension\n\t });\n\t\n\t // add uploader button to Galaxy object\n\t Galaxy.upload = this.upload_button;\n\t\n\t // components for panel definition\n\t this.model = new Backbone.Model({\n\t title: _l('Tools'),\n\t buttons: [this.upload_button]\n\t });\n\t\n\t // build body template\n\t this.setElement(this._template());\n\t },\n\t\n\t render: function () {\n\t // if there are tools, render panel and display everything\n\t var self = this;\n\t if (this.tool_panel.get('layout').size() > 0) {\n\t this.$el.prepend(this.tool_panel_view.$el);\n\t this.tool_panel_view.render();\n\t }\n\t // build the dom for the workflow portion of the tool menu\n\t // add internal workflow list\n\t self.$('#internal-workflows').append(self._templateAllWorkflow({\n\t title: _l('All workflows'),\n\t href: 'workflow'\n\t }));\n\t _.each(this.stored_workflow_menu_entries, function (menu_entry) {\n\t self.$('#internal-workflows').append(self._templateWorkflowLink({\n\t title: menu_entry.stored_workflow.name,\n\t href: 'workflow/run?id=' + menu_entry.encoded_stored_workflow_id\n\t }));\n\t });\n\t },\n\t\n\t /** build a link to one tool */\n\t _templateTool: function (tool) {\n\t return [''].join('');\n\t },\n\t\n\t /** build a link to 'All Workflows' */\n\t _templateAllWorkflow: function (tool) {\n\t return ['
                          ',\n\t // global\n\t '', tool.title, '', '
                          '].join('');\n\t },\n\t\n\t /** build links to workflows in toolpanel */\n\t _templateWorkflowLink: function (wf) {\n\t return [''].join('');\n\t },\n\t\n\t /** override to include inital menu dom and workflow section */\n\t _template: function () {\n\t return ['
                          ', '
                          ', '
                          ', '', _l('Search did not match any tools.'), '', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '', _l('Workflows'), '', '
                          ', '
                          ', '
                          ', '
                          ', '
                          '].join('');\n\t },\n\t\n\t toString: function () {\n\t return 'toolPanel';\n\t }\n\t});\n\t\n\tmodule.exports = ToolPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3)))\n\n/***/ },\n/* 105 */,\n/* 106 */,\n/* 107 */,\n/* 108 */,\n/* 109 */,\n/* 110 */,\n/* 111 */,\n/* 112 */,\n/* 113 */,\n/* 114 */,\n/* 115 */,\n/* 116 */,\n/* 117 */,\n/* 118 */,\n/* 119 */,\n/* 120 */,\n/* 121 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {/*\n\t * Toastr\n\t * Version 2.0.1\n\t * Copyright 2012 John Papa and Hans Fjällemark. \n\t * All Rights Reserved. \n\t * Use, reproduction, distribution, and modification of this code is subject to the terms and \n\t * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php\n\t *\n\t * Author: John Papa and Hans Fjällemark\n\t * Project: https://github.com/CodeSeven/toastr\n\t */\n\t;(function (define) {\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t\t\tvar $ = jQuery;\n\t\t\treturn function () {\n\t\t\t\tvar version = '2.0.1';\n\t\t\t\tvar $container;\n\t\t\t\tvar listener;\n\t\t\t\tvar toastId = 0;\n\t\t\t\tvar toastType = {\n\t\t\t\t\terror: 'error',\n\t\t\t\t\tinfo: 'info',\n\t\t\t\t\tsuccess: 'success',\n\t\t\t\t\twarning: 'warning'\n\t\t\t\t};\n\t\n\t\t\t\tvar toastr = {\n\t\t\t\t\tclear: clear,\n\t\t\t\t\terror: error,\n\t\t\t\t\tgetContainer: getContainer,\n\t\t\t\t\tinfo: info,\n\t\t\t\t\toptions: {},\n\t\t\t\t\tsubscribe: subscribe,\n\t\t\t\t\tsuccess: success,\n\t\t\t\t\tversion: version,\n\t\t\t\t\twarning: warning\n\t\t\t\t};\n\t\n\t\t\t\treturn toastr;\n\t\n\t\t\t\t//#region Accessible Methods\n\t\t\t\tfunction error(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.error,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.error,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction info(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.info,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.info,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction subscribe(callback) {\n\t\t\t\t\tlistener = callback;\n\t\t\t\t}\n\t\n\t\t\t\tfunction success(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.success,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.success,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction warning(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.warning,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.warning,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction clear($toastElement) {\n\t\t\t\t\tvar options = getOptions();\n\t\t\t\t\tif (!$container) {\n\t\t\t\t\t\tgetContainer(options);\n\t\t\t\t\t}\n\t\t\t\t\tif ($toastElement && $(':focus', $toastElement).length === 0) {\n\t\t\t\t\t\t$toastElement[options.hideMethod]({\n\t\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\t\tremoveToast($toastElement);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif ($container.children().length) {\n\t\t\t\t\t\t$container[options.hideMethod]({\n\t\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\t\t$container.remove();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//#endregion\n\t\n\t\t\t\t//#region Internal Methods\n\t\n\t\t\t\tfunction getDefaults() {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttapToDismiss: true,\n\t\t\t\t\t\ttoastClass: 'toast',\n\t\t\t\t\t\tcontainerId: 'toast-container',\n\t\t\t\t\t\tdebug: false,\n\t\n\t\t\t\t\t\tshowMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery\n\t\t\t\t\t\tshowDuration: 300,\n\t\t\t\t\t\tshowEasing: 'swing', //swing and linear are built into jQuery\n\t\t\t\t\t\tonShown: undefined,\n\t\t\t\t\t\thideMethod: 'fadeOut',\n\t\t\t\t\t\thideDuration: 1000,\n\t\t\t\t\t\thideEasing: 'swing',\n\t\t\t\t\t\tonHidden: undefined,\n\t\n\t\t\t\t\t\textendedTimeOut: 1000,\n\t\t\t\t\t\ticonClasses: {\n\t\t\t\t\t\t\terror: 'toast-error',\n\t\t\t\t\t\t\tinfo: 'toast-info',\n\t\t\t\t\t\t\tsuccess: 'toast-success',\n\t\t\t\t\t\t\twarning: 'toast-warning'\n\t\t\t\t\t\t},\n\t\t\t\t\t\ticonClass: 'toast-info',\n\t\t\t\t\t\tpositionClass: 'toast-top-right',\n\t\t\t\t\t\ttimeOut: 5000, // Set timeOut and extendedTimeout to 0 to make it sticky\n\t\t\t\t\t\ttitleClass: 'toast-title',\n\t\t\t\t\t\tmessageClass: 'toast-message',\n\t\t\t\t\t\ttarget: 'body',\n\t\t\t\t\t\tcloseHtml: '',\n\t\t\t\t\t\tnewestOnTop: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\n\t\t\t\tfunction publish(args) {\n\t\t\t\t\tif (!listener) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlistener(args);\n\t\t\t\t}\n\t\n\t\t\t\tfunction notify(map) {\n\t\t\t\t\tvar options = getOptions(),\n\t\t\t\t\t iconClass = map.iconClass || options.iconClass;\n\t\n\t\t\t\t\tif (typeof map.optionsOverride !== 'undefined') {\n\t\t\t\t\t\toptions = $.extend(options, map.optionsOverride);\n\t\t\t\t\t\ticonClass = map.optionsOverride.iconClass || iconClass;\n\t\t\t\t\t}\n\t\n\t\t\t\t\ttoastId++;\n\t\n\t\t\t\t\t$container = getContainer(options);\n\t\t\t\t\tvar intervalId = null,\n\t\t\t\t\t $toastElement = $('
                          '),\n\t\t\t\t\t $titleElement = $('
                          '),\n\t\t\t\t\t $messageElement = $('
                          '),\n\t\t\t\t\t $closeElement = $(options.closeHtml),\n\t\t\t\t\t response = {\n\t\t\t\t\t\ttoastId: toastId,\n\t\t\t\t\t\tstate: 'visible',\n\t\t\t\t\t\tstartTime: new Date(),\n\t\t\t\t\t\toptions: options,\n\t\t\t\t\t\tmap: map\n\t\t\t\t\t};\n\t\n\t\t\t\t\tif (map.iconClass) {\n\t\t\t\t\t\t$toastElement.addClass(options.toastClass).addClass(iconClass);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (map.title) {\n\t\t\t\t\t\t$titleElement.append(map.title).addClass(options.titleClass);\n\t\t\t\t\t\t$toastElement.append($titleElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (map.message) {\n\t\t\t\t\t\t$messageElement.append(map.message).addClass(options.messageClass);\n\t\t\t\t\t\t$toastElement.append($messageElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (options.closeButton) {\n\t\t\t\t\t\t$closeElement.addClass('toast-close-button');\n\t\t\t\t\t\t$toastElement.prepend($closeElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$toastElement.hide();\n\t\t\t\t\tif (options.newestOnTop) {\n\t\t\t\t\t\t$container.prepend($toastElement);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$container.append($toastElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$toastElement[options.showMethod]({ duration: options.showDuration, easing: options.showEasing, complete: options.onShown });\n\t\t\t\t\tif (options.timeOut > 0) {\n\t\t\t\t\t\tintervalId = setTimeout(hideToast, options.timeOut);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$toastElement.hover(stickAround, delayedhideToast);\n\t\t\t\t\tif (!options.onclick && options.tapToDismiss) {\n\t\t\t\t\t\t$toastElement.click(hideToast);\n\t\t\t\t\t}\n\t\t\t\t\tif (options.closeButton && $closeElement) {\n\t\t\t\t\t\t$closeElement.click(function (event) {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\thideToast(true);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (options.onclick) {\n\t\t\t\t\t\t$toastElement.click(function () {\n\t\t\t\t\t\t\toptions.onclick();\n\t\t\t\t\t\t\thideToast();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\tpublish(response);\n\t\n\t\t\t\t\tif (options.debug && console) {\n\t\t\t\t\t\tconsole.log(response);\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn $toastElement;\n\t\n\t\t\t\t\tfunction hideToast(override) {\n\t\t\t\t\t\tif ($(':focus', $toastElement).length && !override) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn $toastElement[options.hideMethod]({\n\t\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\t\tremoveToast($toastElement);\n\t\t\t\t\t\t\t\tif (options.onHidden) {\n\t\t\t\t\t\t\t\t\toptions.onHidden();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tresponse.state = 'hidden';\n\t\t\t\t\t\t\t\tresponse.endTime = new Date(), publish(response);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\tfunction delayedhideToast() {\n\t\t\t\t\t\tif (options.timeOut > 0 || options.extendedTimeOut > 0) {\n\t\t\t\t\t\t\tintervalId = setTimeout(hideToast, options.extendedTimeOut);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\tfunction stickAround() {\n\t\t\t\t\t\tclearTimeout(intervalId);\n\t\t\t\t\t\t$toastElement.stop(true, true)[options.showMethod]({ duration: options.showDuration, easing: options.showEasing });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction getContainer(options) {\n\t\t\t\t\tif (!options) {\n\t\t\t\t\t\toptions = getOptions();\n\t\t\t\t\t}\n\t\t\t\t\t$container = $('#' + options.containerId);\n\t\t\t\t\tif ($container.length) {\n\t\t\t\t\t\treturn $container;\n\t\t\t\t\t}\n\t\t\t\t\t$container = $('
                          ').attr('id', options.containerId).addClass(options.positionClass);\n\t\t\t\t\t$container.appendTo($(options.target));\n\t\t\t\t\treturn $container;\n\t\t\t\t}\n\t\n\t\t\t\tfunction getOptions() {\n\t\t\t\t\treturn $.extend({}, getDefaults(), toastr.options);\n\t\t\t\t}\n\t\n\t\t\t\tfunction removeToast($toastElement) {\n\t\t\t\t\tif (!$container) {\n\t\t\t\t\t\t$container = getContainer();\n\t\t\t\t\t}\n\t\t\t\t\tif ($toastElement.is(':visible')) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t$toastElement.remove();\n\t\t\t\t\t$toastElement = null;\n\t\t\t\t\tif ($container.children().length === 0) {\n\t\t\t\t\t\t$container.remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//#endregion\n\t\t\t}();\n\t\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t})(__webpack_require__(165));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 122 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(58), __webpack_require__(84), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DC_LI, DATASET_LI_EDIT, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t //==============================================================================\n\t\n\t var DCListItemView = DC_LI.DCListItemView;\n\t /** @class Edit view for DatasetCollection.\n\t */\n\t var DCListItemEdit = DCListItemView.extend(\n\t /** @lends DCListItemEdit.prototype */{\n\t\n\t /** override to add linkTarget */\n\t initialize: function (attributes) {\n\t DCListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t var DCEListItemView = DC_LI.DCEListItemView;\n\t /** @class Read only view for DatasetCollectionElement.\n\t */\n\t var DCEListItemEdit = DCEListItemView.extend(\n\t /** @lends DCEListItemEdit.prototype */{\n\t //TODO: this might be expendable - compacted with HDAListItemView\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t DCEListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCEListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t // NOTE: this does not inherit from DatasetDCEListItemView as you would expect\n\t //TODO: but should - if we can find something simpler than using diamond\n\t /** @class Editable view for a DatasetCollectionElement that is also an DatasetAssociation\n\t * (a dataset contained in a dataset collection).\n\t */\n\t var DatasetDCEListItemEdit = DATASET_LI_EDIT.DatasetListItemEdit.extend(\n\t /** @lends DatasetDCEListItemEdit.prototype */{\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t DATASET_LI_EDIT.DatasetListItemEdit.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // NOTE: this does not inherit from DatasetDCEListItemView - so we duplicate this here\n\t //TODO: fix\n\t /** In this override, only get details if in the ready state.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** Override to remove delete button */\n\t _renderDeleteButton: function () {\n\t return null;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DatasetDCEListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetDCEListItemEdit.prototype.templates = function () {\n\t\n\t return _.extend({}, DATASET_LI_EDIT.DatasetListItemEdit.prototype.templates, {\n\t titleBar: DC_LI.DatasetDCEListItemView.prototype.templates.titleBar\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\t var NestedDCDCEListItemEdit = DC_LI.NestedDCDCEListItemView.extend(\n\t /** @lends NestedDCDCEListItemEdit.prototype */{\n\t\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'NestedDCDCEListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t DCListItemEdit: DCListItemEdit,\n\t DCEListItemEdit: DCEListItemEdit,\n\t DatasetDCEListItemEdit: DatasetDCEListItemEdit,\n\t NestedDCDCEListItemEdit: NestedDCDCEListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 123 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(83), __webpack_require__(59), __webpack_require__(122), __webpack_require__(7), __webpack_require__(45), __webpack_require__(25), __webpack_require__(6), __webpack_require__(24)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, TAGS, faIconButton, _l) {\n\t\n\t 'use strict';\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t /** @class editable View/Controller for a dataset collection.\n\t */\n\t\n\t var _super = DC_VIEW.CollectionView;\n\t var CollectionViewEdit = _super.extend(\n\t /** @lends CollectionView.prototype */{\n\t //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n\t\n\t /** logger used to record this.log messages, commonly set to console */\n\t //logger : console,\n\t\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_EDIT.DatasetDCEListItemEdit,\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit,\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes optional settings for the panel\n\t */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t /** In this override, make the collection name editable\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t _super.prototype._setUpBehaviors.call(this, $where);\n\t if (!this.model) {\n\t return;\n\t }\n\t\n\t // anon users shouldn't have access to any of the following\n\t if (!Galaxy.user || Galaxy.user.isAnonymous()) {\n\t return;\n\t }\n\t\n\t this.tagsEditorShown = true;\n\t\n\t //TODO: extract\n\t var panel = this,\n\t nameSelector = '> .controls .name';\n\t $where.find(nameSelector).attr('title', _l('Click to rename collection')).tooltip({ placement: 'bottom' }).make_text_editable({\n\t on_finish: function (newName) {\n\t var previousName = panel.model.get('name');\n\t if (newName && newName !== previousName) {\n\t panel.$el.find(nameSelector).text(newName);\n\t panel.model.save({ name: newName }).fail(function () {\n\t panel.$el.find(nameSelector).text(panel.model.previous('name'));\n\t });\n\t } else {\n\t panel.$el.find(nameSelector).text(previousName);\n\t }\n\t }\n\t });\n\t this.tagsEditor = new TAGS.TagsEditor({\n\t model: this.model,\n\t el: $where.find('.tags-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t usePrompt: false\n\t });\n\t this.tagsEditor.toggle(true);\n\t },\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'CollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var ListCollectionViewEdit = CollectionViewEdit.extend(\n\t /** @lends ListCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_EDIT.DatasetDCEListItemEdit,\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class Editable, read-only View/Controller for a dataset collection. */\n\t var PairCollectionViewEdit = ListCollectionViewEdit.extend(\n\t /** @lends PairCollectionViewEdit.prototype */{\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'PairCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class Editable (roughly since these collections are immutable),\n\t * View/Controller for a dataset collection.\n\t */\n\t var NestedPairCollectionViewEdit = PairCollectionViewEdit.extend(\n\t /** @lends NestedPairCollectionViewEdit.prototype */{\n\t\n\t /** Override to remove the editable text from the name/identifier - these collections are considered immutable */\n\t _setUpBehaviors: function ($where) {\n\t _super.prototype._setUpBehaviors.call(this, $where);\n\t },\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'NestedPairCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class editable, View/Controller for a list of pairs dataset collection. */\n\t var ListOfPairsCollectionViewEdit = CollectionViewEdit.extend(\n\t /** @lends ListOfPairsCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit.extend({\n\t foldoutPanelClass: NestedPairCollectionViewEdit\n\t }),\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfPairsCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class View/Controller for a list of lists dataset collection. */\n\t var ListOfListsCollectionViewEdit = CollectionViewEdit.extend(\n\t /** @lends ListOfListsCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit.extend({\n\t foldoutPanelClass: NestedPairCollectionViewEdit\n\t }),\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfListsCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t CollectionViewEdit: CollectionViewEdit,\n\t ListCollectionViewEdit: ListCollectionViewEdit,\n\t PairCollectionViewEdit: PairCollectionViewEdit,\n\t ListOfPairsCollectionViewEdit: ListOfPairsCollectionViewEdit,\n\t ListOfListsCollectionViewEdit: ListOfListsCollectionViewEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ },\n/* 124 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(156), __webpack_require__(100), __webpack_require__(82), __webpack_require__(7), __webpack_require__(6), __webpack_require__(97)], __WEBPACK_AMD_DEFINE_RESULT__ = function (levenshteinDistance, naturalSort, baseCreator, baseMVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t /* ============================================================================\n\t TODO:\n\t \n\t \n\t PROGRAMMATICALLY:\n\t currPanel.once( 'rendered', function(){\n\t currPanel.showSelectors();\n\t currPanel.selectAll();\n\t _.last( currPanel.actionsPopup.options ).func();\n\t });\n\t \n\t ============================================================================ */\n\t /** A view for paired datasets in the collections creator.\n\t */\n\t var PairView = Backbone.View.extend(baseMVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t tagName: 'li',\n\t className: 'dataset paired',\n\t\n\t initialize: function (attributes) {\n\t this.pair = attributes.pair || {};\n\t },\n\t\n\t template: _.template(['<%- pair.forward.name %>', '', '<%- pair.name %>', '', '<%- pair.reverse.name %>'].join('')),\n\t\n\t render: function () {\n\t this.$el.attr('draggable', true).data('pair', this.pair).html(this.template({ pair: this.pair })).addClass('flex-column-container');\n\t return this;\n\t },\n\t\n\t events: {\n\t 'dragstart': '_dragstart',\n\t 'dragend': '_dragend',\n\t 'dragover': '_sendToParent',\n\t 'drop': '_sendToParent'\n\t },\n\t\n\t /** dragging pairs for re-ordering */\n\t _dragstart: function (ev) {\n\t ev.currentTarget.style.opacity = '0.4';\n\t if (ev.originalEvent) {\n\t ev = ev.originalEvent;\n\t }\n\t\n\t ev.dataTransfer.effectAllowed = 'move';\n\t ev.dataTransfer.setData('text/plain', JSON.stringify(this.pair));\n\t\n\t this.$el.parent().trigger('pair.dragstart', [this]);\n\t },\n\t\n\t /** dragging pairs for re-ordering */\n\t _dragend: function (ev) {\n\t ev.currentTarget.style.opacity = '1.0';\n\t this.$el.parent().trigger('pair.dragend', [this]);\n\t },\n\t\n\t /** manually bubble up an event to the parent/container */\n\t _sendToParent: function (ev) {\n\t this.$el.parent().trigger(ev);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'PairView(' + this.pair.name + ')';\n\t }\n\t });\n\t\n\t // ============================================================================\n\t /** returns an autopair function that uses the provided options.match function */\n\t function autoPairFnBuilder(options) {\n\t options = options || {};\n\t options.createPair = options.createPair || function _defaultCreatePair(params) {\n\t params = params || {};\n\t var a = params.listA.splice(params.indexA, 1)[0],\n\t b = params.listB.splice(params.indexB, 1)[0],\n\t aInBIndex = params.listB.indexOf(a),\n\t bInAIndex = params.listA.indexOf(b);\n\t if (aInBIndex !== -1) {\n\t params.listB.splice(aInBIndex, 1);\n\t }\n\t if (bInAIndex !== -1) {\n\t params.listA.splice(bInAIndex, 1);\n\t }\n\t return this._pair(a, b, { silent: true });\n\t };\n\t // compile these here outside of the loop\n\t var _regexps = [];\n\t function getRegExps() {\n\t if (!_regexps.length) {\n\t _regexps = [new RegExp(this.filters[0]), new RegExp(this.filters[1])];\n\t }\n\t return _regexps;\n\t }\n\t // mangle params as needed\n\t options.preprocessMatch = options.preprocessMatch || function _defaultPreprocessMatch(params) {\n\t var regexps = getRegExps.call(this);\n\t return _.extend(params, {\n\t matchTo: params.matchTo.name.replace(regexps[0], ''),\n\t possible: params.possible.name.replace(regexps[1], '')\n\t });\n\t };\n\t\n\t return function _strategy(params) {\n\t this.debug('autopair _strategy ---------------------------');\n\t params = params || {};\n\t var listA = params.listA,\n\t listB = params.listB,\n\t indexA = 0,\n\t indexB,\n\t bestMatch = {\n\t score: 0.0,\n\t index: null\n\t },\n\t paired = [];\n\t //console.debug( 'params:', JSON.stringify( params, null, ' ' ) );\n\t this.debug('starting list lens:', listA.length, listB.length);\n\t this.debug('bestMatch (starting):', JSON.stringify(bestMatch, null, ' '));\n\t\n\t while (indexA < listA.length) {\n\t var matchTo = listA[indexA];\n\t bestMatch.score = 0.0;\n\t\n\t for (indexB = 0; indexB < listB.length; indexB++) {\n\t var possible = listB[indexB];\n\t this.debug(indexA + ':' + matchTo.name);\n\t this.debug(indexB + ':' + possible.name);\n\t\n\t // no matching with self\n\t if (listA[indexA] !== listB[indexB]) {\n\t bestMatch = options.match.call(this, options.preprocessMatch.call(this, {\n\t matchTo: matchTo,\n\t possible: possible,\n\t index: indexB,\n\t bestMatch: bestMatch\n\t }));\n\t this.debug('bestMatch:', JSON.stringify(bestMatch, null, ' '));\n\t if (bestMatch.score === 1.0) {\n\t this.debug('breaking early due to perfect match');\n\t break;\n\t }\n\t }\n\t }\n\t var scoreThreshold = options.scoreThreshold.call(this);\n\t this.debug('scoreThreshold:', scoreThreshold);\n\t this.debug('bestMatch.score:', bestMatch.score);\n\t\n\t if (bestMatch.score >= scoreThreshold) {\n\t //console.debug( 'autoPairFnBuilder.strategy', listA[ indexA ].name, listB[ bestMatch.index ].name );\n\t paired.push(options.createPair.call(this, {\n\t listA: listA,\n\t indexA: indexA,\n\t listB: listB,\n\t indexB: bestMatch.index\n\t }));\n\t //console.debug( 'list lens now:', listA.length, listB.length );\n\t } else {\n\t indexA += 1;\n\t }\n\t if (!listA.length || !listB.length) {\n\t return paired;\n\t }\n\t }\n\t this.debug('paired:', JSON.stringify(paired, null, ' '));\n\t this.debug('autopair _strategy ---------------------------');\n\t return paired;\n\t };\n\t }\n\t\n\t // ============================================================================\n\t /** An interface for building collections of paired datasets.\n\t */\n\t var PairedCollectionCreator = Backbone.View.extend(baseMVC.LoggableMixin).extend(baseCreator.CollectionCreatorMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t className: 'list-of-pairs-collection-creator collection-creator flex-row-container',\n\t\n\t /** set up initial options, instance vars, behaviors, and autopair (if set to do so) */\n\t initialize: function (attributes) {\n\t this.metric('PairedCollectionCreator.initialize', attributes);\n\t //this.debug( '-- PairedCollectionCreator:', attributes );\n\t\n\t attributes = _.defaults(attributes, {\n\t datasets: [],\n\t filters: this.DEFAULT_FILTERS,\n\t automaticallyPair: true,\n\t strategy: 'lcs',\n\t matchPercentage: 0.9,\n\t twoPassAutopairing: true\n\t });\n\t\n\t /** unordered, original list */\n\t this.initialList = attributes.datasets;\n\t\n\t /** is this from a history? if so, what's its id? */\n\t this.historyId = attributes.historyId;\n\t\n\t /** which filters should be used initially? (String[2] or name in commonFilters) */\n\t this.filters = this.commonFilters[attributes.filters] || this.commonFilters[this.DEFAULT_FILTERS];\n\t if (_.isArray(attributes.filters)) {\n\t this.filters = attributes.filters;\n\t }\n\t\n\t /** try to auto pair the unpaired datasets on load? */\n\t this.automaticallyPair = attributes.automaticallyPair;\n\t\n\t /** what method to use for auto pairing (will be passed aggression level) */\n\t this.strategy = this.strategies[attributes.strategy] || this.strategies[this.DEFAULT_STRATEGY];\n\t if (_.isFunction(attributes.strategy)) {\n\t this.strategy = attributes.strategy;\n\t }\n\t\n\t /** distance/mismatch level allowed for autopairing */\n\t this.matchPercentage = attributes.matchPercentage;\n\t\n\t /** try to autopair using simple first, then this.strategy on the remainder */\n\t this.twoPassAutopairing = attributes.twoPassAutopairing;\n\t\n\t /** remove file extensions (\\.*) from created pair names? */\n\t this.removeExtensions = true;\n\t //this.removeExtensions = false;\n\t\n\t /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n\t this.oncancel = attributes.oncancel;\n\t /** fn to call when the collection is created (scoped to this) */\n\t this.oncreate = attributes.oncreate;\n\t\n\t /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n\t this.autoscrollDist = attributes.autoscrollDist || 24;\n\t\n\t /** is the unpaired panel shown? */\n\t this.unpairedPanelHidden = false;\n\t /** is the paired panel shown? */\n\t this.pairedPanelHidden = false;\n\t\n\t /** DOM elements currently being dragged */\n\t this.$dragging = null;\n\t\n\t /** Used for blocking UI events during ajax/operations (don't post twice) */\n\t this.blocking = false;\n\t\n\t this._setUpCommonSettings(attributes);\n\t this._setUpBehaviors();\n\t this._dataSetUp();\n\t },\n\t\n\t /** map of common filter pairs by name */\n\t commonFilters: {\n\t illumina: ['_1', '_2'],\n\t Rs: ['_R1', '_R2']\n\t },\n\t /** which commonFilter to use by default */\n\t DEFAULT_FILTERS: 'illumina',\n\t\n\t /** map of name->fn for autopairing */\n\t strategies: {\n\t 'simple': 'autopairSimple',\n\t 'lcs': 'autopairLCS',\n\t 'levenshtein': 'autopairLevenshtein'\n\t },\n\t /** default autopair strategy name */\n\t DEFAULT_STRATEGY: 'lcs',\n\t\n\t // ------------------------------------------------------------------------ process raw list\n\t /** set up main data: cache initialList, sort, and autopair */\n\t _dataSetUp: function () {\n\t //this.debug( '-- _dataSetUp' );\n\t\n\t this.paired = [];\n\t this.unpaired = [];\n\t\n\t this.selectedIds = [];\n\t\n\t // sort initial list, add ids if needed, and save new working copy to unpaired\n\t this._sortInitialList();\n\t this._ensureIds();\n\t this.unpaired = this.initialList.slice(0);\n\t\n\t if (this.automaticallyPair) {\n\t this.autoPair();\n\t this.once('rendered:initial', function () {\n\t this.trigger('autopair');\n\t });\n\t }\n\t },\n\t\n\t /** sort initial list */\n\t _sortInitialList: function () {\n\t //this.debug( '-- _sortInitialList' );\n\t this._sortDatasetList(this.initialList);\n\t },\n\t\n\t /** sort a list of datasets */\n\t _sortDatasetList: function (list) {\n\t // currently only natural sort by name\n\t list.sort(function (a, b) {\n\t return naturalSort(a.name, b.name);\n\t });\n\t return list;\n\t },\n\t\n\t /** add ids to dataset objs in initial list if none */\n\t _ensureIds: function () {\n\t this.initialList.forEach(function (dataset) {\n\t if (!dataset.hasOwnProperty('id')) {\n\t dataset.id = _.uniqueId();\n\t }\n\t });\n\t return this.initialList;\n\t },\n\t\n\t /** split initial list into two lists, those that pass forward filters & those passing reverse */\n\t _splitByFilters: function () {\n\t var regexFilters = this.filters.map(function (stringFilter) {\n\t return new RegExp(stringFilter);\n\t }),\n\t split = [[], []];\n\t\n\t function _filter(unpaired, filter) {\n\t return filter.test(unpaired.name);\n\t //return dataset.name.indexOf( filter ) >= 0;\n\t }\n\t this.unpaired.forEach(function _filterEach(unpaired) {\n\t // 90% of the time this seems to work, but:\n\t //TODO: this treats *all* strings as regex which may confuse people - possibly check for // surrounding?\n\t // would need explanation in help as well\n\t regexFilters.forEach(function (filter, i) {\n\t if (_filter(unpaired, filter)) {\n\t split[i].push(unpaired);\n\t }\n\t });\n\t });\n\t return split;\n\t },\n\t\n\t /** add a dataset to the unpaired list in it's proper order */\n\t _addToUnpaired: function (dataset) {\n\t // currently, unpaired is natural sorted by name, use binary search to find insertion point\n\t var binSearchSortedIndex = function (low, hi) {\n\t if (low === hi) {\n\t return low;\n\t }\n\t\n\t var mid = Math.floor((hi - low) / 2) + low,\n\t compared = naturalSort(dataset.name, this.unpaired[mid].name);\n\t\n\t if (compared < 0) {\n\t return binSearchSortedIndex(low, mid);\n\t } else if (compared > 0) {\n\t return binSearchSortedIndex(mid + 1, hi);\n\t }\n\t // walk the equal to find the last\n\t while (this.unpaired[mid] && this.unpaired[mid].name === dataset.name) {\n\t mid++;\n\t }\n\t return mid;\n\t }.bind(this);\n\t\n\t this.unpaired.splice(binSearchSortedIndex(0, this.unpaired.length), 0, dataset);\n\t },\n\t\n\t // ------------------------------------------------------------------------ auto pairing\n\t /** two passes to automatically create pairs:\n\t * use both simpleAutoPair, then the fn mentioned in strategy\n\t */\n\t autoPair: function (strategy) {\n\t // split first using exact matching\n\t var split = this._splitByFilters(),\n\t paired = [];\n\t if (this.twoPassAutopairing) {\n\t paired = this.autopairSimple({\n\t listA: split[0],\n\t listB: split[1]\n\t });\n\t split = this._splitByFilters();\n\t }\n\t\n\t // uncomment to see printlns while running tests\n\t //this.debug = function(){ console.log.apply( console, arguments ); };\n\t\n\t // then try the remainder with something less strict\n\t strategy = strategy || this.strategy;\n\t split = this._splitByFilters();\n\t paired = paired.concat(this[strategy].call(this, {\n\t listA: split[0],\n\t listB: split[1]\n\t }));\n\t return paired;\n\t },\n\t\n\t /** autopair by exact match */\n\t autopairSimple: autoPairFnBuilder({\n\t scoreThreshold: function () {\n\t return 0.6;\n\t },\n\t match: function _match(params) {\n\t params = params || {};\n\t if (params.matchTo === params.possible) {\n\t return {\n\t index: params.index,\n\t score: 1.0\n\t };\n\t }\n\t return params.bestMatch;\n\t }\n\t }),\n\t\n\t /** autopair by levenshtein edit distance scoring */\n\t autopairLevenshtein: autoPairFnBuilder({\n\t scoreThreshold: function () {\n\t return this.matchPercentage;\n\t },\n\t match: function _matches(params) {\n\t params = params || {};\n\t var distance = levenshteinDistance(params.matchTo, params.possible),\n\t score = 1.0 - distance / Math.max(params.matchTo.length, params.possible.length);\n\t if (score > params.bestMatch.score) {\n\t return {\n\t index: params.index,\n\t score: score\n\t };\n\t }\n\t return params.bestMatch;\n\t }\n\t }),\n\t\n\t /** autopair by longest common substrings scoring */\n\t autopairLCS: autoPairFnBuilder({\n\t scoreThreshold: function () {\n\t return this.matchPercentage;\n\t },\n\t match: function _matches(params) {\n\t params = params || {};\n\t var match = this._naiveStartingAndEndingLCS(params.matchTo, params.possible).length,\n\t score = match / Math.max(params.matchTo.length, params.possible.length);\n\t if (score > params.bestMatch.score) {\n\t return {\n\t index: params.index,\n\t score: score\n\t };\n\t }\n\t return params.bestMatch;\n\t }\n\t }),\n\t\n\t /** return the concat'd longest common prefix and suffix from two strings */\n\t _naiveStartingAndEndingLCS: function (s1, s2) {\n\t var fwdLCS = '',\n\t revLCS = '',\n\t i = 0,\n\t j = 0;\n\t while (i < s1.length && i < s2.length) {\n\t if (s1[i] !== s2[i]) {\n\t break;\n\t }\n\t fwdLCS += s1[i];\n\t i += 1;\n\t }\n\t if (i === s1.length) {\n\t return s1;\n\t }\n\t if (i === s2.length) {\n\t return s2;\n\t }\n\t\n\t i = s1.length - 1;\n\t j = s2.length - 1;\n\t while (i >= 0 && j >= 0) {\n\t if (s1[i] !== s2[j]) {\n\t break;\n\t }\n\t revLCS = [s1[i], revLCS].join('');\n\t i -= 1;\n\t j -= 1;\n\t }\n\t return fwdLCS + revLCS;\n\t },\n\t\n\t // ------------------------------------------------------------------------ pairing / unpairing\n\t /** create a pair from fwd and rev, removing them from unpaired, and placing the new pair in paired */\n\t _pair: function (fwd, rev, options) {\n\t options = options || {};\n\t this.debug('_pair:', fwd, rev);\n\t var pair = this._createPair(fwd, rev, options.name);\n\t this.paired.push(pair);\n\t this.unpaired = _.without(this.unpaired, fwd, rev);\n\t if (!options.silent) {\n\t this.trigger('pair:new', pair);\n\t }\n\t return pair;\n\t },\n\t\n\t /** create a pair Object from fwd and rev, adding the name attribute (will guess if not given) */\n\t _createPair: function (fwd, rev, name) {\n\t // ensure existance and don't pair something with itself\n\t if (!(fwd && rev) || fwd === rev) {\n\t throw new Error('Bad pairing: ' + [JSON.stringify(fwd), JSON.stringify(rev)]);\n\t }\n\t name = name || this._guessNameForPair(fwd, rev);\n\t return { forward: fwd, name: name, reverse: rev };\n\t },\n\t\n\t /** try to find a good pair name for the given fwd and rev datasets */\n\t _guessNameForPair: function (fwd, rev, removeExtensions) {\n\t removeExtensions = removeExtensions !== undefined ? removeExtensions : this.removeExtensions;\n\t var fwdName = fwd.name,\n\t revName = rev.name,\n\t lcs = this._naiveStartingAndEndingLCS(fwdName.replace(new RegExp(this.filters[0]), ''), revName.replace(new RegExp(this.filters[1]), ''));\n\t if (removeExtensions) {\n\t var lastDotIndex = lcs.lastIndexOf('.');\n\t if (lastDotIndex > 0) {\n\t var extension = lcs.slice(lastDotIndex, lcs.length);\n\t lcs = lcs.replace(extension, '');\n\t fwdName = fwdName.replace(extension, '');\n\t revName = revName.replace(extension, '');\n\t }\n\t }\n\t return lcs || fwdName + ' & ' + revName;\n\t },\n\t\n\t /** unpair a pair, removing it from paired, and adding the fwd,rev datasets back into unpaired */\n\t _unpair: function (pair, options) {\n\t options = options || {};\n\t if (!pair) {\n\t throw new Error('Bad pair: ' + JSON.stringify(pair));\n\t }\n\t this.paired = _.without(this.paired, pair);\n\t this._addToUnpaired(pair.forward);\n\t this._addToUnpaired(pair.reverse);\n\t\n\t if (!options.silent) {\n\t this.trigger('pair:unpair', [pair]);\n\t }\n\t return pair;\n\t },\n\t\n\t /** unpair all paired datasets */\n\t unpairAll: function () {\n\t var pairs = [];\n\t while (this.paired.length) {\n\t pairs.push(this._unpair(this.paired[0], { silent: true }));\n\t }\n\t this.trigger('pair:unpair', pairs);\n\t },\n\t\n\t // ------------------------------------------------------------------------ API\n\t /** convert a pair into JSON compatible with the collections API */\n\t _pairToJSON: function (pair, src) {\n\t src = src || 'hda';\n\t //TODO: consider making this the pair structure when created instead\n\t return {\n\t collection_type: 'paired',\n\t src: 'new_collection',\n\t name: pair.name,\n\t element_identifiers: [{\n\t name: 'forward',\n\t id: pair.forward.id,\n\t src: src\n\t }, {\n\t name: 'reverse',\n\t id: pair.reverse.id,\n\t src: src\n\t }]\n\t };\n\t },\n\t\n\t /** create the collection via the API\n\t * @returns {jQuery.xhr Object} the jquery ajax request\n\t */\n\t createList: function (name) {\n\t var creator = this,\n\t url = Galaxy.root + 'api/histories/' + this.historyId + '/contents/dataset_collections';\n\t\n\t //TODO: use ListPairedCollection.create()\n\t var ajaxData = {\n\t type: 'dataset_collection',\n\t collection_type: 'list:paired',\n\t hide_source_items: creator.hideOriginals || false,\n\t name: _.escape(name || creator.$('.collection-name').val()),\n\t element_identifiers: creator.paired.map(function (pair) {\n\t return creator._pairToJSON(pair);\n\t })\n\t\n\t };\n\t //this.debug( JSON.stringify( ajaxData ) );\n\t creator.blocking = true;\n\t return jQuery.ajax(url, {\n\t type: 'POST',\n\t contentType: 'application/json',\n\t dataType: 'json',\n\t data: JSON.stringify(ajaxData)\n\t }).always(function () {\n\t creator.blocking = false;\n\t }).fail(function (xhr, status, message) {\n\t creator._ajaxErrHandler(xhr, status, message);\n\t }).done(function (response, message, xhr) {\n\t //this.info( 'ok', response, message, xhr );\n\t creator.trigger('collection:created', response, message, xhr);\n\t creator.metric('collection:created', response);\n\t if (typeof creator.oncreate === 'function') {\n\t creator.oncreate.call(this, response, message, xhr);\n\t }\n\t });\n\t },\n\t\n\t /** handle ajax errors with feedback and details to the user (if available) */\n\t _ajaxErrHandler: function (xhr, status, message) {\n\t this.error(xhr, status, message);\n\t var content = _l('An error occurred while creating this collection');\n\t if (xhr) {\n\t if (xhr.readyState === 0 && xhr.status === 0) {\n\t content += ': ' + _l('Galaxy could not be reached and may be updating.') + _l(' Try again in a few minutes.');\n\t } else if (xhr.responseJSON) {\n\t content += '
                          ' + JSON.stringify(xhr.responseJSON) + '
                          ';\n\t } else {\n\t content += ': ' + message;\n\t }\n\t }\n\t creator._showAlert(content, 'alert-danger');\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering\n\t /** render the entire interface */\n\t render: function (speed, callback) {\n\t //this.debug( '-- _render' );\n\t //this.$el.empty().html( this.templates.main() );\n\t this.$el.empty().html(this.templates.main());\n\t this._renderHeader(speed);\n\t this._renderMiddle(speed);\n\t this._renderFooter(speed);\n\t this._addPluginComponents();\n\t this.trigger('rendered', this);\n\t return this;\n\t },\n\t\n\t /** render the header section */\n\t _renderHeader: function (speed, callback) {\n\t //this.debug( '-- _renderHeader' );\n\t var $header = this.$('.header').empty().html(this.templates.header()).find('.help-content').prepend($(this.templates.helpContent()));\n\t\n\t this._renderFilters();\n\t return $header;\n\t },\n\t /** fill the filter inputs with the filter values */\n\t _renderFilters: function () {\n\t return this.$('.forward-column .column-header input').val(this.filters[0]).add(this.$('.reverse-column .column-header input').val(this.filters[1]));\n\t },\n\t\n\t /** render the middle including unpaired and paired sections (which may be hidden) */\n\t _renderMiddle: function (speed, callback) {\n\t var $middle = this.$('.middle').empty().html(this.templates.middle());\n\t\n\t // (re-) hide the un/paired panels based on instance vars\n\t if (this.unpairedPanelHidden) {\n\t this.$('.unpaired-columns').hide();\n\t } else if (this.pairedPanelHidden) {\n\t this.$('.paired-columns').hide();\n\t }\n\t\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t return $middle;\n\t },\n\t /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n\t _renderUnpaired: function (speed, callback) {\n\t //this.debug( '-- _renderUnpaired' );\n\t var creator = this,\n\t $fwd,\n\t $rev,\n\t $prd = [],\n\t split = this._splitByFilters();\n\t // update unpaired counts\n\t this.$('.forward-column .title').text([split[0].length, _l('unpaired forward')].join(' '));\n\t this.$('.forward-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[0].length));\n\t this.$('.reverse-column .title').text([split[1].length, _l('unpaired reverse')].join(' '));\n\t this.$('.reverse-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[1].length));\n\t\n\t this.$('.unpaired-columns .column-datasets').empty();\n\t\n\t // show/hide the auto pair button if any unpaired are left\n\t this.$('.autopair-link').toggle(this.unpaired.length !== 0);\n\t if (this.unpaired.length === 0) {\n\t this._renderUnpairedEmpty();\n\t return;\n\t }\n\t\n\t // create the dataset dom arrays\n\t $rev = split[1].map(function (dataset, i) {\n\t // if there'll be a fwd dataset across the way, add a button to pair the row\n\t if (split[0][i] !== undefined && split[0][i] !== dataset) {\n\t $prd.push(creator._renderPairButton());\n\t }\n\t return creator._renderUnpairedDataset(dataset);\n\t });\n\t $fwd = split[0].map(function (dataset) {\n\t return creator._renderUnpairedDataset(dataset);\n\t });\n\t\n\t if (!$fwd.length && !$rev.length) {\n\t this._renderUnpairedNotShown();\n\t return;\n\t }\n\t // add to appropo cols\n\t //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n\t // and swapping out that\n\t this.$('.unpaired-columns .forward-column .column-datasets').append($fwd).add(this.$('.unpaired-columns .paired-column .column-datasets').append($prd)).add(this.$('.unpaired-columns .reverse-column .column-datasets').append($rev));\n\t this._adjUnpairedOnScrollbar();\n\t },\n\t /** return a string to display the count of filtered out datasets */\n\t _renderUnpairedDisplayStr: function (numFiltered) {\n\t return ['(', numFiltered, ' ', _l('filtered out'), ')'].join('');\n\t },\n\t /** return an unattached jQuery DOM element to represent an unpaired dataset */\n\t _renderUnpairedDataset: function (dataset) {\n\t //TODO: to underscore template\n\t return $('
                        • ').attr('id', 'dataset-' + dataset.id).addClass('dataset unpaired').attr('draggable', true).addClass(dataset.selected ? 'selected' : '').append($('').addClass('dataset-name').text(dataset.name))\n\t //??\n\t .data('dataset', dataset);\n\t },\n\t /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n\t _renderPairButton: function () {\n\t //TODO: *not* a dataset - don't pretend like it is\n\t return $('
                        • ').addClass('dataset unpaired').append($('').addClass('dataset-name').text(_l('Pair these datasets')));\n\t },\n\t /** a message to display when no unpaired left */\n\t _renderUnpairedEmpty: function () {\n\t //this.debug( '-- renderUnpairedEmpty' );\n\t var $msg = $('
                          ').text('(' + _l('no remaining unpaired datasets') + ')');\n\t this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n\t return $msg;\n\t },\n\t /** a message to display when no unpaired can be shown with the current filters */\n\t _renderUnpairedNotShown: function () {\n\t //this.debug( '-- renderUnpairedEmpty' );\n\t var $msg = $('
                          ').text('(' + _l('no datasets were found matching the current filters') + ')');\n\t this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n\t return $msg;\n\t },\n\t /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n\t _adjUnpairedOnScrollbar: function () {\n\t var $unpairedColumns = this.$('.unpaired-columns').last(),\n\t $firstDataset = this.$('.unpaired-columns .reverse-column .dataset').first();\n\t if (!$firstDataset.length) {\n\t return;\n\t }\n\t var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n\t dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n\t rightDiff = Math.floor(ucRight) - Math.floor(dsRight);\n\t //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n\t this.$('.unpaired-columns .forward-column').css('margin-left', rightDiff > 0 ? rightDiff : 0);\n\t },\n\t\n\t /** render the paired section and update counts of paired datasets */\n\t _renderPaired: function (speed, callback) {\n\t //this.debug( '-- _renderPaired' );\n\t this.$('.paired-column-title .title').text([this.paired.length, _l('paired')].join(' '));\n\t // show/hide the unpair all link\n\t this.$('.unpair-all-link').toggle(this.paired.length !== 0);\n\t if (this.paired.length === 0) {\n\t this._renderPairedEmpty();\n\t return;\n\t //TODO: would be best to return here (the $columns)\n\t } else {\n\t // show/hide 'remove extensions link' when any paired and they seem to have extensions\n\t this.$('.remove-extensions-link').show();\n\t }\n\t\n\t this.$('.paired-columns .column-datasets').empty();\n\t var creator = this;\n\t this.paired.forEach(function (pair, i) {\n\t //TODO: cache these?\n\t var pairView = new PairView({ pair: pair });\n\t creator.$('.paired-columns .column-datasets').append(pairView.render().$el).append([''].join(''));\n\t });\n\t },\n\t /** a message to display when none paired */\n\t _renderPairedEmpty: function () {\n\t var $msg = $('
                          ').text('(' + _l('no paired datasets yet') + ')');\n\t this.$('.paired-columns .column-datasets').empty().prepend($msg);\n\t return $msg;\n\t },\n\t\n\t footerSettings: {\n\t '.hide-originals': 'hideOriginals',\n\t '.remove-extensions': 'removeExtensions'\n\t },\n\t\n\t /** add any jQuery/bootstrap/custom plugins to elements rendered */\n\t _addPluginComponents: function () {\n\t this._chooseFiltersPopover('.choose-filters-link');\n\t this.$('.help-content i').hoverhighlight('.collection-creator', 'rgba( 64, 255, 255, 1.0 )');\n\t },\n\t\n\t /** build a filter selection popover allowing selection of common filter pairs */\n\t _chooseFiltersPopover: function (selector) {\n\t function filterChoice(val1, val2) {\n\t return [''].join('');\n\t }\n\t var $popoverContent = $(_.template(['
                          ', '
                          ', _l('Choose from the following filters to change which unpaired reads are shown in the display'), ':
                          ', _.values(this.commonFilters).map(function (filterSet) {\n\t return filterChoice(filterSet[0], filterSet[1]);\n\t }).join(''), '
                          '].join(''))({}));\n\t\n\t return this.$(selector).popover({\n\t container: '.collection-creator',\n\t placement: 'bottom',\n\t html: true,\n\t //animation : false,\n\t content: $popoverContent\n\t });\n\t },\n\t\n\t /** add (or clear if clear is truthy) a validation warning to what */\n\t _validationWarning: function (what, clear) {\n\t var VALIDATION_CLASS = 'validation-warning';\n\t if (what === 'name') {\n\t what = this.$('.collection-name').add(this.$('.collection-name-prompt'));\n\t this.$('.collection-name').focus().select();\n\t }\n\t if (clear) {\n\t what = what || this.$('.' + VALIDATION_CLASS);\n\t what.removeClass(VALIDATION_CLASS);\n\t } else {\n\t what.addClass(VALIDATION_CLASS);\n\t }\n\t },\n\t\n\t // ------------------------------------------------------------------------ events\n\t /** set up event handlers on self */\n\t _setUpBehaviors: function () {\n\t this.once('rendered', function () {\n\t this.trigger('rendered:initial', this);\n\t });\n\t\n\t this.on('pair:new', function () {\n\t //TODO: ideally only re-render the columns (or even elements) involved\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t\n\t // scroll to bottom where new pairs are added\n\t //TODO: this doesn't seem to work - innerHeight sticks at 133...\n\t // may have to do with improper flex columns\n\t //var $pairedView = this.$( '.paired-columns' );\n\t //$pairedView.scrollTop( $pairedView.innerHeight() );\n\t //this.debug( $pairedView.height() )\n\t this.$('.paired-columns').scrollTop(8000000);\n\t });\n\t this.on('pair:unpair', function (pairs) {\n\t //TODO: ideally only re-render the columns (or even elements) involved\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t this.splitView();\n\t });\n\t\n\t this.on('filter-change', function () {\n\t this.filters = [this.$('.forward-unpaired-filter input').val(), this.$('.reverse-unpaired-filter input').val()];\n\t this.metric('filter-change', this.filters);\n\t this._renderFilters();\n\t this._renderUnpaired();\n\t });\n\t\n\t this.on('autopair', function () {\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t\n\t var message,\n\t msgClass = null;\n\t if (this.paired.length) {\n\t msgClass = 'alert-success';\n\t message = this.paired.length + ' ' + _l('pairs created');\n\t if (!this.unpaired.length) {\n\t message += ': ' + _l('all datasets have been successfully paired');\n\t this.hideUnpaired();\n\t this.$('.collection-name').focus();\n\t }\n\t } else {\n\t message = _l(['Could not automatically create any pairs from the given dataset names.', 'You may want to choose or enter different filters and try auto-pairing again.', 'Close this message using the X on the right to view more help.'].join(' '));\n\t }\n\t this._showAlert(message, msgClass);\n\t });\n\t\n\t //this.on( 'all', function(){\n\t // this.info( arguments );\n\t //});\n\t return this;\n\t },\n\t\n\t events: {\n\t // header\n\t 'click .more-help': '_clickMoreHelp',\n\t 'click .less-help': '_clickLessHelp',\n\t 'click .main-help': '_toggleHelp',\n\t 'click .header .alert button': '_hideAlert',\n\t 'click .forward-column .column-title': '_clickShowOnlyUnpaired',\n\t 'click .reverse-column .column-title': '_clickShowOnlyUnpaired',\n\t 'click .unpair-all-link': '_clickUnpairAll',\n\t //TODO: this seems kinda backasswards - re-sending jq event as a backbone event, can we listen directly?\n\t 'change .forward-unpaired-filter input': function (ev) {\n\t this.trigger('filter-change');\n\t },\n\t 'focus .forward-unpaired-filter input': function (ev) {\n\t $(ev.currentTarget).select();\n\t },\n\t 'click .autopair-link': '_clickAutopair',\n\t 'click .choose-filters .filter-choice': '_clickFilterChoice',\n\t 'click .clear-filters-link': '_clearFilters',\n\t 'change .reverse-unpaired-filter input': function (ev) {\n\t this.trigger('filter-change');\n\t },\n\t 'focus .reverse-unpaired-filter input': function (ev) {\n\t $(ev.currentTarget).select();\n\t },\n\t // unpaired\n\t 'click .forward-column .dataset.unpaired': '_clickUnpairedDataset',\n\t 'click .reverse-column .dataset.unpaired': '_clickUnpairedDataset',\n\t 'click .paired-column .dataset.unpaired': '_clickPairRow',\n\t 'click .unpaired-columns': 'clearSelectedUnpaired',\n\t 'mousedown .unpaired-columns .dataset': '_mousedownUnpaired',\n\t // divider\n\t 'click .paired-column-title': '_clickShowOnlyPaired',\n\t 'mousedown .flexible-partition-drag': '_startPartitionDrag',\n\t // paired\n\t 'click .paired-columns .dataset.paired': 'selectPair',\n\t 'click .paired-columns': 'clearSelectedPaired',\n\t 'click .paired-columns .pair-name': '_clickPairName',\n\t 'click .unpair-btn': '_clickUnpair',\n\t // paired - drop target\n\t //'dragenter .paired-columns' : '_dragenterPairedColumns',\n\t //'dragleave .paired-columns .column-datasets': '_dragleavePairedColumns',\n\t 'dragover .paired-columns .column-datasets': '_dragoverPairedColumns',\n\t 'drop .paired-columns .column-datasets': '_dropPairedColumns',\n\t\n\t 'pair.dragstart .paired-columns .column-datasets': '_pairDragstart',\n\t 'pair.dragend .paired-columns .column-datasets': '_pairDragend',\n\t\n\t // footer\n\t 'change .remove-extensions': function (ev) {\n\t this.toggleExtensions();\n\t },\n\t 'change .collection-name': '_changeName',\n\t 'keydown .collection-name': '_nameCheckForEnter',\n\t 'change .hide-originals': '_changeHideOriginals',\n\t 'click .cancel-create': '_cancelCreate',\n\t 'click .create-collection': '_clickCreate' //,\n\t },\n\t\n\t /** toggle between showing only unpaired and split view */\n\t _clickShowOnlyUnpaired: function (ev) {\n\t //this.debug( 'click unpaired', ev.currentTarget );\n\t if (this.$('.paired-columns').is(':visible')) {\n\t this.hidePaired();\n\t } else {\n\t this.splitView();\n\t }\n\t },\n\t /** toggle between showing only paired and split view */\n\t _clickShowOnlyPaired: function (ev) {\n\t //this.debug( 'click paired' );\n\t if (this.$('.unpaired-columns').is(':visible')) {\n\t this.hideUnpaired();\n\t } else {\n\t this.splitView();\n\t }\n\t },\n\t\n\t /** hide unpaired, show paired */\n\t hideUnpaired: function (speed, callback) {\n\t this.unpairedPanelHidden = true;\n\t this.pairedPanelHidden = false;\n\t this._renderMiddle(speed, callback);\n\t },\n\t /** hide paired, show unpaired */\n\t hidePaired: function (speed, callback) {\n\t this.unpairedPanelHidden = false;\n\t this.pairedPanelHidden = true;\n\t this._renderMiddle(speed, callback);\n\t },\n\t /** show both paired and unpaired (splitting evenly) */\n\t splitView: function (speed, callback) {\n\t this.unpairedPanelHidden = this.pairedPanelHidden = false;\n\t this._renderMiddle(speed, callback);\n\t return this;\n\t },\n\t\n\t /** unpair all paired and do other super neat stuff which I'm not really sure about yet... */\n\t _clickUnpairAll: function (ev) {\n\t this.metric('unpairAll');\n\t this.unpairAll();\n\t },\n\t\n\t /** attempt to autopair */\n\t _clickAutopair: function (ev) {\n\t var paired = this.autoPair();\n\t this.metric('autopair', paired.length, this.unpaired.length);\n\t this.trigger('autopair');\n\t },\n\t\n\t /** set the filters based on the data attributes of the button click target */\n\t _clickFilterChoice: function (ev) {\n\t var $selected = $(ev.currentTarget);\n\t this.$('.forward-unpaired-filter input').val($selected.data('forward'));\n\t this.$('.reverse-unpaired-filter input').val($selected.data('reverse'));\n\t this._hideChooseFilters();\n\t this.trigger('filter-change');\n\t },\n\t\n\t /** hide the choose filters popover */\n\t _hideChooseFilters: function () {\n\t //TODO: update bootstrap and remove the following hack\n\t // see also: https://github.com/twbs/bootstrap/issues/10260\n\t this.$('.choose-filters-link').popover('hide');\n\t this.$('.popover').css('display', 'none');\n\t },\n\t\n\t /** clear both filters */\n\t _clearFilters: function (ev) {\n\t this.$('.forward-unpaired-filter input').val('');\n\t this.$('.reverse-unpaired-filter input').val('');\n\t this.trigger('filter-change');\n\t },\n\t\n\t // ........................................................................ unpaired\n\t /** select an unpaired dataset */\n\t _clickUnpairedDataset: function (ev) {\n\t ev.stopPropagation();\n\t return this.toggleSelectUnpaired($(ev.currentTarget));\n\t },\n\t\n\t /** Toggle the selection of an unpaired dataset representation.\n\t * @param [jQuery] $dataset the unpaired dataset dom rep to select\n\t * @param [Boolean] options.force if defined, force selection based on T/F; otherwise, toggle\n\t */\n\t toggleSelectUnpaired: function ($dataset, options) {\n\t options = options || {};\n\t var dataset = $dataset.data('dataset'),\n\t select = options.force !== undefined ? options.force : !$dataset.hasClass('selected');\n\t //this.debug( id, options.force, $dataset, dataset );\n\t if (!$dataset.length || dataset === undefined) {\n\t return $dataset;\n\t }\n\t\n\t if (select) {\n\t $dataset.addClass('selected');\n\t if (!options.waitToPair) {\n\t this.pairAllSelected();\n\t }\n\t } else {\n\t $dataset.removeClass('selected');\n\t //delete dataset.selected;\n\t }\n\t return $dataset;\n\t },\n\t\n\t /** pair all the currently selected unpaired datasets */\n\t pairAllSelected: function (options) {\n\t options = options || {};\n\t var creator = this,\n\t fwds = [],\n\t revs = [],\n\t pairs = [];\n\t creator.$('.unpaired-columns .forward-column .dataset.selected').each(function () {\n\t fwds.push($(this).data('dataset'));\n\t });\n\t creator.$('.unpaired-columns .reverse-column .dataset.selected').each(function () {\n\t revs.push($(this).data('dataset'));\n\t });\n\t fwds.length = revs.length = Math.min(fwds.length, revs.length);\n\t //this.debug( fwds );\n\t //this.debug( revs );\n\t fwds.forEach(function (fwd, i) {\n\t try {\n\t pairs.push(creator._pair(fwd, revs[i], { silent: true }));\n\t } catch (err) {\n\t //TODO: preserve selected state of those that couldn't be paired\n\t //TODO: warn that some could not be paired\n\t creator.error(err);\n\t }\n\t });\n\t if (pairs.length && !options.silent) {\n\t this.trigger('pair:new', pairs);\n\t }\n\t return pairs;\n\t },\n\t\n\t /** clear the selection on all unpaired datasets */\n\t clearSelectedUnpaired: function () {\n\t this.$('.unpaired-columns .dataset.selected').removeClass('selected');\n\t },\n\t\n\t /** when holding down the shift key on a click, 'paint' the moused over datasets as selected */\n\t _mousedownUnpaired: function (ev) {\n\t if (ev.shiftKey) {\n\t var creator = this,\n\t $startTarget = $(ev.target).addClass('selected'),\n\t moveListener = function (ev) {\n\t creator.$(ev.target).filter('.dataset').addClass('selected');\n\t };\n\t $startTarget.parent().on('mousemove', moveListener);\n\t\n\t // on any mouseup, stop listening to the move and try to pair any selected\n\t $(document).one('mouseup', function (ev) {\n\t $startTarget.parent().off('mousemove', moveListener);\n\t creator.pairAllSelected();\n\t });\n\t }\n\t },\n\t\n\t /** attempt to pair two datasets directly across from one another */\n\t _clickPairRow: function (ev) {\n\t //if( !ev.currentTarget ){ return true; }\n\t var rowIndex = $(ev.currentTarget).index(),\n\t fwd = $('.unpaired-columns .forward-column .dataset').eq(rowIndex).data('dataset'),\n\t rev = $('.unpaired-columns .reverse-column .dataset').eq(rowIndex).data('dataset');\n\t //this.debug( 'row:', rowIndex, fwd, rev );\n\t this._pair(fwd, rev);\n\t },\n\t\n\t // ........................................................................ divider/partition\n\t /** start dragging the visible divider/partition between unpaired and paired panes */\n\t _startPartitionDrag: function (ev) {\n\t var creator = this,\n\t startingY = ev.pageY;\n\t //this.debug( 'partition drag START:', ev );\n\t $('body').css('cursor', 'ns-resize');\n\t creator.$('.flexible-partition-drag').css('color', 'black');\n\t\n\t function endDrag(ev) {\n\t //creator.debug( 'partition drag STOP:', ev );\n\t // doing this by an added class didn't really work well - kept flashing still\n\t creator.$('.flexible-partition-drag').css('color', '');\n\t $('body').css('cursor', '').unbind('mousemove', trackMouse);\n\t }\n\t function trackMouse(ev) {\n\t var offset = ev.pageY - startingY;\n\t //creator.debug( 'partition:', startingY, offset );\n\t if (!creator.adjPartition(offset)) {\n\t //creator.debug( 'mouseup triggered' );\n\t $('body').trigger('mouseup');\n\t }\n\t creator._adjUnpairedOnScrollbar();\n\t startingY += offset;\n\t }\n\t $('body').mousemove(trackMouse);\n\t $('body').one('mouseup', endDrag);\n\t },\n\t\n\t /** adjust the parition up/down +/-adj pixels */\n\t adjPartition: function (adj) {\n\t var $unpaired = this.$('.unpaired-columns'),\n\t $paired = this.$('.paired-columns'),\n\t unpairedHi = parseInt($unpaired.css('height'), 10),\n\t pairedHi = parseInt($paired.css('height'), 10);\n\t //this.debug( adj, 'hi\\'s:', unpairedHi, pairedHi, unpairedHi + adj, pairedHi - adj );\n\t\n\t unpairedHi = Math.max(10, unpairedHi + adj);\n\t pairedHi = pairedHi - adj;\n\t\n\t var movingUpwards = adj < 0;\n\t // when the divider gets close to the top - lock into hiding the unpaired section\n\t if (movingUpwards) {\n\t if (this.unpairedPanelHidden) {\n\t return false;\n\t } else if (unpairedHi <= 10) {\n\t this.hideUnpaired();\n\t return false;\n\t }\n\t } else {\n\t if (this.unpairedPanelHidden) {\n\t $unpaired.show();\n\t this.unpairedPanelHidden = false;\n\t }\n\t }\n\t\n\t // when the divider gets close to the bottom - lock into hiding the paired section\n\t if (!movingUpwards) {\n\t if (this.pairedPanelHidden) {\n\t return false;\n\t } else if (pairedHi <= 15) {\n\t this.hidePaired();\n\t return false;\n\t }\n\t } else {\n\t if (this.pairedPanelHidden) {\n\t $paired.show();\n\t this.pairedPanelHidden = false;\n\t }\n\t }\n\t\n\t $unpaired.css({\n\t height: unpairedHi + 'px',\n\t flex: '0 0 auto'\n\t });\n\t return true;\n\t },\n\t\n\t // ........................................................................ paired\n\t /** select a pair when clicked */\n\t selectPair: function (ev) {\n\t ev.stopPropagation();\n\t $(ev.currentTarget).toggleClass('selected');\n\t },\n\t\n\t /** deselect all pairs */\n\t clearSelectedPaired: function (ev) {\n\t this.$('.paired-columns .dataset.selected').removeClass('selected');\n\t },\n\t\n\t /** rename a pair when the pair name is clicked */\n\t _clickPairName: function (ev) {\n\t ev.stopPropagation();\n\t var $name = $(ev.currentTarget),\n\t $pair = $name.parent().parent(),\n\t index = $pair.index('.dataset.paired'),\n\t pair = this.paired[index],\n\t response = prompt('Enter a new name for the pair:', pair.name);\n\t if (response) {\n\t pair.name = response;\n\t // set a flag (which won't be passed in json creation) for manual naming so we don't overwrite these\n\t // when adding/removing extensions\n\t //hackish\n\t pair.customizedName = true;\n\t $name.text(pair.name);\n\t }\n\t },\n\t\n\t /** unpair this pair */\n\t _clickUnpair: function (ev) {\n\t //if( !ev.currentTarget ){ return true; }\n\t var pairIndex = Math.floor($(ev.currentTarget).index('.unpair-btn'));\n\t //this.debug( 'pair:', pairIndex );\n\t this._unpair(this.paired[pairIndex]);\n\t },\n\t\n\t // ........................................................................ paired - drag and drop re-ordering\n\t //_dragenterPairedColumns : function( ev ){\n\t // this.debug( '_dragenterPairedColumns:', ev );\n\t //},\n\t //_dragleavePairedColumns : function( ev ){\n\t // //this.debug( '_dragleavePairedColumns:', ev );\n\t //},\n\t /** track the mouse drag over the paired list adding a placeholder to show where the drop would occur */\n\t _dragoverPairedColumns: function (ev) {\n\t //this.debug( '_dragoverPairedColumns:', ev );\n\t ev.preventDefault();\n\t\n\t var $list = this.$('.paired-columns .column-datasets');\n\t this._checkForAutoscroll($list, ev.originalEvent.clientY);\n\t //this.debug( ev.originalEvent.clientX, ev.originalEvent.clientY );\n\t var $nearest = this._getNearestPairedDatasetLi(ev.originalEvent.clientY);\n\t\n\t $('.element-drop-placeholder').remove();\n\t var $placeholder = $('
                          ');\n\t if (!$nearest.length) {\n\t $list.append($placeholder);\n\t } else {\n\t $nearest.before($placeholder);\n\t }\n\t },\n\t\n\t /** If the mouse is near enough to the list's top or bottom, scroll the list */\n\t _checkForAutoscroll: function ($element, y) {\n\t var AUTOSCROLL_SPEED = 2;\n\t var offset = $element.offset(),\n\t scrollTop = $element.scrollTop(),\n\t upperDist = y - offset.top,\n\t lowerDist = offset.top + $element.outerHeight() - y;\n\t //this.debug( '_checkForAutoscroll:', scrollTop, upperDist, lowerDist );\n\t if (upperDist >= 0 && upperDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop - AUTOSCROLL_SPEED);\n\t } else if (lowerDist >= 0 && lowerDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop + AUTOSCROLL_SPEED);\n\t }\n\t },\n\t\n\t /** get the nearest *previous* paired dataset PairView based on the mouse's Y coordinate.\n\t * If the y is at the end of the list, return an empty jQuery object.\n\t */\n\t _getNearestPairedDatasetLi: function (y) {\n\t var WIGGLE = 4,\n\t lis = this.$('.paired-columns .column-datasets li').toArray();\n\t for (var i = 0; i < lis.length; i++) {\n\t var $li = $(lis[i]),\n\t top = $li.offset().top,\n\t halfHeight = Math.floor($li.outerHeight() / 2) + WIGGLE;\n\t if (top + halfHeight > y && top - halfHeight < y) {\n\t //this.debug( y, top + halfHeight, top - halfHeight )\n\t return $li;\n\t }\n\t }\n\t return $();\n\t },\n\t /** drop (dragged/selected PairViews) onto the list, re-ordering both the DOM and the internal array of pairs */\n\t _dropPairedColumns: function (ev) {\n\t // both required for firefox\n\t ev.preventDefault();\n\t ev.dataTransfer.dropEffect = 'move';\n\t\n\t var $nearest = this._getNearestPairedDatasetLi(ev.originalEvent.clientY);\n\t if ($nearest.length) {\n\t this.$dragging.insertBefore($nearest);\n\t } else {\n\t // no nearest before - insert after last element (unpair button)\n\t this.$dragging.insertAfter(this.$('.paired-columns .unpair-btn').last());\n\t }\n\t // resync the creator's list of paired based on the new DOM order\n\t this._syncPairsToDom();\n\t return false;\n\t },\n\t /** resync the creator's list of paired based on the DOM order of pairs */\n\t _syncPairsToDom: function () {\n\t var newPaired = [];\n\t //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n\t this.$('.paired-columns .dataset.paired').each(function () {\n\t newPaired.push($(this).data('pair'));\n\t });\n\t //this.debug( newPaired );\n\t this.paired = newPaired;\n\t this._renderPaired();\n\t },\n\t /** drag communication with pair sub-views: dragstart */\n\t _pairDragstart: function (ev, pair) {\n\t //this.debug( '_pairDragstart', ev, pair )\n\t // auto select the pair causing the event and move all selected\n\t pair.$el.addClass('selected');\n\t var $selected = this.$('.paired-columns .dataset.selected');\n\t this.$dragging = $selected;\n\t },\n\t /** drag communication with pair sub-views: dragend - remove the placeholder */\n\t _pairDragend: function (ev, pair) {\n\t //this.debug( '_pairDragend', ev, pair )\n\t $('.element-drop-placeholder').remove();\n\t this.$dragging = null;\n\t },\n\t\n\t // ........................................................................ footer\n\t toggleExtensions: function (force) {\n\t var creator = this;\n\t creator.removeExtensions = force !== undefined ? force : !creator.removeExtensions;\n\t\n\t _.each(creator.paired, function (pair) {\n\t // don't overwrite custom names\n\t if (pair.customizedName) {\n\t return;\n\t }\n\t pair.name = creator._guessNameForPair(pair.forward, pair.reverse);\n\t });\n\t\n\t creator._renderPaired();\n\t creator._renderFooter();\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** debug a dataset list */\n\t _printList: function (list) {\n\t var creator = this;\n\t _.each(list, function (e) {\n\t if (list === creator.paired) {\n\t creator._printPair(e);\n\t } else {\n\t //creator.debug( e );\n\t }\n\t });\n\t },\n\t\n\t /** print a pair Object */\n\t _printPair: function (pair) {\n\t this.debug(pair.forward.name, pair.reverse.name, ': ->', pair.name);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'PairedCollectionCreator';\n\t },\n\t\n\t templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\t\n\t /** the header (not including help text) */\n\t header: _.template(['', '
                          ', '', '', '
                          ', '
                          ', '
                          ', '
                          ', '
                          ', '', _l('Unpaired forward'), '', '', '
                          ', '
                          ', '', '
                          ', '
                          ', '
                          ', '', '
                          ', '
                          ', '
                          ', '', _l('Unpaired reverse'), '', '', '
                          ', '
                          ', '', '
                          ', '
                          ', '
                          ', '
                          '].join('')),\n\t\n\t /** the middle: unpaired, divider, and paired */\n\t middle: _.template([\n\t // contains two flex rows (rows that fill available space) and a divider btwn\n\t '
                          ', '
                          ', '
                            ', '
                            ', '
                            ', '
                              ', '
                              ', '
                              ', '
                                ', '
                                ', '
                                ', '
                                ', '
                                ', '
                                ', '
                                ', '', '
                                ', '', _l('Unpair all'), '', '
                                ', '
                                ', '
                                ', '
                                  ', '
                                  '].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer: _.template(['
                                  ', '
                                  ', '', '', '
                                  ', '
                                  ', '', '
                                  ', _l('Name'), ':
                                  ', '
                                  ', '
                                  ', '
                                  ', '
                                  ', '', '
                                  ', '', '', '
                                  ', '
                                  ', '
                                  ', '', '
                                  ', '
                                  '].join('')),\n\t\n\t /** help content */\n\t helpContent: _.template(['

                                  ', _l(['Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ', 'These collections can be passed to tools and workflows in order to have analyses done on each member of ', 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ', 'and re-order the final collection.'].join('')), '

                                  ', '

                                  ', _l(['Unpaired datasets are shown in the unpaired section ', '(hover over the underlined words to highlight below). ', 'Paired datasets are shown in the paired section.', '

                                    To pair datasets, you can:', '
                                  • Click a dataset in the ', 'forward column ', 'to select it then click a dataset in the ', 'reverse column.', '
                                  • ', '
                                  • Click one of the \"Pair these datasets\" buttons in the ', 'middle column ', 'to pair the datasets in a particular row.', '
                                  • ', '
                                  • Click \"Auto-pair\" ', 'to have your datasets automatically paired based on name.', '
                                  • ', '
                                  '].join('')), '

                                  ', '

                                  ', _l(['

                                    You can filter what is shown in the unpaired sections by:', '
                                  • Entering partial dataset names in either the ', 'forward filter or ', 'reverse filter.', '
                                  • ', '
                                  • Choosing from a list of preset filters by clicking the ', '\"Choose filters\" link.', '
                                  • ', '
                                  • Entering regular expressions to match dataset names. See: ', 'MDN\\'s JavaScript Regular Expression Tutorial. ', 'Note: forward slashes (\\\\) are not needed.', '
                                  • ', '
                                  • Clearing the filters by clicking the ', '\"Clear filters\" link.', '
                                  • ', '
                                  '].join('')), '

                                  ', '

                                  ', _l(['To unpair individual dataset pairs, click the ', 'unpair buttons ( ). ', 'Click the \"Unpair all\" link to unpair all pairs.'].join('')), '

                                  ', '

                                  ', _l(['You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ', '\"Remove file extensions from pair names?\" control.'].join('')), '

                                  ', '

                                  ', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\". ', '(Note: you do not have to pair all unpaired datasets to finish.)'].join('')), '

                                  '].join(''))\n\t })\n\t });\n\t\n\t //=============================================================================\n\t /** a modal version of the paired collection creator */\n\t var pairedCollectionCreatorModal = function _pairedCollectionCreatorModal(datasets, options) {\n\t\n\t var deferred = jQuery.Deferred(),\n\t creator;\n\t\n\t options = _.defaults(options || {}, {\n\t datasets: datasets,\n\t oncancel: function () {\n\t Galaxy.modal.hide();\n\t deferred.reject('cancelled');\n\t },\n\t oncreate: function (creator, response) {\n\t Galaxy.modal.hide();\n\t deferred.resolve(response);\n\t }\n\t });\n\t\n\t if (!window.Galaxy || !Galaxy.modal) {\n\t throw new Error('Galaxy or Galaxy.modal not found');\n\t }\n\t\n\t creator = new PairedCollectionCreator(options);\n\t Galaxy.modal.show({\n\t title: 'Create a collection of paired datasets',\n\t body: creator.$el,\n\t width: '80%',\n\t height: '800px',\n\t closing_events: true\n\t });\n\t creator.render();\n\t window.creator = creator;\n\t\n\t //TODO: remove modal header\n\t return deferred;\n\t };\n\t\n\t //=============================================================================\n\t function createListOfPairsCollection(collection, defaultHideSourceItems) {\n\t var elements = collection.toJSON();\n\t //TODO: validate elements\n\t return pairedCollectionCreatorModal(elements, {\n\t historyId: collection.historyId,\n\t defaultHideSourceItems: defaultHideSourceItems\n\t });\n\t }\n\t\n\t //=============================================================================\n\t return {\n\t PairedCollectionCreator: PairedCollectionCreator,\n\t pairedCollectionCreatorModal: pairedCollectionCreatorModal,\n\t createListOfPairsCollection: createListOfPairsCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 125 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(60), __webpack_require__(63), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_CREATOR, HDCA, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t /*==============================================================================\n\t TODO:\n\t the paired creator doesn't really mesh with the list creator as parent\n\t it may be better to make an abstract super class for both\n\t composites may inherit from this (or vis-versa)\n\t PairedDatasetCollectionElementView doesn't make a lot of sense\n\t \n\t ==============================================================================*/\n\t /** */\n\t var PairedDatasetCollectionElementView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t //TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n\t tagName: 'li',\n\t className: 'collection-element',\n\t\n\t initialize: function (attributes) {\n\t this.element = attributes.element || {};\n\t this.identifier = attributes.identifier;\n\t },\n\t\n\t render: function () {\n\t this.$el.attr('data-element-id', this.element.id).html(this.template({ identifier: this.identifier, element: this.element }));\n\t return this;\n\t },\n\t\n\t //TODO: lots of unused space in the element - possibly load details and display them horiz.\n\t template: _.template(['<%- identifier %>', '<%- element.name %>'].join('')),\n\t\n\t /** remove the DOM and any listeners */\n\t destroy: function () {\n\t this.off();\n\t this.$el.remove();\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'DatasetCollectionElementView()';\n\t }\n\t });\n\t\n\t // ============================================================================\n\t var _super = LIST_CREATOR.ListCollectionCreator;\n\t\n\t /** An interface for building collections.\n\t */\n\t var PairCollectionCreator = _super.extend({\n\t\n\t /** the class used to display individual elements */\n\t elementViewClass: PairedDatasetCollectionElementView,\n\t /** the class this creator will create and save */\n\t collectionClass: HDCA.HistoryPairDatasetCollection,\n\t className: 'pair-collection-creator collection-creator flex-row-container',\n\t\n\t /** override to no-op */\n\t _mangleDuplicateNames: function () {},\n\t\n\t // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n\t // bad inital choices and\n\t // when the user has painted his/her self into a corner during creation/use-of-the-creator\n\t /** render the entire interface */\n\t render: function (speed, callback) {\n\t if (this.workingElements.length === 2) {\n\t return _super.prototype.render.call(this, speed, callback);\n\t }\n\t return this._renderInvalid(speed, callback);\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering elements\n\t /** render forward/reverse */\n\t _renderList: function (speed, callback) {\n\t //this.debug( '-- _renderList' );\n\t //precondition: there are two valid elements in workingElements\n\t var creator = this,\n\t $tmp = jQuery('
                                  '),\n\t $list = creator.$list();\n\t\n\t // lose the original views, create the new, append all at once, then call their renders\n\t _.each(this.elementViews, function (view) {\n\t view.destroy();\n\t creator.removeElementView(view);\n\t });\n\t $tmp.append(creator._createForwardElementView().$el);\n\t $tmp.append(creator._createReverseElementView().$el);\n\t $list.empty().append($tmp.children());\n\t _.invoke(creator.elementViews, 'render');\n\t },\n\t\n\t /** create the forward element view */\n\t _createForwardElementView: function () {\n\t return this._createElementView(this.workingElements[0], { identifier: 'forward' });\n\t },\n\t\n\t /** create the forward element view */\n\t _createReverseElementView: function () {\n\t return this._createElementView(this.workingElements[1], { identifier: 'reverse' });\n\t },\n\t\n\t /** create an element view, cache in elementViews, and return */\n\t _createElementView: function (element, options) {\n\t var elementView = new this.elementViewClass(_.extend(options, {\n\t element: element\n\t }));\n\t this.elementViews.push(elementView);\n\t return elementView;\n\t },\n\t\n\t /** swap the forward, reverse elements and re-render */\n\t swap: function () {\n\t this.workingElements = [this.workingElements[1], this.workingElements[0]];\n\t this._renderList();\n\t },\n\t\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .swap': 'swap'\n\t }),\n\t\n\t // ------------------------------------------------------------------------ templates\n\t //TODO: move to require text plugin and load these as text\n\t //TODO: underscore currently unnecc. bc no vars are used\n\t //TODO: better way of localizing text-nodes in long strings\n\t /** underscore template fns attached to class */\n\t templates: _.extend(_.clone(_super.prototype.templates), {\n\t /** the middle: element list */\n\t middle: _.template(['', '
                                  ', '
                                  '].join('')),\n\t\n\t /** help content */\n\t helpContent: _.template(['

                                  ', _l(['Pair collections are permanent collections containing two datasets: one forward and one reverse. ', 'Often these are forward and reverse reads. The pair collections can be passed to tools and ', 'workflows in order to have analyses done on both datasets. This interface allows ', 'you to create a pair, name it, and swap which is forward and which reverse.'].join('')), '

                                  ', '
                                    ', '
                                  • ', _l(['Click the \"Swap\" link to make your forward dataset the reverse ', 'and the reverse dataset forward.'].join('')), '
                                  • ', '
                                  • ', _l(['Click the \"Cancel\" button to exit the interface.'].join('')), '
                                  • ', '

                                  ', '

                                  ', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '

                                  '].join('')),\n\t\n\t /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n\t invalidInitial: _.template(['
                                  ', '
                                  ', '', '<% if( _.size( problems ) ){ %>', _l('The following selections could not be included due to problems'), '
                                    <% _.each( problems, function( problem ){ %>', '
                                  • <%- problem.element.name %>: <%- problem.text %>
                                  • ', '<% }); %>
                                  ', '<% } else if( _.size( elements ) === 0 ){ %>', _l('No datasets were selected'), '.', '<% } else if( _.size( elements ) === 1 ){ %>', _l('Only one dataset was selected'), ': <%- elements[0].name %>', '<% } else if( _.size( elements ) > 2 ){ %>', _l('Too many datasets were selected'), ': <%- _.pluck( elements, \"name\" ).join( \", \") %>', '<% } %>', '
                                  ', _l('Two (and only two) elements are needed for the pair'), '. ', _l('You may need to '), '', _l('cancel'), ' ', _l('and reselect new elements'), '.', '
                                  ', '
                                  ', '
                                  ', '
                                  ', '
                                  ', '
                                  ', '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
                                  ', '
                                  ', '
                                  '].join(''))\n\t }),\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'PairCollectionCreator';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** List collection flavor of collectionCreatorModal. */\n\t var pairCollectionCreatorModal = function _pairCollectionCreatorModal(elements, options) {\n\t options = options || {};\n\t options.title = _l('Create a collection from a pair of datasets');\n\t return LIST_CREATOR.collectionCreatorModal(elements, options, PairCollectionCreator);\n\t };\n\t\n\t //==============================================================================\n\t /** Use a modal to create a pair collection, then add it to the given history contents.\n\t * @returns {Deferred} resolved when the collection is added to the history.\n\t */\n\t function createPairCollection(contents, defaultHideSourceItems) {\n\t var elements = contents.toJSON(),\n\t promise = pairCollectionCreatorModal(elements, {\n\t defaultHideSourceItems: defaultHideSourceItems,\n\t creationFn: function (elements, name, hideSourceItems) {\n\t elements = [{ name: \"forward\", src: \"hda\", id: elements[0].id }, { name: \"reverse\", src: \"hda\", id: elements[1].id }];\n\t return contents.createHDCA(elements, 'paired', name, hideSourceItems);\n\t }\n\t });\n\t return promise;\n\t }\n\t\n\t //==============================================================================\n\t return {\n\t PairCollectionCreator: PairCollectionCreator,\n\t pairCollectionCreatorModal: pairCollectionCreatorModal,\n\t createPairCollection: createPairCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 126 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(49), __webpack_require__(5), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Tabs, Ui, Form) {\n\t\n\t /** Dataset edit attributes view */\n\t var View = Backbone.View.extend({\n\t initialize: function () {\n\t this.setElement('
                                  ');\n\t this.model = new Backbone.Model({ 'dataset_id': Galaxy.params.dataset_id });\n\t this.render();\n\t },\n\t\n\t // Fetch data for the selected dataset and \n\t // build tabs for editing its attributes\n\t render: function () {\n\t var url = Galaxy.root + 'dataset/edit',\n\t self = this;\n\t Utils.get({\n\t url: url,\n\t data: { 'dataset_id': self.model.get('dataset_id') },\n\t success: function (response) {\n\t self.render_attribute_page(self, response);\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while loading the dataset.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t\n\t /** Render all the tabs view */\n\t render_attribute_page: function (self, response) {\n\t var message = {\n\t 'message': response.message,\n\t 'status': response.status,\n\t 'persistent': true,\n\t 'cls': response.status + 'message'\n\t };\n\t self.$el.empty().append(self._templateHeader());\n\t self.display_message(message, self.$('.response-message'));\n\t // Create all tabs\n\t self.create_tabs(response, self.$('.edit-attr'));\n\t },\n\t\n\t /** Perform AJAX post call */\n\t call_ajax: function (self, data, tab_name) {\n\t var post_url = Galaxy.root + 'dataset/edit';\n\t $.ajax({\n\t type: \"PUT\",\n\t url: post_url,\n\t data: data,\n\t success: function (response) {\n\t self.render_attribute_page(self, response);\n\t self.reload_history();\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t\n\t /** Display actions messages */\n\t display_message: function (response, $el) {\n\t $el.empty().html(new Ui.Message(response).$el);\n\t },\n\t\n\t /** Create tabs for different attributes of dataset*/\n\t create_tabs: function (response, $el_edit_attr) {\n\t var self = this;\n\t self.tabs = new Tabs.View();\n\t self.tabs.add({\n\t id: 'attributes',\n\t title: 'Attributes',\n\t icon: 'fa fa-bars',\n\t tooltip: 'Edit dataset attributes',\n\t $el: self._getAttributesFormTemplate(response)\n\t });\n\t\n\t self.tabs.add({\n\t id: 'convert',\n\t title: 'Convert',\n\t icon: 'fa-gear',\n\t tooltip: 'Convert to new format',\n\t $el: self._getConvertFormTemplate(response)\n\t });\n\t\n\t self.tabs.add({\n\t id: 'datatype',\n\t title: 'Datatypes',\n\t icon: 'fa-database',\n\t tooltip: 'Change data type',\n\t $el: self._getChangeDataTypeFormTemplate(response)\n\t });\n\t\n\t self.tabs.add({\n\t id: 'permissions',\n\t title: 'Permissions',\n\t icon: 'fa-user',\n\t tooltip: 'Permissions',\n\t $el: self._getPermissionsFormTemplate(response)\n\t });\n\t $el_edit_attr.append(self.tabs.$el);\n\t self.tabs.showTab('attributes');\n\t },\n\t\n\t /** Main template */\n\t _templateHeader: function () {\n\t return '
                                  ' + '
                                  ' + '

                                  Edit Dataset Attributes

                                  ' + '
                                  ';\n\t },\n\t\n\t /** Attributes tab template */\n\t _getAttributesFormTemplate: function (response) {\n\t var self = this;\n\t var form = new Form({\n\t title: 'Edit attributes',\n\t inputs: response.edit_attributes_inputs,\n\t operations: {\n\t 'submit_editattr': new Ui.ButtonIcon({\n\t tooltip: 'Save attributes of the dataset.',\n\t icon: 'fa-floppy-o ',\n\t title: 'Save attributes',\n\t onclick: function () {\n\t self._submit(self, form, response, \"edit_attributes\");\n\t }\n\t }),\n\t 'submit_autocorrect': new Ui.ButtonIcon({\n\t tooltip: 'This will inspect the dataset and attempt to correct the values of fields if they are not accurate.',\n\t icon: 'fa-undo ',\n\t title: 'Auto-detect',\n\t onclick: function () {\n\t self._submit(self, form, response, \"auto-detect\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Convert tab template */\n\t _getConvertFormTemplate: function (response) {\n\t var self = this;\n\t var form = new Form({\n\t title: 'Convert to new format',\n\t inputs: response.convert_inputs,\n\t operations: {\n\t 'submit': new Ui.ButtonIcon({\n\t tooltip: 'Convert the datatype to a new format.',\n\t title: 'Convert datatype',\n\t icon: 'fa-exchange ',\n\t onclick: function () {\n\t self._submit(self, form, response, \"convert\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Change datatype template */\n\t _getChangeDataTypeFormTemplate: function (response) {\n\t var self = this;\n\t var form = new Form({\n\t title: 'Change datatype',\n\t inputs: response.convert_datatype_inputs,\n\t operations: {\n\t 'submit': new Ui.ButtonIcon({\n\t tooltip: 'Change the datatype to a new type.',\n\t title: 'Change datatype',\n\t icon: 'fa-exchange ',\n\t onclick: function () {\n\t self._submit(self, form, response, \"change\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Permissions template */\n\t _getPermissionsFormTemplate: function (response) {\n\t var template = \"\",\n\t self = this;\n\t if (response.can_manage_dataset) {\n\t var form = new Form({\n\t title: 'Manage dataset permissions on ' + response.display_name,\n\t inputs: response.permission_inputs,\n\t operations: {\n\t 'submit': new Ui.ButtonIcon({\n\t tooltip: 'Save permissions.',\n\t title: 'Save permissions',\n\t icon: 'fa-floppy-o ',\n\t onclick: function () {\n\t self._submit(self, form, response, \"permissions\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t } else {\n\t var form = new Form({\n\t title: 'View permissions',\n\t inputs: response.permission_inputs\n\t });\n\t return form.$el;\n\t }\n\t },\n\t\n\t /** Submit action */\n\t _submit: function (self, form, response, type) {\n\t var form_data = form.data.create();\n\t form_data.dataset_id = response.dataset_id;\n\t switch (type) {\n\t case \"edit_attributes\":\n\t form_data.save = 'Save';\n\t break;\n\t\n\t case \"auto-detect\":\n\t form_data.detect = 'Auto-detect';\n\t break;\n\t\n\t case \"convert\":\n\t if (form_data.target_type !== null && form_data.target_type) {\n\t form_data.dataset_id = response.dataset_id;\n\t form_data.convert_data = 'Convert';\n\t }\n\t break;\n\t\n\t case \"change\":\n\t form_data.change = 'Save';\n\t break;\n\t\n\t case \"permissions\":\n\t var post_data = {};\n\t post_data.permissions = JSON.stringify(form_data);\n\t post_data.update_roles_button = \"Save\";\n\t post_data.dataset_id = response.dataset_id;\n\t form_data = post_data;\n\t break;\n\t }\n\t self.call_ajax(self, form_data);\n\t },\n\t\n\t /** Reload Galaxy's history after updating dataset's attributes */\n\t reload_history: function () {\n\t if (window.Galaxy) {\n\t window.Galaxy.currHistoryPanel.loadCurrentHistory();\n\t }\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 127 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(5), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Ui, Form) {\n\t\n\t /** Dataset edit attributes view */\n\t var View = Backbone.View.extend({\n\t initialize: function () {\n\t this.setElement('
                                  ');\n\t this.model = new Backbone.Model({ 'dataset_id': Galaxy.params.dataset_id });\n\t this.render();\n\t },\n\t\n\t // Fetch data for the selected dataset and\n\t render: function () {\n\t var data_url = Galaxy.root + 'api/datasets/' + this.model.get('dataset_id'),\n\t self = this;\n\t\n\t Utils.get({\n\t url: data_url,\n\t success: function (dataset) {\n\t var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n\t Utils.get({\n\t url: job_url,\n\t success: function (job) {\n\t var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n\t self.render_error_page(self, dataset, job);\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while loading the job.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while loading the dataset.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t\n\t /** Render the view */\n\t render_error_page: function (self, dataset, job) {\n\t self.$el.empty().append(self._templateHeader());\n\t self.$el.append('

                                  Dataset Error

                                  ');\n\t self.$el.append('

                                  An error occured while running the tool ' + job.tool_id + '.

                                  ');\n\t self.$el.append('

                                  Tool execution generated the following messages:

                                  ');\n\t self.$el.append('
                                  ' + job.stderr + '
                                  ');\n\t self.$el.append('

                                  Report This Error

                                1. ');\n\t self.$el.append('

                                  Usually the local Galaxy administrators regularly review errors that occur on the server. However, if you would like to provide additional information (such as what you were trying to do when the error occurred) and a contact e-mail address, we will be better able to investigate your problem and get back to you.

                                  ');\n\t self.$el.append(self._getBugFormTemplate(dataset, job));\n\t },\n\t\n\t /** Display actions messages */\n\t display_message: function (response, $el, doNotClear, safe) {\n\t if (!safe) {\n\t if (doNotClear) {\n\t $el.append(new Ui.Message(response).$el);\n\t } else {\n\t $el.empty().html(new Ui.Message(response).$el);\n\t }\n\t } else {\n\t if (doNotClear) {\n\t $el.append(new Ui.UnescapedMessage(response).$el);\n\t } else {\n\t $el.empty().html(new Ui.UnescapedMessage(response).$el);\n\t }\n\t }\n\t },\n\t\n\t /** Main template */\n\t _templateHeader: function () {\n\t return '
                                  ' + '
                                  ' + '
                                  ';\n\t },\n\t\n\t /** Convert tab template */\n\t _getBugFormTemplate: function (dataset, job) {\n\t var self = this;\n\t var inputs = [{\n\t \"help\": \"Your email address\",\n\t \"options\": [],\n\t \"type\": \"text\",\n\t \"name\": \"email\",\n\t \"label\": \"Your email\",\n\t \"value\": Galaxy.user.get('email')\n\t }, {\n\t \"help\": \"Any additional comments you can provide regarding what you were doing at the time of the bug.\",\n\t \"options\": [],\n\t \"type\": \"text\",\n\t \"area\": true,\n\t \"name\": \"message\",\n\t \"label\": \"Message\"\n\t }];\n\t\n\t // TODO\n\t if (false) {\n\t inputs.push({\n\t \"name\": \"public_consent\",\n\t \"label\": \"Public Disclosure Consent\",\n\t \"help\": \"This Galaxy is configured to report to one or more error reporting backends that public to the world. By selecting 'yes', you acknowledge that this bug report will be made public.\",\n\t \"value\": String(Boolean(false)),\n\t \"options\": [],\n\t \"type\": \"boolean\"\n\t });\n\t }\n\t\n\t var form = new Form({\n\t title: 'Error Report',\n\t inputs: inputs,\n\t buttons: {\n\t save: new Ui.Button({\n\t icon: 'fa-bug',\n\t title: 'Report',\n\t cls: 'ui-button btn btn-primary',\n\t floating: 'clear',\n\t onclick: function () {\n\t var form_data = form.data.create();\n\t var url = Galaxy.root + 'api/jobs/' + job.id + '/error';\n\t form_data.dataset_id = dataset.id;\n\t self.submit(form_data, url);\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Make ajax request */\n\t submit: function (form_data, url) {\n\t var self = this;\n\t // Some required metadata\n\t $.ajax({\n\t type: \"POST\",\n\t url: url,\n\t data: form_data,\n\t success: function (response) {\n\t // Clear out the div\n\t self.$el.empty().append(self._templateHeader());\n\t // And display the messages.\n\t response.messages.forEach(function (message) {\n\t self.display_message({\n\t 'status': message[1],\n\t 'message': message[0],\n\t 'persistent': true\n\t }, self.$('.response-message'), true, true);\n\t });\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 128 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This class renders the grid list with shared section. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(12)], __WEBPACK_AMD_DEFINE_RESULT__ = function (GridView) {\n\t var View = Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.setElement($('
                                  '));\n\t this.model = new Backbone.Model(options);\n\t this.item = this.model.get('item');\n\t $.ajax({\n\t url: Galaxy.root + this.item + '/' + this.model.get('action_id'),\n\t success: function (response) {\n\t response['dict_format'] = true;\n\t self.model.set(response);\n\t self.render();\n\t }\n\t });\n\t },\n\t\n\t render: function () {\n\t var grid = new GridView(this.model.attributes);\n\t this.$el.empty().append(grid.$el);\n\t this.$el.append(this._templateShared());\n\t },\n\t\n\t _templateShared: function () {\n\t var self = this;\n\t var $tmpl = $('
                                  ' + '

                                  ' + this.model.get('plural') + ' shared with you by others

                                  ' + '
                                  ');\n\t var options = this.model.attributes;\n\t if (options.shared_by_others && options.shared_by_others.length > 0) {\n\t var $table = $('' + '' + '' + '' + '' + '
                                  TitleOwner
                                  ');\n\t _.each(options.shared_by_others, function (it, index) {\n\t var display_url = Galaxy.root + self.item + '/display_by_username_and_slug?username=' + it.username + '&slug=' + it.slug;\n\t $table.append('
                                  ' + '' + _.escape(it.title) + '' + '' + _.escape(it.username) + '
                                  ' + '
                                  ' + '
                                  ' + '
                                  ' + '
                                  ' + '
                                  You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.
                                  ' + '',\n '
                                  ',\n '
                                  '\n ].join( '' );\n }\n});\n\n//==============================================================================\nreturn {\n CitationView : CitationView,\n CitationListView : CitationListView\n};\n\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/citation/citation-view.js","define([\n \"mvc/list/list-item\",\n \"mvc/dataset/dataset-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_ITEM, DATASET_LI, BASE_MVC, _l ){\n\n'use strict';\n//==============================================================================\nvar FoldoutListItemView = LIST_ITEM.FoldoutListItemView,\n ListItemView = LIST_ITEM.ListItemView;\n/** @class Read only view for DatasetCollection.\n */\nvar DCListItemView = FoldoutListItemView.extend(\n/** @lends DCListItemView.prototype */{\n\n className : FoldoutListItemView.prototype.className + \" dataset-collection\",\n id : function(){\n return [ 'dataset_collection', this.model.get( 'id' ) ].join( '-' );\n },\n\n /** override to add linkTarget */\n initialize : function( attributes ){\n this.linkTarget = attributes.linkTarget || '_blank';\n this.hasUser = attributes.hasUser;\n FoldoutListItemView.prototype.initialize.call( this, attributes );\n },\n\n /** event listeners */\n _setUpListeners : function(){\n FoldoutListItemView.prototype._setUpListeners.call( this );\n this.listenTo( this.model, 'change', function( model, options ){\n // if the model has changed deletion status render it entirely\n if( _.has( model.changed, 'deleted' ) ){\n this.render();\n\n // if the model has been decorated after the fact with the element count,\n // render the subtitle where the count is displayed\n } else if( _.has( model.changed, 'element_count' ) ){\n this.$( '> .title-bar .subtitle' ).replaceWith( this._renderSubtitle() );\n }\n });\n },\n\n // ......................................................................... rendering\n /** render a subtitle to show the user what sort of collection this is */\n _renderSubtitle : function(){\n return $( this.templates.subtitle( this.model.toJSON(), this ) );\n },\n\n // ......................................................................... foldout\n /** override to add linktarget to sub-panel */\n _getFoldoutPanelOptions : function(){\n var options = FoldoutListItemView.prototype._getFoldoutPanelOptions.call( this );\n return _.extend( options, {\n linkTarget : this.linkTarget,\n hasUser : this.hasUser\n });\n },\n\n /** override to not catch sub-panel selectors */\n $selector : function(){\n return this.$( '> .selector' );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDCListItemView.prototype.templates = (function(){\n\n var warnings = _.extend( {}, FoldoutListItemView.prototype.templates.warnings, {\n error : BASE_MVC.wrapTemplate([\n // error during index fetch - show error on dataset\n '<% if( model.error ){ %>',\n '
                                  ',\n _l( 'There was an error getting the data for this collection' ), ': <%- model.error %>',\n '
                                  ',\n '<% } %>'\n ]),\n purged : BASE_MVC.wrapTemplate([\n '<% if( model.purged ){ %>',\n '
                                  ',\n _l( 'This collection has been deleted and removed from disk' ),\n '
                                  ',\n '<% } %>'\n ]),\n deleted : BASE_MVC.wrapTemplate([\n // deleted not purged\n '<% if( model.deleted && !model.purged ){ %>',\n '
                                  ',\n _l( 'This collection has been deleted' ),\n '
                                  ',\n '<% } %>'\n ])\n });\n\n // use element identifier\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n '
                                  ',\n '
                                  ',\n '<%- collection.element_identifier || collection.name %>',\n '
                                  ',\n '
                                  ',\n '
                                  '\n ], 'collection' );\n\n // use element identifier\n var subtitleTemplate = BASE_MVC.wrapTemplate([\n '
                                  ',\n '<% var countText = collection.element_count? ( collection.element_count + \" \" ) : \"\"; %>',\n '<% if( collection.collection_type === \"list\" ){ %>',\n _l( 'a list of <%- countText %>datasets' ),\n '<% } else if( collection.collection_type === \"paired\" ){ %>',\n _l( 'a pair of datasets' ),\n '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n _l( 'a list of <%- countText %>dataset pairs' ),\n '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n _l( 'a list of <%- countText %>dataset lists' ),\n '<% } %>',\n '
                                  '\n ], 'collection' );\n\n return _.extend( {}, FoldoutListItemView.prototype.templates, {\n warnings : warnings,\n titleBar : titleBarTemplate,\n subtitle : subtitleTemplate\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for DatasetCollectionElement.\n */\nvar DCEListItemView = ListItemView.extend(\n/** @lends DCEListItemView.prototype */{\n\n /** add the DCE class to the list item */\n className : ListItemView.prototype.className + \" dataset-collection-element\",\n\n /** set up */\n initialize : function( attributes ){\n if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }\n this.log( 'DCEListItemView.initialize:', attributes );\n ListItemView.prototype.initialize.call( this, attributes );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCEListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDCEListItemView.prototype.templates = (function(){\n\n // use the element identifier here - since that will persist and the user will need it\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n '
                                  ',\n '
                                  ',\n '<%- element.element_identifier %>',\n '
                                  ',\n '
                                  ',\n '
                                  '\n ], 'element' );\n\n return _.extend( {}, ListItemView.prototype.templates, {\n titleBar : titleBarTemplate\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for a DatasetCollectionElement that is also an DatasetAssociation\n * (a dataset contained in a dataset collection).\n */\nvar DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend(\n/** @lends DatasetDCEListItemView.prototype */{\n\n className : DATASET_LI.DatasetListItemView.prototype.className + \" dataset-collection-element\",\n\n /** set up */\n initialize : function( attributes ){\n if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }\n this.log( 'DatasetDCEListItemView.initialize:', attributes );\n DATASET_LI.DatasetListItemView.prototype.initialize.call( this, attributes );\n },\n\n /** In this override, only get details if in the ready state.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n }\n return jQuery.when();\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DatasetDCEListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetDCEListItemView.prototype.templates = (function(){\n\n // use the element identifier here and not the dataset name\n //TODO:?? can we steal the DCE titlebar?\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n '
                                  ',\n '',\n '
                                  ',\n '<%- element.element_identifier %>',\n '
                                  ',\n '
                                  '\n ], 'element' );\n\n return _.extend( {}, DATASET_LI.DatasetListItemView.prototype.templates, {\n titleBar : titleBarTemplate\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n * (a nested DC).\n */\nvar NestedDCDCEListItemView = DCListItemView.extend(\n/** @lends NestedDCDCEListItemView.prototype */{\n\n className : DCListItemView.prototype.className + \" dataset-collection-element\",\n\n /** In this override, add the state as a class for use with state-based CSS */\n _swapNewRender : function( $newRender ){\n DCListItemView.prototype._swapNewRender.call( this, $newRender );\n var state = this.model.get( 'state' ) || 'ok';\n this.$el.addClass( 'state-' + state );\n return this.$el;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'NestedDCDCEListItemView(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\n return {\n DCListItemView : DCListItemView,\n DCEListItemView : DCEListItemView,\n DatasetDCEListItemView : DatasetDCEListItemView,\n NestedDCDCEListItemView : NestedDCDCEListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-li.js","define([\n \"mvc/dataset/dataset-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET_MODEL, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\n/*\nNotes:\n\nTerminology:\n DatasetCollection/DC : a container of datasets or nested DatasetCollections\n Element/DatasetCollectionElement/DCE : an item contained in a DatasetCollection\n HistoryDatasetCollectionAssociation/HDCA: a DatasetCollection contained in a history\n\n\nThis all seems too complex unfortunately:\n\n- Terminology collision between DatasetCollections (DCs) and Backbone Collections.\n- In the DatasetCollections API JSON, DC Elements use a 'Has A' stucture to *contain*\n either a dataset or a nested DC. This would make the hierarchy much taller. I've\n decided to merge the contained JSON with the DC element json - making the 'has a'\n relation into an 'is a' relation. This seems simpler to me and allowed a lot of\n DRY in both models and views, but may make tracking or tracing within these models\n more difficult (since DatasetCollectionElements are now *also* DatasetAssociations\n or DatasetCollections (nested)). This also violates the rule of thumb about\n favoring aggregation over inheritance.\n- Currently, there are three DatasetCollection subclasses: List, Pair, and ListPaired.\n These each should a) be usable on their own, b) be usable in the context of\n nesting within a collection model (at least in the case of ListPaired), and\n c) be usable within the context of other container models (like History or\n LibraryFolder, etc.). I've tried to separate/extract classes in order to\n handle those three situations, but it's proven difficult to do in a simple,\n readable manner.\n- Ideally, histories and libraries would inherit from the same server models as\n dataset collections do since they are (in essence) dataset collections themselves -\n making the whole nested structure simpler. This would be a large, error-prone\n refactoring and migration.\n\nMany of the classes and heirarchy are meant as extension points so, while the\nrelations and flow may be difficult to understand initially, they'll allow us to\nhandle the growth or flux dataset collection in the future (w/o actually implementing\nany YAGNI).\n\n*/\n//_________________________________________________________________________________________________ ELEMENTS\n/** @class mixin for Dataset collection elements.\n * When collection elements are passed from the API, the underlying element is\n * in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).\n * This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues\n * effectively changing a DCE from a container to a subclass (has a --> is a).\n */\nvar DatasetCollectionElementMixin = {\n\n /** default attributes used by elements in a dataset collection */\n defaults : {\n model_class : 'DatasetCollectionElement',\n element_identifier : null,\n element_index : null,\n element_type : null\n },\n\n /** merge the attributes of the sub-object 'object' into this model */\n _mergeObject : function( attributes ){\n // if we don't preserve and correct ids here, the element id becomes the object id\n // and collision in backbone's _byId will occur and only\n _.extend( attributes, attributes.object, { element_id: attributes.id });\n delete attributes.object;\n return attributes;\n },\n\n /** override to merge this.object into this */\n constructor : function( attributes, options ){\n // console.debug( '\\t DatasetCollectionElement.constructor:', attributes, options );\n attributes = this._mergeObject( attributes );\n this.idAttribute = 'element_id';\n Backbone.Model.apply( this, arguments );\n },\n\n /** when the model is fetched, merge this.object into this */\n parse : function( response, options ){\n var attributes = response;\n attributes = this._mergeObject( attributes );\n return attributes;\n }\n};\n\n/** @class Concrete class of Generic DatasetCollectionElement */\nvar DatasetCollectionElement = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( DatasetCollectionElementMixin )\n .extend({ _logNamespace : 'collections' });\n\n\n//==============================================================================\n/** @class Base/Abstract Backbone collection for Generic DCEs. */\nvar DCECollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).extend(\n/** @lends DCECollection.prototype */{\n _logNamespace : 'collections',\n\n model: DatasetCollectionElement,\n\n /** String representation. */\n toString : function(){\n return ([ 'DatasetCollectionElementCollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for a dataset collection element that is a dataset (HDA).\n */\nvar DatasetDCE = DATASET_MODEL.DatasetAssociation.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends DatasetDCE.prototype */{\n\n /** url fn */\n url : function(){\n // won't always be an hda\n if( !this.has( 'history_id' ) ){\n console.warn( 'no endpoint for non-hdas within a collection yet' );\n // (a little silly since this api endpoint *also* points at hdas)\n return Galaxy.root + 'api/datasets';\n }\n return Galaxy.root + 'api/histories/' + this.get( 'history_id' ) + '/contents/' + this.get( 'id' );\n },\n\n defaults : _.extend( {},\n DATASET_MODEL.DatasetAssociation.prototype.defaults,\n DatasetCollectionElementMixin.defaults\n ),\n\n _downloadQueryParameters : function() {\n return '?to_ext=' + this.get( 'file_ext' ) + '&hdca_id=' + this.get( 'parent_hdca_id' ) + '&element_identifier=' + this.get( 'element_identifier' );\n },\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually for now\n /** call the mixin constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t DatasetDCE.constructor:', attributes, options );\n //DATASET_MODEL.DatasetAssociation.prototype.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** Does this model already contain detailed data (as opposed to just summary level data)? */\n hasDetails : function(){\n return this.elements && this.elements.length;\n },\n\n /** String representation. */\n toString : function(){\n var objStr = this.get( 'element_identifier' );\n return ([ 'DatasetDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n */\nvar DatasetDCECollection = DCECollection.extend(\n/** @lends DatasetDCECollection.prototype */{\n model: DatasetDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'DatasetDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//_________________________________________________________________________________________________ COLLECTIONS\n/** @class Backbone model for Dataset Collections.\n * The DC API returns an array of JSON objects under the attribute elements.\n * This model:\n * - removes that array/attribute ('elements') from the model,\n * - creates a bbone collection (of the class defined in the 'collectionClass' attribute),\n * - passes that json onto the bbone collection\n * - caches the bbone collection in this.elements\n */\nvar DatasetCollection = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( BASE_MVC.SearchableModelMixin )\n .extend(/** @lends DatasetCollection.prototype */{\n _logNamespace : 'collections',\n\n /** default attributes for a model */\n defaults : {\n /* 'list', 'paired', or 'list:paired' */\n collection_type : null,\n //??\n deleted : false\n },\n\n /** Which class to use for elements */\n collectionClass : DCECollection,\n\n /** set up: create elements instance var and (on changes to elements) update them */\n initialize : function( model, options ){\n this.debug( this + '(DatasetCollection).initialize:', model, options, this );\n this.elements = this._createElementsModel();\n this.on( 'change:elements', function(){\n this.log( 'change:elements' );\n //TODO: prob. better to update the collection instead of re-creating it\n this.elements = this._createElementsModel();\n });\n },\n\n /** move elements model attribute to full collection */\n _createElementsModel : function(){\n this.debug( this + '._createElementsModel', this.collectionClass, this.get( 'elements' ), this.elements );\n //TODO: same patterns as DatasetCollectionElement _createObjectModel - refactor to BASE_MVC.hasSubModel?\n var elements = this.get( 'elements' ) || [];\n this.unset( 'elements', { silent: true });\n var self = this;\n _.each(elements, function(element, index) {\n _.extend(element, {\"parent_hdca_id\": self.get(\"id\")});\n });\n this.elements = new this.collectionClass( elements );\n //this.debug( 'collectionClass:', this.collectionClass + '', this.elements );\n return this.elements;\n },\n\n // ........................................................................ common queries\n /** pass the elements back within the model json when this is serialized */\n toJSON : function(){\n var json = Backbone.Model.prototype.toJSON.call( this );\n if( this.elements ){\n json.elements = this.elements.toJSON();\n }\n return json;\n },\n\n /** Is this collection in a 'ready' state no processing (for the collection) is left\n * to do on the server.\n */\n inReadyState : function(){\n var populated = this.get( 'populated' );\n return ( this.isDeletedOrPurged() || populated );\n },\n\n //TODO:?? the following are the same interface as DatasetAssociation - can we combine?\n /** Does the DC contain any elements yet? Is a fetch() required? */\n hasDetails : function(){\n return this.elements.length !== 0;\n },\n\n /** Given the filters, what models in this.elements would be returned? */\n getVisibleContents : function( filters ){\n // filters unused for now\n return this.elements;\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse : function( response, options ){\n var parsed = Backbone.Model.prototype.parse.call( this, response, options );\n if( parsed.create_time ){\n parsed.create_time = new Date( parsed.create_time );\n }\n if( parsed.update_time ){\n parsed.update_time = new Date( parsed.update_time );\n }\n return parsed;\n },\n\n /** save this dataset, _Mark_ing it as deleted (just a flag) */\n 'delete' : function( options ){\n if( this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: true }, options );\n },\n /** save this dataset, _Mark_ing it as undeleted */\n undelete : function( options ){\n if( !this.get( 'deleted' ) || this.get( 'purged' ) ){ return jQuery.when(); }\n return this.save( { deleted: false }, options );\n },\n\n /** Is this collection deleted or purged? */\n isDeletedOrPurged : function(){\n return ( this.get( 'deleted' ) || this.get( 'purged' ) );\n },\n\n // ........................................................................ searchable\n /** searchable attributes for collections */\n searchAttributes : [\n 'name', 'tags'\n ],\n\n // ........................................................................ misc\n /** String representation */\n toString : function(){\n var idAndName = [ this.get( 'id' ), this.get( 'name' ) || this.get( 'element_identifier' ) ];\n return 'DatasetCollection(' + ( idAndName.join(',') ) + ')';\n }\n});\n\n\n//==============================================================================\n/** Model for a DatasetCollection containing datasets (non-nested).\n */\nvar ListDatasetCollection = DatasetCollection.extend(\n/** @lends ListDatasetCollection.prototype */{\n\n /** override since we know the collection will only contain datasets */\n collectionClass : DatasetDCECollection,\n\n /** String representation. */\n toString : function(){ return 'List' + DatasetCollection.prototype.toString.call( this ); }\n});\n\n\n//==============================================================================\n/** Model for a DatasetCollection containing fwd/rev datasets (a list of 2).\n */\nvar PairDatasetCollection = ListDatasetCollection.extend(\n/** @lends PairDatasetCollection.prototype */{\n\n /** String representation. */\n toString : function(){ return 'Pair' + DatasetCollection.prototype.toString.call( this ); }\n});\n\n\n//_________________________________________________________________________________________________ NESTED COLLECTIONS\n// this is where things get weird, man. Weird.\n//TODO: it might be possible to compact all the following...I think.\n//==============================================================================\n/** @class Backbone model for a Generic DatasetCollectionElement that is also a DatasetCollection\n * (a nested collection). Currently only list:paired.\n */\nvar NestedDCDCE = DatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends NestedDCDCE.prototype */{\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** call the mixin constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t NestedDCDCE.constructor:', attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** String representation. */\n toString : function(){\n var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );\n return ([ 'NestedDCDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n */\nvar NestedDCDCECollection = DCECollection.extend(\n/** @lends NestedDCDCECollection.prototype */{\n\n /** This is a collection of nested collections */\n model: NestedDCDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'NestedDCDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n */\nvar NestedPairDCDCE = PairDatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends NestedPairDCDCE.prototype */{\n//TODO:?? possibly rename to NestedDatasetCollection?\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** This is both a collection and a collection element - call the constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t NestedPairDCDCE.constructor:', attributes, options );\n //DatasetCollection.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** String representation. */\n toString : function(){\n var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );\n return ([ 'NestedPairDCDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection for a backbone collection containing paired dataset collections.\n */\nvar NestedPairDCDCECollection = NestedDCDCECollection.extend(\n/** @lends PairDCDCECollection.prototype */{\n\n /** We know this collection is composed of only nested pair collections */\n model: NestedPairDCDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'NestedPairDCDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n */\nvar ListPairedDatasetCollection = DatasetCollection.extend(\n/** @lends ListPairedDatasetCollection.prototype */{\n\n /** list:paired is the only collection that itself contains collections */\n collectionClass : NestedPairDCDCECollection,\n\n /** String representation. */\n toString : function(){\n return ([ 'ListPairedDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for a list dataset collection within a list:list dataset collection. */\nvar NestedListDCDCE = ListDatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends NestedListDCDCE.prototype */{\n\n /** This is both a collection and a collection element - call the constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t NestedListDCDCE.constructor:', attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** String representation. */\n toString : function(){\n var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );\n return ([ 'NestedListDCDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection containing list dataset collections. */\nvar NestedListDCDCECollection = NestedDCDCECollection.extend({\n\n /** We know this collection is composed of only nested pair collections */\n model: NestedListDCDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'NestedListDCDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\nvar ListOfListsDatasetCollection = DatasetCollection.extend({\n\n /** list:paired is the only collection that itself contains collections */\n collectionClass : NestedListDCDCECollection,\n\n /** String representation. */\n toString : function(){\n return ([ 'ListOfListsDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n ListDatasetCollection : ListDatasetCollection,\n PairDatasetCollection : PairDatasetCollection,\n ListPairedDatasetCollection : ListPairedDatasetCollection,\n ListOfListsDatasetCollection: ListOfListsDatasetCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-model.js","\ndefine([\n \"mvc/history/hdca-model\",\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"mvc/collection/base-creator\",\n \"mvc/ui/ui-modal\",\n \"utils/natural-sort\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( HDCA, STATES, BASE_MVC, baseCreator, UI_MODAL, naturalSort, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n\n/*==============================================================================\nTODO:\n use proper Element model and not just json\n straighten out createFn, collection.createHDCA\n possibly stop using modals for this\n It would be neat to do a drag and drop\n\n==============================================================================*/\n/** A view for both DatasetDCEs and NestedDCDCEs\n * (things that implement collection-model:DatasetCollectionElementMixin)\n */\nvar DatasetCollectionElementView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n//TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName : 'li',\n className : 'collection-element',\n\n initialize : function( attributes ){\n this.element = attributes.element || {};\n this.selected = attributes.selected || false;\n },\n\n render : function(){\n this.$el\n .attr( 'data-element-id', this.element.id )\n .attr( 'draggable', true )\n .html( this.template({ element: this.element }) );\n if( this.selected ){\n this.$el.addClass( 'selected' );\n }\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template : _.template([\n '',\n '<%- element.name %>',\n '',\n '',\n ].join('')),\n\n /** select this element and pub */\n select : function( toggle ){\n this.$el.toggleClass( 'selected', toggle );\n this.trigger( 'select', {\n source : this,\n selected : this.$el.hasClass( 'selected' )\n });\n },\n\n /** animate the removal of this element and pub */\n discard : function(){\n var view = this,\n parentWidth = this.$el.parent().width();\n this.$el.animate({ 'margin-right' : parentWidth }, 'fast', function(){\n view.trigger( 'discard', {\n source : view\n });\n view.destroy();\n });\n },\n\n /** remove the DOM and any listeners */\n destroy : function(){\n this.off();\n this.$el.remove();\n },\n\n events : {\n 'click' : '_click',\n 'click .name' : '_clickName',\n 'click .discard': '_clickDiscard',\n\n 'dragstart' : '_dragstart',\n 'dragend' : '_dragend',\n 'dragover' : '_sendToParent',\n 'drop' : '_sendToParent'\n },\n\n /** select when the li is clicked */\n _click : function( ev ){\n ev.stopPropagation();\n this.select( ev );\n },\n\n /** rename a pair when the name is clicked */\n _clickName : function( ev ){\n ev.stopPropagation();\n ev.preventDefault();\n var promptString = [ _l( 'Enter a new name for the element' ), ':\\n(',\n _l( 'Note that changing the name here will not rename the dataset' ), ')' ].join( '' ),\n response = prompt( _l( 'Enter a new name for the element' ) + ':', this.element.name );\n if( response ){\n this.element.name = response;\n this.render();\n }\n //TODO: cancelling with ESC leads to closure of the creator...\n },\n\n /** discard when the discard button is clicked */\n _clickDiscard : function( ev ){\n ev.stopPropagation();\n this.discard();\n },\n\n /** dragging pairs for re-ordering */\n _dragstart : function( ev ){\n if( ev.originalEvent ){ ev = ev.originalEvent; }\n ev.dataTransfer.effectAllowed = 'move';\n ev.dataTransfer.setData( 'text/plain', JSON.stringify( this.element ) );\n\n this.$el.addClass( 'dragging' );\n this.$el.parent().trigger( 'collection-element.dragstart', [ this ] );\n },\n\n /** dragging for re-ordering */\n _dragend : function( ev ){\n this.$el.removeClass( 'dragging' );\n this.$el.parent().trigger( 'collection-element.dragend', [ this ] );\n },\n\n /** manually bubble up an event to the parent/container */\n _sendToParent : function( ev ){\n this.$el.parent().trigger( ev );\n },\n\n /** string rep */\n toString : function(){\n return 'DatasetCollectionElementView()';\n }\n});\n\n\n// ============================================================================\n/** An interface for building collections.\n */\nvar ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend( baseCreator.CollectionCreatorMixin ).extend({\n _logNamespace : logNamespace,\n\n /** the class used to display individual elements */\n elementViewClass : DatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass : HDCA.HistoryListDatasetCollection,\n className : 'list-collection-creator collection-creator flex-row-container',\n\n /** minimum number of valid elements to start with in order to build a collection of this type */\n minElements : 1,\n\n defaultAttributes : {\n//TODO: remove - use new collectionClass().save()\n /** takes elements and creates the proper collection - returns a promise */\n creationFn : function(){ throw new TypeError( 'no creation fn for creator' ); },\n /** fn to call when the collection is created (scoped to this) */\n oncreate : function(){},\n /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n oncancel : function(){},\n /** distance from list edge to begin autoscrolling list */\n autoscrollDist : 24,\n /** Color passed to hoverhighlight */\n highlightClr : 'rgba( 64, 255, 255, 1.0 )'\n },\n\n footerSettings : {\n '.hide-originals': 'hideOriginals'\n },\n\n /** set up initial options, instance vars, behaviors */\n initialize : function( attributes ){\n this.metric( 'ListCollectionCreator.initialize', attributes );\n var creator = this;\n _.each( this.defaultAttributes, function( value, key ){\n value = attributes[ key ] || value;\n creator[ key ] = value;\n });\n\n /** unordered, original list - cache to allow reversal */\n creator.initialElements = attributes.elements || [];\n\n this._setUpCommonSettings( attributes );\n this._instanceSetUp();\n this._elementsSetUp();\n this._setUpBehaviors();\n },\n\n /** set up instance vars */\n _instanceSetUp : function(){\n /** Ids of elements that have been selected by the user - to preserve over renders */\n this.selectedIds = {};\n /** DOM elements currently being dragged */\n this.$dragging = null;\n /** Used for blocking UI events during ajax/operations (don't post twice) */\n this.blocking = false;\n },\n\n // ------------------------------------------------------------------------ process raw list\n /** set up main data */\n _elementsSetUp : function(){\n //this.debug( '-- _dataSetUp' );\n /** a list of invalid elements and the reasons they aren't valid */\n this.invalidElements = [];\n//TODO: handle fundamental problem of syncing DOM, views, and list here\n /** data for list in progress */\n this.workingElements = [];\n /** views for workingElements */\n this.elementViews = [];\n\n // copy initial list, sort, add ids if needed\n this.workingElements = this.initialElements.slice( 0 );\n this._ensureElementIds();\n this._validateElements();\n this._mangleDuplicateNames();\n this._sortElements();\n },\n\n /** add ids to dataset objs in initial list if none */\n _ensureElementIds : function(){\n this.workingElements.forEach( function( element ){\n if( !element.hasOwnProperty( 'id' ) ){\n element.id = _.uniqueId();\n }\n });\n return this.workingElements;\n },\n\n /** separate working list into valid and invalid elements for this collection */\n _validateElements : function(){\n var creator = this,\n existingNames = {};\n creator.invalidElements = [];\n\n this.workingElements = this.workingElements.filter( function( element ){\n var problem = creator._isElementInvalid( element );\n if( problem ){\n creator.invalidElements.push({\n element : element,\n text : problem\n });\n }\n return !problem;\n });\n return this.workingElements;\n },\n\n /** describe what is wrong with a particular element if anything */\n _isElementInvalid : function( element ){\n if( element.history_content_type !== 'dataset' ){\n return _l( \"is not a dataset\" );\n }\n var validState = element.state === STATES.OK || _.contains( STATES.NOT_READY_STATES, element.state );\n if( ! validState ){\n return _l( \"has errored, is paused, or is not accessible\" );\n }\n if( element.deleted || element.purged ){\n return _l( \"has been deleted or purged\" );\n }\n return null;\n },\n\n /** mangle duplicate names using a mac-like '(counter)' addition to any duplicates */\n _mangleDuplicateNames : function(){\n var SAFETY = 900,\n counter = 1,\n existingNames = {};\n this.workingElements.forEach( function( element ){\n var currName = element.name;\n while( existingNames.hasOwnProperty( currName ) ){\n currName = element.name + ' (' + counter + ')';\n counter += 1;\n if( counter >= SAFETY ){\n throw new Error( 'Safety hit in while loop - thats impressive' );\n }\n }\n element.name = currName;\n existingNames[ element.name ] = true;\n });\n },\n\n /** sort a list of elements */\n _sortElements : function( list ){\n // // currently only natural sort by name\n // this.workingElements.sort( function( a, b ){ return naturalSort( a.name, b.name ); });\n // return this.workingElements;\n },\n\n // ------------------------------------------------------------------------ rendering\n // templates : ListCollectionCreator.templates,\n /** render the entire interface */\n render : function( speed, callback ){\n //this.debug( '-- _render' );\n if( this.workingElements.length < this.minElements ){\n return this._renderInvalid( speed, callback );\n }\n\n this.$el.empty().html( this.templates.main() );\n this._renderHeader( speed );\n this._renderMiddle( speed );\n this._renderFooter( speed );\n this._addPluginComponents();\n this.$( '.collection-name' ).focus();\n this.trigger( 'rendered', this );\n return this;\n },\n\n\n /** render a simplified interface aimed at telling the user why they can't move forward */\n _renderInvalid : function( speed, callback ){\n //this.debug( '-- _render' );\n this.$el.empty().html( this.templates.invalidInitial({\n problems: this.invalidElements,\n elements: this.workingElements,\n }));\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n this.trigger( 'rendered', this );\n return this;\n },\n\n /** render the header section */\n _renderHeader : function( speed, callback ){\n var $header = this.$( '.header' ).empty().html( this.templates.header() )\n .find( '.help-content' ).prepend( $( this.templates.helpContent() ) );\n //TODO: should only show once despite calling _renderHeader again\n if( this.invalidElements.length ){\n this._invalidElementsAlert();\n }\n return $header;\n },\n\n /** render the middle including the elements */\n _renderMiddle : function( speed, callback ){\n var $middle = this.$( '.middle' ).empty().html( this.templates.middle() );\n this._renderList( speed );\n return $middle;\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents : function(){\n this.$( '.help-content i' ).hoverhighlight( '.collection-creator', this.highlightClr );\n },\n\n /** build and show an alert describing any elements that could not be included due to problems */\n _invalidElementsAlert : function(){\n this._showAlert( this.templates.invalidElements({ problems: this.invalidElements }), 'alert-warning' );\n },\n\n _disableNameAndCreate : function( disable ){\n disable = !_.isUndefined( disable )? disable : true;\n if( disable ){\n this.$( '.collection-name' ).prop( 'disabled', true );\n this.$( '.create-collection' ).toggleClass( 'disabled', true );\n // } else {\n // this.$( '.collection-name' ).prop( 'disabled', false );\n // this.$( '.create-collection' ).removeClass( 'disable' );\n }\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** conv. to the main list display DOM */\n $list : function(){\n return this.$( '.collection-elements' );\n },\n\n /** show or hide the clear selected control based on the num of selected elements */\n _renderClearSelected : function(){\n if( _.size( this.selectedIds ) ){\n this.$( '.collection-elements-controls > .clear-selected' ).show();\n } else {\n this.$( '.collection-elements-controls > .clear-selected' ).hide();\n }\n },\n\n /** render the elements in order (or a warning if no elements found) */\n _renderList : function( speed, callback ){\n //this.debug( '-- _renderList' );\n var creator = this,\n $tmp = jQuery( '
                                  ' ),\n $list = creator.$list();\n\n _.each( this.elementViews, function( view ){\n view.destroy();\n creator.removeElementView( view );\n });\n\n // if( !this.workingElements.length ){\n // this._renderNoValidElements();\n // return;\n // }\n\n creator.workingElements.forEach( function( element ){\n var elementView = creator._createElementView( element );\n $tmp.append( elementView.$el );\n });\n\n creator._renderClearSelected();\n $list.empty().append( $tmp.children() );\n _.invoke( creator.elementViews, 'render' );\n\n if( $list.height() > $list.css( 'max-height' ) ){\n $list.css( 'border-width', '1px 0px 1px 0px' );\n } else {\n $list.css( 'border-width', '0px' );\n }\n },\n\n /** create an element view, cache in elementViews, set up listeners, and return */\n _createElementView : function( element ){\n var elementView = new this.elementViewClass({\n//TODO: use non-generic class or not all\n // model : COLLECTION.DatasetDCE( element )\n element : element,\n selected: _.has( this.selectedIds, element.id )\n });\n this.elementViews.push( elementView );\n this._listenToElementView( elementView );\n return elementView;\n },\n\n /** listen to any element events */\n _listenToElementView : function( view ){\n var creator = this;\n creator.listenTo( view, {\n select : function( data ){\n var element = data.source.element;\n if( data.selected ){\n creator.selectedIds[ element.id ] = true;\n } else {\n delete creator.selectedIds[ element.id ];\n }\n creator.trigger( 'elements:select', data );\n },\n discard : function( data ){\n creator.trigger( 'elements:discard', data );\n }\n });\n },\n\n /** add a new element view based on the json in element */\n addElementView : function( element ){\n//TODO: workingElements is sorted, add element in appropo index\n // add element, sort elements, find element index\n // var view = this._createElementView( element );\n // return view;\n },\n\n /** stop listening to view and remove from caches */\n removeElementView : function( view ){\n delete this.selectedIds[ view.element.id ];\n this._renderClearSelected();\n\n this.elementViews = _.without( this.elementViews, view );\n this.stopListening( view );\n },\n\n /** render a message in the list that no elements remain to create a collection */\n _renderNoElementsLeft : function(){\n this._disableNameAndCreate( true );\n this.$( '.collection-elements' ).append( this.templates.noElementsLeft() );\n },\n\n // /** render a message in the list that no valid elements were found to create a collection */\n // _renderNoValidElements : function(){\n // this._disableNameAndCreate( true );\n // this.$( '.collection-elements' ).append( this.templates.noValidElements() );\n // },\n\n // ------------------------------------------------------------------------ API\n /** convert element into JSON compatible with the collections API */\n _elementToJSON : function( element ){\n // return element.toJSON();\n return element;\n },\n\n /** create the collection via the API\n * @returns {jQuery.xhr Object} the jquery ajax request\n */\n createList : function( name ){\n if( !this.workingElements.length ){\n var message = _l( 'No valid elements for final list' ) + '. ';\n message += '' + _l( 'Cancel' ) + ' ';\n message += _l( 'or' );\n message += ' ' + _l( 'start over' ) + '.';\n this._showAlert( message );\n return;\n }\n\n var creator = this,\n elements = this.workingElements.map( function( element ){\n return creator._elementToJSON( element );\n });\n\n creator.blocking = true;\n return creator.creationFn( elements, name, creator.hideOriginals )\n .always( function(){\n creator.blocking = false;\n })\n .fail( function( xhr, status, message ){\n creator.trigger( 'error', {\n xhr : xhr,\n status : status,\n message : _l( 'An error occurred while creating this collection' )\n });\n })\n .done( function( response, message, xhr ){\n creator.trigger( 'collection:created', response, message, xhr );\n creator.metric( 'collection:created', response );\n if( typeof creator.oncreate === 'function' ){\n creator.oncreate.call( this, response, message, xhr );\n }\n });\n },\n\n // ------------------------------------------------------------------------ events\n /** set up event handlers on self */\n _setUpBehaviors : function(){\n this.on( 'error', this._errorHandler );\n\n this.once( 'rendered', function(){\n this.trigger( 'rendered:initial', this );\n });\n\n this.on( 'elements:select', function( data ){\n this._renderClearSelected();\n });\n\n this.on( 'elements:discard', function( data ){\n var element = data.source.element;\n this.removeElementView( data.source );\n\n this.workingElements = _.without( this.workingElements, element );\n if( !this.workingElements.length ){\n this._renderNoElementsLeft();\n }\n });\n\n //this.on( 'all', function(){\n // this.info( arguments );\n //});\n return this;\n },\n\n /** handle errors with feedback and details to the user (if available) */\n _errorHandler : function( data ){\n this.error( data );\n\n var creator = this,\n content = data.message || _l( 'An error occurred' );\n if( data.xhr ){\n var xhr = data.xhr,\n message = data.message;\n if( xhr.readyState === 0 && xhr.status === 0 ){\n content += ': ' + _l( 'Galaxy could not be reached and may be updating.' ) +\n _l( ' Try again in a few minutes.' );\n } else if( xhr.responseJSON ){\n content += ':
                                  ' + JSON.stringify( xhr.responseJSON ) + '
                                  ';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n events : {\n // header\n 'click .more-help' : '_clickMoreHelp',\n 'click .less-help' : '_clickLessHelp',\n 'click .main-help' : '_toggleHelp',\n 'click .header .alert button' : '_hideAlert',\n\n 'click .reset' : 'reset',\n 'click .clear-selected' : 'clearSelectedElements',\n\n // elements - selection\n 'click .collection-elements' : 'clearSelectedElements',\n\n // elements - drop target\n // 'dragenter .collection-elements': '_dragenterElements',\n // 'dragleave .collection-elements': '_dragleaveElements',\n 'dragover .collection-elements' : '_dragoverElements',\n 'drop .collection-elements' : '_dropElements',\n\n // these bubble up from the elements as custom events\n 'collection-element.dragstart .collection-elements' : '_elementDragstart',\n 'collection-element.dragend .collection-elements' : '_elementDragend',\n\n // footer\n 'change .collection-name' : '_changeName',\n 'keydown .collection-name' : '_nameCheckForEnter',\n 'change .hide-originals' : '_changeHideOriginals',\n 'click .cancel-create' : '_cancelCreate',\n 'click .create-collection' : '_clickCreate'//,\n },\n\n // ........................................................................ elements\n /** reset all data to the initial state */\n reset : function(){\n this._instanceSetUp();\n this._elementsSetUp();\n this.render();\n },\n\n /** deselect all elements */\n clearSelectedElements : function( ev ){\n this.$( '.collection-elements .collection-element' ).removeClass( 'selected' );\n this.$( '.collection-elements-controls > .clear-selected' ).hide();\n },\n\n //_dragenterElements : function( ev ){\n // //this.debug( '_dragenterElements:', ev );\n //},\n//TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n // _dragleaveElements : function( ev ){\n // //this.debug( '_dragleaveElements:', ev );\n // },\n\n /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n _dragoverElements : function( ev ){\n //this.debug( '_dragoverElements:', ev );\n ev.preventDefault();\n\n var $list = this.$list();\n this._checkForAutoscroll( $list, ev.originalEvent.clientY );\n var $nearest = this._getNearestElement( ev.originalEvent.clientY );\n\n //TODO: no need to re-create - move instead\n this.$( '.element-drop-placeholder' ).remove();\n var $placeholder = $( '
                                  ' );\n if( !$nearest.length ){\n $list.append( $placeholder );\n } else {\n $nearest.before( $placeholder );\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll : function( $element, y ){\n var AUTOSCROLL_SPEED = 2,\n offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = ( offset.top + $element.outerHeight() ) - y;\n if( upperDist >= 0 && upperDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop - AUTOSCROLL_SPEED );\n } else if( lowerDist >= 0 && lowerDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop + AUTOSCROLL_SPEED );\n }\n },\n\n /** get the nearest element based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestElement : function( y ){\n var WIGGLE = 4,\n lis = this.$( '.collection-elements li.collection-element' ).toArray();\n for( var i=0; i y && top - halfHeight < y ){\n return $li;\n }\n }\n return $();\n },\n\n /** drop (dragged/selected elements) onto the list, re-ordering the internal list */\n _dropElements : function( ev ){\n if( ev.originalEvent ){ ev = ev.originalEvent; }\n // both required for firefox\n ev.preventDefault();\n ev.dataTransfer.dropEffect = 'move';\n\n // insert before the nearest element or after the last.\n var $nearest = this._getNearestElement( ev.clientY );\n if( $nearest.length ){\n this.$dragging.insertBefore( $nearest );\n } else {\n // no nearest before - insert after last element\n this.$dragging.insertAfter( this.$( '.collection-elements .collection-element' ).last() );\n }\n // resync the creator's list based on the new DOM order\n this._syncOrderToDom();\n return false;\n },\n\n /** resync the creator's list of elements based on the DOM order */\n _syncOrderToDom : function(){\n var creator = this,\n newElements = [];\n //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n this.$( '.collection-elements .collection-element' ).each( function(){\n var id = $( this ).attr( 'data-element-id' ),\n element = _.findWhere( creator.workingElements, { id: id });\n if( element ){\n newElements.push( element );\n } else {\n console.error( 'missing element: ', id );\n }\n });\n this.workingElements = newElements;\n this._renderList();\n },\n\n /** drag communication with element sub-views: dragstart */\n _elementDragstart : function( ev, element ){\n // auto select the element causing the event and move all selected\n element.select( true );\n this.$dragging = this.$( '.collection-elements .collection-element.selected' );\n },\n\n /** drag communication with element sub-views: dragend - remove the placeholder */\n _elementDragend : function( ev, element ){\n $( '.element-drop-placeholder' ).remove();\n this.$dragging = null;\n },\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates : _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\n /** the header (not including help text) */\n header : _.template([\n '
                                  ',\n '', _l( 'More help' ), '',\n '
                                  ',\n '', _l( 'Less' ), '',\n '
                                  ',\n '
                                  ',\n '
                                  ',\n '',\n '',\n '
                                  ',\n ].join('')),\n\n /** the middle: element list */\n middle : _.template([\n '',\n '
                                  ',\n '
                                  '\n ].join('')),\n\n /** creation and cancel controls */\n footer : _.template([\n '
                                  ',\n '
                                  ',\n '',\n '
                                  ',\n '
                                  ',\n '',\n '
                                  ', _l( 'Name' ), ':
                                  ',\n '
                                  ',\n '
                                  ',\n\n '
                                  ',\n '
                                  ',\n '',\n '
                                  ',\n '',\n '',\n '
                                  ',\n '
                                  ',\n\n '
                                  ',\n '',\n '
                                  ',\n '
                                  '\n ].join('')),\n\n /** help content */\n helpContent : _.template([\n '

                                  ', _l([\n 'Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ',\n 'workflows in order to have analyses done on each member of the entire group. This interface allows ',\n 'you to create a collection and re-order the final collection.'\n ].join( '' )), '

                                  ',\n '
                                    ',\n '
                                  • ', _l([\n 'Rename elements in the list by clicking on ',\n 'the existing name.'\n ].join( '' )), '
                                  • ',\n '
                                  • ', _l([\n 'Discard elements from the final created list by clicking on the ',\n '\"Discard\" button.'\n ].join( '' )), '
                                  • ',\n '
                                  • ', _l([\n 'Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ',\n 'them and you can then move those selected by dragging the ',\n 'entire group. Deselect them by clicking them again or by clicking the ',\n 'the \"Clear selected\" link.'\n ].join( '' )), '
                                  • ',\n '
                                  • ', _l([\n 'Click the \"Start over\" link to begin again as if you had just opened ',\n 'the interface.'\n ].join( '' )), '
                                  • ',\n '
                                  • ', _l([\n 'Click the \"Cancel\" button to exit the interface.'\n ].join( '' )), '
                                  • ',\n '

                                  ',\n '

                                  ', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '

                                  '\n ].join('')),\n\n /** shown in list when all elements are discarded */\n invalidElements : _.template([\n _l( 'The following selections could not be included due to problems:' ),\n '
                                    <% _.each( problems, function( problem ){ %>',\n '
                                  • <%- problem.element.name %>: <%- problem.text %>
                                  • ',\n '<% }); %>
                                  '\n ].join('')),\n\n /** shown in list when all elements are discarded */\n noElementsLeft : _.template([\n '
                                2. ',\n _l( 'No elements left! ' ),\n _l( 'Would you like to ' ), '', _l( 'start over' ), '?',\n '
                                3. '\n ].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial : _.template([\n '
                                  ',\n '
                                  ',\n '',\n '<% if( _.size( problems ) ){ %>',\n _l( 'The following selections could not be included due to problems' ), ':',\n '
                                    <% _.each( problems, function( problem ){ %>',\n '
                                  • <%- problem.element.name %>: <%- problem.text %>
                                  • ',\n '<% }); %>
                                  ',\n '<% } else if( _.size( elements ) < 1 ){ %>',\n _l( 'No datasets were selected' ), '.',\n '<% } %>',\n '
                                  ',\n _l( 'At least one element is needed for the collection' ), '. ',\n _l( 'You may need to ' ),\n '', _l( 'cancel' ), ' ',\n _l( 'and reselect new elements' ), '.',\n '
                                  ',\n '
                                  ',\n '
                                  ',\n '
                                  ',\n '
                                  ',\n '
                                  ',\n '',\n // _l( 'Create a different kind of collection' ),\n '
                                  ',\n '
                                  ',\n '
                                  '\n ].join('')),\n }),\n\n // ------------------------------------------------------------------------ misc\n /** string rep */\n toString : function(){ return 'ListCollectionCreator'; }\n});\n\n\n\n//=============================================================================\n/** Create a modal and load its body with the given CreatorClass creator type\n * @returns {Deferred} resolved when creator has built a collection.\n */\nvar collectionCreatorModal = function _collectionCreatorModal( elements, options, CreatorClass ){\n\n var deferred = jQuery.Deferred(),\n modal = Galaxy.modal || ( new UI_MODAL.View() ),\n creator;\n\n options = _.defaults( options || {}, {\n elements : elements,\n oncancel : function(){\n modal.hide();\n deferred.reject( 'cancelled' );\n },\n oncreate : function( creator, response ){\n modal.hide();\n deferred.resolve( response );\n }\n });\n\n creator = new CreatorClass( options );\n modal.show({\n title : options.title || _l( 'Create a collection' ),\n body : creator.$el,\n width : '80%',\n height : '100%',\n closing_events: true\n });\n creator.render();\n window._collectionCreator = creator;\n\n //TODO: remove modal header\n return deferred;\n};\n\n/** List collection flavor of collectionCreatorModal. */\nvar listCollectionCreatorModal = function _listCollectionCreatorModal( elements, options ){\n options = options || {};\n options.title = _l( 'Create a collection from a list of datasets' );\n return collectionCreatorModal( elements, options, ListCollectionCreator );\n};\n\n\n//==============================================================================\n/** Use a modal to create a list collection, then add it to the given history contents.\n * @returns {Deferred} resolved when the collection is added to the history.\n */\nfunction createListCollection( contents, defaultHideSourceItems ){\n var elements = contents.toJSON(),\n promise = listCollectionCreatorModal( elements, {\n defaultHideSourceItems: defaultHideSourceItems,\n creationFn : function( elements, name, hideSourceItems ){\n elements = elements.map( function( element ){\n return {\n id : element.id,\n name : element.name,\n //TODO: this allows for list:list even if the filter above does not - reconcile\n src : ( element.history_content_type === 'dataset'? 'hda' : 'hdca' )\n };\n });\n return contents.createHDCA( elements, 'list', name, hideSourceItems );\n }\n });\n return promise;\n}\n\n//==============================================================================\n return {\n DatasetCollectionElementView: DatasetCollectionElementView,\n ListCollectionCreator : ListCollectionCreator,\n\n collectionCreatorModal : collectionCreatorModal,\n listCollectionCreatorModal : listCollectionCreatorModal,\n createListCollection : createListCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/list-collection-creator.js","define([\n \"mvc/list/list-item\",\n \"mvc/dataset/states\",\n \"ui/fa-icon-button\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_ITEM, STATES, faIconButton, BASE_MVC, _l ){\n'use strict';\n\nvar logNamespace = 'dataset';\n/*==============================================================================\nTODO:\n straighten out state rendering and templates used\n inaccessible/STATES.NOT_VIEWABLE is a special case\n simplify button rendering\n\n==============================================================================*/\nvar _super = LIST_ITEM.ListItemView;\n/** @class Read only list view for either LDDAs, HDAs, or HDADCEs.\n * Roughly, any DatasetInstance (and not a raw Dataset).\n */\nvar DatasetListItemView = _super.extend(\n/** @lends DatasetListItemView.prototype */{\n _logNamespace : logNamespace,\n\n className : _super.prototype.className + \" dataset\",\n //TODO:?? doesn't exactly match an hda's type_id\n id : function(){\n return [ 'dataset', this.model.get( 'id' ) ].join( '-' );\n },\n\n /** Set up: instance vars, options, and event handlers */\n initialize : function( attributes ){\n if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }\n this.log( this + '.initialize:', attributes );\n _super.prototype.initialize.call( this, attributes );\n\n /** where should pages from links be displayed? (default to new tab/window) */\n this.linkTarget = attributes.linkTarget || '_blank';\n },\n\n /** event listeners */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n var self = this;\n\n // re-rendering on any model changes\n return self.listenTo( self.model, {\n 'change': function( model ){\n // if the model moved into the ready state and is expanded without details, fetch those details now\n if( self.model.changedAttributes().state &&\n self.model.inReadyState() &&\n self.expanded &&\n !self.model.hasDetails() ){\n // normally, will render automatically (due to fetch -> change),\n // but! setting_metadata sometimes doesn't cause any other changes besides state\n // so, not rendering causes it to seem frozen in setting_metadata state\n self.model.fetch({ silent : true })\n .done( function(){ self.render(); });\n } else {\n if( _.has( model.changed, 'tags' ) && _.keys( model.changed ).length === 1 ){\n // If only the tags have changed, rerender specifically\n // the titlebar region. Otherwise default to the full\n // render.\n self.$( '.nametags' ).html( self._renderNametags() );\n } else {\n self.render();\n }\n }\n }\n });\n },\n\n // ......................................................................... expandable\n /** In this override, only get details if in the ready state, get rerunnable if in other states.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n }\n return jQuery.when();\n },\n\n // ......................................................................... removal\n /** Remove this view's html from the DOM and remove all event listeners.\n * @param {Number or String} speed jq effect speed\n * @param {Function} callback an optional function called when removal is done (scoped to this view)\n */\n remove : function( speed, callback ){\n var view = this;\n speed = speed || this.fxSpeed;\n this.$el.fadeOut( speed, function(){\n Backbone.View.prototype.remove.call( view );\n if( callback ){ callback.call( view ); }\n });\n },\n\n // ......................................................................... rendering\n /* TODO:\n dataset states are the issue primarily making dataset rendering complex\n each state should have it's own way of displaying/set of details\n often with different actions that can be applied\n throw in deleted/purged/visible and things get complicated easily\n I've considered (a couple of times) - creating a view for each state\n - but recreating the view during an update...seems wrong\n */\n /** In this override, add the dataset state as a class for use with state-based CSS */\n _swapNewRender : function( $newRender ){\n _super.prototype._swapNewRender.call( this, $newRender );\n if( this.model.has( 'state' ) ){\n this.$el.addClass( 'state-' + this.model.get( 'state' ) );\n }\n return this.$el;\n },\n\n // ................................................................................ titlebar\n /** In this override, add the dataset display button. */\n _renderPrimaryActions : function(){\n // render just the display for read-only\n return [ this._renderDisplayButton() ];\n },\n\n /** Render icon-button to display dataset data */\n _renderDisplayButton : function(){\n // don't show display if not viewable or not accessible\n var state = this.model.get( 'state' );\n if( ( state === STATES.NOT_VIEWABLE ) ||\n ( state === STATES.DISCARDED ) ||\n ( !this.model.get( 'accessible' ) ) ){\n return null;\n }\n\n var displayBtnData = {\n target : this.linkTarget,\n classes : 'display-btn'\n };\n\n // show a disabled display if the data's been purged\n if( this.model.get( 'purged' ) ){\n displayBtnData.disabled = true;\n displayBtnData.title = _l( 'Cannot display datasets removed from disk' );\n\n // disable if still uploading\n } else if( state === STATES.UPLOAD ){\n displayBtnData.disabled = true;\n displayBtnData.title = _l( 'This dataset must finish uploading before it can be viewed' );\n\n // disable if still new\n } else if( state === STATES.NEW ){\n displayBtnData.disabled = true;\n displayBtnData.title = _l( 'This dataset is not yet viewable' );\n\n } else {\n displayBtnData.title = _l( 'View data' );\n\n // default link for dataset\n displayBtnData.href = this.model.urls.display;\n\n // add frame manager option onclick event\n var self = this;\n displayBtnData.onclick = function( ev ){\n if (Galaxy.frame && Galaxy.frame.active) {\n // Add dataset to frames.\n Galaxy.frame.addDataset(self.model.get('id'));\n ev.preventDefault();\n }\n };\n }\n displayBtnData.faIcon = 'fa-eye';\n return faIconButton( displayBtnData );\n },\n\n // ......................................................................... rendering details\n /** Render the enclosing div of the hda body and, if expanded, the html in the body\n * @returns {jQuery} rendered DOM\n */\n _renderDetails : function(){\n //TODO: generalize to be allow different details for each state\n\n // no access - render nothing but a message\n if( this.model.get( 'state' ) === STATES.NOT_VIEWABLE ){\n return $( this.templates.noAccess( this.model.toJSON(), this ) );\n }\n\n var $details = _super.prototype._renderDetails.call( this );\n $details.find( '.actions .left' ).empty().append( this._renderSecondaryActions() );\n $details.find( '.summary' ).html( this._renderSummary() )\n .prepend( this._renderDetailMessages() );\n $details.find( '.display-applications' ).html( this._renderDisplayApplications() );\n\n this._setUpBehaviors( $details );\n return $details;\n },\n\n /** Defer to the appropo summary rendering fn based on state */\n _renderSummary : function(){\n var json = this.model.toJSON(),\n summaryRenderFn = this.templates.summaries[ json.state ];\n summaryRenderFn = summaryRenderFn || this.templates.summaries.unknown;\n return summaryRenderFn( json, this );\n },\n\n /** Render messages to be displayed only when the details are shown */\n _renderDetailMessages : function(){\n var view = this,\n $warnings = $( '
                                  ' ),\n json = view.model.toJSON();\n //TODO:! unordered (map)\n _.each( view.templates.detailMessages, function( templateFn ){\n $warnings.append( $( templateFn( json, view ) ) );\n });\n return $warnings;\n },\n\n /** Render the external display application links */\n _renderDisplayApplications : function(){\n if( this.model.isDeletedOrPurged() ){ return ''; }\n // render both old and new display apps using the same template\n return [\n this.templates.displayApplications( this.model.get( 'display_apps' ), this ),\n this.templates.displayApplications( this.model.get( 'display_types' ), this )\n ].join( '' );\n },\n\n // ......................................................................... secondary/details actions\n /** A series of links/buttons for less commonly used actions: re-run, info, etc. */\n _renderSecondaryActions : function(){\n this.debug( '_renderSecondaryActions' );\n switch( this.model.get( 'state' ) ){\n case STATES.NOT_VIEWABLE:\n return [];\n case STATES.OK:\n case STATES.FAILED_METADATA:\n case STATES.ERROR:\n return [ this._renderDownloadButton(), this._renderShowParamsButton() ];\n }\n return [ this._renderShowParamsButton() ];\n },\n\n /** Render icon-button to show the input and output (stdout/err) for the job that created this.\n * @returns {jQuery} rendered DOM\n */\n _renderShowParamsButton : function(){\n // gen. safe to show in all cases\n return faIconButton({\n title : _l( 'View details' ),\n classes : 'params-btn',\n href : this.model.urls.show_params,\n target : this.linkTarget,\n faIcon : 'fa-info-circle',\n onclick : function( ev ) {\n if ( Galaxy.frame && Galaxy.frame.active ) {\n Galaxy.frame.add( { title: 'Dataset details', url: this.href } );\n ev.preventDefault();\n ev.stopPropagation();\n }\n }\n });\n },\n\n\n /** Render icon-button/popupmenu to download the data (and/or the associated meta files (bai, etc.)) for this.\n * @returns {jQuery} rendered DOM\n */\n _renderDownloadButton : function(){\n // don't show anything if the data's been purged\n if( this.model.get( 'purged' ) || !this.model.hasData() ){ return null; }\n\n // return either: a popupmenu with links to download assoc. meta files (if there are meta files)\n // or a single download icon-button (if there are no meta files)\n if( !_.isEmpty( this.model.get( 'meta_files' ) ) ){\n return this._renderMetaFileDownloadButton();\n }\n\n return $([\n '',\n '',\n ''\n ].join( '' ));\n },\n\n /** Render the download button which opens a dropdown with links to download assoc. meta files (indeces, etc.) */\n _renderMetaFileDownloadButton : function(){\n var urls = this.model.urls;\n return $([\n '
                                  ',\n '',\n '',\n '',\n '',\n '
                                  '\n ].join( '\\n' ));\n },\n\n _renderNametags : function(){\n var tpl = _.template([\n '<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>',\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n '<% } %>',\n '<% }); %>'].join(''));\n return tpl({tags: this.model.get('tags')});\n },\n\n // ......................................................................... misc\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .display-btn' : function( ev ){ this.trigger( 'display', this, ev ); },\n 'click .params-btn' : function( ev ){ this.trigger( 'params', this, ev ); },\n 'click .download-btn' : function( ev ){ this.trigger( 'download', this, ev ); }\n }),\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DatasetListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetListItemView.prototype.templates = (function(){\n//TODO: move to require text! plugin\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n failed_metadata : BASE_MVC.wrapTemplate([\n // failed metadata is rendered as a warning on an otherwise ok dataset view\n '<% if( model.state === \"failed_metadata\" ){ %>',\n '
                                  ',\n _l( 'An error occurred setting the metadata for this dataset' ),\n '
                                  ',\n '<% } %>'\n ]),\n error : BASE_MVC.wrapTemplate([\n // error during index fetch - show error on dataset\n '<% if( model.error ){ %>',\n '
                                  ',\n _l( 'There was an error getting the data for this dataset' ), ': <%- model.error %>',\n '
                                  ',\n '<% } %>'\n ]),\n purged : BASE_MVC.wrapTemplate([\n '<% if( model.purged ){ %>',\n '
                                  ',\n _l( 'This dataset has been deleted and removed from disk' ),\n '
                                  ',\n '<% } %>'\n ]),\n deleted : BASE_MVC.wrapTemplate([\n // deleted not purged\n '<% if( model.deleted && !model.purged ){ %>',\n '
                                  ',\n _l( 'This dataset has been deleted' ),\n '
                                  ',\n '<% } %>'\n ])\n\n //NOTE: hidden warning is only needed for HDAs\n });\n\n var detailsTemplate = BASE_MVC.wrapTemplate([\n '
                                  ',\n '
                                  ',\n\n '
                                  ',\n '
                                  ',\n '
                                  ',\n '
                                  ',\n\n // do not display tags, annotation, display apps, or peek when deleted\n '<% if( !dataset.deleted && !dataset.purged ){ %>',\n '
                                  ',\n '
                                  ',\n\n '
                                  ',\n\n '<% if( dataset.peek ){ %>',\n '
                                  <%= dataset.peek %>
                                  ',\n '<% } %>',\n '<% } %>',\n '
                                  '\n ], 'dataset' );\n\n var noAccessTemplate = BASE_MVC.wrapTemplate([\n '
                                  ',\n '
                                  ',\n _l( 'You do not have permission to view this dataset' ),\n '
                                  ',\n '
                                  '\n ], 'dataset' );\n\n//TODO: still toooooooooooooo complex - rework\n var summaryTemplates = {};\n summaryTemplates[ STATES.OK ] = summaryTemplates[ STATES.FAILED_METADATA ] = BASE_MVC.wrapTemplate([\n '<% if( dataset.misc_blurb ){ %>',\n '
                                  ',\n '<%- dataset.misc_blurb %>',\n '
                                  ',\n '<% } %>',\n\n '<% if( dataset.file_ext ){ %>',\n '
                                  ',\n '',\n '<%- dataset.file_ext %>',\n '
                                  ',\n '<% } %>',\n\n '<% if( dataset.metadata_dbkey ){ %>',\n '
                                  ',\n '',\n '',\n '<%- dataset.metadata_dbkey %>',\n '',\n '
                                  ',\n '<% } %>',\n\n '<% if( dataset.misc_info ){ %>',\n '
                                  ',\n '<%- dataset.misc_info %>',\n '
                                  ',\n '<% } %>'\n ], 'dataset' );\n summaryTemplates[ STATES.NEW ] = BASE_MVC.wrapTemplate([\n '
                                  ', _l( 'This is a new dataset and not all of its data are available yet' ), '
                                  '\n ], 'dataset' );\n summaryTemplates[ STATES.NOT_VIEWABLE ] = BASE_MVC.wrapTemplate([\n '
                                  ', _l( 'You do not have permission to view this dataset' ), '
                                  '\n ], 'dataset' );\n summaryTemplates[ STATES.DISCARDED ] = BASE_MVC.wrapTemplate([\n '
                                  ', _l( 'The job creating this dataset was cancelled before completion' ), '
                                  '\n ], 'dataset' );\n summaryTemplates[ STATES.QUEUED ] = BASE_MVC.wrapTemplate([\n '
                                  ', _l( 'This job is waiting to run' ), '
                                  '\n ], 'dataset' );\n summaryTemplates[ STATES.RUNNING ] = BASE_MVC.wrapTemplate([\n '
                                  ', _l( 'This job is currently running' ), '
                                  '\n ], 'dataset' );\n summaryTemplates[ STATES.UPLOAD ] = BASE_MVC.wrapTemplate([\n '
                                  ', _l( 'This dataset is currently uploading' ), '
                                  '\n ], 'dataset' );\n summaryTemplates[ STATES.SETTING_METADATA ] = BASE_MVC.wrapTemplate([\n '
                                  ', _l( 'Metadata is being auto-detected' ), '
                                  '\n ], 'dataset' );\n summaryTemplates[ STATES.PAUSED ] = BASE_MVC.wrapTemplate([\n '
                                  ', _l( 'This job is paused. Use the \"Resume Paused Jobs\" in the history menu to resume' ), '
                                  '\n ], 'dataset' );\n summaryTemplates[ STATES.ERROR ] = BASE_MVC.wrapTemplate([\n '<% if( !dataset.purged ){ %>',\n '
                                  <%- dataset.misc_blurb %>
                                  ',\n '<% } %>',\n '', _l( 'An error occurred with this dataset' ), ':',\n '
                                  <%- dataset.misc_info %>
                                  '\n ], 'dataset' );\n summaryTemplates[ STATES.EMPTY ] = BASE_MVC.wrapTemplate([\n '
                                  ', _l( 'No data' ), ': <%- dataset.misc_blurb %>
                                  '\n ], 'dataset' );\n summaryTemplates.unknown = BASE_MVC.wrapTemplate([\n '
                                  Error: unknown dataset state: \"<%- dataset.state %>\"
                                  '\n ], 'dataset' );\n\n // messages to be displayed only within the details section ('below the fold')\n var detailMessageTemplates = {\n resubmitted : BASE_MVC.wrapTemplate([\n // deleted not purged\n '<% if( model.resubmitted ){ %>',\n '
                                  ',\n _l( 'The job creating this dataset has been resubmitted' ),\n '
                                  ',\n '<% } %>'\n ])\n };\n\n // this is applied to both old and new style display apps\n var displayApplicationsTemplate = BASE_MVC.wrapTemplate([\n '<% _.each( apps, function( app ){ %>',\n '
                                  ',\n '<%- app.label %> ',\n '',\n '<% _.each( app.links, function( link ){ %>',\n '\" href=\"<%- link.href %>\">',\n '<% print( _l( link.text ) ); %>',\n ' ',\n '<% }); %>',\n '',\n '
                                  ',\n '<% }); %>'\n ], 'apps' );\n\n return _.extend( {}, _super.prototype.templates, {\n warnings : warnings,\n details : detailsTemplate,\n noAccess : noAccessTemplate,\n summaries : summaryTemplates,\n detailMessages : detailMessageTemplates,\n displayApplications : displayApplicationsTemplate\n });\n}());\n\n\n// ============================================================================\n return {\n DatasetListItemView : DatasetListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-li.js","/** Generic form view */\ndefine( [ 'mvc/form/form-view', 'mvc/ui/ui-misc' ], function( Form, Ui ) {\n\n var View = Backbone.View.extend({\n\n initialize: function( options ) {\n this.model = new Backbone.Model( options );\n this.url = this.model.get( 'url' );\n this.redirect = this.model.get( 'redirect' );\n this.setElement( '
                                  ' );\n this.render();\n },\n\n render: function() {\n var self = this;\n $.ajax({\n url : Galaxy.root + this.url,\n type : 'GET'\n }).done( function( response ) {\n var options = $.extend( {}, self.model.attributes, response );\n var form = new Form({\n title : options.title,\n message: options.message,\n status : options.status || 'warning',\n icon : options.icon,\n inputs : options.inputs,\n buttons: {\n 'submit': new Ui.Button({\n tooltip : options.submit_tooltip,\n title : options.submit_title || 'Save',\n icon : options.submit_icon || 'fa-save',\n cls : 'btn btn-primary ui-clear-float',\n onclick : function() { self._submit( form ) }\n })\n }\n });\n self.$el.empty().append( form.$el );\n }).fail( function( response ) {\n self.$el.empty().append( new Ui.Message({\n message : 'Failed to load resource ' + self.url + '.',\n status : 'danger',\n persistent : true\n }).$el );\n });\n },\n\n _submit: function( form ) {\n var self = this;\n $.ajax( {\n url : Galaxy.root + self.url,\n data : JSON.stringify( form.data.create() ),\n type : 'PUT',\n contentType : 'application/json'\n }).done( function( response ) {\n var success_message = { message: response.message, status: 'success', persistent: false };\n if ( self.redirect ) {\n window.location = Galaxy.root + self.redirect + '?' + $.param( success_message );\n } else {\n form.data.matchModel( response, function ( input, input_id ) {\n form.field_list[ input_id ].value( input.value );\n });\n self._showMessage( form, success_message );\n }\n }).fail( function( response ) {\n self._showMessage( form, { message: response.responseJSON.err_msg, status: 'danger', persistent: false } );\n });\n },\n\n _showMessage: function( form, options ) {\n var $panel = form.$el.parents().filter(function() {\n return [ 'auto', 'scroll' ].indexOf( $( this ).css( 'overflow' ) ) != -1;\n }).first();\n $panel.animate( { scrollTop : 0 }, 500 );\n form.message.update( options );\n }\n });\n\n return {\n View : View\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/form/form-wrapper.js","define([\n \"mvc/collection/collection-model\",\n \"mvc/history/history-content-model\",\n \"utils/localization\"\n], function( DC_MODEL, HISTORY_CONTENT, _l ){\n\n'use strict';\n\n/*==============================================================================\n\nModels for DatasetCollections contained within a history.\n\nTODO:\n these might be compactable to one class if some duplication with\n collection-model is used.\n\n==============================================================================*/\nvar hcontentMixin = HISTORY_CONTENT.HistoryContentMixin,\n ListDC = DC_MODEL.ListDatasetCollection,\n PairDC = DC_MODEL.PairDatasetCollection,\n ListPairedDC = DC_MODEL.ListPairedDatasetCollection,\n ListOfListsDC = DC_MODEL.ListOfListsDatasetCollection;\n\n//==============================================================================\n/** Override to post to contents route w/o id. */\nfunction buildHDCASave( _super ){\n return function _save( attributes, options ){\n if( this.isNew() ){\n options = options || {};\n options.url = this.urlRoot + this.get( 'history_id' ) + '/contents';\n attributes = attributes || {};\n attributes.type = 'dataset_collection';\n }\n return _super.call( this, attributes, options );\n };\n}\n\n\n//==============================================================================\n/** @class Backbone model for List Dataset Collection within a History.\n */\nvar HistoryListDatasetCollection = ListDC.extend( hcontentMixin ).extend(\n/** @lends HistoryListDatasetCollection.prototype */{\n\n defaults : _.extend( _.clone( ListDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'list',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( ListDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return 'History' + ListDC.prototype.toString.call( this );\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for Pair Dataset Collection within a History.\n * @constructs\n */\nvar HistoryPairDatasetCollection = PairDC.extend( hcontentMixin ).extend(\n/** @lends HistoryPairDatasetCollection.prototype */{\n\n defaults : _.extend( _.clone( PairDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'paired',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( PairDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return 'History' + PairDC.prototype.toString.call( this );\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for List of Pairs Dataset Collection within a History. */\nvar HistoryListPairedDatasetCollection = ListPairedDC.extend( hcontentMixin ).extend({\n\n defaults : _.extend( _.clone( ListPairedDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'list:paired',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( ListPairedDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return 'History' + ListPairedDC.prototype.toString.call( this );\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for List of Lists Dataset Collection within a History. */\nvar HistoryListOfListsDatasetCollection = ListOfListsDC.extend( hcontentMixin ).extend({\n\n defaults : _.extend( _.clone( ListOfListsDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'list:list',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( ListOfListsDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return ([ 'HistoryListOfListsDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n HistoryListDatasetCollection : HistoryListDatasetCollection,\n HistoryPairDatasetCollection : HistoryPairDatasetCollection,\n HistoryListPairedDatasetCollection : HistoryListPairedDatasetCollection,\n HistoryListOfListsDatasetCollection : HistoryListOfListsDatasetCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hdca-model.js","define([\n \"mvc/base/controlled-fetch-collection\",\n \"mvc/history/hda-model\",\n \"mvc/history/hdca-model\",\n \"mvc/history/history-preferences\",\n \"mvc/base-mvc\",\n \"utils/ajax-queue\"\n], function( CONTROLLED_FETCH_COLLECTION, HDA_MODEL, HDCA_MODEL, HISTORY_PREFS, BASE_MVC, AJAX_QUEUE ){\n'use strict';\n\n//==============================================================================\nvar _super = CONTROLLED_FETCH_COLLECTION.PaginatedCollection;\n/** @class Backbone collection for history content.\n * NOTE: history content seems like a dataset collection, but differs in that it is mixed:\n * each element can be either an HDA (dataset) or a DatasetCollection and co-exist on\n * the same level.\n * Dataset collections on the other hand are not mixed and (so far) can only contain either\n * HDAs or child dataset collections on one level.\n * This is why this does not inherit from any of the DatasetCollections (currently).\n */\nvar HistoryContents = _super.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : 'history',\n\n // ........................................................................ composite collection\n /** since history content is a mix, override model fn into a factory, creating based on history_content_type */\n model : function( attrs, options ) {\n if( attrs.history_content_type === \"dataset\" ) {\n return new HDA_MODEL.HistoryDatasetAssociation( attrs, options );\n\n } else if( attrs.history_content_type === \"dataset_collection\" ) {\n switch( attrs.collection_type ){\n case 'list':\n return new HDCA_MODEL.HistoryListDatasetCollection( attrs, options );\n case 'paired':\n return new HDCA_MODEL.HistoryPairDatasetCollection( attrs, options );\n case 'list:paired':\n return new HDCA_MODEL.HistoryListPairedDatasetCollection( attrs, options );\n case 'list:list':\n return new HDCA_MODEL.HistoryListOfListsDatasetCollection( attrs, options );\n }\n // This is a hack inside a hack:\n // Raise a plain object with validationError to fake a model.validationError\n // (since we don't have a model to use validate with)\n // (the outer hack being the mixed content/model function in this collection)\n var msg = 'Unknown collection_type: ' + attrs.collection_type;\n console.warn( msg, attrs );\n return { validationError : msg };\n }\n return { validationError : 'Unknown history_content_type: ' + attrs.history_content_type };\n },\n\n // ........................................................................ set up\n limitPerPage : 500,\n\n /** @type {Integer} how many contents per call to fetch when using progressivelyFetchDetails */\n limitPerProgressiveFetch : 500,\n\n /** @type {String} order used here and when fetching from server */\n order : 'hid',\n\n /** root api url */\n urlRoot : Galaxy.root + 'api/histories',\n\n /** complete api url */\n url : function(){\n return this.urlRoot + '/' + this.historyId + '/contents';\n },\n\n /** Set up */\n initialize : function( models, options ){\n options = options || {};\n _super.prototype.initialize.call( this, models, options );\n\n this.history = options.history || null;\n this.setHistoryId( options.historyId || null );\n /** @type {Boolean} does this collection contain and fetch deleted elements */\n this.includeDeleted = options.includeDeleted || this.includeDeleted;\n /** @type {Boolean} does this collection contain and fetch non-visible elements */\n this.includeHidden = options.includeHidden || this.includeHidden;\n\n // backbonejs uses collection.model.prototype.idAttribute to determine if a model is *already* in a collection\n // and either merged or replaced. In this case, our 'model' is a function so we need to add idAttribute\n // manually here - if we don't, contents will not merge but be replaced/swapped.\n this.model.prototype.idAttribute = 'type_id';\n },\n\n setHistoryId : function( newId ){\n this.historyId = newId;\n this._setUpWebStorage();\n },\n\n /** Set up client side storage. Currently PersistanStorage keyed under 'history:' */\n _setUpWebStorage : function( initialSettings ){\n // TODO: use initialSettings\n if( !this.historyId ){ return; }\n this.storage = new HISTORY_PREFS.HistoryPrefs({\n id: HISTORY_PREFS.HistoryPrefs.historyStorageKey( this.historyId )\n });\n this.trigger( 'new-storage', this.storage, this );\n\n this.on({\n 'include-deleted' : function( newVal ){\n this.storage.includeDeleted( newVal );\n },\n 'include-hidden' : function( newVal ){\n this.storage.includeHidden( newVal );\n }\n });\n\n this.includeDeleted = this.storage.includeDeleted() || false;\n this.includeHidden = this.storage.includeHidden() || false;\n return this;\n },\n\n // ........................................................................ common queries\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators : _.extend( _.clone( _super.prototype.comparators ), {\n 'name' : BASE_MVC.buildComparator( 'name', { ascending: true }),\n 'name-dsc' : BASE_MVC.buildComparator( 'name', { ascending: false }),\n 'hid' : BASE_MVC.buildComparator( 'hid', { ascending: false }),\n 'hid-asc' : BASE_MVC.buildComparator( 'hid', { ascending: true }),\n }),\n\n /** Get every model in this collection not in a 'ready' state (running). */\n running : function(){\n return this.filter( function( c ){ return !c.inReadyState(); });\n },\n\n /** return contents that are not ready and not deleted/hidden */\n runningAndActive : function(){\n return this.filter( function( c ){\n return ( !c.inReadyState() )\n && ( c.get( 'visible' ) )\n // TODO: deletedOrPurged?\n && ( !c.get( 'deleted' ) );\n });\n },\n\n /** Get the model with the given hid\n * @param {Int} hid the hid to search for\n * @returns {HistoryDatasetAssociation} the model with the given hid or undefined if not found\n */\n getByHid : function( hid ){\n // note: there *can* be more than one content with a given hid, this finds the first based on order\n return this.findWhere({ hid: hid });\n },\n\n /** return true if all contents have details */\n haveDetails : function(){\n return this.all( function( c ){ return c.hasDetails(); });\n },\n\n // ........................................................................ hidden / deleted\n /** return a new contents collection of only hidden items */\n hidden : function(){\n return this.filter( function( c ){ return c.hidden(); });\n },\n\n /** return a new contents collection of only hidden items */\n deleted : function(){\n return this.filter( function( c ){ return c.get( 'deleted' ); });\n },\n\n /** return a new contents collection of only hidden items */\n visibleAndUndeleted : function(){\n return this.filter( function( c ){\n return ( c.get( 'visible' ) )\n // TODO: deletedOrPurged?\n && ( !c.get( 'deleted' ) );\n });\n },\n\n /** create a setter in order to publish the change */\n setIncludeDeleted : function( setting, options ){\n if( _.isBoolean( setting ) && setting !== this.includeDeleted ){\n this.includeDeleted = setting;\n if( _.result( options, 'silent' ) ){ return; }\n this.trigger( 'include-deleted', setting, this );\n }\n },\n\n /** create a setter in order to publish the change */\n setIncludeHidden : function( setting, options ){\n if( _.isBoolean( setting ) && setting !== this.includeHidden ){\n this.includeHidden = setting;\n options = options || {};\n if( _.result( options, 'silent' ) ){ return; }\n this.trigger( 'include-hidden', setting, this );\n }\n },\n\n // ........................................................................ ajax\n // ............ controlled fetch collection\n /** override to get expanded ids from sessionStorage and pass to API as details */\n fetch : function( options ){\n options = options || {};\n if( this.historyId && !options.details ){\n var prefs = HISTORY_PREFS.HistoryPrefs.get( this.historyId ).toJSON();\n if( !_.isEmpty( prefs.expandedIds ) ){\n options.details = _.values( prefs.expandedIds ).join( ',' );\n }\n }\n return _super.prototype.fetch.call( this, options );\n },\n\n // ............. ControlledFetch stuff\n /** override to include the API versioning flag */\n _buildFetchData : function( options ){\n return _.extend( _super.prototype._buildFetchData.call( this, options ), {\n v : 'dev'\n });\n },\n\n /** Extend to include details and version */\n _fetchParams : _super.prototype._fetchParams.concat([\n // TODO: remove (the need for) both\n /** version */\n 'v',\n /** dataset ids to get full details of */\n 'details',\n ]),\n\n /** override to add deleted/hidden filters */\n _buildFetchFilters : function( options ){\n var superFilters = _super.prototype._buildFetchFilters.call( this, options ) || {};\n var filters = {};\n if( !this.includeDeleted ){\n filters.deleted = false;\n filters.purged = false;\n }\n if( !this.includeHidden ){\n filters.visible = true;\n }\n return _.defaults( superFilters, filters );\n },\n\n // ............ paginated collection\n getTotalItemCount : function(){\n return this.history.contentsShown();\n },\n\n // ............ history contents specific ajax\n /** override to filter requested contents to those updated after the Date 'since' */\n fetchUpdated : function( since, options ){\n if( since ){\n options = options || { filters: {} };\n options.remove = false;\n options.filters = {\n 'update_time-ge' : since.toISOString(),\n // workflows will produce hidden datasets (non-output datasets) that still\n // need to be updated in the collection or they'll update forever\n // we can remove the default visible filter by using an 'empty' value\n visible : ''\n };\n }\n return this.fetch( options );\n },\n\n /** fetch all the deleted==true contents of this collection */\n fetchDeleted : function( options ){\n options = options || {};\n var self = this;\n options.filters = _.extend( options.filters, {\n // all deleted, purged or not\n deleted : true,\n purged : undefined\n });\n options.remove = false;\n\n self.trigger( 'fetching-deleted', self );\n return self.fetch( options )\n .always( function(){ self.trigger( 'fetching-deleted-done', self ); });\n },\n\n /** fetch all the visible==false contents of this collection */\n fetchHidden : function( options ){\n options = options || {};\n var self = this;\n options.filters = _.extend( options.filters, {\n visible : false\n });\n options.remove = false;\n\n self.trigger( 'fetching-hidden', self );\n return self.fetch( options )\n .always( function(){ self.trigger( 'fetching-hidden-done', self ); });\n },\n\n /** fetch detailed model data for all contents in this collection */\n fetchAllDetails : function( options ){\n options = options || {};\n var detailsFlag = { details: 'all' };\n options.data = _.extend( options.data || {}, detailsFlag );\n return this.fetch( options );\n },\n\n /** specialty fetch method for retrieving the element_counts of all hdcas in the history */\n fetchCollectionCounts : function( options ){\n options = options || {};\n options.keys = [ 'type_id', 'element_count' ].join( ',' );\n options.filters = _.extend( options.filters || {}, {\n history_content_type: 'dataset_collection',\n });\n options.remove = false;\n return this.fetch( options );\n },\n\n // ............. quasi-batch ops\n // TODO: to batch\n /** helper that fetches using filterParams then calls save on each fetched using updateWhat as the save params */\n _filterAndUpdate : function( filterParams, updateWhat ){\n var self = this;\n var idAttribute = self.model.prototype.idAttribute;\n var updateArgs = [ updateWhat ];\n\n return self.fetch({ filters: filterParams, remove: false })\n .then( function( fetched ){\n // convert filtered json array to model array\n fetched = fetched.reduce( function( modelArray, currJson, i ){\n var model = self.get( currJson[ idAttribute ] );\n return model? modelArray.concat( model ) : modelArray;\n }, []);\n return self.ajaxQueue( 'save', updateArgs, fetched );\n });\n },\n\n /** using a queue, perform ajaxFn on each of the models in this collection */\n ajaxQueue : function( ajaxFn, args, collection ){\n collection = collection || this.models;\n return new AJAX_QUEUE.AjaxQueue( collection.slice().reverse().map( function( content, i ){\n var fn = _.isString( ajaxFn )? content[ ajaxFn ] : ajaxFn;\n return function(){ return fn.apply( content, args ); };\n })).deferred;\n },\n\n /** fetch contents' details in batches of limitPerCall - note: only get searchable details here */\n progressivelyFetchDetails : function( options ){\n options = options || {};\n var deferred = jQuery.Deferred();\n var self = this;\n var limit = options.limitPerCall || self.limitPerProgressiveFetch;\n // TODO: only fetch tags and annotations if specifically requested\n var searchAttributes = HDA_MODEL.HistoryDatasetAssociation.prototype.searchAttributes;\n var detailKeys = searchAttributes.join( ',' );\n\n function _recursivelyFetch( offset ){\n offset = offset || 0;\n var _options = _.extend( _.clone( options ), {\n view : 'summary',\n keys : detailKeys,\n limit : limit,\n offset : offset,\n reset : offset === 0,\n remove : false\n });\n\n _.defer( function(){\n self.fetch.call( self, _options )\n .fail( deferred.reject )\n .done( function( response ){\n deferred.notify( response, limit, offset );\n if( response.length !== limit ){\n self.allFetched = true;\n deferred.resolve( response, limit, offset );\n\n } else {\n _recursivelyFetch( offset + limit );\n }\n });\n });\n }\n _recursivelyFetch();\n return deferred;\n },\n\n /** does some bit of JSON represent something that can be copied into this contents collection */\n isCopyable : function( contentsJSON ){\n var copyableModelClasses = [\n 'HistoryDatasetAssociation',\n 'HistoryDatasetCollectionAssociation'\n ];\n return ( ( _.isObject( contentsJSON ) && contentsJSON.id )\n && ( _.contains( copyableModelClasses, contentsJSON.model_class ) ) );\n },\n\n /** copy an existing, accessible hda into this collection */\n copy : function( json ){\n // TODO: somehow showhorn all this into 'save'\n var id, type, contentType;\n if( _.isString( json ) ){\n id = json;\n contentType = 'hda';\n type = 'dataset';\n } else {\n id = json.id;\n contentType = ({\n 'HistoryDatasetAssociation' : 'hda',\n 'LibraryDatasetDatasetAssociation' : 'ldda',\n 'HistoryDatasetCollectionAssociation' : 'hdca'\n })[ json.model_class ] || 'hda';\n type = ( contentType === 'hdca'? 'dataset_collection' : 'dataset' );\n }\n var collection = this,\n xhr = jQuery.ajax( this.url(), {\n method: 'POST',\n contentType: 'application/json',\n data: JSON.stringify({\n content : id,\n source : contentType,\n type : type\n })\n })\n .done( function( response ){\n collection.add([ response ], { parse: true });\n })\n .fail( function( error, status, message ){\n collection.trigger( 'error', collection, xhr, {},\n 'Error copying contents', { type: type, id: id, source: contentType });\n });\n return xhr;\n },\n\n /** create a new HDCA in this collection */\n createHDCA : function( elementIdentifiers, collectionType, name, hideSourceItems, options ){\n // normally collection.create returns the new model, but we need the promise from the ajax, so we fake create\n //precondition: elementIdentifiers is an array of plain js objects\n // in the proper form to create the collectionType\n var hdca = this.model({\n history_content_type: 'dataset_collection',\n collection_type : collectionType,\n history_id : this.historyId,\n name : name,\n hide_source_items : hideSourceItems || false,\n // should probably be able to just send in a bunch of json here and restruct per class\n // note: element_identifiers is now (incorrectly) an attribute\n element_identifiers : elementIdentifiers\n // do not create the model on the client until the ajax returns\n });\n return hdca.save( options );\n },\n\n // ........................................................................ searching\n /** return true if all contents have the searchable attributes */\n haveSearchDetails : function(){\n return this.allFetched && this.all( function( content ){\n // null (which is a valid returned annotation value)\n // will return false when using content.has( 'annotation' )\n //TODO: a bit hacky - formalize\n return _.has( content.attributes, 'annotation' );\n });\n },\n\n /** return a new collection of contents whose attributes contain the substring matchesWhat */\n matches : function( matchesWhat ){\n return this.filter( function( content ){\n return content.matches( matchesWhat );\n });\n },\n\n // ........................................................................ misc\n /** In this override, copy the historyId to the clone */\n clone : function(){\n var clone = Backbone.Collection.prototype.clone.call( this );\n clone.historyId = this.historyId;\n return clone;\n },\n\n /** String representation. */\n toString : function(){\n return ([ 'HistoryContents(', [ this.historyId, this.length ].join(), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n HistoryContents : HistoryContents\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-contents.js","\ndefine([\n \"mvc/history/history-contents\",\n \"mvc/history/history-preferences\",\n \"mvc/base/controlled-fetch-collection\",\n \"utils/utils\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( HISTORY_CONTENTS, HISTORY_PREFS, CONTROLLED_FETCH_COLLECTION, UTILS, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\n/** @class Model for a Galaxy history resource - both a record of user\n * tool use and a collection of the datasets those tools produced.\n * @name History\n * @augments Backbone.Model\n */\nvar History = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( BASE_MVC.mixin( BASE_MVC.SearchableModelMixin, /** @lends History.prototype */{\n _logNamespace : 'history',\n\n /** ms between fetches when checking running jobs/datasets for updates */\n UPDATE_DELAY : 4000,\n\n // values from api (may need more)\n defaults : {\n model_class : 'History',\n id : null,\n name : 'Unnamed History',\n state : 'new',\n\n deleted : false,\n contents_active : {},\n contents_states : {},\n },\n\n urlRoot: Galaxy.root + 'api/histories',\n\n contentsClass : HISTORY_CONTENTS.HistoryContents,\n\n /** What model fields to search with */\n searchAttributes : [\n 'name', 'annotation', 'tags'\n ],\n\n /** Adding title and singular tag */\n searchAliases : {\n title : 'name',\n tag : 'tags'\n },\n\n // ........................................................................ set up/tear down\n /** Set up the model\n * @param {Object} historyJSON model data for this History\n * @param {Object} options any extra settings including logger\n */\n initialize : function( historyJSON, options ){\n options = options || {};\n this.logger = options.logger || null;\n this.log( this + \".initialize:\", historyJSON, options );\n\n /** HistoryContents collection of the HDAs contained in this history. */\n this.contents = new this.contentsClass( [], {\n history : this,\n historyId : this.get( 'id' ),\n order : options.order,\n });\n\n this._setUpListeners();\n this._setUpCollectionListeners();\n\n /** cached timeout id for the dataset updater */\n this.updateTimeoutId = null;\n },\n\n /** set up any event listeners for this history including those to the contained HDAs\n * events: error:contents if an error occurred with the contents collection\n */\n _setUpListeners : function(){\n // if the model's id changes ('current' or null -> an actual id), update the contents history_id\n return this.on({\n 'error' : function( model, xhr, options, msg, details ){\n this.clearUpdateTimeout();\n },\n 'change:id' : function( model, newId ){\n if( this.contents ){\n this.contents.historyId = newId;\n }\n },\n });\n },\n\n /** event handlers for the contents submodels */\n _setUpCollectionListeners : function(){\n if( !this.contents ){ return this; }\n // bubble up errors\n return this.listenTo( this.contents, {\n 'error' : function(){\n this.trigger.apply( this, jQuery.makeArray( arguments ) );\n },\n });\n },\n\n // ........................................................................ derived attributes\n /** */\n contentsShown : function(){\n var contentsActive = this.get( 'contents_active' );\n var shown = contentsActive.active || 0;\n shown += this.contents.includeDeleted? contentsActive.deleted : 0;\n shown += this.contents.includeHidden? contentsActive.hidden : 0;\n return shown;\n },\n\n /** convert size in bytes to a more human readable version */\n nice_size : function(){\n var size = this.get( 'size' );\n return size? UTILS.bytesToString( size, true, 2 ) : _l( '(empty)' );\n },\n\n /** override to add nice_size */\n toJSON : function(){\n return _.extend( Backbone.Model.prototype.toJSON.call( this ), {\n nice_size : this.nice_size()\n });\n },\n\n /** override to allow getting nice_size */\n get : function( key ){\n if( key === 'nice_size' ){\n return this.nice_size();\n }\n return Backbone.Model.prototype.get.apply( this, arguments );\n },\n\n // ........................................................................ common queries\n /** T/F is this history owned by the current user (Galaxy.user)\n * Note: that this will return false for an anon user even if the history is theirs.\n */\n ownedByCurrUser : function(){\n // no currUser\n if( !Galaxy || !Galaxy.user ){\n return false;\n }\n // user is anon or history isn't owned\n if( Galaxy.user.isAnonymous() || Galaxy.user.id !== this.get( 'user_id' ) ){\n return false;\n }\n return true;\n },\n\n /** Return the number of running jobs assoc with this history (note: unknown === 0) */\n numOfUnfinishedJobs : function(){\n var unfinishedJobIds = this.get( 'non_ready_jobs' );\n return unfinishedJobIds? unfinishedJobIds.length : 0;\n },\n\n /** Return the number of running hda/hdcas in this history (note: unknown === 0) */\n numOfUnfinishedShownContents : function(){\n return this.contents.runningAndActive().length || 0;\n },\n\n // ........................................................................ updates\n _fetchContentRelatedAttributes : function(){\n var contentRelatedAttrs = [ 'size', 'non_ready_jobs', 'contents_active', 'hid_counter' ];\n return this.fetch({ data : $.param({ keys : contentRelatedAttrs.join( ',' ) }) });\n },\n\n /** check for any changes since the last time we updated (or fetch all if ) */\n refresh : function( options ){\n // console.log( this + '.refresh' );\n options = options || {};\n var self = this;\n\n // note if there was no previous update time, all summary contents will be fetched\n var lastUpdateTime = self.lastUpdateTime;\n // if we don't flip this, then a fully-fetched list will not be re-checked via fetch\n this.contents.allFetched = false;\n var fetchFn = self.contents.currentPage !== 0\n ? function(){ return self.contents.fetchPage( self.contents.currentPage ); }\n : function(){ return self.contents.fetchUpdated( lastUpdateTime ); };\n // note: if there was no previous update time, all summary contents will be fetched\n return fetchFn()\n .done( function( response, status, xhr ){\n var serverResponseDatetime;\n try {\n serverResponseDatetime = new Date( xhr.getResponseHeader( 'Date' ) );\n } catch( err ){}\n self.lastUpdateTime = serverResponseDatetime || new Date();\n self.checkForUpdates( options );\n });\n },\n\n /** continuously fetch updated contents every UPDATE_DELAY ms if this history's datasets or jobs are unfinished */\n checkForUpdates : function( options ){\n // console.log( this + '.checkForUpdates' );\n options = options || {};\n var delay = this.UPDATE_DELAY;\n var self = this;\n if( !self.id ){ return; }\n\n function _delayThenUpdate(){\n // prevent buildup of updater timeouts by clearing previous if any, then set new and cache id\n self.clearUpdateTimeout();\n self.updateTimeoutId = setTimeout( function(){\n self.refresh( options );\n }, delay );\n }\n\n // if there are still datasets in the non-ready state, recurse into this function with the new time\n var nonReadyContentCount = this.numOfUnfinishedShownContents();\n // console.log( 'nonReadyContentCount:', nonReadyContentCount );\n if( nonReadyContentCount > 0 ){\n _delayThenUpdate();\n\n } else {\n // no datasets are running, but currently runnning jobs may still produce new datasets\n // see if the history has any running jobs and continue to update if so\n // (also update the size for the user in either case)\n self._fetchContentRelatedAttributes()\n .done( function( historyData ){\n // console.log( 'non_ready_jobs:', historyData.non_ready_jobs );\n if( self.numOfUnfinishedJobs() > 0 ){\n _delayThenUpdate();\n\n } else {\n // otherwise, let listeners know that all updates have stopped\n self.trigger( 'ready' );\n }\n });\n }\n },\n\n /** clear the timeout and the cached timeout id */\n clearUpdateTimeout : function(){\n if( this.updateTimeoutId ){\n clearTimeout( this.updateTimeoutId );\n this.updateTimeoutId = null;\n }\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse : function( response, options ){\n var parsed = Backbone.Model.prototype.parse.call( this, response, options );\n if( parsed.create_time ){\n parsed.create_time = new Date( parsed.create_time );\n }\n if( parsed.update_time ){\n parsed.update_time = new Date( parsed.update_time );\n }\n return parsed;\n },\n\n /** fetch this histories data (using options) then it's contents (using contentsOptions) */\n fetchWithContents : function( options, contentsOptions ){\n options = options || {};\n var self = this;\n\n // console.log( this + '.fetchWithContents' );\n // TODO: push down to a base class\n options.view = 'dev-detailed';\n\n // fetch history then use history data to fetch (paginated) contents\n return this.fetch( options ).then( function getContents( history ){\n self.contents.history = self;\n self.contents.setHistoryId( history.id );\n return self.fetchContents( contentsOptions );\n });\n },\n\n /** fetch this histories contents, adjusting options based on the stored history preferences */\n fetchContents : function( options ){\n options = options || {};\n var self = this;\n\n // we're updating, reset the update time\n self.lastUpdateTime = new Date();\n return self.contents.fetchCurrentPage( options );\n },\n\n /** save this history, _Mark_ing it as deleted (just a flag) */\n _delete : function( options ){\n if( this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: true }, options );\n },\n /** purge this history, _Mark_ing it as purged and removing all dataset data from the server */\n purge : function( options ){\n if( this.get( 'purged' ) ){ return jQuery.when(); }\n return this.save( { deleted: true, purged: true }, options );\n },\n /** save this history, _Mark_ing it as undeleted */\n undelete : function( options ){\n if( !this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: false }, options );\n },\n\n /** Make a copy of this history on the server\n * @param {Boolean} current if true, set the copy as the new current history (default: true)\n * @param {String} name name of new history (default: none - server sets to: Copy of )\n * @fires copied passed this history and the response JSON from the copy\n * @returns {xhr}\n */\n copy : function( current, name, allDatasets ){\n current = ( current !== undefined )?( current ):( true );\n if( !this.id ){\n throw new Error( 'You must set the history ID before copying it.' );\n }\n\n var postData = { history_id : this.id };\n if( current ){\n postData.current = true;\n }\n if( name ){\n postData.name = name;\n }\n if( !allDatasets ){\n postData.all_datasets = false;\n }\n postData.view = 'dev-detailed';\n\n var history = this;\n var copy = jQuery.post( this.urlRoot, postData );\n // if current - queue to setAsCurrent before firing 'copied'\n if( current ){\n return copy.then( function( response ){\n var newHistory = new History( response );\n return newHistory.setAsCurrent()\n .done( function(){\n history.trigger( 'copied', history, response );\n });\n });\n }\n return copy.done( function( response ){\n history.trigger( 'copied', history, response );\n });\n },\n\n setAsCurrent : function(){\n var history = this,\n xhr = jQuery.getJSON( Galaxy.root + 'history/set_as_current?id=' + this.id );\n\n xhr.done( function(){\n history.trigger( 'set-as-current', history );\n });\n return xhr;\n },\n\n // ........................................................................ misc\n toString : function(){\n return 'History(' + this.get( 'id' ) + ',' + this.get( 'name' ) + ')';\n }\n}));\n\n\n//==============================================================================\nvar _collectionSuper = CONTROLLED_FETCH_COLLECTION.InfinitelyScrollingCollection;\n/** @class A collection of histories (per user)\n * that maintains the current history as the first in the collection.\n * New or copied histories become the current history.\n */\nvar HistoryCollection = _collectionSuper.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : 'history',\n\n model : History,\n /** @type {String} initial order used by collection */\n order : 'update_time',\n /** @type {Number} limit used for the first fetch (or a reset) */\n limitOnFirstFetch : 10,\n /** @type {Number} limit used for each subsequent fetch */\n limitPerFetch : 10,\n\n initialize : function( models, options ){\n options = options || {};\n this.log( 'HistoryCollection.initialize', models, options );\n _collectionSuper.prototype.initialize.call( this, models, options );\n\n /** @type {boolean} should deleted histories be included */\n this.includeDeleted = options.includeDeleted || false;\n\n /** @type {String} encoded id of the history that's current */\n this.currentHistoryId = options.currentHistoryId;\n\n this.setUpListeners();\n // note: models are sent to reset *after* this fn ends; up to this point\n // the collection *is empty*\n },\n\n urlRoot : Galaxy.root + 'api/histories',\n url : function(){ return this.urlRoot; },\n\n /** set up reflexive event handlers */\n setUpListeners : function setUpListeners(){\n return this.on({\n // when a history is deleted, remove it from the collection (if optionally set to do so)\n 'change:deleted' : function( history ){\n // TODO: this becomes complicated when more filters are used\n this.debug( 'change:deleted', this.includeDeleted, history.get( 'deleted' ) );\n if( !this.includeDeleted && history.get( 'deleted' ) ){\n this.remove( history );\n }\n },\n // listen for a history copy, setting it to current\n 'copied' : function( original, newData ){\n this.setCurrent( new History( newData, [] ) );\n },\n // when a history is made current, track the id in the collection\n 'set-as-current' : function( history ){\n var oldCurrentId = this.currentHistoryId;\n this.trigger( 'no-longer-current', oldCurrentId );\n this.currentHistoryId = history.id;\n }\n });\n },\n\n /** override to change view */\n _buildFetchData : function( options ){\n return _.extend( _collectionSuper.prototype._buildFetchData.call( this, options ), {\n view : 'dev-detailed'\n });\n },\n\n /** override to filter out deleted and purged */\n _buildFetchFilters : function( options ){\n var superFilters = _collectionSuper.prototype._buildFetchFilters.call( this, options ) || {};\n var filters = {};\n if( !this.includeDeleted ){\n filters.deleted = false;\n filters.purged = false;\n } else {\n // force API to return both deleted and non\n //TODO: when the API is updated, remove this\n filters.deleted = null;\n }\n return _.defaults( superFilters, filters );\n },\n\n /** override to fetch current as well (as it may be outside the first 10, etc.) */\n fetchFirst : function( options ){\n var self = this;\n // TODO: batch?\n var xhr = $.when();\n if( this.currentHistoryId ){\n xhr = _collectionSuper.prototype.fetchFirst.call( self, {\n silent: true,\n limit : 1,\n filters: {\n // without these a deleted current history will return [] here and block the other xhr\n 'purged' : '',\n 'deleted' : '',\n 'encoded_id-in' : this.currentHistoryId,\n }\n });\n }\n return xhr.then( function(){\n options = options || {};\n options.offset = 0;\n return self.fetchMore( options );\n });\n },\n\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators : _.extend( _.clone( _collectionSuper.prototype.comparators ), {\n 'name' : BASE_MVC.buildComparator( 'name', { ascending: true }),\n 'name-dsc' : BASE_MVC.buildComparator( 'name', { ascending: false }),\n 'size' : BASE_MVC.buildComparator( 'size', { ascending: false }),\n 'size-asc' : BASE_MVC.buildComparator( 'size', { ascending: true }),\n }),\n\n /** override to always have the current history first */\n sort : function( options ){\n options = options || {};\n var silent = options.silent;\n var currentHistory = this.remove( this.get( this.currentHistoryId ) );\n _collectionSuper.prototype.sort.call( this, _.defaults({ silent: true }, options ) );\n this.unshift( currentHistory, { silent: true });\n if( !silent ){\n this.trigger( 'sort', this, options );\n }\n return this;\n },\n\n /** create a new history and by default set it to be the current history */\n create : function create( data, hdas, historyOptions, xhrOptions ){\n //TODO: .create is actually a collection function that's overridden here\n var collection = this,\n xhr = jQuery.getJSON( Galaxy.root + 'history/create_new_current' );\n return xhr.done( function( newData ){\n collection.setCurrent( new History( newData, [], historyOptions || {} ) );\n });\n },\n\n /** set the current history to the given history, placing it first in the collection.\n * Pass standard bbone options for use in unshift.\n * @triggers new-current passed history and this collection\n */\n setCurrent : function( history, options ){\n options = options || {};\n // new histories go in the front\n this.unshift( history, options );\n this.currentHistoryId = history.get( 'id' );\n if( !options.silent ){\n this.trigger( 'new-current', history, this );\n }\n return this;\n },\n\n toString: function toString(){\n return 'HistoryCollection(' + this.length + ',current:' + this.currentHistoryId + ')';\n }\n});\n\n\n//==============================================================================\nreturn {\n History : History,\n HistoryCollection : HistoryCollection\n};});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-model.js","define([\n \"mvc/base-mvc\"\n], function( BASE_MVC ){\n\n'use strict';\n\nvar logNamespace = 'history';\n\n// ============================================================================\n/** session storage for individual history preferences */\nvar HistoryPrefs = BASE_MVC.SessionStorageModel.extend(\n/** @lends HistoryPrefs.prototype */{\n //TODO:?? move to user prefs?\n defaults : {\n //TODO:?? expandedIds to array?\n expandedIds : {},\n show_deleted : false,\n show_hidden : false\n },\n\n /** add an hda id to the hash of expanded hdas */\n addExpanded : function( model ){\n//TODO: use type_id and not model\n var current = this.get( 'expandedIds' );\n current[ model.id ] = model.get( 'id' );\n this.save( 'expandedIds', current );\n },\n\n /** remove an hda id from the hash of expanded hdas */\n removeExpanded : function( model ){\n var current = this.get( 'expandedIds' );\n delete current[ model.id ];\n this.save( 'expandedIds', current );\n },\n\n isExpanded : function( contentId ){\n return _.result( this.get( 'expandedIds' ), contentId, false );\n },\n\n allExpanded : function(){\n return _.values( this.get( 'expandedIds' ) );\n },\n\n clearExpanded : function(){\n this.set( 'expandedIds', {} );\n },\n\n includeDeleted : function( val ){\n // moving the invocation here so other components don't need to know the key\n // TODO: change this key later\n if( !_.isUndefined( val ) ){ this.set( 'show_deleted', val ); }\n return this.get( 'show_deleted' );\n },\n\n includeHidden : function( val ){\n // TODO: change this key later\n if( !_.isUndefined( val ) ){ this.set( 'show_hidden', val ); }\n return this.get( 'show_hidden' );\n },\n\n toString : function(){\n return 'HistoryPrefs(' + this.id + ')';\n }\n\n}, {\n // ........................................................................ class vars\n // class lvl for access w/o instantiation\n storageKeyPrefix : 'history:',\n\n /** key string to store each histories settings under */\n historyStorageKey : function historyStorageKey( historyId ){\n if( !historyId ){\n throw new Error( 'HistoryPrefs.historyStorageKey needs valid id: ' + historyId );\n }\n // single point of change\n return ( HistoryPrefs.storageKeyPrefix + historyId );\n },\n\n /** return the existing storage for the history with the given id (or create one if it doesn't exist) */\n get : function get( historyId ){\n return new HistoryPrefs({ id: HistoryPrefs.historyStorageKey( historyId ) });\n },\n\n /** clear all history related items in sessionStorage */\n clearAll : function clearAll( historyId ){\n for( var key in sessionStorage ){\n if( key.indexOf( HistoryPrefs.storageKeyPrefix ) === 0 ){\n sessionStorage.removeItem( key );\n }\n }\n }\n});\n\n//==============================================================================\n return {\n HistoryPrefs: HistoryPrefs\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-preferences.js","define([\n 'mvc/base-mvc',\n 'utils/localization'\n], function( BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'list';\n//==============================================================================\n/** A view which, when first rendered, shows only summary data/attributes, but\n * can be expanded to show further details (and optionally fetch those\n * details from the server).\n */\nvar ExpandableView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n //TODO: Although the reasoning behind them is different, this shares a lot with HiddenUntilActivated above: combine them\n //PRECONDITION: model must have method hasDetails\n //PRECONDITION: subclasses must have templates.el and templates.details\n\n initialize : function( attributes ){\n /** are the details of this view expanded/shown or not? */\n this.expanded = attributes.expanded || false;\n this.log( '\\t expanded:', this.expanded );\n this.fxSpeed = attributes.fxSpeed !== undefined? attributes.fxSpeed : this.fxSpeed;\n },\n\n // ........................................................................ render main\n /** jq fx speed */\n fxSpeed : 'fast',\n\n /** Render this content, set up ui.\n * @param {Number or String} speed the speed of the render\n */\n render : function( speed ){\n var $newRender = this._buildNewRender();\n this._setUpBehaviors( $newRender );\n this._queueNewRender( $newRender, speed );\n return this;\n },\n\n /** Build a temp div containing the new children for the view's $el.\n * If the view is already expanded, build the details as well.\n */\n _buildNewRender : function(){\n // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n var $newRender = $( this.templates.el( this.model.toJSON(), this ) );\n if( this.expanded ){\n this.$details( $newRender ).replaceWith( this._renderDetails().show() );\n }\n return $newRender;\n },\n\n /** Fade out the old el, swap in the new contents, then fade in.\n * @param {Number or String} speed jq speed to use for rendering effects\n * @fires rendered when rendered\n */\n _queueNewRender : function( $newRender, speed ) {\n speed = ( speed === undefined )?( this.fxSpeed ):( speed );\n var view = this;\n\n if( speed === 0 ){\n view._swapNewRender( $newRender );\n view.trigger( 'rendered', view );\n\n } else {\n $( view ).queue( 'fx', [\n function( next ){\n view.$el.fadeOut( speed, next );\n },\n function( next ){\n view._swapNewRender( $newRender );\n next();\n },\n function( next ){\n view.$el.fadeIn( speed, next );\n },\n function( next ){\n view.trigger( 'rendered', view );\n next();\n }\n ]);\n }\n },\n\n /** empty out the current el, move the $newRender's children in */\n _swapNewRender : function( $newRender ){\n return this.$el.empty()\n .attr( 'class', _.isFunction( this.className )? this.className(): this.className )\n .append( $newRender.children() );\n },\n\n /** set up js behaviors, event handlers for elements within the given container\n * @param {jQuery} $container jq object that contains the elements to process (defaults to this.$el)\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n // set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)\n //make_popup_menus( $where );\n $where.find( '[title]' ).tooltip({ placement : 'bottom' });\n },\n\n // ......................................................................... details\n /** shortcut to details DOM (as jQ) */\n $details : function( $where ){\n $where = $where || this.$el;\n return $where.find( '> .details' );\n },\n\n /** build the DOM for the details and set up behaviors on it */\n _renderDetails : function(){\n var $newDetails = $( this.templates.details( this.model.toJSON(), this ) );\n this._setUpBehaviors( $newDetails );\n return $newDetails;\n },\n\n // ......................................................................... expansion/details\n /** Show or hide the details\n * @param {Boolean} expand if true, expand; if false, collapse\n */\n toggleExpanded : function( expand ){\n expand = ( expand === undefined )?( !this.expanded ):( expand );\n if( expand ){\n this.expand();\n } else {\n this.collapse();\n }\n return this;\n },\n\n /** Render and show the full, detailed body of this view including extra data and controls.\n * note: if the model does not have detailed data, fetch that data before showing the body\n * @fires expanded when a body has been expanded\n */\n expand : function(){\n var view = this;\n return view._fetchModelDetails().always( function(){\n view._expand();\n });\n },\n\n /** Check for model details and, if none, fetch them.\n * @returns {jQuery.promise} the model.fetch.xhr if details are being fetched, an empty promise if not\n */\n _fetchModelDetails : function(){\n if( !this.model.hasDetails() ){\n return this.model.fetch();\n }\n return jQuery.when();\n },\n\n /** Inner fn called when expand (public) has fetched the details */\n _expand : function(){\n var view = this,\n $newDetails = view._renderDetails();\n view.$details().replaceWith( $newDetails );\n // needs to be set after the above or the slide will not show\n view.expanded = true;\n view.$details().slideDown( view.fxSpeed, function(){\n view.trigger( 'expanded', view );\n });\n },\n\n /** Hide the body/details of an HDA.\n * @fires collapsed when a body has been collapsed\n */\n collapse : function(){\n this.debug( this + '(ExpandableView).collapse' );\n var view = this;\n view.expanded = false;\n this.$details().slideUp( view.fxSpeed, function(){\n view.trigger( 'collapsed', view );\n });\n }\n\n});\n\n\n//==============================================================================\n/** A view that is displayed in some larger list/grid/collection.\n * Inherits from Expandable, Selectable, Draggable.\n * The DOM contains warnings, a title bar, and a series of primary action controls.\n * Primary actions are meant to be easily accessible item functions (such as delete)\n * that are rendered in the title bar.\n *\n * Details are rendered when the user clicks the title bar or presses enter/space when\n * the title bar is in focus.\n *\n * Designed as a base class for history panel contents - but usable elsewhere (I hope).\n */\nvar ListItemView = ExpandableView.extend(\n BASE_MVC.mixin( BASE_MVC.SelectableViewMixin, BASE_MVC.DraggableViewMixin, {\n\n tagName : 'div',\n className : 'list-item',\n\n /** Set up the base class and all mixins */\n initialize : function( attributes ){\n ExpandableView.prototype.initialize.call( this, attributes );\n BASE_MVC.SelectableViewMixin.initialize.call( this, attributes );\n BASE_MVC.DraggableViewMixin.initialize.call( this, attributes );\n this._setUpListeners();\n },\n\n /** event listeners */\n _setUpListeners : function(){\n // hide the primary actions in the title bar when selectable and narrow\n this.on( 'selectable', function( isSelectable ){\n if( isSelectable ){\n this.$( '.primary-actions' ).hide();\n } else {\n this.$( '.primary-actions' ).show();\n }\n }, this );\n return this;\n },\n\n // ........................................................................ rendering\n /** In this override, call methods to build warnings, titlebar and primary actions */\n _buildNewRender : function(){\n var $newRender = ExpandableView.prototype._buildNewRender.call( this );\n $newRender.children( '.warnings' ).replaceWith( this._renderWarnings() );\n $newRender.children( '.title-bar' ).replaceWith( this._renderTitleBar() );\n $newRender.children( '.primary-actions' ).append( this._renderPrimaryActions() );\n $newRender.find( '> .title-bar .subtitle' ).replaceWith( this._renderSubtitle() );\n return $newRender;\n },\n\n /** In this override, render the selector controls and set up dragging before the swap */\n _swapNewRender : function( $newRender ){\n ExpandableView.prototype._swapNewRender.call( this, $newRender );\n if( this.selectable ){ this.showSelector( 0 ); }\n if( this.draggable ){ this.draggableOn(); }\n return this.$el;\n },\n\n /** Render any warnings the item may need to show (e.g. \"I'm deleted\") */\n _renderWarnings : function(){\n var view = this,\n $warnings = $( '
                                  ' ),\n json = view.model.toJSON();\n //TODO:! unordered (map)\n _.each( view.templates.warnings, function( templateFn ){\n $warnings.append( $( templateFn( json, view ) ) );\n });\n return $warnings;\n },\n\n /** Render the title bar (the main/exposed SUMMARY dom element) */\n _renderTitleBar : function(){\n return $( this.templates.titleBar( this.model.toJSON(), this ) );\n },\n\n /** Return an array of jQ objects containing common/easily-accessible item controls */\n _renderPrimaryActions : function(){\n // override this\n return [];\n },\n\n /** Render the title bar (the main/exposed SUMMARY dom element) */\n _renderSubtitle : function(){\n return $( this.templates.subtitle( this.model.toJSON(), this ) );\n },\n\n // ......................................................................... events\n /** event map */\n events : {\n // expand the body when the title is clicked or when in focus and space or enter is pressed\n 'click .title-bar' : '_clickTitleBar',\n 'keydown .title-bar' : '_keyDownTitleBar',\n 'click .selector' : 'toggleSelect'\n },\n\n /** expand when the title bar is clicked */\n _clickTitleBar : function( event ){\n event.stopPropagation();\n if( event.altKey ){\n this.toggleSelect( event );\n if( !this.selectable ){\n this.showSelector();\n }\n } else {\n this.toggleExpanded();\n }\n },\n\n /** expand when the title bar is in focus and enter or space is pressed */\n _keyDownTitleBar : function( event ){\n // bail (with propagation) if keydown and not space or enter\n var KEYCODE_SPACE = 32, KEYCODE_RETURN = 13;\n if( event && ( event.type === 'keydown' )\n &&( event.keyCode === KEYCODE_SPACE || event.keyCode === KEYCODE_RETURN ) ){\n this.toggleExpanded();\n event.stopPropagation();\n return false;\n }\n return true;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'ListItemView(' + modelString + ')';\n }\n}));\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nListItemView.prototype.templates = (function(){\n\n var elTemplato = BASE_MVC.wrapTemplate([\n '
                                  ',\n // errors, messages, etc.\n '
                                  ',\n\n // multi-select checkbox\n '
                                  ',\n '',\n '
                                  ',\n // space for title bar buttons - gen. floated to the right\n '
                                  ',\n '
                                  ',\n\n // expandable area for more details\n '
                                  ',\n '
                                  '\n ]);\n\n var warnings = {};\n\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n // adding a tabindex here allows focusing the title bar and the use of keydown to expand the dataset display\n '
                                  ',\n //TODO: prob. belongs in dataset-list-item\n '',\n '
                                  ',\n '<%- element.name %>',\n '
                                  ',\n '
                                  ',\n '
                                  '\n ], 'element' );\n\n var subtitleTemplate = BASE_MVC.wrapTemplate([\n // override this\n '
                                  '\n ]);\n\n var detailsTemplate = BASE_MVC.wrapTemplate([\n // override this\n '
                                  '\n ]);\n\n return {\n el : elTemplato,\n warnings : warnings,\n titleBar : titleBarTemplate,\n subtitle : subtitleTemplate,\n details : detailsTemplate\n };\n}());\n\n\n//==============================================================================\n/** A view that is displayed in some larger list/grid/collection.\n * *AND* can display some sub-list of it's own when expanded (e.g. dataset collections).\n * This list will 'foldout' when the item is expanded depending on this.foldoutStyle:\n * If 'foldout': will expand vertically to show the nested list\n * If 'drilldown': will overlay the parent list\n *\n * Inherits from ListItemView.\n *\n * _renderDetails does the work of creating this.details: a sub-view that shows the nested list\n */\nvar FoldoutListItemView = ListItemView.extend({\n\n /** If 'foldout': show the sub-panel inside the expanded item\n * If 'drilldown': only fire events and handle by pub-sub\n * (allow the panel containing this item to attach it, hide itself, etc.)\n */\n foldoutStyle : 'foldout',\n /** Panel view class to instantiate for the sub-panel */\n foldoutPanelClass : null,\n\n /** override to:\n * add attributes foldoutStyle and foldoutPanelClass for config poly\n * disrespect attributes.expanded if drilldown\n */\n initialize : function( attributes ){\n if( this.foldoutStyle === 'drilldown' ){ this.expanded = false; }\n this.foldoutStyle = attributes.foldoutStyle || this.foldoutStyle;\n this.foldoutPanelClass = attributes.foldoutPanelClass || this.foldoutPanelClass;\n\n ListItemView.prototype.initialize.call( this, attributes );\n this.foldout = this._createFoldoutPanel();\n },\n\n /** in this override, attach the foldout panel when rendering details */\n _renderDetails : function(){\n if( this.foldoutStyle === 'drilldown' ){ return $(); }\n var $newDetails = ListItemView.prototype._renderDetails.call( this );\n return this._attachFoldout( this.foldout, $newDetails );\n },\n\n /** In this override, handle collection expansion. */\n _createFoldoutPanel : function(){\n var model = this.model;\n var FoldoutClass = this._getFoldoutPanelClass( model ),\n options = this._getFoldoutPanelOptions( model ),\n foldout = new FoldoutClass( _.extend( options, {\n model : model\n }));\n return foldout;\n },\n\n /** Stub to return proper foldout panel class */\n _getFoldoutPanelClass : function(){\n // override\n return this.foldoutPanelClass;\n },\n\n /** Stub to return proper foldout panel options */\n _getFoldoutPanelOptions : function(){\n return {\n // propagate foldout style down\n foldoutStyle : this.foldoutStyle,\n fxSpeed : this.fxSpeed\n };\n },\n\n /** Render the foldout panel inside the view, hiding controls */\n _attachFoldout : function( foldout, $whereTo ){\n $whereTo = $whereTo || this.$( '> .details' );\n this.foldout = foldout.render( 0 );\n foldout.$( '> .controls' ).hide();\n return $whereTo.append( foldout.$el );\n },\n\n /** In this override, branch on foldoutStyle to show expanded */\n expand : function(){\n var view = this;\n return view._fetchModelDetails()\n .always(function(){\n if( view.foldoutStyle === 'foldout' ){\n view._expand();\n } else if( view.foldoutStyle === 'drilldown' ){\n view._expandByDrilldown();\n }\n });\n },\n\n /** For drilldown, set up close handler and fire expanded:drilldown\n * containing views can listen to this and handle other things\n * (like hiding themselves) by listening for expanded/collapsed:drilldown\n */\n _expandByDrilldown : function(){\n var view = this;\n // attachment and rendering done by listener\n view.listenTo( view.foldout, 'close', function(){\n view.trigger( 'collapsed:drilldown', view, view.foldout );\n });\n view.trigger( 'expanded:drilldown', view, view.foldout );\n }\n\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nFoldoutListItemView.prototype.templates = (function(){\n\n var detailsTemplate = BASE_MVC.wrapTemplate([\n '
                                  ',\n // override with more info (that goes above the panel)\n '
                                  '\n ], 'collection' );\n\n return _.extend( {}, ListItemView.prototype.templates, {\n details : detailsTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n ExpandableView : ExpandableView,\n ListItemView : ListItemView,\n FoldoutListItemView : FoldoutListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/list/list-item.js","/**\n * Model, view, and controller objects for Galaxy tools and tool panel.\n */\n\n define([\n \"libs/underscore\",\n \"viz/trackster/util\",\n \"mvc/dataset/data\",\n \"mvc/tool/tool-form\"\n\n], function(_, util, data, ToolForm) {\n 'use strict';\n\n/**\n * Mixin for tracking model visibility.\n */\nvar VisibilityMixin = {\n hidden: false,\n\n show: function() {\n this.set(\"hidden\", false);\n },\n\n hide: function() {\n this.set(\"hidden\", true);\n },\n\n toggle: function() {\n this.set(\"hidden\", !this.get(\"hidden\"));\n },\n\n is_visible: function() {\n return !this.attributes.hidden;\n }\n\n};\n\n/**\n * A tool parameter.\n */\nvar ToolParameter = Backbone.Model.extend({\n defaults: {\n name: null,\n label: null,\n type: null,\n value: null,\n html: null,\n num_samples: 5\n },\n\n initialize: function(options) {\n this.attributes.html = unescape(this.attributes.html);\n },\n\n copy: function() {\n return new ToolParameter(this.toJSON());\n },\n\n set_value: function(value) {\n this.set('value', value || '');\n }\n});\n\nvar ToolParameterCollection = Backbone.Collection.extend({\n model: ToolParameter\n});\n\n/**\n * A data tool parameter.\n */\nvar DataToolParameter = ToolParameter.extend({});\n\n/**\n * An integer tool parameter.\n */\nvar IntegerToolParameter = ToolParameter.extend({\n set_value: function(value) {\n this.set('value', parseInt(value, 10));\n },\n\n /**\n * Returns samples from a tool input.\n */\n get_samples: function() {\n return d3.scale.linear()\n .domain([this.get('min'), this.get('max')])\n .ticks(this.get('num_samples'));\n }\n});\n\nvar FloatToolParameter = IntegerToolParameter.extend({\n set_value: function(value) {\n this.set('value', parseFloat(value));\n }\n});\n\n/**\n * A select tool parameter.\n */\nvar SelectToolParameter = ToolParameter.extend({\n /**\n * Returns tool options.\n */\n get_samples: function() {\n return _.map(this.get('options'), function(option) {\n return option[0];\n });\n }\n});\n\n// Set up dictionary of parameter types.\nToolParameter.subModelTypes = {\n 'integer': IntegerToolParameter,\n 'float': FloatToolParameter,\n 'data': DataToolParameter,\n 'select': SelectToolParameter\n};\n\n/**\n * A Galaxy tool.\n */\nvar Tool = Backbone.Model.extend({\n // Default attributes.\n defaults: {\n id: null,\n name: null,\n description: null,\n target: null,\n inputs: [],\n outputs: []\n },\n\n urlRoot: Galaxy.root + 'api/tools',\n\n initialize: function(options) {\n\n // Set parameters.\n this.set('inputs', new ToolParameterCollection(_.map(options.inputs, function(p) {\n var p_class = ToolParameter.subModelTypes[p.type] || ToolParameter;\n return new p_class(p);\n })));\n },\n\n /**\n *\n */\n toJSON: function() {\n var rval = Backbone.Model.prototype.toJSON.call(this);\n\n // Convert inputs to JSON manually.\n rval.inputs = this.get('inputs').map(function(i) { return i.toJSON(); });\n return rval;\n },\n\n /**\n * Removes inputs of a particular type; this is useful because not all inputs can be handled by\n * client and server yet.\n */\n remove_inputs: function(types) {\n var tool = this,\n incompatible_inputs = tool.get('inputs').filter( function(input) {\n return ( types.indexOf( input.get('type') ) !== -1);\n });\n tool.get('inputs').remove(incompatible_inputs);\n },\n\n /**\n * Returns object copy, optionally including only inputs that can be sampled.\n */\n copy: function(only_samplable_inputs) {\n var copy = new Tool(this.toJSON());\n\n // Return only samplable inputs if flag is set.\n if (only_samplable_inputs) {\n var valid_inputs = new Backbone.Collection();\n copy.get('inputs').each(function(input) {\n if (input.get_samples()) {\n valid_inputs.push(input);\n }\n });\n copy.set('inputs', valid_inputs);\n }\n\n return copy;\n },\n\n apply_search_results: function(results) {\n ( _.indexOf(results, this.attributes.id) !== -1 ? this.show() : this.hide() );\n return this.is_visible();\n },\n\n /**\n * Set a tool input's value.\n */\n set_input_value: function(name, value) {\n this.get('inputs').find(function(input) {\n return input.get('name') === name;\n }).set('value', value);\n },\n\n /**\n * Set many input values at once.\n */\n set_input_values: function(inputs_dict) {\n var self = this;\n _.each(_.keys(inputs_dict), function(input_name) {\n self.set_input_value(input_name, inputs_dict[input_name]);\n });\n },\n\n /**\n * Run tool; returns a Deferred that resolves to the tool's output(s).\n */\n run: function() {\n return this._run();\n },\n\n /**\n * Rerun tool using regions and a target dataset.\n */\n rerun: function(target_dataset, regions) {\n return this._run({\n action: 'rerun',\n target_dataset_id: target_dataset.id,\n regions: regions\n });\n },\n\n /**\n * Returns input dict for tool's inputs.\n */\n get_inputs_dict: function() {\n var input_dict = {};\n this.get('inputs').each(function(input) {\n input_dict[input.get('name')] = input.get('value');\n });\n return input_dict;\n },\n\n /**\n * Run tool; returns a Deferred that resolves to the tool's output(s).\n * NOTE: this method is a helper method and should not be called directly.\n */\n _run: function(additional_params) {\n // Create payload.\n var payload = _.extend({\n tool_id: this.id,\n inputs: this.get_inputs_dict()\n }, additional_params);\n\n // Because job may require indexing datasets, use server-side\n // deferred to ensure that job is run. Also use deferred that\n // resolves to outputs from tool.\n var run_deferred = $.Deferred(),\n ss_deferred = new util.ServerStateDeferred({\n ajax_settings: {\n url: this.urlRoot,\n data: JSON.stringify(payload),\n dataType: \"json\",\n contentType: 'application/json',\n type: \"POST\"\n },\n interval: 2000,\n success_fn: function(response) {\n return response !== \"pending\";\n }\n });\n\n // Run job and resolve run_deferred to tool outputs.\n $.when(ss_deferred.go()).then(function(result) {\n run_deferred.resolve(new data.DatasetCollection(result));\n });\n return run_deferred;\n }\n});\n_.extend(Tool.prototype, VisibilityMixin);\n\n/**\n * Tool view.\n */\nvar ToolView = Backbone.View.extend({\n\n});\n\n/**\n * Wrap collection of tools for fast access/manipulation.\n */\nvar ToolCollection = Backbone.Collection.extend({\n model: Tool\n});\n\n/**\n * Label or section header in tool panel.\n */\nvar ToolSectionLabel = Backbone.Model.extend(VisibilityMixin);\n\n/**\n * Section of tool panel with elements (labels and tools).\n */\nvar ToolSection = Backbone.Model.extend({\n defaults: {\n elems: [],\n open: false\n },\n\n clear_search_results: function() {\n _.each(this.attributes.elems, function(elt) {\n elt.show();\n });\n\n this.show();\n this.set(\"open\", false);\n },\n\n apply_search_results: function(results) {\n var all_hidden = true,\n cur_label;\n _.each(this.attributes.elems, function(elt) {\n if (elt instanceof ToolSectionLabel) {\n cur_label = elt;\n cur_label.hide();\n }\n else if (elt instanceof Tool) {\n if (elt.apply_search_results(results)) {\n all_hidden = false;\n if (cur_label) {\n cur_label.show();\n }\n }\n }\n });\n\n if (all_hidden) {\n this.hide();\n }\n else {\n this.show();\n this.set(\"open\", true);\n }\n }\n});\n_.extend(ToolSection.prototype, VisibilityMixin);\n\n/**\n * Tool search that updates results when query is changed. Result value of null\n * indicates that query was not run; if not null, results are from search using\n * query.\n */\nvar ToolSearch = Backbone.Model.extend({\n defaults: {\n search_hint_string: \"search tools\",\n min_chars_for_search: 3,\n clear_btn_url: \"\",\n visible: true,\n query: \"\",\n results: null,\n // ESC (27) will clear the input field and tool search filters\n clear_key: 27\n },\n\n urlRoot: Galaxy.root + 'api/tools',\n\n initialize: function() {\n this.on(\"change:query\", this.do_search);\n },\n\n /**\n * Do the search and update the results.\n */\n do_search: function() {\n var query = this.attributes.query;\n\n // If query is too short, do not search.\n if (query.length < this.attributes.min_chars_for_search) {\n this.set(\"results\", null);\n return;\n }\n\n // Do search via AJAX.\n var q = query;\n // Stop previous ajax-request\n if (this.timer) {\n clearTimeout(this.timer);\n }\n // Start a new ajax-request in X ms\n $(\"#search-clear-btn\").hide();\n $(\"#search-spinner\").show();\n var self = this;\n this.timer = setTimeout(function () {\n // log the search to analytics if present\n if ( typeof ga !== 'undefined' ) {\n ga( 'send', 'pageview', Galaxy.root + '?q=' + q );\n }\n $.get( self.urlRoot, { q: q }, function (data) {\n self.set(\"results\", data);\n $(\"#search-spinner\").hide();\n $(\"#search-clear-btn\").show();\n }, \"json\" );\n }, 400 );\n },\n\n clear_search: function() {\n this.set(\"query\", \"\");\n this.set(\"results\", null);\n }\n\n});\n_.extend(ToolSearch.prototype, VisibilityMixin);\n\n/**\n * Tool Panel.\n */\nvar ToolPanel = Backbone.Model.extend({\n\n initialize: function(options) {\n this.attributes.tool_search = options.tool_search;\n this.attributes.tool_search.on(\"change:results\", this.apply_search_results, this);\n this.attributes.tools = options.tools;\n this.attributes.layout = new Backbone.Collection( this.parse(options.layout) );\n },\n\n /**\n * Parse tool panel dictionary and return collection of tool panel elements.\n */\n parse: function(response) {\n // Recursive function to parse tool panel elements.\n var self = this,\n // Helper to recursively parse tool panel.\n parse_elt = function(elt_dict) {\n var type = elt_dict.model_class;\n // There are many types of tools; for now, anything that ends in 'Tool'\n // is treated as a generic tool.\n if ( type.indexOf('Tool') === type.length - 4 ) {\n return self.attributes.tools.get(elt_dict.id);\n }\n else if (type === 'ToolSection') {\n // Parse elements.\n var elems = _.map(elt_dict.elems, parse_elt);\n elt_dict.elems = elems;\n return new ToolSection(elt_dict);\n }\n else if (type === 'ToolSectionLabel') {\n return new ToolSectionLabel(elt_dict);\n }\n };\n\n return _.map(response, parse_elt);\n },\n\n clear_search_results: function() {\n this.get('layout').each(function(panel_elt) {\n if (panel_elt instanceof ToolSection) {\n panel_elt.clear_search_results();\n }\n else {\n // Label or tool, so just show.\n panel_elt.show();\n }\n });\n },\n\n apply_search_results: function() {\n var results = this.get('tool_search').get('results');\n if (results === null) {\n this.clear_search_results();\n return;\n }\n\n var cur_label = null;\n this.get('layout').each(function(panel_elt) {\n if (panel_elt instanceof ToolSectionLabel) {\n cur_label = panel_elt;\n cur_label.hide();\n }\n else if (panel_elt instanceof Tool) {\n if (panel_elt.apply_search_results(results)) {\n if (cur_label) {\n cur_label.show();\n }\n }\n }\n else {\n // Starting new section, so clear current label.\n cur_label = null;\n panel_elt.apply_search_results(results);\n }\n });\n }\n});\n\n/**\n * View classes for Galaxy tools and tool panel.\n *\n * Views use the templates defined below for rendering. Views update as needed\n * based on (a) model/collection events and (b) user interactions; in this sense,\n * they are controllers are well and the HTML is the real view in the MVC architecture.\n */\n\n/**\n * Base view that handles visibility based on model's hidden attribute.\n */\nvar BaseView = Backbone.View.extend({\n initialize: function() {\n this.model.on(\"change:hidden\", this.update_visible, this);\n this.update_visible();\n },\n update_visible: function() {\n ( this.model.attributes.hidden ? this.$el.hide() : this.$el.show() );\n }\n});\n\n/**\n * Link to a tool.\n */\nvar ToolLinkView = BaseView.extend({\n tagName: 'div',\n\n render: function() {\n // create element\n var $link = $('
                                  ');\n $link.append(templates.tool_link(this.model.toJSON()));\n\n var formStyle = this.model.get( 'form_style', null );\n // open upload dialog for upload tool\n if (this.model.id === 'upload1') {\n $link.find('a').on('click', function(e) {\n e.preventDefault();\n Galaxy.upload.show();\n });\n }\n else if ( formStyle === 'regular' ) { // regular tools\n var self = this;\n $link.find('a').on('click', function(e) {\n e.preventDefault();\n Galaxy.router.push( '/', { tool_id : self.model.id, version : self.model.get('version') } );\n });\n }\n\n // add element\n this.$el.append($link);\n return this;\n }\n});\n\n/**\n * Panel label/section header.\n */\nvar ToolSectionLabelView = BaseView.extend({\n tagName: 'div',\n className: 'toolPanelLabel',\n\n render: function() {\n this.$el.append( $(\"\").text(this.model.attributes.text) );\n return this;\n }\n});\n\n/**\n * Panel section.\n */\nvar ToolSectionView = BaseView.extend({\n tagName: 'div',\n className: 'toolSectionWrapper',\n\n initialize: function() {\n BaseView.prototype.initialize.call(this);\n this.model.on(\"change:open\", this.update_open, this);\n },\n\n render: function() {\n // Build using template.\n this.$el.append( templates.panel_section(this.model.toJSON()) );\n\n // Add tools to section.\n var section_body = this.$el.find(\".toolSectionBody\");\n _.each(this.model.attributes.elems, function(elt) {\n if (elt instanceof Tool) {\n var tool_view = new ToolLinkView({model: elt, className: \"toolTitle\"});\n tool_view.render();\n section_body.append(tool_view.$el);\n }\n else if (elt instanceof ToolSectionLabel) {\n var label_view = new ToolSectionLabelView({model: elt});\n label_view.render();\n section_body.append(label_view.$el);\n }\n else {\n // TODO: handle nested section bodies?\n }\n });\n return this;\n },\n\n events: {\n 'click .toolSectionTitle > a': 'toggle'\n },\n\n /**\n * Toggle visibility of tool section.\n */\n toggle: function() {\n this.model.set(\"open\", !this.model.attributes.open);\n },\n\n /**\n * Update whether section is open or close.\n */\n update_open: function() {\n (this.model.attributes.open ?\n this.$el.children(\".toolSectionBody\").slideDown(\"fast\") :\n this.$el.children(\".toolSectionBody\").slideUp(\"fast\")\n );\n }\n});\n\nvar ToolSearchView = Backbone.View.extend({\n tagName: 'div',\n id: 'tool-search',\n className: 'bar',\n\n events: {\n 'click': 'focus_and_select',\n 'keyup :input': 'query_changed',\n 'change :input': 'query_changed',\n 'click #search-clear-btn': 'clear'\n },\n\n render: function() {\n this.$el.append( templates.tool_search(this.model.toJSON()) );\n if (!this.model.is_visible()) {\n this.$el.hide();\n }\n\n // Adjust top for issue 2907 depending on whether the messagebox is visible.\n if ($(\"#messagebox\").is(\":visible\")) {\n this.$el.css(\"top\",\"95px\");\n }\n\n this.$el.find('[title]').tooltip();\n return this;\n },\n\n focus_and_select: function() {\n this.$el.find(\":input\").focus().select();\n },\n\n clear: function() {\n this.model.clear_search();\n this.$el.find(\":input\").val('');\n this.focus_and_select();\n return false;\n },\n\n query_changed: function( evData ) {\n // check for the 'clear key' (ESC) first\n if( ( this.model.attributes.clear_key ) &&\n ( this.model.attributes.clear_key === evData.which ) ){\n this.clear();\n return false;\n }\n this.model.set(\"query\", this.$el.find(\":input\").val());\n }\n});\n\n/**\n * Tool panel view. Events triggered include:\n * tool_link_click(click event, tool_model)\n */\nvar ToolPanelView = Backbone.View.extend({\n tagName: 'div',\n className: 'toolMenu',\n\n /**\n * Set up view.\n */\n initialize: function() {\n this.model.get('tool_search').on(\"change:results\", this.handle_search_results, this);\n },\n\n render: function() {\n var self = this;\n\n // Render search.\n var search_view = new ToolSearchView( { model: this.model.get('tool_search') } );\n search_view.render();\n self.$el.append(search_view.$el);\n\n // Render panel.\n this.model.get('layout').each(function(panel_elt) {\n if (panel_elt instanceof ToolSection) {\n var section_title_view = new ToolSectionView({model: panel_elt});\n section_title_view.render();\n self.$el.append(section_title_view.$el);\n }\n else if (panel_elt instanceof Tool) {\n var tool_view = new ToolLinkView({model: panel_elt, className: \"toolTitleNoSection\"});\n tool_view.render();\n self.$el.append(tool_view.$el);\n }\n else if (panel_elt instanceof ToolSectionLabel) {\n var label_view = new ToolSectionLabelView({model: panel_elt});\n label_view.render();\n self.$el.append(label_view.$el);\n }\n });\n\n // Setup tool link click eventing.\n self.$el.find(\"a.tool-link\").click(function(e) {\n // Tool id is always the first class.\n var\n tool_id = $(this).attr('class').split(/\\s+/)[0],\n tool = self.model.get('tools').get(tool_id);\n\n self.trigger(\"tool_link_click\", e, tool);\n });\n\n return this;\n },\n\n handle_search_results: function() {\n var results = this.model.get('tool_search').get('results');\n if (results && results.length === 0) {\n $(\"#search-no-results\").show();\n }\n else {\n $(\"#search-no-results\").hide();\n }\n }\n});\n\n/**\n * View for working with a tool: setting parameters and inputs and executing the tool.\n */\nvar ToolFormView = Backbone.View.extend({\n className: 'toolForm',\n\n render: function() {\n this.$el.children().remove();\n this.$el.append( templates.tool_form(this.model.toJSON()) );\n }\n});\n\n/**\n * Integrated tool menu + tool execution.\n */\nvar IntegratedToolMenuAndView = Backbone.View.extend({\n className: 'toolMenuAndView',\n\n initialize: function() {\n this.tool_panel_view = new ToolPanelView({collection: this.collection});\n this.tool_form_view = new ToolFormView();\n },\n\n render: function() {\n // Render and append tool panel.\n this.tool_panel_view.render();\n this.tool_panel_view.$el.css(\"float\", \"left\");\n this.$el.append(this.tool_panel_view.$el);\n\n // Append tool form view.\n this.tool_form_view.$el.hide();\n this.$el.append(this.tool_form_view.$el);\n\n // On tool link click, show tool.\n var self = this;\n this.tool_panel_view.on(\"tool_link_click\", function(e, tool) {\n // Prevents click from activating link:\n e.preventDefault();\n // Show tool that was clicked on:\n self.show_tool(tool);\n });\n },\n\n /**\n * Fetch and display tool.\n */\n show_tool: function(tool) {\n var self = this;\n tool.fetch().done( function() {\n self.tool_form_view.model = tool;\n self.tool_form_view.render();\n self.tool_form_view.$el.show();\n $('#left').width(\"650px\");\n });\n }\n});\n\n// TODO: move into relevant views\nvar templates = {\n // the search bar at the top of the tool panel\n tool_search : _.template([\n '\" autocomplete=\"off\" type=\"text\" />',\n ' ',\n //TODO: replace with icon\n '',\n ].join('')),\n\n // the category level container in the tool panel (e.g. 'Get Data', 'Text Manipulation')\n panel_section : _.template([\n '
                                  \">',\n '<%- name %>',\n '
                                  ',\n '
                                  \" class=\"toolSectionBody\" style=\"display: none;\">',\n '
                                  ',\n '
                                  '\n ].join('')),\n\n // a single tool's link in the tool panel; will load the tool form in the center panel\n tool_link : _.template([\n ' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">',\n '',\n '<% _.each( labels, function( label ){ %>',\n '\">',\n '<%- label %>',\n '',\n '<% }); %>',\n '',\n '',\n '<%- name %>',\n '',\n ' <%- description %>',\n ''\n ].join('')),\n\n // the tool form for entering tool parameters, viewing help and executing the tool\n // loaded when a tool link is clicked in the tool panel\n tool_form : _.template([\n '
                                  <%- tool.name %> (version <%- tool.version %>)
                                  ',\n '
                                  ',\n '<% _.each( tool.inputs, function( input ){ %>',\n '
                                  ',\n '',\n '
                                  ',\n '<%= input.html %>',\n '
                                  ',\n '
                                  ',\n '<%- input.help %>',\n '
                                  ',\n '
                                  ',\n '
                                  ',\n '<% }); %>',\n '
                                  ',\n '
                                  ',\n '',\n '
                                  ',\n '
                                  ',\n '
                                  <% tool.help %>
                                  ',\n '
                                  ',\n // TODO: we need scoping here because 'help' is the dom for the help menu in the masthead\n // which implies a leaky variable that I can't find\n ].join(''), { variable: 'tool' }),\n};\n\n\n// Exports\nreturn {\n ToolParameter: ToolParameter,\n IntegerToolParameter: IntegerToolParameter,\n SelectToolParameter: SelectToolParameter,\n Tool: Tool,\n ToolCollection: ToolCollection,\n ToolSearch: ToolSearch,\n ToolPanel: ToolPanel,\n ToolPanelView: ToolPanelView,\n ToolFormView: ToolFormView\n};\n\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/tool/tools.js","/** This renders the content of the ftp popup **/\ndefine( [ 'utils/utils' ], function( Utils ) {\n return Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.options = Utils.merge( options, {\n class_add : 'upload-icon-button fa fa-square-o',\n class_remove : 'upload-icon-button fa fa-check-square-o',\n class_partial : 'upload-icon-button fa fa-minus-square-o',\n collection : null,\n onchange : function() {},\n onadd : function() {},\n onremove : function() {}\n } );\n this.collection = this.options.collection;\n this.setElement( this._template() );\n this.rows = [];\n Utils.get({\n url : Galaxy.root + 'api/remote_files',\n success : function( ftp_files ) { self._fill( ftp_files ) },\n error : function() { self._fill(); }\n });\n },\n\n /** Fill table with ftp entries */\n _fill: function( ftp_files ) {\n if ( ftp_files && ftp_files.length > 0 ) {\n this.$( '.upload-ftp-content' ).html( $( this._templateTable() ) );\n var size = 0;\n for (var index in ftp_files ) {\n this.rows.push( this._add( ftp_files[ index ] ) );\n size += ftp_files[ index ].size;\n }\n this.$( '.upload-ftp-number' ).html( ftp_files.length + ' files' );\n this.$( '.upload-ftp-disk' ).html( Utils.bytesToString ( size, true ) );\n if ( this.collection ) {\n var self = this;\n this.$( '._has_collection' ).show();\n this.$select_all = this.$( '.upload-selectall' ).addClass( this.options.class_add );\n this.$select_all.on( 'click', function() {\n var add = self.$select_all.hasClass( self.options.class_add );\n for (var index in ftp_files ) {\n var ftp_file = ftp_files[ index ];\n var model_index = self._find( ftp_file );\n if( !model_index && add || model_index && !add ) {\n self.rows[ index ].trigger( 'click' );\n }\n }\n });\n this._refresh();\n }\n } else {\n this.$( '.upload-ftp-content' ).html( $( this._templateInfo() ) );\n }\n this.$( '.upload-ftp-wait' ).hide();\n },\n\n /** Add file to table */\n _add: function( ftp_file ) {\n var self = this;\n var $it = $( this._templateRow( ftp_file ) );\n var $icon = $it.find( '.icon' );\n this.$( 'tbody' ).append( $it );\n if ( this.collection ) {\n $icon.addClass( this._find( ftp_file ) ? this.options.class_remove : this.options.class_add );\n $it.on('click', function() {\n var model_index = self._find( ftp_file );\n $icon.removeClass();\n if ( !model_index ) {\n self.options.onadd( ftp_file );\n $icon.addClass( self.options.class_remove );\n } else {\n self.options.onremove( model_index );\n $icon.addClass( self.options.class_add );\n }\n self._refresh();\n });\n } else {\n $it.on('click', function() { self.options.onchange( ftp_file ) } );\n }\n return $it;\n },\n\n /** Refresh select all button state */\n _refresh: function() {\n var filtered = this.collection.where( { file_mode: 'ftp', enabled: true } );\n this.$select_all.removeClass();\n if ( filtered.length == 0 ) {\n this.$select_all.addClass( this.options.class_add );\n } else {\n this.$select_all.addClass( filtered.length == this.rows.length ? this.options.class_remove : this.options.class_partial );\n }\n },\n\n /** Get model index */\n _find: function( ftp_file ) {\n var item = this.collection.findWhere({\n file_path : ftp_file.path,\n file_mode : 'ftp',\n enabled : true\n });\n return item && item.get('id');\n },\n\n /** Template of row */\n _templateRow: function( options ) {\n return '
                                  ' + _.escape(options.path) + '' + Utils.bytesToString( options.size ) + '' + options.ctime + '
                                  ' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '
                                  NameSizeCreated
                                  ';\n },\n\n /** Template of info message */\n _templateInfo: function() {\n return '
                                  ' +\n 'Your FTP directory does not contain any files.' +\n '
                                  ';\n },\n\n /** Template of main view */\n _template: function() {\n return '
                                  ' +\n '
                                  ' +\n '
                                  This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at ' + this.options.ftp_upload_site + ' using your Galaxy credentials (email address and password).
                                  ' +\n '
                                  ' +\n '
                                  ';\n }\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/upload/upload-ftp.js","/** This renders the content of the settings popup, allowing users to specify flags i.e. for space-to-tab conversion **/\ndefine( [ 'utils/utils' ], function( Utils ) {\n return Backbone.View.extend({\n options: {\n class_check : 'fa-check-square-o',\n class_uncheck : 'fa-square-o',\n parameters : [{\n id : 'space_to_tab',\n title : 'Convert spaces to tabs',\n },{\n id : 'to_posix_lines',\n title : 'Use POSIX standard'\n }]\n },\n\n initialize: function( options ) {\n var self = this;\n this.model = options.model;\n this.setElement( $( '
                                  ' ).addClass( 'upload-settings' ) );\n this.$el.append( $( '
                                  ' ).addClass( 'upload-settings-cover' ) );\n this.$el.append( $( '' ).addClass( 'upload-settings-table ui-table-striped' ).append( '' ) );\n this.$cover = this.$( '.upload-settings-cover' );\n this.$table = this.$( '.upload-settings-table > tbody' );\n this.listenTo ( this.model, 'change', this.render, this );\n this.model.trigger( 'change' );\n },\n\n render: function() {\n var self = this;\n this.$table.empty();\n _.each( this.options.parameters, function( parameter ) {\n var $checkbox = $( '
                                  ' ).addClass( 'upload-' + parameter.id + ' upload-icon-button fa' )\n .addClass( self.model.get( parameter.id ) && self.options.class_check || self.options.class_uncheck )\n .on( 'click', function() {\n self.model.get( 'enabled' ) && self.model.set( parameter.id, !self.model.get( parameter.id ) )\n });\n self.$table.append( $( '
                                  ' ).append( $( '' +\n '' +\n '' +\n '' );\n });\n $tmpl.append( $table );\n } else {\n $tmpl.append( 'No ' + this.model.get( 'plural' ).toLowerCase() + ' have been shared with you.' );\n }\n return $tmpl;\n }\n });\n\n return {\n View: View\n }\n});\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/grid/grid-shared.js","define([\n \"mvc/dataset/dataset-li-edit\",\n \"mvc/history/hda-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET_LI_EDIT, HDA_LI, BASE_MVC, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = DATASET_LI_EDIT.DatasetListItemEdit;\n/** @class Editing view for HistoryDatasetAssociation.\n */\nvar HDAListItemEdit = _super.extend(\n/** @lends HDAListItemEdit.prototype */{\n\n className : _super.prototype.className + \" history-content\",\n\n /** In this override, only get details if in the ready state, get rerunnable if in other states.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n\n // special case the need for the rerunnable and creating_job attributes\n // needed for rendering re-run button on queued, running datasets\n } else if( !view.model.has( 'rerunnable' ) ){\n return view.model.fetch({ silent: true, data: {\n // only fetch rerunnable and creating_job to keep overhead down\n keys: [ 'rerunnable', 'creating_job' ].join(',')\n }});\n }\n return jQuery.when();\n },\n\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .unhide-link' : function( ev ){ this.model.unhide(); return false; }\n }),\n\n /** string rep */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDAListItemEdit(' + modelString + ')';\n }\n});\n\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nHDAListItemEdit.prototype.templates = (function(){\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n hidden : BASE_MVC.wrapTemplate([\n '<% if( !dataset.visible ){ %>',\n // add a link to unhide a dataset\n '
                                  ',\n _l( 'This dataset has been hidden' ),\n '
                                  ', _l( 'Unhide it' ), '',\n '
                                  ',\n '<% } %>'\n ], 'dataset' )\n });\n\n return _.extend( {}, _super.prototype.templates, {\n //NOTE: *steal* the HDAListItemView titleBar\n titleBar : HDA_LI.HDAListItemView.prototype.templates.titleBar,\n warnings : warnings\n });\n}());\n\n\n//==============================================================================\n return {\n HDAListItemEdit : HDAListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hda-li-edit.js","define([\n \"mvc/history/hdca-li\",\n \"mvc/collection/collection-view-edit\",\n \"ui/fa-icon-button\",\n \"utils/localization\"\n], function( HDCA_LI, DC_VIEW_EDIT, faIconButton, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = HDCA_LI.HDCAListItemView;\n/** @class Editing view for HistoryDatasetCollectionAssociation.\n */\nvar HDCAListItemEdit = _super.extend(\n/** @lends HDCAListItemEdit.prototype */{\n\n /** logger used to record this.log messages, commonly set to console */\n //logger : console,\n\n /** Override to return editable versions of the collection panels */\n _getFoldoutPanelClass : function(){\n switch( this.model.get( 'collection_type' ) ){\n case 'list':\n return DC_VIEW_EDIT.ListCollectionViewEdit;\n case 'paired':\n return DC_VIEW_EDIT.PairCollectionViewEdit;\n case 'list:paired':\n return DC_VIEW_EDIT.ListOfPairsCollectionViewEdit;\n case 'list:list':\n return DC_VIEW_EDIT.ListOfListsCollectionViewEdit;\n }\n throw new TypeError( 'Uknown collection_type: ' + this.model.get( 'collection_type' ) );\n },\n\n // ......................................................................... delete\n /** In this override, add the delete button. */\n _renderPrimaryActions : function(){\n this.log( this + '._renderPrimaryActions' );\n // render the display, edit attr and delete icon-buttons\n return _super.prototype._renderPrimaryActions.call( this )\n .concat([\n this._renderDeleteButton()\n ]);\n },\n\n /** Render icon-button to delete this collection. */\n _renderDeleteButton : function(){\n var self = this,\n deleted = this.model.get( 'deleted' );\n return faIconButton({\n title : deleted? _l( 'Dataset collection is already deleted' ): _l( 'Delete' ),\n classes : 'delete-btn',\n faIcon : 'fa-times',\n disabled : deleted,\n onclick : function() {\n // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n self.$el.find( '.icon-btn.delete-btn' ).trigger( 'mouseout' );\n self.model[ 'delete' ]();\n }\n });\n },\n\n // ......................................................................... misc\n /** string rep */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDCAListItemEdit(' + modelString + ')';\n }\n});\n\n//==============================================================================\n return {\n HDCAListItemEdit : HDCAListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hdca-li-edit.js","/** This class renders the grid list. */\ndefine( [ 'utils/utils', 'mvc/grid/grid-view', 'mvc/history/history-model', 'mvc/history/copy-dialog' ], function( Utils, GridView, HistoryModel, historyCopyDialog ) {\n\n var View = Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.setElement( $( '
                                  ' ) );\n this.model = new Backbone.Model();\n Utils.get({\n url : Galaxy.root + 'history/' + options.action_id,\n success : function( response ) {\n response[ 'dict_format' ] = true;\n _.each( response[ 'operations' ], function( operation ) {\n if ( operation.label == 'Copy' ) {\n operation.onclick = function( id ) { self._showCopyDialog( id ) };\n }\n });\n self.model.set( response );\n self.render();\n }\n });\n },\n\n render: function() {\n var grid = new GridView( this.model.attributes );\n this.$el.empty().append( grid.$el );\n },\n\n _showCopyDialog: function( id ) {\n var history = new HistoryModel.History( { id : id } );\n history.fetch()\n .fail( function() {\n alert( 'History could not be fetched. Please contact an administrator' );\n })\n .done( function(){\n historyCopyDialog( history, {} ).done( function() {\n if( window.parent && window.parent.Galaxy && window.parent.Galaxy.currHistoryPanel ) {\n window.parent.Galaxy.currHistoryPanel.loadCurrentHistory();\n }\n window.location.reload( true );\n } );\n });\n }\n });\n\n return {\n View: View\n }\n});\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-list.js","define([\n \"mvc/history/history-model\",\n \"mvc/history/history-view-edit\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( HISTORY_MODEL, HISTORY_VIEW_EDIT, BASE_MVC, _l ){\n\n'use strict';\n\n// ============================================================================\n/** session storage for history panel preferences (and to maintain state)\n */\nvar HistoryViewPrefs = BASE_MVC.SessionStorageModel.extend(\n/** @lends HistoryViewPrefs.prototype */{\n defaults : {\n /** should the tags editor be shown or hidden initially? */\n tagsEditorShown : false,\n /** should the annotation editor be shown or hidden initially? */\n annotationEditorShown : false,\n ///** what is the currently focused content (dataset or collection) in the current history?\n // * (the history panel will highlight and scroll to the focused content view)\n // */\n //focusedContentId : null\n /** Current scroll position */\n scrollPosition : 0\n },\n toString : function(){\n return 'HistoryViewPrefs(' + JSON.stringify( this.toJSON() ) + ')';\n }\n});\n\n/** key string to store panel prefs (made accessible on class so you can access sessionStorage directly) */\nHistoryViewPrefs.storageKey = function storageKey(){\n return ( 'history-panel' );\n};\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\nvar _super = HISTORY_VIEW_EDIT.HistoryViewEdit;\n// used in root/index.mako\n/** @class View/Controller for the user's current history model as used in the history\n * panel (current right hand panel) of the analysis page.\n *\n * The only history panel that:\n * will poll for updates.\n * displays datasets in reverse hid order.\n */\nvar CurrentHistoryView = _super.extend(/** @lends CurrentHistoryView.prototype */{\n\n className : _super.prototype.className + ' current-history-panel',\n\n /** override to use drilldown (and not foldout) for how collections are displayed */\n HDCAViewClass : _super.prototype.HDCAViewClass.extend({\n foldoutStyle : 'drilldown'\n }),\n\n emptyMsg : [\n _l( 'This history is empty' ), '. ',\n _l( 'You can ' ),\n '',\n _l( 'load your own data' ),\n '',\n _l( ' or ' ),\n '',\n _l( 'get data from an external source' ),\n ''\n ].join(''),\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events */\n initialize : function( attributes ){\n attributes = attributes || {};\n\n // ---- persistent preferences\n /** maintain state / preferences over page loads */\n this.preferences = new HistoryViewPrefs( _.extend({\n id : HistoryViewPrefs.storageKey()\n }, _.pick( attributes, _.keys( HistoryViewPrefs.prototype.defaults ) )));\n\n _super.prototype.initialize.call( this, attributes );\n\n /** sub-views that will overlay this panel (collections) */\n this.panelStack = [];\n\n /** id of currently focused content */\n this.currentContentId = attributes.currentContentId || null;\n //NOTE: purposely not sent to localstorage since panel recreation roughly lines up with a reset of this value\n },\n\n /** Override to cache the current scroll position with a listener */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n\n var panel = this;\n // reset scroll position when there's a new history\n this.on( 'new-model', function(){\n panel.preferences.set( 'scrollPosition', 0 );\n });\n },\n\n // ------------------------------------------------------------------------ loading history/item models\n // TODO: next three more appropriate moved to the app level\n /** (re-)loads the user's current history & contents w/ details */\n loadCurrentHistory : function(){\n return this.loadHistory( null, { url : Galaxy.root + 'history/current_history_json' });\n },\n\n /** loads a history & contents w/ details and makes them the current history */\n switchToHistory : function( historyId, attributes ){\n if( Galaxy.user.isAnonymous() ){\n this.trigger( 'error', _l( 'You must be logged in to switch histories' ), _l( 'Anonymous user' ) );\n return $.when();\n }\n return this.loadHistory( historyId, { url : Galaxy.root + 'history/set_as_current?id=' + historyId });\n },\n\n /** creates a new history on the server and sets it as the user's current history */\n createNewHistory : function( attributes ){\n if( Galaxy.user.isAnonymous() ){\n this.trigger( 'error', _l( 'You must be logged in to create histories' ), _l( 'Anonymous user' ) );\n return $.when();\n }\n return this.loadHistory( null, { url : Galaxy.root + 'history/create_new_current' });\n },\n\n /** release/free/shutdown old models and set up panel for new models */\n setModel : function( model, attributes, render ){\n _super.prototype.setModel.call( this, model, attributes, render );\n if( this.model && this.model.id ){\n this.log( 'checking for updates' );\n this.model.checkForUpdates();\n }\n return this;\n },\n\n // ------------------------------------------------------------------------ history/content event listening\n /** listening for history events */\n _setUpModelListeners : function(){\n _super.prototype._setUpModelListeners.call( this );\n // re-broadcast any model change events so that listeners don't have to re-bind to each history\n return this.listenTo( this.model, {\n 'change:nice_size change:size' : function(){\n this.trigger( 'history-size-change', this, this.model, arguments );\n },\n 'change:id' : function(){\n this.once( 'loading-done', function(){ this.model.checkForUpdates(); });\n }\n });\n },\n\n /** listening for collection events */\n _setUpCollectionListeners : function(){\n _super.prototype._setUpCollectionListeners.call( this );\n // if a hidden item is created (gen. by a workflow), moves thru the updater to the ready state,\n // then: remove it from the collection if the panel is set to NOT show hidden datasets\n this.listenTo( this.collection, 'state:ready', function( model, newState, oldState ){\n if( ( !model.get( 'visible' ) )\n && ( !this.collection.storage.includeHidden() ) ){\n this.removeItemView( model );\n }\n });\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** override to add a handler to capture the scroll position when the parent scrolls */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n // console.log( '_setUpBehaviors', this.$scrollContainer( $where ).get(0), this.$list( $where ) );\n // we need to call this in _setUpBehaviors which is called after render since the $el\n // may not be attached to $el.parent and $scrollContainer() may not work\n var panel = this;\n _super.prototype._setUpBehaviors.call( panel, $where );\n\n // cache the handler to remove and re-add so we don't pile up the handlers\n if( !this._debouncedScrollCaptureHandler ){\n this._debouncedScrollCaptureHandler = _.debounce( function scrollCapture(){\n // cache the scroll position (only if visible)\n if( panel.$el.is( ':visible' ) ){\n panel.preferences.set( 'scrollPosition', $( this ).scrollTop() );\n }\n }, 40 );\n }\n\n panel.$scrollContainer( $where )\n .off( 'scroll', this._debouncedScrollCaptureHandler )\n .on( 'scroll', this._debouncedScrollCaptureHandler );\n return panel;\n },\n\n /** In this override, handle null models and move the search input to the top */\n _buildNewRender : function(){\n if( !this.model ){ return $(); }\n var $newRender = _super.prototype._buildNewRender.call( this );\n $newRender.find( '.search' ).prependTo( $newRender.find( '> .controls' ) );\n this._renderQuotaMessage( $newRender );\n return $newRender;\n },\n\n /** render the message displayed when a user is over quota and can't run jobs */\n _renderQuotaMessage : function( $whereTo ){\n $whereTo = $whereTo || this.$el;\n return $( this.templates.quotaMsg( {}, this ) ).prependTo( $whereTo.find( '.messages' ) );\n },\n\n /** In this override, get and set current panel preferences when editor is used */\n _renderTags : function( $where ){\n var panel = this;\n // render tags and show/hide based on preferences\n _super.prototype._renderTags.call( panel, $where );\n if( panel.preferences.get( 'tagsEditorShown' ) ){\n panel.tagsEditor.toggle( true );\n }\n // store preference when shown or hidden\n panel.listenTo( panel.tagsEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden',\n function( tagsEditor ){\n panel.preferences.set( 'tagsEditorShown', tagsEditor.hidden );\n }\n );\n },\n\n /** In this override, get and set current panel preferences when editor is used */\n _renderAnnotation : function( $where ){\n var panel = this;\n // render annotation and show/hide based on preferences\n _super.prototype._renderAnnotation.call( panel, $where );\n if( panel.preferences.get( 'annotationEditorShown' ) ){\n panel.annotationEditor.toggle( true );\n }\n // store preference when shown or hidden\n panel.listenTo( panel.annotationEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden',\n function( annotationEditor ){\n panel.preferences.set( 'annotationEditorShown', annotationEditor.hidden );\n }\n );\n },\n\n /** Override to scroll to cached position (in prefs) after swapping */\n _swapNewRender : function( $newRender ){\n _super.prototype._swapNewRender.call( this, $newRender );\n var panel = this;\n _.delay( function(){\n var pos = panel.preferences.get( 'scrollPosition' );\n if( pos ){\n panel.scrollTo( pos, 0 );\n }\n }, 10 );\n //TODO: is this enough of a delay on larger histories?\n\n return this;\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** Override to add the current-content highlight class to currentContentId's view */\n _attachItems : function( $whereTo ){\n _super.prototype._attachItems.call( this, $whereTo );\n var panel = this;\n if( panel.currentContentId ){\n panel._setCurrentContentById( panel.currentContentId );\n }\n return this;\n },\n\n /** Override to remove any drill down panels */\n addItemView : function( model, collection, options ){\n var view = _super.prototype.addItemView.call( this, model, collection, options );\n if( !view ){ return view; }\n if( this.panelStack.length ){ return this._collapseDrilldownPanel(); }\n return view;\n },\n\n // ------------------------------------------------------------------------ collection sub-views\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n _super.prototype._setUpItemViewListeners.call( panel, view );\n // use pub-sub to: handle drilldown expansion and collapse\n return panel.listenTo( view, {\n 'expanded:drilldown' : function( v, drilldown ){\n this._expandDrilldownPanel( drilldown );\n },\n 'collapsed:drilldown' : function( v, drilldown ){\n this._collapseDrilldownPanel( drilldown );\n },\n });\n },\n\n /** display 'current content': add a visible highlight and store the id of a content item */\n setCurrentContent : function( view ){\n this.$( '.history-content.current-content' ).removeClass( 'current-content' );\n if( view ){\n view.$el.addClass( 'current-content' );\n this.currentContentId = view.model.id;\n } else {\n this.currentContentId = null;\n }\n },\n\n /** find the view with the id and then call setCurrentContent on it */\n _setCurrentContentById : function( id ){\n var view = this.viewFromModelId( id ) || null;\n this.setCurrentContent( view );\n },\n\n /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n _expandDrilldownPanel : function( drilldown ){\n this.panelStack.push( drilldown );\n // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n this.$controls().add( this.$list() ).hide();\n drilldown.parentName = this.model.get( 'name' );\n drilldown.delegateEvents().render().$el.appendTo( this.$el );\n },\n\n /** Handle drilldown close by freeing the panel and re-rendering this panel */\n _collapseDrilldownPanel : function( drilldown ){\n this.panelStack.pop();\n //TODO: MEM: free the panel\n this.$controls().add( this.$list() ).show();\n },\n\n // ........................................................................ panel events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n // the two links in the empty message\n 'click .uploader-link' : function( ev ){ Galaxy.upload.show( ev ); },\n 'click .get-data-link' : function( ev ){\n var $toolMenu = $( '.toolMenuContainer' );\n $toolMenu.parent().scrollTop( 0 );\n $toolMenu.find( 'span:contains(\"Get Data\")' ).click();\n }\n }),\n\n // ........................................................................ external objects/MVC\n listenToGalaxy : function( galaxy ){\n this.listenTo( galaxy, {\n // when the galaxy_main iframe is loaded with a new page,\n // compare the url to the following list and if there's a match\n // pull the id from url and indicate in the history view that\n // the dataset with that id is the 'current'ly active dataset\n 'center-frame:load': function( data ){\n var pathToMatch = data.fullpath;\n var hdaId = null;\n var useToURLRegexMap = {\n 'display' : /datasets\\/([a-f0-9]+)\\/display/,\n 'edit' : /datasets\\/([a-f0-9]+)\\/edit/,\n 'report_error' : /dataset\\/errors\\?id=([a-f0-9]+)/,\n 'rerun' : /tool_runner\\/rerun\\?id=([a-f0-9]+)/,\n 'show_params' : /datasets\\/([a-f0-9]+)\\/show_params/,\n // no great way to do this here? (leave it in the dataset event handlers above?)\n // 'visualization' : 'visualization',\n };\n _.find( useToURLRegexMap, function( regex, use ){\n // grab the more specific match result (1), save, and use it as the find flag\n hdaId = _.result( pathToMatch.match( regex ), 1 );\n return hdaId;\n });\n // need to type mangle to go from web route to history contents\n this._setCurrentContentById( hdaId? ( 'dataset-' + hdaId ) : null );\n },\n // when the center panel is given a new view, clear the current indicator\n 'center-panel:load': function( view ){\n this._setCurrentContentById();\n }\n });\n },\n\n //TODO: remove quota meter from panel and remove this\n /** add listeners to an external quota meter (mvc/user/user-quotameter.js) */\n connectToQuotaMeter : function( quotaMeter ){\n if( !quotaMeter ){\n return this;\n }\n // show/hide the 'over quota message' in the history when the meter tells it to\n this.listenTo( quotaMeter, 'quota:over', this.showQuotaMessage );\n this.listenTo( quotaMeter, 'quota:under', this.hideQuotaMessage );\n\n // having to add this to handle re-render of hview while overquota (the above do not fire)\n this.on( 'rendered rendered:initial', function(){\n if( quotaMeter && quotaMeter.isOverQuota() ){\n this.showQuotaMessage();\n }\n });\n return this;\n },\n\n /** Override to preserve the quota message */\n clearMessages : function( ev ){\n var $target = !_.isUndefined( ev )?\n $( ev.currentTarget )\n :this.$messages().children( '[class$=\"message\"]' );\n $target = $target.not( '.quota-message' );\n $target.fadeOut( this.fxSpeed, function(){\n $( this ).remove();\n });\n return this;\n },\n\n /** Show the over quota message (which happens to be in the history panel).\n */\n showQuotaMessage : function(){\n var $msg = this.$( '.quota-message' );\n if( $msg.is( ':hidden' ) ){ $msg.slideDown( this.fxSpeed ); }\n },\n\n /** Hide the over quota message (which happens to be in the history panel).\n */\n hideQuotaMessage : function(){\n var $msg = this.$( '.quota-message' );\n if( !$msg.is( ':hidden' ) ){ $msg.slideUp( this.fxSpeed ); }\n },\n\n // ........................................................................ options menu\n //TODO: remove to batch\n /** unhide any hidden datasets */\n unhideHidden : function() {\n var self = this;\n if( confirm( _l( 'Really unhide all hidden datasets?' ) ) ){\n // get all hidden, regardless of deleted/purged\n return self.model.contents._filterAndUpdate(\n { visible: false, deleted: '', purged: '' },\n { visible : true }\n ).done( function(){\n // TODO: would be better to render these as they're unhidden instead of all at once\n if( !self.model.contents.includeHidden ){\n self.renderItems();\n }\n });\n }\n return jQuery.when();\n },\n\n /** delete any hidden datasets */\n deleteHidden : function() {\n var self = this;\n if( confirm( _l( 'Really delete all hidden datasets?' ) ) ){\n return self.model.contents._filterAndUpdate(\n // get all hidden, regardless of deleted/purged\n { visible: false, deleted: '', purged: '' },\n // both delete *and* unhide them\n { deleted : true, visible: true }\n );\n }\n return jQuery.when();\n },\n\n /** Return a string rep of the history */\n toString : function(){\n return 'CurrentHistoryView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//------------------------------------------------------------------------------ TEMPLATES\nCurrentHistoryView.prototype.templates = (function(){\n\n var quotaMsgTemplate = BASE_MVC.wrapTemplate([\n '
                                  ',\n _l( 'You are over your disk quota' ), '. ',\n _l( 'Tool execution is on hold until your disk usage drops below your allocated quota' ), '.',\n '
                                  '\n ], 'history' );\n return _.extend( _.clone( _super.prototype.templates ), {\n quotaMsg : quotaMsgTemplate\n });\n\n}());\n\n\n//==============================================================================\n return {\n CurrentHistoryView : CurrentHistoryView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-view-edit-current.js","define([\n \"mvc/history/history-view\",\n \"mvc/history/history-contents\",\n \"mvc/dataset/states\",\n \"mvc/history/hda-model\",\n \"mvc/history/hda-li-edit\",\n \"mvc/history/hdca-li-edit\",\n \"mvc/tag\",\n \"mvc/annotation\",\n \"mvc/collection/list-collection-creator\",\n \"mvc/collection/pair-collection-creator\",\n \"mvc/collection/list-of-pairs-collection-creator\",\n \"ui/fa-icon-button\",\n \"mvc/ui/popup-menu\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function(\n HISTORY_VIEW,\n HISTORY_CONTENTS,\n STATES,\n HDA_MODEL,\n HDA_LI_EDIT,\n HDCA_LI_EDIT,\n TAGS,\n ANNOTATIONS,\n LIST_COLLECTION_CREATOR,\n PAIR_COLLECTION_CREATOR,\n LIST_OF_PAIRS_COLLECTION_CREATOR,\n faIconButton,\n PopupMenu,\n BASE_MVC,\n _l\n){\n\n'use strict';\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\nvar _super = HISTORY_VIEW.HistoryView;\n// base class for history-view-edit-current and used as-is in history/view.mako\n/** @class Editable View/Controller for the history model.\n *\n * Allows:\n * (everything HistoryView allows)\n * changing the name\n * displaying and editing tags and annotations\n * multi-selection and operations on mulitple content items\n */\nvar HistoryViewEdit = _super.extend(\n/** @lends HistoryViewEdit.prototype */{\n\n /** class to use for constructing the HistoryDatasetAssociation views */\n HDAViewClass : HDA_LI_EDIT.HDAListItemEdit,\n /** class to use for constructing the HistoryDatasetCollectionAssociation views */\n HDCAViewClass : HDCA_LI_EDIT.HDCAListItemEdit,\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes\n */\n initialize : function( attributes ){\n attributes = attributes || {};\n _super.prototype.initialize.call( this, attributes );\n\n // ---- set up instance vars\n /** editor for tags - sub-view */\n this.tagsEditor = null;\n\n /** enable drag and drop - sub-view */\n this.dragItems = true;\n\n /** editor for annotations - sub-view */\n this.annotationEditor = null;\n\n /** allow user purge of dataset files? */\n this.purgeAllowed = attributes.purgeAllowed || false;\n\n // states/modes the panel can be in\n /** is the panel currently showing the dataset selection controls? */\n this.annotationEditorShown = attributes.annotationEditorShown || false;\n this.tagsEditorShown = attributes.tagsEditorShown || false;\n },\n\n /** Override to handle history as drag-drop target */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n return this.on({\n 'droptarget:drop': function( ev, data ){\n // process whatever was dropped and re-hide the drop target\n this.dataDropped( data );\n this.dropTargetOff();\n },\n 'view:attached view:removed': function(){\n this._renderCounts();\n },\n 'search:loading-progress': this._renderSearchProgress,\n 'search:searching': this._renderSearchFindings,\n });\n },\n\n // ------------------------------------------------------------------------ listeners\n /** listening for history and HDA events */\n _setUpModelListeners : function(){\n _super.prototype._setUpModelListeners.call( this );\n this.listenTo( this.model, 'change:size', this.updateHistoryDiskSize );\n return this;\n },\n\n /** listening for collection events */\n _setUpCollectionListeners : function(){\n _super.prototype._setUpCollectionListeners.call( this );\n this.listenTo( this.collection, {\n 'change:deleted': this._handleItemDeletedChange,\n 'change:visible': this._handleItemVisibleChange,\n 'change:purged' : function( model ){\n // hafta get the new nice-size w/o the purged model\n this.model.fetch();\n },\n // loading indicators for deleted/hidden\n 'fetching-deleted' : function( collection ){\n this.$( '> .controls .deleted-count' )\n .html( '' + _l( 'loading...' ) + '' );\n },\n 'fetching-hidden' : function( collection ){\n this.$( '> .controls .hidden-count' )\n .html( '' + _l( 'loading...' ) + '' );\n },\n 'fetching-deleted-done fetching-hidden-done' : this._renderCounts,\n });\n return this;\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** In this override, add tag and annotation editors and a btn to toggle the selectors */\n _buildNewRender : function(){\n // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n var $newRender = _super.prototype._buildNewRender.call( this );\n if( !this.model ){ return $newRender; }\n\n if( Galaxy && Galaxy.user && Galaxy.user.id && Galaxy.user.id === this.model.get( 'user_id' ) ){\n this._renderTags( $newRender );\n this._renderAnnotation( $newRender );\n }\n return $newRender;\n },\n\n /** Update the history size display (curr. upper right of panel). */\n updateHistoryDiskSize : function(){\n this.$( '.history-size' ).text( this.model.get( 'nice_size' ) );\n },\n\n /** override to render counts when the items are rendered */\n renderItems : function( $whereTo ){\n var views = _super.prototype.renderItems.call( this, $whereTo );\n if( !this.searchFor ){ this._renderCounts( $whereTo ); }\n return views;\n },\n\n /** override to show counts, what's deleted/hidden, and links to toggle those */\n _renderCounts : function( $whereTo ){\n $whereTo = $whereTo instanceof jQuery? $whereTo : this.$el;\n var html = this.templates.counts( this.model.toJSON(), this );\n return $whereTo.find( '> .controls .subtitle' ).html( html );\n },\n\n /** render the tags sub-view controller */\n _renderTags : function( $where ){\n var panel = this;\n this.tagsEditor = new TAGS.TagsEditor({\n model : this.model,\n el : $where.find( '.controls .tags-display' ),\n onshowFirstTime : function(){ this.render(); },\n // show hide sub-view tag editors when this is shown/hidden\n onshow : function(){\n panel.toggleHDATagEditors( true, panel.fxSpeed );\n },\n onhide : function(){\n panel.toggleHDATagEditors( false, panel.fxSpeed );\n },\n $activator : faIconButton({\n title : _l( 'Edit history tags' ),\n classes : 'history-tag-btn',\n faIcon : 'fa-tags'\n }).appendTo( $where.find( '.controls .actions' ) )\n });\n },\n /** render the annotation sub-view controller */\n _renderAnnotation : function( $where ){\n var panel = this;\n this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n model : this.model,\n el : $where.find( '.controls .annotation-display' ),\n onshowFirstTime : function(){ this.render(); },\n // show hide sub-view view annotation editors when this is shown/hidden\n onshow : function(){\n panel.toggleHDAAnnotationEditors( true, panel.fxSpeed );\n },\n onhide : function(){\n panel.toggleHDAAnnotationEditors( false, panel.fxSpeed );\n },\n $activator : faIconButton({\n title : _l( 'Edit history annotation' ),\n classes : 'history-annotate-btn',\n faIcon : 'fa-comment'\n }).appendTo( $where.find( '.controls .actions' ) )\n });\n },\n\n /** Set up HistoryViewEdit js/widget behaviours\n * In this override, make the name editable\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n _super.prototype._setUpBehaviors.call( this, $where );\n if( !this.model ){ return; }\n\n // anon users shouldn't have access to any of the following\n if( ( !Galaxy.user || Galaxy.user.isAnonymous() )\n || ( Galaxy.user.id !== this.model.get( 'user_id' ) ) ){\n return;\n }\n\n var panel = this,\n nameSelector = '> .controls .name';\n $where.find( nameSelector )\n .attr( 'title', _l( 'Click to rename history' ) )\n .tooltip({ placement: 'bottom' })\n .make_text_editable({\n on_finish: function( newName ){\n var previousName = panel.model.get( 'name' );\n if( newName && newName !== previousName ){\n panel.$el.find( nameSelector ).text( newName );\n panel.model.save({ name: newName })\n .fail( function(){\n panel.$el.find( nameSelector ).text( panel.model.previous( 'name' ) );\n });\n } else {\n panel.$el.find( nameSelector ).text( previousName );\n }\n }\n });\n },\n\n /** return a new popup menu for choosing a multi selection action\n * ajax calls made for multiple datasets are queued\n */\n multiselectActions : function(){\n var panel = this,\n actions = [\n { html: _l( 'Hide datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.hide;\n panel.getSelectedModels().ajaxQueue( action );\n }\n },\n { html: _l( 'Unhide datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.unhide;\n panel.getSelectedModels().ajaxQueue( action );\n }\n },\n { html: _l( 'Delete datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype['delete'];\n panel.getSelectedModels().ajaxQueue( action );\n }\n },\n { html: _l( 'Undelete datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.undelete;\n panel.getSelectedModels().ajaxQueue( action );\n }\n }\n ];\n if( panel.purgeAllowed ){\n actions.push({\n html: _l( 'Permanently delete datasets' ), func: function(){\n if( confirm( _l( 'This will permanently remove the data in your datasets. Are you sure?' ) ) ){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.purge;\n panel.getSelectedModels().ajaxQueue( action );\n }\n }\n });\n }\n actions = actions.concat( panel._collectionActions() );\n return actions;\n },\n\n /** */\n _collectionActions : function(){\n var panel = this;\n return [\n { html: _l( 'Build Dataset List' ), func: function() { panel.buildCollection( \"list\") }\n },\n // TODO: Only show quick pair if two things selected.\n { html: _l( 'Build Dataset Pair' ), func: function() { panel.buildCollection( \"paired\") }\n },\n { html: _l( 'Build List of Dataset Pairs' ), func: function() { panel.buildCollection( \"list:paired\" ) }\n },\n ];\n },\n\n buildCollection : function( collectionType, selection, hideSourceItems ) {\n var panel = this;\n var selection = selection || panel.getSelectedModels();\n var hideSourceItems = hideSourceItems || false;\n var createFunc;\n if( collectionType == \"list\" ) {\n createFunc = LIST_COLLECTION_CREATOR.createListCollection;\n } else if( collectionType == \"paired\" ) {\n createFunc = PAIR_COLLECTION_CREATOR.createPairCollection;\n } else if( collectionType == \"list:paired\" ) {\n createFunc = LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection;\n } else {\n console.warn( \"Unknown collectionType encountered \" + collectionType );\n }\n createFunc( selection, hideSourceItems ).done( function() { panel.model.refresh() } );\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** In this override, add purgeAllowed and whether tags/annotation editors should be shown */\n _getItemViewOptions : function( model ){\n var options = _super.prototype._getItemViewOptions.call( this, model );\n _.extend( options, {\n purgeAllowed : this.purgeAllowed,\n tagsEditorShown : ( this.tagsEditor && !this.tagsEditor.hidden ),\n annotationEditorShown : ( this.annotationEditor && !this.annotationEditor.hidden )\n });\n return options;\n },\n\n /** If this item is deleted and we're not showing deleted items, remove the view\n * @param {Model} the item model to check\n */\n _handleItemDeletedChange : function( itemModel ){\n if( itemModel.get( 'deleted' ) ){\n this._handleItemDeletion( itemModel );\n } else {\n this._handleItemUndeletion( itemModel );\n }\n this._renderCounts();\n },\n\n _handleItemDeletion : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.deleted += 1;\n contentsShown.active -= 1;\n if( !this.model.contents.includeDeleted ){\n this.removeItemView( itemModel );\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n _handleItemUndeletion : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.deleted -= 1;\n if( !this.model.contents.includeDeleted ){\n contentsShown.active -= 1;\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n /** If this item is hidden and we're not showing hidden items, remove the view\n * @param {Model} the item model to check\n */\n _handleItemVisibleChange : function( itemModel ){\n if( itemModel.hidden() ){\n this._handleItemHidden( itemModel );\n } else {\n this._handleItemUnhidden( itemModel );\n }\n this._renderCounts();\n },\n\n _handleItemHidden : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.hidden += 1;\n contentsShown.active -= 1;\n if( !this.model.contents.includeHidden ){\n this.removeItemView( itemModel );\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n _handleItemUnhidden : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.hidden -= 1;\n if( !this.model.contents.includeHidden ){\n contentsShown.active -= 1;\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n /** toggle the visibility of each content's tagsEditor applying all the args sent to this function */\n toggleHDATagEditors : function( showOrHide, speed ){\n _.each( this.views, function( view ){\n if( view.tagsEditor ){\n view.tagsEditor.toggle( showOrHide, speed );\n }\n });\n },\n\n /** toggle the visibility of each content's annotationEditor applying all the args sent to this function */\n toggleHDAAnnotationEditors : function( showOrHide, speed ){\n _.each( this.views, function( view ){\n if( view.annotationEditor ){\n view.annotationEditor.toggle( showOrHide, speed );\n }\n });\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .show-selectors-btn' : 'toggleSelectors',\n 'click .toggle-deleted-link' : function( ev ){ this.toggleShowDeleted(); },\n 'click .toggle-hidden-link' : function( ev ){ this.toggleShowHidden(); }\n }),\n\n // ------------------------------------------------------------------------ search\n _renderSearchProgress : function( limit, offset ){\n var stop = limit + offset;\n return this.$( '> .controls .subtitle' ).html([\n '',\n _l( 'Searching ' ), stop, '/', this.model.contentsShown(),\n ''\n ].join(''));\n },\n\n /** override to display number found in subtitle */\n _renderSearchFindings : function(){\n this.$( '> .controls .subtitle' ).html([\n _l( 'Found' ), this.views.length\n ].join(' '));\n return this;\n },\n\n // ------------------------------------------------------------------------ as drop target\n /** turn all the drag and drop handlers on and add some help text above the drop area */\n dropTargetOn : function(){\n if( this.dropTarget ){ return this; }\n this.dropTarget = true;\n\n //TODO: to init\n var dropHandlers = {\n 'dragenter' : _.bind( this.dragenter, this ),\n 'dragover' : _.bind( this.dragover, this ),\n 'dragleave' : _.bind( this.dragleave, this ),\n 'drop' : _.bind( this.drop, this )\n };\n\n var $dropTarget = this._renderDropTarget();\n this.$list().before([ this._renderDropTargetHelp(), $dropTarget ]);\n for( var evName in dropHandlers ){\n if( dropHandlers.hasOwnProperty( evName ) ){\n //console.debug( evName, dropHandlers[ evName ] );\n $dropTarget.on( evName, dropHandlers[ evName ] );\n }\n }\n return this;\n },\n\n /** render a box to serve as a 'drop here' area on the history */\n _renderDropTarget : function(){\n this.$( '.history-drop-target' ).remove();\n return $( '
                                  ' ).addClass( 'history-drop-target' );\n },\n\n /** tell the user how it works */\n _renderDropTargetHelp : function(){\n this.$( '.history-drop-target-help' ).remove();\n return $( '
                                  ' ).addClass( 'history-drop-target-help' )\n .text( _l( 'Drag datasets here to copy them to the current history' ) );\n },\n\n /** shut down drag and drop event handlers and remove drop target */\n dropTargetOff : function(){\n if( !this.dropTarget ){ return this; }\n //this.log( 'dropTargetOff' );\n this.dropTarget = false;\n var dropTarget = this.$( '.history-drop-target' ).get(0);\n for( var evName in this._dropHandlers ){\n if( this._dropHandlers.hasOwnProperty( evName ) ){\n dropTarget.off( evName, this._dropHandlers[ evName ] );\n }\n }\n this.$( '.history-drop-target' ).remove();\n this.$( '.history-drop-target-help' ).remove();\n return this;\n },\n /** toggle the target on/off */\n dropTargetToggle : function(){\n if( this.dropTarget ){\n this.dropTargetOff();\n } else {\n this.dropTargetOn();\n }\n return this;\n },\n\n dragenter : function( ev ){\n //console.debug( 'dragenter:', this, ev );\n ev.preventDefault();\n ev.stopPropagation();\n this.$( '.history-drop-target' ).css( 'border', '2px solid black' );\n },\n dragover : function( ev ){\n ev.preventDefault();\n ev.stopPropagation();\n },\n dragleave : function( ev ){\n //console.debug( 'dragleave:', this, ev );\n ev.preventDefault();\n ev.stopPropagation();\n this.$( '.history-drop-target' ).css( 'border', '1px dashed black' );\n },\n /** when (text) is dropped try to parse as json and trigger an event */\n drop : function( ev ){\n ev.preventDefault();\n //ev.stopPropagation();\n\n var self = this;\n var dataTransfer = ev.originalEvent.dataTransfer;\n var data = dataTransfer.getData( \"text\" );\n\n dataTransfer.dropEffect = 'move';\n try {\n data = JSON.parse( data );\n } catch( err ){\n self.warn( 'error parsing JSON from drop:', data );\n }\n\n self.trigger( 'droptarget:drop', ev, data, self );\n return false;\n },\n\n /** handler that copies data into the contents */\n dataDropped : function( data ){\n var self = this;\n // HDA: dropping will copy it to the history\n if( _.isObject( data ) && data.model_class === 'HistoryDatasetAssociation' && data.id ){\n if( self.contents.currentPage !== 0 ){\n return self.contents.fetchPage( 0 )\n .then( function(){\n return self.model.contents.copy( data.id );\n });\n }\n return self.model.contents.copy( data.id );\n }\n return jQuery.when();\n },\n\n // ........................................................................ misc\n /** Return a string rep of the history */\n toString : function(){\n return 'HistoryViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n//------------------------------------------------------------------------------ TEMPLATES\nHistoryViewEdit.prototype.templates = (function(){\n\n var countsTemplate = BASE_MVC.wrapTemplate([\n '<% var shown = Math.max( view.views.length, history.contents_active.active ) %>',\n '<% if( shown ){ %>',\n '',\n '<%- shown %> ', _l( 'shown' ),\n '',\n '<% } %>',\n\n '<% if( history.contents_active.deleted ){ %>',\n '',\n '<% if( view.model.contents.includeDeleted ){ %>',\n '',\n _l( 'hide deleted' ),\n '',\n '<% } else { %>',\n '<%- history.contents_active.deleted %> ',\n '',\n _l( 'deleted' ),\n '',\n '<% } %>',\n '',\n '<% } %>',\n\n '<% if( history.contents_active.hidden ){ %>',\n '',\n '<% if( view.model.contents.includeHidden ){ %>',\n '',\n _l( 'hide hidden' ),\n '',\n '<% } else { %>',\n '<%- history.contents_active.hidden %> ',\n '',\n _l( 'hidden' ),\n '',\n '<% } %>',\n '',\n '<% } %>',\n ], 'history' );\n\n return _.extend( _.clone( _super.prototype.templates ), {\n counts : countsTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n HistoryViewEdit : HistoryViewEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-view-edit.js","define([\n \"mvc/list/list-view\",\n \"mvc/history/history-model\",\n \"mvc/history/history-contents\",\n \"mvc/history/history-preferences\",\n \"mvc/history/hda-li\",\n \"mvc/history/hdca-li\",\n \"mvc/user/user-model\",\n \"mvc/ui/error-modal\",\n \"ui/fa-icon-button\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/search-input\"\n], function(\n LIST_VIEW,\n HISTORY_MODEL,\n HISTORY_CONTENTS,\n HISTORY_PREFS,\n HDA_LI,\n HDCA_LI,\n USER,\n ERROR_MODAL,\n faIconButton,\n BASE_MVC,\n _l\n){\n'use strict';\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a history model.\n * Allows:\n * changing the loaded history\n * displaying data, info, and download\n * tracking history attrs: size, tags, annotations, name, etc.\n * Does not allow:\n * changing the name\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar HistoryView = _super.extend(\n/** @lends HistoryView.prototype */{\n _logNamespace : 'history',\n\n /** class to use for constructing the HDA views */\n HDAViewClass : HDA_LI.HDAListItemView,\n /** class to use for constructing the HDCA views */\n HDCAViewClass : HDCA_LI.HDCAListItemView,\n /** class to used for constructing collection of sub-view models */\n collectionClass : HISTORY_CONTENTS.HistoryContents,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey : 'contents',\n\n tagName : 'div',\n className : _super.prototype.className + ' history-panel',\n\n /** string to display when the collection is empty */\n emptyMsg : _l( 'This history is empty' ),\n /** displayed when no items match the search terms */\n noneFoundMsg : _l( 'No matching datasets found' ),\n /** string used for search placeholder */\n searchPlaceholder : _l( 'search datasets' ),\n\n /** @type {Number} ms to wait after history load to fetch/decorate hdcas with element_count */\n FETCH_COLLECTION_COUNTS_DELAY : 2000,\n\n // ......................................................................... SET UP\n /** Set up the view, bind listeners.\n * @param {Object} attributes optional settings for the panel\n */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n // ---- instance vars\n // control contents/behavior based on where (and in what context) the panel is being used\n /** where should pages from links be displayed? (default to new tab/window) */\n this.linkTarget = attributes.linkTarget || '_blank';\n },\n\n /** create and return a collection for when none is initially passed */\n _createDefaultCollection : function(){\n // override\n return new this.collectionClass([], { history: this.model });\n },\n\n /** In this override, clear the update timer on the model */\n freeModel : function(){\n _super.prototype.freeModel.call( this );\n if( this.model ){\n this.model.clearUpdateTimeout();\n }\n return this;\n },\n\n /** create any event listeners for the panel\n * @fires: rendered:initial on the first render\n * @fires: empty-history when switching to a history with no contents or creating a new history\n */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n this.on({\n error : function( model, xhr, options, msg, details ){\n this.errorHandler( model, xhr, options, msg, details );\n },\n 'loading-done' : function(){\n var self = this;\n // after the initial load, decorate with more time consuming fields (like HDCA element_counts)\n _.delay( function(){\n self.model.contents.fetchCollectionCounts();\n }, self.FETCH_COLLECTION_COUNTS_DELAY );\n },\n 'views:ready view:attached view:removed' : function( view ){\n this._renderSelectButton();\n },\n 'view:attached' : function( view ){\n this.scrollTo(0);\n },\n });\n // this.on( 'all', function(){ console.debug( arguments ); });\n },\n\n // ------------------------------------------------------------------------ loading history/hda models\n /** load the history with the given id then it's contents, sending ajax options to both */\n loadHistory : function( historyId, options, contentsOptions ){\n contentsOptions = _.extend( contentsOptions || { silent: true });\n this.info( 'loadHistory:', historyId, options, contentsOptions );\n var self = this;\n self.setModel( new HISTORY_MODEL.History({ id : historyId }) );\n\n contentsOptions.silent = true;\n self.trigger( 'loading' );\n return self.model\n .fetchWithContents( options, contentsOptions )\n .always( function(){\n self.render();\n self.trigger( 'loading-done' );\n });\n },\n\n /** convenience alias to the model. Updates the item list only (not the history) */\n refreshContents : function( options ){\n if( this.model ){\n return this.model.refresh( options );\n }\n // may have callbacks - so return an empty promise\n return $.when();\n },\n\n /** Override to reset web storage when the id changes (since it needs the id) */\n _setUpCollectionListeners : function(){\n _super.prototype._setUpCollectionListeners.call( this );\n return this.listenTo( this.collection, {\n // 'all' : function(){ console.log( this.collection + ':', arguments ); },\n 'fetching-more' : function(){\n this._toggleContentsLoadingIndicator( true );\n this.$emptyMessage().hide();\n },\n 'fetching-more-done': function(){ this._toggleContentsLoadingIndicator( false ); },\n });\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n _showLoadingIndicator : function( msg, speed, callback ){\n var $indicator = $( '
                                  ' );\n this.$el.html( $indicator.text( msg ).slideDown( !_.isUndefined( speed )? speed : this.fxSpeed ) );\n },\n\n /** hide the loading indicator */\n _hideLoadingIndicator : function( speed ){\n // make speed a bit slower to compensate for slow rendering of up to 500 contents\n this.$( '.loading-indicator' ).slideUp( !_.isUndefined( speed )? speed : ( this.fxSpeed + 200 ), function(){\n $( this ).remove();\n });\n },\n\n /** In this override, add a btn to toggle the selectors */\n _buildNewRender : function(){\n var $newRender = _super.prototype._buildNewRender.call( this );\n this._renderSelectButton( $newRender );\n return $newRender;\n },\n\n /** button for starting select mode */\n _renderSelectButton : function( $where ){\n $where = $where || this.$el;\n // do not render selector option if no actions\n if( !this.multiselectActions().length ){\n return null;\n }\n // do not render (and remove even) if nothing to select\n if( !this.views.length ){\n this.hideSelectors();\n $where.find( '.controls .actions .show-selectors-btn' ).remove();\n return null;\n }\n // don't bother rendering if there's one already\n var $existing = $where.find( '.controls .actions .show-selectors-btn' );\n if( $existing.length ){\n return $existing;\n }\n\n return faIconButton({\n title : _l( 'Operations on multiple datasets' ),\n classes : 'show-selectors-btn',\n faIcon : 'fa-check-square-o'\n }).prependTo( $where.find( '.controls .actions' ) );\n },\n\n /** override to avoid showing intial empty message using contents_active */\n _renderEmptyMessage : function( $whereTo ){\n var self = this;\n var $emptyMsg = self.$emptyMessage( $whereTo );\n\n var empty = self.model.get( 'contents_active' ).active <= 0;\n if( empty ){\n return $emptyMsg.empty().append( self.emptyMsg ).show();\n\n } else if( self.searchFor && self.model.contents.haveSearchDetails() && !self.views.length ){\n return $emptyMsg.empty().append( self.noneFoundMsg ).show();\n }\n $emptyMsg.hide();\n return $();\n },\n\n /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n $scrollContainer : function( $where ){\n // override or set via attributes.$scrollContainer\n return this.$list( $where );\n },\n\n // ------------------------------------------------------------------------ subviews\n _toggleContentsLoadingIndicator : function( show ){\n if( !show ){\n this.$list().find( '.contents-loading-indicator' ).remove();\n } else {\n this.$list().html( '
                                  '\n + '
                                  ' );\n }\n },\n\n /** override to render pagination also */\n renderItems: function( $whereTo ){\n // console.log( this + '.renderItems-----------------', new Date() );\n $whereTo = $whereTo || this.$el;\n var self = this;\n var $list = self.$list( $whereTo );\n\n // TODO: bootstrap hack to remove orphaned tooltips\n $( '.tooltip' ).remove();\n\n $list.empty();\n self.views = [];\n\n var models = self._filterCollection();\n if( models.length ){\n self._renderPagination( $whereTo );\n self.views = self._renderSomeItems( models, $list );\n } else {\n // TODO: consolidate with _renderPagination above by (???) passing in models/length?\n $whereTo.find( '> .controls .list-pagination' ).empty();\n }\n self._renderEmptyMessage( $whereTo ).toggle( !models.length );\n\n self.trigger( 'views:ready', self.views );\n return self.views;\n },\n\n /** render pagination controls if not searching and contents says we're paginating */\n _renderPagination: function( $whereTo ){\n var $paginationControls = $whereTo.find( '> .controls .list-pagination' );\n if( this.searchFor || !this.model.contents.shouldPaginate() ) return $paginationControls.empty();\n\n $paginationControls.html( this.templates.pagination({\n // pagination is 1-based for the user\n current : this.model.contents.currentPage + 1,\n last : this.model.contents.getLastPage() + 1,\n }, this ));\n $paginationControls.find( 'select.pages' ).tooltip();\n return $paginationControls;\n },\n\n /** render a subset of the entire collection (client-side pagination) */\n _renderSomeItems: function( models, $list ){\n var self = this;\n var views = [];\n $list.append( models.map( function( m ){\n var view = self._createItemView( m );\n views.push( view );\n return self._renderItemView$el( view );\n }));\n return views;\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** in this override, check if the contents would also display based on includeDeleted/hidden */\n _filterItem : function( model ){\n var self = this;\n var contents = self.model.contents;\n return ( contents.includeHidden || !model.hidden() )\n && ( contents.includeDeleted || !model.isDeletedOrPurged() )\n && ( _super.prototype._filterItem.call( self, model ) );\n },\n\n /** In this override, since history contents are mixed,\n * get the appropo view class based on history_content_type\n */\n _getItemViewClass : function( model ){\n var contentType = model.get( \"history_content_type\" );\n switch( contentType ){\n case 'dataset':\n return this.HDAViewClass;\n case 'dataset_collection':\n return this.HDCAViewClass;\n }\n throw new TypeError( 'Unknown history_content_type: ' + contentType );\n },\n\n /** in this override, add a linktarget, and expand if id is in web storage */\n _getItemViewOptions : function( model ){\n var options = _super.prototype._getItemViewOptions.call( this, model );\n return _.extend( options, {\n linkTarget : this.linkTarget,\n expanded : this.model.contents.storage.isExpanded( model.id ),\n hasUser : this.model.ownedByCurrUser()\n });\n },\n\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n _super.prototype._setUpItemViewListeners.call( panel, view );\n //TODO: send from content view: this.model.collection.storage.addExpanded\n // maintain a list of items whose bodies are expanded\n return panel.listenTo( view, {\n 'expanded': function( v ){\n panel.model.contents.storage.addExpanded( v.model );\n },\n 'collapsed': function( v ){\n panel.model.contents.storage.removeExpanded( v.model );\n }\n });\n },\n\n /** override to remove expandedIds from webstorage */\n collapseAll : function(){\n this.model.contents.storage.clearExpanded();\n _super.prototype.collapseAll.call( this );\n },\n\n // ------------------------------------------------------------------------ selection\n /** Override to correctly set the historyId of the new collection */\n getSelectedModels : function(){\n var collection = _super.prototype.getSelectedModels.call( this );\n collection.historyId = this.collection.historyId;\n return collection;\n },\n\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .show-selectors-btn' : 'toggleSelectors',\n 'click > .controls .prev' : '_clickPrevPage',\n 'click > .controls .next' : '_clickNextPage',\n 'change > .controls .pages' : '_changePageSelect',\n // allow (error) messages to be clicked away\n 'click .messages [class$=message]' : 'clearMessages',\n }),\n\n _clickPrevPage : function( ev ){\n this.model.clearUpdateTimeout();\n this.model.contents.fetchPrevPage();\n },\n\n _clickNextPage : function( ev ){\n this.model.clearUpdateTimeout();\n this.model.contents.fetchNextPage();\n },\n\n _changePageSelect : function( ev ){\n this.model.clearUpdateTimeout();\n var page = $( ev.currentTarget ).val();\n this.model.contents.fetchPage( page );\n },\n\n /** Toggle and store the deleted visibility and re-render items\n * @returns {Boolean} new setting\n */\n toggleShowDeleted : function( show, options ){\n show = ( show !== undefined )?( show ):( !this.model.contents.includeDeleted );\n var self = this;\n var contents = self.model.contents;\n contents.setIncludeDeleted( show, options );\n self.trigger( 'show-deleted', show );\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** Toggle and store whether to render explicity hidden contents\n * @returns {Boolean} new setting\n */\n toggleShowHidden : function( show, store, options ){\n // console.log( 'toggleShowHidden', show, store );\n show = ( show !== undefined )?( show ):( !this.model.contents.includeHidden );\n var self = this;\n var contents = self.model.contents;\n contents.setIncludeHidden( show, options );\n self.trigger( 'show-hidden', show );\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** On the first search, if there are no details - load them, then search */\n _firstSearch : function( searchFor ){\n var self = this;\n var inputSelector = '> .controls .search-input';\n this.log( 'onFirstSearch', searchFor );\n\n // if the contents already have enough details to search, search and return now\n if( self.model.contents.haveSearchDetails() ){\n self.searchItems( searchFor );\n return;\n }\n\n // otherwise, load the details progressively here\n self.$( inputSelector ).searchInput( 'toggle-loading' );\n // set this now so that only results will show during progress\n self.searchFor = searchFor;\n var xhr = self.model.contents.progressivelyFetchDetails({ silent: true })\n .progress( function( response, limit, offset ){\n self.renderItems();\n self.trigger( 'search:loading-progress', limit, offset );\n })\n .always( function(){\n self.$el.find( inputSelector ).searchInput( 'toggle-loading' );\n })\n .done( function(){\n self.searchItems( searchFor, 'force' );\n });\n },\n\n /** clear the search filters and show all views that are normally shown */\n clearSearch : function( searchFor ){\n var self = this;\n if( !self.searchFor ) return self;\n //self.log( 'onSearchClear', self );\n self.searchFor = '';\n self.trigger( 'search:clear', self );\n self.$( '> .controls .search-query' ).val( '' );\n // NOTE: silent + render prevents collection update event with merge only\n // - which causes an empty page due to event handler above\n self.model.contents.fetchCurrentPage({ silent: true })\n .done( function(){\n self.renderItems();\n });\n return self;\n },\n\n // ........................................................................ error handling\n /** Event handler for errors (from the panel, the history, or the history's contents)\n * Alternately use two strings for model and xhr to use custom message and title (respectively)\n * @param {Model or View} model the (Backbone) source of the error\n * @param {XMLHTTPRequest} xhr any ajax obj. assoc. with the error\n * @param {Object} options the options map commonly used with bbone ajax\n */\n errorHandler : function( model, xhr, options ){\n //TODO: to mixin or base model\n // interrupted ajax or no connection\n if( xhr && xhr.status === 0 && xhr.readyState === 0 ){\n // return ERROR_MODAL.offlineErrorModal();\n // fail silently\n return;\n }\n // otherwise, leave something to report in the console\n this.error( model, xhr, options );\n // and feedback to a modal\n // if sent two strings (and possibly details as 'options'), use those as message and title\n if( _.isString( model ) && _.isString( xhr ) ){\n var message = model;\n var title = xhr;\n return ERROR_MODAL.errorModal( message, title, options );\n }\n // bad gateway\n // TODO: possibly to global handler\n if( xhr && xhr.status === 502 ){\n return ERROR_MODAL.badGatewayErrorModal();\n }\n return ERROR_MODAL.ajaxErrorModal( model, xhr, options );\n },\n\n /** Remove all messages from the panel. */\n clearMessages : function( ev ){\n var $target = !_.isUndefined( ev )?\n $( ev.currentTarget )\n :this.$messages().children( '[class$=\"message\"]' );\n $target.fadeOut( this.fxSpeed, function(){\n $( this ).remove();\n });\n return this;\n },\n\n // ........................................................................ scrolling\n /** Scrolls the panel to show the content sub-view with the given hid.\n * @param {Integer} hid the hid of item to scroll into view\n * @returns {HistoryView} the panel\n */\n scrollToHid : function( hid ){\n return this.scrollToItem( _.first( this.viewsWhereModel({ hid: hid }) ) );\n },\n\n // ........................................................................ misc\n /** utility for adding -st, -nd, -rd, -th to numbers */\n ordinalIndicator : function( number ){\n var numStr = number + '';\n switch( numStr.charAt( numStr.length - 1 )){\n case '1': return numStr + 'st';\n case '2': return numStr + 'nd';\n case '3': return numStr + 'rd';\n default : return numStr + 'th';\n }\n },\n\n /** Return a string rep of the history */\n toString : function(){\n return 'HistoryView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//------------------------------------------------------------------------------ TEMPLATES\nHistoryView.prototype.templates = (function(){\n\n var mainTemplate = BASE_MVC.wrapTemplate([\n // temp container\n '
                                  ',\n '
                                  ',\n '
                                    ',\n '
                                    ',\n '
                                    '\n ]);\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                                    ',\n '
                                    ',\n '
                                    <%- history.name %>
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    <%- history.nice_size %>
                                    ',\n\n '
                                    ',\n\n '
                                    ',\n '<% if( history.deleted && history.purged ){ %>',\n '
                                    ',\n _l( 'This history has been purged and deleted' ),\n '
                                    ',\n '<% } else if( history.deleted ){ %>',\n '
                                    ',\n _l( 'This history has been deleted' ),\n '
                                    ',\n '<% } else if( history.purged ){ %>',\n '
                                    ',\n _l( 'This history has been purged' ),\n '
                                    ',\n '<% } %>',\n\n '<% if( history.message ){ %>',\n // should already be localized\n '
                                    messagesmall\">',\n '<%= history.message.text %>',\n '
                                    ',\n '<% } %>',\n '
                                    ',\n\n // add tags and annotations\n '
                                    ',\n '
                                    ',\n\n '
                                    ',\n '
                                    ',\n '
                                    ',\n\n '
                                    ',\n '
                                    ',\n '',\n '',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    '\n ], 'history' );\n\n var paginationTemplate = BASE_MVC.wrapTemplate([\n '',\n '',\n '',\n ], 'pages' );\n\n return _.extend( _.clone( _super.prototype.templates ), {\n el : mainTemplate,\n controls : controlsTemplate,\n pagination : paginationTemplate,\n });\n}());\n\n\n//==============================================================================\n return {\n HistoryView: HistoryView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-view.js","define([\n \"mvc/ui/popup-menu\",\n \"mvc/history/copy-dialog\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"mvc/webhooks\"\n], function( PopupMenu, historyCopyDialog, BASE_MVC, _l, Webhooks ){\n\n'use strict';\n\n// ============================================================================\nvar menu = [\n {\n html : _l( 'History Lists' ),\n header : true\n },\n {\n html : _l( 'Saved Histories' ),\n href : 'histories/list',\n target : '_top'\n\n },\n {\n html : _l( 'Histories Shared with Me' ),\n href : 'histories/list_shared',\n target : '_top'\n },\n {\n html : _l( 'Current History' ),\n header : true,\n anon : true\n },\n {\n html : _l( 'Create New' ),\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel ){\n Galaxy.currHistoryPanel.createNewHistory();\n }\n },\n },\n {\n html : _l( 'Copy History' ),\n func : function() {\n historyCopyDialog( Galaxy.currHistoryPanel.model )\n .done( function(){\n Galaxy.currHistoryPanel.loadCurrentHistory();\n });\n },\n },\n {\n html : _l( 'Share or Publish' ),\n href : 'history/sharing',\n },\n {\n html : _l( 'Show Structure' ),\n href : 'history/display_structured',\n anon : true,\n },\n {\n html : _l( 'Extract Workflow' ),\n href : 'workflow/build_from_current_history',\n },\n {\n html : _l( 'Delete' ),\n anon : true,\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really delete the current history?' ) ) ){\n Galaxy.currHistoryPanel.model._delete().done(function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n {\n html : _l( 'Delete Permanently' ),\n purge : true,\n anon : true,\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel\n && confirm( _l( 'Really delete the current history permanently? This cannot be undone.' ) ) ){\n Galaxy.currHistoryPanel.model.purge().done(function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n\n\n {\n html : _l( 'Dataset Actions' ),\n header : true,\n anon : true\n },\n {\n html : _l( 'Copy Datasets' ),\n href : 'dataset/copy_datasets',\n },\n {\n html : _l( 'Dataset Security' ),\n href : 'root/history_set_default_permissions',\n },\n {\n html : _l( 'Resume Paused Jobs' ),\n href : 'history/resume_paused_jobs?current=True',\n anon : true,\n },\n {\n html : _l( 'Collapse Expanded Datasets' ),\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel ){\n Galaxy.currHistoryPanel.collapseAll();\n }\n },\n },\n {\n html : _l( 'Unhide Hidden Datasets' ),\n anon : true,\n func : function() {\n // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really unhide all hidden datasets?' ) ) ){\n $.post(Galaxy.root + \"history/adjust_hidden\",\n { 'user_action' : 'unhide' },\n function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n {\n html : _l( 'Delete Hidden Datasets' ),\n anon : true,\n func : function() {\n // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really delete all hidden datasets?' ) ) ){\n $.post(Galaxy.root + \"history/adjust_hidden\",\n { 'user_action' : 'delete' },\n function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n {\n html : _l( 'Purge Deleted Datasets' ),\n confirm : _l( 'Really delete all deleted datasets permanently? This cannot be undone.' ),\n href : 'history/purge_deleted_datasets',\n purge : true,\n anon : true,\n },\n\n\n {\n html : _l( 'Downloads' ),\n header : true\n },\n {\n html : _l( 'Export Tool Citations' ),\n href : 'history/citations',\n anon : true,\n },\n {\n html : _l( 'Export History to File' ),\n href : 'history/export_archive?preview=True',\n anon : true,\n },\n\n {\n html : _l( 'Other Actions' ),\n header : true\n },\n {\n html : _l( 'Import from File' ),\n href : 'history/import_archive',\n }\n];\n\n// Webhooks\nWebhooks.add({\n url: 'api/webhooks/history-menu/all',\n async: false, // (hypothetically) slows down the performance\n callback: function(webhooks) {\n var webhooks_menu = [];\n\n $.each(webhooks.models, function(index, model) {\n var webhook = model.toJSON();\n if (webhook.activate) {\n webhooks_menu.push({\n html : _l( webhook.config.title ),\n // func: function() {},\n anon : true\n });\n }\n });\n\n if (webhooks_menu.length > 0) {\n webhooks_menu.unshift({\n html : _l( 'Webhooks' ),\n header : true\n });\n $.merge(menu, webhooks_menu);\n }\n }\n});\n\n\nfunction buildMenu( isAnon, purgeAllowed, urlRoot ){\n return _.clone( menu ).filter( function( menuOption ){\n if( isAnon && !menuOption.anon ){\n return false;\n }\n if( !purgeAllowed && menuOption.purge ){\n return false;\n }\n\n //TODO:?? hard-coded galaxy_main\n if( menuOption.href ){\n menuOption.href = urlRoot + menuOption.href;\n menuOption.target = menuOption.target || 'galaxy_main';\n }\n\n if( menuOption.confirm ){\n menuOption.func = function(){\n if( confirm( menuOption.confirm ) ){\n galaxy_main.location = menuOption.href;\n }\n };\n }\n return true;\n });\n}\n\nvar create = function( $button, options ){\n options = options || {};\n var isAnon = options.anonymous === undefined? true : options.anonymous,\n purgeAllowed = options.purgeAllowed || false,\n menu = buildMenu( isAnon, purgeAllowed, Galaxy.root );\n //console.debug( 'menu:', menu );\n return new PopupMenu( $button, menu );\n};\n\n\n// ============================================================================\n return create;\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/options-menu.js","/** Renders the collection uploader rows */\ndefine( [ 'utils/utils', 'mvc/upload/upload-model', 'mvc/upload/upload-settings', 'mvc/ui/ui-popover', 'mvc/ui/ui-select' ],\nfunction( Utils, UploadModel, UploadSettings, Popover, Select ) {\n return Backbone.View.extend({\n /** Dictionary of upload states and associated icons */\n status_classes : {\n init : 'upload-icon-button fa fa-trash-o',\n queued : 'upload-icon fa fa-spinner fa-spin',\n running : 'upload-icon fa fa-spinner fa-spin',\n success : 'upload-icon-button fa fa-check',\n error : 'upload-icon-button fa fa-exclamation-triangle'\n },\n\n initialize: function( app, options ) {\n var self = this;\n this.app = app;\n this.model = options.model;\n this.setElement( this._template( options.model ) );\n this.$mode = this.$( '.upload-mode' );\n this.$title = this.$( '.upload-title-extended' );\n this.$text = this.$( '.upload-text' );\n this.$size = this.$( '.upload-size' );\n this.$info_text = this.$( '.upload-info-text' );\n this.$info_progress = this.$( '.upload-info-progress' );\n this.$text_content = this.$( '.upload-text-content' );\n this.$symbol = this.$( '.upload-symbol' );\n this.$progress_bar = this.$( '.upload-progress-bar' );\n this.$percentage = this.$( '.upload-percentage' );\n\n // append popup to settings icon\n this.settings = new Popover.View({\n title : 'Upload configuration',\n container : this.$( '.upload-settings' ),\n placement : 'bottom'\n });\n\n // identify default genome and extension values\n var default_genome = this.app.select_genome.value();\n var default_extension = this.app.select_extension.value();\n\n // handle click event\n this.$symbol.on('click', function() { self._removeRow(); });\n\n // handle text editing event\n this.$text_content.on( 'change input', function( e ) {\n self.model.set( { 'url_paste': $( e.target ).val(),\n 'file_size': $( e.target ).val().length } );\n });\n\n // model events\n this.listenTo( this.model, 'change:percentage', function() { self._refreshPercentage() } );\n this.listenTo( this.model, 'change:status', function() { self._refreshStatus() } );\n this.listenTo( this.model, 'change:info', function() { self._refreshInfo() } );\n this.listenTo( this.model, 'change:file_size', function() { self._refreshFileSize() } );\n this.listenTo( this.model, 'remove', function() { self.remove() } );\n this.app.collection.on('reset', function() { self.remove() } );\n },\n\n render: function() {\n var options = this.model.attributes;\n this.$title.html( _.escape( options.file_name ) );\n this.$size.html( Utils.bytesToString ( options.file_size ) );\n this.$mode.removeClass().addClass( 'upload-mode' ).addClass( 'text-primary' );\n if ( options.file_mode == 'new' ) {\n this.$text.css( { 'width' : this.$el.width() - 16 + 'px', 'top' : this.$el.height() - 8 + 'px' } ).show();\n this.$el.height( this.$el.height() - 8 + this.$text.height() + 16 );\n this.$mode.addClass( 'fa fa-edit' );\n } else if ( options.file_mode == 'local' ) {\n this.$mode.addClass( 'fa fa-laptop' );\n } else if ( options.file_mode == 'ftp' ) {\n this.$mode.addClass( 'fa fa-folder-open-o' );\n }\n },\n\n /** Refresh info text */\n _refreshInfo: function() {\n var info = this.model.get( 'info' );\n if ( info ) {\n this.$info_text.html( 'Failed: ' + info ).show();\n } else {\n this.$info_text.hide();\n }\n },\n\n /** Refresh percentage status */\n _refreshPercentage : function() {\n var percentage = parseInt( this.model.get( 'percentage' ) );\n this.$progress_bar.css( { width : percentage + '%' } );\n this.$percentage.html( percentage != 100 ? percentage + '%' : 'Adding to history...' );\n },\n\n /** Refresh status */\n _refreshStatus : function() {\n var status = this.model.get( 'status' );\n this.$symbol.removeClass().addClass( 'upload-symbol' ).addClass( this.status_classes[ status ] );\n this.model.set( 'enabled', status == 'init' );\n var enabled = this.model.get( 'enabled' );\n this.$text_content.attr( 'disabled', !enabled );\n if ( status == 'success' ) {\n this.$el.addClass( 'success' );\n this.$percentage.html( '100%' );\n }\n if ( status == 'error' ) {\n this.$el.addClass( 'danger' );\n this.$info_progress.hide();\n }\n },\n\n /** Refresh file size */\n _refreshFileSize: function() {\n this.$size.html( Utils.bytesToString ( this.model.get( 'file_size' ) ) );\n },\n\n /** Remove row */\n _removeRow: function() {\n if ( [ 'init', 'success', 'error' ].indexOf( this.model.get( 'status' ) ) !== -1 ) {\n this.app.collection.remove( this.model );\n }\n },\n\n /** Attach file info popup */\n _showSettings : function() {\n if ( !this.settings.visible ) {\n this.settings.empty();\n this.settings.append( ( new UploadSettings( this ) ).$el );\n this.settings.show();\n } else {\n this.settings.hide();\n }\n },\n\n /** View template */\n _template: function( options ) {\n return '
                                    ' +\n '' + '' + '' + '' + '' + '';\n\t },\n\t\n\t /** Template of table */\n\t _templateTable: function () {\n\t return 'Available files: ' + '' + '' + '  ' + '' + '' + '' + '
                                    ' ).append( $checkbox ) )\n .append( $( '' ).append( parameter.title ) ) )\n });\n this.$cover[ this.model.get( 'enabled' ) && 'hide' || 'show' ]();\n }\n });\n});\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/upload/upload-settings.js","/*\n galaxy upload plugins - requires FormData and XMLHttpRequest\n*/\n;(function($){\n // add event properties\n jQuery.event.props.push(\"dataTransfer\");\n\n /**\n Posts file data to the API\n */\n $.uploadpost = function (config) {\n // parse options\n var cnf = $.extend({}, {\n data : {},\n success : function() {},\n error : function() {},\n progress : function() {},\n url : null,\n maxfilesize : 2048,\n error_filesize : 'File exceeds 2GB. Please use a FTP client.',\n error_default : 'Please make sure the file is available.',\n error_server : 'Upload request failed.',\n error_login : 'Uploads require you to log in.'\n }, config);\n\n // link data\n var data = cnf.data;\n\n // check errors\n if (data.error_message) {\n cnf.error(data.error_message);\n return;\n }\n\n // construct form data\n var form = new FormData();\n for (var key in data.payload) {\n form.append(key, data.payload[key]);\n }\n\n // add files to submission\n var sizes = 0;\n for (var key in data.files) {\n var d = data.files[key];\n form.append(d.name, d.file, d.file.name);\n sizes += d.file.size;\n }\n\n // check file size, unless it's an ftp file\n if (sizes > 1048576 * cnf.maxfilesize) {\n cnf.error(cnf.error_filesize);\n return;\n }\n\n // prepare request\n var xhr = new XMLHttpRequest();\n xhr.open('POST', cnf.url, true);\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.setRequestHeader('Cache-Control', 'no-cache');\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\n // captures state changes\n xhr.onreadystatechange = function() {\n // check for request completed, server connection closed\n if (xhr.readyState == xhr.DONE) {\n // parse response\n var response = null;\n var extra_info = \"\";\n if (xhr.responseText) {\n try {\n response = jQuery.parseJSON(xhr.responseText);\n extra_info = response.err_msg;\n } catch (e) {\n response = xhr.responseText;\n extra_info = response;\n }\n }\n // pass any error to the error option\n if (xhr.status < 200 || xhr.status > 299) {\n var text = xhr.statusText;\n if (xhr.status == 403) {\n text = cnf.error_login;\n } else if (xhr.status == 0) {\n text = cnf.error_server;\n } else if (!text) {\n text = cnf.error_default;\n }\n cnf.error(text + ' (' + xhr.status + '). ' + extra_info);\n } else {\n cnf.success(response);\n }\n }\n }\n\n // prepare upload progress\n xhr.upload.addEventListener('progress', function(e) {\n if (e.lengthComputable) {\n cnf.progress(Math.round((e.loaded * 100) / e.total));\n }\n }, false);\n\n // send request\n Galaxy.emit.debug('uploadbox::uploadpost()', 'Posting following data.', cnf);\n xhr.send(form);\n }\n\n /**\n Handles the upload events drag/drop etc.\n */\n $.fn.uploadinput = function(options) {\n // initialize\n var el = this;\n var opts = $.extend({}, {\n ondragover : function() {},\n ondragleave : function() {},\n onchange : function() {},\n multiple : false\n }, options);\n\n // append hidden upload field\n var $input = $('');\n el.append($input.change(function (e) {\n opts.onchange(e.target.files);\n $(this).val('');\n }));\n\n // drag/drop events\n el.on('drop', function (e) {\n opts.ondragleave(e);\n if(e.dataTransfer) {\n opts.onchange(e.dataTransfer.files);\n e.preventDefault();\n }\n });\n el.on('dragover', function (e) {\n e.preventDefault();\n opts.ondragover(e);\n });\n el.on('dragleave', function (e) {\n e.stopPropagation();\n opts.ondragleave(e);\n });\n\n // exports\n return {\n dialog: function () {\n $input.trigger('click');\n }\n }\n }\n\n /**\n Handles the upload queue and events such as drag/drop etc.\n */\n $.fn.uploadbox = function(options) {\n // parse options\n var opts = $.extend({}, {\n dragover : function() {},\n dragleave : function() {},\n announce : function(d) {},\n initialize : function(d) {},\n progress : function(d, m) {},\n success : function(d, m) {},\n error : function(d, m) { alert(m); },\n complete : function() {}\n }, options);\n\n // file queue\n var queue = {};\n\n // queue index/length counter\n var queue_index = 0;\n var queue_length = 0;\n\n // indicates if queue is currently running\n var queue_running = false;\n var queue_stop = false;\n\n // element\n var uploadinput = $(this).uploadinput({\n multiple : true,\n onchange : function(files) { add(files); },\n ondragover : options.ondragover,\n ondragleave : options.ondragleave\n });\n\n // add new files to upload queue\n function add(files) {\n if (files && files.length && !queue_running) {\n var current_index = queue_index;\n _.each(files, function(file, key) {\n if (file.mode !== 'new' && _.filter(queue, function(f) {\n return f.name === file.name && f.size === file.size;\n }).length) {\n file.duplicate = true;\n }\n });\n _.each(files, function(file) {\n if (!file.duplicate) {\n var index = String(queue_index++);\n queue[index] = file;\n opts.announce(index, queue[index]);\n queue_length++;\n }\n });\n return current_index;\n }\n }\n\n // remove file from queue\n function remove(index) {\n if (queue[index]) {\n delete queue[index];\n queue_length--;\n }\n }\n\n // process an upload, recursive\n function process() {\n // validate\n if (queue_length == 0 || queue_stop) {\n queue_stop = false;\n queue_running = false;\n opts.complete();\n return;\n } else {\n queue_running = true;\n }\n\n // get an identifier from the queue\n var index = -1;\n for (var key in queue) {\n index = key;\n break;\n }\n\n // get current file from queue\n var file = queue[index];\n\n // remove from queue\n remove(index)\n\n // create and submit data\n $.uploadpost({\n url : opts.url,\n data : opts.initialize(index),\n success : function(message) { opts.success(index, message); process();},\n error : function(message) { opts.error(index, message); process();},\n progress : function(percentage) { opts.progress(index, percentage); }\n });\n }\n\n /*\n public interface\n */\n\n // open file browser for selection\n function select() {\n uploadinput.dialog();\n }\n\n // remove all entries from queue\n function reset(index) {\n for (index in queue) {\n remove(index);\n }\n }\n\n // initiate upload process\n function start() {\n if (!queue_running) {\n queue_running = true;\n process();\n }\n }\n\n // stop upload process\n function stop() {\n queue_stop = true;\n }\n\n // set options\n function configure(options) {\n opts = $.extend({}, opts, options);\n return opts;\n }\n\n // verify browser compatibility\n function compatible() {\n return window.File && window.FormData && window.XMLHttpRequest && window.FileList;\n }\n\n // export functions\n return {\n 'select' : select,\n 'add' : add,\n 'remove' : remove,\n 'start' : start,\n 'stop' : stop,\n 'reset' : reset,\n 'configure' : configure,\n 'compatible' : compatible\n };\n }\n})(jQuery);\n\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/utils/uploadbox.js","define([\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function( baseMVC, _l ){\n// =============================================================================\n/** A view on any model that has a 'annotation' attribute\n */\nvar AnnotationEditor = Backbone.View\n .extend( baseMVC.LoggableMixin )\n .extend( baseMVC.HiddenUntilActivatedViewMixin ).extend({\n\n tagName : 'div',\n className : 'annotation-display',\n\n /** Set up listeners, parse options */\n initialize : function( options ){\n options = options || {};\n this.tooltipConfig = options.tooltipConfig || { placement: 'bottom' };\n //console.debug( this, options );\n // only listen to the model only for changes to annotations\n this.listenTo( this.model, 'change:annotation', function(){\n this.render();\n });\n this.hiddenUntilActivated( options.$activator, options );\n },\n\n /** Build the DOM elements, call select to on the created input, and set up behaviors */\n render : function(){\n var view = this;\n this.$el.html( this._template() );\n\n //TODO: handle empties better\n this.$annotation().make_text_editable({\n use_textarea: true,\n on_finish: function( newAnnotation ){\n view.$annotation().text( newAnnotation );\n view.model.save({ annotation: newAnnotation }, { silent: true })\n .fail( function(){\n view.$annotation().text( view.model.previous( 'annotation' ) );\n });\n }\n });\n return this;\n },\n\n /** @returns {String} the html text used to build the view's DOM */\n _template : function(){\n var annotation = this.model.get( 'annotation' );\n return [\n //TODO: make prompt optional\n '',\n // set up initial tags by adding as CSV to input vals (necc. to init select2)\n '
                                    ',\n _.escape( annotation ),\n '
                                    '\n ].join( '' );\n },\n\n /** @returns {jQuery} the main element for this view */\n $annotation : function(){\n return this.$el.find( '.annotation' );\n },\n\n /** shut down event listeners and remove this view's DOM */\n remove : function(){\n this.$annotation.off();\n this.stopListening( this.model );\n Backbone.View.prototype.remove.call( this );\n },\n\n /** string rep */\n toString : function(){ return [ 'AnnotationEditor(', this.model + '', ')' ].join(''); }\n});\n// =============================================================================\nreturn {\n AnnotationEditor : AnnotationEditor\n};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/annotation.js","define([\n 'libs/underscore',\n 'libs/backbone',\n 'mvc/base-mvc',\n], function( _, Backbone, BASE_MVC ){\n'use strict';\n\n//=============================================================================\n/**\n * A Collection that can be limited/offset/re-ordered/filtered.\n * @type {Backbone.Collection}\n */\nvar ControlledFetchCollection = Backbone.Collection.extend({\n\n /** call setOrder on initialization to build the comparator based on options */\n initialize : function( models, options ){\n Backbone.Collection.prototype.initialize.call( this, models, options );\n this.setOrder( options.order || this.order, { silent: true });\n },\n\n /** set up to track order changes and re-sort when changed */\n _setUpListeners : function(){\n return this.on({\n 'changed-order' : this.sort\n });\n },\n\n /** override to provide order and offsets based on instance vars, set limit if passed,\n * and set allFetched/fire 'all-fetched' when xhr returns\n */\n fetch : function( options ){\n options = this._buildFetchOptions( options );\n // console.log( 'fetch options:', options );\n return Backbone.Collection.prototype.fetch.call( this, options );\n },\n\n /** build ajax data/parameters from options */\n _buildFetchOptions : function( options ){\n // note: we normally want options passed in to override the defaults built here\n // so most of these fns will generate defaults\n options = _.clone( options ) || {};\n var self = this;\n\n // jquery ajax option; allows multiple q/qv for filters (instead of 'q[]')\n options.traditional = true;\n\n // options.data\n // we keep limit, offset, etc. in options *as well as move it into data* because:\n // - it makes fetch calling convenient to add it to a single options map (instead of as mult. args)\n // - it allows the std. event handlers (for fetch, etc.) to have access\n // to the pagination options too\n // (i.e. this.on( 'sync', function( options ){ if( options.limit ){ ... } }))\n // however, when we send to xhr/jquery we copy them to data also so that they become API query params\n options.data = options.data || self._buildFetchData( options );\n // console.log( 'data:', options.data );\n\n // options.data.filters --> options.data.q, options.data.qv\n var filters = this._buildFetchFilters( options );\n // console.log( 'filters:', filters );\n if( !_.isEmpty( filters ) ){\n _.extend( options.data, this._fetchFiltersToAjaxData( filters ) );\n }\n // console.log( 'data:', options.data );\n return options;\n },\n\n /** Build the dictionary to send to fetch's XHR as data */\n _buildFetchData : function( options ){\n var defaults = {};\n if( this.order ){ defaults.order = this.order; }\n return _.defaults( _.pick( options, this._fetchParams ), defaults );\n },\n\n /** These attribute keys are valid params to fetch/API-index */\n _fetchParams : [\n /** model dependent string to control the order of models returned */\n 'order',\n /** limit the number of models returned from a fetch */\n 'limit',\n /** skip this number of models when fetching */\n 'offset',\n /** what series of attributes to return (model dependent) */\n 'view',\n /** individual keys to return for the models (see api/histories.index) */\n 'keys'\n ],\n\n /** add any needed filters here based on collection state */\n _buildFetchFilters : function( options ){\n // override\n return _.clone( options.filters || {} );\n },\n\n /** Convert dictionary filters to qqv style arrays */\n _fetchFiltersToAjaxData : function( filters ){\n // return as a map so ajax.data can extend from it\n var filterMap = {\n q : [],\n qv : []\n };\n _.each( filters, function( v, k ){\n // don't send if filter value is empty\n if( v === undefined || v === '' ){ return; }\n // json to python\n if( v === true ){ v = 'True'; }\n if( v === false ){ v = 'False'; }\n if( v === null ){ v = 'None'; }\n // map to k/v arrays (q/qv)\n filterMap.q.push( k );\n filterMap.qv.push( v );\n });\n return filterMap;\n },\n\n /** override to reset allFetched flag to false */\n reset : function( models, options ){\n this.allFetched = false;\n return Backbone.Collection.prototype.reset.call( this, models, options );\n },\n\n // ........................................................................ order\n order : null,\n\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators : {\n 'update_time' : BASE_MVC.buildComparator( 'update_time', { ascending: false }),\n 'update_time-asc' : BASE_MVC.buildComparator( 'update_time', { ascending: true }),\n 'create_time' : BASE_MVC.buildComparator( 'create_time', { ascending: false }),\n 'create_time-asc' : BASE_MVC.buildComparator( 'create_time', { ascending: true }),\n },\n\n /** set the order and comparator for this collection then sort with the new order\n * @event 'changed-order' passed the new order and the collection\n */\n setOrder : function( order, options ){\n options = options || {};\n var collection = this;\n var comparator = collection.comparators[ order ];\n if( _.isUndefined( comparator ) ){ throw new Error( 'unknown order: ' + order ); }\n // if( _.isUndefined( comparator ) ){ return; }\n if( comparator === collection.comparator ){ return; }\n\n var oldOrder = collection.order;\n collection.order = order;\n collection.comparator = comparator;\n\n if( !options.silent ){\n collection.trigger( 'changed-order', options );\n }\n return collection;\n },\n\n});\n\n\n//=============================================================================\n/**\n *\n */\nvar PaginatedCollection = ControlledFetchCollection.extend({\n\n /** @type {Number} limit used for each page's fetch */\n limitPerPage : 500,\n\n initialize : function( models, options ){\n ControlledFetchCollection.prototype.initialize.call( this, models, options );\n this.currentPage = options.currentPage || 0;\n },\n\n getTotalItemCount : function(){\n return this.length;\n },\n\n shouldPaginate : function(){\n return this.getTotalItemCount() >= this.limitPerPage;\n },\n\n getLastPage : function(){\n return Math.floor( this.getTotalItemCount() / this.limitPerPage );\n },\n\n getPageCount : function(){\n return this.getLastPage() + 1;\n },\n\n getPageLimitOffset : function( pageNum ){\n pageNum = this.constrainPageNum( pageNum );\n return {\n limit : this.limitPerPage,\n offset: pageNum * this.limitPerPage\n };\n },\n\n constrainPageNum : function( pageNum ){\n return Math.max( 0, Math.min( pageNum, this.getLastPage() ));\n },\n\n /** fetch the next page of data */\n fetchPage : function( pageNum, options ){\n var self = this;\n pageNum = self.constrainPageNum( pageNum );\n self.currentPage = pageNum;\n options = _.defaults( options || {}, self.getPageLimitOffset( pageNum ) );\n\n self.trigger( 'fetching-more' );\n return self.fetch( options )\n .always( function(){\n self.trigger( 'fetching-more-done' );\n });\n },\n\n fetchCurrentPage : function( options ){\n return this.fetchPage( this.currentPage, options );\n },\n\n fetchPrevPage : function( options ){\n return this.fetchPage( this.currentPage - 1, options );\n },\n\n fetchNextPage : function( options ){\n return this.fetchPage( this.currentPage + 1, options );\n },\n});\n\n\n//=============================================================================\n/**\n * A Collection that will load more elements without reseting.\n */\nvar InfinitelyScrollingCollection = ControlledFetchCollection.extend({\n\n /** @type {Number} limit used for the first fetch (or a reset) */\n limitOnFirstFetch : null,\n /** @type {Number} limit used for each subsequent fetch */\n limitPerFetch : 100,\n\n initialize : function( models, options ){\n ControlledFetchCollection.prototype.initialize.call( this, models, options );\n /** @type {Integer} number of contents to return from the first fetch */\n this.limitOnFirstFetch = options.limitOnFirstFetch || this.limitOnFirstFetch;\n /** @type {Integer} limit for every fetch after the first */\n this.limitPerFetch = options.limitPerFetch || this.limitPerFetch;\n /** @type {Boolean} are all contents fetched? */\n this.allFetched = false;\n /** @type {Integer} what was the offset of the last content returned */\n this.lastFetched = options.lastFetched || 0;\n },\n\n /** build ajax data/parameters from options */\n _buildFetchOptions : function( options ){\n // options (options for backbone.fetch and jquery.ajax generally)\n // backbone option; false here to make fetching an addititive process\n options.remove = options.remove || false;\n return ControlledFetchCollection.prototype._buildFetchOptions.call( this, options );\n },\n\n /** fetch the first 'page' of data */\n fetchFirst : function( options ){\n // console.log( 'ControlledFetchCollection.fetchFirst:', options );\n options = options? _.clone( options ) : {};\n this.allFetched = false;\n this.lastFetched = 0;\n return this.fetchMore( _.defaults( options, {\n reset : true,\n limit : this.limitOnFirstFetch,\n }));\n },\n\n /** fetch the next page of data */\n fetchMore : function( options ){\n // console.log( 'ControlledFetchCollection.fetchMore:', options );\n options = _.clone( options || {} );\n var collection = this;\n\n // console.log( 'fetchMore, options.reset:', options.reset );\n if( ( !options.reset && collection.allFetched ) ){\n return jQuery.when();\n }\n\n // TODO: this fails in the edge case where\n // the first fetch offset === limit (limit 4, offset 4, collection.length 4)\n options.offset = options.reset? 0 : ( options.offset || collection.lastFetched );\n var limit = options.limit = options.limit || collection.limitPerFetch || null;\n // console.log( 'fetchMore, limit:', limit, 'offset:', options.offset );\n\n collection.trigger( 'fetching-more' );\n return collection.fetch( options )\n .always( function(){\n collection.trigger( 'fetching-more-done' );\n })\n // maintain allFetched flag and trigger if all were fetched this time\n .done( function _postFetchMore( fetchedData ){\n var numFetched = _.isArray( fetchedData )? fetchedData.length : 0;\n collection.lastFetched += numFetched;\n // console.log( 'fetchMore, lastFetched:', collection.lastFetched );\n // anything less than a full page means we got all there is to get\n if( !limit || numFetched < limit ){\n collection.allFetched = true;\n collection.trigger( 'all-fetched', this );\n }\n }\n );\n },\n\n /** fetch all the collection */\n fetchAll : function( options ){\n // whitelist options to prevent allowing limit/offset/filters\n // (use vanilla fetch instead)\n options = options || {};\n var self = this;\n options = _.pick( options, 'silent' );\n options.filters = {};\n return self.fetch( options ).done( function( fetchData ){\n self.allFetched = true;\n self.trigger( 'all-fetched', self );\n });\n },\n});\n\n\n//==============================================================================\n return {\n ControlledFetchCollection : ControlledFetchCollection,\n PaginatedCollection : PaginatedCollection,\n InfinitelyScrollingCollection : InfinitelyScrollingCollection,\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/base/controlled-fetch-collection.js","define([\n], function( ){\n\n/* For presentation-related functionality shared across collection creators.\n Particularily overlapping functionality related to name processing and help.\n*/\nvar CollectionCreatorMixin = {\n\n /** add (or clear if clear is truthy) a validation warning to the DOM element described in what */\n _validationWarning : function( what, clear ){\n var VALIDATION_CLASS = 'validation-warning';\n if( what === 'name' ){\n what = this.$( '.collection-name' ).add( this.$( '.collection-name-prompt' ) );\n this.$( '.collection-name' ).focus().select();\n }\n if( clear ){\n what = what || this.$( '.' + VALIDATION_CLASS );\n what.removeClass( VALIDATION_CLASS );\n } else {\n what.addClass( VALIDATION_CLASS );\n }\n },\n\n _changeHideOriginals: function( ev ) {\n this.hideOriginals = this.$( '.hide-originals' ).prop(\"checked\");\n },\n\n // ........................................................................ footer\n /** handle a collection name change */\n _changeName : function( ev ){\n this._validationWarning( 'name', !!this._getName() );\n },\n\n /** check for enter key press when in the collection name and submit */\n _nameCheckForEnter : function( ev ){\n if( ev.keyCode === 13 && !this.blocking ){\n this._clickCreate();\n }\n },\n\n /** get the current collection name */\n _getName : function(){\n return _.escape( this.$( '.collection-name' ).val() );\n },\n\n // ........................................................................ header\n /** expand help */\n _clickMoreHelp : function( ev ){\n ev.stopPropagation();\n this.$( '.main-help' ).addClass( 'expanded' );\n this.$( '.more-help' ).hide();\n },\n /** collapse help */\n _clickLessHelp : function( ev ){\n ev.stopPropagation();\n this.$( '.main-help' ).removeClass( 'expanded' );\n this.$( '.more-help' ).show();\n },\n /** toggle help */\n _toggleHelp : function( ev ){\n ev.stopPropagation();\n this.$( '.main-help' ).toggleClass( 'expanded' );\n this.$( '.more-help' ).toggle();\n },\n\n /** show an alert on the top of the interface containing message (alertClass is bootstrap's alert-*) */\n _showAlert : function( message, alertClass ){\n alertClass = alertClass || 'alert-danger';\n this.$( '.main-help' ).hide();\n this.$( '.header .alert' )\n .attr( 'class', 'alert alert-dismissable' ).addClass( alertClass ).show()\n .find( '.alert-message' ).html( message );\n },\n /** hide the alerts at the top */\n _hideAlert : function( message ){\n this.$( '.main-help' ).show();\n this.$( '.header .alert' ).hide();\n },\n\n _cancelCreate: function( ev ){\n if( typeof this.oncancel === 'function' ){\n this.oncancel.call( this );\n }\n },\n\n /** attempt to create the current collection */\n _clickCreate : function( ev ){\n var name = this._getName();\n if( !name ){\n this._validationWarning( 'name' );\n } else if( !this.blocking ){\n this.createList( name );\n }\n },\n\n _setUpCommonSettings : function( attributes ) {\n this.hideOriginals = attributes.defaultHideSourceItems || false;\n },\n\n /** render the footer, completion controls, and cancel controls */\n _renderFooter : function( speed, callback ){\n var instance = this;\n var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );\n _.each( this.footerSettings, function( property, selector ) {\n this.$( selector ).prop( 'checked', instance[ property ] );\n });\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n return $footer;\n },\n\n _creatorTemplates: {\n main : _.template([\n '
                                    ',\n '
                                    ',\n '
                                    '\n ].join('')),\n }\n\n}\n\n//==============================================================================\n return {\n CollectionCreatorMixin: CollectionCreatorMixin\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/base-creator.js","define([\n \"mvc/list/list-view\",\n \"mvc/collection/collection-model\",\n \"mvc/collection/collection-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_VIEW, DC_MODEL, DC_LI, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a dataset collection.\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar CollectionView = _super.extend(\n/** @lends CollectionView.prototype */{\n //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n _logNamespace : logNamespace,\n\n className : _super.prototype.className + ' dataset-collection-panel',\n\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_LI.DatasetDCEListItemView,\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey : 'elements',\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the panel\n */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n this.linkTarget = attributes.linkTarget || '_blank';\n\n this.hasUser = attributes.hasUser;\n /** A stack of panels that currently cover or hide this panel */\n this.panelStack = [];\n /** The text of the link to go back to the panel containing this one */\n this.parentName = attributes.parentName;\n /** foldout or drilldown */\n this.foldoutStyle = attributes.foldoutStyle || 'foldout';\n this.downloadUrl = this.model.attributes.url + '/download';\n },\n\n _queueNewRender : function( $newRender, speed ) {\n speed = ( speed === undefined )?( this.fxSpeed ):( speed );\n var panel = this;\n panel.log( '_queueNewRender:', $newRender, speed );\n\n // TODO: jquery@1.12 doesn't change display when the elem has display: flex\n // this causes display: block for those elems after the use of show/hide animations\n // animations are removed from this view for now until fixed\n panel._swapNewRender( $newRender );\n panel.trigger( 'rendered', panel );\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** In this override, use model.getVisibleContents */\n _filterCollection : function(){\n //TODO: should *not* be model.getVisibleContents - visibility is not model related\n return this.model.getVisibleContents();\n },\n\n /** override to return proper view class based on element_type */\n _getItemViewClass : function( model ){\n //this.debug( this + '._getItemViewClass:', model );\n //TODO: subclasses use DCEViewClass - but are currently unused - decide\n switch( model.get( 'element_type' ) ){\n case 'hda':\n return this.DatasetDCEViewClass;\n case 'dataset_collection':\n return this.NestedDCDCEViewClass;\n }\n throw new TypeError( 'Unknown element type:', model.get( 'element_type' ) );\n },\n\n /** override to add link target and anon */\n _getItemViewOptions : function( model ){\n var options = _super.prototype._getItemViewOptions.call( this, model );\n return _.extend( options, {\n linkTarget : this.linkTarget,\n hasUser : this.hasUser,\n //TODO: could move to only nested: list:paired\n foldoutStyle : this.foldoutStyle\n });\n },\n\n // ------------------------------------------------------------------------ collection sub-views\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n _super.prototype._setUpItemViewListeners.call( panel, view );\n\n // use pub-sub to: handle drilldown expansion and collapse\n panel.listenTo( view, {\n 'expanded:drilldown': function( v, drilldown ){\n this._expandDrilldownPanel( drilldown );\n },\n 'collapsed:drilldown': function( v, drilldown ){\n this._collapseDrilldownPanel( drilldown );\n }\n });\n return this;\n },\n\n /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n _expandDrilldownPanel : function( drilldown ){\n this.panelStack.push( drilldown );\n // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n this.$( '> .controls' ).add( this.$list() ).hide();\n drilldown.parentName = this.model.get( 'name' );\n this.$el.append( drilldown.render().$el );\n },\n\n /** Handle drilldown close by freeing the panel and re-rendering this panel */\n _collapseDrilldownPanel : function( drilldown ){\n this.panelStack.pop();\n this.render();\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : {\n 'click .navigation .back' : 'close'\n },\n\n /** close/remove this collection panel */\n close : function( event ){\n this.remove();\n this.trigger( 'close' );\n },\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'CollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//------------------------------------------------------------------------------ TEMPLATES\nCollectionView.prototype.templates = (function(){\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                                    ',\n '',\n\n '
                                    ',\n '
                                    <%- collection.name || collection.element_identifier %>
                                    ',\n '
                                    ',\n '<% if( collection.collection_type === \"list\" ){ %>',\n _l( 'a list of datasets' ),\n '<% } else if( collection.collection_type === \"paired\" ){ %>',\n _l( 'a pair of datasets' ),\n '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n _l( 'a list of paired datasets' ),\n '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n _l( 'a list of dataset lists' ),\n '<% } %>',\n '
                                    ',\n '
                                    ',\n\n '
                                    ',\n\n '',\n '
                                    ',\n ], 'collection' );\n\n return _.extend( _.clone( _super.prototype.templates ), {\n controls : controlsTemplate\n });\n}());\n\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListCollectionView = CollectionView.extend(\n/** @lends ListCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_LI.DatasetDCEListItemView,\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar PairCollectionView = ListCollectionView.extend(\n/** @lends PairCollectionView.prototype */{\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'PairCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListOfPairsCollectionView = CollectionView.extend(\n/** @lends ListOfPairsCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass : PairCollectionView\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListOfPairsCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\nvar ListOfListsCollectionView = CollectionView.extend({\n\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass : PairCollectionView\n }),\n\n /** string rep */\n toString : function(){\n return 'ListOfListsCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//==============================================================================\n return {\n CollectionView : CollectionView,\n ListCollectionView : ListCollectionView,\n PairCollectionView : PairCollectionView,\n ListOfPairsCollectionView : ListOfPairsCollectionView,\n ListOfListsCollectionView : ListOfListsCollectionView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-view.js","define([\n \"mvc/dataset/states\",\n \"mvc/dataset/dataset-li\",\n \"mvc/tag\",\n \"mvc/annotation\",\n \"ui/fa-icon-button\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, DATASET_LI, TAGS, ANNOTATIONS, faIconButton, BASE_MVC, _l ){\n\n'use strict';\n//==============================================================================\nvar _super = DATASET_LI.DatasetListItemView;\n/** @class Editing view for DatasetAssociation.\n */\nvar DatasetListItemEdit = _super.extend(\n/** @lends DatasetListItemEdit.prototype */{\n\n /** set up: options */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n this.hasUser = attributes.hasUser;\n\n /** allow user purge of dataset files? */\n this.purgeAllowed = attributes.purgeAllowed || false;\n\n //TODO: move to HiddenUntilActivatedViewMixin\n /** should the tags editor be shown or hidden initially? */\n this.tagsEditorShown = attributes.tagsEditorShown || false;\n /** should the tags editor be shown or hidden initially? */\n this.annotationEditorShown = attributes.annotationEditorShown || false;\n },\n\n // ......................................................................... titlebar actions\n /** In this override, add the other two primary actions: edit and delete */\n _renderPrimaryActions : function(){\n var actions = _super.prototype._renderPrimaryActions.call( this );\n if( this.model.get( 'state' ) === STATES.NOT_VIEWABLE ){\n return actions;\n }\n // render the display, edit attr and delete icon-buttons\n return _super.prototype._renderPrimaryActions.call( this ).concat([\n this._renderEditButton(),\n this._renderDeleteButton()\n ]);\n },\n\n //TODO: move titleButtons into state renderers, remove state checks in the buttons\n\n /** Render icon-button to edit the attributes (format, permissions, etc.) this dataset. */\n _renderEditButton : function(){\n // don't show edit while uploading, in-accessible\n // DO show if in error (ala previous history panel)\n if( ( this.model.get( 'state' ) === STATES.DISCARDED )\n || ( !this.model.get( 'accessible' ) ) ){\n return null;\n }\n\n var purged = this.model.get( 'purged' ),\n deleted = this.model.get( 'deleted' ),\n editBtnData = {\n title : _l( 'Edit attributes' ),\n href : Galaxy.root + 'datasets/edit?dataset_id=' + this.model.attributes.id,\n faIcon : 'fa-pencil',\n classes : 'edit-btn'\n };\n // disable if purged or deleted and explain why in the tooltip\n if( deleted || purged ){\n editBtnData.disabled = true;\n if( purged ){\n editBtnData.title = _l( 'Cannot edit attributes of datasets removed from disk' );\n } else if( deleted ){\n editBtnData.title = _l( 'Undelete dataset to edit attributes' );\n }\n\n // disable if still uploading or new\n } else if( _.contains( [ STATES.UPLOAD, STATES.NEW ], this.model.get( 'state' ) ) ){\n editBtnData.disabled = true;\n editBtnData.title = _l( 'This dataset is not yet editable' );\n }\n return faIconButton( editBtnData );\n },\n\n /** Render icon-button to delete this hda. */\n _renderDeleteButton : function(){\n // don't show delete if...\n if( ( !this.model.get( 'accessible' ) ) ){\n return null;\n }\n\n var self = this,\n deletedAlready = this.model.isDeletedOrPurged();\n return faIconButton({\n title : !deletedAlready? _l( 'Delete' ) : _l( 'Dataset is already deleted' ),\n disabled : deletedAlready,\n faIcon : 'fa-times',\n classes : 'delete-btn',\n onclick : function() {\n // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n self.$el.find( '.icon-btn.delete-btn' ).trigger( 'mouseout' );\n self.model[ 'delete' ]();\n }\n });\n },\n\n // ......................................................................... details\n /** In this override, add tags and annotations controls, make the ? dbkey a link to editing page */\n _renderDetails : function(){\n //TODO: generalize to be allow different details for each state\n var $details = _super.prototype._renderDetails.call( this ),\n state = this.model.get( 'state' );\n\n if( !this.model.isDeletedOrPurged() && _.contains([ STATES.OK, STATES.FAILED_METADATA ], state ) ){\n this._renderTags( $details );\n this._renderAnnotation( $details );\n this._makeDbkeyEditLink( $details );\n }\n\n this._setUpBehaviors( $details );\n return $details;\n },\n\n /**************************************************************************\n * Render help button to show tool help text without rerunning the tool.\n * Issue #2100\n */\n _renderToolHelpButton : function() {\n var datasetID = this.model.attributes.dataset_id;\n var jobID = this.model.attributes.creating_job;\n var self = this;\n\n var parseToolBuild = function(data) {\n var helpString = '
                                    '\n if (data.name && data.help){\n helpString += 'Tool help for ' + data.name + '
                                    ';\n helpString += data.help;\n } else {\n helpString += 'Tool help is unavailable for this dataset.
                                    ';\n }\n helpString += '
                                    ';\n self.$el.find( '.details' ).append($.parseHTML(helpString));\n };\n var parseToolID = function(data) {\n $.ajax({\n url: Galaxy.root + 'api/tools/' + data.tool_id + '/build'\n }).done(function(data){\n parseToolBuild(data);\n }).fail(function(){\n parseToolBuild({})\n });\n };\n if (Galaxy.user.id === null){\n return null\n }\n return faIconButton({\n title: _l('Tool Help'),\n classes: 'icon-btn',\n href: '#',\n faIcon: 'fa-question',\n onclick: function() {\n var divString = 'thdiv-' + datasetID;\n if (self.$el.find(\".toolhelp\").length > 0){\n self.$el.find(\".toolhelp\").toggle();\n } else {\n $.ajax({\n url: Galaxy.root + 'api/jobs/' + jobID\n }).done(function(data){\n parseToolID(data);\n }).fail(function(){\n console.log('Failed at recovering job information from the Galaxy API for job id \"' + jobID + '\".');\n });\n }\n }\n });\n },\n //*************************************************************************\n\n /** Add less commonly used actions in the details section based on state */\n _renderSecondaryActions : function(){\n var actions = _super.prototype._renderSecondaryActions.call( this );\n switch( this.model.get( 'state' ) ){\n case STATES.UPLOAD:\n case STATES.NOT_VIEWABLE:\n return actions;\n case STATES.ERROR:\n // error button comes first\n actions.unshift( this._renderErrButton() );\n return actions.concat([ this._renderRerunButton(), this._renderToolHelpButton() ]);\n case STATES.OK:\n case STATES.FAILED_METADATA:\n return actions.concat([ this._renderRerunButton(), this._renderVisualizationsButton(), this._renderToolHelpButton() ]);\n }\n return actions.concat([ this._renderRerunButton(), this._renderToolHelpButton() ]);\n },\n\n /** Render icon-button to report an error on this dataset to the galaxy admin. */\n _renderErrButton : function(){\n return faIconButton({\n title : _l( 'View or report this error' ),\n href : Galaxy.root + 'datasets/error?dataset_id=' + this.model.attributes.id,\n classes : 'report-error-btn',\n faIcon : 'fa-bug'\n });\n },\n\n /** Render icon-button to re-run the job that created this dataset. */\n _renderRerunButton : function(){\n var creating_job = this.model.get( 'creating_job' );\n if( this.model.get( 'rerunnable' ) ){\n return faIconButton({\n title : _l( 'Run this job again' ),\n href : this.model.urls.rerun,\n classes : 'rerun-btn',\n target : this.linkTarget,\n faIcon : 'fa-refresh',\n onclick : function( ev ) {\n ev.preventDefault();\n Galaxy.router.push( '/', { job_id : creating_job } );\n }\n });\n }\n },\n\n /** Render an icon-button or popupmenu of links based on the applicable visualizations */\n _renderVisualizationsButton : function(){\n //TODO: someday - lazyload visualizations\n var visualizations = this.model.get( 'visualizations' );\n if( ( this.model.isDeletedOrPurged() )\n || ( !this.hasUser )\n || ( !this.model.hasData() )\n || ( _.isEmpty( visualizations ) ) ){\n return null;\n }\n if( !_.isObject( visualizations[0] ) ){\n this.warn( 'Visualizations have been switched off' );\n return null;\n }\n\n var $visualizations = $( this.templates.visualizations( visualizations, this ) );\n //HACK: need to re-write those directed at galaxy_main with linkTarget\n $visualizations.find( '[target=\"galaxy_main\"]').attr( 'target', this.linkTarget );\n // use addBack here to include the root $visualizations elem (for the case of 1 visualization)\n this._addScratchBookFn( $visualizations.find( '.visualization-link' ).addBack( '.visualization-link' ) );\n return $visualizations;\n },\n\n /** add scratchbook functionality to visualization links */\n _addScratchBookFn : function( $links ){\n var li = this;\n $links.click( function( ev ){\n if( Galaxy.frame && Galaxy.frame.active ){\n Galaxy.frame.add({\n title : 'Visualization',\n url : $( this ).attr( 'href' )\n });\n ev.preventDefault();\n ev.stopPropagation();\n }\n });\n },\n\n //TODO: if possible move these to readonly view - but display the owner's tags/annotation (no edit)\n /** Render the tags list/control */\n _renderTags : function( $where ){\n if( !this.hasUser ){ return; }\n var view = this;\n this.tagsEditor = new TAGS.TagsEditor({\n model : this.model,\n el : $where.find( '.tags-display' ),\n onshowFirstTime : function(){ this.render(); },\n // persist state on the hda view (and not the editor) since these are currently re-created each time\n onshow : function(){ view.tagsEditorShown = true; },\n onhide : function(){ view.tagsEditorShown = false; },\n $activator : faIconButton({\n title : _l( 'Edit dataset tags' ),\n classes : 'tag-btn',\n faIcon : 'fa-tags'\n }).appendTo( $where.find( '.actions .right' ) )\n });\n if( this.tagsEditorShown ){ this.tagsEditor.toggle( true ); }\n },\n\n /** Render the annotation display/control */\n _renderAnnotation : function( $where ){\n if( !this.hasUser ){ return; }\n var view = this;\n this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n model : this.model,\n el : $where.find( '.annotation-display' ),\n onshowFirstTime : function(){ this.render(); },\n // persist state on the hda view (and not the editor) since these are currently re-created each time\n onshow : function(){ view.annotationEditorShown = true; },\n onhide : function(){ view.annotationEditorShown = false; },\n $activator : faIconButton({\n title : _l( 'Edit dataset annotation' ),\n classes : 'annotate-btn',\n faIcon : 'fa-comment'\n }).appendTo( $where.find( '.actions .right' ) )\n });\n if( this.annotationEditorShown ){ this.annotationEditor.toggle( true ); }\n },\n\n /** If the format/dbkey/genome_build isn't set, make the display a link to the edit page */\n _makeDbkeyEditLink : function( $details ){\n // make the dbkey a link to editing\n if( this.model.get( 'metadata_dbkey' ) === '?'\n && !this.model.isDeletedOrPurged() ){\n var editableDbkey = $( '?' )\n .attr( 'href', this.model.urls.edit )\n .attr( 'target', this.linkTarget );\n $details.find( '.dbkey .value' ).replaceWith( editableDbkey );\n }\n },\n\n // ......................................................................... events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .undelete-link' : '_clickUndeleteLink',\n 'click .purge-link' : '_clickPurgeLink',\n\n 'click .edit-btn' : function( ev ){ this.trigger( 'edit', this, ev ); },\n 'click .delete-btn' : function( ev ){ this.trigger( 'delete', this, ev ); },\n 'click .rerun-btn' : function( ev ){ this.trigger( 'rerun', this, ev ); },\n 'click .report-err-btn' : function( ev ){ this.trigger( 'report-err', this, ev ); },\n 'click .visualization-btn' : function( ev ){ this.trigger( 'visualize', this, ev ); },\n 'click .dbkey a' : function( ev ){ this.trigger( 'edit', this, ev ); }\n }),\n\n /** listener for item undelete (in the messages section) */\n _clickUndeleteLink : function( ev ){\n this.model.undelete();\n return false;\n },\n\n /** listener for item purge (in the messages section) */\n _clickPurgeLink : function( ev ){\n if( confirm( _l( 'This will permanently remove the data in your dataset. Are you sure?' ) ) ){\n this.model.purge();\n }\n return false;\n },\n\n // ......................................................................... misc\n /** string rep */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDAEditView(' + modelString + ')';\n }\n});\n\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetListItemEdit.prototype.templates = (function(){\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n failed_metadata : BASE_MVC.wrapTemplate([\n // in this override, provide a link to the edit page\n '<% if( dataset.state === \"failed_metadata\" ){ %>',\n '',\n '<% } %>'\n ], 'dataset' ),\n\n deleted : BASE_MVC.wrapTemplate([\n // in this override, provide links to undelete or purge the dataset\n '<% if( dataset.deleted && !dataset.purged ){ %>',\n // deleted not purged\n '
                                    ',\n _l( 'This dataset has been deleted' ),\n '
                                    ', _l( 'Undelete it' ), '',\n '<% if( view.purgeAllowed ){ %>',\n '
                                    ',\n _l( 'Permanently remove it from disk' ),\n '',\n '<% } %>',\n '
                                    ',\n '<% } %>'\n ], 'dataset' )\n });\n\n var visualizationsTemplate = BASE_MVC.wrapTemplate([\n '<% if( visualizations.length === 1 ){ %>',\n '\"',\n ' target=\"<%- visualizations[0].target %>\" title=\"', _l( 'Visualize in' ),\n ' <%- visualizations[0].html %>\">',\n '',\n '',\n\n '<% } else { %>',\n '
                                    ',\n '',\n '',\n '',\n '',\n '
                                    ',\n '<% } %>'\n ], 'visualizations' );\n\n return _.extend( {}, _super.prototype.templates, {\n warnings : warnings,\n visualizations : visualizationsTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n DatasetListItemEdit : DatasetListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-li-edit.js","define([\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, BASE_MVC, _l ){\n'use strict';\n\nvar logNamespace = 'dataset';\n//==============================================================================\nvar searchableMixin = BASE_MVC.SearchableModelMixin;\n/** @class base model for any DatasetAssociation (HDAs, LDDAs, DatasetCollectionDAs).\n * No knowledge of what type (HDA/LDDA/DCDA) should be needed here.\n * The DA's are made searchable (by attribute) by mixing in SearchableModelMixin.\n */\nvar DatasetAssociation = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( BASE_MVC.mixin( searchableMixin, /** @lends DatasetAssociation.prototype */{\n _logNamespace : logNamespace,\n\n /** default attributes for a model */\n defaults : {\n state : STATES.NEW,\n deleted : false,\n purged : false,\n name : '(unnamed dataset)',\n accessible : true,\n // sniffed datatype (sam, tabular, bed, etc.)\n data_type : '',\n file_ext : '',\n file_size : 0,\n\n // array of associated file types (eg. [ 'bam_index', ... ])\n meta_files : [],\n\n misc_blurb : '',\n misc_info : '',\n\n tags : []\n // do NOT default on annotation, as this default is valid and will be passed on 'save'\n // which is incorrect behavior when the model is only partially fetched (annos are not passed in summary data)\n //annotation : ''\n },\n\n /** instance vars and listeners */\n initialize : function( attributes, options ){\n this.debug( this + '(Dataset).initialize', attributes, options );\n\n //!! this state is not in trans.app.model.Dataset.states - set it here -\n if( !this.get( 'accessible' ) ){\n this.set( 'state', STATES.NOT_VIEWABLE );\n }\n\n /** Datasets rely/use some web controllers - have the model generate those URLs on startup */\n this.urls = this._generateUrls();\n\n this._setUpListeners();\n },\n\n /** returns misc. web urls for rendering things like re-run, display, etc. */\n _generateUrls : function(){\n var id = this.get( 'id' );\n if( !id ){ return {}; }\n var urls = {\n 'purge' : 'datasets/' + id + '/purge_async',\n 'display' : 'datasets/' + id + '/display/?preview=True',\n 'edit' : 'datasets/' + id + '/edit',\n 'download' : 'datasets/' + id + '/display' + this._downloadQueryParameters(),\n 'report_error' : 'dataset/errors?id=' + id,\n 'rerun' : 'tool_runner/rerun?id=' + id,\n 'show_params' : 'datasets/' + id + '/show_params',\n 'visualization' : 'visualization',\n 'meta_download' : 'dataset/get_metadata_file?hda_id=' + id + '&metadata_name='\n };\n _.each( urls, function( value, key ){\n urls[ key ] = Galaxy.root + value;\n });\n this.urls = urls;\n return urls;\n },\n\n _downloadQueryParameters : function() {\n return '?to_ext=' + this.get( 'file_ext' );\n },\n\n /** set up any event listeners\n * event: state:ready fired when this DA moves into/is already in a ready state\n */\n _setUpListeners : function(){\n // if the state has changed and the new state is a ready state, fire an event\n this.on( 'change:state', function( currModel, newState ){\n this.log( this + ' has changed state:', currModel, newState );\n if( this.inReadyState() ){\n this.trigger( 'state:ready', currModel, newState, this.previous( 'state' ) );\n }\n });\n // the download url (currently) relies on having a correct file extension\n this.on( 'change:id change:file_ext', function( currModel ){\n this._generateUrls();\n });\n },\n\n // ........................................................................ common queries\n /** override to add urls */\n toJSON : function(){\n var json = Backbone.Model.prototype.toJSON.call( this );\n //console.warn( 'returning json?' );\n //return json;\n return _.extend( json, {\n urls : this.urls\n });\n },\n\n /** Is this dataset deleted or purged? */\n isDeletedOrPurged : function(){\n return ( this.get( 'deleted' ) || this.get( 'purged' ) );\n },\n\n /** Is this dataset in a 'ready' state; where 'Ready' states are states where no\n * processing (for the ds) is left to do on the server.\n */\n inReadyState : function(){\n var ready = _.contains( STATES.READY_STATES, this.get( 'state' ) );\n return ( this.isDeletedOrPurged() || ready );\n },\n\n /** Does this model already contain detailed data (as opposed to just summary level data)? */\n hasDetails : function(){\n // if it's inaccessible assume it has everything it needs\n if( !this.get( 'accessible' ) ){ return true; }\n return this.has( 'annotation' );\n },\n\n /** Convenience function to match dataset.has_data. */\n hasData : function(){\n return ( this.get( 'file_size' ) > 0 );\n },\n\n // ........................................................................ ajax\n fetch : function( options ){\n var dataset = this;\n return Backbone.Model.prototype.fetch.call( this, options )\n .always( function(){\n dataset._generateUrls();\n });\n },\n\n /** override to use actual Dates objects for create/update times */\n parse : function( response, options ){\n var parsed = Backbone.Model.prototype.parse.call( this, response, options );\n if( parsed.create_time ){\n parsed.create_time = new Date( parsed.create_time );\n }\n if( parsed.update_time ){\n parsed.update_time = new Date( parsed.update_time );\n }\n return parsed;\n },\n\n /** override to wait by default */\n save : function( attrs, options ){\n options = options || {};\n options.wait = _.isUndefined( options.wait ) ? true : options.wait;\n return Backbone.Model.prototype.save.call( this, attrs, options );\n },\n\n //NOTE: subclasses of DA's will need to implement url and urlRoot in order to have these work properly\n /** save this dataset, _Mark_ing it as deleted (just a flag) */\n 'delete' : function( options ){\n if( this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: true }, options );\n },\n /** save this dataset, _Mark_ing it as undeleted */\n undelete : function( options ){\n if( !this.get( 'deleted' ) || this.get( 'purged' ) ){ return jQuery.when(); }\n return this.save( { deleted: false }, options );\n },\n\n /** remove the file behind this dataset from the filesystem (if permitted) */\n purge : function _purge( options ){\n //TODO: use, override model.destroy, HDA.delete({ purge: true })\n if( this.get( 'purged' ) ){ return jQuery.when(); }\n options = options || {};\n options.url = this.urls.purge;\n\n //TODO: ideally this would be a DELETE call to the api\n // using purge async for now\n var hda = this,\n xhr = jQuery.ajax( options );\n xhr.done( function( message, status, responseObj ){\n hda.set({ deleted: true, purged: true });\n });\n xhr.fail( function( xhr, status, message ){\n // Exception messages are hidden within error page including: '...not allowed in this Galaxy instance.'\n // unbury and re-add to xhr\n var error = _l( \"Unable to purge dataset\" );\n var messageBuriedInUnfortunatelyFormattedError = ( 'Removal of datasets by users '\n + 'is not allowed in this Galaxy instance' );\n if( xhr.responseJSON && xhr.responseJSON.error ){\n error = xhr.responseJSON.error;\n } else if( xhr.responseText.indexOf( messageBuriedInUnfortunatelyFormattedError ) !== -1 ){\n error = messageBuriedInUnfortunatelyFormattedError;\n }\n xhr.responseText = error;\n hda.trigger( 'error', hda, xhr, options, _l( error ), { error: error } );\n });\n return xhr;\n },\n\n // ........................................................................ searching\n /** what attributes of an HDA will be used in a text search */\n searchAttributes : [\n 'name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'\n ],\n\n /** our attr keys don't often match the labels we display to the user - so, when using\n * attribute specifiers ('name=\"bler\"') in a term, allow passing in aliases for the\n * following attr keys.\n */\n searchAliases : {\n title : 'name',\n format : 'file_ext',\n database : 'genome_build',\n blurb : 'misc_blurb',\n description : 'misc_blurb',\n info : 'misc_info',\n tag : 'tags'\n },\n\n // ........................................................................ misc\n /** String representation */\n toString : function(){\n var nameAndId = this.get( 'id' ) || '';\n if( this.get( 'name' ) ){\n nameAndId = '\"' + this.get( 'name' ) + '\",' + nameAndId;\n }\n return 'Dataset(' + nameAndId + ')';\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection for dataset associations.\n */\nvar DatasetAssociationCollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).extend(\n/** @lends HistoryContents.prototype */{\n _logNamespace : logNamespace,\n\n model : DatasetAssociation,\n\n /** root api url */\n urlRoot : Galaxy.root + 'api/datasets',\n\n /** url fn */\n url : function(){\n return this.urlRoot;\n },\n\n // ........................................................................ common queries\n /** Get the ids of every item in this collection\n * @returns array of encoded ids\n */\n ids : function(){\n return this.map( function( item ){ return item.get('id'); });\n },\n\n /** Get contents that are not ready\n * @returns array of content models\n */\n notReady : function(){\n return this.filter( function( content ){\n return !content.inReadyState();\n });\n },\n\n /** return true if any datasets don't have details */\n haveDetails : function(){\n return this.all( function( dataset ){ return dataset.hasDetails(); });\n },\n\n // ........................................................................ ajax\n /** using a queue, perform ajaxFn on each of the models in this collection */\n ajaxQueue : function( ajaxFn, options ){\n var deferred = jQuery.Deferred(),\n startingLength = this.length,\n responses = [];\n\n if( !startingLength ){\n deferred.resolve([]);\n return deferred;\n }\n\n // use reverse order (stylistic choice)\n var ajaxFns = this.chain().reverse().map( function( dataset, i ){\n return function(){\n var xhr = ajaxFn.call( dataset, options );\n // if successful, notify using the deferred to allow tracking progress\n xhr.done( function( response ){\n deferred.notify({ curr: i, total: startingLength, response: response, model: dataset });\n });\n // (regardless of previous error or success) if not last ajax call, shift and call the next\n // if last fn, resolve deferred\n xhr.always( function( response ){\n responses.push( response );\n if( ajaxFns.length ){\n ajaxFns.shift()();\n } else {\n deferred.resolve( responses );\n }\n });\n };\n }).value();\n // start the queue\n ajaxFns.shift()();\n\n return deferred;\n },\n\n // ........................................................................ sorting/filtering\n /** return a new collection of datasets whose attributes contain the substring matchesWhat */\n matches : function( matchesWhat ){\n return this.filter( function( dataset ){\n return dataset.matches( matchesWhat );\n });\n },\n\n /** String representation. */\n toString : function(){\n return ([ 'DatasetAssociationCollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n DatasetAssociation : DatasetAssociation,\n DatasetAssociationCollection : DatasetAssociationCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-model.js","define([\n \"mvc/ui/ui-modal\",\n \"mvc/ui/error-modal\",\n \"utils/localization\"\n], function( MODAL, ERROR_MODAL, _l ){\n\n'use strict';\n\n//==============================================================================\n/**\n * A dialog/modal that allows copying a user history or 'importing' from user\n * another. Generally called via historyCopyDialog below.\n * @type {Object}\n */\nvar CopyDialog = {\n\n // language related strings/fns\n defaultName : _.template( \"Copy of '<%- name %>'\" ),\n title : _.template( _l( 'Copying history' ) + ' \"<%- name %>\"' ),\n submitLabel : _l( 'Copy' ),\n errorMessage : _l( 'History could not be copied.' ),\n progressive : _l( 'Copying history' ),\n activeLabel : _l( 'Copy only the active, non-deleted datasets' ),\n allLabel : _l( 'Copy all datasets including deleted ones' ),\n anonWarning : _l( 'As an anonymous user, unless you login or register, you will lose your current history ' ) +\n _l( 'after copying this history. ' ),\n\n // template for modal body\n _template : _.template([\n //TODO: remove inline styles\n // show a warning message for losing current to anon users\n '<% if( isAnon ){ %>',\n '
                                    ',\n '<%- anonWarning %>',\n _l( 'You can' ),\n ' ', _l( 'login here' ), ' ', _l( 'or' ), ' ',\n ' ', _l( 'register here' ), '.',\n '
                                    ',\n '<% } %>',\n '
                                    ',\n '
                                    ',\n // TODO: could use required here and the form validators\n // NOTE: use unescaped here if escaped in the modal function below\n '\" />',\n '

                                    ',\n _l( 'Please enter a valid history title' ),\n '

                                    ',\n // if allowAll, add the option to copy deleted datasets, too\n '<% if( allowAll ){ %>',\n '
                                    ',\n '

                                    ', _l( 'Choose which datasets from the original history to include:' ), '

                                    ',\n // copy non-deleted is the default\n '/>',\n '',\n '
                                    ',\n '/>',\n '',\n '<% } %>',\n '
                                    '\n ].join( '' )),\n\n // empty modal body and let the user know the copy is happening\n _showAjaxIndicator : function _showAjaxIndicator(){\n var indicator = '

                                    ' + this.progressive + '...

                                    ';\n this.modal.$( '.modal-body' ).empty().append( indicator ).css({ 'margin-top': '8px' });\n },\n\n // (sorta) public interface - display the modal, render the form, and potentially copy the history\n // returns a jQuery.Deferred done->history copied, fail->user cancelled\n dialog : function _dialog( modal, history, options ){\n options = options || {};\n\n var dialog = this,\n deferred = jQuery.Deferred(),\n // TODO: getting a little byzantine here\n defaultCopyNameFn = options.nameFn || this.defaultName,\n defaultCopyName = defaultCopyNameFn({ name: history.get( 'name' ) }),\n // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n defaultCopyWhat = options.allDatasets? 'copy-all' : 'copy-non-deleted',\n allowAll = !_.isUndefined( options.allowAll )? options.allowAll : true,\n autoClose = !_.isUndefined( options.autoClose )? options.autoClose : true;\n\n this.modal = modal;\n\n\n // validate the name and copy if good\n function checkNameAndCopy(){\n var name = modal.$( '#copy-modal-title' ).val();\n if( !name ){\n modal.$( '.invalid-title' ).show();\n return;\n }\n // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n var copyAllDatasets = modal.$( 'input[name=\"copy-what\"]:checked' ).val() === 'copy-all';\n modal.$( 'button' ).prop( 'disabled', true );\n dialog._showAjaxIndicator();\n history.copy( true, name, copyAllDatasets )\n .done( function( response ){\n deferred.resolve( response );\n })\n .fail( function( xhr, status, message ){\n var options = { name: name, copyAllDatasets: copyAllDatasets };\n ERROR_MODAL.ajaxErrorModal( history, xhr, options, dialog.errorMessage );\n deferred.rejectWith( deferred, arguments );\n })\n .done( function(){\n if( autoClose ){ modal.hide(); }\n });\n }\n\n var originalClosingCallback = options.closing_callback;\n modal.show( _.extend( options, {\n title : this.title({ name: history.get( 'name' ) }),\n body : $( dialog._template({\n name : defaultCopyName,\n isAnon : Galaxy.user.isAnonymous(),\n allowAll : allowAll,\n copyWhat : defaultCopyWhat,\n activeLabel : this.activeLabel,\n allLabel : this.allLabel,\n anonWarning : this.anonWarning,\n })),\n buttons : _.object([\n [ _l( 'Cancel' ), function(){ modal.hide(); } ],\n [ this.submitLabel, checkNameAndCopy ]\n ]),\n height : 'auto',\n closing_events : true,\n closing_callback: function _historyCopyClose( cancelled ){\n if( cancelled ){\n deferred.reject({ cancelled : true });\n }\n if( originalClosingCallback ){\n originalClosingCallback( cancelled );\n }\n }\n }));\n\n // set the default dataset copy, autofocus the title, and set up for a simple return\n modal.$( '#copy-modal-title' ).focus().select();\n modal.$( '#copy-modal-title' ).on( 'keydown', function( ev ){\n if( ev.keyCode === 13 ){\n ev.preventDefault();\n checkNameAndCopy();\n }\n });\n\n return deferred;\n },\n};\n\n//==============================================================================\n// maintain the (slight) distinction between copy and import\n/**\n * Subclass CopyDialog to use the import language.\n */\nvar ImportDialog = _.extend( {}, CopyDialog, {\n defaultName : _.template( \"imported: <%- name %>\" ),\n title : _.template( _l( 'Importing history' ) + ' \"<%- name %>\"' ),\n submitLabel : _l( 'Import' ),\n errorMessage : _l( 'History could not be imported.' ),\n progressive : _l( 'Importing history' ),\n activeLabel : _l( 'Import only the active, non-deleted datasets' ),\n allLabel : _l( 'Import all datasets including deleted ones' ),\n anonWarning : _l( 'As an anonymous user, unless you login or register, you will lose your current history ' ) +\n _l( 'after importing this history. ' ),\n\n});\n\n//==============================================================================\n/**\n * Main interface for both history import and history copy dialogs.\n * @param {Backbone.Model} history the history to copy\n * @param {Object} options a hash\n * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n *\n * options:\n * (this object is also passed to the modal used to display the dialog and accepts modal options)\n * {Function} nameFn if defined, use this to build the default name shown to the user\n * (the fn is passed: {name: })\n * {bool} useImport if true, use the 'import' language (instead of Copy)\n * {bool} allowAll if true, allow the user to choose between copying all datasets and\n * only non-deleted datasets\n * {String} allDatasets default initial checked radio button: 'copy-all' or 'copy-non-deleted',\n */\nvar historyCopyDialog = function( history, options ){\n options = options || {};\n // create our own modal if Galaxy doesn't have one (mako tab without use_panels)\n var modal = window.parent.Galaxy.modal || new MODAL.View({});\n return options.useImport?\n ImportDialog.dialog( modal, history, options ):\n CopyDialog.dialog( modal, history, options );\n};\n\n\n//==============================================================================\n return historyCopyDialog;\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/copy-dialog.js","define([\n \"mvc/dataset/dataset-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET_LI, BASE_MVC, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = DATASET_LI.DatasetListItemView;\n/** @class Read only view for HistoryDatasetAssociation.\n * Since there are no controls on the HDAView to hide the dataset,\n * the primary thing this class does (currently) is override templates\n * to render the HID.\n */\nvar HDAListItemView = _super.extend(\n/** @lends HDAListItemView.prototype */{\n\n className : _super.prototype.className + \" history-content\",\n\n initialize : function( attributes, options ){\n _super.prototype.initialize.call( this, attributes, options );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDAListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nHDAListItemView.prototype.templates = (function(){\n\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n // adding the hid display to the title\n '
                                    ',\n '',\n '
                                    ',\n //TODO: remove whitespace and use margin-right\n '<%- dataset.hid %> ',\n '<%- dataset.name %>',\n '
                                    ',\n '
                                    ',\n '',\n '<% _.each(_.sortBy(_.uniq(dataset.tags), function(x) { return x }), function(tag){ %>',\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n '<% } %>',\n '<% }); %>',\n '',\n '
                                    '\n ], 'dataset' );\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n hidden : BASE_MVC.wrapTemplate([\n // add a warning when hidden\n '<% if( !dataset.visible ){ %>',\n '
                                    ',\n _l( 'This dataset has been hidden' ),\n '
                                    ',\n '<% } %>'\n ], 'dataset' )\n });\n\n return _.extend( {}, _super.prototype.templates, {\n titleBar : titleBarTemplate,\n warnings : warnings\n });\n}());\n\n\n\n//==============================================================================\n return {\n HDAListItemView : HDAListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hda-li.js","define([\n \"mvc/dataset/dataset-model\",\n \"mvc/history/history-content-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET, HISTORY_CONTENT, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\nvar _super = DATASET.DatasetAssociation,\n hcontentMixin = HISTORY_CONTENT.HistoryContentMixin;\n/** @class (HDA) model for a Galaxy dataset contained in and related to a history.\n */\nvar HistoryDatasetAssociation = _super.extend( BASE_MVC.mixin( hcontentMixin,\n/** @lends HistoryDatasetAssociation.prototype */{\n\n /** default attributes for a model */\n defaults : _.extend( {}, _super.prototype.defaults, hcontentMixin.defaults, {\n history_content_type: 'dataset',\n model_class : 'HistoryDatasetAssociation'\n }),\n}));\n\n//==============================================================================\n return {\n HistoryDatasetAssociation : HistoryDatasetAssociation\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hda-model.js","define([\n \"mvc/dataset/states\",\n \"mvc/collection/collection-li\",\n \"mvc/collection/collection-view\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, DC_LI, DC_VIEW, BASE_MVC, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = DC_LI.DCListItemView;\n/** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n */\nvar HDCAListItemView = _super.extend(\n/** @lends HDCAListItemView.prototype */{\n\n className : _super.prototype.className + \" history-content\",\n\n /** event listeners */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n this.listenTo( this.model, {\n 'change:tags change:populated change:visible' : function( model, options ){ this.render(); },\n });\n },\n\n /** Override to provide the proper collections panels as the foldout */\n _getFoldoutPanelClass : function(){\n switch( this.model.get( 'collection_type' ) ){\n case 'list':\n return DC_VIEW.ListCollectionView;\n case 'paired':\n return DC_VIEW.PairCollectionView;\n case 'list:paired':\n return DC_VIEW.ListOfPairsCollectionView;\n case 'list:list':\n return DC_VIEW.ListOfListsCollectionView;\n }\n throw new TypeError( 'Uknown collection_type: ' + this.model.get( 'collection_type' ) );\n },\n\n /** In this override, add the state as a class for use with state-based CSS */\n _swapNewRender : function( $newRender ){\n _super.prototype._swapNewRender.call( this, $newRender );\n //TODO: model currently has no state\n var state = !this.model.get( 'populated' ) ? STATES.RUNNING : STATES.OK;\n //if( this.model.has( 'state' ) ){\n this.$el.addClass( 'state-' + state );\n //}\n return this.$el;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDCAListItemView(' + modelString + ')';\n }\n});\n\n/** underscore templates */\nHDCAListItemView.prototype.templates = (function(){\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n hidden : BASE_MVC.wrapTemplate([\n // add a warning when hidden\n '<% if( !collection.visible ){ %>',\n '
                                    ',\n _l( 'This collection has been hidden' ),\n '
                                    ',\n '<% } %>'\n ], 'collection' )\n });\n\n// could steal this from hda-base (or use mixed content)\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n // adding the hid display to the title\n '
                                    ',\n '',\n '
                                    ',\n //TODO: remove whitespace and use margin-right\n '<%- collection.hid %> ',\n '<%- collection.name %>',\n '
                                    ',\n '
                                    ',\n '',\n '<% _.each(_.sortBy(_.uniq(collection.tags), function(x) { return x }), function(tag){ %>',\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n '<% } %>',\n '<% }); %>',\n '',\n '
                                    '\n ], 'collection' );\n\n return _.extend( {}, _super.prototype.templates, {\n warnings : warnings,\n titleBar : titleBarTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n HDCAListItemView : HDCAListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hdca-li.js","define([\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\n/** @class Mixin for HistoryContents content (HDAs, HDCAs).\n */\nvar HistoryContentMixin = {\n\n /** default attributes for a model */\n defaults : {\n /** parent (containing) history */\n history_id : null,\n /** some content_type (HistoryContents can contain mixed model classes) */\n history_content_type: null,\n /** indicating when/what order the content was generated in the context of the history */\n hid : null,\n /** whether the user wants the content shown (visible) */\n visible : true\n },\n\n // ........................................................................ mixed content element\n // In order to be part of a MIXED bbone collection, we can't rely on the id\n // (which may collide btwn models of different classes)\n // Instead, use type_id which prefixes the history_content_type so the bbone collection can differentiate\n idAttribute : 'type_id',\n\n // ........................................................................ common queries\n /** the more common alias of visible */\n hidden : function(){\n return !this.get( 'visible' );\n },\n\n//TODO: remove\n /** based on includeDeleted, includeHidden (gen. from the container control),\n * would this ds show in the list of ds's?\n * @param {Boolean} includeDeleted are we showing deleted hdas?\n * @param {Boolean} includeHidden are we showing hidden hdas?\n */\n isVisible : function( includeDeleted, includeHidden ){\n var isVisible = true;\n if( ( !includeDeleted )\n && ( this.get( 'deleted' ) || this.get( 'purged' ) ) ){\n isVisible = false;\n }\n if( ( !includeHidden )\n && ( !this.get( 'visible' ) ) ){\n isVisible = false;\n }\n return isVisible;\n },\n\n // ........................................................................ ajax\n //TODO?: these are probably better done on the leaf classes\n /** history content goes through the 'api/histories' API */\n urlRoot: Galaxy.root + 'api/histories/',\n\n /** full url spec. for this content */\n url : function(){\n var url = this.urlRoot + this.get( 'history_id' ) + '/contents/'\n + this.get('history_content_type') + 's/' + this.get( 'id' );\n return url;\n },\n\n /** save this content as not visible */\n hide : function( options ){\n if( !this.get( 'visible' ) ){ return jQuery.when(); }\n return this.save( { visible: false }, options );\n },\n /** save this content as visible */\n unhide : function( options ){\n if( this.get( 'visible' ) ){ return jQuery.when(); }\n return this.save( { visible: true }, options );\n },\n\n // ........................................................................ misc\n toString : function(){\n return ([ this.get( 'type_id' ), this.get( 'hid' ), this.get( 'name' ) ].join(':'));\n }\n};\n\n\n//==============================================================================\n return {\n HistoryContentMixin : HistoryContentMixin\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-content-model.js","define([\n \"mvc/list/list-item\",\n \"ui/loading-indicator\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/search-input\"\n], function( LIST_ITEM, LoadingIndicator, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'list';\n/* ============================================================================\nTODO:\n\n============================================================================ */\n/** @class View for a list/collection of models and the sub-views of those models.\n * Sub-views must (at least have the interface if not) inherit from ListItemView.\n * (For a list panel that also includes some 'container' model (History->HistoryContents)\n * use ModelWithListPanel)\n *\n * Allows for:\n * searching collection/sub-views\n * selecting/multi-selecting sub-views\n *\n * Currently used:\n * for dataset/dataset-choice\n * as superclass of ModelListPanel\n */\nvar ListPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(/** @lends ListPanel.prototype */{\n _logNamespace : logNamespace,\n\n /** class to use for constructing the sub-views */\n viewClass : LIST_ITEM.ListItemView,\n /** class to used for constructing collection of sub-view models */\n collectionClass : Backbone.Collection,\n\n tagName : 'div',\n className : 'list-panel',\n\n /** (in ms) that jquery effects will use */\n fxSpeed : 'fast',\n\n /** string to display when the collection has no contents */\n emptyMsg : _l( 'This list is empty' ),\n /** displayed when no items match the search terms */\n noneFoundMsg : _l( 'No matching items found' ),\n /** string used for search placeholder */\n searchPlaceholder : _l( 'search' ),\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the list\n */\n initialize : function( attributes, options ){\n attributes = attributes || {};\n // set the logger if requested\n if( attributes.logger ){\n this.logger = attributes.logger;\n }\n this.log( this + '.initialize:', attributes );\n\n // ---- instance vars\n /** how quickly should jquery fx run? */\n this.fxSpeed = _.has( attributes, 'fxSpeed' )?( attributes.fxSpeed ):( this.fxSpeed );\n\n /** filters for displaying subviews */\n this.filters = [];\n /** current search terms */\n this.searchFor = attributes.searchFor || '';\n\n /** loading indicator */\n // this.indicator = new LoadingIndicator( this.$el );\n\n /** currently showing selectors on items? */\n this.selecting = ( attributes.selecting !== undefined )? attributes.selecting : true;\n //this.selecting = false;\n\n /** cached selected item.model.ids to persist btwn renders */\n this.selected = attributes.selected || [];\n /** the last selected item.model.id */\n this.lastSelected = null;\n\n /** are sub-views draggable */\n this.dragItems = attributes.dragItems || false;\n\n /** list item view class (when passed models) */\n this.viewClass = attributes.viewClass || this.viewClass;\n\n /** list item views */\n this.views = [];\n /** list item models */\n this.collection = attributes.collection || this._createDefaultCollection();\n\n /** filter fns run over collection items to see if they should show in the list */\n this.filters = attributes.filters || [];\n\n /** override $scrollContainer fn via attributes - fn should return jq for elem to call scrollTo on */\n this.$scrollContainer = attributes.$scrollContainer || this.$scrollContainer;\n\n /** @type {String} generic title */\n this.title = attributes.title || '';\n /** @type {String} generic subtitle */\n this.subtitle = attributes.subtitle || '';\n\n this._setUpListeners();\n },\n\n // ------------------------------------------------------------------------ listeners\n /** create any event listeners for the list */\n _setUpListeners : function(){\n this.off();\n\n //TODO: move errorHandler down into list-view from history-view or\n // pass to global error handler (Galaxy)\n this.on({\n error: function( model, xhr, options, msg, details ){\n //this.errorHandler( model, xhr, options, msg, details );\n console.error( model, xhr, options, msg, details );\n },\n // show hide the loading indicator\n loading: function(){\n this._showLoadingIndicator( 'loading...', 40 );\n },\n 'loading-done': function(){\n this._hideLoadingIndicator( 40 );\n },\n });\n\n // throw the first render up as a diff namespace using once (for outside consumption)\n this.once( 'rendered', function(){\n this.trigger( 'rendered:initial', this );\n });\n\n this._setUpCollectionListeners();\n this._setUpViewListeners();\n return this;\n },\n\n /** create and return a collection for when none is initially passed */\n _createDefaultCollection : function(){\n // override\n return new this.collectionClass([]);\n },\n\n /** listening for collection events */\n _setUpCollectionListeners : function(){\n this.log( this + '._setUpCollectionListeners', this.collection );\n this.stopListening( this.collection );\n\n // bubble up error events\n this.listenTo( this.collection, {\n error : function( model, xhr, options, msg, details ){\n this.trigger( 'error', model, xhr, options, msg, details );\n },\n update : function( collection, options ){\n var changes = options.changes;\n // console.info( collection + ', update:', changes, '\\noptions:', options );\n // more than one: render everything\n if( options.renderAll || ( changes.added.length + changes.removed.length > 1 ) ){\n return this.renderItems();\n }\n // otherwise, let the single add/remove handlers do it\n if( changes.added.length === 1 ){\n return this.addItemView( _.first( changes.added ), collection, options );\n }\n if( changes.removed.length === 1 ){\n return this.removeItemView( _.first( changes.removed ), collection, options );\n }\n }\n });\n return this;\n },\n\n /** listening for sub-view events that bubble up with the 'view:' prefix */\n _setUpViewListeners : function(){\n this.log( this + '._setUpViewListeners' );\n\n // shift to select a range\n this.on({\n 'view:selected': function( view, ev ){\n if( ev && ev.shiftKey && this.lastSelected ){\n var lastSelectedView = this.viewFromModelId( this.lastSelected );\n if( lastSelectedView ){\n this.selectRange( view, lastSelectedView );\n }\n } else if( ev && ev.altKey && !this.selecting ){\n this.showSelectors();\n }\n this.selected.push( view.model.id );\n this.lastSelected = view.model.id;\n },\n\n 'view:de-selected': function( view, ev ){\n this.selected = _.without( this.selected, view.model.id );\n }\n });\n },\n\n // ------------------------------------------------------------------------ rendering\n /** Render this content, set up ui.\n * @param {Number or String} speed the speed of the render\n */\n render : function( speed ){\n this.log( this + '.render', speed );\n var $newRender = this._buildNewRender();\n this._setUpBehaviors( $newRender );\n this._queueNewRender( $newRender, speed );\n return this;\n },\n\n /** Build a temp div containing the new children for the view's $el. */\n _buildNewRender : function(){\n this.debug( this + '(ListPanel)._buildNewRender' );\n var $newRender = $( this.templates.el( {}, this ) );\n this._renderControls( $newRender );\n this._renderTitle( $newRender );\n this._renderSubtitle( $newRender );\n this._renderSearch( $newRender );\n this.renderItems( $newRender );\n return $newRender;\n },\n\n /** Build a temp div containing the new children for the view's $el. */\n _renderControls : function( $newRender ){\n this.debug( this + '(ListPanel)._renderControls' );\n var $controls = $( this.templates.controls( {}, this ) );\n $newRender.find( '.controls' ).replaceWith( $controls );\n return $controls;\n },\n\n /** return a jQuery object containing the title DOM */\n _renderTitle : function( $where ){\n //$where = $where || this.$el;\n //$where.find( '.title' ).replaceWith( ... )\n },\n\n /** return a jQuery object containing the subtitle DOM (if any) */\n _renderSubtitle : function( $where ){\n //$where = $where || this.$el;\n //$where.find( '.title' ).replaceWith( ... )\n },\n\n /** Fade out the old el, swap in the new contents, then fade in.\n * @param {Number or String} speed jq speed to use for rendering effects\n * @fires rendered when rendered\n */\n _queueNewRender : function( $newRender, speed ) {\n speed = ( speed === undefined )?( this.fxSpeed ):( speed );\n var panel = this;\n panel.log( '_queueNewRender:', $newRender, speed );\n\n $( panel ).queue( 'fx', [\n function( next ){\n panel.$el.fadeOut( speed, next );\n },\n function( next ){\n panel._swapNewRender( $newRender );\n next();\n },\n function( next ){\n panel.$el.fadeIn( speed, next );\n },\n function( next ){\n panel.trigger( 'rendered', panel );\n next();\n }\n ]);\n },\n\n /** empty out the current el, move the $newRender's children in */\n _swapNewRender : function( $newRender ){\n this.$el.empty().attr( 'class', this.className ).append( $newRender.children() );\n if( this.selecting ){ this.showSelectors( 0 ); }\n return this;\n },\n\n /** Set up any behaviors, handlers (ep. plugins) that need to be called when the entire view has been built but\n * not attached to the page yet.\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n this.$controls( $where ).find('[title]').tooltip();\n // set up the pupup for actions available when multi selecting\n this._renderMultiselectActionMenu( $where );\n return this;\n },\n\n /** render a menu containing the actions available to sets of selected items */\n _renderMultiselectActionMenu : function( $where ){\n $where = $where || this.$el;\n var $menu = $where.find( '.list-action-menu' ),\n actions = this.multiselectActions();\n if( !actions.length ){\n return $menu.empty();\n }\n\n var $newMenu = $([\n '
                                    ',\n '',\n '
                                      ', '
                                    ',\n '
                                    '\n ].join(''));\n var $actions = actions.map( function( action ){\n var html = [ '
                                  • ', action.html, '
                                  • ' ].join( '' );\n return $( html ).click( function( ev ){\n ev.preventDefault();\n return action.func( ev );\n });\n });\n $newMenu.find( 'ul' ).append( $actions );\n $menu.replaceWith( $newMenu );\n return $newMenu;\n },\n\n /** return a list of plain objects used to render multiselect actions menu. Each object should have:\n * html: an html string used as the anchor contents\n * func: a function called when the anchor is clicked (passed the click event)\n */\n multiselectActions : function(){\n return [];\n },\n\n // ------------------------------------------------------------------------ sub-$element shortcuts\n /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n $scrollContainer : function( $where ){\n // override or set via attributes.$scrollContainer\n return ( $where || this.$el ).parent().parent();\n },\n /** convenience selector for the section that displays the list controls */\n $controls : function( $where ){\n return ( $where || this.$el ).find( '> .controls' );\n },\n /** list-items: where the subviews are contained in the view's dom */\n $list : function( $where ){\n return ( $where || this.$el ).find( '> .list-items' );\n },\n /** container where list messages are attached */\n $messages : function( $where ){\n //TODO: controls isn't really correct here (only for ModelListPanel)\n return ( $where || this.$el ).find( '> .controls .messages' );\n },\n /** the message displayed when no views can be shown (no views, none matching search) */\n $emptyMessage : function( $where ){\n return ( $where || this.$el ).find( '> .empty-message' );\n },\n\n // ------------------------------------------------------------------------ hda sub-views\n /** render the subviews for the list's collection */\n renderItems : function( $whereTo ){\n $whereTo = $whereTo || this.$el;\n var panel = this;\n panel.log( this + '.renderItems', $whereTo );\n\n var $list = panel.$list( $whereTo );\n panel.freeViews();\n // console.log( 'views freed' );\n //TODO:? cache and re-use views?\n var shownModels = panel._filterCollection();\n // console.log( 'models filtered:', shownModels );\n\n panel.views = shownModels.map( function( itemModel ){\n var view = panel._createItemView( itemModel );\n return view;\n });\n\n $list.empty();\n // console.log( 'list emptied' );\n if( panel.views.length ){\n panel._attachItems( $whereTo );\n // console.log( 'items attached' );\n }\n panel._renderEmptyMessage( $whereTo ).toggle( !panel.views.length );\n panel.trigger( 'views:ready', panel.views );\n\n // console.log( '------------------------------------------- rendering items' );\n return panel.views;\n },\n\n /** Filter the collection to only those models that should be currently viewed */\n _filterCollection : function(){\n // override this\n var panel = this;\n return panel.collection.filter( _.bind( panel._filterItem, panel ) );\n },\n\n /** Should the model be viewable in the current state?\n * Checks against this.filters and this.searchFor\n */\n _filterItem : function( model ){\n // override this\n var panel = this;\n return ( _.every( panel.filters.map( function( fn ){ return fn.call( model ); }) ) )\n && ( !panel.searchFor || model.matchesAll( panel.searchFor ) );\n },\n\n /** Create a view for a model and set up it's listeners */\n _createItemView : function( model ){\n var ViewClass = this._getItemViewClass( model );\n var options = _.extend( this._getItemViewOptions( model ), {\n model : model\n });\n var view = new ViewClass( options );\n this._setUpItemViewListeners( view );\n return view;\n },\n\n /** Free a view for a model. Note: does not remove it from the DOM */\n _destroyItemView : function( view ){\n this.stopListening( view );\n this.views = _.without( this.views, view );\n },\n\n _destroyItemViews : function( view ){\n var self = this;\n self.views.forEach( function( v ){\n self.stopListening( v );\n });\n self.views = [];\n return self;\n },\n\n /** free any sub-views the list has */\n freeViews : function(){\n return this._destroyItemViews();\n },\n\n /** Get the bbone view class based on the model */\n _getItemViewClass : function( model ){\n // override this\n return this.viewClass;\n },\n\n /** Get the options passed to the new view based on the model */\n _getItemViewOptions : function( model ){\n // override this\n return {\n //logger : this.logger,\n fxSpeed : this.fxSpeed,\n expanded : false,\n selectable : this.selecting,\n selected : _.contains( this.selected, model.id ),\n draggable : this.dragItems\n };\n },\n\n /** Set up listeners for new models */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n // send all events to the panel, re-namspaceing them with the view prefix\n this.listenTo( view, 'all', function(){\n var args = Array.prototype.slice.call( arguments, 0 );\n args[0] = 'view:' + args[0];\n panel.trigger.apply( panel, args );\n });\n\n // drag multiple - hijack ev.setData to add all selected items\n this.listenTo( view, 'draggable:dragstart', function( ev, v ){\n //TODO: set multiple drag data here\n var json = {},\n selected = this.getSelectedModels();\n if( selected.length ){\n json = selected.toJSON();\n } else {\n json = [ v.model.toJSON() ];\n }\n ev.dataTransfer.setData( 'text', JSON.stringify( json ) );\n //ev.dataTransfer.setDragImage( v.el, 60, 60 );\n }, this );\n\n return panel;\n },\n\n /** Attach views in this.views to the model based on $whereTo */\n _attachItems : function( $whereTo ){\n var self = this;\n // console.log( '_attachItems:', $whereTo, this.$list( $whereTo ) );\n //ASSUMES: $list has been emptied\n this.$list( $whereTo ).append( this.views.map( function( view ){\n return self._renderItemView$el( view );\n }));\n return this;\n },\n\n /** get a given subview's $el (or whatever may wrap it) and return it */\n _renderItemView$el : function( view ){\n // useful to wrap and override\n return view.render(0).$el;\n },\n\n /** render the empty/none-found message */\n _renderEmptyMessage : function( $whereTo ){\n this.debug( '_renderEmptyMessage', $whereTo, this.searchFor );\n var text = this.searchFor? this.noneFoundMsg : this.emptyMsg;\n return this.$emptyMessage( $whereTo ).text( text );\n },\n\n /** expand all item views */\n expandAll : function(){\n _.each( this.views, function( view ){\n view.expand();\n });\n },\n\n /** collapse all item views */\n collapseAll : function(){\n _.each( this.views, function( view ){\n view.collapse();\n });\n },\n\n // ------------------------------------------------------------------------ collection/views syncing\n /** Add a view (if the model should be viewable) to the panel */\n addItemView : function( model, collection, options ){\n // console.log( this + '.addItemView:', model );\n var panel = this;\n // get the index of the model in the list of filtered models shown by this list\n // in order to insert the view in the proper place\n //TODO:? potentially expensive\n var modelIndex = panel._filterCollection().indexOf( model );\n if( modelIndex === -1 ){ return undefined; }\n var view = panel._createItemView( model );\n // console.log( 'adding and rendering:', modelIndex, view.toString() );\n\n $( view ).queue( 'fx', [\n function( next ){\n // hide the empty message first if only view\n if( panel.$emptyMessage().is( ':visible' ) ){\n panel.$emptyMessage().fadeOut( panel.fxSpeed, next );\n } else {\n next();\n }\n },\n function( next ){\n panel._attachView( view, modelIndex );\n next();\n }\n ]);\n return view;\n },\n\n /** internal fn to add view (to both panel.views and panel.$list) */\n _attachView : function( view, modelIndex, useFx ){\n // console.log( this + '._attachView:', view, modelIndex, useFx );\n useFx = _.isUndefined( useFx )? true : useFx;\n modelIndex = modelIndex || 0;\n var panel = this;\n\n // use the modelIndex to splice into views and insert at the proper index in the DOM\n panel.views.splice( modelIndex, 0, view );\n panel._insertIntoListAt( modelIndex, panel._renderItemView$el( view ).hide() );\n\n panel.trigger( 'view:attached', view );\n if( useFx ){\n view.$el.slideDown( panel.fxSpeed, function(){\n panel.trigger( 'view:attached:rendered' );\n });\n } else {\n view.$el.show();\n panel.trigger( 'view:attached:rendered' );\n }\n return view;\n },\n\n /** insert a jq object as a child of list-items at the specified *DOM index* */\n _insertIntoListAt : function( index, $what ){\n // console.log( this + '._insertIntoListAt:', index, $what );\n var $list = this.$list();\n if( index === 0 ){\n $list.prepend( $what );\n } else {\n $list.children().eq( index - 1 ).after( $what );\n }\n return $what;\n },\n\n /** Remove a view from the panel (if found) */\n removeItemView : function( model, collection, options ){\n var panel = this;\n var view = _.find( panel.views, function( v ){ return v.model === model; });\n if( !view ){ return undefined; }\n panel.views = _.without( panel.views, view );\n panel.trigger( 'view:removed', view );\n\n // potentially show the empty message if no views left\n // use anonymous queue here - since remove can happen multiple times\n $({}).queue( 'fx', [\n function( next ){\n view.$el.fadeOut( panel.fxSpeed, next );\n },\n function( next ){\n view.remove();\n panel.trigger( 'view:removed:rendered' );\n if( !panel.views.length ){\n panel._renderEmptyMessage().fadeIn( panel.fxSpeed, next );\n } else {\n next();\n }\n }\n ]);\n return view;\n },\n\n /** get views based on model.id */\n viewFromModelId : function( id ){\n return _.find( this.views, function( v ){ return v.model.id === id; });\n },\n\n /** get views based on model */\n viewFromModel : function( model ){\n return model ? this.viewFromModelId( model.id ) : undefined;\n },\n\n /** get views based on model properties */\n viewsWhereModel : function( properties ){\n return this.views.filter( function( view ){\n return _.isMatch( view.model.attributes, properties );\n });\n },\n\n /** A range of views between (and including) viewA and viewB */\n viewRange : function( viewA, viewB ){\n if( viewA === viewB ){ return ( viewA )?( [ viewA ] ):( [] ); }\n\n var indexA = this.views.indexOf( viewA ),\n indexB = this.views.indexOf( viewB );\n\n // handle not found\n if( indexA === -1 || indexB === -1 ){\n if( indexA === indexB ){ return []; }\n return ( indexA === -1 )?( [ viewB ] ):( [ viewA ] );\n }\n // reverse if indeces are\n //note: end inclusive\n return ( indexA < indexB )?\n this.views.slice( indexA, indexB + 1 ) :\n this.views.slice( indexB, indexA + 1 );\n },\n\n // ------------------------------------------------------------------------ searching\n /** render a search input for filtering datasets shown\n * (see SearchableMixin in base-mvc for implementation of the actual searching)\n * return will start the search\n * esc will clear the search\n * clicking the clear button will clear the search\n * uses searchInput in ui.js\n */\n _renderSearch : function( $where ){\n $where.find( '.controls .search-input' ).searchInput({\n placeholder : this.searchPlaceholder,\n initialVal : this.searchFor,\n onfirstsearch : _.bind( this._firstSearch, this ),\n onsearch : _.bind( this.searchItems, this ),\n onclear : _.bind( this.clearSearch, this )\n });\n return $where;\n },\n\n /** What to do on the first search entered */\n _firstSearch : function( searchFor ){\n // override to load model details if necc.\n this.log( 'onFirstSearch', searchFor );\n return this.searchItems( searchFor );\n },\n\n /** filter view list to those that contain the searchFor terms */\n searchItems : function( searchFor, force ){\n this.log( 'searchItems', searchFor, this.searchFor, force );\n if( !force && this.searchFor === searchFor ){ return this; }\n this.searchFor = searchFor;\n this.renderItems();\n this.trigger( 'search:searching', searchFor, this );\n var $search = this.$( '> .controls .search-query' );\n if( $search.val() !== searchFor ){\n $search.val( searchFor );\n }\n return this;\n },\n\n /** clear the search filters and show all views that are normally shown */\n clearSearch : function( searchFor ){\n //this.log( 'onSearchClear', this );\n this.searchFor = '';\n this.trigger( 'search:clear', this );\n this.$( '> .controls .search-query' ).val( '' );\n this.renderItems();\n return this;\n },\n\n // ------------------------------------------------------------------------ selection\n /** @type Integer when the number of list item views is >= to this, don't animate selectors */\n THROTTLE_SELECTOR_FX_AT : 20,\n\n /** show selectors on all visible itemViews and associated controls */\n showSelectors : function( speed ){\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n this.selecting = true;\n this.$( '.list-actions' ).slideDown( speed );\n speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT? 0 : speed;\n _.each( this.views, function( view ){\n view.showSelector( speed );\n });\n //this.selected = [];\n //this.lastSelected = null;\n },\n\n /** hide selectors on all visible itemViews and associated controls */\n hideSelectors : function( speed ){\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n this.selecting = false;\n this.$( '.list-actions' ).slideUp( speed );\n speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT? 0 : speed;\n _.each( this.views, function( view ){\n view.hideSelector( speed );\n });\n this.selected = [];\n this.lastSelected = null;\n },\n\n /** show or hide selectors on all visible itemViews and associated controls */\n toggleSelectors : function(){\n if( !this.selecting ){\n this.showSelectors();\n } else {\n this.hideSelectors();\n }\n },\n\n /** select all visible items */\n selectAll : function( event ){\n _.each( this.views, function( view ){\n view.select( event );\n });\n },\n\n /** deselect all visible items */\n deselectAll : function( event ){\n this.lastSelected = null;\n _.each( this.views, function( view ){\n view.deselect( event );\n });\n },\n\n /** select a range of datasets between A and B */\n selectRange : function( viewA, viewB ){\n var range = this.viewRange( viewA, viewB );\n _.each( range, function( view ){\n view.select();\n });\n return range;\n },\n\n /** return an array of all currently selected itemViews */\n getSelectedViews : function(){\n return _.filter( this.views, function( v ){\n return v.selected;\n });\n },\n\n /** return a collection of the models of all currenly selected items */\n getSelectedModels : function(){\n // console.log( '(getSelectedModels)' );\n return new this.collection.constructor( _.map( this.getSelectedViews(), function( view ){\n return view.model;\n }));\n },\n\n // ------------------------------------------------------------------------ loading indicator\n /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n _showLoadingIndicator : function( msg, speed, callback ){\n this.debug( '_showLoadingIndicator', this.indicator, msg, speed, callback );\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n if( !this.indicator ){\n this.indicator = new LoadingIndicator( this.$el );\n this.debug( '\\t created', this.indicator );\n }\n if( !this.$el.is( ':visible' ) ){\n this.indicator.show( 0, callback );\n } else {\n this.$el.fadeOut( speed );\n this.indicator.show( msg, speed, callback );\n }\n },\n\n /** hide the loading indicator */\n _hideLoadingIndicator : function( speed, callback ){\n this.debug( '_hideLoadingIndicator', this.indicator, speed, callback );\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n if( this.indicator ){\n this.indicator.hide( speed, callback );\n }\n },\n\n // ------------------------------------------------------------------------ scrolling\n /** get the current scroll position of the panel in its parent */\n scrollPosition : function(){\n return this.$scrollContainer().scrollTop();\n },\n\n /** set the current scroll position of the panel in its parent */\n scrollTo : function( pos, speed ){\n speed = speed || 0;\n this.$scrollContainer().animate({ scrollTop: pos }, speed );\n return this;\n },\n\n /** Scrolls the panel to the top. */\n scrollToTop : function( speed ){\n return this.scrollTo( 0, speed );\n },\n\n /** scroll to the given view in list-items */\n scrollToItem : function( view, speed ){\n if( !view ){ return this; }\n return this;\n },\n\n /** Scrolls the panel to show the content with the given id. */\n scrollToId : function( id, speed ){\n return this.scrollToItem( this.viewFromModelId( id ), speed );\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : {\n 'click .select-all' : 'selectAll',\n 'click .deselect-all' : 'deselectAll'\n },\n\n // ------------------------------------------------------------------------ misc\n /** Return a string rep of the panel */\n toString : function(){\n return 'ListPanel(' + this.collection + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nListPanel.prototype.templates = (function(){\n\n var elTemplate = BASE_MVC.wrapTemplate([\n // temp container\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    '\n ]);\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                                    ',\n '
                                    ',\n '
                                    <%- view.title %>
                                    ',\n '
                                    ',\n '
                                    <%- view.subtitle %>
                                    ',\n // buttons, controls go here\n '
                                    ',\n // deleted msg, etc.\n '
                                    ',\n\n '
                                    ',\n '
                                    ',\n '
                                    ',\n\n // show when selectors are shown\n '
                                    ',\n '
                                    ',\n '',\n '',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    '\n ]);\n\n return {\n el : elTemplate,\n controls : controlsTemplate\n };\n}());\n\n\n//=============================================================================\n/** View for a model that has a sub-collection (e.g. History, DatasetCollection)\n * Allows:\n * the model to be reset\n * auto assign panel.collection to panel.model[ panel.modelCollectionKey ]\n *\n */\nvar ModelListPanel = ListPanel.extend({\n\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey : 'contents',\n\n initialize : function( attributes ){\n ListPanel.prototype.initialize.call( this, attributes );\n this.selecting = ( attributes.selecting !== undefined )? attributes.selecting : false;\n\n this.setModel( this.model, attributes );\n },\n\n /** release/free/shutdown old models and set up panel for new models\n * @fires new-model with the panel as parameter\n */\n setModel : function( model, attributes ){\n attributes = attributes || {};\n this.debug( this + '.setModel:', model, attributes );\n\n this.freeModel();\n this.freeViews();\n\n if( model ){\n var oldModelId = this.model? this.model.get( 'id' ): null;\n\n // set up the new model with user, logger, storage, events\n this.model = model;\n if( this.logger ){\n this.model.logger = this.logger;\n }\n this._setUpModelListeners();\n\n //TODO: relation btwn model, collection becoming tangled here\n // free the collection, and assign the new collection to either\n // the model[ modelCollectionKey ], attributes.collection, or an empty vanilla collection\n this.stopListening( this.collection );\n this.collection = this.model[ this.modelCollectionKey ]\n || attributes.collection\n || this._createDefaultCollection();\n this._setUpCollectionListeners();\n\n if( oldModelId && model.get( 'id' ) !== oldModelId ){\n this.trigger( 'new-model', this );\n }\n }\n return this;\n },\n\n /** free the current model and all listeners for it, free any views for the model */\n freeModel : function(){\n // stop/release the previous model, and clear cache to sub-views\n if( this.model ){\n this.stopListening( this.model );\n //TODO: see base-mvc\n //this.model.free();\n //this.model = null;\n }\n return this;\n },\n\n // ------------------------------------------------------------------------ listening\n /** listening for model events */\n _setUpModelListeners : function(){\n // override\n this.log( this + '._setUpModelListeners', this.model );\n // bounce model errors up to the panel\n this.listenTo( this.model, 'error', function(){\n var args = Array.prototype.slice.call( arguments, 0 );\n //args.unshift( 'model:error' );\n args.unshift( 'error' );\n this.trigger.apply( this, args );\n }, this );\n\n // debugging\n if( this.logger ){\n this.listenTo( this.model, 'all', function( event ){\n this.info( this + '(model)', event, arguments );\n });\n }\n return this;\n },\n\n /** Build a temp div containing the new children for the view's $el.\n */\n _renderControls : function( $newRender ){\n this.debug( this + '(ModelListPanel)._renderControls' );\n var json = this.model? this.model.toJSON() : {},\n $controls = $( this.templates.controls( json, this ) );\n $newRender.find( '.controls' ).replaceWith( $controls );\n return $controls;\n },\n\n // ------------------------------------------------------------------------ misc\n /** Return a string rep of the panel */\n toString : function(){\n return 'ModelListPanel(' + this.model + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nModelListPanel.prototype.templates = (function(){\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                                    ',\n '
                                    ',\n //TODO: this is really the only difference - consider factoring titlebar out\n '
                                    <%- model.name %>
                                    ',\n '
                                    ',\n '
                                    <%- view.subtitle %>
                                    ',\n '
                                    ',\n '
                                    ',\n\n '
                                    ',\n '
                                    ',\n '
                                    ',\n\n '
                                    ',\n '
                                    ',\n '',\n '',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    '\n ]);\n\n return _.extend( _.clone( ListPanel.prototype.templates ), {\n controls : controlsTemplate\n });\n}());\n\n\n//=============================================================================\n return {\n ListPanel : ListPanel,\n ModelListPanel : ModelListPanel\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/list/list-view.js","/** This is the run workflow tool form view. */\ndefine([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view', 'mvc/form/form-data', 'mvc/tool/tool-form-base', 'mvc/ui/ui-modal', 'mvc/webhooks', 'mvc/workflow/workflow-icons' ],\n function( Utils, Deferred, Ui, Form, FormData, ToolFormBase, Modal, Webhooks, WorkflowIcons ) {\n\n var View = Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.modal = parent.Galaxy.modal || new Modal.View();\n this.model = options && options.model || new Backbone.Model( options );\n this.deferred = new Deferred();\n this.setElement( $( '
                                    ' ).addClass( 'ui-form-composite' )\n .append( this.$message = $( '
                                    ' ) )\n .append( this.$header = $( '
                                    ' ) )\n .append( this.$steps = $( '
                                    ' ) ) );\n $( 'body' ).append( this.$el );\n this._configure();\n this.render();\n $( window ).resize( function() { self._refresh() } );\n },\n\n /** Refresh height of scrollable div below header, handle scrolling by lazy loading steps */\n _refresh: function( step_index ) {\n var margin = _.reduce( this.$el.children(), function( memo, child ) {\n return memo + $( child ).outerHeight();\n }, 0 ) - this.$steps.height() + 90;\n this.$steps.css( 'height', $( window ).height() - margin );\n },\n\n /** Configures form/step options for each workflow step */\n _configure: function() {\n var self = this;\n this.forms = [];\n this.steps = [];\n this.links = [];\n this.parms = [];\n _.each( this.model.get( 'steps' ), function( step, i ) {\n Galaxy.emit.debug( 'tool-form-composite::initialize()', i + ' : Preparing workflow step.' );\n var icon = WorkflowIcons[ step.step_type ];\n var title = parseInt( i + 1 ) + ': ' + ( step.step_label || step.step_name );\n if ( step.annotation ) {\n title += ' - ' + step.annotation;\n }\n if ( step.step_version ) {\n title += ' (Galaxy Version ' + step.step_version + ')';\n }\n step = Utils.merge( {\n index : i,\n fixed_title : _.escape( title ),\n icon : icon || '',\n help : null,\n citations : null,\n collapsible : true,\n collapsed : i > 0 && !self._isDataStep( step ),\n sustain_version : true,\n sustain_repeats : true,\n sustain_conditionals : true,\n narrow : true,\n text_enable : 'Edit',\n text_disable : 'Undo',\n cls_enable : 'fa fa-edit',\n cls_disable : 'fa fa-undo',\n errors : step.messages,\n initial_errors : true,\n cls : 'ui-portlet-narrow',\n hide_operations : true,\n needs_refresh : false,\n always_refresh : step.step_type != 'tool'\n }, step );\n self.steps[ i ] = step;\n self.links[ i ] = [];\n self.parms[ i ] = {};\n });\n\n // build linear index of step input pairs\n _.each( this.steps, function( step, i ) {\n FormData.visitInputs( step.inputs, function( input, name ) {\n self.parms[ i ][ name ] = input;\n });\n });\n\n // iterate through data input modules and collect linked sub steps\n _.each( this.steps, function( step, i ) {\n _.each( step.output_connections, function( output_connection ) {\n _.each( self.steps, function( sub_step, j ) {\n sub_step.step_index === output_connection.input_step_index && self.links[ i ].push( sub_step );\n });\n });\n });\n\n // convert all connected data inputs to hidden fields with proper labels,\n // and track the linked source step\n _.each( this.steps, function( step, i ) {\n _.each( self.steps, function( sub_step, j ) {\n var connections_by_name = {};\n _.each( step.output_connections, function( connection ) {\n sub_step.step_index === connection.input_step_index && ( connections_by_name[ connection.input_name ] = connection );\n });\n _.each( self.parms[ j ], function( input, name ) {\n var connection = connections_by_name[ name ];\n if ( connection ) {\n input.type = 'hidden';\n input.help = input.step_linked ? input.help + ', ' : '';\n input.help += 'Output dataset \\'' + connection.output_name + '\\' from step ' + ( parseInt( i ) + 1 );\n input.step_linked = input.step_linked || [];\n input.step_linked.push( step );\n }\n });\n });\n });\n\n // identify and configure workflow parameters\n var wp_count = 0;\n this.wp_inputs = {};\n function _handleWorkflowParameter( value, callback ) {\n var re = /\\$\\{(.+?)\\}/g, match;\n while ( match = re.exec( String( value ) ) ) {\n var wp_name = match[ 1 ];\n callback( self.wp_inputs[ wp_name ] = self.wp_inputs[ wp_name ] || {\n label : wp_name,\n name : wp_name,\n type : 'text',\n color : 'hsl( ' + ( ++wp_count * 100 ) + ', 70%, 30% )',\n style : 'ui-form-wp-source',\n links : []\n });\n }\n }\n _.each( this.steps, function( step, i ) {\n _.each( self.parms[ i ], function( input, name ) {\n _handleWorkflowParameter( input.value, function( wp_input ) {\n wp_input.links.push( step );\n input.wp_linked = true;\n input.type = 'text';\n input.backdrop = true;\n input.style = 'ui-form-wp-target';\n });\n });\n _.each( step.post_job_actions, function( pja ) {\n _.each( pja.action_arguments, function( arg ) {\n _handleWorkflowParameter( arg, function() {} );\n });\n });\n });\n\n // select fields are shown for dynamic fields if all putative data inputs are available,\n // or if an explicit reference is specified as data_ref and available\n _.each( this.steps, function( step, i ) {\n if ( step.step_type == 'tool' ) {\n var data_resolved = true;\n FormData.visitInputs( step.inputs, function ( input, name, context ) {\n var is_runtime_value = input.value && input.value.__class__ == 'RuntimeValue';\n var is_data_input = ([ 'data', 'data_collection' ]).indexOf( input.type ) != -1;\n var data_ref = context[ input.data_ref ];\n input.step_linked && !self._isDataStep( input.step_linked ) && ( data_resolved = false );\n input.options && ( ( input.options.length == 0 && !data_resolved ) || input.wp_linked ) && ( input.is_workflow = true );\n data_ref && ( input.is_workflow = ( data_ref.step_linked && !self._isDataStep( data_ref.step_linked ) ) || input.wp_linked );\n ( is_data_input || ( input.value && input.value.__class__ == 'RuntimeValue' && !input.step_linked ) ) && ( step.collapsed = false );\n is_runtime_value && ( input.value = input.default_value );\n input.flavor = 'workflow';\n if ( !is_runtime_value && !is_data_input && input.type !== 'hidden' && !input.wp_linked ) {\n if ( input.optional || ( !Utils.isEmpty( input.value ) && input.value !== '' ) ) {\n input.collapsible_value = input.value;\n input.collapsible_preview = true;\n }\n }\n });\n }\n });\n },\n\n render: function() {\n var self = this;\n this.deferred.reset();\n this._renderHeader();\n this._renderMessage();\n this._renderParameters();\n this._renderHistory();\n _.each ( this.steps, function( step ) { self._renderStep( step ) } );\n },\n\n /** Render header */\n _renderHeader: function() {\n var self = this;\n this.execute_btn = new Ui.Button({\n icon : 'fa-check',\n title : 'Run workflow',\n cls : 'btn btn-primary',\n onclick : function() { self._execute() }\n });\n this.$header.addClass( 'ui-form-header' ).empty()\n .append( new Ui.Label( { title: 'Workflow: ' + this.model.get( 'name' ) } ).$el )\n .append( this.execute_btn.$el );\n },\n\n /** Render message */\n _renderMessage: function() {\n this.$message.empty();\n if ( this.model.get( 'has_upgrade_messages' ) ) {\n this.$message.append( new Ui.Message( {\n message : 'Some tools in this workflow may have changed since it was last saved or some errors were found. The workflow may still run, but any new options will have default values. Please review the messages below to make a decision about whether the changes will affect your analysis.',\n status : 'warning',\n persistent : true,\n fade : false\n } ).$el );\n }\n var step_version_changes = this.model.get( 'step_version_changes' );\n if ( step_version_changes && step_version_changes.length > 0 ) {\n this.$message.append( new Ui.Message( {\n message : 'Some tools are being executed with different versions compared to those available when this workflow was last saved because the other versions are not or no longer available on this Galaxy instance. To upgrade your workflow and dismiss this message simply edit the workflow and re-save it.',\n status : 'warning',\n persistent : true,\n fade : false\n } ).$el );\n }\n },\n\n /** Render workflow parameters */\n _renderParameters: function() {\n var self = this;\n this.wp_form = null;\n if ( !_.isEmpty( this.wp_inputs ) ) {\n this.wp_form = new Form({ title: 'Workflow Parameters', inputs: this.wp_inputs, cls: 'ui-portlet-narrow', onchange: function() {\n _.each( self.wp_form.input_list, function( input_def, i ) {\n _.each( input_def.links, function( step ) { self._refreshStep( step ) } );\n });\n }\n });\n this._append( this.$steps.empty(), this.wp_form.$el );\n }\n },\n\n /** Render workflow parameters */\n _renderHistory: function() {\n this.history_form = new Form({\n cls : 'ui-portlet-narrow',\n title : 'History Options',\n inputs : [{\n type : 'conditional',\n name : 'new_history',\n test_param : {\n name : 'check',\n label : 'Send results to a new history',\n type : 'boolean',\n value : 'false',\n help : ''\n },\n cases : [{\n value : 'true',\n inputs : [{\n name : 'name',\n label : 'History name',\n type : 'text',\n value : this.model.get( 'name' )\n }]\n }]\n }]\n });\n this._append( this.$steps, this.history_form.$el );\n },\n\n /** Render step */\n _renderStep: function( step ) {\n var self = this;\n var form = null;\n this.deferred.execute( function( promise ) {\n self.$steps.addClass( 'ui-steps' );\n if ( step.step_type == 'tool' ) {\n step.postchange = function( process, form ) {\n var self = this;\n var current_state = {\n tool_id : step.id,\n tool_version : step.version,\n inputs : $.extend( true, {}, form.data.create() )\n }\n form.wait( true );\n Galaxy.emit.debug( 'tool-form-composite::postchange()', 'Sending current state.', current_state );\n Utils.request({\n type : 'POST',\n url : Galaxy.root + 'api/tools/' + step.id + '/build',\n data : current_state,\n success : function( data ) {\n form.update( data );\n form.wait( false );\n Galaxy.emit.debug( 'tool-form-composite::postchange()', 'Received new model.', data );\n process.resolve();\n },\n error : function( response ) {\n Galaxy.emit.debug( 'tool-form-composite::postchange()', 'Refresh request failed.', response );\n process.reject();\n }\n });\n };\n form = new ToolFormBase( step );\n if ( step.post_job_actions && step.post_job_actions.length ) {\n form.portlet.append( $( '
                                    ' ).addClass( 'ui-form-element-disabled' )\n .append( $( '
                                    ' ).addClass( 'ui-form-title' ).html( 'Job Post Actions' ) )\n .append( $( '
                                    ' ).addClass( 'ui-form-preview' ).html(\n _.reduce( step.post_job_actions, function( memo, value ) {\n return memo + ' ' + value.short_str;\n }, '' ) ) )\n );\n }\n } else {\n var is_simple_input = ([ 'data_input', 'data_collection_input' ]).indexOf( step.step_type ) != -1;\n _.each( step.inputs, function( input ) { input.flavor = 'module'; input.hide_label = is_simple_input; } );\n form = new Form( Utils.merge({\n title : step.fixed_title,\n onchange : function() { _.each( self.links[ step.index ], function( link ) { self._refreshStep( link ) } ) },\n inputs : step.inputs && step.inputs.length > 0 ? step.inputs : [ { type: 'hidden', name: 'No options available.', ignore: null } ]\n }, step ) );\n }\n self.forms[ step.index ] = form;\n self._append( self.$steps, form.$el );\n self._refresh();\n step.needs_refresh && self._refreshStep( step );\n form.portlet[ !self.show_progress ? 'enable' : 'disable' ]();\n self.show_progress && self.execute_btn.model.set( { wait : true,\n wait_text : 'Preparing...',\n percentage : ( step.index + 1 ) * 100.0 / self.steps.length } );\n Galaxy.emit.debug( 'tool-form-composite::initialize()', step.index + ' : Workflow step state ready.', step );\n setTimeout( function() { promise.resolve() }, 0 );\n });\n },\n\n /** Refreshes step values from source step values */\n _refreshStep: function( step ) {\n var self = this;\n var form = this.forms[ step.index ];\n if ( form ) {\n _.each( self.parms[ step.index ], function( input, name ) {\n if ( input.step_linked || input.wp_linked ) {\n var field = form.field_list[ form.data.match( name ) ];\n if ( field ) {\n var new_value = undefined;\n if ( input.step_linked ) {\n new_value = { values: [] };\n _.each( input.step_linked, function( source_step ) {\n if ( self._isDataStep( source_step ) ) {\n var value = self.forms[ source_step.index ].data.create().input;\n value && _.each( value.values, function( v ) { new_value.values.push( v ) } );\n }\n });\n if ( !input.multiple && new_value.values.length > 0 ) {\n new_value = { values: [ new_value.values[ 0 ] ] };\n }\n } else if ( input.wp_linked ) {\n new_value = input.value;\n var re = /\\$\\{(.+?)\\}/g, match;\n while ( match = re.exec( input.value ) ) {\n var wp_field = self.wp_form.field_list[ self.wp_form.data.match( match[ 1 ] ) ];\n var wp_value = wp_field && wp_field.value();\n if ( wp_value ) {\n new_value = new_value.split( match[ 0 ] ).join( wp_value );\n }\n }\n }\n if ( new_value !== undefined ) {\n field.value( new_value );\n }\n }\n }\n });\n form.trigger( 'change' );\n } else {\n step.needs_refresh = true;\n }\n },\n\n /** Refresh the history after job submission while form is shown */\n _refreshHistory: function() {\n var self = this;\n var history = parent.Galaxy && parent.Galaxy.currHistoryPanel && parent.Galaxy.currHistoryPanel.model;\n this._refresh_history && clearTimeout( this._refresh_history );\n if ( history ) {\n history.refresh().success( function() {\n if ( history.numOfUnfinishedShownContents() === 0 ) {\n self._refresh_history = setTimeout( function() { self._refreshHistory() }, history.UPDATE_DELAY );\n }\n });\n }\n },\n\n /** Build remaining steps */\n _execute: function() {\n var self = this;\n this.show_progress = true;\n this._enabled( false );\n this.deferred.execute( function( promise ) {\n setTimeout( function() { promise.resolve(); self._submit(); }, 0 );\n });\n },\n\n /** Validate and submit workflow */\n _submit: function() {\n var self = this;\n var history_form_data = this.history_form.data.create();\n var job_def = {\n new_history_name : history_form_data[ 'new_history|name' ] ? history_form_data[ 'new_history|name' ] : null,\n history_id : !history_form_data[ 'new_history|name' ] ? this.model.get( 'history_id' ) : null,\n replacement_params : this.wp_form ? this.wp_form.data.create() : {},\n parameters : {},\n // Tool form will submit flat maps for each parameter\n // (e.g. \"repeat_0|cond|param\": \"foo\" instead of nested\n // data structures).\n parameters_normalized : true,\n // Tool form always wants a list of invocations back\n // so that inputs can be batched.\n batch : true\n };\n var validated = true;\n for ( var i in this.forms ) {\n var form = this.forms[ i ];\n var job_inputs = form.data.create();\n var step = self.steps[ i ];\n var step_index = step.step_index;\n form.trigger( 'reset' );\n for ( var job_input_id in job_inputs ) {\n var input_value = job_inputs[ job_input_id ];\n var input_id = form.data.match( job_input_id );\n var input_field = form.field_list[ input_id ];\n var input_def = form.input_list[ input_id ];\n if ( !input_def.step_linked ) {\n if ( this._isDataStep( step ) ) {\n validated = input_value && input_value.values && input_value.values.length > 0;\n } else {\n validated = input_def.optional || ( input_def.is_workflow && input_value !== '' ) || ( !input_def.is_workflow && input_value !== null );\n }\n if ( !validated ) {\n form.highlight( input_id );\n break;\n }\n job_def.parameters[ step_index ] = job_def.parameters[ step_index ] || {};\n job_def.parameters[ step_index ][ job_input_id ] = job_inputs[ job_input_id ];\n }\n }\n if ( !validated ) {\n break;\n }\n }\n if ( !validated ) {\n self._enabled( true );\n Galaxy.emit.debug( 'tool-form-composite::submit()', 'Validation failed.', job_def );\n } else {\n Galaxy.emit.debug( 'tool-form-composite::submit()', 'Validation complete.', job_def );\n Utils.request({\n type : 'POST',\n url : Galaxy.root + 'api/workflows/' + this.model.id + '/invocations',\n data : job_def,\n success : function( response ) {\n Galaxy.emit.debug( 'tool-form-composite::submit', 'Submission successful.', response );\n self.$el.children().hide();\n self.$el.append( self._templateSuccess( response ) );\n\n // Show Webhook if job is running\n if ($.isArray( response ) && response.length > 0) {\n self.$el.append( $( '
                                    ', { id: 'webhook-view' } ) );\n var WebhookApp = new Webhooks.WebhookView({\n urlRoot: Galaxy.root + 'api/webhooks/workflow',\n toolId: job_def.tool_id,\n toolVersion: job_def.tool_version,\n });\n }\n\n self._refreshHistory();\n },\n error : function( response ) {\n Galaxy.emit.debug( 'tool-form-composite::submit', 'Submission failed.', response );\n var input_found = false;\n if ( response && response.err_data ) {\n for ( var i in self.forms ) {\n var form = self.forms[ i ];\n var step_related_errors = response.err_data[ form.model.get( 'step_index' ) ];\n if ( step_related_errors ) {\n var error_messages = form.data.matchResponse( step_related_errors );\n for ( var input_id in error_messages ) {\n form.highlight( input_id, error_messages[ input_id ] );\n input_found = true;\n break;\n }\n }\n }\n }\n if ( !input_found ) {\n self.modal.show({\n title : 'Workflow submission failed',\n body : self._templateError( job_def, response && response.err_msg ),\n buttons : {\n 'Close' : function() {\n self.modal.hide();\n }\n }\n });\n }\n },\n complete: function() {\n self._enabled( true );\n }\n });\n }\n },\n\n /** Append new dom to body */\n _append: function( $container, $el ) {\n $container.append( '

                                    ' ).append( $el );\n },\n\n /** Set enabled/disabled state */\n _enabled: function( enabled ) {\n this.execute_btn.model.set( { wait: !enabled, wait_text: 'Sending...', percentage: -1 } );\n this.wp_form && this.wp_form.portlet[ enabled ? 'enable' : 'disable' ]();\n this.history_form && this.history_form.portlet[ enabled ? 'enable' : 'disable' ]();\n _.each( this.forms, function( form ) { form && form.portlet[ enabled ? 'enable' : 'disable' ]() } );\n },\n\n /** Is data input module/step */\n _isDataStep: function( steps ) {\n var lst = $.isArray( steps ) ? steps : [ steps ] ;\n for ( var i = 0; i < lst.length; i++ ) {\n var step = lst[ i ];\n if ( !step || !step.step_type || !step.step_type.startsWith( 'data' ) ) {\n return false;\n }\n }\n return true;\n },\n\n /** Templates */\n _templateSuccess: function( response ) {\n if ( $.isArray( response ) && response.length > 0 ) {\n return $( '

                                    ' ).addClass( 'donemessagelarge' )\n .append( $( '

                                    ' ).html( 'Successfully invoked workflow ' + Utils.sanitize( this.model.get( 'name' ) ) + '' + ( response.length > 1 ? ' ' + response.length + ' times' : '' ) + '.' ) )\n .append( $( '

                                    ' ).append( '' ).text( 'You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from \\'running\\' to \\'finished\\' if completed successfully or \\'error\\' if problems were encountered.' ) );\n } else {\n return this._templateError( response, 'Invalid success response. No invocations found.' );\n }\n },\n\n _templateError: function( response, err_msg ) {\n return $( '

                                    ' ).addClass( 'errormessagelarge' )\n .append( $( '

                                    ' ).text( 'The server could not complete the request. Please contact the Galaxy Team if this error persists. ' + ( JSON.stringify( err_msg ) || '' ) ) )\n .append( $( '

                                    ' ).text( JSON.stringify( response, null, 4 ) ) );\n        }\n    });\n    return {\n        View: View\n    };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/tool/tool-form-composite.js","define([\n    \"utils/localization\"\n], function( _l ){\n'use strict';\n\n//TODO: toastr is another possibility - I didn't see where I might add details, tho\n\n/* ============================================================================\nError modals meant to replace the o-so-easy alerts.\n\nThese are currently styled as errormessages but use the Galaxy.modal\ninfrastructure to be shown/closed. They're capable of showing details in a\ntogglable dropdown and the details are formatted in a pre.\n\nExample:\n    errorModal( 'Heres a message', 'A Title', { some_details: 'here' });\n    errorModal( 'Heres a message' ); // no details, title is 'Error'\n\nThere are three specialized forms:\n    offlineErrorModal       a canned response for when there's no connection\n    badGatewayErrorModal    canned response for when Galaxy is restarting\n    ajaxErrorModal          plugable into any Backbone class as an\n        error event handler by accepting the error args: model, xhr, options\n\nExamples:\n    if( navigator.offLine ){ offlineErrorModal(); }\n    if( xhr.status === 502 ){ badGatewayErrorModal(); }\n    this.listenTo( this.model, 'error', ajaxErrorModal );\n\n============================================================================ */\n\nvar CONTACT_MSG = _l( 'Please contact a Galaxy administrator if the problem persists.' );\nvar DEFAULT_AJAX_ERR_MSG = _l( 'An error occurred while updating information with the server.' );\nvar DETAILS_MSG = _l( 'The following information can assist the developers in finding the source of the error:' );\n\n/** private helper that builds the modal and handles adding details */\nfunction _errorModal( message, title, details ){\n    // create and return the modal, adding details button only if needed\n    Galaxy.modal.show({\n        title           : title,\n        body            : message,\n        closing_events  : true,\n        buttons         : { Ok: function(){ Galaxy.modal.hide(); } },\n    });\n    Galaxy.modal.$el.addClass( 'error-modal' );\n\n    if( details ){\n        Galaxy.modal.$( '.error-details' ).add( Galaxy.modal.$( 'button:contains(\"Details\")' ) ).remove();\n        $( '
                                    ' ).addClass( 'error-details' )\n .hide().appendTo( Galaxy.modal.$( '.modal-content' ) )\n .append([\n $( '

                                    ' ).text( DETAILS_MSG ),\n $( '

                                    ' ).text( JSON.stringify( details, null, '  ' ) )\n            ]);\n\n        $( '' )\n            .appendTo( Galaxy.modal.$( '.buttons' ) )\n            .click( function(){ Galaxy.modal.$( '.error-details' ).toggle(); });\n    }\n    return Galaxy.modal;\n}\n\n/** Display a modal showing an error message but fallback to alert if there's no modal */\nfunction errorModal( message, title, details ){\n    if( !message ){ return; }\n\n    message = _l( message );\n    title = _l( title ) || _l( 'Error:' );\n    if( window.Galaxy && Galaxy.modal ){\n        return _errorModal( message, title, details );\n    }\n\n    alert( title + '\\n\\n' + message );\n    console.log( 'error details:', JSON.stringify( details ) );\n}\n\n\n// ----------------------------------------------------------------------------\n/** display a modal when the user may be offline */\nfunction offlineErrorModal(){\n    return errorModal(\n        _l( 'You appear to be offline. Please check your connection and try again.' ),\n        _l( 'Offline?' )\n    );\n}\n\n\n// ----------------------------------------------------------------------------\n/** 502 messages that should be displayed when galaxy is restarting */\nfunction badGatewayErrorModal(){\n    return errorModal(\n        _l( 'Galaxy is currently unreachable. Please try again in a few minutes.' ) + ' ' + CONTACT_MSG,\n        _l( 'Cannot connect to Galaxy' )\n    );\n}\n\n\n// ----------------------------------------------------------------------------\n/** display a modal (with details) about a failed Backbone ajax operation */\nfunction ajaxErrorModal( model, xhr, options, message, title ){\n    message = message || DEFAULT_AJAX_ERR_MSG;\n    message += ' ' + CONTACT_MSG;\n    title = title || _l( 'An error occurred' );\n    var details = _ajaxDetails( model, xhr, options );\n    return errorModal( message, title, details );\n}\n\n/** build details which may help debugging the ajax call */\nfunction _ajaxDetails( model, xhr, options ){\n    return {\n//TODO: still can't manage Raven id\n        raven       : _.result( window.Raven, 'lastEventId' ),\n        userAgent   : navigator.userAgent,\n        onLine      : navigator.onLine,\n        version     : _.result( Galaxy.config, 'version_major' ),\n        xhr         : _.omit( xhr, _.functions( xhr ) ),\n        options     : _.omit( options, 'xhr' ),\n        // add ajax data from Galaxy object cache\n        url         : _.result( Galaxy.lastAjax, 'url' ),\n        data        : _.result( Galaxy.lastAjax, 'data' ),\n        // backbone stuff (auto-redacting email for user)\n        model       : _.result( model, 'toJSON' , model + '' ),\n        user        : _.omit( _.result( Galaxy.user, 'toJSON' ), 'email' ),\n    };\n}\n\n\n//=============================================================================\n    return {\n        errorModal          : errorModal,\n        offlineErrorModal   : offlineErrorModal,\n        badGatewayErrorModal: badGatewayErrorModal,\n        ajaxErrorModal      : ajaxErrorModal\n    };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/ui/error-modal.js","(function (factory) {\n    if (typeof define === 'function' && define.amd) {\n        define([], factory);\n    } else {\n        // Browser globals\n        factory(jQuery);\n    }\n\n}(function () {\n//=============================================================================\n\n    jQuery.fn.extend({\n        hoverhighlight : function $hoverhighlight( scope, color ){\n            scope = scope || 'body';\n            if( !this.length ){ return this; }\n\n            $( this ).each( function(){\n                var $this = $( this ),\n                    targetSelector = $this.data( 'target' );\n\n                if( targetSelector ){\n                    $this.mouseover( function( ev ){\n                        $( targetSelector, scope ).css({\n                            background: color\n                        });\n                    })\n                    .mouseout( function( ev ){\n                        $( targetSelector ).css({\n                            background: ''\n                        });\n                    });\n                }\n            });\n            return this;\n        }\n    });\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/ui/hoverhighlight.js","// from: https://raw.githubusercontent.com/umdjs/umd/master/jqueryPlugin.js\n// Uses AMD or browser globals to create a jQuery plugin.\n(function (factory) {\n    if (typeof define === 'function' && define.amd) {\n        //TODO: So...this turns out to be an all or nothing thing. If I load jQuery in the define below, it will\n        //  (of course) wipe the old jquery *and all the plugins loaded into it*. So the define below *is still\n        //  relying on jquery being loaded globally* in order to preserve plugins.\n        define([], factory);\n    } else {\n        // Browser globals\n        factory(jQuery);\n    }\n\n}(function () {\n    var _l = window._l || function( s ){ return s; };\n\n    //TODO: consolidate with tool menu functionality, use there\n\n    /** searchInput: (jQuery plugin)\n     *      Creates a search input, a clear button, and loading indicator\n     *      within the selected node.\n     *\n     *      When the user either presses return or enters some minimal number\n     *      of characters, a callback is called. Pressing ESC when the input\n     *      is focused will clear the input and call a separate callback.\n     */\n    function searchInput( parentNode, options ){\n        var KEYCODE_ESC     = 27,\n            KEYCODE_RETURN  = 13,\n            $parentNode     = $( parentNode ),\n            firstSearch     = true,\n            defaults = {\n                initialVal      : '',\n                name            : 'search',\n                placeholder     : 'search',\n                classes         : '',\n                onclear         : function(){},\n                onfirstsearch   : null,\n                onsearch        : function( inputVal ){},\n                minSearchLen    : 0,\n                escWillClear    : true,\n                oninit          : function(){}\n            };\n\n        // .................................................................... input rendering and events\n        // visually clear the search, trigger an event, and call the callback\n        function clearSearchInput( event ){\n            var $input = $( this ).parent().children( 'input' );\n            $input.val( '' ).trigger( 'searchInput.clear' ).blur();\n            options.onclear();\n        }\n\n        // search for searchTerms, trigger an event, call the appropo callback (based on whether this is the first)\n        function search( event, searchTerms ){\n            if( !searchTerms ){\n                return clearSearchInput();\n            }\n            $( this ).trigger( 'search.search', searchTerms );\n            if( typeof options.onfirstsearch === 'function' && firstSearch ){\n                firstSearch = false;\n                options.onfirstsearch( searchTerms );\n            } else {\n                options.onsearch( searchTerms );\n            }\n        }\n\n        // .................................................................... input rendering and events\n        function inputTemplate(){\n            // class search-query is bootstrap 2.3 style that now lives in base.less\n            return [ '' ].join( '' );\n        }\n\n        // the search input that responds to keyboard events and displays the search value\n        function $input(){\n            return $( inputTemplate() )\n                // select all text on a focus\n                .focus( function( event ){\n                    $( this ).select();\n                })\n                // attach behaviors to esc, return if desired, search on some min len string\n                .keyup( function( event ){\n                    event.preventDefault();\n                    event.stopPropagation();\n\n                    // esc key will clear if desired\n                    if( event.which === KEYCODE_ESC && options.escWillClear ){\n                        clearSearchInput.call( this, event );\n\n                    } else {\n                        var searchTerms = $( this ).val();\n                        // return key or the search string len > minSearchLen (if not 0) triggers search\n                        if( ( event.which === KEYCODE_RETURN )\n                        ||  ( options.minSearchLen && searchTerms.length >= options.minSearchLen ) ){\n                            search.call( this, event, searchTerms );\n                        }\n                    }\n                })\n                .val( options.initialVal );\n        }\n\n        // .................................................................... clear button rendering and events\n        // a button for clearing the search bar, placed on the right hand side\n        function $clearBtn(){\n            return $([ '' ].join('') )\n            .tooltip({ placement: 'bottom' })\n            .click( function( event ){\n                clearSearchInput.call( this, event );\n            });\n        }\n\n        // .................................................................... loadingIndicator rendering\n        // a button for clearing the search bar, placed on the right hand side\n        function $loadingIndicator(){\n            return $([ '' ].join('') )\n                .hide().tooltip({ placement: 'bottom' });\n        }\n\n        // .................................................................... commands\n        // visually swap the load, clear buttons\n        function toggleLoadingIndicator(){\n            $parentNode.find( '.search-loading' ).toggle();\n            $parentNode.find( '.search-clear' ).toggle();\n        }\n\n        // .................................................................... init\n        // string command (not constructor)\n        if( jQuery.type( options ) === 'string' ){\n            if( options === 'toggle-loading' ){\n                toggleLoadingIndicator();\n            }\n            return $parentNode;\n        }\n\n        // initial render\n        if( jQuery.type( options ) === 'object' ){\n            options = jQuery.extend( true, {}, defaults, options );\n        }\n        //NOTE: prepended\n        return $parentNode.addClass( 'search-input' ).prepend([ $input(), $clearBtn(), $loadingIndicator() ]);\n    }\n\n    // as jq plugin\n    jQuery.fn.extend({\n        searchInput : function $searchInput( options ){\n            return this.each( function(){\n                return searchInput( this, options );\n            });\n        }\n    });\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/ui/search-input.js","define([], function(){\n// Alphanumeric/natural sort fn\nfunction naturalSort(a, b) {\n    // setup temp-scope variables for comparison evauluation\n    var re = /(-?[0-9\\.]+)/g,\n        x = a.toString().toLowerCase() || '',\n        y = b.toString().toLowerCase() || '',\n        nC = String.fromCharCode(0),\n        xN = x.replace( re, nC + '$1' + nC ).split(nC),\n        yN = y.replace( re, nC + '$1' + nC ).split(nC),\n        xD = (new Date(x)).getTime(),\n        yD = xD ? (new Date(y)).getTime() : null;\n    // natural sorting of dates\n    if ( yD ) {\n        if ( xD < yD ) { return -1; }\n        else if ( xD > yD ) { return 1; }\n    }\n    // natural sorting through split numeric strings and default strings\n    var oFxNcL, oFyNcL;\n    for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {\n        oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];\n        oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];\n        if (oFxNcL < oFyNcL) { return -1; }\n        else if (oFxNcL > oFyNcL) { return 1; }\n    }\n    return 0;\n}\n\nreturn naturalSort;\n})\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/utils/natural-sort.js","var Ui = require( 'mvc/ui/ui-misc' ),\n    historyOptionsMenu = require( 'mvc/history/options-menu' );\n    CurrentHistoryView = require( 'mvc/history/history-view-edit-current' ).CurrentHistoryView,\n    _l = require( 'utils/localization' );\n\n/** the right hand panel in the analysis page that shows the current history */\nvar HistoryPanel = Backbone.View.extend({\n\n    initialize : function( page, options ) {\n        var self = this;\n        this.userIsAnonymous            = Galaxy.user.isAnonymous();\n        this.allow_user_dataset_purge   = options.config.allow_user_dataset_purge;\n        this.root                       = options.root;\n\n        // view of the current history\n        this.historyView = new CurrentHistoryView({\n            className       : CurrentHistoryView.prototype.className + ' middle',\n            purgeAllowed    : this.allow_user_dataset_purge,\n            linkTarget      : 'galaxy_main'\n        });\n\n        // add history panel to Galaxy object\n        Galaxy.currHistoryPanel = this.historyView;\n        Galaxy.currHistoryPanel.listenToGalaxy( Galaxy );\n\n        // build buttons\n        this.buttonRefresh = new Ui.ButtonLink({\n            id      : 'history-refresh-button',\n            title   : 'Refresh history',\n            cls     : 'panel-header-button',\n            icon    : 'fa fa-refresh',\n            onclick : function() {\n                self.historyView.loadCurrentHistory();\n            }\n        });\n        this.buttonOptions = new Ui.ButtonLink({\n            id      : 'history-options-button',\n            title   : 'History options',\n            cls     : 'panel-header-button',\n            target  : 'galaxy_main',\n            icon    : 'fa fa-cog',\n            href    : this.root + 'root/history_options'\n        });\n        this.buttonViewMulti = new Ui.ButtonLink({\n            id      : 'history-view-multi-button',\n            title   : 'View all histories',\n            cls     : 'panel-header-button',\n            icon    : 'fa fa-columns',\n            href    : this.root + 'history/view_multiple'\n        });\n\n        // define components\n        this.model = new Backbone.Model({\n            cls     : 'history-right-panel',\n            title   : _l( 'History' ),\n            buttons : [ this.buttonRefresh, this.buttonOptions, this.buttonViewMulti ]\n        });\n\n        // build body template and connect history view\n        this.setElement( this._template() );\n        this.historyView.setElement( this.$el );\n        this.historyView.connectToQuotaMeter( Galaxy.quotaMeter );\n        this.historyView.loadCurrentHistory();\n\n        // fetch to update the quota meter adding 'current' for any anon-user's id\n        Galaxy.listenTo( this.historyView, 'history-size-change', function(){\n            Galaxy.user.fetch({ url: Galaxy.user.urlRoot() + '/' + ( Galaxy.user.id || 'current' ) });\n        });\n    },\n\n    render : function() {\n        this.optionsMenu = historyOptionsMenu( this.buttonOptions.$el, {\n            anonymous    : this.userIsAnonymous,\n            purgeAllowed : this.allow_user_dataset_purge,\n            root         : this.root\n        });\n        this.buttonViewMulti.$el[ !this.userIsAnonymous ? 'show' : 'hide' ]();\n    },\n\n    /** add history view div */\n    _template : function( data ){\n        return [\n            '
                                    ',\n ].join('');\n },\n\n toString : function() { return 'historyPanel' }\n});\n\nmodule.exports = HistoryPanel;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/panels/history-panel.js","var Tools = require( 'mvc/tool/tools' ),\n Upload = require( 'mvc/upload/upload-view' ),\n _l = require( 'utils/localization' ),\n ToolForm = require( 'mvc/tool/tool-form-composite' );\n\nvar ToolPanel = Backbone.View.extend({\n initialize: function( page, options ) {\n // access configuration options\n var config = options.config;\n this.root = options.root;\n\n /** @type {Object[]} descriptions of user's workflows to be shown in the tool menu */\n this.stored_workflow_menu_entries = config.stored_workflow_menu_entries || [];\n\n // create tool search, tool panel, and tool panel view.\n var tool_search = new Tools.ToolSearch({\n hidden : false\n });\n var tools = new Tools.ToolCollection( config.toolbox );\n this.tool_panel = new Tools.ToolPanel({\n tool_search : tool_search,\n tools : tools,\n layout : config.toolbox_in_panel\n });\n this.tool_panel_view = new Tools.ToolPanelView({ model: this.tool_panel });\n\n // add upload modal\n this.upload_button = new Upload({\n nginx_upload_path : config.nginx_upload_path,\n ftp_upload_site : config.ftp_upload_site,\n default_genome : config.default_genome,\n default_extension : config.default_extension,\n });\n\n // add uploader button to Galaxy object\n Galaxy.upload = this.upload_button;\n\n // components for panel definition\n this.model = new Backbone.Model({\n title : _l( 'Tools' ),\n buttons : [ this.upload_button ]\n });\n\n // build body template\n this.setElement( this._template() );\n },\n\n render : function(){\n // if there are tools, render panel and display everything\n var self = this;\n if ( this.tool_panel.get( 'layout' ).size() > 0 ) {\n this.$el.prepend( this.tool_panel_view.$el );\n this.tool_panel_view.render();\n }\n // build the dom for the workflow portion of the tool menu\n // add internal workflow list\n self.$( '#internal-workflows' ).append( self._templateAllWorkflow({\n title : _l( 'All workflows' ),\n href : 'workflow'\n }));\n _.each( this.stored_workflow_menu_entries, function( menu_entry ){\n self.$( '#internal-workflows' ).append( self._templateWorkflowLink({\n title : menu_entry.stored_workflow.name,\n href : 'workflow/run?id=' + menu_entry.encoded_stored_workflow_id\n }));\n });\n },\n\n /** build a link to one tool */\n _templateTool: function( tool ) {\n return [\n '
                                    ',\n '', tool.title, '',\n '
                                    '\n ].join('');\n },\n\n /** build a link to 'All Workflows' */\n _templateAllWorkflow: function( tool ) {\n return [\n '
                                    ',\n // global\n '', tool.title, '',\n '
                                    '\n ].join('');\n },\n\n /** build links to workflows in toolpanel */\n _templateWorkflowLink: function( wf ) {\n return [\n '
                                    ',\n '', wf.title, '',\n '
                                    '\n ].join('');\n },\n\n /** override to include inital menu dom and workflow section */\n _template : function() {\n return [\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '', _l( 'Search did not match any tools.' ), '',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '', _l( 'Workflows' ), '',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    '\n ].join('');\n },\n\n toString : function() { return 'toolPanel' }\n});\n\nmodule.exports = ToolPanel;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/panels/tool-panel.js","/*\n * Toastr\n * Version 2.0.1\n * Copyright 2012 John Papa and Hans Fjällemark. \n * All Rights Reserved. \n * Use, reproduction, distribution, and modification of this code is subject to the terms and \n * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php\n *\n * Author: John Papa and Hans Fjällemark\n * Project: https://github.com/CodeSeven/toastr\n */\n; (function (define) {\n\tdefine([], function () {\n\t\tvar $ = jQuery;\n\t\treturn (function () {\n\t\t\tvar version = '2.0.1';\n\t\t\tvar $container;\n\t\t\tvar listener;\n\t\t\tvar toastId = 0;\n\t\t\tvar toastType = {\n\t\t\t\terror: 'error',\n\t\t\t\tinfo: 'info',\n\t\t\t\tsuccess: 'success',\n\t\t\t\twarning: 'warning'\n\t\t\t};\n\n\t\t\tvar toastr = {\n\t\t\t\tclear: clear,\n\t\t\t\terror: error,\n\t\t\t\tgetContainer: getContainer,\n\t\t\t\tinfo: info,\n\t\t\t\toptions: {},\n\t\t\t\tsubscribe: subscribe,\n\t\t\t\tsuccess: success,\n\t\t\t\tversion: version,\n\t\t\t\twarning: warning\n\t\t\t};\n\n\t\t\treturn toastr;\n\n\t\t\t//#region Accessible Methods\n\t\t\tfunction error(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.error,\n\t\t\t\t\ticonClass: getOptions().iconClasses.error,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction info(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.info,\n\t\t\t\t\ticonClass: getOptions().iconClasses.info,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction subscribe(callback) {\n\t\t\t\tlistener = callback;\n\t\t\t}\n\n\t\t\tfunction success(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.success,\n\t\t\t\t\ticonClass: getOptions().iconClasses.success,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction warning(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.warning,\n\t\t\t\t\ticonClass: getOptions().iconClasses.warning,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction clear($toastElement) {\n\t\t\t\tvar options = getOptions();\n\t\t\t\tif (!$container) { getContainer(options); }\n\t\t\t\tif ($toastElement && $(':focus', $toastElement).length === 0) {\n\t\t\t\t\t$toastElement[options.hideMethod]({\n\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\tcomplete: function () { removeToast($toastElement); }\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ($container.children().length) {\n\t\t\t\t\t$container[options.hideMethod]({\n\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\tcomplete: function () { $container.remove(); }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\t//#endregion\n\n\t\t\t//#region Internal Methods\n\n\t\t\tfunction getDefaults() {\n\t\t\t\treturn {\n\t\t\t\t\ttapToDismiss: true,\n\t\t\t\t\ttoastClass: 'toast',\n\t\t\t\t\tcontainerId: 'toast-container',\n\t\t\t\t\tdebug: false,\n\n\t\t\t\t\tshowMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery\n\t\t\t\t\tshowDuration: 300,\n\t\t\t\t\tshowEasing: 'swing', //swing and linear are built into jQuery\n\t\t\t\t\tonShown: undefined,\n\t\t\t\t\thideMethod: 'fadeOut',\n\t\t\t\t\thideDuration: 1000,\n\t\t\t\t\thideEasing: 'swing',\n\t\t\t\t\tonHidden: undefined,\n\n\t\t\t\t\textendedTimeOut: 1000,\n\t\t\t\t\ticonClasses: {\n\t\t\t\t\t\terror: 'toast-error',\n\t\t\t\t\t\tinfo: 'toast-info',\n\t\t\t\t\t\tsuccess: 'toast-success',\n\t\t\t\t\t\twarning: 'toast-warning'\n\t\t\t\t\t},\n\t\t\t\t\ticonClass: 'toast-info',\n\t\t\t\t\tpositionClass: 'toast-top-right',\n\t\t\t\t\ttimeOut: 5000, // Set timeOut and extendedTimeout to 0 to make it sticky\n\t\t\t\t\ttitleClass: 'toast-title',\n\t\t\t\t\tmessageClass: 'toast-message',\n\t\t\t\t\ttarget: 'body',\n\t\t\t\t\tcloseHtml: '',\n\t\t\t\t\tnewestOnTop: true\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfunction publish(args) {\n\t\t\t\tif (!listener) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlistener(args);\n\t\t\t}\n\n\t\t\tfunction notify(map) {\n\t\t\t\tvar\n\t\t\t\t\toptions = getOptions(),\n\t\t\t\t\ticonClass = map.iconClass || options.iconClass;\n\n\t\t\t\tif (typeof (map.optionsOverride) !== 'undefined') {\n\t\t\t\t\toptions = $.extend(options, map.optionsOverride);\n\t\t\t\t\ticonClass = map.optionsOverride.iconClass || iconClass;\n\t\t\t\t}\n\n\t\t\t\ttoastId++;\n\n\t\t\t\t$container = getContainer(options);\n\t\t\t\tvar\n\t\t\t\t\tintervalId = null,\n\t\t\t\t\t$toastElement = $('
                                    '),\n\t\t\t\t\t$titleElement = $('
                                    '),\n\t\t\t\t\t$messageElement = $('
                                    '),\n\t\t\t\t\t$closeElement = $(options.closeHtml),\n\t\t\t\t\tresponse = {\n\t\t\t\t\t\ttoastId: toastId,\n\t\t\t\t\t\tstate: 'visible',\n\t\t\t\t\t\tstartTime: new Date(),\n\t\t\t\t\t\toptions: options,\n\t\t\t\t\t\tmap: map\n\t\t\t\t\t};\n\n\t\t\t\tif (map.iconClass) {\n\t\t\t\t\t$toastElement.addClass(options.toastClass).addClass(iconClass);\n\t\t\t\t}\n\n\t\t\t\tif (map.title) {\n\t\t\t\t\t$titleElement.append(map.title).addClass(options.titleClass);\n\t\t\t\t\t$toastElement.append($titleElement);\n\t\t\t\t}\n\n\t\t\t\tif (map.message) {\n\t\t\t\t\t$messageElement.append(map.message).addClass(options.messageClass);\n\t\t\t\t\t$toastElement.append($messageElement);\n\t\t\t\t}\n\n\t\t\t\tif (options.closeButton) {\n\t\t\t\t\t$closeElement.addClass('toast-close-button');\n\t\t\t\t\t$toastElement.prepend($closeElement);\n\t\t\t\t}\n\n\t\t\t\t$toastElement.hide();\n\t\t\t\tif (options.newestOnTop) {\n\t\t\t\t\t$container.prepend($toastElement);\n\t\t\t\t} else {\n\t\t\t\t\t$container.append($toastElement);\n\t\t\t\t}\n\n\n\t\t\t\t$toastElement[options.showMethod](\n\t\t\t\t\t{ duration: options.showDuration, easing: options.showEasing, complete: options.onShown }\n\t\t\t\t);\n\t\t\t\tif (options.timeOut > 0) {\n\t\t\t\t\tintervalId = setTimeout(hideToast, options.timeOut);\n\t\t\t\t}\n\n\t\t\t\t$toastElement.hover(stickAround, delayedhideToast);\n\t\t\t\tif (!options.onclick && options.tapToDismiss) {\n\t\t\t\t\t$toastElement.click(hideToast);\n\t\t\t\t}\n\t\t\t\tif (options.closeButton && $closeElement) {\n\t\t\t\t\t$closeElement.click(function (event) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\thideToast(true);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (options.onclick) {\n\t\t\t\t\t$toastElement.click(function () {\n\t\t\t\t\t\toptions.onclick();\n\t\t\t\t\t\thideToast();\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tpublish(response);\n\n\t\t\t\tif (options.debug && console) {\n\t\t\t\t\tconsole.log(response);\n\t\t\t\t}\n\n\t\t\t\treturn $toastElement;\n\n\t\t\t\tfunction hideToast(override) {\n\t\t\t\t\tif ($(':focus', $toastElement).length && !override) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\treturn $toastElement[options.hideMethod]({\n\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\tremoveToast($toastElement);\n\t\t\t\t\t\t\tif (options.onHidden) {\n\t\t\t\t\t\t\t\toptions.onHidden();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresponse.state = 'hidden';\n\t\t\t\t\t\t\tresponse.endTime = new Date(),\n\t\t\t\t\t\t\tpublish(response);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfunction delayedhideToast() {\n\t\t\t\t\tif (options.timeOut > 0 || options.extendedTimeOut > 0) {\n\t\t\t\t\t\tintervalId = setTimeout(hideToast, options.extendedTimeOut);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction stickAround() {\n\t\t\t\t\tclearTimeout(intervalId);\n\t\t\t\t\t$toastElement.stop(true, true)[options.showMethod](\n\t\t\t\t\t\t{ duration: options.showDuration, easing: options.showEasing }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfunction getContainer(options) {\n\t\t\t\tif (!options) { options = getOptions(); }\n\t\t\t\t$container = $('#' + options.containerId);\n\t\t\t\tif ($container.length) {\n\t\t\t\t\treturn $container;\n\t\t\t\t}\n\t\t\t\t$container = $('
                                    ')\n\t\t\t\t\t.attr('id', options.containerId)\n\t\t\t\t\t.addClass(options.positionClass);\n\t\t\t\t$container.appendTo($(options.target));\n\t\t\t\treturn $container;\n\t\t\t}\n\n\t\t\tfunction getOptions() {\n\t\t\t\treturn $.extend({}, getDefaults(), toastr.options);\n\t\t\t}\n\n\t\t\tfunction removeToast($toastElement) {\n\t\t\t\tif (!$container) { $container = getContainer(); }\n\t\t\t\tif ($toastElement.is(':visible')) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$toastElement.remove();\n\t\t\t\t$toastElement = null;\n\t\t\t\tif ($container.children().length === 0) {\n\t\t\t\t\t$container.remove();\n\t\t\t\t}\n\t\t\t}\n\t\t\t//#endregion\n\n\t\t})();\n\t});\n}(typeof define === 'function' && define.amd ? define : function (deps, factory) {\n\tif (typeof module !== 'undefined' && module.exports) { //Node\n\t\tmodule.exports = factory(require(deps[0]));\n\t} else {\n\t\twindow['toastr'] = factory(window['jQuery']);\n\t}\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/libs/toastr.js","define([\n \"mvc/collection/collection-li\",\n \"mvc/dataset/dataset-li-edit\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DC_LI, DATASET_LI_EDIT, BASE_MVC, _l ){\n\n'use strict';\n//==============================================================================\nvar DCListItemView = DC_LI.DCListItemView;\n/** @class Edit view for DatasetCollection.\n */\nvar DCListItemEdit = DCListItemView.extend(\n/** @lends DCListItemEdit.prototype */{\n\n /** override to add linkTarget */\n initialize : function( attributes ){\n DCListItemView.prototype.initialize.call( this, attributes );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCListItemEdit(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\nvar DCEListItemView = DC_LI.DCEListItemView;\n/** @class Read only view for DatasetCollectionElement.\n */\nvar DCEListItemEdit = DCEListItemView.extend(\n/** @lends DCEListItemEdit.prototype */{\n//TODO: this might be expendable - compacted with HDAListItemView\n\n /** set up */\n initialize : function( attributes ){\n DCEListItemView.prototype.initialize.call( this, attributes );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCEListItemEdit(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\n// NOTE: this does not inherit from DatasetDCEListItemView as you would expect\n//TODO: but should - if we can find something simpler than using diamond\n/** @class Editable view for a DatasetCollectionElement that is also an DatasetAssociation\n * (a dataset contained in a dataset collection).\n */\nvar DatasetDCEListItemEdit = DATASET_LI_EDIT.DatasetListItemEdit.extend(\n/** @lends DatasetDCEListItemEdit.prototype */{\n\n /** set up */\n initialize : function( attributes ){\n DATASET_LI_EDIT.DatasetListItemEdit.prototype.initialize.call( this, attributes );\n },\n\n // NOTE: this does not inherit from DatasetDCEListItemView - so we duplicate this here\n //TODO: fix\n /** In this override, only get details if in the ready state.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n }\n return jQuery.when();\n },\n\n /** Override to remove delete button */\n _renderDeleteButton : function(){\n return null;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DatasetDCEListItemEdit(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetDCEListItemEdit.prototype.templates = (function(){\n\n return _.extend( {}, DATASET_LI_EDIT.DatasetListItemEdit.prototype.templates, {\n titleBar : DC_LI.DatasetDCEListItemView.prototype.templates.titleBar\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n * (a nested DC).\n */\nvar NestedDCDCEListItemEdit = DC_LI.NestedDCDCEListItemView.extend(\n/** @lends NestedDCDCEListItemEdit.prototype */{\n\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'NestedDCDCEListItemEdit(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\n return {\n DCListItemEdit : DCListItemEdit,\n DCEListItemEdit : DCEListItemEdit,\n DatasetDCEListItemEdit : DatasetDCEListItemEdit,\n NestedDCDCEListItemEdit : NestedDCDCEListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-li-edit.js","define([\n \"mvc/collection/collection-view\",\n \"mvc/collection/collection-model\",\n \"mvc/collection/collection-li-edit\",\n \"mvc/base-mvc\",\n \"mvc/tag\",\n \"ui/fa-icon-button\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function( DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, TAGS, faIconButton, _l ){\n\n'use strict';\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class editable View/Controller for a dataset collection.\n */\nvar _super = DC_VIEW.CollectionView;\nvar CollectionViewEdit = _super.extend(\n/** @lends CollectionView.prototype */{\n //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n\n /** logger used to record this.log messages, commonly set to console */\n //logger : console,\n\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_EDIT.DatasetDCEListItemEdit,\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit,\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the panel\n */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n },\n\n /** In this override, make the collection name editable\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n _super.prototype._setUpBehaviors.call( this, $where );\n if( !this.model ){ return; }\n\n // anon users shouldn't have access to any of the following\n if( !Galaxy.user || Galaxy.user.isAnonymous() ){\n return;\n }\n\n this.tagsEditorShown = true;\n\n //TODO: extract\n var panel = this,\n nameSelector = '> .controls .name';\n $where.find( nameSelector )\n .attr( 'title', _l( 'Click to rename collection' ) )\n .tooltip({ placement: 'bottom' })\n .make_text_editable({\n on_finish: function( newName ){\n var previousName = panel.model.get( 'name' );\n if( newName && newName !== previousName ){\n panel.$el.find( nameSelector ).text( newName );\n panel.model.save({ name: newName })\n .fail( function(){\n panel.$el.find( nameSelector ).text( panel.model.previous( 'name' ) );\n });\n } else {\n panel.$el.find( nameSelector ).text( previousName );\n }\n }\n });\n this.tagsEditor = new TAGS.TagsEditor({\n model : this.model,\n el : $where.find( '.tags-display' ),\n onshowFirstTime : function(){ this.render(); },\n usePrompt : false\n });\n this.tagsEditor.toggle( true );\n },\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'CollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListCollectionViewEdit = CollectionViewEdit.extend(\n/** @lends ListCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_EDIT.DatasetDCEListItemEdit,\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class Editable, read-only View/Controller for a dataset collection. */\nvar PairCollectionViewEdit = ListCollectionViewEdit.extend(\n/** @lends PairCollectionViewEdit.prototype */{\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'PairCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class Editable (roughly since these collections are immutable),\n * View/Controller for a dataset collection.\n */\nvar NestedPairCollectionViewEdit = PairCollectionViewEdit.extend(\n/** @lends NestedPairCollectionViewEdit.prototype */{\n\n /** Override to remove the editable text from the name/identifier - these collections are considered immutable */\n _setUpBehaviors : function( $where ){\n _super.prototype._setUpBehaviors.call( this, $where );\n },\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'NestedPairCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class editable, View/Controller for a list of pairs dataset collection. */\nvar ListOfPairsCollectionViewEdit = CollectionViewEdit.extend(\n/** @lends ListOfPairsCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_EDIT.NestedDCDCEListItemEdit.extend({\n foldoutPanelClass : NestedPairCollectionViewEdit\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListOfPairsCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class View/Controller for a list of lists dataset collection. */\nvar ListOfListsCollectionViewEdit = CollectionViewEdit.extend(\n/** @lends ListOfListsCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_EDIT.NestedDCDCEListItemEdit.extend({\n foldoutPanelClass : NestedPairCollectionViewEdit\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListOfListsCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//==============================================================================\n return {\n CollectionViewEdit : CollectionViewEdit,\n ListCollectionViewEdit : ListCollectionViewEdit,\n PairCollectionViewEdit : PairCollectionViewEdit,\n ListOfPairsCollectionViewEdit : ListOfPairsCollectionViewEdit,\n ListOfListsCollectionViewEdit : ListOfListsCollectionViewEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-view-edit.js","define([\n \"utils/levenshtein\",\n \"utils/natural-sort\",\n \"mvc/collection/base-creator\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( levenshteinDistance, naturalSort, baseCreator, baseMVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/* ============================================================================\nTODO:\n\n\nPROGRAMMATICALLY:\ncurrPanel.once( 'rendered', function(){\n currPanel.showSelectors();\n currPanel.selectAll();\n _.last( currPanel.actionsPopup.options ).func();\n});\n\n============================================================================ */\n/** A view for paired datasets in the collections creator.\n */\nvar PairView = Backbone.View.extend( baseMVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n tagName : 'li',\n className : 'dataset paired',\n\n initialize : function( attributes ){\n this.pair = attributes.pair || {};\n },\n\n template : _.template([\n '<%- pair.forward.name %>',\n '',\n '<%- pair.name %>',\n '',\n '<%- pair.reverse.name %>'\n ].join('')),\n\n render : function(){\n this.$el\n .attr( 'draggable', true )\n .data( 'pair', this.pair )\n .html( this.template({ pair: this.pair }) )\n .addClass( 'flex-column-container' );\n return this;\n },\n\n events : {\n 'dragstart' : '_dragstart',\n 'dragend' : '_dragend',\n 'dragover' : '_sendToParent',\n 'drop' : '_sendToParent'\n },\n\n /** dragging pairs for re-ordering */\n _dragstart : function( ev ){\n ev.currentTarget.style.opacity = '0.4';\n if( ev.originalEvent ){ ev = ev.originalEvent; }\n\n ev.dataTransfer.effectAllowed = 'move';\n ev.dataTransfer.setData( 'text/plain', JSON.stringify( this.pair ) );\n\n this.$el.parent().trigger( 'pair.dragstart', [ this ] );\n },\n\n /** dragging pairs for re-ordering */\n _dragend : function( ev ){\n ev.currentTarget.style.opacity = '1.0';\n this.$el.parent().trigger( 'pair.dragend', [ this ] );\n },\n\n /** manually bubble up an event to the parent/container */\n _sendToParent : function( ev ){\n this.$el.parent().trigger( ev );\n },\n\n /** string rep */\n toString : function(){\n return 'PairView(' + this.pair.name + ')';\n }\n});\n\n\n// ============================================================================\n/** returns an autopair function that uses the provided options.match function */\nfunction autoPairFnBuilder( options ){\n options = options || {};\n options.createPair = options.createPair || function _defaultCreatePair( params ){\n params = params || {};\n var a = params.listA.splice( params.indexA, 1 )[0],\n b = params.listB.splice( params.indexB, 1 )[0],\n aInBIndex = params.listB.indexOf( a ),\n bInAIndex = params.listA.indexOf( b );\n if( aInBIndex !== -1 ){ params.listB.splice( aInBIndex, 1 ); }\n if( bInAIndex !== -1 ){ params.listA.splice( bInAIndex, 1 ); }\n return this._pair( a, b, { silent: true });\n };\n // compile these here outside of the loop\n var _regexps = [];\n function getRegExps(){\n if( !_regexps.length ){\n _regexps = [\n new RegExp( this.filters[0] ),\n new RegExp( this.filters[1] )\n ];\n }\n return _regexps;\n }\n // mangle params as needed\n options.preprocessMatch = options.preprocessMatch || function _defaultPreprocessMatch( params ){\n var regexps = getRegExps.call( this );\n return _.extend( params, {\n matchTo : params.matchTo.name.replace( regexps[0], '' ),\n possible : params.possible.name.replace( regexps[1], '' )\n });\n };\n\n return function _strategy( params ){\n this.debug( 'autopair _strategy ---------------------------' );\n params = params || {};\n var listA = params.listA,\n listB = params.listB,\n indexA = 0, indexB,\n bestMatch = {\n score : 0.0,\n index : null\n },\n paired = [];\n //console.debug( 'params:', JSON.stringify( params, null, ' ' ) );\n this.debug( 'starting list lens:', listA.length, listB.length );\n this.debug( 'bestMatch (starting):', JSON.stringify( bestMatch, null, ' ' ) );\n\n while( indexA < listA.length ){\n var matchTo = listA[ indexA ];\n bestMatch.score = 0.0;\n\n for( indexB=0; indexB= scoreThreshold ){\n //console.debug( 'autoPairFnBuilder.strategy', listA[ indexA ].name, listB[ bestMatch.index ].name );\n paired.push( options.createPair.call( this, {\n listA : listA,\n indexA : indexA,\n listB : listB,\n indexB : bestMatch.index\n }));\n //console.debug( 'list lens now:', listA.length, listB.length );\n } else {\n indexA += 1;\n }\n if( !listA.length || !listB.length ){\n return paired;\n }\n }\n this.debug( 'paired:', JSON.stringify( paired, null, ' ' ) );\n this.debug( 'autopair _strategy ---------------------------' );\n return paired;\n };\n}\n\n\n// ============================================================================\n/** An interface for building collections of paired datasets.\n */\nvar PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).extend( baseCreator.CollectionCreatorMixin ).extend({\n _logNamespace : logNamespace,\n\n className: 'list-of-pairs-collection-creator collection-creator flex-row-container',\n\n /** set up initial options, instance vars, behaviors, and autopair (if set to do so) */\n initialize : function( attributes ){\n this.metric( 'PairedCollectionCreator.initialize', attributes );\n //this.debug( '-- PairedCollectionCreator:', attributes );\n\n attributes = _.defaults( attributes, {\n datasets : [],\n filters : this.DEFAULT_FILTERS,\n automaticallyPair : true,\n strategy : 'lcs',\n matchPercentage : 0.9,\n twoPassAutopairing : true\n });\n\n /** unordered, original list */\n this.initialList = attributes.datasets;\n\n /** is this from a history? if so, what's its id? */\n this.historyId = attributes.historyId;\n\n /** which filters should be used initially? (String[2] or name in commonFilters) */\n this.filters = this.commonFilters[ attributes.filters ] || this.commonFilters[ this.DEFAULT_FILTERS ];\n if( _.isArray( attributes.filters ) ){\n this.filters = attributes.filters;\n }\n\n /** try to auto pair the unpaired datasets on load? */\n this.automaticallyPair = attributes.automaticallyPair;\n\n /** what method to use for auto pairing (will be passed aggression level) */\n this.strategy = this.strategies[ attributes.strategy ] || this.strategies[ this.DEFAULT_STRATEGY ];\n if( _.isFunction( attributes.strategy ) ){\n this.strategy = attributes.strategy;\n }\n\n /** distance/mismatch level allowed for autopairing */\n this.matchPercentage = attributes.matchPercentage;\n\n /** try to autopair using simple first, then this.strategy on the remainder */\n this.twoPassAutopairing = attributes.twoPassAutopairing;\n\n /** remove file extensions (\\.*) from created pair names? */\n this.removeExtensions = true;\n //this.removeExtensions = false;\n\n /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n this.oncancel = attributes.oncancel;\n /** fn to call when the collection is created (scoped to this) */\n this.oncreate = attributes.oncreate;\n\n /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n this.autoscrollDist = attributes.autoscrollDist || 24;\n\n /** is the unpaired panel shown? */\n this.unpairedPanelHidden = false;\n /** is the paired panel shown? */\n this.pairedPanelHidden = false;\n\n /** DOM elements currently being dragged */\n this.$dragging = null;\n\n /** Used for blocking UI events during ajax/operations (don't post twice) */\n this.blocking = false;\n\n this._setUpCommonSettings( attributes );\n this._setUpBehaviors();\n this._dataSetUp();\n },\n\n /** map of common filter pairs by name */\n commonFilters : {\n illumina : [ '_1', '_2' ],\n Rs : [ '_R1', '_R2' ]\n },\n /** which commonFilter to use by default */\n DEFAULT_FILTERS : 'illumina',\n\n /** map of name->fn for autopairing */\n strategies : {\n 'simple' : 'autopairSimple',\n 'lcs' : 'autopairLCS',\n 'levenshtein' : 'autopairLevenshtein'\n },\n /** default autopair strategy name */\n DEFAULT_STRATEGY : 'lcs',\n\n // ------------------------------------------------------------------------ process raw list\n /** set up main data: cache initialList, sort, and autopair */\n _dataSetUp : function(){\n //this.debug( '-- _dataSetUp' );\n\n this.paired = [];\n this.unpaired = [];\n\n this.selectedIds = [];\n\n // sort initial list, add ids if needed, and save new working copy to unpaired\n this._sortInitialList();\n this._ensureIds();\n this.unpaired = this.initialList.slice( 0 );\n\n if( this.automaticallyPair ){\n this.autoPair();\n this.once( 'rendered:initial', function(){\n this.trigger( 'autopair' );\n });\n }\n },\n\n /** sort initial list */\n _sortInitialList : function(){\n //this.debug( '-- _sortInitialList' );\n this._sortDatasetList( this.initialList );\n },\n\n /** sort a list of datasets */\n _sortDatasetList : function( list ){\n // currently only natural sort by name\n list.sort( function( a, b ){ return naturalSort( a.name, b.name ); });\n return list;\n },\n\n /** add ids to dataset objs in initial list if none */\n _ensureIds : function(){\n this.initialList.forEach( function( dataset ){\n if( !dataset.hasOwnProperty( 'id' ) ){\n dataset.id = _.uniqueId();\n }\n });\n return this.initialList;\n },\n\n /** split initial list into two lists, those that pass forward filters & those passing reverse */\n _splitByFilters : function(){\n var regexFilters = this.filters.map( function( stringFilter ){\n return new RegExp( stringFilter );\n }),\n split = [ [], [] ];\n\n function _filter( unpaired, filter ){\n return filter.test( unpaired.name );\n //return dataset.name.indexOf( filter ) >= 0;\n }\n this.unpaired.forEach( function _filterEach( unpaired ){\n // 90% of the time this seems to work, but:\n //TODO: this treats *all* strings as regex which may confuse people - possibly check for // surrounding?\n // would need explanation in help as well\n regexFilters.forEach( function( filter, i ){\n if( _filter( unpaired, filter ) ){\n split[i].push( unpaired );\n }\n });\n });\n return split;\n },\n\n /** add a dataset to the unpaired list in it's proper order */\n _addToUnpaired : function( dataset ){\n // currently, unpaired is natural sorted by name, use binary search to find insertion point\n var binSearchSortedIndex = function( low, hi ){\n if( low === hi ){ return low; }\n\n var mid = Math.floor( ( hi - low ) / 2 ) + low,\n compared = naturalSort( dataset.name, this.unpaired[ mid ].name );\n\n if( compared < 0 ){\n return binSearchSortedIndex( low, mid );\n } else if( compared > 0 ){\n return binSearchSortedIndex( mid + 1, hi );\n }\n // walk the equal to find the last\n while( this.unpaired[ mid ] && this.unpaired[ mid ].name === dataset.name ){ mid++; }\n return mid;\n\n }.bind( this );\n\n this.unpaired.splice( binSearchSortedIndex( 0, this.unpaired.length ), 0, dataset );\n },\n\n // ------------------------------------------------------------------------ auto pairing\n /** two passes to automatically create pairs:\n * use both simpleAutoPair, then the fn mentioned in strategy\n */\n autoPair : function( strategy ){\n // split first using exact matching\n var split = this._splitByFilters(),\n paired = [];\n if( this.twoPassAutopairing ){\n paired = this.autopairSimple({\n listA : split[0],\n listB : split[1]\n });\n split = this._splitByFilters();\n }\n\n // uncomment to see printlns while running tests\n //this.debug = function(){ console.log.apply( console, arguments ); };\n\n // then try the remainder with something less strict\n strategy = strategy || this.strategy;\n split = this._splitByFilters();\n paired = paired.concat( this[ strategy ].call( this, {\n listA : split[0],\n listB : split[1]\n }));\n return paired;\n },\n\n /** autopair by exact match */\n autopairSimple : autoPairFnBuilder({\n scoreThreshold: function(){ return 0.6; },\n match : function _match( params ){\n params = params || {};\n if( params.matchTo === params.possible ){\n return {\n index: params.index,\n score: 1.0\n };\n }\n return params.bestMatch;\n }\n }),\n\n /** autopair by levenshtein edit distance scoring */\n autopairLevenshtein : autoPairFnBuilder({\n scoreThreshold: function(){ return this.matchPercentage; },\n match : function _matches( params ){\n params = params || {};\n var distance = levenshteinDistance( params.matchTo, params.possible ),\n score = 1.0 - ( distance / ( Math.max( params.matchTo.length, params.possible.length ) ) );\n if( score > params.bestMatch.score ){\n return {\n index: params.index,\n score: score\n };\n }\n return params.bestMatch;\n }\n }),\n\n /** autopair by longest common substrings scoring */\n autopairLCS : autoPairFnBuilder({\n scoreThreshold: function(){ return this.matchPercentage; },\n match : function _matches( params ){\n params = params || {};\n var match = this._naiveStartingAndEndingLCS( params.matchTo, params.possible ).length,\n score = match / ( Math.max( params.matchTo.length, params.possible.length ) );\n if( score > params.bestMatch.score ){\n return {\n index: params.index,\n score: score\n };\n }\n return params.bestMatch;\n }\n }),\n\n /** return the concat'd longest common prefix and suffix from two strings */\n _naiveStartingAndEndingLCS : function( s1, s2 ){\n var fwdLCS = '',\n revLCS = '',\n i = 0, j = 0;\n while( i < s1.length && i < s2.length ){\n if( s1[ i ] !== s2[ i ] ){\n break;\n }\n fwdLCS += s1[ i ];\n i += 1;\n }\n if( i === s1.length ){ return s1; }\n if( i === s2.length ){ return s2; }\n\n i = ( s1.length - 1 );\n j = ( s2.length - 1 );\n while( i >= 0 && j >= 0 ){\n if( s1[ i ] !== s2[ j ] ){\n break;\n }\n revLCS = [ s1[ i ], revLCS ].join( '' );\n i -= 1;\n j -= 1;\n }\n return fwdLCS + revLCS;\n },\n\n // ------------------------------------------------------------------------ pairing / unpairing\n /** create a pair from fwd and rev, removing them from unpaired, and placing the new pair in paired */\n _pair : function( fwd, rev, options ){\n options = options || {};\n this.debug( '_pair:', fwd, rev );\n var pair = this._createPair( fwd, rev, options.name );\n this.paired.push( pair );\n this.unpaired = _.without( this.unpaired, fwd, rev );\n if( !options.silent ){\n this.trigger( 'pair:new', pair );\n }\n return pair;\n },\n\n /** create a pair Object from fwd and rev, adding the name attribute (will guess if not given) */\n _createPair : function( fwd, rev, name ){\n // ensure existance and don't pair something with itself\n if( !( fwd && rev ) || ( fwd === rev ) ){\n throw new Error( 'Bad pairing: ' + [ JSON.stringify( fwd ), JSON.stringify( rev ) ] );\n }\n name = name || this._guessNameForPair( fwd, rev );\n return { forward : fwd, name : name, reverse : rev };\n },\n\n /** try to find a good pair name for the given fwd and rev datasets */\n _guessNameForPair : function( fwd, rev, removeExtensions ){\n removeExtensions = ( removeExtensions !== undefined )?( removeExtensions ):( this.removeExtensions );\n var fwdName = fwd.name,\n revName = rev.name,\n lcs = this._naiveStartingAndEndingLCS(\n fwdName.replace( new RegExp( this.filters[0] ), '' ),\n revName.replace( new RegExp( this.filters[1] ), '' )\n );\n if( removeExtensions ){\n var lastDotIndex = lcs.lastIndexOf( '.' );\n if( lastDotIndex > 0 ){\n var extension = lcs.slice( lastDotIndex, lcs.length );\n lcs = lcs.replace( extension, '' );\n fwdName = fwdName.replace( extension, '' );\n revName = revName.replace( extension, '' );\n }\n }\n return lcs || ( fwdName + ' & ' + revName );\n },\n\n /** unpair a pair, removing it from paired, and adding the fwd,rev datasets back into unpaired */\n _unpair : function( pair, options ){\n options = options || {};\n if( !pair ){\n throw new Error( 'Bad pair: ' + JSON.stringify( pair ) );\n }\n this.paired = _.without( this.paired, pair );\n this._addToUnpaired( pair.forward );\n this._addToUnpaired( pair.reverse );\n\n if( !options.silent ){\n this.trigger( 'pair:unpair', [ pair ] );\n }\n return pair;\n },\n\n /** unpair all paired datasets */\n unpairAll : function(){\n var pairs = [];\n while( this.paired.length ){\n pairs.push( this._unpair( this.paired[ 0 ], { silent: true }) );\n }\n this.trigger( 'pair:unpair', pairs );\n },\n\n // ------------------------------------------------------------------------ API\n /** convert a pair into JSON compatible with the collections API */\n _pairToJSON : function( pair, src ){\n src = src || 'hda';\n //TODO: consider making this the pair structure when created instead\n return {\n collection_type : 'paired',\n src : 'new_collection',\n name : pair.name,\n element_identifiers : [{\n name : 'forward',\n id : pair.forward.id,\n src : src\n }, {\n name : 'reverse',\n id : pair.reverse.id,\n src : src\n }]\n };\n },\n\n /** create the collection via the API\n * @returns {jQuery.xhr Object} the jquery ajax request\n */\n createList : function( name ){\n var creator = this,\n url = Galaxy.root + 'api/histories/' + this.historyId + '/contents/dataset_collections';\n\n //TODO: use ListPairedCollection.create()\n var ajaxData = {\n type : 'dataset_collection',\n collection_type : 'list:paired',\n hide_source_items : creator.hideOriginals || false,\n name : _.escape( name || creator.$( '.collection-name' ).val() ),\n element_identifiers : creator.paired.map( function( pair ){\n return creator._pairToJSON( pair );\n })\n\n };\n //this.debug( JSON.stringify( ajaxData ) );\n creator.blocking = true;\n return jQuery.ajax( url, {\n type : 'POST',\n contentType : 'application/json',\n dataType : 'json',\n data : JSON.stringify( ajaxData )\n })\n .always( function(){\n creator.blocking = false;\n })\n .fail( function( xhr, status, message ){\n creator._ajaxErrHandler( xhr, status, message );\n })\n .done( function( response, message, xhr ){\n //this.info( 'ok', response, message, xhr );\n creator.trigger( 'collection:created', response, message, xhr );\n creator.metric( 'collection:created', response );\n if( typeof creator.oncreate === 'function' ){\n creator.oncreate.call( this, response, message, xhr );\n }\n });\n },\n\n /** handle ajax errors with feedback and details to the user (if available) */\n _ajaxErrHandler : function( xhr, status, message ){\n this.error( xhr, status, message );\n var content = _l( 'An error occurred while creating this collection' );\n if( xhr ){\n if( xhr.readyState === 0 && xhr.status === 0 ){\n content += ': ' + _l( 'Galaxy could not be reached and may be updating.' )\n + _l( ' Try again in a few minutes.' );\n } else if( xhr.responseJSON ){\n content += '
                                    ' + JSON.stringify( xhr.responseJSON ) + '
                                    ';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n // ------------------------------------------------------------------------ rendering\n /** render the entire interface */\n render : function( speed, callback ){\n //this.debug( '-- _render' );\n //this.$el.empty().html( this.templates.main() );\n this.$el.empty().html( this.templates.main() );\n this._renderHeader( speed );\n this._renderMiddle( speed );\n this._renderFooter( speed );\n this._addPluginComponents();\n this.trigger( 'rendered', this );\n return this;\n },\n\n /** render the header section */\n _renderHeader : function( speed, callback ){\n //this.debug( '-- _renderHeader' );\n var $header = this.$( '.header' ).empty().html( this.templates.header() )\n .find( '.help-content' ).prepend( $( this.templates.helpContent() ) );\n\n this._renderFilters();\n return $header;\n },\n /** fill the filter inputs with the filter values */\n _renderFilters : function(){\n return this.$( '.forward-column .column-header input' ).val( this.filters[0] )\n .add( this.$( '.reverse-column .column-header input' ).val( this.filters[1] ) );\n },\n\n /** render the middle including unpaired and paired sections (which may be hidden) */\n _renderMiddle : function( speed, callback ){\n var $middle = this.$( '.middle' ).empty().html( this.templates.middle() );\n\n // (re-) hide the un/paired panels based on instance vars\n if( this.unpairedPanelHidden ){\n this.$( '.unpaired-columns' ).hide();\n } else if( this.pairedPanelHidden ){\n this.$( '.paired-columns' ).hide();\n }\n\n this._renderUnpaired();\n this._renderPaired();\n return $middle;\n },\n /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n _renderUnpaired : function( speed, callback ){\n //this.debug( '-- _renderUnpaired' );\n var creator = this,\n $fwd, $rev, $prd = [],\n split = this._splitByFilters();\n // update unpaired counts\n this.$( '.forward-column .title' )\n .text([ split[0].length, _l( 'unpaired forward' ) ].join( ' ' ));\n this.$( '.forward-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[0].length ) );\n this.$( '.reverse-column .title' )\n .text([ split[1].length, _l( 'unpaired reverse' ) ].join( ' ' ));\n this.$( '.reverse-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[1].length ) );\n\n this.$( '.unpaired-columns .column-datasets' ).empty();\n\n // show/hide the auto pair button if any unpaired are left\n this.$( '.autopair-link' ).toggle( this.unpaired.length !== 0 );\n if( this.unpaired.length === 0 ){\n this._renderUnpairedEmpty();\n return;\n }\n\n // create the dataset dom arrays\n $rev = split[1].map( function( dataset, i ){\n // if there'll be a fwd dataset across the way, add a button to pair the row\n if( ( split[0][ i ] !== undefined )\n && ( split[0][ i ] !== dataset ) ){\n $prd.push( creator._renderPairButton() );\n }\n return creator._renderUnpairedDataset( dataset );\n });\n $fwd = split[0].map( function( dataset ){\n return creator._renderUnpairedDataset( dataset );\n });\n\n if( !$fwd.length && !$rev.length ){\n this._renderUnpairedNotShown();\n return;\n }\n // add to appropo cols\n //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n // and swapping out that\n this.$( '.unpaired-columns .forward-column .column-datasets' ).append( $fwd )\n .add( this.$( '.unpaired-columns .paired-column .column-datasets' ).append( $prd ) )\n .add( this.$( '.unpaired-columns .reverse-column .column-datasets' ).append( $rev ) );\n this._adjUnpairedOnScrollbar();\n },\n /** return a string to display the count of filtered out datasets */\n _renderUnpairedDisplayStr : function( numFiltered ){\n return [ '(', numFiltered, ' ', _l( 'filtered out' ), ')' ].join('');\n },\n /** return an unattached jQuery DOM element to represent an unpaired dataset */\n _renderUnpairedDataset : function( dataset ){\n //TODO: to underscore template\n return $( '
                                  • ')\n .attr( 'id', 'dataset-' + dataset.id )\n .addClass( 'dataset unpaired' )\n .attr( 'draggable', true )\n .addClass( dataset.selected? 'selected': '' )\n .append( $( '' ).addClass( 'dataset-name' ).text( dataset.name ) )\n //??\n .data( 'dataset', dataset );\n },\n /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n _renderPairButton : function(){\n //TODO: *not* a dataset - don't pretend like it is\n return $( '
                                  • ').addClass( 'dataset unpaired' )\n .append( $( '' ).addClass( 'dataset-name' ).text( _l( 'Pair these datasets' ) ) );\n },\n /** a message to display when no unpaired left */\n _renderUnpairedEmpty : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '
                                    ' )\n .text( '(' + _l( 'no remaining unpaired datasets' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** a message to display when no unpaired can be shown with the current filters */\n _renderUnpairedNotShown : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '
                                    ' )\n .text( '(' + _l( 'no datasets were found matching the current filters' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n _adjUnpairedOnScrollbar : function(){\n var $unpairedColumns = this.$( '.unpaired-columns' ).last(),\n $firstDataset = this.$( '.unpaired-columns .reverse-column .dataset' ).first();\n if( !$firstDataset.length ){ return; }\n var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n rightDiff = Math.floor( ucRight ) - Math.floor( dsRight );\n //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n this.$( '.unpaired-columns .forward-column' )\n .css( 'margin-left', ( rightDiff > 0 )? rightDiff: 0 );\n },\n\n /** render the paired section and update counts of paired datasets */\n _renderPaired : function( speed, callback ){\n //this.debug( '-- _renderPaired' );\n this.$( '.paired-column-title .title' ).text([ this.paired.length, _l( 'paired' ) ].join( ' ' ) );\n // show/hide the unpair all link\n this.$( '.unpair-all-link' ).toggle( this.paired.length !== 0 );\n if( this.paired.length === 0 ){\n this._renderPairedEmpty();\n return;\n //TODO: would be best to return here (the $columns)\n } else {\n // show/hide 'remove extensions link' when any paired and they seem to have extensions\n this.$( '.remove-extensions-link' ).show();\n }\n\n this.$( '.paired-columns .column-datasets' ).empty();\n var creator = this;\n this.paired.forEach( function( pair, i ){\n //TODO: cache these?\n var pairView = new PairView({ pair: pair });\n creator.$( '.paired-columns .column-datasets' )\n .append( pairView.render().$el )\n .append([\n ''\n ].join( '' ));\n });\n },\n /** a message to display when none paired */\n _renderPairedEmpty : function(){\n var $msg = $( '
                                    ' )\n .text( '(' + _l( 'no paired datasets yet' ) + ')' );\n this.$( '.paired-columns .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n\n footerSettings : {\n '.hide-originals': 'hideOriginals',\n '.remove-extensions': 'removeExtensions'\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents : function(){\n this._chooseFiltersPopover( '.choose-filters-link' );\n this.$( '.help-content i' ).hoverhighlight( '.collection-creator', 'rgba( 64, 255, 255, 1.0 )' );\n },\n\n /** build a filter selection popover allowing selection of common filter pairs */\n _chooseFiltersPopover : function( selector ){\n function filterChoice( val1, val2 ){\n return [\n ''\n ].join('');\n }\n var $popoverContent = $( _.template([\n '
                                    ',\n '
                                    ',\n _l( 'Choose from the following filters to change which unpaired reads are shown in the display' ),\n ':
                                    ',\n _.values( this.commonFilters ).map( function( filterSet ){\n return filterChoice( filterSet[0], filterSet[1] );\n }).join( '' ),\n '
                                    '\n ].join(''))({}));\n\n return this.$( selector ).popover({\n container : '.collection-creator',\n placement : 'bottom',\n html : true,\n //animation : false,\n content : $popoverContent\n });\n },\n\n /** add (or clear if clear is truthy) a validation warning to what */\n _validationWarning : function( what, clear ){\n var VALIDATION_CLASS = 'validation-warning';\n if( what === 'name' ){\n what = this.$( '.collection-name' ).add( this.$( '.collection-name-prompt' ) );\n this.$( '.collection-name' ).focus().select();\n }\n if( clear ){\n what = what || this.$( '.' + VALIDATION_CLASS );\n what.removeClass( VALIDATION_CLASS );\n } else {\n what.addClass( VALIDATION_CLASS );\n }\n },\n\n // ------------------------------------------------------------------------ events\n /** set up event handlers on self */\n _setUpBehaviors : function(){\n this.once( 'rendered', function(){\n this.trigger( 'rendered:initial', this );\n });\n\n this.on( 'pair:new', function(){\n //TODO: ideally only re-render the columns (or even elements) involved\n this._renderUnpaired();\n this._renderPaired();\n\n // scroll to bottom where new pairs are added\n //TODO: this doesn't seem to work - innerHeight sticks at 133...\n // may have to do with improper flex columns\n //var $pairedView = this.$( '.paired-columns' );\n //$pairedView.scrollTop( $pairedView.innerHeight() );\n //this.debug( $pairedView.height() )\n this.$( '.paired-columns' ).scrollTop( 8000000 );\n });\n this.on( 'pair:unpair', function( pairs ){\n //TODO: ideally only re-render the columns (or even elements) involved\n this._renderUnpaired();\n this._renderPaired();\n this.splitView();\n });\n\n this.on( 'filter-change', function(){\n this.filters = [\n this.$( '.forward-unpaired-filter input' ).val(),\n this.$( '.reverse-unpaired-filter input' ).val()\n ];\n this.metric( 'filter-change', this.filters );\n this._renderFilters();\n this._renderUnpaired();\n });\n\n this.on( 'autopair', function(){\n this._renderUnpaired();\n this._renderPaired();\n\n var message, msgClass = null;\n if( this.paired.length ){\n msgClass = 'alert-success';\n message = this.paired.length + ' ' + _l( 'pairs created' );\n if( !this.unpaired.length ){\n message += ': ' + _l( 'all datasets have been successfully paired' );\n this.hideUnpaired();\n this.$( '.collection-name' ).focus();\n }\n } else {\n message = _l([\n 'Could not automatically create any pairs from the given dataset names.',\n 'You may want to choose or enter different filters and try auto-pairing again.',\n 'Close this message using the X on the right to view more help.'\n ].join( ' ' ));\n }\n this._showAlert( message, msgClass );\n });\n\n //this.on( 'all', function(){\n // this.info( arguments );\n //});\n return this;\n },\n\n events : {\n // header\n 'click .more-help' : '_clickMoreHelp',\n 'click .less-help' : '_clickLessHelp',\n 'click .main-help' : '_toggleHelp',\n 'click .header .alert button' : '_hideAlert',\n 'click .forward-column .column-title' : '_clickShowOnlyUnpaired',\n 'click .reverse-column .column-title' : '_clickShowOnlyUnpaired',\n 'click .unpair-all-link' : '_clickUnpairAll',\n //TODO: this seems kinda backasswards - re-sending jq event as a backbone event, can we listen directly?\n 'change .forward-unpaired-filter input' : function( ev ){ this.trigger( 'filter-change' ); },\n 'focus .forward-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\n 'click .autopair-link' : '_clickAutopair',\n 'click .choose-filters .filter-choice' : '_clickFilterChoice',\n 'click .clear-filters-link' : '_clearFilters',\n 'change .reverse-unpaired-filter input' : function( ev ){ this.trigger( 'filter-change' ); },\n 'focus .reverse-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\n // unpaired\n 'click .forward-column .dataset.unpaired' : '_clickUnpairedDataset',\n 'click .reverse-column .dataset.unpaired' : '_clickUnpairedDataset',\n 'click .paired-column .dataset.unpaired' : '_clickPairRow',\n 'click .unpaired-columns' : 'clearSelectedUnpaired',\n 'mousedown .unpaired-columns .dataset' : '_mousedownUnpaired',\n // divider\n 'click .paired-column-title' : '_clickShowOnlyPaired',\n 'mousedown .flexible-partition-drag' : '_startPartitionDrag',\n // paired\n 'click .paired-columns .dataset.paired' : 'selectPair',\n 'click .paired-columns' : 'clearSelectedPaired',\n 'click .paired-columns .pair-name' : '_clickPairName',\n 'click .unpair-btn' : '_clickUnpair',\n // paired - drop target\n //'dragenter .paired-columns' : '_dragenterPairedColumns',\n //'dragleave .paired-columns .column-datasets': '_dragleavePairedColumns',\n 'dragover .paired-columns .column-datasets' : '_dragoverPairedColumns',\n 'drop .paired-columns .column-datasets' : '_dropPairedColumns',\n\n 'pair.dragstart .paired-columns .column-datasets' : '_pairDragstart',\n 'pair.dragend .paired-columns .column-datasets' : '_pairDragend',\n\n // footer\n 'change .remove-extensions' : function( ev ){ this.toggleExtensions(); },\n 'change .collection-name' : '_changeName',\n 'keydown .collection-name' : '_nameCheckForEnter',\n 'change .hide-originals' : '_changeHideOriginals',\n 'click .cancel-create' : '_cancelCreate',\n 'click .create-collection' : '_clickCreate'//,\n },\n\n /** toggle between showing only unpaired and split view */\n _clickShowOnlyUnpaired : function( ev ){\n //this.debug( 'click unpaired', ev.currentTarget );\n if( this.$( '.paired-columns' ).is( ':visible' ) ){\n this.hidePaired();\n } else {\n this.splitView();\n }\n },\n /** toggle between showing only paired and split view */\n _clickShowOnlyPaired : function( ev ){\n //this.debug( 'click paired' );\n if( this.$( '.unpaired-columns' ).is( ':visible' ) ){\n this.hideUnpaired();\n } else {\n this.splitView();\n }\n },\n\n /** hide unpaired, show paired */\n hideUnpaired : function( speed, callback ){\n this.unpairedPanelHidden = true;\n this.pairedPanelHidden = false;\n this._renderMiddle( speed, callback );\n },\n /** hide paired, show unpaired */\n hidePaired : function( speed, callback ){\n this.unpairedPanelHidden = false;\n this.pairedPanelHidden = true;\n this._renderMiddle( speed, callback );\n },\n /** show both paired and unpaired (splitting evenly) */\n splitView : function( speed, callback ){\n this.unpairedPanelHidden = this.pairedPanelHidden = false;\n this._renderMiddle( speed, callback );\n return this;\n },\n\n /** unpair all paired and do other super neat stuff which I'm not really sure about yet... */\n _clickUnpairAll : function( ev ){\n this.metric( 'unpairAll' );\n this.unpairAll();\n },\n\n /** attempt to autopair */\n _clickAutopair : function( ev ){\n var paired = this.autoPair();\n this.metric( 'autopair', paired.length, this.unpaired.length );\n this.trigger( 'autopair' );\n },\n\n /** set the filters based on the data attributes of the button click target */\n _clickFilterChoice : function( ev ){\n var $selected = $( ev.currentTarget );\n this.$( '.forward-unpaired-filter input' ).val( $selected.data( 'forward' ) );\n this.$( '.reverse-unpaired-filter input' ).val( $selected.data( 'reverse' ) );\n this._hideChooseFilters();\n this.trigger( 'filter-change' );\n },\n\n /** hide the choose filters popover */\n _hideChooseFilters : function(){\n //TODO: update bootstrap and remove the following hack\n // see also: https://github.com/twbs/bootstrap/issues/10260\n this.$( '.choose-filters-link' ).popover( 'hide' );\n this.$( '.popover' ).css( 'display', 'none' );\n },\n\n /** clear both filters */\n _clearFilters : function( ev ){\n this.$( '.forward-unpaired-filter input' ).val( '' );\n this.$( '.reverse-unpaired-filter input' ).val( '' );\n this.trigger( 'filter-change' );\n },\n\n // ........................................................................ unpaired\n /** select an unpaired dataset */\n _clickUnpairedDataset : function( ev ){\n ev.stopPropagation();\n return this.toggleSelectUnpaired( $( ev.currentTarget ) );\n },\n\n /** Toggle the selection of an unpaired dataset representation.\n * @param [jQuery] $dataset the unpaired dataset dom rep to select\n * @param [Boolean] options.force if defined, force selection based on T/F; otherwise, toggle\n */\n toggleSelectUnpaired : function( $dataset, options ){\n options = options || {};\n var dataset = $dataset.data( 'dataset' ),\n select = options.force !== undefined? options.force: !$dataset.hasClass( 'selected' );\n //this.debug( id, options.force, $dataset, dataset );\n if( !$dataset.length || dataset === undefined ){ return $dataset; }\n\n if( select ){\n $dataset.addClass( 'selected' );\n if( !options.waitToPair ){\n this.pairAllSelected();\n }\n\n } else {\n $dataset.removeClass( 'selected' );\n //delete dataset.selected;\n }\n return $dataset;\n },\n\n /** pair all the currently selected unpaired datasets */\n pairAllSelected : function( options ){\n options = options || {};\n var creator = this,\n fwds = [],\n revs = [],\n pairs = [];\n creator.$( '.unpaired-columns .forward-column .dataset.selected' ).each( function(){\n fwds.push( $( this ).data( 'dataset' ) );\n });\n creator.$( '.unpaired-columns .reverse-column .dataset.selected' ).each( function(){\n revs.push( $( this ).data( 'dataset' ) );\n });\n fwds.length = revs.length = Math.min( fwds.length, revs.length );\n //this.debug( fwds );\n //this.debug( revs );\n fwds.forEach( function( fwd, i ){\n try {\n pairs.push( creator._pair( fwd, revs[i], { silent: true }) );\n\n } catch( err ){\n //TODO: preserve selected state of those that couldn't be paired\n //TODO: warn that some could not be paired\n creator.error( err );\n }\n });\n if( pairs.length && !options.silent ){\n this.trigger( 'pair:new', pairs );\n }\n return pairs;\n },\n\n /** clear the selection on all unpaired datasets */\n clearSelectedUnpaired : function(){\n this.$( '.unpaired-columns .dataset.selected' ).removeClass( 'selected' );\n },\n\n /** when holding down the shift key on a click, 'paint' the moused over datasets as selected */\n _mousedownUnpaired : function( ev ){\n if( ev.shiftKey ){\n var creator = this,\n $startTarget = $( ev.target ).addClass( 'selected' ),\n moveListener = function( ev ){\n creator.$( ev.target ).filter( '.dataset' ).addClass( 'selected' );\n };\n $startTarget.parent().on( 'mousemove', moveListener );\n\n // on any mouseup, stop listening to the move and try to pair any selected\n $( document ).one( 'mouseup', function( ev ){\n $startTarget.parent().off( 'mousemove', moveListener );\n creator.pairAllSelected();\n });\n }\n },\n\n /** attempt to pair two datasets directly across from one another */\n _clickPairRow : function( ev ){\n //if( !ev.currentTarget ){ return true; }\n var rowIndex = $( ev.currentTarget ).index(),\n fwd = $( '.unpaired-columns .forward-column .dataset' ).eq( rowIndex ).data( 'dataset' ),\n rev = $( '.unpaired-columns .reverse-column .dataset' ).eq( rowIndex ).data( 'dataset' );\n //this.debug( 'row:', rowIndex, fwd, rev );\n this._pair( fwd, rev );\n },\n\n // ........................................................................ divider/partition\n /** start dragging the visible divider/partition between unpaired and paired panes */\n _startPartitionDrag : function( ev ){\n var creator = this,\n startingY = ev.pageY;\n //this.debug( 'partition drag START:', ev );\n $( 'body' ).css( 'cursor', 'ns-resize' );\n creator.$( '.flexible-partition-drag' ).css( 'color', 'black' );\n\n function endDrag( ev ){\n //creator.debug( 'partition drag STOP:', ev );\n // doing this by an added class didn't really work well - kept flashing still\n creator.$( '.flexible-partition-drag' ).css( 'color', '' );\n $( 'body' ).css( 'cursor', '' ).unbind( 'mousemove', trackMouse );\n }\n function trackMouse( ev ){\n var offset = ev.pageY - startingY;\n //creator.debug( 'partition:', startingY, offset );\n if( !creator.adjPartition( offset ) ){\n //creator.debug( 'mouseup triggered' );\n $( 'body' ).trigger( 'mouseup' );\n }\n creator._adjUnpairedOnScrollbar();\n startingY += offset;\n }\n $( 'body' ).mousemove( trackMouse );\n $( 'body' ).one( 'mouseup', endDrag );\n },\n\n /** adjust the parition up/down +/-adj pixels */\n adjPartition : function( adj ){\n var $unpaired = this.$( '.unpaired-columns' ),\n $paired = this.$( '.paired-columns' ),\n unpairedHi = parseInt( $unpaired.css( 'height' ), 10 ),\n pairedHi = parseInt( $paired.css( 'height' ), 10 );\n //this.debug( adj, 'hi\\'s:', unpairedHi, pairedHi, unpairedHi + adj, pairedHi - adj );\n\n unpairedHi = Math.max( 10, unpairedHi + adj );\n pairedHi = pairedHi - adj;\n\n var movingUpwards = adj < 0;\n // when the divider gets close to the top - lock into hiding the unpaired section\n if( movingUpwards ){\n if( this.unpairedPanelHidden ){\n return false;\n } else if( unpairedHi <= 10 ){\n this.hideUnpaired();\n return false;\n }\n } else {\n if( this.unpairedPanelHidden ){\n $unpaired.show();\n this.unpairedPanelHidden = false;\n }\n }\n\n // when the divider gets close to the bottom - lock into hiding the paired section\n if( !movingUpwards ){\n if( this.pairedPanelHidden ){\n return false;\n } else if( pairedHi <= 15 ){\n this.hidePaired();\n return false;\n }\n\n } else {\n if( this.pairedPanelHidden ){\n $paired.show();\n this.pairedPanelHidden = false;\n }\n }\n\n $unpaired.css({\n height : unpairedHi + 'px',\n flex : '0 0 auto'\n });\n return true;\n },\n\n // ........................................................................ paired\n /** select a pair when clicked */\n selectPair : function( ev ){\n ev.stopPropagation();\n $( ev.currentTarget ).toggleClass( 'selected' );\n },\n\n /** deselect all pairs */\n clearSelectedPaired : function( ev ){\n this.$( '.paired-columns .dataset.selected' ).removeClass( 'selected' );\n },\n\n /** rename a pair when the pair name is clicked */\n _clickPairName : function( ev ){\n ev.stopPropagation();\n var $name = $( ev.currentTarget ),\n $pair = $name.parent().parent(),\n index = $pair.index( '.dataset.paired' ),\n pair = this.paired[ index ],\n response = prompt( 'Enter a new name for the pair:', pair.name );\n if( response ){\n pair.name = response;\n // set a flag (which won't be passed in json creation) for manual naming so we don't overwrite these\n // when adding/removing extensions\n //hackish\n pair.customizedName = true;\n $name.text( pair.name );\n }\n },\n\n /** unpair this pair */\n _clickUnpair : function( ev ){\n //if( !ev.currentTarget ){ return true; }\n var pairIndex = Math.floor( $( ev.currentTarget ).index( '.unpair-btn' ) );\n //this.debug( 'pair:', pairIndex );\n this._unpair( this.paired[ pairIndex ] );\n },\n\n // ........................................................................ paired - drag and drop re-ordering\n //_dragenterPairedColumns : function( ev ){\n // this.debug( '_dragenterPairedColumns:', ev );\n //},\n //_dragleavePairedColumns : function( ev ){\n // //this.debug( '_dragleavePairedColumns:', ev );\n //},\n /** track the mouse drag over the paired list adding a placeholder to show where the drop would occur */\n _dragoverPairedColumns : function( ev ){\n //this.debug( '_dragoverPairedColumns:', ev );\n ev.preventDefault();\n\n var $list = this.$( '.paired-columns .column-datasets' );\n this._checkForAutoscroll( $list, ev.originalEvent.clientY );\n //this.debug( ev.originalEvent.clientX, ev.originalEvent.clientY );\n var $nearest = this._getNearestPairedDatasetLi( ev.originalEvent.clientY );\n\n $( '.element-drop-placeholder' ).remove();\n var $placeholder = $( '
                                    ' );\n if( !$nearest.length ){\n $list.append( $placeholder );\n } else {\n $nearest.before( $placeholder );\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll : function( $element, y ){\n var AUTOSCROLL_SPEED = 2;\n var offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = ( offset.top + $element.outerHeight() ) - y;\n //this.debug( '_checkForAutoscroll:', scrollTop, upperDist, lowerDist );\n if( upperDist >= 0 && upperDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop - AUTOSCROLL_SPEED );\n } else if( lowerDist >= 0 && lowerDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop + AUTOSCROLL_SPEED );\n }\n },\n\n /** get the nearest *previous* paired dataset PairView based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestPairedDatasetLi : function( y ){\n var WIGGLE = 4,\n lis = this.$( '.paired-columns .column-datasets li' ).toArray();\n for( var i=0; i y && top - halfHeight < y ){\n //this.debug( y, top + halfHeight, top - halfHeight )\n return $li;\n }\n }\n return $();\n },\n /** drop (dragged/selected PairViews) onto the list, re-ordering both the DOM and the internal array of pairs */\n _dropPairedColumns : function( ev ){\n // both required for firefox\n ev.preventDefault();\n ev.dataTransfer.dropEffect = 'move';\n\n var $nearest = this._getNearestPairedDatasetLi( ev.originalEvent.clientY );\n if( $nearest.length ){\n this.$dragging.insertBefore( $nearest );\n\n } else {\n // no nearest before - insert after last element (unpair button)\n this.$dragging.insertAfter( this.$( '.paired-columns .unpair-btn' ).last() );\n }\n // resync the creator's list of paired based on the new DOM order\n this._syncPairsToDom();\n return false;\n },\n /** resync the creator's list of paired based on the DOM order of pairs */\n _syncPairsToDom : function(){\n var newPaired = [];\n //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n this.$( '.paired-columns .dataset.paired' ).each( function(){\n newPaired.push( $( this ).data( 'pair' ) );\n });\n //this.debug( newPaired );\n this.paired = newPaired;\n this._renderPaired();\n },\n /** drag communication with pair sub-views: dragstart */\n _pairDragstart : function( ev, pair ){\n //this.debug( '_pairDragstart', ev, pair )\n // auto select the pair causing the event and move all selected\n pair.$el.addClass( 'selected' );\n var $selected = this.$( '.paired-columns .dataset.selected' );\n this.$dragging = $selected;\n },\n /** drag communication with pair sub-views: dragend - remove the placeholder */\n _pairDragend : function( ev, pair ){\n //this.debug( '_pairDragend', ev, pair )\n $( '.element-drop-placeholder' ).remove();\n this.$dragging = null;\n },\n\n // ........................................................................ footer\n toggleExtensions : function( force ){\n var creator = this;\n creator.removeExtensions = ( force !== undefined )?( force ):( !creator.removeExtensions );\n\n _.each( creator.paired, function( pair ){\n // don't overwrite custom names\n if( pair.customizedName ){ return; }\n pair.name = creator._guessNameForPair( pair.forward, pair.reverse );\n });\n\n creator._renderPaired();\n creator._renderFooter();\n },\n\n // ------------------------------------------------------------------------ misc\n /** debug a dataset list */\n _printList : function( list ){\n var creator = this;\n _.each( list, function( e ){\n if( list === creator.paired ){\n creator._printPair( e );\n } else {\n //creator.debug( e );\n }\n });\n },\n\n /** print a pair Object */\n _printPair : function( pair ){\n this.debug( pair.forward.name, pair.reverse.name, ': ->', pair.name );\n },\n\n /** string rep */\n toString : function(){ return 'PairedCollectionCreator'; },\n\n templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\n /** the header (not including help text) */\n header : _.template([\n '
                                    ',\n '', _l( 'More help' ), '',\n '
                                    ',\n '', _l( 'Less' ), '',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '',\n '',\n '
                                    ',\n\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '', _l( 'Unpaired forward' ), '',\n '',\n '
                                    ',\n '
                                    ',\n '',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '', _l( 'Unpaired reverse' ), '',\n '',\n '
                                    ',\n '
                                    ',\n '',\n '
                                    ',\n '
                                    ',\n '
                                    ',\n '
                                    '\n ].join('')),\n\n /** the middle: unpaired, divider, and paired */\n middle : _.template([\n // contains two flex rows (rows that fill available space) and a divider btwn\n '
                                    ',\n '
                                    ',\n '
                                      ',\n '
                                      ',\n '
                                      ',\n '
                                        ',\n '
                                        ',\n '
                                        ',\n '
                                          ',\n '
                                          ',\n '
                                          ',\n '
                                          ',\n '
                                          ',\n '
                                          ',\n '
                                          ',\n '',\n '
                                          ',\n '',\n _l( 'Unpair all' ),\n '',\n '
                                          ',\n '
                                          ',\n '
                                          ',\n '
                                            ',\n '
                                            '\n ].join('')),\n\n /** creation and cancel controls */\n footer : _.template([\n '
                                            ',\n '
                                            ',\n '',\n '',\n '
                                            ',\n '
                                            ',\n '',\n '
                                            ', _l( 'Name' ), ':
                                            ',\n '
                                            ',\n '
                                            ',\n\n '
                                            ',\n '
                                            ',\n '',\n '
                                            ',\n '',\n '',\n '
                                            ',\n '
                                            ',\n\n '
                                            ',\n '',\n '
                                            ',\n '
                                            '\n ].join('')),\n\n /** help content */\n helpContent : _.template([\n '

                                            ', _l([\n 'Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ',\n 'These collections can be passed to tools and workflows in order to have analyses done on each member of ',\n 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ',\n 'and re-order the final collection.'\n ].join( '' )), '

                                            ',\n '

                                            ', _l([\n 'Unpaired datasets are shown in the unpaired section ',\n '(hover over the underlined words to highlight below). ',\n 'Paired datasets are shown in the paired section.',\n '

                                              To pair datasets, you can:',\n '
                                            • Click a dataset in the ',\n 'forward column ',\n 'to select it then click a dataset in the ',\n 'reverse column.',\n '
                                            • ',\n '
                                            • Click one of the \"Pair these datasets\" buttons in the ',\n 'middle column ',\n 'to pair the datasets in a particular row.',\n '
                                            • ',\n '
                                            • Click \"Auto-pair\" ',\n 'to have your datasets automatically paired based on name.',\n '
                                            • ',\n '
                                            '\n ].join( '' )), '

                                            ',\n '

                                            ', _l([\n '

                                              You can filter what is shown in the unpaired sections by:',\n '
                                            • Entering partial dataset names in either the ',\n 'forward filter or ',\n 'reverse filter.',\n '
                                            • ',\n '
                                            • Choosing from a list of preset filters by clicking the ',\n '\"Choose filters\" link.',\n '
                                            • ',\n '
                                            • Entering regular expressions to match dataset names. See: ',\n 'MDN\\'s JavaScript Regular Expression Tutorial. ',\n 'Note: forward slashes (\\\\) are not needed.',\n '
                                            • ',\n '
                                            • Clearing the filters by clicking the ',\n '\"Clear filters\" link.',\n '
                                            • ',\n '
                                            '\n ].join( '' )), '

                                            ',\n '

                                            ', _l([\n 'To unpair individual dataset pairs, click the ',\n 'unpair buttons ( ). ',\n 'Click the \"Unpair all\" link to unpair all pairs.'\n ].join( '' )), '

                                            ',\n '

                                            ', _l([\n 'You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ',\n '\"Remove file extensions from pair names?\" control.'\n ].join( '' )), '

                                            ',\n '

                                            ', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\". ',\n '(Note: you do not have to pair all unpaired datasets to finish.)'\n ].join( '' )), '

                                            '\n ].join(''))\n })\n});\n\n//=============================================================================\n/** a modal version of the paired collection creator */\nvar pairedCollectionCreatorModal = function _pairedCollectionCreatorModal( datasets, options ){\n\n var deferred = jQuery.Deferred(),\n creator;\n\n options = _.defaults( options || {}, {\n datasets : datasets,\n oncancel : function(){\n Galaxy.modal.hide();\n deferred.reject( 'cancelled' );\n },\n oncreate : function( creator, response ){\n Galaxy.modal.hide();\n deferred.resolve( response );\n }\n });\n\n if( !window.Galaxy || !Galaxy.modal ){\n throw new Error( 'Galaxy or Galaxy.modal not found' );\n }\n\n creator = new PairedCollectionCreator( options );\n Galaxy.modal.show({\n title : 'Create a collection of paired datasets',\n body : creator.$el,\n width : '80%',\n height : '800px',\n closing_events: true\n });\n creator.render();\n window.creator = creator;\n\n //TODO: remove modal header\n return deferred;\n};\n\n\n//=============================================================================\nfunction createListOfPairsCollection( collection, defaultHideSourceItems ){\n var elements = collection.toJSON();\n//TODO: validate elements\n return pairedCollectionCreatorModal( elements, {\n historyId : collection.historyId,\n defaultHideSourceItems: defaultHideSourceItems\n });\n}\n\n\n//=============================================================================\n return {\n PairedCollectionCreator : PairedCollectionCreator,\n pairedCollectionCreatorModal : pairedCollectionCreatorModal,\n createListOfPairsCollection : createListOfPairsCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js","define([\n \"mvc/collection/list-collection-creator\",\n \"mvc/history/hdca-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_CREATOR, HDCA, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/*==============================================================================\nTODO:\n the paired creator doesn't really mesh with the list creator as parent\n it may be better to make an abstract super class for both\n composites may inherit from this (or vis-versa)\n PairedDatasetCollectionElementView doesn't make a lot of sense\n\n==============================================================================*/\n/** */\nvar PairedDatasetCollectionElementView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n//TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName : 'li',\n className : 'collection-element',\n\n initialize : function( attributes ){\n this.element = attributes.element || {};\n this.identifier = attributes.identifier;\n },\n\n render : function(){\n this.$el\n .attr( 'data-element-id', this.element.id )\n .html( this.template({ identifier: this.identifier, element: this.element }) );\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template : _.template([\n '<%- identifier %>',\n '<%- element.name %>',\n ].join('')),\n\n /** remove the DOM and any listeners */\n destroy : function(){\n this.off();\n this.$el.remove();\n },\n\n /** string rep */\n toString : function(){\n return 'DatasetCollectionElementView()';\n }\n});\n\n\n// ============================================================================\nvar _super = LIST_CREATOR.ListCollectionCreator;\n\n/** An interface for building collections.\n */\nvar PairCollectionCreator = _super.extend({\n\n /** the class used to display individual elements */\n elementViewClass : PairedDatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass : HDCA.HistoryPairDatasetCollection,\n className : 'pair-collection-creator collection-creator flex-row-container',\n\n /** override to no-op */\n _mangleDuplicateNames : function(){},\n\n // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n // bad inital choices and\n // when the user has painted his/her self into a corner during creation/use-of-the-creator\n /** render the entire interface */\n render : function( speed, callback ){\n if( this.workingElements.length === 2 ){\n return _super.prototype.render.call( this, speed, callback );\n }\n return this._renderInvalid( speed, callback );\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** render forward/reverse */\n _renderList : function( speed, callback ){\n //this.debug( '-- _renderList' );\n //precondition: there are two valid elements in workingElements\n var creator = this,\n $tmp = jQuery( '
                                            ' ),\n $list = creator.$list();\n\n // lose the original views, create the new, append all at once, then call their renders\n _.each( this.elementViews, function( view ){\n view.destroy();\n creator.removeElementView( view );\n });\n $tmp.append( creator._createForwardElementView().$el );\n $tmp.append( creator._createReverseElementView().$el );\n $list.empty().append( $tmp.children() );\n _.invoke( creator.elementViews, 'render' );\n },\n\n /** create the forward element view */\n _createForwardElementView : function(){\n return this._createElementView( this.workingElements[0], { identifier: 'forward' } );\n },\n\n /** create the forward element view */\n _createReverseElementView : function(){\n return this._createElementView( this.workingElements[1], { identifier: 'reverse' } );\n },\n\n /** create an element view, cache in elementViews, and return */\n _createElementView : function( element, options ){\n var elementView = new this.elementViewClass( _.extend( options, {\n element : element,\n }));\n this.elementViews.push( elementView );\n return elementView;\n },\n\n /** swap the forward, reverse elements and re-render */\n swap : function(){\n this.workingElements = [\n this.workingElements[1],\n this.workingElements[0],\n ];\n this._renderList();\n },\n\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .swap' : 'swap',\n }),\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates : _.extend( _.clone( _super.prototype.templates ), {\n /** the middle: element list */\n middle : _.template([\n '',\n '
                                            ',\n '
                                            '\n ].join('')),\n\n /** help content */\n helpContent : _.template([\n '

                                            ', _l([\n 'Pair collections are permanent collections containing two datasets: one forward and one reverse. ',\n 'Often these are forward and reverse reads. The pair collections can be passed to tools and ',\n 'workflows in order to have analyses done on both datasets. This interface allows ',\n 'you to create a pair, name it, and swap which is forward and which reverse.'\n ].join( '' )), '

                                            ',\n '
                                              ',\n '
                                            • ', _l([\n 'Click the \"Swap\" link to make your forward dataset the reverse ',\n 'and the reverse dataset forward.'\n ].join( '' )), '
                                            • ',\n '
                                            • ', _l([\n 'Click the \"Cancel\" button to exit the interface.'\n ].join( '' )), '
                                            • ',\n '

                                            ',\n '

                                            ', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '

                                            '\n ].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial : _.template([\n '
                                            ',\n '
                                            ',\n '',\n '<% if( _.size( problems ) ){ %>',\n _l( 'The following selections could not be included due to problems' ),\n '
                                              <% _.each( problems, function( problem ){ %>',\n '
                                            • <%- problem.element.name %>: <%- problem.text %>
                                            • ',\n '<% }); %>
                                            ',\n '<% } else if( _.size( elements ) === 0 ){ %>',\n _l( 'No datasets were selected' ), '.',\n '<% } else if( _.size( elements ) === 1 ){ %>',\n _l( 'Only one dataset was selected' ), ': <%- elements[0].name %>',\n '<% } else if( _.size( elements ) > 2 ){ %>',\n _l( 'Too many datasets were selected' ),\n ': <%- _.pluck( elements, \"name\" ).join( \", \") %>',\n '<% } %>',\n '
                                            ',\n _l( 'Two (and only two) elements are needed for the pair' ), '. ',\n _l( 'You may need to ' ),\n '', _l( 'cancel' ), ' ',\n _l( 'and reselect new elements' ), '.',\n '
                                            ',\n '
                                            ',\n '
                                            ',\n '
                                            ',\n '
                                            ',\n '
                                            ',\n '',\n // _l( 'Create a different kind of collection' ),\n '
                                            ',\n '
                                            ',\n '
                                            '\n ].join('')),\n }),\n\n // ------------------------------------------------------------------------ misc\n /** string rep */\n toString : function(){ return 'PairCollectionCreator'; }\n});\n\n\n//==============================================================================\n/** List collection flavor of collectionCreatorModal. */\nvar pairCollectionCreatorModal = function _pairCollectionCreatorModal( elements, options ){\n options = options || {};\n options.title = _l( 'Create a collection from a pair of datasets' );\n return LIST_CREATOR.collectionCreatorModal( elements, options, PairCollectionCreator );\n};\n\n\n//==============================================================================\n/** Use a modal to create a pair collection, then add it to the given history contents.\n * @returns {Deferred} resolved when the collection is added to the history.\n */\nfunction createPairCollection( contents, defaultHideSourceItems ){\n var elements = contents.toJSON(),\n promise = pairCollectionCreatorModal( elements, {\n defaultHideSourceItems: defaultHideSourceItems,\n creationFn : function( elements, name, hideSourceItems ){\n elements = [\n { name: \"forward\", src: \"hda\", id: elements[0].id },\n { name: \"reverse\", src: \"hda\", id: elements[1].id }\n ];\n return contents.createHDCA( elements, 'paired', name, hideSourceItems );\n }\n });\n return promise;\n}\n\n//==============================================================================\n return {\n PairCollectionCreator : PairCollectionCreator,\n pairCollectionCreatorModal : pairCollectionCreatorModal,\n createPairCollection : createPairCollection,\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/pair-collection-creator.js","\ndefine( [ 'utils/utils', 'mvc/ui/ui-tabs', 'mvc/ui/ui-misc', 'mvc/form/form-view' ], function( Utils, Tabs, Ui, Form ) {\n\n /** Dataset edit attributes view */\n var View = Backbone.View.extend({\n initialize: function() {\n this.setElement( '
                                            ' );\n this.model = new Backbone.Model( { 'dataset_id': Galaxy.params.dataset_id } );\n this.render();\n },\n\n // Fetch data for the selected dataset and \n // build tabs for editing its attributes\n render: function() {\n var url = Galaxy.root + 'dataset/edit',\n self = this;\n Utils.get({\n url : url,\n data : { 'dataset_id' : self.model.get( 'dataset_id' ) },\n success : function( response ) {\n self.render_attribute_page( self, response );\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while loading the dataset.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n\n /** Render all the tabs view */\n render_attribute_page: function( self, response ) {\n var message = {\n 'message' : response.message,\n 'status' : response.status,\n 'persistent' : true,\n 'cls' : response.status + 'message'\n };\n self.$el.empty().append( self._templateHeader() );\n self.display_message( message, self.$( '.response-message' ) );\n // Create all tabs\n self.create_tabs( response, self.$( '.edit-attr' ) );\n },\n\n /** Perform AJAX post call */\n call_ajax: function( self, data, tab_name ) {\n var post_url = Galaxy.root + 'dataset/edit';\n $.ajax({\n type: \"PUT\",\n url: post_url,\n data: data,\n success: function( response ) {\n self.render_attribute_page( self, response );\n self.reload_history();\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n\n /** Display actions messages */\n display_message: function( response, $el ) {\n $el.empty().html( new Ui.Message( response ).$el );\n },\n\n /** Create tabs for different attributes of dataset*/\n create_tabs: function( response, $el_edit_attr ) {\n var self = this;\n self.tabs = new Tabs.View();\n self.tabs.add({\n id : 'attributes',\n title : 'Attributes',\n icon : 'fa fa-bars',\n tooltip : 'Edit dataset attributes',\n $el : self._getAttributesFormTemplate( response )\n });\n\n self.tabs.add({\n id : 'convert',\n title : 'Convert',\n icon : 'fa-gear',\n tooltip : 'Convert to new format',\n $el : self._getConvertFormTemplate( response )\n });\n\n self.tabs.add({\n id : 'datatype',\n title : 'Datatypes',\n icon : 'fa-database',\n tooltip : 'Change data type',\n $el : self._getChangeDataTypeFormTemplate( response )\n });\n\n self.tabs.add({\n id : 'permissions',\n title : 'Permissions',\n icon : 'fa-user',\n tooltip : 'Permissions',\n $el : self._getPermissionsFormTemplate( response )\n });\n $el_edit_attr.append( self.tabs.$el );\n self.tabs.showTab( 'attributes' );\n },\n\n /** Main template */\n _templateHeader: function() {\n return '
                                            ' +\n '
                                            ' +\n '

                                            Edit Dataset Attributes

                                            ' +\n '
                                            ';\n },\n\n /** Attributes tab template */\n _getAttributesFormTemplate: function( response ) {\n var self = this;\n var form = new Form({\n title : 'Edit attributes',\n inputs : response.edit_attributes_inputs,\n operations: {\n 'submit_editattr' : new Ui.ButtonIcon({\n tooltip : 'Save attributes of the dataset.',\n icon : 'fa-floppy-o ',\n title : 'Save attributes',\n onclick : function() { self._submit( self, form, response, \"edit_attributes\" ) }\n }),\n 'submit_autocorrect' : new Ui.ButtonIcon({\n tooltip : 'This will inspect the dataset and attempt to correct the values of fields if they are not accurate.',\n icon : 'fa-undo ',\n title : 'Auto-detect',\n onclick : function() { self._submit( self, form, response, \"auto-detect\" ) }\n })\n }\n });\n return form.$el;\n },\n\n /** Convert tab template */\n _getConvertFormTemplate: function( response ) {\n var self = this;\n var form = new Form({\n title : 'Convert to new format',\n inputs : response.convert_inputs,\n operations: {\n 'submit' : new Ui.ButtonIcon({\n tooltip : 'Convert the datatype to a new format.',\n title : 'Convert datatype',\n icon : 'fa-exchange ',\n onclick : function() { self._submit( self, form, response, \"convert\" ) }\n })\n }\n });\n return form.$el;\n },\n\n /** Change datatype template */\n _getChangeDataTypeFormTemplate: function( response ) {\n var self = this;\n var form = new Form({\n title : 'Change datatype',\n inputs : response.convert_datatype_inputs,\n operations: {\n 'submit' : new Ui.ButtonIcon({\n tooltip : 'Change the datatype to a new type.',\n title : 'Change datatype',\n icon : 'fa-exchange ',\n onclick : function() { self._submit( self, form, response, \"change\" ) }\n })\n }\n });\n return form.$el;\n },\n\n /** Permissions template */\n _getPermissionsFormTemplate: function( response ) {\n var template = \"\",\n self = this;\n if( response.can_manage_dataset ) {\n var form = new Form({\n title : 'Manage dataset permissions on ' + response.display_name,\n inputs : response.permission_inputs,\n operations: {\n 'submit': new Ui.ButtonIcon({\n tooltip : 'Save permissions.',\n title : 'Save permissions',\n icon : 'fa-floppy-o ',\n onclick : function() { self._submit( self, form, response, \"permissions\" ) }\n })\n }\n });\n return form.$el;\n }\n else {\n var form = new Form({\n title : 'View permissions',\n inputs : response.permission_inputs\n });\n return form.$el;\n }\n },\n\n /** Submit action */\n _submit: function( self, form, response, type ) {\n var form_data = form.data.create();\n form_data.dataset_id = response.dataset_id;\n switch( type ) {\n case \"edit_attributes\":\n form_data.save = 'Save';\n break;\n\n case \"auto-detect\":\n form_data.detect = 'Auto-detect';\n break;\n \n case \"convert\":\n if ( form_data.target_type !== null && form_data.target_type ) {\n form_data.dataset_id = response.dataset_id;\n form_data.convert_data = 'Convert';\n }\n break;\n\n case \"change\":\n form_data.change = 'Save';\n break;\n\n case \"permissions\":\n var post_data = {};\n post_data.permissions = JSON.stringify( form_data );\n post_data.update_roles_button = \"Save\";\n post_data.dataset_id = response.dataset_id;\n form_data = post_data;\n break; \n }\n self.call_ajax( self, form_data );\n },\n\n /** Reload Galaxy's history after updating dataset's attributes */\n reload_history: function() {\n if ( window.Galaxy ) {\n window.Galaxy.currHistoryPanel.loadCurrentHistory();\n }\n }\n });\n\n return {\n View : View\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-edit-attributes.js","define( [ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/form/form-view' ], function( Utils, Ui, Form ) {\n\n /** Dataset edit attributes view */\n var View = Backbone.View.extend({\n initialize: function() {\n this.setElement( '
                                            ' );\n this.model = new Backbone.Model( { 'dataset_id': Galaxy.params.dataset_id } );\n this.render();\n },\n\n // Fetch data for the selected dataset and\n render: function() {\n var data_url = Galaxy.root + 'api/datasets/' + this.model.get( 'dataset_id' ),\n self = this;\n\n Utils.get({\n url : data_url,\n success : function( dataset ) {\n var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n Utils.get({\n url : job_url,\n success : function( job ) {\n var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n self.render_error_page( self, dataset, job );\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while loading the job.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while loading the dataset.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n\n /** Render the view */\n render_error_page: function( self, dataset, job ) {\n self.$el.empty().append( self._templateHeader() );\n self.$el.append('

                                            Dataset Error

                                            ');\n self.$el.append('

                                            An error occured while running the tool ' + job.tool_id + '.

                                            ');\n self.$el.append('

                                            Tool execution generated the following messages:

                                            ');\n self.$el.append('
                                            ' + job.stderr + '
                                            ');\n self.$el.append('

                                            Report This Error

                                          1. ');\n self.$el.append('

                                            Usually the local Galaxy administrators regularly review errors that occur on the server. However, if you would like to provide additional information (such as what you were trying to do when the error occurred) and a contact e-mail address, we will be better able to investigate your problem and get back to you.

                                            ');\n self.$el.append(self._getBugFormTemplate(dataset, job));\n },\n\n /** Display actions messages */\n display_message: function( response, $el, doNotClear, safe ) {\n if(!safe){\n if(doNotClear) {\n $el.append( new Ui.Message( response ).$el );\n } else {\n $el.empty().html( new Ui.Message( response ).$el );\n }\n } else {\n if(doNotClear) {\n $el.append( new Ui.UnescapedMessage( response ).$el );\n } else {\n $el.empty().html( new Ui.UnescapedMessage( response ).$el );\n }\n }\n },\n\n /** Main template */\n _templateHeader: function() {\n return '
                                            ' +\n '
                                            ' +\n '
                                            ';\n },\n\n /** Convert tab template */\n _getBugFormTemplate: function(dataset, job) {\n var self = this;\n var inputs = [\n {\n \"help\": \"Your email address\",\n \"options\": [],\n \"type\": \"text\",\n \"name\": \"email\",\n \"label\": \"Your email\",\n \"value\": Galaxy.user.get('email')\n },\n {\n \"help\": \"Any additional comments you can provide regarding what you were doing at the time of the bug.\",\n \"options\": [],\n \"type\": \"text\",\n \"area\": true,\n \"name\": \"message\",\n \"label\": \"Message\"\n }\n ];\n\n // TODO\n if(false && response.any_public){\n inputs.push({\n \"name\": \"public_consent\",\n \"label\": \"Public Disclosure Consent\",\n \"help\": \"This Galaxy is configured to report to one or more error reporting backends that public to the world. By selecting 'yes', you acknowledge that this bug report will be made public.\",\n \"value\": String( Boolean( false ) ),\n \"options\": [],\n \"type\": \"boolean\",\n })\n }\n\n var form = new Form({\n title : 'Error Report',\n inputs : inputs,\n buttons : {\n save : new Ui.Button({\n icon : 'fa-bug',\n title : 'Report',\n cls : 'ui-button btn btn-primary',\n floating : 'clear',\n onclick : function() {\n var form_data = form.data.create();\n var url = Galaxy.root + 'api/jobs/' + job.id + '/error'\n form_data.dataset_id = dataset.id;\n self.submit(form_data, url)\n }\n })\n },\n });\n return form.$el;\n },\n\n /** Make ajax request */\n submit : function(form_data, url){\n var self = this;\n // Some required metadata\n $.ajax({\n type: \"POST\",\n url: url,\n data: form_data,\n success: function( response ) {\n // Clear out the div\n self.$el.empty().append( self._templateHeader() );\n // And display the messages.\n response.messages.forEach(function(message){\n self.display_message( {\n 'status': message[1],\n 'message': message[0],\n 'persistent': true,\n }, self.$( '.response-message' ), true, true );\n });\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n }\n });\n\n return {\n View : View\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-error.js","/** This class renders the grid list with shared section. */\ndefine( [ 'mvc/grid/grid-view' ], function( GridView ) {\n var View = Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.setElement( $( '
                                            ' ) );\n this.model = new Backbone.Model( options );\n this.item = this.model.get( 'item' );\n $.ajax({\n url : Galaxy.root + this.item + '/' + this.model.get( 'action_id' ),\n success : function( response ) {\n response[ 'dict_format' ] = true;\n self.model.set( response );\n self.render();\n }\n });\n },\n\n render: function() {\n var grid = new GridView( this.model.attributes );\n this.$el.empty().append( grid.$el );\n this.$el.append( this._templateShared() );\n },\n\n _templateShared: function() {\n var self = this;\n var $tmpl = $( '
                                            ' +\n '

                                            ' + this.model.get( 'plural' ) + ' shared with you by others

                                            ' +\n '
                                            ' );\n var options = this.model.attributes;\n if ( options.shared_by_others && options.shared_by_others.length > 0 ) {\n var $table = $( '' +\n '' +\n '' +\n '' +\n '' +\n '
                                            TitleOwner
                                            ' );\n _.each( options.shared_by_others, function( it, index ) {\n var display_url = Galaxy.root + self.item + '/display_by_username_and_slug?username=' + it.username + '&slug=' + it.slug;\n $table.append( '
                                            ' +\n '' + _.escape( it.title ) + '' +\n '' + _.escape( it.username ) + '
                                            ' +\n '
                                            ' +\n '
                                            ' +\n '
                                            ' +\n '
                                            ' +\n '
                                            You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.
                                            ' +\n '', '
                                            ', '
                                            '].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t CitationView: CitationView,\n\t CitationListView: CitationListView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 58 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(67), __webpack_require__(61), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_ITEM, DATASET_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t //==============================================================================\n\t\n\t var FoldoutListItemView = LIST_ITEM.FoldoutListItemView,\n\t ListItemView = LIST_ITEM.ListItemView;\n\t /** @class Read only view for DatasetCollection.\n\t */\n\t var DCListItemView = FoldoutListItemView.extend(\n\t /** @lends DCListItemView.prototype */{\n\t\n\t className: FoldoutListItemView.prototype.className + \" dataset-collection\",\n\t id: function () {\n\t return ['dataset_collection', this.model.get('id')].join('-');\n\t },\n\t\n\t /** override to add linkTarget */\n\t initialize: function (attributes) {\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t this.hasUser = attributes.hasUser;\n\t FoldoutListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t FoldoutListItemView.prototype._setUpListeners.call(this);\n\t this.listenTo(this.model, 'change', function (model, options) {\n\t // if the model has changed deletion status render it entirely\n\t if (_.has(model.changed, 'deleted')) {\n\t this.render();\n\t\n\t // if the model has been decorated after the fact with the element count,\n\t // render the subtitle where the count is displayed\n\t } else if (_.has(model.changed, 'element_count')) {\n\t this.$('> .title-bar .subtitle').replaceWith(this._renderSubtitle());\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... rendering\n\t /** render a subtitle to show the user what sort of collection this is */\n\t _renderSubtitle: function () {\n\t return $(this.templates.subtitle(this.model.toJSON(), this));\n\t },\n\t\n\t // ......................................................................... foldout\n\t /** override to add linktarget to sub-panel */\n\t _getFoldoutPanelOptions: function () {\n\t var options = FoldoutListItemView.prototype._getFoldoutPanelOptions.call(this);\n\t return _.extend(options, {\n\t linkTarget: this.linkTarget,\n\t hasUser: this.hasUser\n\t });\n\t },\n\t\n\t /** override to not catch sub-panel selectors */\n\t $selector: function () {\n\t return this.$('> .selector');\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DCListItemView.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, FoldoutListItemView.prototype.templates.warnings, {\n\t error: BASE_MVC.wrapTemplate([\n\t // error during index fetch - show error on dataset\n\t '<% if( model.error ){ %>', '
                                            ', _l('There was an error getting the data for this collection'), ': <%- model.error %>', '
                                            ', '<% } %>']),\n\t purged: BASE_MVC.wrapTemplate(['<% if( model.purged ){ %>', '
                                            ', _l('This collection has been deleted and removed from disk'), '
                                            ', '<% } %>']),\n\t deleted: BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>', '
                                            ', _l('This collection has been deleted'), '
                                            ', '<% } %>'])\n\t });\n\t\n\t // use element identifier\n\t var titleBarTemplate = BASE_MVC.wrapTemplate(['
                                            ', '
                                            ', '<%- collection.element_identifier || collection.name %>', '
                                            ', '
                                            ', '
                                            '], 'collection');\n\t\n\t // use element identifier\n\t var subtitleTemplate = BASE_MVC.wrapTemplate(['
                                            ', '<% var countText = collection.element_count? ( collection.element_count + \" \" ) : \"\"; %>', '<% if( collection.collection_type === \"list\" ){ %>', _l('a list of <%- countText %>datasets'), '<% } else if( collection.collection_type === \"paired\" ){ %>', _l('a pair of datasets'), '<% } else if( collection.collection_type === \"list:paired\" ){ %>', _l('a list of <%- countText %>dataset pairs'), '<% } else if( collection.collection_type === \"list:list\" ){ %>', _l('a list of <%- countText %>dataset lists'), '<% } %>', '
                                            '], 'collection');\n\t\n\t return _.extend({}, FoldoutListItemView.prototype.templates, {\n\t warnings: warnings,\n\t titleBar: titleBarTemplate,\n\t subtitle: subtitleTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for DatasetCollectionElement.\n\t */\n\t var DCEListItemView = ListItemView.extend(\n\t /** @lends DCEListItemView.prototype */{\n\t\n\t /** add the DCE class to the list item */\n\t className: ListItemView.prototype.className + \" dataset-collection-element\",\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t if (attributes.logger) {\n\t this.logger = this.model.logger = attributes.logger;\n\t }\n\t this.log('DCEListItemView.initialize:', attributes);\n\t ListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCEListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DCEListItemView.prototype.templates = function () {\n\t\n\t // use the element identifier here - since that will persist and the user will need it\n\t var titleBarTemplate = BASE_MVC.wrapTemplate(['
                                            ', '
                                            ', '<%- element.element_identifier %>', '
                                            ', '
                                            ', '
                                            '], 'element');\n\t\n\t return _.extend({}, ListItemView.prototype.templates, {\n\t titleBar: titleBarTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for a DatasetCollectionElement that is also an DatasetAssociation\n\t * (a dataset contained in a dataset collection).\n\t */\n\t var DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend(\n\t /** @lends DatasetDCEListItemView.prototype */{\n\t\n\t className: DATASET_LI.DatasetListItemView.prototype.className + \" dataset-collection-element\",\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t if (attributes.logger) {\n\t this.logger = this.model.logger = attributes.logger;\n\t }\n\t this.log('DatasetDCEListItemView.initialize:', attributes);\n\t DATASET_LI.DatasetListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t /** In this override, only get details if in the ready state.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DatasetDCEListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetDCEListItemView.prototype.templates = function () {\n\t\n\t // use the element identifier here and not the dataset name\n\t //TODO:?? can we steal the DCE titlebar?\n\t var titleBarTemplate = BASE_MVC.wrapTemplate(['
                                            ', '', '
                                            ', '<%- element.element_identifier %>', '
                                            ', '
                                            '], 'element');\n\t\n\t return _.extend({}, DATASET_LI.DatasetListItemView.prototype.templates, {\n\t titleBar: titleBarTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\t var NestedDCDCEListItemView = DCListItemView.extend(\n\t /** @lends NestedDCDCEListItemView.prototype */{\n\t\n\t className: DCListItemView.prototype.className + \" dataset-collection-element\",\n\t\n\t /** In this override, add the state as a class for use with state-based CSS */\n\t _swapNewRender: function ($newRender) {\n\t DCListItemView.prototype._swapNewRender.call(this, $newRender);\n\t var state = this.model.get('state') || 'ok';\n\t this.$el.addClass('state-' + state);\n\t return this.$el;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'NestedDCDCEListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t DCListItemView: DCListItemView,\n\t DCEListItemView: DCEListItemView,\n\t DatasetDCEListItemView: DatasetDCEListItemView,\n\t NestedDCDCEListItemView: NestedDCDCEListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 59 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, Backbone, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(85), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET_MODEL, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /*\n\t Notes:\n\t \n\t Terminology:\n\t DatasetCollection/DC : a container of datasets or nested DatasetCollections\n\t Element/DatasetCollectionElement/DCE : an item contained in a DatasetCollection\n\t HistoryDatasetCollectionAssociation/HDCA: a DatasetCollection contained in a history\n\t \n\t \n\t This all seems too complex unfortunately:\n\t \n\t - Terminology collision between DatasetCollections (DCs) and Backbone Collections.\n\t - In the DatasetCollections API JSON, DC Elements use a 'Has A' stucture to *contain*\n\t either a dataset or a nested DC. This would make the hierarchy much taller. I've\n\t decided to merge the contained JSON with the DC element json - making the 'has a'\n\t relation into an 'is a' relation. This seems simpler to me and allowed a lot of\n\t DRY in both models and views, but may make tracking or tracing within these models\n\t more difficult (since DatasetCollectionElements are now *also* DatasetAssociations\n\t or DatasetCollections (nested)). This also violates the rule of thumb about\n\t favoring aggregation over inheritance.\n\t - Currently, there are three DatasetCollection subclasses: List, Pair, and ListPaired.\n\t These each should a) be usable on their own, b) be usable in the context of\n\t nesting within a collection model (at least in the case of ListPaired), and\n\t c) be usable within the context of other container models (like History or\n\t LibraryFolder, etc.). I've tried to separate/extract classes in order to\n\t handle those three situations, but it's proven difficult to do in a simple,\n\t readable manner.\n\t - Ideally, histories and libraries would inherit from the same server models as\n\t dataset collections do since they are (in essence) dataset collections themselves -\n\t making the whole nested structure simpler. This would be a large, error-prone\n\t refactoring and migration.\n\t \n\t Many of the classes and heirarchy are meant as extension points so, while the\n\t relations and flow may be difficult to understand initially, they'll allow us to\n\t handle the growth or flux dataset collection in the future (w/o actually implementing\n\t any YAGNI).\n\t \n\t */\n\t //_________________________________________________________________________________________________ ELEMENTS\n\t /** @class mixin for Dataset collection elements.\n\t * When collection elements are passed from the API, the underlying element is\n\t * in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).\n\t * This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues\n\t * effectively changing a DCE from a container to a subclass (has a --> is a).\n\t */\n\t\n\t var DatasetCollectionElementMixin = {\n\t\n\t /** default attributes used by elements in a dataset collection */\n\t defaults: {\n\t model_class: 'DatasetCollectionElement',\n\t element_identifier: null,\n\t element_index: null,\n\t element_type: null\n\t },\n\t\n\t /** merge the attributes of the sub-object 'object' into this model */\n\t _mergeObject: function (attributes) {\n\t // if we don't preserve and correct ids here, the element id becomes the object id\n\t // and collision in backbone's _byId will occur and only\n\t _.extend(attributes, attributes.object, { element_id: attributes.id });\n\t delete attributes.object;\n\t return attributes;\n\t },\n\t\n\t /** override to merge this.object into this */\n\t constructor: function (attributes, options) {\n\t // console.debug( '\\t DatasetCollectionElement.constructor:', attributes, options );\n\t attributes = this._mergeObject(attributes);\n\t this.idAttribute = 'element_id';\n\t Backbone.Model.apply(this, arguments);\n\t },\n\t\n\t /** when the model is fetched, merge this.object into this */\n\t parse: function (response, options) {\n\t var attributes = response;\n\t attributes = this._mergeObject(attributes);\n\t return attributes;\n\t }\n\t };\n\t\n\t /** @class Concrete class of Generic DatasetCollectionElement */\n\t var DatasetCollectionElement = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(DatasetCollectionElementMixin).extend({ _logNamespace: 'collections' });\n\t\n\t //==============================================================================\n\t /** @class Base/Abstract Backbone collection for Generic DCEs. */\n\t var DCECollection = Backbone.Collection.extend(BASE_MVC.LoggableMixin).extend(\n\t /** @lends DCECollection.prototype */{\n\t _logNamespace: 'collections',\n\t\n\t model: DatasetCollectionElement,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['DatasetCollectionElementCollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for a dataset collection element that is a dataset (HDA).\n\t */\n\t var DatasetDCE = DATASET_MODEL.DatasetAssociation.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends DatasetDCE.prototype */{\n\t\n\t /** url fn */\n\t url: function () {\n\t // won't always be an hda\n\t if (!this.has('history_id')) {\n\t console.warn('no endpoint for non-hdas within a collection yet');\n\t // (a little silly since this api endpoint *also* points at hdas)\n\t return Galaxy.root + 'api/datasets';\n\t }\n\t return Galaxy.root + 'api/histories/' + this.get('history_id') + '/contents/' + this.get('id');\n\t },\n\t\n\t defaults: _.extend({}, DATASET_MODEL.DatasetAssociation.prototype.defaults, DatasetCollectionElementMixin.defaults),\n\t\n\t _downloadQueryParameters: function () {\n\t return '?to_ext=' + this.get('file_ext') + '&hdca_id=' + this.get('parent_hdca_id') + '&element_identifier=' + this.get('element_identifier');\n\t },\n\t\n\t // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n\t // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n\t // - re-apply manually for now\n\t /** call the mixin constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t DatasetDCE.constructor:', attributes, options);\n\t //DATASET_MODEL.DatasetAssociation.prototype.constructor.call( this, attributes, options );\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** Does this model already contain detailed data (as opposed to just summary level data)? */\n\t hasDetails: function () {\n\t return this.elements && this.elements.length;\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.get('element_identifier');\n\t return ['DatasetDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n\t */\n\t var DatasetDCECollection = DCECollection.extend(\n\t /** @lends DatasetDCECollection.prototype */{\n\t model: DatasetDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['DatasetDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //_________________________________________________________________________________________________ COLLECTIONS\n\t /** @class Backbone model for Dataset Collections.\n\t * The DC API returns an array of JSON objects under the attribute elements.\n\t * This model:\n\t * - removes that array/attribute ('elements') from the model,\n\t * - creates a bbone collection (of the class defined in the 'collectionClass' attribute),\n\t * - passes that json onto the bbone collection\n\t * - caches the bbone collection in this.elements\n\t */\n\t var DatasetCollection = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(BASE_MVC.SearchableModelMixin).extend( /** @lends DatasetCollection.prototype */{\n\t _logNamespace: 'collections',\n\t\n\t /** default attributes for a model */\n\t defaults: {\n\t /* 'list', 'paired', or 'list:paired' */\n\t collection_type: null,\n\t //??\n\t deleted: false\n\t },\n\t\n\t /** Which class to use for elements */\n\t collectionClass: DCECollection,\n\t\n\t /** set up: create elements instance var and (on changes to elements) update them */\n\t initialize: function (model, options) {\n\t this.debug(this + '(DatasetCollection).initialize:', model, options, this);\n\t this.elements = this._createElementsModel();\n\t this.on('change:elements', function () {\n\t this.log('change:elements');\n\t //TODO: prob. better to update the collection instead of re-creating it\n\t this.elements = this._createElementsModel();\n\t });\n\t },\n\t\n\t /** move elements model attribute to full collection */\n\t _createElementsModel: function () {\n\t this.debug(this + '._createElementsModel', this.collectionClass, this.get('elements'), this.elements);\n\t //TODO: same patterns as DatasetCollectionElement _createObjectModel - refactor to BASE_MVC.hasSubModel?\n\t var elements = this.get('elements') || [];\n\t this.unset('elements', { silent: true });\n\t var self = this;\n\t _.each(elements, function (element, index) {\n\t _.extend(element, { \"parent_hdca_id\": self.get(\"id\") });\n\t });\n\t this.elements = new this.collectionClass(elements);\n\t //this.debug( 'collectionClass:', this.collectionClass + '', this.elements );\n\t return this.elements;\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** pass the elements back within the model json when this is serialized */\n\t toJSON: function () {\n\t var json = Backbone.Model.prototype.toJSON.call(this);\n\t if (this.elements) {\n\t json.elements = this.elements.toJSON();\n\t }\n\t return json;\n\t },\n\t\n\t /** Is this collection in a 'ready' state no processing (for the collection) is left\n\t * to do on the server.\n\t */\n\t inReadyState: function () {\n\t var populated = this.get('populated');\n\t return this.isDeletedOrPurged() || populated;\n\t },\n\t\n\t //TODO:?? the following are the same interface as DatasetAssociation - can we combine?\n\t /** Does the DC contain any elements yet? Is a fetch() required? */\n\t hasDetails: function () {\n\t return this.elements.length !== 0;\n\t },\n\t\n\t /** Given the filters, what models in this.elements would be returned? */\n\t getVisibleContents: function (filters) {\n\t // filters unused for now\n\t return this.elements;\n\t },\n\t\n\t // ........................................................................ ajax\n\t /** override to use actual Dates objects for create/update times */\n\t parse: function (response, options) {\n\t var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n\t if (parsed.create_time) {\n\t parsed.create_time = new Date(parsed.create_time);\n\t }\n\t if (parsed.update_time) {\n\t parsed.update_time = new Date(parsed.update_time);\n\t }\n\t return parsed;\n\t },\n\t\n\t /** save this dataset, _Mark_ing it as deleted (just a flag) */\n\t 'delete': function (options) {\n\t if (this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true }, options);\n\t },\n\t /** save this dataset, _Mark_ing it as undeleted */\n\t undelete: function (options) {\n\t if (!this.get('deleted') || this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: false }, options);\n\t },\n\t\n\t /** Is this collection deleted or purged? */\n\t isDeletedOrPurged: function () {\n\t return this.get('deleted') || this.get('purged');\n\t },\n\t\n\t // ........................................................................ searchable\n\t /** searchable attributes for collections */\n\t searchAttributes: ['name', 'tags'],\n\t\n\t // ........................................................................ misc\n\t /** String representation */\n\t toString: function () {\n\t var idAndName = [this.get('id'), this.get('name') || this.get('element_identifier')];\n\t return 'DatasetCollection(' + idAndName.join(',') + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** Model for a DatasetCollection containing datasets (non-nested).\n\t */\n\t var ListDatasetCollection = DatasetCollection.extend(\n\t /** @lends ListDatasetCollection.prototype */{\n\t\n\t /** override since we know the collection will only contain datasets */\n\t collectionClass: DatasetDCECollection,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'List' + DatasetCollection.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** Model for a DatasetCollection containing fwd/rev datasets (a list of 2).\n\t */\n\t var PairDatasetCollection = ListDatasetCollection.extend(\n\t /** @lends PairDatasetCollection.prototype */{\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'Pair' + DatasetCollection.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //_________________________________________________________________________________________________ NESTED COLLECTIONS\n\t // this is where things get weird, man. Weird.\n\t //TODO: it might be possible to compact all the following...I think.\n\t //==============================================================================\n\t /** @class Backbone model for a Generic DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested collection). Currently only list:paired.\n\t */\n\t var NestedDCDCE = DatasetCollection.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends NestedDCDCE.prototype */{\n\t\n\t // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n\t // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n\t // - re-apply manually it now\n\t /** call the mixin constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t NestedDCDCE.constructor:', attributes, options);\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.object ? '' + this.object : this.get('element_identifier');\n\t return ['NestedDCDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n\t */\n\t var NestedDCDCECollection = DCECollection.extend(\n\t /** @lends NestedDCDCECollection.prototype */{\n\t\n\t /** This is a collection of nested collections */\n\t model: NestedDCDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['NestedDCDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n\t */\n\t var NestedPairDCDCE = PairDatasetCollection.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends NestedPairDCDCE.prototype */{\n\t //TODO:?? possibly rename to NestedDatasetCollection?\n\t\n\t // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n\t // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n\t // - re-apply manually it now\n\t /** This is both a collection and a collection element - call the constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t NestedPairDCDCE.constructor:', attributes, options);\n\t //DatasetCollection.constructor.call( this, attributes, options );\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.object ? '' + this.object : this.get('element_identifier');\n\t return ['NestedPairDCDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection for a backbone collection containing paired dataset collections.\n\t */\n\t var NestedPairDCDCECollection = NestedDCDCECollection.extend(\n\t /** @lends PairDCDCECollection.prototype */{\n\t\n\t /** We know this collection is composed of only nested pair collections */\n\t model: NestedPairDCDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['NestedPairDCDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n\t */\n\t var ListPairedDatasetCollection = DatasetCollection.extend(\n\t /** @lends ListPairedDatasetCollection.prototype */{\n\t\n\t /** list:paired is the only collection that itself contains collections */\n\t collectionClass: NestedPairDCDCECollection,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['ListPairedDatasetCollection(', this.get('name'), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for a list dataset collection within a list:list dataset collection. */\n\t var NestedListDCDCE = ListDatasetCollection.extend(BASE_MVC.mixin(DatasetCollectionElementMixin,\n\t /** @lends NestedListDCDCE.prototype */{\n\t\n\t /** This is both a collection and a collection element - call the constructor */\n\t constructor: function (attributes, options) {\n\t this.debug('\\t NestedListDCDCE.constructor:', attributes, options);\n\t DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t var objStr = this.object ? '' + this.object : this.get('element_identifier');\n\t return ['NestedListDCDCE(', objStr, ')'].join('');\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection containing list dataset collections. */\n\t var NestedListDCDCECollection = NestedDCDCECollection.extend({\n\t\n\t /** We know this collection is composed of only nested pair collections */\n\t model: NestedListDCDCE,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['NestedListDCDCECollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\n\t var ListOfListsDatasetCollection = DatasetCollection.extend({\n\t\n\t /** list:paired is the only collection that itself contains collections */\n\t collectionClass: NestedListDCDCECollection,\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['ListOfListsDatasetCollection(', this.get('name'), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t ListDatasetCollection: ListDatasetCollection,\n\t PairDatasetCollection: PairDatasetCollection,\n\t ListPairedDatasetCollection: ListPairedDatasetCollection,\n\t ListOfListsDatasetCollection: ListOfListsDatasetCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 60 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, $, jQuery) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(63), __webpack_require__(17), __webpack_require__(7), __webpack_require__(82), __webpack_require__(8), __webpack_require__(100), __webpack_require__(6), __webpack_require__(97)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HDCA, STATES, BASE_MVC, baseCreator, UI_MODAL, naturalSort, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t\n\t /*==============================================================================\n\t TODO:\n\t use proper Element model and not just json\n\t straighten out createFn, collection.createHDCA\n\t possibly stop using modals for this\n\t It would be neat to do a drag and drop\n\t \n\t ==============================================================================*/\n\t /** A view for both DatasetDCEs and NestedDCDCEs\n\t * (things that implement collection-model:DatasetCollectionElementMixin)\n\t */\n\t var DatasetCollectionElementView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t //TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n\t tagName: 'li',\n\t className: 'collection-element',\n\t\n\t initialize: function (attributes) {\n\t this.element = attributes.element || {};\n\t this.selected = attributes.selected || false;\n\t },\n\t\n\t render: function () {\n\t this.$el.attr('data-element-id', this.element.id).attr('draggable', true).html(this.template({ element: this.element }));\n\t if (this.selected) {\n\t this.$el.addClass('selected');\n\t }\n\t return this;\n\t },\n\t\n\t //TODO: lots of unused space in the element - possibly load details and display them horiz.\n\t template: _.template(['', '<%- element.name %>', '', ''].join('')),\n\t\n\t /** select this element and pub */\n\t select: function (toggle) {\n\t this.$el.toggleClass('selected', toggle);\n\t this.trigger('select', {\n\t source: this,\n\t selected: this.$el.hasClass('selected')\n\t });\n\t },\n\t\n\t /** animate the removal of this element and pub */\n\t discard: function () {\n\t var view = this,\n\t parentWidth = this.$el.parent().width();\n\t this.$el.animate({ 'margin-right': parentWidth }, 'fast', function () {\n\t view.trigger('discard', {\n\t source: view\n\t });\n\t view.destroy();\n\t });\n\t },\n\t\n\t /** remove the DOM and any listeners */\n\t destroy: function () {\n\t this.off();\n\t this.$el.remove();\n\t },\n\t\n\t events: {\n\t 'click': '_click',\n\t 'click .name': '_clickName',\n\t 'click .discard': '_clickDiscard',\n\t\n\t 'dragstart': '_dragstart',\n\t 'dragend': '_dragend',\n\t 'dragover': '_sendToParent',\n\t 'drop': '_sendToParent'\n\t },\n\t\n\t /** select when the li is clicked */\n\t _click: function (ev) {\n\t ev.stopPropagation();\n\t this.select(ev);\n\t },\n\t\n\t /** rename a pair when the name is clicked */\n\t _clickName: function (ev) {\n\t ev.stopPropagation();\n\t ev.preventDefault();\n\t var promptString = [_l('Enter a new name for the element'), ':\\n(', _l('Note that changing the name here will not rename the dataset'), ')'].join(''),\n\t response = prompt(_l('Enter a new name for the element') + ':', this.element.name);\n\t if (response) {\n\t this.element.name = response;\n\t this.render();\n\t }\n\t //TODO: cancelling with ESC leads to closure of the creator...\n\t },\n\t\n\t /** discard when the discard button is clicked */\n\t _clickDiscard: function (ev) {\n\t ev.stopPropagation();\n\t this.discard();\n\t },\n\t\n\t /** dragging pairs for re-ordering */\n\t _dragstart: function (ev) {\n\t if (ev.originalEvent) {\n\t ev = ev.originalEvent;\n\t }\n\t ev.dataTransfer.effectAllowed = 'move';\n\t ev.dataTransfer.setData('text/plain', JSON.stringify(this.element));\n\t\n\t this.$el.addClass('dragging');\n\t this.$el.parent().trigger('collection-element.dragstart', [this]);\n\t },\n\t\n\t /** dragging for re-ordering */\n\t _dragend: function (ev) {\n\t this.$el.removeClass('dragging');\n\t this.$el.parent().trigger('collection-element.dragend', [this]);\n\t },\n\t\n\t /** manually bubble up an event to the parent/container */\n\t _sendToParent: function (ev) {\n\t this.$el.parent().trigger(ev);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'DatasetCollectionElementView()';\n\t }\n\t });\n\t\n\t // ============================================================================\n\t /** An interface for building collections.\n\t */\n\t var ListCollectionCreator = Backbone.View.extend(BASE_MVC.LoggableMixin).extend(baseCreator.CollectionCreatorMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t /** the class used to display individual elements */\n\t elementViewClass: DatasetCollectionElementView,\n\t /** the class this creator will create and save */\n\t collectionClass: HDCA.HistoryListDatasetCollection,\n\t className: 'list-collection-creator collection-creator flex-row-container',\n\t\n\t /** minimum number of valid elements to start with in order to build a collection of this type */\n\t minElements: 1,\n\t\n\t defaultAttributes: {\n\t //TODO: remove - use new collectionClass().save()\n\t /** takes elements and creates the proper collection - returns a promise */\n\t creationFn: function () {\n\t throw new TypeError('no creation fn for creator');\n\t },\n\t /** fn to call when the collection is created (scoped to this) */\n\t oncreate: function () {},\n\t /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n\t oncancel: function () {},\n\t /** distance from list edge to begin autoscrolling list */\n\t autoscrollDist: 24,\n\t /** Color passed to hoverhighlight */\n\t highlightClr: 'rgba( 64, 255, 255, 1.0 )'\n\t },\n\t\n\t footerSettings: {\n\t '.hide-originals': 'hideOriginals'\n\t },\n\t\n\t /** set up initial options, instance vars, behaviors */\n\t initialize: function (attributes) {\n\t this.metric('ListCollectionCreator.initialize', attributes);\n\t var creator = this;\n\t _.each(this.defaultAttributes, function (value, key) {\n\t value = attributes[key] || value;\n\t creator[key] = value;\n\t });\n\t\n\t /** unordered, original list - cache to allow reversal */\n\t creator.initialElements = attributes.elements || [];\n\t\n\t this._setUpCommonSettings(attributes);\n\t this._instanceSetUp();\n\t this._elementsSetUp();\n\t this._setUpBehaviors();\n\t },\n\t\n\t /** set up instance vars */\n\t _instanceSetUp: function () {\n\t /** Ids of elements that have been selected by the user - to preserve over renders */\n\t this.selectedIds = {};\n\t /** DOM elements currently being dragged */\n\t this.$dragging = null;\n\t /** Used for blocking UI events during ajax/operations (don't post twice) */\n\t this.blocking = false;\n\t },\n\t\n\t // ------------------------------------------------------------------------ process raw list\n\t /** set up main data */\n\t _elementsSetUp: function () {\n\t //this.debug( '-- _dataSetUp' );\n\t /** a list of invalid elements and the reasons they aren't valid */\n\t this.invalidElements = [];\n\t //TODO: handle fundamental problem of syncing DOM, views, and list here\n\t /** data for list in progress */\n\t this.workingElements = [];\n\t /** views for workingElements */\n\t this.elementViews = [];\n\t\n\t // copy initial list, sort, add ids if needed\n\t this.workingElements = this.initialElements.slice(0);\n\t this._ensureElementIds();\n\t this._validateElements();\n\t this._mangleDuplicateNames();\n\t this._sortElements();\n\t },\n\t\n\t /** add ids to dataset objs in initial list if none */\n\t _ensureElementIds: function () {\n\t this.workingElements.forEach(function (element) {\n\t if (!element.hasOwnProperty('id')) {\n\t element.id = _.uniqueId();\n\t }\n\t });\n\t return this.workingElements;\n\t },\n\t\n\t /** separate working list into valid and invalid elements for this collection */\n\t _validateElements: function () {\n\t var creator = this,\n\t existingNames = {};\n\t creator.invalidElements = [];\n\t\n\t this.workingElements = this.workingElements.filter(function (element) {\n\t var problem = creator._isElementInvalid(element);\n\t if (problem) {\n\t creator.invalidElements.push({\n\t element: element,\n\t text: problem\n\t });\n\t }\n\t return !problem;\n\t });\n\t return this.workingElements;\n\t },\n\t\n\t /** describe what is wrong with a particular element if anything */\n\t _isElementInvalid: function (element) {\n\t if (element.history_content_type !== 'dataset') {\n\t return _l(\"is not a dataset\");\n\t }\n\t var validState = element.state === STATES.OK || _.contains(STATES.NOT_READY_STATES, element.state);\n\t if (!validState) {\n\t return _l(\"has errored, is paused, or is not accessible\");\n\t }\n\t if (element.deleted || element.purged) {\n\t return _l(\"has been deleted or purged\");\n\t }\n\t return null;\n\t },\n\t\n\t /** mangle duplicate names using a mac-like '(counter)' addition to any duplicates */\n\t _mangleDuplicateNames: function () {\n\t var SAFETY = 900,\n\t counter = 1,\n\t existingNames = {};\n\t this.workingElements.forEach(function (element) {\n\t var currName = element.name;\n\t while (existingNames.hasOwnProperty(currName)) {\n\t currName = element.name + ' (' + counter + ')';\n\t counter += 1;\n\t if (counter >= SAFETY) {\n\t throw new Error('Safety hit in while loop - thats impressive');\n\t }\n\t }\n\t element.name = currName;\n\t existingNames[element.name] = true;\n\t });\n\t },\n\t\n\t /** sort a list of elements */\n\t _sortElements: function (list) {\n\t // // currently only natural sort by name\n\t // this.workingElements.sort( function( a, b ){ return naturalSort( a.name, b.name ); });\n\t // return this.workingElements;\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering\n\t // templates : ListCollectionCreator.templates,\n\t /** render the entire interface */\n\t render: function (speed, callback) {\n\t //this.debug( '-- _render' );\n\t if (this.workingElements.length < this.minElements) {\n\t return this._renderInvalid(speed, callback);\n\t }\n\t\n\t this.$el.empty().html(this.templates.main());\n\t this._renderHeader(speed);\n\t this._renderMiddle(speed);\n\t this._renderFooter(speed);\n\t this._addPluginComponents();\n\t this.$('.collection-name').focus();\n\t this.trigger('rendered', this);\n\t return this;\n\t },\n\t\n\t /** render a simplified interface aimed at telling the user why they can't move forward */\n\t _renderInvalid: function (speed, callback) {\n\t //this.debug( '-- _render' );\n\t this.$el.empty().html(this.templates.invalidInitial({\n\t problems: this.invalidElements,\n\t elements: this.workingElements\n\t }));\n\t if (typeof this.oncancel === 'function') {\n\t this.$('.cancel-create.btn').show();\n\t }\n\t this.trigger('rendered', this);\n\t return this;\n\t },\n\t\n\t /** render the header section */\n\t _renderHeader: function (speed, callback) {\n\t var $header = this.$('.header').empty().html(this.templates.header()).find('.help-content').prepend($(this.templates.helpContent()));\n\t //TODO: should only show once despite calling _renderHeader again\n\t if (this.invalidElements.length) {\n\t this._invalidElementsAlert();\n\t }\n\t return $header;\n\t },\n\t\n\t /** render the middle including the elements */\n\t _renderMiddle: function (speed, callback) {\n\t var $middle = this.$('.middle').empty().html(this.templates.middle());\n\t this._renderList(speed);\n\t return $middle;\n\t },\n\t\n\t /** add any jQuery/bootstrap/custom plugins to elements rendered */\n\t _addPluginComponents: function () {\n\t this.$('.help-content i').hoverhighlight('.collection-creator', this.highlightClr);\n\t },\n\t\n\t /** build and show an alert describing any elements that could not be included due to problems */\n\t _invalidElementsAlert: function () {\n\t this._showAlert(this.templates.invalidElements({ problems: this.invalidElements }), 'alert-warning');\n\t },\n\t\n\t _disableNameAndCreate: function (disable) {\n\t disable = !_.isUndefined(disable) ? disable : true;\n\t if (disable) {\n\t this.$('.collection-name').prop('disabled', true);\n\t this.$('.create-collection').toggleClass('disabled', true);\n\t // } else {\n\t // this.$( '.collection-name' ).prop( 'disabled', false );\n\t // this.$( '.create-collection' ).removeClass( 'disable' );\n\t }\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering elements\n\t /** conv. to the main list display DOM */\n\t $list: function () {\n\t return this.$('.collection-elements');\n\t },\n\t\n\t /** show or hide the clear selected control based on the num of selected elements */\n\t _renderClearSelected: function () {\n\t if (_.size(this.selectedIds)) {\n\t this.$('.collection-elements-controls > .clear-selected').show();\n\t } else {\n\t this.$('.collection-elements-controls > .clear-selected').hide();\n\t }\n\t },\n\t\n\t /** render the elements in order (or a warning if no elements found) */\n\t _renderList: function (speed, callback) {\n\t //this.debug( '-- _renderList' );\n\t var creator = this,\n\t $tmp = jQuery('
                                            '),\n\t $list = creator.$list();\n\t\n\t _.each(this.elementViews, function (view) {\n\t view.destroy();\n\t creator.removeElementView(view);\n\t });\n\t\n\t // if( !this.workingElements.length ){\n\t // this._renderNoValidElements();\n\t // return;\n\t // }\n\t\n\t creator.workingElements.forEach(function (element) {\n\t var elementView = creator._createElementView(element);\n\t $tmp.append(elementView.$el);\n\t });\n\t\n\t creator._renderClearSelected();\n\t $list.empty().append($tmp.children());\n\t _.invoke(creator.elementViews, 'render');\n\t\n\t if ($list.height() > $list.css('max-height')) {\n\t $list.css('border-width', '1px 0px 1px 0px');\n\t } else {\n\t $list.css('border-width', '0px');\n\t }\n\t },\n\t\n\t /** create an element view, cache in elementViews, set up listeners, and return */\n\t _createElementView: function (element) {\n\t var elementView = new this.elementViewClass({\n\t //TODO: use non-generic class or not all\n\t // model : COLLECTION.DatasetDCE( element )\n\t element: element,\n\t selected: _.has(this.selectedIds, element.id)\n\t });\n\t this.elementViews.push(elementView);\n\t this._listenToElementView(elementView);\n\t return elementView;\n\t },\n\t\n\t /** listen to any element events */\n\t _listenToElementView: function (view) {\n\t var creator = this;\n\t creator.listenTo(view, {\n\t select: function (data) {\n\t var element = data.source.element;\n\t if (data.selected) {\n\t creator.selectedIds[element.id] = true;\n\t } else {\n\t delete creator.selectedIds[element.id];\n\t }\n\t creator.trigger('elements:select', data);\n\t },\n\t discard: function (data) {\n\t creator.trigger('elements:discard', data);\n\t }\n\t });\n\t },\n\t\n\t /** add a new element view based on the json in element */\n\t addElementView: function (element) {\n\t //TODO: workingElements is sorted, add element in appropo index\n\t // add element, sort elements, find element index\n\t // var view = this._createElementView( element );\n\t // return view;\n\t },\n\t\n\t /** stop listening to view and remove from caches */\n\t removeElementView: function (view) {\n\t delete this.selectedIds[view.element.id];\n\t this._renderClearSelected();\n\t\n\t this.elementViews = _.without(this.elementViews, view);\n\t this.stopListening(view);\n\t },\n\t\n\t /** render a message in the list that no elements remain to create a collection */\n\t _renderNoElementsLeft: function () {\n\t this._disableNameAndCreate(true);\n\t this.$('.collection-elements').append(this.templates.noElementsLeft());\n\t },\n\t\n\t // /** render a message in the list that no valid elements were found to create a collection */\n\t // _renderNoValidElements : function(){\n\t // this._disableNameAndCreate( true );\n\t // this.$( '.collection-elements' ).append( this.templates.noValidElements() );\n\t // },\n\t\n\t // ------------------------------------------------------------------------ API\n\t /** convert element into JSON compatible with the collections API */\n\t _elementToJSON: function (element) {\n\t // return element.toJSON();\n\t return element;\n\t },\n\t\n\t /** create the collection via the API\n\t * @returns {jQuery.xhr Object} the jquery ajax request\n\t */\n\t createList: function (name) {\n\t if (!this.workingElements.length) {\n\t var message = _l('No valid elements for final list') + '. ';\n\t message += '' + _l('Cancel') + ' ';\n\t message += _l('or');\n\t message += ' ' + _l('start over') + '.';\n\t this._showAlert(message);\n\t return;\n\t }\n\t\n\t var creator = this,\n\t elements = this.workingElements.map(function (element) {\n\t return creator._elementToJSON(element);\n\t });\n\t\n\t creator.blocking = true;\n\t return creator.creationFn(elements, name, creator.hideOriginals).always(function () {\n\t creator.blocking = false;\n\t }).fail(function (xhr, status, message) {\n\t creator.trigger('error', {\n\t xhr: xhr,\n\t status: status,\n\t message: _l('An error occurred while creating this collection')\n\t });\n\t }).done(function (response, message, xhr) {\n\t creator.trigger('collection:created', response, message, xhr);\n\t creator.metric('collection:created', response);\n\t if (typeof creator.oncreate === 'function') {\n\t creator.oncreate.call(this, response, message, xhr);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ events\n\t /** set up event handlers on self */\n\t _setUpBehaviors: function () {\n\t this.on('error', this._errorHandler);\n\t\n\t this.once('rendered', function () {\n\t this.trigger('rendered:initial', this);\n\t });\n\t\n\t this.on('elements:select', function (data) {\n\t this._renderClearSelected();\n\t });\n\t\n\t this.on('elements:discard', function (data) {\n\t var element = data.source.element;\n\t this.removeElementView(data.source);\n\t\n\t this.workingElements = _.without(this.workingElements, element);\n\t if (!this.workingElements.length) {\n\t this._renderNoElementsLeft();\n\t }\n\t });\n\t\n\t //this.on( 'all', function(){\n\t // this.info( arguments );\n\t //});\n\t return this;\n\t },\n\t\n\t /** handle errors with feedback and details to the user (if available) */\n\t _errorHandler: function (data) {\n\t this.error(data);\n\t\n\t var creator = this,\n\t content = data.message || _l('An error occurred');\n\t if (data.xhr) {\n\t var xhr = data.xhr,\n\t message = data.message;\n\t if (xhr.readyState === 0 && xhr.status === 0) {\n\t content += ': ' + _l('Galaxy could not be reached and may be updating.') + _l(' Try again in a few minutes.');\n\t } else if (xhr.responseJSON) {\n\t content += ':
                                            ' + JSON.stringify(xhr.responseJSON) + '
                                            ';\n\t } else {\n\t content += ': ' + message;\n\t }\n\t }\n\t creator._showAlert(content, 'alert-danger');\n\t },\n\t\n\t events: {\n\t // header\n\t 'click .more-help': '_clickMoreHelp',\n\t 'click .less-help': '_clickLessHelp',\n\t 'click .main-help': '_toggleHelp',\n\t 'click .header .alert button': '_hideAlert',\n\t\n\t 'click .reset': 'reset',\n\t 'click .clear-selected': 'clearSelectedElements',\n\t\n\t // elements - selection\n\t 'click .collection-elements': 'clearSelectedElements',\n\t\n\t // elements - drop target\n\t // 'dragenter .collection-elements': '_dragenterElements',\n\t // 'dragleave .collection-elements': '_dragleaveElements',\n\t 'dragover .collection-elements': '_dragoverElements',\n\t 'drop .collection-elements': '_dropElements',\n\t\n\t // these bubble up from the elements as custom events\n\t 'collection-element.dragstart .collection-elements': '_elementDragstart',\n\t 'collection-element.dragend .collection-elements': '_elementDragend',\n\t\n\t // footer\n\t 'change .collection-name': '_changeName',\n\t 'keydown .collection-name': '_nameCheckForEnter',\n\t 'change .hide-originals': '_changeHideOriginals',\n\t 'click .cancel-create': '_cancelCreate',\n\t 'click .create-collection': '_clickCreate' //,\n\t },\n\t\n\t // ........................................................................ elements\n\t /** reset all data to the initial state */\n\t reset: function () {\n\t this._instanceSetUp();\n\t this._elementsSetUp();\n\t this.render();\n\t },\n\t\n\t /** deselect all elements */\n\t clearSelectedElements: function (ev) {\n\t this.$('.collection-elements .collection-element').removeClass('selected');\n\t this.$('.collection-elements-controls > .clear-selected').hide();\n\t },\n\t\n\t //_dragenterElements : function( ev ){\n\t // //this.debug( '_dragenterElements:', ev );\n\t //},\n\t //TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n\t // _dragleaveElements : function( ev ){\n\t // //this.debug( '_dragleaveElements:', ev );\n\t // },\n\t\n\t /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n\t _dragoverElements: function (ev) {\n\t //this.debug( '_dragoverElements:', ev );\n\t ev.preventDefault();\n\t\n\t var $list = this.$list();\n\t this._checkForAutoscroll($list, ev.originalEvent.clientY);\n\t var $nearest = this._getNearestElement(ev.originalEvent.clientY);\n\t\n\t //TODO: no need to re-create - move instead\n\t this.$('.element-drop-placeholder').remove();\n\t var $placeholder = $('
                                            ');\n\t if (!$nearest.length) {\n\t $list.append($placeholder);\n\t } else {\n\t $nearest.before($placeholder);\n\t }\n\t },\n\t\n\t /** If the mouse is near enough to the list's top or bottom, scroll the list */\n\t _checkForAutoscroll: function ($element, y) {\n\t var AUTOSCROLL_SPEED = 2,\n\t offset = $element.offset(),\n\t scrollTop = $element.scrollTop(),\n\t upperDist = y - offset.top,\n\t lowerDist = offset.top + $element.outerHeight() - y;\n\t if (upperDist >= 0 && upperDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop - AUTOSCROLL_SPEED);\n\t } else if (lowerDist >= 0 && lowerDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop + AUTOSCROLL_SPEED);\n\t }\n\t },\n\t\n\t /** get the nearest element based on the mouse's Y coordinate.\n\t * If the y is at the end of the list, return an empty jQuery object.\n\t */\n\t _getNearestElement: function (y) {\n\t var WIGGLE = 4,\n\t lis = this.$('.collection-elements li.collection-element').toArray();\n\t for (var i = 0; i < lis.length; i++) {\n\t var $li = $(lis[i]),\n\t top = $li.offset().top,\n\t halfHeight = Math.floor($li.outerHeight() / 2) + WIGGLE;\n\t if (top + halfHeight > y && top - halfHeight < y) {\n\t return $li;\n\t }\n\t }\n\t return $();\n\t },\n\t\n\t /** drop (dragged/selected elements) onto the list, re-ordering the internal list */\n\t _dropElements: function (ev) {\n\t if (ev.originalEvent) {\n\t ev = ev.originalEvent;\n\t }\n\t // both required for firefox\n\t ev.preventDefault();\n\t ev.dataTransfer.dropEffect = 'move';\n\t\n\t // insert before the nearest element or after the last.\n\t var $nearest = this._getNearestElement(ev.clientY);\n\t if ($nearest.length) {\n\t this.$dragging.insertBefore($nearest);\n\t } else {\n\t // no nearest before - insert after last element\n\t this.$dragging.insertAfter(this.$('.collection-elements .collection-element').last());\n\t }\n\t // resync the creator's list based on the new DOM order\n\t this._syncOrderToDom();\n\t return false;\n\t },\n\t\n\t /** resync the creator's list of elements based on the DOM order */\n\t _syncOrderToDom: function () {\n\t var creator = this,\n\t newElements = [];\n\t //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n\t this.$('.collection-elements .collection-element').each(function () {\n\t var id = $(this).attr('data-element-id'),\n\t element = _.findWhere(creator.workingElements, { id: id });\n\t if (element) {\n\t newElements.push(element);\n\t } else {\n\t console.error('missing element: ', id);\n\t }\n\t });\n\t this.workingElements = newElements;\n\t this._renderList();\n\t },\n\t\n\t /** drag communication with element sub-views: dragstart */\n\t _elementDragstart: function (ev, element) {\n\t // auto select the element causing the event and move all selected\n\t element.select(true);\n\t this.$dragging = this.$('.collection-elements .collection-element.selected');\n\t },\n\t\n\t /** drag communication with element sub-views: dragend - remove the placeholder */\n\t _elementDragend: function (ev, element) {\n\t $('.element-drop-placeholder').remove();\n\t this.$dragging = null;\n\t },\n\t\n\t // ------------------------------------------------------------------------ templates\n\t //TODO: move to require text plugin and load these as text\n\t //TODO: underscore currently unnecc. bc no vars are used\n\t //TODO: better way of localizing text-nodes in long strings\n\t /** underscore template fns attached to class */\n\t templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\t\n\t /** the header (not including help text) */\n\t header: _.template(['', '
                                            ', '', '', '
                                            '].join('')),\n\t\n\t /** the middle: element list */\n\t middle: _.template(['', '
                                            ', '
                                            '].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer: _.template(['
                                            ', '
                                            ', '', '
                                            ', '
                                            ', '', '
                                            ', _l('Name'), ':
                                            ', '
                                            ', '
                                            ', '
                                            ', '
                                            ', '', '
                                            ', '', '', '
                                            ', '
                                            ', '
                                            ', '', '
                                            ', '
                                            '].join('')),\n\t\n\t /** help content */\n\t helpContent: _.template(['

                                            ', _l(['Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ', 'workflows in order to have analyses done on each member of the entire group. This interface allows ', 'you to create a collection and re-order the final collection.'].join('')), '

                                            ', '
                                              ', '
                                            • ', _l(['Rename elements in the list by clicking on ', 'the existing name.'].join('')), '
                                            • ', '
                                            • ', _l(['Discard elements from the final created list by clicking on the ', '\"Discard\" button.'].join('')), '
                                            • ', '
                                            • ', _l(['Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ', 'them and you can then move those selected by dragging the ', 'entire group. Deselect them by clicking them again or by clicking the ', 'the \"Clear selected\" link.'].join('')), '
                                            • ', '
                                            • ', _l(['Click the \"Start over\" link to begin again as if you had just opened ', 'the interface.'].join('')), '
                                            • ', '
                                            • ', _l(['Click the \"Cancel\" button to exit the interface.'].join('')), '
                                            • ', '

                                            ', '

                                            ', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '

                                            '].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t invalidElements: _.template([_l('The following selections could not be included due to problems:'), '
                                              <% _.each( problems, function( problem ){ %>', '
                                            • <%- problem.element.name %>: <%- problem.text %>
                                            • ', '<% }); %>
                                            '].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t noElementsLeft: _.template(['
                                          2. ', _l('No elements left! '), _l('Would you like to '), '', _l('start over'), '?', '
                                          3. '].join('')),\n\t\n\t /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n\t invalidInitial: _.template(['
                                            ', '
                                            ', '', '<% if( _.size( problems ) ){ %>', _l('The following selections could not be included due to problems'), ':', '
                                              <% _.each( problems, function( problem ){ %>', '
                                            • <%- problem.element.name %>: <%- problem.text %>
                                            • ', '<% }); %>
                                            ', '<% } else if( _.size( elements ) < 1 ){ %>', _l('No datasets were selected'), '.', '<% } %>', '
                                            ', _l('At least one element is needed for the collection'), '. ', _l('You may need to '), '', _l('cancel'), ' ', _l('and reselect new elements'), '.', '
                                            ', '
                                            ', '
                                            ', '
                                            ', '
                                            ', '
                                            ', '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
                                            ', '
                                            ', '
                                            '].join(''))\n\t }),\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListCollectionCreator';\n\t }\n\t });\n\t\n\t //=============================================================================\n\t /** Create a modal and load its body with the given CreatorClass creator type\n\t * @returns {Deferred} resolved when creator has built a collection.\n\t */\n\t var collectionCreatorModal = function _collectionCreatorModal(elements, options, CreatorClass) {\n\t\n\t var deferred = jQuery.Deferred(),\n\t modal = Galaxy.modal || new UI_MODAL.View(),\n\t creator;\n\t\n\t options = _.defaults(options || {}, {\n\t elements: elements,\n\t oncancel: function () {\n\t modal.hide();\n\t deferred.reject('cancelled');\n\t },\n\t oncreate: function (creator, response) {\n\t modal.hide();\n\t deferred.resolve(response);\n\t }\n\t });\n\t\n\t creator = new CreatorClass(options);\n\t modal.show({\n\t title: options.title || _l('Create a collection'),\n\t body: creator.$el,\n\t width: '80%',\n\t height: '100%',\n\t closing_events: true\n\t });\n\t creator.render();\n\t window._collectionCreator = creator;\n\t\n\t //TODO: remove modal header\n\t return deferred;\n\t };\n\t\n\t /** List collection flavor of collectionCreatorModal. */\n\t var listCollectionCreatorModal = function _listCollectionCreatorModal(elements, options) {\n\t options = options || {};\n\t options.title = _l('Create a collection from a list of datasets');\n\t return collectionCreatorModal(elements, options, ListCollectionCreator);\n\t };\n\t\n\t //==============================================================================\n\t /** Use a modal to create a list collection, then add it to the given history contents.\n\t * @returns {Deferred} resolved when the collection is added to the history.\n\t */\n\t function createListCollection(contents, defaultHideSourceItems) {\n\t var elements = contents.toJSON(),\n\t promise = listCollectionCreatorModal(elements, {\n\t defaultHideSourceItems: defaultHideSourceItems,\n\t creationFn: function (elements, name, hideSourceItems) {\n\t elements = elements.map(function (element) {\n\t return {\n\t id: element.id,\n\t name: element.name,\n\t //TODO: this allows for list:list even if the filter above does not - reconcile\n\t src: element.history_content_type === 'dataset' ? 'hda' : 'hdca'\n\t };\n\t });\n\t return contents.createHDCA(elements, 'list', name, hideSourceItems);\n\t }\n\t });\n\t return promise;\n\t }\n\t\n\t //==============================================================================\n\t return {\n\t DatasetCollectionElementView: DatasetCollectionElementView,\n\t ListCollectionCreator: ListCollectionCreator,\n\t\n\t collectionCreatorModal: collectionCreatorModal,\n\t listCollectionCreatorModal: listCollectionCreatorModal,\n\t createListCollection: createListCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 61 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, jQuery, Backbone, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(67), __webpack_require__(17), __webpack_require__(25), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_ITEM, STATES, faIconButton, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t var logNamespace = 'dataset';\n\t /*==============================================================================\n\t TODO:\n\t straighten out state rendering and templates used\n\t inaccessible/STATES.NOT_VIEWABLE is a special case\n\t simplify button rendering\n\t \n\t ==============================================================================*/\n\t var _super = LIST_ITEM.ListItemView;\n\t /** @class Read only list view for either LDDAs, HDAs, or HDADCEs.\n\t * Roughly, any DatasetInstance (and not a raw Dataset).\n\t */\n\t var DatasetListItemView = _super.extend(\n\t /** @lends DatasetListItemView.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t className: _super.prototype.className + \" dataset\",\n\t //TODO:?? doesn't exactly match an hda's type_id\n\t id: function () {\n\t return ['dataset', this.model.get('id')].join('-');\n\t },\n\t\n\t /** Set up: instance vars, options, and event handlers */\n\t initialize: function (attributes) {\n\t if (attributes.logger) {\n\t this.logger = this.model.logger = attributes.logger;\n\t }\n\t this.log(this + '.initialize:', attributes);\n\t _super.prototype.initialize.call(this, attributes);\n\t\n\t /** where should pages from links be displayed? (default to new tab/window) */\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t },\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t var self = this;\n\t\n\t // re-rendering on any model changes\n\t return self.listenTo(self.model, {\n\t 'change': function (model) {\n\t // if the model moved into the ready state and is expanded without details, fetch those details now\n\t if (self.model.changedAttributes().state && self.model.inReadyState() && self.expanded && !self.model.hasDetails()) {\n\t // normally, will render automatically (due to fetch -> change),\n\t // but! setting_metadata sometimes doesn't cause any other changes besides state\n\t // so, not rendering causes it to seem frozen in setting_metadata state\n\t self.model.fetch({ silent: true }).done(function () {\n\t self.render();\n\t });\n\t } else {\n\t if (_.has(model.changed, 'tags') && _.keys(model.changed).length === 1) {\n\t // If only the tags have changed, rerender specifically\n\t // the titlebar region. Otherwise default to the full\n\t // render.\n\t self.$('.nametags').html(self._renderNametags());\n\t } else {\n\t self.render();\n\t }\n\t }\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... expandable\n\t /** In this override, only get details if in the ready state, get rerunnable if in other states.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t // ......................................................................... removal\n\t /** Remove this view's html from the DOM and remove all event listeners.\n\t * @param {Number or String} speed jq effect speed\n\t * @param {Function} callback an optional function called when removal is done (scoped to this view)\n\t */\n\t remove: function (speed, callback) {\n\t var view = this;\n\t speed = speed || this.fxSpeed;\n\t this.$el.fadeOut(speed, function () {\n\t Backbone.View.prototype.remove.call(view);\n\t if (callback) {\n\t callback.call(view);\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... rendering\n\t /* TODO:\n\t dataset states are the issue primarily making dataset rendering complex\n\t each state should have it's own way of displaying/set of details\n\t often with different actions that can be applied\n\t throw in deleted/purged/visible and things get complicated easily\n\t I've considered (a couple of times) - creating a view for each state\n\t - but recreating the view during an update...seems wrong\n\t */\n\t /** In this override, add the dataset state as a class for use with state-based CSS */\n\t _swapNewRender: function ($newRender) {\n\t _super.prototype._swapNewRender.call(this, $newRender);\n\t if (this.model.has('state')) {\n\t this.$el.addClass('state-' + this.model.get('state'));\n\t }\n\t return this.$el;\n\t },\n\t\n\t // ................................................................................ titlebar\n\t /** In this override, add the dataset display button. */\n\t _renderPrimaryActions: function () {\n\t // render just the display for read-only\n\t return [this._renderDisplayButton()];\n\t },\n\t\n\t /** Render icon-button to display dataset data */\n\t _renderDisplayButton: function () {\n\t // don't show display if not viewable or not accessible\n\t var state = this.model.get('state');\n\t if (state === STATES.NOT_VIEWABLE || state === STATES.DISCARDED || !this.model.get('accessible')) {\n\t return null;\n\t }\n\t\n\t var displayBtnData = {\n\t target: this.linkTarget,\n\t classes: 'display-btn'\n\t };\n\t\n\t // show a disabled display if the data's been purged\n\t if (this.model.get('purged')) {\n\t displayBtnData.disabled = true;\n\t displayBtnData.title = _l('Cannot display datasets removed from disk');\n\t\n\t // disable if still uploading\n\t } else if (state === STATES.UPLOAD) {\n\t displayBtnData.disabled = true;\n\t displayBtnData.title = _l('This dataset must finish uploading before it can be viewed');\n\t\n\t // disable if still new\n\t } else if (state === STATES.NEW) {\n\t displayBtnData.disabled = true;\n\t displayBtnData.title = _l('This dataset is not yet viewable');\n\t } else {\n\t displayBtnData.title = _l('View data');\n\t\n\t // default link for dataset\n\t displayBtnData.href = this.model.urls.display;\n\t\n\t // add frame manager option onclick event\n\t var self = this;\n\t displayBtnData.onclick = function (ev) {\n\t if (Galaxy.frame && Galaxy.frame.active) {\n\t // Add dataset to frames.\n\t Galaxy.frame.addDataset(self.model.get('id'));\n\t ev.preventDefault();\n\t }\n\t };\n\t }\n\t displayBtnData.faIcon = 'fa-eye';\n\t return faIconButton(displayBtnData);\n\t },\n\t\n\t // ......................................................................... rendering details\n\t /** Render the enclosing div of the hda body and, if expanded, the html in the body\n\t * @returns {jQuery} rendered DOM\n\t */\n\t _renderDetails: function () {\n\t //TODO: generalize to be allow different details for each state\n\t\n\t // no access - render nothing but a message\n\t if (this.model.get('state') === STATES.NOT_VIEWABLE) {\n\t return $(this.templates.noAccess(this.model.toJSON(), this));\n\t }\n\t\n\t var $details = _super.prototype._renderDetails.call(this);\n\t $details.find('.actions .left').empty().append(this._renderSecondaryActions());\n\t $details.find('.summary').html(this._renderSummary()).prepend(this._renderDetailMessages());\n\t $details.find('.display-applications').html(this._renderDisplayApplications());\n\t\n\t this._setUpBehaviors($details);\n\t return $details;\n\t },\n\t\n\t /** Defer to the appropo summary rendering fn based on state */\n\t _renderSummary: function () {\n\t var json = this.model.toJSON(),\n\t summaryRenderFn = this.templates.summaries[json.state];\n\t summaryRenderFn = summaryRenderFn || this.templates.summaries.unknown;\n\t return summaryRenderFn(json, this);\n\t },\n\t\n\t /** Render messages to be displayed only when the details are shown */\n\t _renderDetailMessages: function () {\n\t var view = this,\n\t $warnings = $('
                                            '),\n\t json = view.model.toJSON();\n\t //TODO:! unordered (map)\n\t _.each(view.templates.detailMessages, function (templateFn) {\n\t $warnings.append($(templateFn(json, view)));\n\t });\n\t return $warnings;\n\t },\n\t\n\t /** Render the external display application links */\n\t _renderDisplayApplications: function () {\n\t if (this.model.isDeletedOrPurged()) {\n\t return '';\n\t }\n\t // render both old and new display apps using the same template\n\t return [this.templates.displayApplications(this.model.get('display_apps'), this), this.templates.displayApplications(this.model.get('display_types'), this)].join('');\n\t },\n\t\n\t // ......................................................................... secondary/details actions\n\t /** A series of links/buttons for less commonly used actions: re-run, info, etc. */\n\t _renderSecondaryActions: function () {\n\t this.debug('_renderSecondaryActions');\n\t switch (this.model.get('state')) {\n\t case STATES.NOT_VIEWABLE:\n\t return [];\n\t case STATES.OK:\n\t case STATES.FAILED_METADATA:\n\t case STATES.ERROR:\n\t return [this._renderDownloadButton(), this._renderShowParamsButton()];\n\t }\n\t return [this._renderShowParamsButton()];\n\t },\n\t\n\t /** Render icon-button to show the input and output (stdout/err) for the job that created this.\n\t * @returns {jQuery} rendered DOM\n\t */\n\t _renderShowParamsButton: function () {\n\t // gen. safe to show in all cases\n\t return faIconButton({\n\t title: _l('View details'),\n\t classes: 'params-btn',\n\t href: this.model.urls.show_params,\n\t target: this.linkTarget,\n\t faIcon: 'fa-info-circle',\n\t onclick: function (ev) {\n\t if (Galaxy.frame && Galaxy.frame.active) {\n\t Galaxy.frame.add({ title: 'Dataset details', url: this.href });\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** Render icon-button/popupmenu to download the data (and/or the associated meta files (bai, etc.)) for this.\n\t * @returns {jQuery} rendered DOM\n\t */\n\t _renderDownloadButton: function () {\n\t // don't show anything if the data's been purged\n\t if (this.model.get('purged') || !this.model.hasData()) {\n\t return null;\n\t }\n\t\n\t // return either: a popupmenu with links to download assoc. meta files (if there are meta files)\n\t // or a single download icon-button (if there are no meta files)\n\t if (!_.isEmpty(this.model.get('meta_files'))) {\n\t return this._renderMetaFileDownloadButton();\n\t }\n\t\n\t return $(['', '', ''].join(''));\n\t },\n\t\n\t /** Render the download button which opens a dropdown with links to download assoc. meta files (indeces, etc.) */\n\t _renderMetaFileDownloadButton: function () {\n\t var urls = this.model.urls;\n\t return $(['
                                            ', '', '', '', '', '
                                            '].join('\\n'));\n\t },\n\t\n\t _renderNametags: function () {\n\t var tpl = _.template(['<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>', '<% if (tag.indexOf(\"name:\") == 0){ %>', '<%- tag.slice(5) %>', '<% } %>', '<% }); %>'].join(''));\n\t return tpl({ tags: this.model.get('tags') });\n\t },\n\t\n\t // ......................................................................... misc\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .display-btn': function (ev) {\n\t this.trigger('display', this, ev);\n\t },\n\t 'click .params-btn': function (ev) {\n\t this.trigger('params', this, ev);\n\t },\n\t 'click .download-btn': function (ev) {\n\t this.trigger('download', this, ev);\n\t }\n\t }),\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DatasetListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetListItemView.prototype.templates = function () {\n\t //TODO: move to require text! plugin\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t failed_metadata: BASE_MVC.wrapTemplate([\n\t // failed metadata is rendered as a warning on an otherwise ok dataset view\n\t '<% if( model.state === \"failed_metadata\" ){ %>', '
                                            ', _l('An error occurred setting the metadata for this dataset'), '
                                            ', '<% } %>']),\n\t error: BASE_MVC.wrapTemplate([\n\t // error during index fetch - show error on dataset\n\t '<% if( model.error ){ %>', '
                                            ', _l('There was an error getting the data for this dataset'), ': <%- model.error %>', '
                                            ', '<% } %>']),\n\t purged: BASE_MVC.wrapTemplate(['<% if( model.purged ){ %>', '
                                            ', _l('This dataset has been deleted and removed from disk'), '
                                            ', '<% } %>']),\n\t deleted: BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>', '
                                            ', _l('This dataset has been deleted'), '
                                            ', '<% } %>'])\n\t\n\t //NOTE: hidden warning is only needed for HDAs\n\t });\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate(['
                                            ', '
                                            ', '
                                            ', '
                                            ', '
                                            ', '
                                            ',\n\t\n\t // do not display tags, annotation, display apps, or peek when deleted\n\t '<% if( !dataset.deleted && !dataset.purged ){ %>', '
                                            ', '
                                            ', '
                                            ', '<% if( dataset.peek ){ %>', '
                                            <%= dataset.peek %>
                                            ', '<% } %>', '<% } %>', '
                                            '], 'dataset');\n\t\n\t var noAccessTemplate = BASE_MVC.wrapTemplate(['
                                            ', '
                                            ', _l('You do not have permission to view this dataset'), '
                                            ', '
                                            '], 'dataset');\n\t\n\t //TODO: still toooooooooooooo complex - rework\n\t var summaryTemplates = {};\n\t summaryTemplates[STATES.OK] = summaryTemplates[STATES.FAILED_METADATA] = BASE_MVC.wrapTemplate(['<% if( dataset.misc_blurb ){ %>', '
                                            ', '<%- dataset.misc_blurb %>', '
                                            ', '<% } %>', '<% if( dataset.file_ext ){ %>', '
                                            ', '', '<%- dataset.file_ext %>', '
                                            ', '<% } %>', '<% if( dataset.metadata_dbkey ){ %>', '
                                            ', '', '', '<%- dataset.metadata_dbkey %>', '', '
                                            ', '<% } %>', '<% if( dataset.misc_info ){ %>', '
                                            ', '<%- dataset.misc_info %>', '
                                            ', '<% } %>'], 'dataset');\n\t summaryTemplates[STATES.NEW] = BASE_MVC.wrapTemplate(['
                                            ', _l('This is a new dataset and not all of its data are available yet'), '
                                            '], 'dataset');\n\t summaryTemplates[STATES.NOT_VIEWABLE] = BASE_MVC.wrapTemplate(['
                                            ', _l('You do not have permission to view this dataset'), '
                                            '], 'dataset');\n\t summaryTemplates[STATES.DISCARDED] = BASE_MVC.wrapTemplate(['
                                            ', _l('The job creating this dataset was cancelled before completion'), '
                                            '], 'dataset');\n\t summaryTemplates[STATES.QUEUED] = BASE_MVC.wrapTemplate(['
                                            ', _l('This job is waiting to run'), '
                                            '], 'dataset');\n\t summaryTemplates[STATES.RUNNING] = BASE_MVC.wrapTemplate(['
                                            ', _l('This job is currently running'), '
                                            '], 'dataset');\n\t summaryTemplates[STATES.UPLOAD] = BASE_MVC.wrapTemplate(['
                                            ', _l('This dataset is currently uploading'), '
                                            '], 'dataset');\n\t summaryTemplates[STATES.SETTING_METADATA] = BASE_MVC.wrapTemplate(['
                                            ', _l('Metadata is being auto-detected'), '
                                            '], 'dataset');\n\t summaryTemplates[STATES.PAUSED] = BASE_MVC.wrapTemplate(['
                                            ', _l('This job is paused. Use the \"Resume Paused Jobs\" in the history menu to resume'), '
                                            '], 'dataset');\n\t summaryTemplates[STATES.ERROR] = BASE_MVC.wrapTemplate(['<% if( !dataset.purged ){ %>', '
                                            <%- dataset.misc_blurb %>
                                            ', '<% } %>', '', _l('An error occurred with this dataset'), ':', '
                                            <%- dataset.misc_info %>
                                            '], 'dataset');\n\t summaryTemplates[STATES.EMPTY] = BASE_MVC.wrapTemplate(['
                                            ', _l('No data'), ': <%- dataset.misc_blurb %>
                                            '], 'dataset');\n\t summaryTemplates.unknown = BASE_MVC.wrapTemplate(['
                                            Error: unknown dataset state: \"<%- dataset.state %>\"
                                            '], 'dataset');\n\t\n\t // messages to be displayed only within the details section ('below the fold')\n\t var detailMessageTemplates = {\n\t resubmitted: BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.resubmitted ){ %>', '
                                            ', _l('The job creating this dataset has been resubmitted'), '
                                            ', '<% } %>'])\n\t };\n\t\n\t // this is applied to both old and new style display apps\n\t var displayApplicationsTemplate = BASE_MVC.wrapTemplate(['<% _.each( apps, function( app ){ %>', '
                                            ', '<%- app.label %> ', '', '<% _.each( app.links, function( link ){ %>', '\" href=\"<%- link.href %>\">', '<% print( _l( link.text ) ); %>', ' ', '<% }); %>', '', '
                                            ', '<% }); %>'], 'apps');\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t warnings: warnings,\n\t details: detailsTemplate,\n\t noAccess: noAccessTemplate,\n\t summaries: summaryTemplates,\n\t detailMessages: detailMessageTemplates,\n\t displayApplications: displayApplicationsTemplate\n\t });\n\t }();\n\t\n\t // ============================================================================\n\t return {\n\t DatasetListItemView: DatasetListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 62 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {/** Generic form view */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(10), __webpack_require__(5)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Form, Ui) {\n\t\n\t var View = Backbone.View.extend({\n\t\n\t initialize: function (options) {\n\t this.model = new Backbone.Model(options);\n\t this.url = this.model.get('url');\n\t this.redirect = this.model.get('redirect');\n\t this.setElement('
                                            ');\n\t this.render();\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t $.ajax({\n\t url: Galaxy.root + this.url,\n\t type: 'GET'\n\t }).done(function (response) {\n\t var options = $.extend({}, self.model.attributes, response);\n\t var form = new Form({\n\t title: options.title,\n\t message: options.message,\n\t status: options.status || 'warning',\n\t icon: options.icon,\n\t inputs: options.inputs,\n\t buttons: {\n\t 'submit': new Ui.Button({\n\t tooltip: options.submit_tooltip,\n\t title: options.submit_title || 'Save',\n\t icon: options.submit_icon || 'fa-save',\n\t cls: 'btn btn-primary ui-clear-float',\n\t onclick: function () {\n\t self._submit(form);\n\t }\n\t })\n\t }\n\t });\n\t self.$el.empty().append(form.$el);\n\t }).fail(function (response) {\n\t self.$el.empty().append(new Ui.Message({\n\t message: 'Failed to load resource ' + self.url + '.',\n\t status: 'danger',\n\t persistent: true\n\t }).$el);\n\t });\n\t },\n\t\n\t _submit: function (form) {\n\t var self = this;\n\t $.ajax({\n\t url: Galaxy.root + self.url,\n\t data: JSON.stringify(form.data.create()),\n\t type: 'PUT',\n\t contentType: 'application/json'\n\t }).done(function (response) {\n\t var success_message = { message: response.message, status: 'success', persistent: false };\n\t if (self.redirect) {\n\t window.location = Galaxy.root + self.redirect + '?' + $.param(success_message);\n\t } else {\n\t form.data.matchModel(response, function (input, input_id) {\n\t form.field_list[input_id].value(input.value);\n\t });\n\t self._showMessage(form, success_message);\n\t }\n\t }).fail(function (response) {\n\t self._showMessage(form, { message: response.responseJSON.err_msg, status: 'danger', persistent: false });\n\t });\n\t },\n\t\n\t _showMessage: function (form, options) {\n\t var $panel = form.$el.parents().filter(function () {\n\t return ['auto', 'scroll'].indexOf($(this).css('overflow')) != -1;\n\t }).first();\n\t $panel.animate({ scrollTop: 0 }, 500);\n\t form.message.update(options);\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 63 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(59), __webpack_require__(90), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DC_MODEL, HISTORY_CONTENT, _l) {\n\t\n\t 'use strict';\n\t\n\t /*==============================================================================\n\t \n\t Models for DatasetCollections contained within a history.\n\t \n\t TODO:\n\t these might be compactable to one class if some duplication with\n\t collection-model is used.\n\t \n\t ==============================================================================*/\n\t\n\t var hcontentMixin = HISTORY_CONTENT.HistoryContentMixin,\n\t ListDC = DC_MODEL.ListDatasetCollection,\n\t PairDC = DC_MODEL.PairDatasetCollection,\n\t ListPairedDC = DC_MODEL.ListPairedDatasetCollection,\n\t ListOfListsDC = DC_MODEL.ListOfListsDatasetCollection;\n\t\n\t //==============================================================================\n\t /** Override to post to contents route w/o id. */\n\t function buildHDCASave(_super) {\n\t return function _save(attributes, options) {\n\t if (this.isNew()) {\n\t options = options || {};\n\t options.url = this.urlRoot + this.get('history_id') + '/contents';\n\t attributes = attributes || {};\n\t attributes.type = 'dataset_collection';\n\t }\n\t return _super.call(this, attributes, options);\n\t };\n\t }\n\t\n\t //==============================================================================\n\t /** @class Backbone model for List Dataset Collection within a History.\n\t */\n\t var HistoryListDatasetCollection = ListDC.extend(hcontentMixin).extend(\n\t /** @lends HistoryListDatasetCollection.prototype */{\n\t\n\t defaults: _.extend(_.clone(ListDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'list',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(ListDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'History' + ListDC.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for Pair Dataset Collection within a History.\n\t * @constructs\n\t */\n\t var HistoryPairDatasetCollection = PairDC.extend(hcontentMixin).extend(\n\t /** @lends HistoryPairDatasetCollection.prototype */{\n\t\n\t defaults: _.extend(_.clone(PairDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'paired',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(PairDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'History' + PairDC.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for List of Pairs Dataset Collection within a History. */\n\t var HistoryListPairedDatasetCollection = ListPairedDC.extend(hcontentMixin).extend({\n\t\n\t defaults: _.extend(_.clone(ListPairedDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'list:paired',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(ListPairedDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return 'History' + ListPairedDC.prototype.toString.call(this);\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** @class Backbone model for List of Lists Dataset Collection within a History. */\n\t var HistoryListOfListsDatasetCollection = ListOfListsDC.extend(hcontentMixin).extend({\n\t\n\t defaults: _.extend(_.clone(ListOfListsDC.prototype.defaults), {\n\t history_content_type: 'dataset_collection',\n\t collection_type: 'list:list',\n\t model_class: 'HistoryDatasetCollectionAssociation'\n\t }),\n\t\n\t /** Override to post to contents route w/o id. */\n\t save: buildHDCASave(ListOfListsDC.prototype.save),\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['HistoryListOfListsDatasetCollection(', this.get('name'), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HistoryListDatasetCollection: HistoryListDatasetCollection,\n\t HistoryPairDatasetCollection: HistoryPairDatasetCollection,\n\t HistoryListPairedDatasetCollection: HistoryListPairedDatasetCollection,\n\t HistoryListOfListsDatasetCollection: HistoryListOfListsDatasetCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 64 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, jQuery, Backbone) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(81), __webpack_require__(88), __webpack_require__(63), __webpack_require__(66), __webpack_require__(7), __webpack_require__(154)], __WEBPACK_AMD_DEFINE_RESULT__ = function (CONTROLLED_FETCH_COLLECTION, HDA_MODEL, HDCA_MODEL, HISTORY_PREFS, BASE_MVC, AJAX_QUEUE) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = CONTROLLED_FETCH_COLLECTION.PaginatedCollection;\n\t /** @class Backbone collection for history content.\n\t * NOTE: history content seems like a dataset collection, but differs in that it is mixed:\n\t * each element can be either an HDA (dataset) or a DatasetCollection and co-exist on\n\t * the same level.\n\t * Dataset collections on the other hand are not mixed and (so far) can only contain either\n\t * HDAs or child dataset collections on one level.\n\t * This is why this does not inherit from any of the DatasetCollections (currently).\n\t */\n\t var HistoryContents = _super.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: 'history',\n\t\n\t // ........................................................................ composite collection\n\t /** since history content is a mix, override model fn into a factory, creating based on history_content_type */\n\t model: function (attrs, options) {\n\t if (attrs.history_content_type === \"dataset\") {\n\t return new HDA_MODEL.HistoryDatasetAssociation(attrs, options);\n\t } else if (attrs.history_content_type === \"dataset_collection\") {\n\t switch (attrs.collection_type) {\n\t case 'list':\n\t return new HDCA_MODEL.HistoryListDatasetCollection(attrs, options);\n\t case 'paired':\n\t return new HDCA_MODEL.HistoryPairDatasetCollection(attrs, options);\n\t case 'list:paired':\n\t return new HDCA_MODEL.HistoryListPairedDatasetCollection(attrs, options);\n\t case 'list:list':\n\t return new HDCA_MODEL.HistoryListOfListsDatasetCollection(attrs, options);\n\t }\n\t // This is a hack inside a hack:\n\t // Raise a plain object with validationError to fake a model.validationError\n\t // (since we don't have a model to use validate with)\n\t // (the outer hack being the mixed content/model function in this collection)\n\t var msg = 'Unknown collection_type: ' + attrs.collection_type;\n\t console.warn(msg, attrs);\n\t return { validationError: msg };\n\t }\n\t return { validationError: 'Unknown history_content_type: ' + attrs.history_content_type };\n\t },\n\t\n\t // ........................................................................ set up\n\t limitPerPage: 500,\n\t\n\t /** @type {Integer} how many contents per call to fetch when using progressivelyFetchDetails */\n\t limitPerProgressiveFetch: 500,\n\t\n\t /** @type {String} order used here and when fetching from server */\n\t order: 'hid',\n\t\n\t /** root api url */\n\t urlRoot: Galaxy.root + 'api/histories',\n\t\n\t /** complete api url */\n\t url: function () {\n\t return this.urlRoot + '/' + this.historyId + '/contents';\n\t },\n\t\n\t /** Set up */\n\t initialize: function (models, options) {\n\t options = options || {};\n\t _super.prototype.initialize.call(this, models, options);\n\t\n\t this.history = options.history || null;\n\t this.setHistoryId(options.historyId || null);\n\t /** @type {Boolean} does this collection contain and fetch deleted elements */\n\t this.includeDeleted = options.includeDeleted || this.includeDeleted;\n\t /** @type {Boolean} does this collection contain and fetch non-visible elements */\n\t this.includeHidden = options.includeHidden || this.includeHidden;\n\t\n\t // backbonejs uses collection.model.prototype.idAttribute to determine if a model is *already* in a collection\n\t // and either merged or replaced. In this case, our 'model' is a function so we need to add idAttribute\n\t // manually here - if we don't, contents will not merge but be replaced/swapped.\n\t this.model.prototype.idAttribute = 'type_id';\n\t },\n\t\n\t setHistoryId: function (newId) {\n\t this.historyId = newId;\n\t this._setUpWebStorage();\n\t },\n\t\n\t /** Set up client side storage. Currently PersistanStorage keyed under 'history:' */\n\t _setUpWebStorage: function (initialSettings) {\n\t // TODO: use initialSettings\n\t if (!this.historyId) {\n\t return;\n\t }\n\t this.storage = new HISTORY_PREFS.HistoryPrefs({\n\t id: HISTORY_PREFS.HistoryPrefs.historyStorageKey(this.historyId)\n\t });\n\t this.trigger('new-storage', this.storage, this);\n\t\n\t this.on({\n\t 'include-deleted': function (newVal) {\n\t this.storage.includeDeleted(newVal);\n\t },\n\t 'include-hidden': function (newVal) {\n\t this.storage.includeHidden(newVal);\n\t }\n\t });\n\t\n\t this.includeDeleted = this.storage.includeDeleted() || false;\n\t this.includeHidden = this.storage.includeHidden() || false;\n\t return this;\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** @type {Object} map of collection available sorting orders containing comparator fns */\n\t comparators: _.extend(_.clone(_super.prototype.comparators), {\n\t 'name': BASE_MVC.buildComparator('name', { ascending: true }),\n\t 'name-dsc': BASE_MVC.buildComparator('name', { ascending: false }),\n\t 'hid': BASE_MVC.buildComparator('hid', { ascending: false }),\n\t 'hid-asc': BASE_MVC.buildComparator('hid', { ascending: true })\n\t }),\n\t\n\t /** Get every model in this collection not in a 'ready' state (running). */\n\t running: function () {\n\t return this.filter(function (c) {\n\t return !c.inReadyState();\n\t });\n\t },\n\t\n\t /** return contents that are not ready and not deleted/hidden */\n\t runningAndActive: function () {\n\t return this.filter(function (c) {\n\t return !c.inReadyState() && c.get('visible')\n\t // TODO: deletedOrPurged?\n\t && !c.get('deleted');\n\t });\n\t },\n\t\n\t /** Get the model with the given hid\n\t * @param {Int} hid the hid to search for\n\t * @returns {HistoryDatasetAssociation} the model with the given hid or undefined if not found\n\t */\n\t getByHid: function (hid) {\n\t // note: there *can* be more than one content with a given hid, this finds the first based on order\n\t return this.findWhere({ hid: hid });\n\t },\n\t\n\t /** return true if all contents have details */\n\t haveDetails: function () {\n\t return this.all(function (c) {\n\t return c.hasDetails();\n\t });\n\t },\n\t\n\t // ........................................................................ hidden / deleted\n\t /** return a new contents collection of only hidden items */\n\t hidden: function () {\n\t return this.filter(function (c) {\n\t return c.hidden();\n\t });\n\t },\n\t\n\t /** return a new contents collection of only hidden items */\n\t deleted: function () {\n\t return this.filter(function (c) {\n\t return c.get('deleted');\n\t });\n\t },\n\t\n\t /** return a new contents collection of only hidden items */\n\t visibleAndUndeleted: function () {\n\t return this.filter(function (c) {\n\t return c.get('visible') &&\n\t // TODO: deletedOrPurged?\n\t !c.get('deleted');\n\t });\n\t },\n\t\n\t /** create a setter in order to publish the change */\n\t setIncludeDeleted: function (setting, options) {\n\t if (_.isBoolean(setting) && setting !== this.includeDeleted) {\n\t this.includeDeleted = setting;\n\t if (_.result(options, 'silent')) {\n\t return;\n\t }\n\t this.trigger('include-deleted', setting, this);\n\t }\n\t },\n\t\n\t /** create a setter in order to publish the change */\n\t setIncludeHidden: function (setting, options) {\n\t if (_.isBoolean(setting) && setting !== this.includeHidden) {\n\t this.includeHidden = setting;\n\t options = options || {};\n\t if (_.result(options, 'silent')) {\n\t return;\n\t }\n\t this.trigger('include-hidden', setting, this);\n\t }\n\t },\n\t\n\t // ........................................................................ ajax\n\t // ............ controlled fetch collection\n\t /** override to get expanded ids from sessionStorage and pass to API as details */\n\t fetch: function (options) {\n\t options = options || {};\n\t if (this.historyId && !options.details) {\n\t var prefs = HISTORY_PREFS.HistoryPrefs.get(this.historyId).toJSON();\n\t if (!_.isEmpty(prefs.expandedIds)) {\n\t options.details = _.values(prefs.expandedIds).join(',');\n\t }\n\t }\n\t return _super.prototype.fetch.call(this, options);\n\t },\n\t\n\t // ............. ControlledFetch stuff\n\t /** override to include the API versioning flag */\n\t _buildFetchData: function (options) {\n\t return _.extend(_super.prototype._buildFetchData.call(this, options), {\n\t v: 'dev'\n\t });\n\t },\n\t\n\t /** Extend to include details and version */\n\t _fetchParams: _super.prototype._fetchParams.concat([\n\t // TODO: remove (the need for) both\n\t /** version */\n\t 'v',\n\t /** dataset ids to get full details of */\n\t 'details']),\n\t\n\t /** override to add deleted/hidden filters */\n\t _buildFetchFilters: function (options) {\n\t var superFilters = _super.prototype._buildFetchFilters.call(this, options) || {};\n\t var filters = {};\n\t if (!this.includeDeleted) {\n\t filters.deleted = false;\n\t filters.purged = false;\n\t }\n\t if (!this.includeHidden) {\n\t filters.visible = true;\n\t }\n\t return _.defaults(superFilters, filters);\n\t },\n\t\n\t // ............ paginated collection\n\t getTotalItemCount: function () {\n\t return this.history.contentsShown();\n\t },\n\t\n\t // ............ history contents specific ajax\n\t /** override to filter requested contents to those updated after the Date 'since' */\n\t fetchUpdated: function (since, options) {\n\t if (since) {\n\t options = options || { filters: {} };\n\t options.remove = false;\n\t options.filters = {\n\t 'update_time-ge': since.toISOString(),\n\t // workflows will produce hidden datasets (non-output datasets) that still\n\t // need to be updated in the collection or they'll update forever\n\t // we can remove the default visible filter by using an 'empty' value\n\t visible: ''\n\t };\n\t }\n\t return this.fetch(options);\n\t },\n\t\n\t /** fetch all the deleted==true contents of this collection */\n\t fetchDeleted: function (options) {\n\t options = options || {};\n\t var self = this;\n\t options.filters = _.extend(options.filters, {\n\t // all deleted, purged or not\n\t deleted: true,\n\t purged: undefined\n\t });\n\t options.remove = false;\n\t\n\t self.trigger('fetching-deleted', self);\n\t return self.fetch(options).always(function () {\n\t self.trigger('fetching-deleted-done', self);\n\t });\n\t },\n\t\n\t /** fetch all the visible==false contents of this collection */\n\t fetchHidden: function (options) {\n\t options = options || {};\n\t var self = this;\n\t options.filters = _.extend(options.filters, {\n\t visible: false\n\t });\n\t options.remove = false;\n\t\n\t self.trigger('fetching-hidden', self);\n\t return self.fetch(options).always(function () {\n\t self.trigger('fetching-hidden-done', self);\n\t });\n\t },\n\t\n\t /** fetch detailed model data for all contents in this collection */\n\t fetchAllDetails: function (options) {\n\t options = options || {};\n\t var detailsFlag = { details: 'all' };\n\t options.data = _.extend(options.data || {}, detailsFlag);\n\t return this.fetch(options);\n\t },\n\t\n\t /** specialty fetch method for retrieving the element_counts of all hdcas in the history */\n\t fetchCollectionCounts: function (options) {\n\t options = options || {};\n\t options.keys = ['type_id', 'element_count'].join(',');\n\t options.filters = _.extend(options.filters || {}, {\n\t history_content_type: 'dataset_collection'\n\t });\n\t options.remove = false;\n\t return this.fetch(options);\n\t },\n\t\n\t // ............. quasi-batch ops\n\t // TODO: to batch\n\t /** helper that fetches using filterParams then calls save on each fetched using updateWhat as the save params */\n\t _filterAndUpdate: function (filterParams, updateWhat) {\n\t var self = this;\n\t var idAttribute = self.model.prototype.idAttribute;\n\t var updateArgs = [updateWhat];\n\t\n\t return self.fetch({ filters: filterParams, remove: false }).then(function (fetched) {\n\t // convert filtered json array to model array\n\t fetched = fetched.reduce(function (modelArray, currJson, i) {\n\t var model = self.get(currJson[idAttribute]);\n\t return model ? modelArray.concat(model) : modelArray;\n\t }, []);\n\t return self.ajaxQueue('save', updateArgs, fetched);\n\t });\n\t },\n\t\n\t /** using a queue, perform ajaxFn on each of the models in this collection */\n\t ajaxQueue: function (ajaxFn, args, collection) {\n\t collection = collection || this.models;\n\t return new AJAX_QUEUE.AjaxQueue(collection.slice().reverse().map(function (content, i) {\n\t var fn = _.isString(ajaxFn) ? content[ajaxFn] : ajaxFn;\n\t return function () {\n\t return fn.apply(content, args);\n\t };\n\t })).deferred;\n\t },\n\t\n\t /** fetch contents' details in batches of limitPerCall - note: only get searchable details here */\n\t progressivelyFetchDetails: function (options) {\n\t options = options || {};\n\t var deferred = jQuery.Deferred();\n\t var self = this;\n\t var limit = options.limitPerCall || self.limitPerProgressiveFetch;\n\t // TODO: only fetch tags and annotations if specifically requested\n\t var searchAttributes = HDA_MODEL.HistoryDatasetAssociation.prototype.searchAttributes;\n\t var detailKeys = searchAttributes.join(',');\n\t\n\t function _recursivelyFetch(offset) {\n\t offset = offset || 0;\n\t var _options = _.extend(_.clone(options), {\n\t view: 'summary',\n\t keys: detailKeys,\n\t limit: limit,\n\t offset: offset,\n\t reset: offset === 0,\n\t remove: false\n\t });\n\t\n\t _.defer(function () {\n\t self.fetch.call(self, _options).fail(deferred.reject).done(function (response) {\n\t deferred.notify(response, limit, offset);\n\t if (response.length !== limit) {\n\t self.allFetched = true;\n\t deferred.resolve(response, limit, offset);\n\t } else {\n\t _recursivelyFetch(offset + limit);\n\t }\n\t });\n\t });\n\t }\n\t _recursivelyFetch();\n\t return deferred;\n\t },\n\t\n\t /** does some bit of JSON represent something that can be copied into this contents collection */\n\t isCopyable: function (contentsJSON) {\n\t var copyableModelClasses = ['HistoryDatasetAssociation', 'HistoryDatasetCollectionAssociation'];\n\t return _.isObject(contentsJSON) && contentsJSON.id && _.contains(copyableModelClasses, contentsJSON.model_class);\n\t },\n\t\n\t /** copy an existing, accessible hda into this collection */\n\t copy: function (json) {\n\t // TODO: somehow showhorn all this into 'save'\n\t var id, type, contentType;\n\t if (_.isString(json)) {\n\t id = json;\n\t contentType = 'hda';\n\t type = 'dataset';\n\t } else {\n\t id = json.id;\n\t contentType = {\n\t 'HistoryDatasetAssociation': 'hda',\n\t 'LibraryDatasetDatasetAssociation': 'ldda',\n\t 'HistoryDatasetCollectionAssociation': 'hdca'\n\t }[json.model_class] || 'hda';\n\t type = contentType === 'hdca' ? 'dataset_collection' : 'dataset';\n\t }\n\t var collection = this,\n\t xhr = jQuery.ajax(this.url(), {\n\t method: 'POST',\n\t contentType: 'application/json',\n\t data: JSON.stringify({\n\t content: id,\n\t source: contentType,\n\t type: type\n\t })\n\t }).done(function (response) {\n\t collection.add([response], { parse: true });\n\t }).fail(function (error, status, message) {\n\t collection.trigger('error', collection, xhr, {}, 'Error copying contents', { type: type, id: id, source: contentType });\n\t });\n\t return xhr;\n\t },\n\t\n\t /** create a new HDCA in this collection */\n\t createHDCA: function (elementIdentifiers, collectionType, name, hideSourceItems, options) {\n\t // normally collection.create returns the new model, but we need the promise from the ajax, so we fake create\n\t //precondition: elementIdentifiers is an array of plain js objects\n\t // in the proper form to create the collectionType\n\t var hdca = this.model({\n\t history_content_type: 'dataset_collection',\n\t collection_type: collectionType,\n\t history_id: this.historyId,\n\t name: name,\n\t hide_source_items: hideSourceItems || false,\n\t // should probably be able to just send in a bunch of json here and restruct per class\n\t // note: element_identifiers is now (incorrectly) an attribute\n\t element_identifiers: elementIdentifiers\n\t // do not create the model on the client until the ajax returns\n\t });\n\t return hdca.save(options);\n\t },\n\t\n\t // ........................................................................ searching\n\t /** return true if all contents have the searchable attributes */\n\t haveSearchDetails: function () {\n\t return this.allFetched && this.all(function (content) {\n\t // null (which is a valid returned annotation value)\n\t // will return false when using content.has( 'annotation' )\n\t //TODO: a bit hacky - formalize\n\t return _.has(content.attributes, 'annotation');\n\t });\n\t },\n\t\n\t /** return a new collection of contents whose attributes contain the substring matchesWhat */\n\t matches: function (matchesWhat) {\n\t return this.filter(function (content) {\n\t return content.matches(matchesWhat);\n\t });\n\t },\n\t\n\t // ........................................................................ misc\n\t /** In this override, copy the historyId to the clone */\n\t clone: function () {\n\t var clone = Backbone.Collection.prototype.clone.call(this);\n\t clone.historyId = this.historyId;\n\t return clone;\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['HistoryContents(', [this.historyId, this.length].join(), ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HistoryContents: HistoryContents\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 65 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, jQuery, _, $) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(64), __webpack_require__(66), __webpack_require__(81), __webpack_require__(4), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HISTORY_CONTENTS, HISTORY_PREFS, CONTROLLED_FETCH_COLLECTION, UTILS, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /** @class Model for a Galaxy history resource - both a record of user\n\t * tool use and a collection of the datasets those tools produced.\n\t * @name History\n\t * @augments Backbone.Model\n\t */\n\t\n\t var History = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(BASE_MVC.mixin(BASE_MVC.SearchableModelMixin, /** @lends History.prototype */{\n\t _logNamespace: 'history',\n\t\n\t /** ms between fetches when checking running jobs/datasets for updates */\n\t UPDATE_DELAY: 4000,\n\t\n\t // values from api (may need more)\n\t defaults: {\n\t model_class: 'History',\n\t id: null,\n\t name: 'Unnamed History',\n\t state: 'new',\n\t\n\t deleted: false,\n\t contents_active: {},\n\t contents_states: {}\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/histories',\n\t\n\t contentsClass: HISTORY_CONTENTS.HistoryContents,\n\t\n\t /** What model fields to search with */\n\t searchAttributes: ['name', 'annotation', 'tags'],\n\t\n\t /** Adding title and singular tag */\n\t searchAliases: {\n\t title: 'name',\n\t tag: 'tags'\n\t },\n\t\n\t // ........................................................................ set up/tear down\n\t /** Set up the model\n\t * @param {Object} historyJSON model data for this History\n\t * @param {Object} options any extra settings including logger\n\t */\n\t initialize: function (historyJSON, options) {\n\t options = options || {};\n\t this.logger = options.logger || null;\n\t this.log(this + \".initialize:\", historyJSON, options);\n\t\n\t /** HistoryContents collection of the HDAs contained in this history. */\n\t this.contents = new this.contentsClass([], {\n\t history: this,\n\t historyId: this.get('id'),\n\t order: options.order\n\t });\n\t\n\t this._setUpListeners();\n\t this._setUpCollectionListeners();\n\t\n\t /** cached timeout id for the dataset updater */\n\t this.updateTimeoutId = null;\n\t },\n\t\n\t /** set up any event listeners for this history including those to the contained HDAs\n\t * events: error:contents if an error occurred with the contents collection\n\t */\n\t _setUpListeners: function () {\n\t // if the model's id changes ('current' or null -> an actual id), update the contents history_id\n\t return this.on({\n\t 'error': function (model, xhr, options, msg, details) {\n\t this.clearUpdateTimeout();\n\t },\n\t 'change:id': function (model, newId) {\n\t if (this.contents) {\n\t this.contents.historyId = newId;\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** event handlers for the contents submodels */\n\t _setUpCollectionListeners: function () {\n\t if (!this.contents) {\n\t return this;\n\t }\n\t // bubble up errors\n\t return this.listenTo(this.contents, {\n\t 'error': function () {\n\t this.trigger.apply(this, jQuery.makeArray(arguments));\n\t }\n\t });\n\t },\n\t\n\t // ........................................................................ derived attributes\n\t /** */\n\t contentsShown: function () {\n\t var contentsActive = this.get('contents_active');\n\t var shown = contentsActive.active || 0;\n\t shown += this.contents.includeDeleted ? contentsActive.deleted : 0;\n\t shown += this.contents.includeHidden ? contentsActive.hidden : 0;\n\t return shown;\n\t },\n\t\n\t /** convert size in bytes to a more human readable version */\n\t nice_size: function () {\n\t var size = this.get('size');\n\t return size ? UTILS.bytesToString(size, true, 2) : _l('(empty)');\n\t },\n\t\n\t /** override to add nice_size */\n\t toJSON: function () {\n\t return _.extend(Backbone.Model.prototype.toJSON.call(this), {\n\t nice_size: this.nice_size()\n\t });\n\t },\n\t\n\t /** override to allow getting nice_size */\n\t get: function (key) {\n\t if (key === 'nice_size') {\n\t return this.nice_size();\n\t }\n\t return Backbone.Model.prototype.get.apply(this, arguments);\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** T/F is this history owned by the current user (Galaxy.user)\n\t * Note: that this will return false for an anon user even if the history is theirs.\n\t */\n\t ownedByCurrUser: function () {\n\t // no currUser\n\t if (!Galaxy || !Galaxy.user) {\n\t return false;\n\t }\n\t // user is anon or history isn't owned\n\t if (Galaxy.user.isAnonymous() || Galaxy.user.id !== this.get('user_id')) {\n\t return false;\n\t }\n\t return true;\n\t },\n\t\n\t /** Return the number of running jobs assoc with this history (note: unknown === 0) */\n\t numOfUnfinishedJobs: function () {\n\t var unfinishedJobIds = this.get('non_ready_jobs');\n\t return unfinishedJobIds ? unfinishedJobIds.length : 0;\n\t },\n\t\n\t /** Return the number of running hda/hdcas in this history (note: unknown === 0) */\n\t numOfUnfinishedShownContents: function () {\n\t return this.contents.runningAndActive().length || 0;\n\t },\n\t\n\t // ........................................................................ updates\n\t _fetchContentRelatedAttributes: function () {\n\t var contentRelatedAttrs = ['size', 'non_ready_jobs', 'contents_active', 'hid_counter'];\n\t return this.fetch({ data: $.param({ keys: contentRelatedAttrs.join(',') }) });\n\t },\n\t\n\t /** check for any changes since the last time we updated (or fetch all if ) */\n\t refresh: function (options) {\n\t // console.log( this + '.refresh' );\n\t options = options || {};\n\t var self = this;\n\t\n\t // note if there was no previous update time, all summary contents will be fetched\n\t var lastUpdateTime = self.lastUpdateTime;\n\t // if we don't flip this, then a fully-fetched list will not be re-checked via fetch\n\t this.contents.allFetched = false;\n\t var fetchFn = self.contents.currentPage !== 0 ? function () {\n\t return self.contents.fetchPage(self.contents.currentPage);\n\t } : function () {\n\t return self.contents.fetchUpdated(lastUpdateTime);\n\t };\n\t // note: if there was no previous update time, all summary contents will be fetched\n\t return fetchFn().done(function (response, status, xhr) {\n\t var serverResponseDatetime;\n\t try {\n\t serverResponseDatetime = new Date(xhr.getResponseHeader('Date'));\n\t } catch (err) {}\n\t self.lastUpdateTime = serverResponseDatetime || new Date();\n\t self.checkForUpdates(options);\n\t });\n\t },\n\t\n\t /** continuously fetch updated contents every UPDATE_DELAY ms if this history's datasets or jobs are unfinished */\n\t checkForUpdates: function (options) {\n\t // console.log( this + '.checkForUpdates' );\n\t options = options || {};\n\t var delay = this.UPDATE_DELAY;\n\t var self = this;\n\t if (!self.id) {\n\t return;\n\t }\n\t\n\t function _delayThenUpdate() {\n\t // prevent buildup of updater timeouts by clearing previous if any, then set new and cache id\n\t self.clearUpdateTimeout();\n\t self.updateTimeoutId = setTimeout(function () {\n\t self.refresh(options);\n\t }, delay);\n\t }\n\t\n\t // if there are still datasets in the non-ready state, recurse into this function with the new time\n\t var nonReadyContentCount = this.numOfUnfinishedShownContents();\n\t // console.log( 'nonReadyContentCount:', nonReadyContentCount );\n\t if (nonReadyContentCount > 0) {\n\t _delayThenUpdate();\n\t } else {\n\t // no datasets are running, but currently runnning jobs may still produce new datasets\n\t // see if the history has any running jobs and continue to update if so\n\t // (also update the size for the user in either case)\n\t self._fetchContentRelatedAttributes().done(function (historyData) {\n\t // console.log( 'non_ready_jobs:', historyData.non_ready_jobs );\n\t if (self.numOfUnfinishedJobs() > 0) {\n\t _delayThenUpdate();\n\t } else {\n\t // otherwise, let listeners know that all updates have stopped\n\t self.trigger('ready');\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** clear the timeout and the cached timeout id */\n\t clearUpdateTimeout: function () {\n\t if (this.updateTimeoutId) {\n\t clearTimeout(this.updateTimeoutId);\n\t this.updateTimeoutId = null;\n\t }\n\t },\n\t\n\t // ........................................................................ ajax\n\t /** override to use actual Dates objects for create/update times */\n\t parse: function (response, options) {\n\t var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n\t if (parsed.create_time) {\n\t parsed.create_time = new Date(parsed.create_time);\n\t }\n\t if (parsed.update_time) {\n\t parsed.update_time = new Date(parsed.update_time);\n\t }\n\t return parsed;\n\t },\n\t\n\t /** fetch this histories data (using options) then it's contents (using contentsOptions) */\n\t fetchWithContents: function (options, contentsOptions) {\n\t options = options || {};\n\t var self = this;\n\t\n\t // console.log( this + '.fetchWithContents' );\n\t // TODO: push down to a base class\n\t options.view = 'dev-detailed';\n\t\n\t // fetch history then use history data to fetch (paginated) contents\n\t return this.fetch(options).then(function getContents(history) {\n\t self.contents.history = self;\n\t self.contents.setHistoryId(history.id);\n\t return self.fetchContents(contentsOptions);\n\t });\n\t },\n\t\n\t /** fetch this histories contents, adjusting options based on the stored history preferences */\n\t fetchContents: function (options) {\n\t options = options || {};\n\t var self = this;\n\t\n\t // we're updating, reset the update time\n\t self.lastUpdateTime = new Date();\n\t return self.contents.fetchCurrentPage(options);\n\t },\n\t\n\t /** save this history, _Mark_ing it as deleted (just a flag) */\n\t _delete: function (options) {\n\t if (this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true }, options);\n\t },\n\t /** purge this history, _Mark_ing it as purged and removing all dataset data from the server */\n\t purge: function (options) {\n\t if (this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true, purged: true }, options);\n\t },\n\t /** save this history, _Mark_ing it as undeleted */\n\t undelete: function (options) {\n\t if (!this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: false }, options);\n\t },\n\t\n\t /** Make a copy of this history on the server\n\t * @param {Boolean} current if true, set the copy as the new current history (default: true)\n\t * @param {String} name name of new history (default: none - server sets to: Copy of )\n\t * @fires copied passed this history and the response JSON from the copy\n\t * @returns {xhr}\n\t */\n\t copy: function (current, name, allDatasets) {\n\t current = current !== undefined ? current : true;\n\t if (!this.id) {\n\t throw new Error('You must set the history ID before copying it.');\n\t }\n\t\n\t var postData = { history_id: this.id };\n\t if (current) {\n\t postData.current = true;\n\t }\n\t if (name) {\n\t postData.name = name;\n\t }\n\t if (!allDatasets) {\n\t postData.all_datasets = false;\n\t }\n\t postData.view = 'dev-detailed';\n\t\n\t var history = this;\n\t var copy = jQuery.post(this.urlRoot, postData);\n\t // if current - queue to setAsCurrent before firing 'copied'\n\t if (current) {\n\t return copy.then(function (response) {\n\t var newHistory = new History(response);\n\t return newHistory.setAsCurrent().done(function () {\n\t history.trigger('copied', history, response);\n\t });\n\t });\n\t }\n\t return copy.done(function (response) {\n\t history.trigger('copied', history, response);\n\t });\n\t },\n\t\n\t setAsCurrent: function () {\n\t var history = this,\n\t xhr = jQuery.getJSON(Galaxy.root + 'history/set_as_current?id=' + this.id);\n\t\n\t xhr.done(function () {\n\t history.trigger('set-as-current', history);\n\t });\n\t return xhr;\n\t },\n\t\n\t // ........................................................................ misc\n\t toString: function () {\n\t return 'History(' + this.get('id') + ',' + this.get('name') + ')';\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t var _collectionSuper = CONTROLLED_FETCH_COLLECTION.InfinitelyScrollingCollection;\n\t /** @class A collection of histories (per user)\n\t * that maintains the current history as the first in the collection.\n\t * New or copied histories become the current history.\n\t */\n\t var HistoryCollection = _collectionSuper.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: 'history',\n\t\n\t model: History,\n\t /** @type {String} initial order used by collection */\n\t order: 'update_time',\n\t /** @type {Number} limit used for the first fetch (or a reset) */\n\t limitOnFirstFetch: 10,\n\t /** @type {Number} limit used for each subsequent fetch */\n\t limitPerFetch: 10,\n\t\n\t initialize: function (models, options) {\n\t options = options || {};\n\t this.log('HistoryCollection.initialize', models, options);\n\t _collectionSuper.prototype.initialize.call(this, models, options);\n\t\n\t /** @type {boolean} should deleted histories be included */\n\t this.includeDeleted = options.includeDeleted || false;\n\t\n\t /** @type {String} encoded id of the history that's current */\n\t this.currentHistoryId = options.currentHistoryId;\n\t\n\t this.setUpListeners();\n\t // note: models are sent to reset *after* this fn ends; up to this point\n\t // the collection *is empty*\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/histories',\n\t url: function () {\n\t return this.urlRoot;\n\t },\n\t\n\t /** set up reflexive event handlers */\n\t setUpListeners: function setUpListeners() {\n\t return this.on({\n\t // when a history is deleted, remove it from the collection (if optionally set to do so)\n\t 'change:deleted': function (history) {\n\t // TODO: this becomes complicated when more filters are used\n\t this.debug('change:deleted', this.includeDeleted, history.get('deleted'));\n\t if (!this.includeDeleted && history.get('deleted')) {\n\t this.remove(history);\n\t }\n\t },\n\t // listen for a history copy, setting it to current\n\t 'copied': function (original, newData) {\n\t this.setCurrent(new History(newData, []));\n\t },\n\t // when a history is made current, track the id in the collection\n\t 'set-as-current': function (history) {\n\t var oldCurrentId = this.currentHistoryId;\n\t this.trigger('no-longer-current', oldCurrentId);\n\t this.currentHistoryId = history.id;\n\t }\n\t });\n\t },\n\t\n\t /** override to change view */\n\t _buildFetchData: function (options) {\n\t return _.extend(_collectionSuper.prototype._buildFetchData.call(this, options), {\n\t view: 'dev-detailed'\n\t });\n\t },\n\t\n\t /** override to filter out deleted and purged */\n\t _buildFetchFilters: function (options) {\n\t var superFilters = _collectionSuper.prototype._buildFetchFilters.call(this, options) || {};\n\t var filters = {};\n\t if (!this.includeDeleted) {\n\t filters.deleted = false;\n\t filters.purged = false;\n\t } else {\n\t // force API to return both deleted and non\n\t //TODO: when the API is updated, remove this\n\t filters.deleted = null;\n\t }\n\t return _.defaults(superFilters, filters);\n\t },\n\t\n\t /** override to fetch current as well (as it may be outside the first 10, etc.) */\n\t fetchFirst: function (options) {\n\t var self = this;\n\t // TODO: batch?\n\t var xhr = $.when();\n\t if (this.currentHistoryId) {\n\t xhr = _collectionSuper.prototype.fetchFirst.call(self, {\n\t silent: true,\n\t limit: 1,\n\t filters: {\n\t // without these a deleted current history will return [] here and block the other xhr\n\t 'purged': '',\n\t 'deleted': '',\n\t 'encoded_id-in': this.currentHistoryId\n\t }\n\t });\n\t }\n\t return xhr.then(function () {\n\t options = options || {};\n\t options.offset = 0;\n\t return self.fetchMore(options);\n\t });\n\t },\n\t\n\t /** @type {Object} map of collection available sorting orders containing comparator fns */\n\t comparators: _.extend(_.clone(_collectionSuper.prototype.comparators), {\n\t 'name': BASE_MVC.buildComparator('name', { ascending: true }),\n\t 'name-dsc': BASE_MVC.buildComparator('name', { ascending: false }),\n\t 'size': BASE_MVC.buildComparator('size', { ascending: false }),\n\t 'size-asc': BASE_MVC.buildComparator('size', { ascending: true })\n\t }),\n\t\n\t /** override to always have the current history first */\n\t sort: function (options) {\n\t options = options || {};\n\t var silent = options.silent;\n\t var currentHistory = this.remove(this.get(this.currentHistoryId));\n\t _collectionSuper.prototype.sort.call(this, _.defaults({ silent: true }, options));\n\t this.unshift(currentHistory, { silent: true });\n\t if (!silent) {\n\t this.trigger('sort', this, options);\n\t }\n\t return this;\n\t },\n\t\n\t /** create a new history and by default set it to be the current history */\n\t create: function create(data, hdas, historyOptions, xhrOptions) {\n\t //TODO: .create is actually a collection function that's overridden here\n\t var collection = this,\n\t xhr = jQuery.getJSON(Galaxy.root + 'history/create_new_current');\n\t return xhr.done(function (newData) {\n\t collection.setCurrent(new History(newData, [], historyOptions || {}));\n\t });\n\t },\n\t\n\t /** set the current history to the given history, placing it first in the collection.\n\t * Pass standard bbone options for use in unshift.\n\t * @triggers new-current passed history and this collection\n\t */\n\t setCurrent: function (history, options) {\n\t options = options || {};\n\t // new histories go in the front\n\t this.unshift(history, options);\n\t this.currentHistoryId = history.get('id');\n\t if (!options.silent) {\n\t this.trigger('new-current', history, this);\n\t }\n\t return this;\n\t },\n\t\n\t toString: function toString() {\n\t return 'HistoryCollection(' + this.length + ',current:' + this.currentHistoryId + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t History: History,\n\t HistoryCollection: HistoryCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 66 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(7)], __WEBPACK_AMD_DEFINE_RESULT__ = function (BASE_MVC) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'history';\n\t\n\t // ============================================================================\n\t /** session storage for individual history preferences */\n\t var HistoryPrefs = BASE_MVC.SessionStorageModel.extend(\n\t /** @lends HistoryPrefs.prototype */{\n\t //TODO:?? move to user prefs?\n\t defaults: {\n\t //TODO:?? expandedIds to array?\n\t expandedIds: {},\n\t show_deleted: false,\n\t show_hidden: false\n\t },\n\t\n\t /** add an hda id to the hash of expanded hdas */\n\t addExpanded: function (model) {\n\t //TODO: use type_id and not model\n\t var current = this.get('expandedIds');\n\t current[model.id] = model.get('id');\n\t this.save('expandedIds', current);\n\t },\n\t\n\t /** remove an hda id from the hash of expanded hdas */\n\t removeExpanded: function (model) {\n\t var current = this.get('expandedIds');\n\t delete current[model.id];\n\t this.save('expandedIds', current);\n\t },\n\t\n\t isExpanded: function (contentId) {\n\t return _.result(this.get('expandedIds'), contentId, false);\n\t },\n\t\n\t allExpanded: function () {\n\t return _.values(this.get('expandedIds'));\n\t },\n\t\n\t clearExpanded: function () {\n\t this.set('expandedIds', {});\n\t },\n\t\n\t includeDeleted: function (val) {\n\t // moving the invocation here so other components don't need to know the key\n\t // TODO: change this key later\n\t if (!_.isUndefined(val)) {\n\t this.set('show_deleted', val);\n\t }\n\t return this.get('show_deleted');\n\t },\n\t\n\t includeHidden: function (val) {\n\t // TODO: change this key later\n\t if (!_.isUndefined(val)) {\n\t this.set('show_hidden', val);\n\t }\n\t return this.get('show_hidden');\n\t },\n\t\n\t toString: function () {\n\t return 'HistoryPrefs(' + this.id + ')';\n\t }\n\t\n\t }, {\n\t // ........................................................................ class vars\n\t // class lvl for access w/o instantiation\n\t storageKeyPrefix: 'history:',\n\t\n\t /** key string to store each histories settings under */\n\t historyStorageKey: function historyStorageKey(historyId) {\n\t if (!historyId) {\n\t throw new Error('HistoryPrefs.historyStorageKey needs valid id: ' + historyId);\n\t }\n\t // single point of change\n\t return HistoryPrefs.storageKeyPrefix + historyId;\n\t },\n\t\n\t /** return the existing storage for the history with the given id (or create one if it doesn't exist) */\n\t get: function get(historyId) {\n\t return new HistoryPrefs({ id: HistoryPrefs.historyStorageKey(historyId) });\n\t },\n\t\n\t /** clear all history related items in sessionStorage */\n\t clearAll: function clearAll(historyId) {\n\t for (var key in sessionStorage) {\n\t if (key.indexOf(HistoryPrefs.storageKeyPrefix) === 0) {\n\t sessionStorage.removeItem(key);\n\t }\n\t }\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HistoryPrefs: HistoryPrefs\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 67 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'list';\n\t //==============================================================================\n\t /** A view which, when first rendered, shows only summary data/attributes, but\n\t * can be expanded to show further details (and optionally fetch those\n\t * details from the server).\n\t */\n\t var ExpandableView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t //TODO: Although the reasoning behind them is different, this shares a lot with HiddenUntilActivated above: combine them\n\t //PRECONDITION: model must have method hasDetails\n\t //PRECONDITION: subclasses must have templates.el and templates.details\n\t\n\t initialize: function (attributes) {\n\t /** are the details of this view expanded/shown or not? */\n\t this.expanded = attributes.expanded || false;\n\t this.log('\\t expanded:', this.expanded);\n\t this.fxSpeed = attributes.fxSpeed !== undefined ? attributes.fxSpeed : this.fxSpeed;\n\t },\n\t\n\t // ........................................................................ render main\n\t /** jq fx speed */\n\t fxSpeed: 'fast',\n\t\n\t /** Render this content, set up ui.\n\t * @param {Number or String} speed the speed of the render\n\t */\n\t render: function (speed) {\n\t var $newRender = this._buildNewRender();\n\t this._setUpBehaviors($newRender);\n\t this._queueNewRender($newRender, speed);\n\t return this;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el.\n\t * If the view is already expanded, build the details as well.\n\t */\n\t _buildNewRender: function () {\n\t // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n\t var $newRender = $(this.templates.el(this.model.toJSON(), this));\n\t if (this.expanded) {\n\t this.$details($newRender).replaceWith(this._renderDetails().show());\n\t }\n\t return $newRender;\n\t },\n\t\n\t /** Fade out the old el, swap in the new contents, then fade in.\n\t * @param {Number or String} speed jq speed to use for rendering effects\n\t * @fires rendered when rendered\n\t */\n\t _queueNewRender: function ($newRender, speed) {\n\t speed = speed === undefined ? this.fxSpeed : speed;\n\t var view = this;\n\t\n\t if (speed === 0) {\n\t view._swapNewRender($newRender);\n\t view.trigger('rendered', view);\n\t } else {\n\t $(view).queue('fx', [function (next) {\n\t view.$el.fadeOut(speed, next);\n\t }, function (next) {\n\t view._swapNewRender($newRender);\n\t next();\n\t }, function (next) {\n\t view.$el.fadeIn(speed, next);\n\t }, function (next) {\n\t view.trigger('rendered', view);\n\t next();\n\t }]);\n\t }\n\t },\n\t\n\t /** empty out the current el, move the $newRender's children in */\n\t _swapNewRender: function ($newRender) {\n\t return this.$el.empty().attr('class', _.isFunction(this.className) ? this.className() : this.className).append($newRender.children());\n\t },\n\t\n\t /** set up js behaviors, event handlers for elements within the given container\n\t * @param {jQuery} $container jq object that contains the elements to process (defaults to this.$el)\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t // set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)\n\t //make_popup_menus( $where );\n\t $where.find('[title]').tooltip({ placement: 'bottom' });\n\t },\n\t\n\t // ......................................................................... details\n\t /** shortcut to details DOM (as jQ) */\n\t $details: function ($where) {\n\t $where = $where || this.$el;\n\t return $where.find('> .details');\n\t },\n\t\n\t /** build the DOM for the details and set up behaviors on it */\n\t _renderDetails: function () {\n\t var $newDetails = $(this.templates.details(this.model.toJSON(), this));\n\t this._setUpBehaviors($newDetails);\n\t return $newDetails;\n\t },\n\t\n\t // ......................................................................... expansion/details\n\t /** Show or hide the details\n\t * @param {Boolean} expand if true, expand; if false, collapse\n\t */\n\t toggleExpanded: function (expand) {\n\t expand = expand === undefined ? !this.expanded : expand;\n\t if (expand) {\n\t this.expand();\n\t } else {\n\t this.collapse();\n\t }\n\t return this;\n\t },\n\t\n\t /** Render and show the full, detailed body of this view including extra data and controls.\n\t * note: if the model does not have detailed data, fetch that data before showing the body\n\t * @fires expanded when a body has been expanded\n\t */\n\t expand: function () {\n\t var view = this;\n\t return view._fetchModelDetails().always(function () {\n\t view._expand();\n\t });\n\t },\n\t\n\t /** Check for model details and, if none, fetch them.\n\t * @returns {jQuery.promise} the model.fetch.xhr if details are being fetched, an empty promise if not\n\t */\n\t _fetchModelDetails: function () {\n\t if (!this.model.hasDetails()) {\n\t return this.model.fetch();\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** Inner fn called when expand (public) has fetched the details */\n\t _expand: function () {\n\t var view = this,\n\t $newDetails = view._renderDetails();\n\t view.$details().replaceWith($newDetails);\n\t // needs to be set after the above or the slide will not show\n\t view.expanded = true;\n\t view.$details().slideDown(view.fxSpeed, function () {\n\t view.trigger('expanded', view);\n\t });\n\t },\n\t\n\t /** Hide the body/details of an HDA.\n\t * @fires collapsed when a body has been collapsed\n\t */\n\t collapse: function () {\n\t this.debug(this + '(ExpandableView).collapse');\n\t var view = this;\n\t view.expanded = false;\n\t this.$details().slideUp(view.fxSpeed, function () {\n\t view.trigger('collapsed', view);\n\t });\n\t }\n\t\n\t });\n\t\n\t //==============================================================================\n\t /** A view that is displayed in some larger list/grid/collection.\n\t * Inherits from Expandable, Selectable, Draggable.\n\t * The DOM contains warnings, a title bar, and a series of primary action controls.\n\t * Primary actions are meant to be easily accessible item functions (such as delete)\n\t * that are rendered in the title bar.\n\t *\n\t * Details are rendered when the user clicks the title bar or presses enter/space when\n\t * the title bar is in focus.\n\t *\n\t * Designed as a base class for history panel contents - but usable elsewhere (I hope).\n\t */\n\t var ListItemView = ExpandableView.extend(BASE_MVC.mixin(BASE_MVC.SelectableViewMixin, BASE_MVC.DraggableViewMixin, {\n\t\n\t tagName: 'div',\n\t className: 'list-item',\n\t\n\t /** Set up the base class and all mixins */\n\t initialize: function (attributes) {\n\t ExpandableView.prototype.initialize.call(this, attributes);\n\t BASE_MVC.SelectableViewMixin.initialize.call(this, attributes);\n\t BASE_MVC.DraggableViewMixin.initialize.call(this, attributes);\n\t this._setUpListeners();\n\t },\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t // hide the primary actions in the title bar when selectable and narrow\n\t this.on('selectable', function (isSelectable) {\n\t if (isSelectable) {\n\t this.$('.primary-actions').hide();\n\t } else {\n\t this.$('.primary-actions').show();\n\t }\n\t }, this);\n\t return this;\n\t },\n\t\n\t // ........................................................................ rendering\n\t /** In this override, call methods to build warnings, titlebar and primary actions */\n\t _buildNewRender: function () {\n\t var $newRender = ExpandableView.prototype._buildNewRender.call(this);\n\t $newRender.children('.warnings').replaceWith(this._renderWarnings());\n\t $newRender.children('.title-bar').replaceWith(this._renderTitleBar());\n\t $newRender.children('.primary-actions').append(this._renderPrimaryActions());\n\t $newRender.find('> .title-bar .subtitle').replaceWith(this._renderSubtitle());\n\t return $newRender;\n\t },\n\t\n\t /** In this override, render the selector controls and set up dragging before the swap */\n\t _swapNewRender: function ($newRender) {\n\t ExpandableView.prototype._swapNewRender.call(this, $newRender);\n\t if (this.selectable) {\n\t this.showSelector(0);\n\t }\n\t if (this.draggable) {\n\t this.draggableOn();\n\t }\n\t return this.$el;\n\t },\n\t\n\t /** Render any warnings the item may need to show (e.g. \"I'm deleted\") */\n\t _renderWarnings: function () {\n\t var view = this,\n\t $warnings = $('
                                            '),\n\t json = view.model.toJSON();\n\t //TODO:! unordered (map)\n\t _.each(view.templates.warnings, function (templateFn) {\n\t $warnings.append($(templateFn(json, view)));\n\t });\n\t return $warnings;\n\t },\n\t\n\t /** Render the title bar (the main/exposed SUMMARY dom element) */\n\t _renderTitleBar: function () {\n\t return $(this.templates.titleBar(this.model.toJSON(), this));\n\t },\n\t\n\t /** Return an array of jQ objects containing common/easily-accessible item controls */\n\t _renderPrimaryActions: function () {\n\t // override this\n\t return [];\n\t },\n\t\n\t /** Render the title bar (the main/exposed SUMMARY dom element) */\n\t _renderSubtitle: function () {\n\t return $(this.templates.subtitle(this.model.toJSON(), this));\n\t },\n\t\n\t // ......................................................................... events\n\t /** event map */\n\t events: {\n\t // expand the body when the title is clicked or when in focus and space or enter is pressed\n\t 'click .title-bar': '_clickTitleBar',\n\t 'keydown .title-bar': '_keyDownTitleBar',\n\t 'click .selector': 'toggleSelect'\n\t },\n\t\n\t /** expand when the title bar is clicked */\n\t _clickTitleBar: function (event) {\n\t event.stopPropagation();\n\t if (event.altKey) {\n\t this.toggleSelect(event);\n\t if (!this.selectable) {\n\t this.showSelector();\n\t }\n\t } else {\n\t this.toggleExpanded();\n\t }\n\t },\n\t\n\t /** expand when the title bar is in focus and enter or space is pressed */\n\t _keyDownTitleBar: function (event) {\n\t // bail (with propagation) if keydown and not space or enter\n\t var KEYCODE_SPACE = 32,\n\t KEYCODE_RETURN = 13;\n\t if (event && event.type === 'keydown' && (event.keyCode === KEYCODE_SPACE || event.keyCode === KEYCODE_RETURN)) {\n\t this.toggleExpanded();\n\t event.stopPropagation();\n\t return false;\n\t }\n\t return true;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'ListItemView(' + modelString + ')';\n\t }\n\t }));\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t ListItemView.prototype.templates = function () {\n\t\n\t var elTemplato = BASE_MVC.wrapTemplate(['
                                            ',\n\t // errors, messages, etc.\n\t '
                                            ',\n\t\n\t // multi-select checkbox\n\t '
                                            ', '', '
                                            ',\n\t // space for title bar buttons - gen. floated to the right\n\t '
                                            ', '
                                            ',\n\t\n\t // expandable area for more details\n\t '
                                            ', '
                                            ']);\n\t\n\t var warnings = {};\n\t\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t // adding a tabindex here allows focusing the title bar and the use of keydown to expand the dataset display\n\t '
                                            ',\n\t //TODO: prob. belongs in dataset-list-item\n\t '', '
                                            ', '<%- element.name %>', '
                                            ', '
                                            ', '
                                            '], 'element');\n\t\n\t var subtitleTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
                                            ']);\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
                                            ']);\n\t\n\t return {\n\t el: elTemplato,\n\t warnings: warnings,\n\t titleBar: titleBarTemplate,\n\t subtitle: subtitleTemplate,\n\t details: detailsTemplate\n\t };\n\t }();\n\t\n\t //==============================================================================\n\t /** A view that is displayed in some larger list/grid/collection.\n\t * *AND* can display some sub-list of it's own when expanded (e.g. dataset collections).\n\t * This list will 'foldout' when the item is expanded depending on this.foldoutStyle:\n\t * If 'foldout': will expand vertically to show the nested list\n\t * If 'drilldown': will overlay the parent list\n\t *\n\t * Inherits from ListItemView.\n\t *\n\t * _renderDetails does the work of creating this.details: a sub-view that shows the nested list\n\t */\n\t var FoldoutListItemView = ListItemView.extend({\n\t\n\t /** If 'foldout': show the sub-panel inside the expanded item\n\t * If 'drilldown': only fire events and handle by pub-sub\n\t * (allow the panel containing this item to attach it, hide itself, etc.)\n\t */\n\t foldoutStyle: 'foldout',\n\t /** Panel view class to instantiate for the sub-panel */\n\t foldoutPanelClass: null,\n\t\n\t /** override to:\n\t * add attributes foldoutStyle and foldoutPanelClass for config poly\n\t * disrespect attributes.expanded if drilldown\n\t */\n\t initialize: function (attributes) {\n\t if (this.foldoutStyle === 'drilldown') {\n\t this.expanded = false;\n\t }\n\t this.foldoutStyle = attributes.foldoutStyle || this.foldoutStyle;\n\t this.foldoutPanelClass = attributes.foldoutPanelClass || this.foldoutPanelClass;\n\t\n\t ListItemView.prototype.initialize.call(this, attributes);\n\t this.foldout = this._createFoldoutPanel();\n\t },\n\t\n\t /** in this override, attach the foldout panel when rendering details */\n\t _renderDetails: function () {\n\t if (this.foldoutStyle === 'drilldown') {\n\t return $();\n\t }\n\t var $newDetails = ListItemView.prototype._renderDetails.call(this);\n\t return this._attachFoldout(this.foldout, $newDetails);\n\t },\n\t\n\t /** In this override, handle collection expansion. */\n\t _createFoldoutPanel: function () {\n\t var model = this.model;\n\t var FoldoutClass = this._getFoldoutPanelClass(model),\n\t options = this._getFoldoutPanelOptions(model),\n\t foldout = new FoldoutClass(_.extend(options, {\n\t model: model\n\t }));\n\t return foldout;\n\t },\n\t\n\t /** Stub to return proper foldout panel class */\n\t _getFoldoutPanelClass: function () {\n\t // override\n\t return this.foldoutPanelClass;\n\t },\n\t\n\t /** Stub to return proper foldout panel options */\n\t _getFoldoutPanelOptions: function () {\n\t return {\n\t // propagate foldout style down\n\t foldoutStyle: this.foldoutStyle,\n\t fxSpeed: this.fxSpeed\n\t };\n\t },\n\t\n\t /** Render the foldout panel inside the view, hiding controls */\n\t _attachFoldout: function (foldout, $whereTo) {\n\t $whereTo = $whereTo || this.$('> .details');\n\t this.foldout = foldout.render(0);\n\t foldout.$('> .controls').hide();\n\t return $whereTo.append(foldout.$el);\n\t },\n\t\n\t /** In this override, branch on foldoutStyle to show expanded */\n\t expand: function () {\n\t var view = this;\n\t return view._fetchModelDetails().always(function () {\n\t if (view.foldoutStyle === 'foldout') {\n\t view._expand();\n\t } else if (view.foldoutStyle === 'drilldown') {\n\t view._expandByDrilldown();\n\t }\n\t });\n\t },\n\t\n\t /** For drilldown, set up close handler and fire expanded:drilldown\n\t * containing views can listen to this and handle other things\n\t * (like hiding themselves) by listening for expanded/collapsed:drilldown\n\t */\n\t _expandByDrilldown: function () {\n\t var view = this;\n\t // attachment and rendering done by listener\n\t view.listenTo(view.foldout, 'close', function () {\n\t view.trigger('collapsed:drilldown', view, view.foldout);\n\t });\n\t view.trigger('expanded:drilldown', view, view.foldout);\n\t }\n\t\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t FoldoutListItemView.prototype.templates = function () {\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate(['
                                            ',\n\t // override with more info (that goes above the panel)\n\t '
                                            '], 'collection');\n\t\n\t return _.extend({}, ListItemView.prototype.templates, {\n\t details: detailsTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t ExpandableView: ExpandableView,\n\t ListItemView: ListItemView,\n\t FoldoutListItemView: FoldoutListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 68 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {/**\n\t * Model, view, and controller objects for Galaxy tools and tool panel.\n\t */\n\t\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3), __webpack_require__(27), __webpack_require__(16), __webpack_require__(47)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_, util, data, ToolForm) {\n\t 'use strict';\n\t\n\t /**\n\t * Mixin for tracking model visibility.\n\t */\n\t\n\t var VisibilityMixin = {\n\t hidden: false,\n\t\n\t show: function () {\n\t this.set(\"hidden\", false);\n\t },\n\t\n\t hide: function () {\n\t this.set(\"hidden\", true);\n\t },\n\t\n\t toggle: function () {\n\t this.set(\"hidden\", !this.get(\"hidden\"));\n\t },\n\t\n\t is_visible: function () {\n\t return !this.attributes.hidden;\n\t }\n\t\n\t };\n\t\n\t /**\n\t * A tool parameter.\n\t */\n\t var ToolParameter = Backbone.Model.extend({\n\t defaults: {\n\t name: null,\n\t label: null,\n\t type: null,\n\t value: null,\n\t html: null,\n\t num_samples: 5\n\t },\n\t\n\t initialize: function (options) {\n\t this.attributes.html = unescape(this.attributes.html);\n\t },\n\t\n\t copy: function () {\n\t return new ToolParameter(this.toJSON());\n\t },\n\t\n\t set_value: function (value) {\n\t this.set('value', value || '');\n\t }\n\t });\n\t\n\t var ToolParameterCollection = Backbone.Collection.extend({\n\t model: ToolParameter\n\t });\n\t\n\t /**\n\t * A data tool parameter.\n\t */\n\t var DataToolParameter = ToolParameter.extend({});\n\t\n\t /**\n\t * An integer tool parameter.\n\t */\n\t var IntegerToolParameter = ToolParameter.extend({\n\t set_value: function (value) {\n\t this.set('value', parseInt(value, 10));\n\t },\n\t\n\t /**\n\t * Returns samples from a tool input.\n\t */\n\t get_samples: function () {\n\t return d3.scale.linear().domain([this.get('min'), this.get('max')]).ticks(this.get('num_samples'));\n\t }\n\t });\n\t\n\t var FloatToolParameter = IntegerToolParameter.extend({\n\t set_value: function (value) {\n\t this.set('value', parseFloat(value));\n\t }\n\t });\n\t\n\t /**\n\t * A select tool parameter.\n\t */\n\t var SelectToolParameter = ToolParameter.extend({\n\t /**\n\t * Returns tool options.\n\t */\n\t get_samples: function () {\n\t return _.map(this.get('options'), function (option) {\n\t return option[0];\n\t });\n\t }\n\t });\n\t\n\t // Set up dictionary of parameter types.\n\t ToolParameter.subModelTypes = {\n\t 'integer': IntegerToolParameter,\n\t 'float': FloatToolParameter,\n\t 'data': DataToolParameter,\n\t 'select': SelectToolParameter\n\t };\n\t\n\t /**\n\t * A Galaxy tool.\n\t */\n\t var Tool = Backbone.Model.extend({\n\t // Default attributes.\n\t defaults: {\n\t id: null,\n\t name: null,\n\t description: null,\n\t target: null,\n\t inputs: [],\n\t outputs: []\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/tools',\n\t\n\t initialize: function (options) {\n\t\n\t // Set parameters.\n\t this.set('inputs', new ToolParameterCollection(_.map(options.inputs, function (p) {\n\t var p_class = ToolParameter.subModelTypes[p.type] || ToolParameter;\n\t return new p_class(p);\n\t })));\n\t },\n\t\n\t /**\n\t *\n\t */\n\t toJSON: function () {\n\t var rval = Backbone.Model.prototype.toJSON.call(this);\n\t\n\t // Convert inputs to JSON manually.\n\t rval.inputs = this.get('inputs').map(function (i) {\n\t return i.toJSON();\n\t });\n\t return rval;\n\t },\n\t\n\t /**\n\t * Removes inputs of a particular type; this is useful because not all inputs can be handled by\n\t * client and server yet.\n\t */\n\t remove_inputs: function (types) {\n\t var tool = this,\n\t incompatible_inputs = tool.get('inputs').filter(function (input) {\n\t return types.indexOf(input.get('type')) !== -1;\n\t });\n\t tool.get('inputs').remove(incompatible_inputs);\n\t },\n\t\n\t /**\n\t * Returns object copy, optionally including only inputs that can be sampled.\n\t */\n\t copy: function (only_samplable_inputs) {\n\t var copy = new Tool(this.toJSON());\n\t\n\t // Return only samplable inputs if flag is set.\n\t if (only_samplable_inputs) {\n\t var valid_inputs = new Backbone.Collection();\n\t copy.get('inputs').each(function (input) {\n\t if (input.get_samples()) {\n\t valid_inputs.push(input);\n\t }\n\t });\n\t copy.set('inputs', valid_inputs);\n\t }\n\t\n\t return copy;\n\t },\n\t\n\t apply_search_results: function (results) {\n\t _.indexOf(results, this.attributes.id) !== -1 ? this.show() : this.hide();\n\t return this.is_visible();\n\t },\n\t\n\t /**\n\t * Set a tool input's value.\n\t */\n\t set_input_value: function (name, value) {\n\t this.get('inputs').find(function (input) {\n\t return input.get('name') === name;\n\t }).set('value', value);\n\t },\n\t\n\t /**\n\t * Set many input values at once.\n\t */\n\t set_input_values: function (inputs_dict) {\n\t var self = this;\n\t _.each(_.keys(inputs_dict), function (input_name) {\n\t self.set_input_value(input_name, inputs_dict[input_name]);\n\t });\n\t },\n\t\n\t /**\n\t * Run tool; returns a Deferred that resolves to the tool's output(s).\n\t */\n\t run: function () {\n\t return this._run();\n\t },\n\t\n\t /**\n\t * Rerun tool using regions and a target dataset.\n\t */\n\t rerun: function (target_dataset, regions) {\n\t return this._run({\n\t action: 'rerun',\n\t target_dataset_id: target_dataset.id,\n\t regions: regions\n\t });\n\t },\n\t\n\t /**\n\t * Returns input dict for tool's inputs.\n\t */\n\t get_inputs_dict: function () {\n\t var input_dict = {};\n\t this.get('inputs').each(function (input) {\n\t input_dict[input.get('name')] = input.get('value');\n\t });\n\t return input_dict;\n\t },\n\t\n\t /**\n\t * Run tool; returns a Deferred that resolves to the tool's output(s).\n\t * NOTE: this method is a helper method and should not be called directly.\n\t */\n\t _run: function (additional_params) {\n\t // Create payload.\n\t var payload = _.extend({\n\t tool_id: this.id,\n\t inputs: this.get_inputs_dict()\n\t }, additional_params);\n\t\n\t // Because job may require indexing datasets, use server-side\n\t // deferred to ensure that job is run. Also use deferred that\n\t // resolves to outputs from tool.\n\t var run_deferred = $.Deferred(),\n\t ss_deferred = new util.ServerStateDeferred({\n\t ajax_settings: {\n\t url: this.urlRoot,\n\t data: JSON.stringify(payload),\n\t dataType: \"json\",\n\t contentType: 'application/json',\n\t type: \"POST\"\n\t },\n\t interval: 2000,\n\t success_fn: function (response) {\n\t return response !== \"pending\";\n\t }\n\t });\n\t\n\t // Run job and resolve run_deferred to tool outputs.\n\t $.when(ss_deferred.go()).then(function (result) {\n\t run_deferred.resolve(new data.DatasetCollection(result));\n\t });\n\t return run_deferred;\n\t }\n\t });\n\t _.extend(Tool.prototype, VisibilityMixin);\n\t\n\t /**\n\t * Tool view.\n\t */\n\t var ToolView = Backbone.View.extend({});\n\t\n\t /**\n\t * Wrap collection of tools for fast access/manipulation.\n\t */\n\t var ToolCollection = Backbone.Collection.extend({\n\t model: Tool\n\t });\n\t\n\t /**\n\t * Label or section header in tool panel.\n\t */\n\t var ToolSectionLabel = Backbone.Model.extend(VisibilityMixin);\n\t\n\t /**\n\t * Section of tool panel with elements (labels and tools).\n\t */\n\t var ToolSection = Backbone.Model.extend({\n\t defaults: {\n\t elems: [],\n\t open: false\n\t },\n\t\n\t clear_search_results: function () {\n\t _.each(this.attributes.elems, function (elt) {\n\t elt.show();\n\t });\n\t\n\t this.show();\n\t this.set(\"open\", false);\n\t },\n\t\n\t apply_search_results: function (results) {\n\t var all_hidden = true,\n\t cur_label;\n\t _.each(this.attributes.elems, function (elt) {\n\t if (elt instanceof ToolSectionLabel) {\n\t cur_label = elt;\n\t cur_label.hide();\n\t } else if (elt instanceof Tool) {\n\t if (elt.apply_search_results(results)) {\n\t all_hidden = false;\n\t if (cur_label) {\n\t cur_label.show();\n\t }\n\t }\n\t }\n\t });\n\t\n\t if (all_hidden) {\n\t this.hide();\n\t } else {\n\t this.show();\n\t this.set(\"open\", true);\n\t }\n\t }\n\t });\n\t _.extend(ToolSection.prototype, VisibilityMixin);\n\t\n\t /**\n\t * Tool search that updates results when query is changed. Result value of null\n\t * indicates that query was not run; if not null, results are from search using\n\t * query.\n\t */\n\t var ToolSearch = Backbone.Model.extend({\n\t defaults: {\n\t search_hint_string: \"search tools\",\n\t min_chars_for_search: 3,\n\t clear_btn_url: \"\",\n\t visible: true,\n\t query: \"\",\n\t results: null,\n\t // ESC (27) will clear the input field and tool search filters\n\t clear_key: 27\n\t },\n\t\n\t urlRoot: Galaxy.root + 'api/tools',\n\t\n\t initialize: function () {\n\t this.on(\"change:query\", this.do_search);\n\t },\n\t\n\t /**\n\t * Do the search and update the results.\n\t */\n\t do_search: function () {\n\t var query = this.attributes.query;\n\t\n\t // If query is too short, do not search.\n\t if (query.length < this.attributes.min_chars_for_search) {\n\t this.set(\"results\", null);\n\t return;\n\t }\n\t\n\t // Do search via AJAX.\n\t var q = query;\n\t // Stop previous ajax-request\n\t if (this.timer) {\n\t clearTimeout(this.timer);\n\t }\n\t // Start a new ajax-request in X ms\n\t $(\"#search-clear-btn\").hide();\n\t $(\"#search-spinner\").show();\n\t var self = this;\n\t this.timer = setTimeout(function () {\n\t // log the search to analytics if present\n\t if (typeof ga !== 'undefined') {\n\t ga('send', 'pageview', Galaxy.root + '?q=' + q);\n\t }\n\t $.get(self.urlRoot, { q: q }, function (data) {\n\t self.set(\"results\", data);\n\t $(\"#search-spinner\").hide();\n\t $(\"#search-clear-btn\").show();\n\t }, \"json\");\n\t }, 400);\n\t },\n\t\n\t clear_search: function () {\n\t this.set(\"query\", \"\");\n\t this.set(\"results\", null);\n\t }\n\t\n\t });\n\t _.extend(ToolSearch.prototype, VisibilityMixin);\n\t\n\t /**\n\t * Tool Panel.\n\t */\n\t var ToolPanel = Backbone.Model.extend({\n\t\n\t initialize: function (options) {\n\t this.attributes.tool_search = options.tool_search;\n\t this.attributes.tool_search.on(\"change:results\", this.apply_search_results, this);\n\t this.attributes.tools = options.tools;\n\t this.attributes.layout = new Backbone.Collection(this.parse(options.layout));\n\t },\n\t\n\t /**\n\t * Parse tool panel dictionary and return collection of tool panel elements.\n\t */\n\t parse: function (response) {\n\t // Recursive function to parse tool panel elements.\n\t var self = this,\n\t\n\t // Helper to recursively parse tool panel.\n\t parse_elt = function (elt_dict) {\n\t var type = elt_dict.model_class;\n\t // There are many types of tools; for now, anything that ends in 'Tool'\n\t // is treated as a generic tool.\n\t if (type.indexOf('Tool') === type.length - 4) {\n\t return self.attributes.tools.get(elt_dict.id);\n\t } else if (type === 'ToolSection') {\n\t // Parse elements.\n\t var elems = _.map(elt_dict.elems, parse_elt);\n\t elt_dict.elems = elems;\n\t return new ToolSection(elt_dict);\n\t } else if (type === 'ToolSectionLabel') {\n\t return new ToolSectionLabel(elt_dict);\n\t }\n\t };\n\t\n\t return _.map(response, parse_elt);\n\t },\n\t\n\t clear_search_results: function () {\n\t this.get('layout').each(function (panel_elt) {\n\t if (panel_elt instanceof ToolSection) {\n\t panel_elt.clear_search_results();\n\t } else {\n\t // Label or tool, so just show.\n\t panel_elt.show();\n\t }\n\t });\n\t },\n\t\n\t apply_search_results: function () {\n\t var results = this.get('tool_search').get('results');\n\t if (results === null) {\n\t this.clear_search_results();\n\t return;\n\t }\n\t\n\t var cur_label = null;\n\t this.get('layout').each(function (panel_elt) {\n\t if (panel_elt instanceof ToolSectionLabel) {\n\t cur_label = panel_elt;\n\t cur_label.hide();\n\t } else if (panel_elt instanceof Tool) {\n\t if (panel_elt.apply_search_results(results)) {\n\t if (cur_label) {\n\t cur_label.show();\n\t }\n\t }\n\t } else {\n\t // Starting new section, so clear current label.\n\t cur_label = null;\n\t panel_elt.apply_search_results(results);\n\t }\n\t });\n\t }\n\t });\n\t\n\t /**\n\t * View classes for Galaxy tools and tool panel.\n\t *\n\t * Views use the templates defined below for rendering. Views update as needed\n\t * based on (a) model/collection events and (b) user interactions; in this sense,\n\t * they are controllers are well and the HTML is the real view in the MVC architecture.\n\t */\n\t\n\t /**\n\t * Base view that handles visibility based on model's hidden attribute.\n\t */\n\t var BaseView = Backbone.View.extend({\n\t initialize: function () {\n\t this.model.on(\"change:hidden\", this.update_visible, this);\n\t this.update_visible();\n\t },\n\t update_visible: function () {\n\t this.model.attributes.hidden ? this.$el.hide() : this.$el.show();\n\t }\n\t });\n\t\n\t /**\n\t * Link to a tool.\n\t */\n\t var ToolLinkView = BaseView.extend({\n\t tagName: 'div',\n\t\n\t render: function () {\n\t // create element\n\t var $link = $('
                                            ');\n\t $link.append(templates.tool_link(this.model.toJSON()));\n\t\n\t var formStyle = this.model.get('form_style', null);\n\t // open upload dialog for upload tool\n\t if (this.model.id === 'upload1') {\n\t $link.find('a').on('click', function (e) {\n\t e.preventDefault();\n\t Galaxy.upload.show();\n\t });\n\t } else if (formStyle === 'regular') {\n\t // regular tools\n\t var self = this;\n\t $link.find('a').on('click', function (e) {\n\t e.preventDefault();\n\t Galaxy.router.push('/', { tool_id: self.model.id, version: self.model.get('version') });\n\t });\n\t }\n\t\n\t // add element\n\t this.$el.append($link);\n\t return this;\n\t }\n\t });\n\t\n\t /**\n\t * Panel label/section header.\n\t */\n\t var ToolSectionLabelView = BaseView.extend({\n\t tagName: 'div',\n\t className: 'toolPanelLabel',\n\t\n\t render: function () {\n\t this.$el.append($(\"\").text(this.model.attributes.text));\n\t return this;\n\t }\n\t });\n\t\n\t /**\n\t * Panel section.\n\t */\n\t var ToolSectionView = BaseView.extend({\n\t tagName: 'div',\n\t className: 'toolSectionWrapper',\n\t\n\t initialize: function () {\n\t BaseView.prototype.initialize.call(this);\n\t this.model.on(\"change:open\", this.update_open, this);\n\t },\n\t\n\t render: function () {\n\t // Build using template.\n\t this.$el.append(templates.panel_section(this.model.toJSON()));\n\t\n\t // Add tools to section.\n\t var section_body = this.$el.find(\".toolSectionBody\");\n\t _.each(this.model.attributes.elems, function (elt) {\n\t if (elt instanceof Tool) {\n\t var tool_view = new ToolLinkView({ model: elt, className: \"toolTitle\" });\n\t tool_view.render();\n\t section_body.append(tool_view.$el);\n\t } else if (elt instanceof ToolSectionLabel) {\n\t var label_view = new ToolSectionLabelView({ model: elt });\n\t label_view.render();\n\t section_body.append(label_view.$el);\n\t } else {\n\t // TODO: handle nested section bodies?\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t events: {\n\t 'click .toolSectionTitle > a': 'toggle'\n\t },\n\t\n\t /**\n\t * Toggle visibility of tool section.\n\t */\n\t toggle: function () {\n\t this.model.set(\"open\", !this.model.attributes.open);\n\t },\n\t\n\t /**\n\t * Update whether section is open or close.\n\t */\n\t update_open: function () {\n\t this.model.attributes.open ? this.$el.children(\".toolSectionBody\").slideDown(\"fast\") : this.$el.children(\".toolSectionBody\").slideUp(\"fast\");\n\t }\n\t });\n\t\n\t var ToolSearchView = Backbone.View.extend({\n\t tagName: 'div',\n\t id: 'tool-search',\n\t className: 'bar',\n\t\n\t events: {\n\t 'click': 'focus_and_select',\n\t 'keyup :input': 'query_changed',\n\t 'change :input': 'query_changed',\n\t 'click #search-clear-btn': 'clear'\n\t },\n\t\n\t render: function () {\n\t this.$el.append(templates.tool_search(this.model.toJSON()));\n\t if (!this.model.is_visible()) {\n\t this.$el.hide();\n\t }\n\t\n\t // Adjust top for issue 2907 depending on whether the messagebox is visible.\n\t if ($(\"#messagebox\").is(\":visible\")) {\n\t this.$el.css(\"top\", \"95px\");\n\t }\n\t\n\t this.$el.find('[title]').tooltip();\n\t return this;\n\t },\n\t\n\t focus_and_select: function () {\n\t this.$el.find(\":input\").focus().select();\n\t },\n\t\n\t clear: function () {\n\t this.model.clear_search();\n\t this.$el.find(\":input\").val('');\n\t this.focus_and_select();\n\t return false;\n\t },\n\t\n\t query_changed: function (evData) {\n\t // check for the 'clear key' (ESC) first\n\t if (this.model.attributes.clear_key && this.model.attributes.clear_key === evData.which) {\n\t this.clear();\n\t return false;\n\t }\n\t this.model.set(\"query\", this.$el.find(\":input\").val());\n\t }\n\t });\n\t\n\t /**\n\t * Tool panel view. Events triggered include:\n\t * tool_link_click(click event, tool_model)\n\t */\n\t var ToolPanelView = Backbone.View.extend({\n\t tagName: 'div',\n\t className: 'toolMenu',\n\t\n\t /**\n\t * Set up view.\n\t */\n\t initialize: function () {\n\t this.model.get('tool_search').on(\"change:results\", this.handle_search_results, this);\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t\n\t // Render search.\n\t var search_view = new ToolSearchView({ model: this.model.get('tool_search') });\n\t search_view.render();\n\t self.$el.append(search_view.$el);\n\t\n\t // Render panel.\n\t this.model.get('layout').each(function (panel_elt) {\n\t if (panel_elt instanceof ToolSection) {\n\t var section_title_view = new ToolSectionView({ model: panel_elt });\n\t section_title_view.render();\n\t self.$el.append(section_title_view.$el);\n\t } else if (panel_elt instanceof Tool) {\n\t var tool_view = new ToolLinkView({ model: panel_elt, className: \"toolTitleNoSection\" });\n\t tool_view.render();\n\t self.$el.append(tool_view.$el);\n\t } else if (panel_elt instanceof ToolSectionLabel) {\n\t var label_view = new ToolSectionLabelView({ model: panel_elt });\n\t label_view.render();\n\t self.$el.append(label_view.$el);\n\t }\n\t });\n\t\n\t // Setup tool link click eventing.\n\t self.$el.find(\"a.tool-link\").click(function (e) {\n\t // Tool id is always the first class.\n\t var tool_id = $(this).attr('class').split(/\\s+/)[0],\n\t tool = self.model.get('tools').get(tool_id);\n\t\n\t self.trigger(\"tool_link_click\", e, tool);\n\t });\n\t\n\t return this;\n\t },\n\t\n\t handle_search_results: function () {\n\t var results = this.model.get('tool_search').get('results');\n\t if (results && results.length === 0) {\n\t $(\"#search-no-results\").show();\n\t } else {\n\t $(\"#search-no-results\").hide();\n\t }\n\t }\n\t });\n\t\n\t /**\n\t * View for working with a tool: setting parameters and inputs and executing the tool.\n\t */\n\t var ToolFormView = Backbone.View.extend({\n\t className: 'toolForm',\n\t\n\t render: function () {\n\t this.$el.children().remove();\n\t this.$el.append(templates.tool_form(this.model.toJSON()));\n\t }\n\t });\n\t\n\t /**\n\t * Integrated tool menu + tool execution.\n\t */\n\t var IntegratedToolMenuAndView = Backbone.View.extend({\n\t className: 'toolMenuAndView',\n\t\n\t initialize: function () {\n\t this.tool_panel_view = new ToolPanelView({ collection: this.collection });\n\t this.tool_form_view = new ToolFormView();\n\t },\n\t\n\t render: function () {\n\t // Render and append tool panel.\n\t this.tool_panel_view.render();\n\t this.tool_panel_view.$el.css(\"float\", \"left\");\n\t this.$el.append(this.tool_panel_view.$el);\n\t\n\t // Append tool form view.\n\t this.tool_form_view.$el.hide();\n\t this.$el.append(this.tool_form_view.$el);\n\t\n\t // On tool link click, show tool.\n\t var self = this;\n\t this.tool_panel_view.on(\"tool_link_click\", function (e, tool) {\n\t // Prevents click from activating link:\n\t e.preventDefault();\n\t // Show tool that was clicked on:\n\t self.show_tool(tool);\n\t });\n\t },\n\t\n\t /**\n\t * Fetch and display tool.\n\t */\n\t show_tool: function (tool) {\n\t var self = this;\n\t tool.fetch().done(function () {\n\t self.tool_form_view.model = tool;\n\t self.tool_form_view.render();\n\t self.tool_form_view.$el.show();\n\t $('#left').width(\"650px\");\n\t });\n\t }\n\t });\n\t\n\t // TODO: move into relevant views\n\t var templates = {\n\t // the search bar at the top of the tool panel\n\t tool_search: _.template(['\" autocomplete=\"off\" type=\"text\" />', ' ',\n\t //TODO: replace with icon\n\t ''].join('')),\n\t\n\t // the category level container in the tool panel (e.g. 'Get Data', 'Text Manipulation')\n\t panel_section: _.template(['
                                            \">', '<%- name %>', '
                                            ', '
                                            \" class=\"toolSectionBody\" style=\"display: none;\">', '
                                            ', '
                                            '].join('')),\n\t\n\t // a single tool's link in the tool panel; will load the tool form in the center panel\n\t tool_link: _.template([' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">', '', '<% _.each( labels, function( label ){ %>', '\">', '<%- label %>', '', '<% }); %>', '', '', '<%- name %>', '', ' <%- description %>', ''].join('')),\n\t\n\t // the tool form for entering tool parameters, viewing help and executing the tool\n\t // loaded when a tool link is clicked in the tool panel\n\t tool_form: _.template(['
                                            <%- tool.name %> (version <%- tool.version %>)
                                            ', '
                                            ', '<% _.each( tool.inputs, function( input ){ %>', '
                                            ', '', '
                                            ', '<%= input.html %>', '
                                            ', '
                                            ', '<%- input.help %>', '
                                            ', '
                                            ', '
                                            ', '<% }); %>', '
                                            ', '
                                            ', '', '
                                            ', '
                                            ', '
                                            <% tool.help %>
                                            ', '
                                            '].join(''), { variable: 'tool' })\n\t };\n\t\n\t // Exports\n\t return {\n\t ToolParameter: ToolParameter,\n\t IntegerToolParameter: IntegerToolParameter,\n\t SelectToolParameter: SelectToolParameter,\n\t Tool: Tool,\n\t ToolCollection: ToolCollection,\n\t ToolSearch: ToolSearch,\n\t ToolPanel: ToolPanel,\n\t ToolPanelView: ToolPanelView,\n\t ToolFormView: ToolFormView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 69 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This renders the content of the ftp popup **/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils) {\n\t return Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.options = Utils.merge(options, {\n\t class_add: 'upload-icon-button fa fa-square-o',\n\t class_remove: 'upload-icon-button fa fa-check-square-o',\n\t class_partial: 'upload-icon-button fa fa-minus-square-o',\n\t collection: null,\n\t onchange: function () {},\n\t onadd: function () {},\n\t onremove: function () {}\n\t });\n\t this.collection = this.options.collection;\n\t this.setElement(this._template());\n\t this.rows = [];\n\t Utils.get({\n\t url: Galaxy.root + 'api/remote_files',\n\t success: function (ftp_files) {\n\t self._fill(ftp_files);\n\t },\n\t error: function () {\n\t self._fill();\n\t }\n\t });\n\t },\n\t\n\t /** Fill table with ftp entries */\n\t _fill: function (ftp_files) {\n\t if (ftp_files && ftp_files.length > 0) {\n\t this.$('.upload-ftp-content').html($(this._templateTable()));\n\t var size = 0;\n\t for (var index in ftp_files) {\n\t this.rows.push(this._add(ftp_files[index]));\n\t size += ftp_files[index].size;\n\t }\n\t this.$('.upload-ftp-number').html(ftp_files.length + ' files');\n\t this.$('.upload-ftp-disk').html(Utils.bytesToString(size, true));\n\t if (this.collection) {\n\t var self = this;\n\t this.$('._has_collection').show();\n\t this.$select_all = this.$('.upload-selectall').addClass(this.options.class_add);\n\t this.$select_all.on('click', function () {\n\t var add = self.$select_all.hasClass(self.options.class_add);\n\t for (var index in ftp_files) {\n\t var ftp_file = ftp_files[index];\n\t var model_index = self._find(ftp_file);\n\t if (!model_index && add || model_index && !add) {\n\t self.rows[index].trigger('click');\n\t }\n\t }\n\t });\n\t this._refresh();\n\t }\n\t } else {\n\t this.$('.upload-ftp-content').html($(this._templateInfo()));\n\t }\n\t this.$('.upload-ftp-wait').hide();\n\t },\n\t\n\t /** Add file to table */\n\t _add: function (ftp_file) {\n\t var self = this;\n\t var $it = $(this._templateRow(ftp_file));\n\t var $icon = $it.find('.icon');\n\t this.$('tbody').append($it);\n\t if (this.collection) {\n\t $icon.addClass(this._find(ftp_file) ? this.options.class_remove : this.options.class_add);\n\t $it.on('click', function () {\n\t var model_index = self._find(ftp_file);\n\t $icon.removeClass();\n\t if (!model_index) {\n\t self.options.onadd(ftp_file);\n\t $icon.addClass(self.options.class_remove);\n\t } else {\n\t self.options.onremove(model_index);\n\t $icon.addClass(self.options.class_add);\n\t }\n\t self._refresh();\n\t });\n\t } else {\n\t $it.on('click', function () {\n\t self.options.onchange(ftp_file);\n\t });\n\t }\n\t return $it;\n\t },\n\t\n\t /** Refresh select all button state */\n\t _refresh: function () {\n\t var filtered = this.collection.where({ file_mode: 'ftp', enabled: true });\n\t this.$select_all.removeClass();\n\t if (filtered.length == 0) {\n\t this.$select_all.addClass(this.options.class_add);\n\t } else {\n\t this.$select_all.addClass(filtered.length == this.rows.length ? this.options.class_remove : this.options.class_partial);\n\t }\n\t },\n\t\n\t /** Get model index */\n\t _find: function (ftp_file) {\n\t var item = this.collection.findWhere({\n\t file_path: ftp_file.path,\n\t file_mode: 'ftp',\n\t enabled: true\n\t });\n\t return item && item.get('id');\n\t },\n\t\n\t /** Template of row */\n\t _templateRow: function (options) {\n\t return '
                                            ' + _.escape(options.path) + '' + Utils.bytesToString(options.size) + '' + options.ctime + '
                                            ' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
                                            NameSizeCreated
                                            ';\n\t },\n\t\n\t /** Template of info message */\n\t _templateInfo: function () {\n\t return '
                                            ' + 'Your FTP directory does not contain any files.' + '
                                            ';\n\t },\n\t\n\t /** Template of main view */\n\t _template: function () {\n\t return '
                                            ' + '
                                            ' + '
                                            This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at ' + this.options.ftp_upload_site + ' using your Galaxy credentials (email address and password).
                                            ' + '
                                            ' + '
                                            ';\n\t }\n\t });\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 70 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This renders the content of the settings popup, allowing users to specify flags i.e. for space-to-tab conversion **/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils) {\n\t return Backbone.View.extend({\n\t options: {\n\t class_check: 'fa-check-square-o',\n\t class_uncheck: 'fa-square-o',\n\t parameters: [{\n\t id: 'space_to_tab',\n\t title: 'Convert spaces to tabs'\n\t }, {\n\t id: 'to_posix_lines',\n\t title: 'Use POSIX standard'\n\t }]\n\t },\n\t\n\t initialize: function (options) {\n\t var self = this;\n\t this.model = options.model;\n\t this.setElement($('
                                            ').addClass('upload-settings'));\n\t this.$el.append($('
                                            ').addClass('upload-settings-cover'));\n\t this.$el.append($('').addClass('upload-settings-table ui-table-striped').append(''));\n\t this.$cover = this.$('.upload-settings-cover');\n\t this.$table = this.$('.upload-settings-table > tbody');\n\t this.listenTo(this.model, 'change', this.render, this);\n\t this.model.trigger('change');\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t this.$table.empty();\n\t _.each(this.options.parameters, function (parameter) {\n\t var $checkbox = $('
                                            ').addClass('upload-' + parameter.id + ' upload-icon-button fa').addClass(self.model.get(parameter.id) && self.options.class_check || self.options.class_uncheck).on('click', function () {\n\t self.model.get('enabled') && self.model.set(parameter.id, !self.model.get(parameter.id));\n\t });\n\t self.$table.append($('
                                            ').append($('' + '' + '' + '');\n\t });\n\t $tmpl.append($table);\n\t } else {\n\t $tmpl.append('No ' + this.model.get('plural').toLowerCase() + ' have been shared with you.');\n\t }\n\t return $tmpl;\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 129 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(84), __webpack_require__(87), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET_LI_EDIT, HDA_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DATASET_LI_EDIT.DatasetListItemEdit;\n\t /** @class Editing view for HistoryDatasetAssociation.\n\t */\n\t var HDAListItemEdit = _super.extend(\n\t /** @lends HDAListItemEdit.prototype */{\n\t\n\t className: _super.prototype.className + \" history-content\",\n\t\n\t /** In this override, only get details if in the ready state, get rerunnable if in other states.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t\n\t // special case the need for the rerunnable and creating_job attributes\n\t // needed for rendering re-run button on queued, running datasets\n\t } else if (!view.model.has('rerunnable')) {\n\t return view.model.fetch({ silent: true, data: {\n\t // only fetch rerunnable and creating_job to keep overhead down\n\t keys: ['rerunnable', 'creating_job'].join(',')\n\t } });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .unhide-link': function (ev) {\n\t this.model.unhide();return false;\n\t }\n\t }),\n\t\n\t /** string rep */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDAListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t HDAListItemEdit.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t hidden: BASE_MVC.wrapTemplate(['<% if( !dataset.visible ){ %>',\n\t // add a link to unhide a dataset\n\t '
                                            ', _l('This dataset has been hidden'), '
                                            ', _l('Unhide it'), '', '
                                            ', '<% } %>'], 'dataset')\n\t });\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t //NOTE: *steal* the HDAListItemView titleBar\n\t titleBar: HDA_LI.HDAListItemView.prototype.templates.titleBar,\n\t warnings: warnings\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HDAListItemEdit: HDAListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 130 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(89), __webpack_require__(123), __webpack_require__(25), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HDCA_LI, DC_VIEW_EDIT, faIconButton, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = HDCA_LI.HDCAListItemView;\n\t /** @class Editing view for HistoryDatasetCollectionAssociation.\n\t */\n\t var HDCAListItemEdit = _super.extend(\n\t /** @lends HDCAListItemEdit.prototype */{\n\t\n\t /** logger used to record this.log messages, commonly set to console */\n\t //logger : console,\n\t\n\t /** Override to return editable versions of the collection panels */\n\t _getFoldoutPanelClass: function () {\n\t switch (this.model.get('collection_type')) {\n\t case 'list':\n\t return DC_VIEW_EDIT.ListCollectionViewEdit;\n\t case 'paired':\n\t return DC_VIEW_EDIT.PairCollectionViewEdit;\n\t case 'list:paired':\n\t return DC_VIEW_EDIT.ListOfPairsCollectionViewEdit;\n\t case 'list:list':\n\t return DC_VIEW_EDIT.ListOfListsCollectionViewEdit;\n\t }\n\t throw new TypeError('Uknown collection_type: ' + this.model.get('collection_type'));\n\t },\n\t\n\t // ......................................................................... delete\n\t /** In this override, add the delete button. */\n\t _renderPrimaryActions: function () {\n\t this.log(this + '._renderPrimaryActions');\n\t // render the display, edit attr and delete icon-buttons\n\t return _super.prototype._renderPrimaryActions.call(this).concat([this._renderDeleteButton()]);\n\t },\n\t\n\t /** Render icon-button to delete this collection. */\n\t _renderDeleteButton: function () {\n\t var self = this,\n\t deleted = this.model.get('deleted');\n\t return faIconButton({\n\t title: deleted ? _l('Dataset collection is already deleted') : _l('Delete'),\n\t classes: 'delete-btn',\n\t faIcon: 'fa-times',\n\t disabled: deleted,\n\t onclick: function () {\n\t // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n\t self.$el.find('.icon-btn.delete-btn').trigger('mouseout');\n\t self.model['delete']();\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... misc\n\t /** string rep */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDCAListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t HDCAListItemEdit: HDCAListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ },\n/* 131 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This class renders the grid list. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(12), __webpack_require__(65), __webpack_require__(86)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, GridView, HistoryModel, historyCopyDialog) {\n\t\n\t var View = Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.setElement($('
                                            '));\n\t this.model = new Backbone.Model();\n\t Utils.get({\n\t url: Galaxy.root + 'history/' + options.action_id,\n\t success: function (response) {\n\t response['dict_format'] = true;\n\t _.each(response['operations'], function (operation) {\n\t if (operation.label == 'Copy') {\n\t operation.onclick = function (id) {\n\t self._showCopyDialog(id);\n\t };\n\t }\n\t });\n\t self.model.set(response);\n\t self.render();\n\t }\n\t });\n\t },\n\t\n\t render: function () {\n\t var grid = new GridView(this.model.attributes);\n\t this.$el.empty().append(grid.$el);\n\t },\n\t\n\t _showCopyDialog: function (id) {\n\t var history = new HistoryModel.History({ id: id });\n\t history.fetch().fail(function () {\n\t alert('History could not be fetched. Please contact an administrator');\n\t }).done(function () {\n\t historyCopyDialog(history, {}).done(function () {\n\t if (window.parent && window.parent.Galaxy && window.parent.Galaxy.currHistoryPanel) {\n\t window.parent.Galaxy.currHistoryPanel.loadCurrentHistory();\n\t }\n\t window.location.reload(true);\n\t });\n\t });\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 132 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(65), __webpack_require__(133), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HISTORY_MODEL, HISTORY_VIEW_EDIT, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t // ============================================================================\n\t /** session storage for history panel preferences (and to maintain state)\n\t */\n\t\n\t var HistoryViewPrefs = BASE_MVC.SessionStorageModel.extend(\n\t /** @lends HistoryViewPrefs.prototype */{\n\t defaults: {\n\t /** should the tags editor be shown or hidden initially? */\n\t tagsEditorShown: false,\n\t /** should the annotation editor be shown or hidden initially? */\n\t annotationEditorShown: false,\n\t ///** what is the currently focused content (dataset or collection) in the current history?\n\t // * (the history panel will highlight and scroll to the focused content view)\n\t // */\n\t //focusedContentId : null\n\t /** Current scroll position */\n\t scrollPosition: 0\n\t },\n\t toString: function () {\n\t return 'HistoryViewPrefs(' + JSON.stringify(this.toJSON()) + ')';\n\t }\n\t });\n\t\n\t /** key string to store panel prefs (made accessible on class so you can access sessionStorage directly) */\n\t HistoryViewPrefs.storageKey = function storageKey() {\n\t return 'history-panel';\n\t };\n\t\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t var _super = HISTORY_VIEW_EDIT.HistoryViewEdit;\n\t // used in root/index.mako\n\t /** @class View/Controller for the user's current history model as used in the history\n\t * panel (current right hand panel) of the analysis page.\n\t *\n\t * The only history panel that:\n\t * will poll for updates.\n\t * displays datasets in reverse hid order.\n\t */\n\t var CurrentHistoryView = _super.extend( /** @lends CurrentHistoryView.prototype */{\n\t\n\t className: _super.prototype.className + ' current-history-panel',\n\t\n\t /** override to use drilldown (and not foldout) for how collections are displayed */\n\t HDCAViewClass: _super.prototype.HDCAViewClass.extend({\n\t foldoutStyle: 'drilldown'\n\t }),\n\t\n\t emptyMsg: [_l('This history is empty'), '. ', _l('You can '), '', _l('load your own data'), '', _l(' or '), '', _l('get data from an external source'), ''].join(''),\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events */\n\t initialize: function (attributes) {\n\t attributes = attributes || {};\n\t\n\t // ---- persistent preferences\n\t /** maintain state / preferences over page loads */\n\t this.preferences = new HistoryViewPrefs(_.extend({\n\t id: HistoryViewPrefs.storageKey()\n\t }, _.pick(attributes, _.keys(HistoryViewPrefs.prototype.defaults))));\n\t\n\t _super.prototype.initialize.call(this, attributes);\n\t\n\t /** sub-views that will overlay this panel (collections) */\n\t this.panelStack = [];\n\t\n\t /** id of currently focused content */\n\t this.currentContentId = attributes.currentContentId || null;\n\t //NOTE: purposely not sent to localstorage since panel recreation roughly lines up with a reset of this value\n\t },\n\t\n\t /** Override to cache the current scroll position with a listener */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t\n\t var panel = this;\n\t // reset scroll position when there's a new history\n\t this.on('new-model', function () {\n\t panel.preferences.set('scrollPosition', 0);\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ loading history/item models\n\t // TODO: next three more appropriate moved to the app level\n\t /** (re-)loads the user's current history & contents w/ details */\n\t loadCurrentHistory: function () {\n\t return this.loadHistory(null, { url: Galaxy.root + 'history/current_history_json' });\n\t },\n\t\n\t /** loads a history & contents w/ details and makes them the current history */\n\t switchToHistory: function (historyId, attributes) {\n\t if (Galaxy.user.isAnonymous()) {\n\t this.trigger('error', _l('You must be logged in to switch histories'), _l('Anonymous user'));\n\t return $.when();\n\t }\n\t return this.loadHistory(historyId, { url: Galaxy.root + 'history/set_as_current?id=' + historyId });\n\t },\n\t\n\t /** creates a new history on the server and sets it as the user's current history */\n\t createNewHistory: function (attributes) {\n\t if (Galaxy.user.isAnonymous()) {\n\t this.trigger('error', _l('You must be logged in to create histories'), _l('Anonymous user'));\n\t return $.when();\n\t }\n\t return this.loadHistory(null, { url: Galaxy.root + 'history/create_new_current' });\n\t },\n\t\n\t /** release/free/shutdown old models and set up panel for new models */\n\t setModel: function (model, attributes, render) {\n\t _super.prototype.setModel.call(this, model, attributes, render);\n\t if (this.model && this.model.id) {\n\t this.log('checking for updates');\n\t this.model.checkForUpdates();\n\t }\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ history/content event listening\n\t /** listening for history events */\n\t _setUpModelListeners: function () {\n\t _super.prototype._setUpModelListeners.call(this);\n\t // re-broadcast any model change events so that listeners don't have to re-bind to each history\n\t return this.listenTo(this.model, {\n\t 'change:nice_size change:size': function () {\n\t this.trigger('history-size-change', this, this.model, arguments);\n\t },\n\t 'change:id': function () {\n\t this.once('loading-done', function () {\n\t this.model.checkForUpdates();\n\t });\n\t }\n\t });\n\t },\n\t\n\t /** listening for collection events */\n\t _setUpCollectionListeners: function () {\n\t _super.prototype._setUpCollectionListeners.call(this);\n\t // if a hidden item is created (gen. by a workflow), moves thru the updater to the ready state,\n\t // then: remove it from the collection if the panel is set to NOT show hidden datasets\n\t this.listenTo(this.collection, 'state:ready', function (model, newState, oldState) {\n\t if (!model.get('visible') && !this.collection.storage.includeHidden()) {\n\t this.removeItemView(model);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel rendering\n\t /** override to add a handler to capture the scroll position when the parent scrolls */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t // console.log( '_setUpBehaviors', this.$scrollContainer( $where ).get(0), this.$list( $where ) );\n\t // we need to call this in _setUpBehaviors which is called after render since the $el\n\t // may not be attached to $el.parent and $scrollContainer() may not work\n\t var panel = this;\n\t _super.prototype._setUpBehaviors.call(panel, $where);\n\t\n\t // cache the handler to remove and re-add so we don't pile up the handlers\n\t if (!this._debouncedScrollCaptureHandler) {\n\t this._debouncedScrollCaptureHandler = _.debounce(function scrollCapture() {\n\t // cache the scroll position (only if visible)\n\t if (panel.$el.is(':visible')) {\n\t panel.preferences.set('scrollPosition', $(this).scrollTop());\n\t }\n\t }, 40);\n\t }\n\t\n\t panel.$scrollContainer($where).off('scroll', this._debouncedScrollCaptureHandler).on('scroll', this._debouncedScrollCaptureHandler);\n\t return panel;\n\t },\n\t\n\t /** In this override, handle null models and move the search input to the top */\n\t _buildNewRender: function () {\n\t if (!this.model) {\n\t return $();\n\t }\n\t var $newRender = _super.prototype._buildNewRender.call(this);\n\t $newRender.find('.search').prependTo($newRender.find('> .controls'));\n\t this._renderQuotaMessage($newRender);\n\t return $newRender;\n\t },\n\t\n\t /** render the message displayed when a user is over quota and can't run jobs */\n\t _renderQuotaMessage: function ($whereTo) {\n\t $whereTo = $whereTo || this.$el;\n\t return $(this.templates.quotaMsg({}, this)).prependTo($whereTo.find('.messages'));\n\t },\n\t\n\t /** In this override, get and set current panel preferences when editor is used */\n\t _renderTags: function ($where) {\n\t var panel = this;\n\t // render tags and show/hide based on preferences\n\t _super.prototype._renderTags.call(panel, $where);\n\t if (panel.preferences.get('tagsEditorShown')) {\n\t panel.tagsEditor.toggle(true);\n\t }\n\t // store preference when shown or hidden\n\t panel.listenTo(panel.tagsEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden', function (tagsEditor) {\n\t panel.preferences.set('tagsEditorShown', tagsEditor.hidden);\n\t });\n\t },\n\t\n\t /** In this override, get and set current panel preferences when editor is used */\n\t _renderAnnotation: function ($where) {\n\t var panel = this;\n\t // render annotation and show/hide based on preferences\n\t _super.prototype._renderAnnotation.call(panel, $where);\n\t if (panel.preferences.get('annotationEditorShown')) {\n\t panel.annotationEditor.toggle(true);\n\t }\n\t // store preference when shown or hidden\n\t panel.listenTo(panel.annotationEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden', function (annotationEditor) {\n\t panel.preferences.set('annotationEditorShown', annotationEditor.hidden);\n\t });\n\t },\n\t\n\t /** Override to scroll to cached position (in prefs) after swapping */\n\t _swapNewRender: function ($newRender) {\n\t _super.prototype._swapNewRender.call(this, $newRender);\n\t var panel = this;\n\t _.delay(function () {\n\t var pos = panel.preferences.get('scrollPosition');\n\t if (pos) {\n\t panel.scrollTo(pos, 0);\n\t }\n\t }, 10);\n\t //TODO: is this enough of a delay on larger histories?\n\t\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** Override to add the current-content highlight class to currentContentId's view */\n\t _attachItems: function ($whereTo) {\n\t _super.prototype._attachItems.call(this, $whereTo);\n\t var panel = this;\n\t if (panel.currentContentId) {\n\t panel._setCurrentContentById(panel.currentContentId);\n\t }\n\t return this;\n\t },\n\t\n\t /** Override to remove any drill down panels */\n\t addItemView: function (model, collection, options) {\n\t var view = _super.prototype.addItemView.call(this, model, collection, options);\n\t if (!view) {\n\t return view;\n\t }\n\t if (this.panelStack.length) {\n\t return this._collapseDrilldownPanel();\n\t }\n\t return view;\n\t },\n\t\n\t // ------------------------------------------------------------------------ collection sub-views\n\t /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t _super.prototype._setUpItemViewListeners.call(panel, view);\n\t // use pub-sub to: handle drilldown expansion and collapse\n\t return panel.listenTo(view, {\n\t 'expanded:drilldown': function (v, drilldown) {\n\t this._expandDrilldownPanel(drilldown);\n\t },\n\t 'collapsed:drilldown': function (v, drilldown) {\n\t this._collapseDrilldownPanel(drilldown);\n\t }\n\t });\n\t },\n\t\n\t /** display 'current content': add a visible highlight and store the id of a content item */\n\t setCurrentContent: function (view) {\n\t this.$('.history-content.current-content').removeClass('current-content');\n\t if (view) {\n\t view.$el.addClass('current-content');\n\t this.currentContentId = view.model.id;\n\t } else {\n\t this.currentContentId = null;\n\t }\n\t },\n\t\n\t /** find the view with the id and then call setCurrentContent on it */\n\t _setCurrentContentById: function (id) {\n\t var view = this.viewFromModelId(id) || null;\n\t this.setCurrentContent(view);\n\t },\n\t\n\t /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n\t _expandDrilldownPanel: function (drilldown) {\n\t this.panelStack.push(drilldown);\n\t // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n\t this.$controls().add(this.$list()).hide();\n\t drilldown.parentName = this.model.get('name');\n\t drilldown.delegateEvents().render().$el.appendTo(this.$el);\n\t },\n\t\n\t /** Handle drilldown close by freeing the panel and re-rendering this panel */\n\t _collapseDrilldownPanel: function (drilldown) {\n\t this.panelStack.pop();\n\t //TODO: MEM: free the panel\n\t this.$controls().add(this.$list()).show();\n\t },\n\t\n\t // ........................................................................ panel events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t // the two links in the empty message\n\t 'click .uploader-link': function (ev) {\n\t Galaxy.upload.show(ev);\n\t },\n\t 'click .get-data-link': function (ev) {\n\t var $toolMenu = $('.toolMenuContainer');\n\t $toolMenu.parent().scrollTop(0);\n\t $toolMenu.find('span:contains(\"Get Data\")').click();\n\t }\n\t }),\n\t\n\t // ........................................................................ external objects/MVC\n\t listenToGalaxy: function (galaxy) {\n\t this.listenTo(galaxy, {\n\t // when the galaxy_main iframe is loaded with a new page,\n\t // compare the url to the following list and if there's a match\n\t // pull the id from url and indicate in the history view that\n\t // the dataset with that id is the 'current'ly active dataset\n\t 'center-frame:load': function (data) {\n\t var pathToMatch = data.fullpath;\n\t var hdaId = null;\n\t var useToURLRegexMap = {\n\t 'display': /datasets\\/([a-f0-9]+)\\/display/,\n\t 'edit': /datasets\\/([a-f0-9]+)\\/edit/,\n\t 'report_error': /dataset\\/errors\\?id=([a-f0-9]+)/,\n\t 'rerun': /tool_runner\\/rerun\\?id=([a-f0-9]+)/,\n\t 'show_params': /datasets\\/([a-f0-9]+)\\/show_params/\n\t };\n\t _.find(useToURLRegexMap, function (regex, use) {\n\t // grab the more specific match result (1), save, and use it as the find flag\n\t hdaId = _.result(pathToMatch.match(regex), 1);\n\t return hdaId;\n\t });\n\t // need to type mangle to go from web route to history contents\n\t this._setCurrentContentById(hdaId ? 'dataset-' + hdaId : null);\n\t },\n\t // when the center panel is given a new view, clear the current indicator\n\t 'center-panel:load': function (view) {\n\t this._setCurrentContentById();\n\t }\n\t });\n\t },\n\t\n\t //TODO: remove quota meter from panel and remove this\n\t /** add listeners to an external quota meter (mvc/user/user-quotameter.js) */\n\t connectToQuotaMeter: function (quotaMeter) {\n\t if (!quotaMeter) {\n\t return this;\n\t }\n\t // show/hide the 'over quota message' in the history when the meter tells it to\n\t this.listenTo(quotaMeter, 'quota:over', this.showQuotaMessage);\n\t this.listenTo(quotaMeter, 'quota:under', this.hideQuotaMessage);\n\t\n\t // having to add this to handle re-render of hview while overquota (the above do not fire)\n\t this.on('rendered rendered:initial', function () {\n\t if (quotaMeter && quotaMeter.isOverQuota()) {\n\t this.showQuotaMessage();\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** Override to preserve the quota message */\n\t clearMessages: function (ev) {\n\t var $target = !_.isUndefined(ev) ? $(ev.currentTarget) : this.$messages().children('[class$=\"message\"]');\n\t $target = $target.not('.quota-message');\n\t $target.fadeOut(this.fxSpeed, function () {\n\t $(this).remove();\n\t });\n\t return this;\n\t },\n\t\n\t /** Show the over quota message (which happens to be in the history panel).\n\t */\n\t showQuotaMessage: function () {\n\t var $msg = this.$('.quota-message');\n\t if ($msg.is(':hidden')) {\n\t $msg.slideDown(this.fxSpeed);\n\t }\n\t },\n\t\n\t /** Hide the over quota message (which happens to be in the history panel).\n\t */\n\t hideQuotaMessage: function () {\n\t var $msg = this.$('.quota-message');\n\t if (!$msg.is(':hidden')) {\n\t $msg.slideUp(this.fxSpeed);\n\t }\n\t },\n\t\n\t // ........................................................................ options menu\n\t //TODO: remove to batch\n\t /** unhide any hidden datasets */\n\t unhideHidden: function () {\n\t var self = this;\n\t if (confirm(_l('Really unhide all hidden datasets?'))) {\n\t // get all hidden, regardless of deleted/purged\n\t return self.model.contents._filterAndUpdate({ visible: false, deleted: '', purged: '' }, { visible: true }).done(function () {\n\t // TODO: would be better to render these as they're unhidden instead of all at once\n\t if (!self.model.contents.includeHidden) {\n\t self.renderItems();\n\t }\n\t });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** delete any hidden datasets */\n\t deleteHidden: function () {\n\t var self = this;\n\t if (confirm(_l('Really delete all hidden datasets?'))) {\n\t return self.model.contents._filterAndUpdate(\n\t // get all hidden, regardless of deleted/purged\n\t { visible: false, deleted: '', purged: '' },\n\t // both delete *and* unhide them\n\t { deleted: true, visible: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** Return a string rep of the history */\n\t toString: function () {\n\t return 'CurrentHistoryView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t CurrentHistoryView.prototype.templates = function () {\n\t\n\t var quotaMsgTemplate = BASE_MVC.wrapTemplate(['
                                            ', _l('You are over your disk quota'), '. ', _l('Tool execution is on hold until your disk usage drops below your allocated quota'), '.', '
                                            '], 'history');\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t quotaMsg: quotaMsgTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t CurrentHistoryView: CurrentHistoryView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 133 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, _, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(134), __webpack_require__(64), __webpack_require__(17), __webpack_require__(88), __webpack_require__(129), __webpack_require__(130), __webpack_require__(45), __webpack_require__(80), __webpack_require__(60), __webpack_require__(125), __webpack_require__(124), __webpack_require__(25), __webpack_require__(18), __webpack_require__(7), __webpack_require__(6), __webpack_require__(24)], __WEBPACK_AMD_DEFINE_RESULT__ = function (HISTORY_VIEW, HISTORY_CONTENTS, STATES, HDA_MODEL, HDA_LI_EDIT, HDCA_LI_EDIT, TAGS, ANNOTATIONS, LIST_COLLECTION_CREATOR, PAIR_COLLECTION_CREATOR, LIST_OF_PAIRS_COLLECTION_CREATOR, faIconButton, PopupMenu, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t\n\t var _super = HISTORY_VIEW.HistoryView;\n\t // base class for history-view-edit-current and used as-is in history/view.mako\n\t /** @class Editable View/Controller for the history model.\n\t *\n\t * Allows:\n\t * (everything HistoryView allows)\n\t * changing the name\n\t * displaying and editing tags and annotations\n\t * multi-selection and operations on mulitple content items\n\t */\n\t var HistoryViewEdit = _super.extend(\n\t /** @lends HistoryViewEdit.prototype */{\n\t\n\t /** class to use for constructing the HistoryDatasetAssociation views */\n\t HDAViewClass: HDA_LI_EDIT.HDAListItemEdit,\n\t /** class to use for constructing the HistoryDatasetCollectionAssociation views */\n\t HDCAViewClass: HDCA_LI_EDIT.HDCAListItemEdit,\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes\n\t */\n\t initialize: function (attributes) {\n\t attributes = attributes || {};\n\t _super.prototype.initialize.call(this, attributes);\n\t\n\t // ---- set up instance vars\n\t /** editor for tags - sub-view */\n\t this.tagsEditor = null;\n\t\n\t /** enable drag and drop - sub-view */\n\t this.dragItems = true;\n\t\n\t /** editor for annotations - sub-view */\n\t this.annotationEditor = null;\n\t\n\t /** allow user purge of dataset files? */\n\t this.purgeAllowed = attributes.purgeAllowed || false;\n\t\n\t // states/modes the panel can be in\n\t /** is the panel currently showing the dataset selection controls? */\n\t this.annotationEditorShown = attributes.annotationEditorShown || false;\n\t this.tagsEditorShown = attributes.tagsEditorShown || false;\n\t },\n\t\n\t /** Override to handle history as drag-drop target */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t return this.on({\n\t 'droptarget:drop': function (ev, data) {\n\t // process whatever was dropped and re-hide the drop target\n\t this.dataDropped(data);\n\t this.dropTargetOff();\n\t },\n\t 'view:attached view:removed': function () {\n\t this._renderCounts();\n\t },\n\t 'search:loading-progress': this._renderSearchProgress,\n\t 'search:searching': this._renderSearchFindings\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ listeners\n\t /** listening for history and HDA events */\n\t _setUpModelListeners: function () {\n\t _super.prototype._setUpModelListeners.call(this);\n\t this.listenTo(this.model, 'change:size', this.updateHistoryDiskSize);\n\t return this;\n\t },\n\t\n\t /** listening for collection events */\n\t _setUpCollectionListeners: function () {\n\t _super.prototype._setUpCollectionListeners.call(this);\n\t this.listenTo(this.collection, {\n\t 'change:deleted': this._handleItemDeletedChange,\n\t 'change:visible': this._handleItemVisibleChange,\n\t 'change:purged': function (model) {\n\t // hafta get the new nice-size w/o the purged model\n\t this.model.fetch();\n\t },\n\t // loading indicators for deleted/hidden\n\t 'fetching-deleted': function (collection) {\n\t this.$('> .controls .deleted-count').html('' + _l('loading...') + '');\n\t },\n\t 'fetching-hidden': function (collection) {\n\t this.$('> .controls .hidden-count').html('' + _l('loading...') + '');\n\t },\n\t 'fetching-deleted-done fetching-hidden-done': this._renderCounts\n\t });\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel rendering\n\t /** In this override, add tag and annotation editors and a btn to toggle the selectors */\n\t _buildNewRender: function () {\n\t // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n\t var $newRender = _super.prototype._buildNewRender.call(this);\n\t if (!this.model) {\n\t return $newRender;\n\t }\n\t\n\t if (Galaxy && Galaxy.user && Galaxy.user.id && Galaxy.user.id === this.model.get('user_id')) {\n\t this._renderTags($newRender);\n\t this._renderAnnotation($newRender);\n\t }\n\t return $newRender;\n\t },\n\t\n\t /** Update the history size display (curr. upper right of panel). */\n\t updateHistoryDiskSize: function () {\n\t this.$('.history-size').text(this.model.get('nice_size'));\n\t },\n\t\n\t /** override to render counts when the items are rendered */\n\t renderItems: function ($whereTo) {\n\t var views = _super.prototype.renderItems.call(this, $whereTo);\n\t if (!this.searchFor) {\n\t this._renderCounts($whereTo);\n\t }\n\t return views;\n\t },\n\t\n\t /** override to show counts, what's deleted/hidden, and links to toggle those */\n\t _renderCounts: function ($whereTo) {\n\t $whereTo = $whereTo instanceof jQuery ? $whereTo : this.$el;\n\t var html = this.templates.counts(this.model.toJSON(), this);\n\t return $whereTo.find('> .controls .subtitle').html(html);\n\t },\n\t\n\t /** render the tags sub-view controller */\n\t _renderTags: function ($where) {\n\t var panel = this;\n\t this.tagsEditor = new TAGS.TagsEditor({\n\t model: this.model,\n\t el: $where.find('.controls .tags-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // show hide sub-view tag editors when this is shown/hidden\n\t onshow: function () {\n\t panel.toggleHDATagEditors(true, panel.fxSpeed);\n\t },\n\t onhide: function () {\n\t panel.toggleHDATagEditors(false, panel.fxSpeed);\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit history tags'),\n\t classes: 'history-tag-btn',\n\t faIcon: 'fa-tags'\n\t }).appendTo($where.find('.controls .actions'))\n\t });\n\t },\n\t /** render the annotation sub-view controller */\n\t _renderAnnotation: function ($where) {\n\t var panel = this;\n\t this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n\t model: this.model,\n\t el: $where.find('.controls .annotation-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // show hide sub-view view annotation editors when this is shown/hidden\n\t onshow: function () {\n\t panel.toggleHDAAnnotationEditors(true, panel.fxSpeed);\n\t },\n\t onhide: function () {\n\t panel.toggleHDAAnnotationEditors(false, panel.fxSpeed);\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit history annotation'),\n\t classes: 'history-annotate-btn',\n\t faIcon: 'fa-comment'\n\t }).appendTo($where.find('.controls .actions'))\n\t });\n\t },\n\t\n\t /** Set up HistoryViewEdit js/widget behaviours\n\t * In this override, make the name editable\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t _super.prototype._setUpBehaviors.call(this, $where);\n\t if (!this.model) {\n\t return;\n\t }\n\t\n\t // anon users shouldn't have access to any of the following\n\t if (!Galaxy.user || Galaxy.user.isAnonymous() || Galaxy.user.id !== this.model.get('user_id')) {\n\t return;\n\t }\n\t\n\t var panel = this,\n\t nameSelector = '> .controls .name';\n\t $where.find(nameSelector).attr('title', _l('Click to rename history')).tooltip({ placement: 'bottom' }).make_text_editable({\n\t on_finish: function (newName) {\n\t var previousName = panel.model.get('name');\n\t if (newName && newName !== previousName) {\n\t panel.$el.find(nameSelector).text(newName);\n\t panel.model.save({ name: newName }).fail(function () {\n\t panel.$el.find(nameSelector).text(panel.model.previous('name'));\n\t });\n\t } else {\n\t panel.$el.find(nameSelector).text(previousName);\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** return a new popup menu for choosing a multi selection action\n\t * ajax calls made for multiple datasets are queued\n\t */\n\t multiselectActions: function () {\n\t var panel = this,\n\t actions = [{ html: _l('Hide datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.hide;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }, { html: _l('Unhide datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.unhide;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }, { html: _l('Delete datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype['delete'];\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }, { html: _l('Undelete datasets'), func: function () {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.undelete;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }];\n\t if (panel.purgeAllowed) {\n\t actions.push({\n\t html: _l('Permanently delete datasets'), func: function () {\n\t if (confirm(_l('This will permanently remove the data in your datasets. Are you sure?'))) {\n\t var action = HDA_MODEL.HistoryDatasetAssociation.prototype.purge;\n\t panel.getSelectedModels().ajaxQueue(action);\n\t }\n\t }\n\t });\n\t }\n\t actions = actions.concat(panel._collectionActions());\n\t return actions;\n\t },\n\t\n\t /** */\n\t _collectionActions: function () {\n\t var panel = this;\n\t return [{ html: _l('Build Dataset List'), func: function () {\n\t panel.buildCollection(\"list\");\n\t }\n\t },\n\t // TODO: Only show quick pair if two things selected.\n\t { html: _l('Build Dataset Pair'), func: function () {\n\t panel.buildCollection(\"paired\");\n\t }\n\t }, { html: _l('Build List of Dataset Pairs'), func: function () {\n\t panel.buildCollection(\"list:paired\");\n\t }\n\t }];\n\t },\n\t\n\t buildCollection: function (collectionType, selection, hideSourceItems) {\n\t var panel = this;\n\t var selection = selection || panel.getSelectedModels();\n\t var hideSourceItems = hideSourceItems || false;\n\t var createFunc;\n\t if (collectionType == \"list\") {\n\t createFunc = LIST_COLLECTION_CREATOR.createListCollection;\n\t } else if (collectionType == \"paired\") {\n\t createFunc = PAIR_COLLECTION_CREATOR.createPairCollection;\n\t } else if (collectionType == \"list:paired\") {\n\t createFunc = LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection;\n\t } else {\n\t console.warn(\"Unknown collectionType encountered \" + collectionType);\n\t }\n\t createFunc(selection, hideSourceItems).done(function () {\n\t panel.model.refresh();\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** In this override, add purgeAllowed and whether tags/annotation editors should be shown */\n\t _getItemViewOptions: function (model) {\n\t var options = _super.prototype._getItemViewOptions.call(this, model);\n\t _.extend(options, {\n\t purgeAllowed: this.purgeAllowed,\n\t tagsEditorShown: this.tagsEditor && !this.tagsEditor.hidden,\n\t annotationEditorShown: this.annotationEditor && !this.annotationEditor.hidden\n\t });\n\t return options;\n\t },\n\t\n\t /** If this item is deleted and we're not showing deleted items, remove the view\n\t * @param {Model} the item model to check\n\t */\n\t _handleItemDeletedChange: function (itemModel) {\n\t if (itemModel.get('deleted')) {\n\t this._handleItemDeletion(itemModel);\n\t } else {\n\t this._handleItemUndeletion(itemModel);\n\t }\n\t this._renderCounts();\n\t },\n\t\n\t _handleItemDeletion: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.deleted += 1;\n\t contentsShown.active -= 1;\n\t if (!this.model.contents.includeDeleted) {\n\t this.removeItemView(itemModel);\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t _handleItemUndeletion: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.deleted -= 1;\n\t if (!this.model.contents.includeDeleted) {\n\t contentsShown.active -= 1;\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t /** If this item is hidden and we're not showing hidden items, remove the view\n\t * @param {Model} the item model to check\n\t */\n\t _handleItemVisibleChange: function (itemModel) {\n\t if (itemModel.hidden()) {\n\t this._handleItemHidden(itemModel);\n\t } else {\n\t this._handleItemUnhidden(itemModel);\n\t }\n\t this._renderCounts();\n\t },\n\t\n\t _handleItemHidden: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.hidden += 1;\n\t contentsShown.active -= 1;\n\t if (!this.model.contents.includeHidden) {\n\t this.removeItemView(itemModel);\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t _handleItemUnhidden: function (itemModel) {\n\t var contentsShown = this.model.get('contents_active');\n\t contentsShown.hidden -= 1;\n\t if (!this.model.contents.includeHidden) {\n\t contentsShown.active -= 1;\n\t }\n\t this.model.set('contents_active', contentsShown);\n\t },\n\t\n\t /** toggle the visibility of each content's tagsEditor applying all the args sent to this function */\n\t toggleHDATagEditors: function (showOrHide, speed) {\n\t _.each(this.views, function (view) {\n\t if (view.tagsEditor) {\n\t view.tagsEditor.toggle(showOrHide, speed);\n\t }\n\t });\n\t },\n\t\n\t /** toggle the visibility of each content's annotationEditor applying all the args sent to this function */\n\t toggleHDAAnnotationEditors: function (showOrHide, speed) {\n\t _.each(this.views, function (view) {\n\t if (view.annotationEditor) {\n\t view.annotationEditor.toggle(showOrHide, speed);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .show-selectors-btn': 'toggleSelectors',\n\t 'click .toggle-deleted-link': function (ev) {\n\t this.toggleShowDeleted();\n\t },\n\t 'click .toggle-hidden-link': function (ev) {\n\t this.toggleShowHidden();\n\t }\n\t }),\n\t\n\t // ------------------------------------------------------------------------ search\n\t _renderSearchProgress: function (limit, offset) {\n\t var stop = limit + offset;\n\t return this.$('> .controls .subtitle').html(['', _l('Searching '), stop, '/', this.model.contentsShown(), ''].join(''));\n\t },\n\t\n\t /** override to display number found in subtitle */\n\t _renderSearchFindings: function () {\n\t this.$('> .controls .subtitle').html([_l('Found'), this.views.length].join(' '));\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ as drop target\n\t /** turn all the drag and drop handlers on and add some help text above the drop area */\n\t dropTargetOn: function () {\n\t if (this.dropTarget) {\n\t return this;\n\t }\n\t this.dropTarget = true;\n\t\n\t //TODO: to init\n\t var dropHandlers = {\n\t 'dragenter': _.bind(this.dragenter, this),\n\t 'dragover': _.bind(this.dragover, this),\n\t 'dragleave': _.bind(this.dragleave, this),\n\t 'drop': _.bind(this.drop, this)\n\t };\n\t\n\t var $dropTarget = this._renderDropTarget();\n\t this.$list().before([this._renderDropTargetHelp(), $dropTarget]);\n\t for (var evName in dropHandlers) {\n\t if (dropHandlers.hasOwnProperty(evName)) {\n\t //console.debug( evName, dropHandlers[ evName ] );\n\t $dropTarget.on(evName, dropHandlers[evName]);\n\t }\n\t }\n\t return this;\n\t },\n\t\n\t /** render a box to serve as a 'drop here' area on the history */\n\t _renderDropTarget: function () {\n\t this.$('.history-drop-target').remove();\n\t return $('
                                            ').addClass('history-drop-target');\n\t },\n\t\n\t /** tell the user how it works */\n\t _renderDropTargetHelp: function () {\n\t this.$('.history-drop-target-help').remove();\n\t return $('
                                            ').addClass('history-drop-target-help').text(_l('Drag datasets here to copy them to the current history'));\n\t },\n\t\n\t /** shut down drag and drop event handlers and remove drop target */\n\t dropTargetOff: function () {\n\t if (!this.dropTarget) {\n\t return this;\n\t }\n\t //this.log( 'dropTargetOff' );\n\t this.dropTarget = false;\n\t var dropTarget = this.$('.history-drop-target').get(0);\n\t for (var evName in this._dropHandlers) {\n\t if (this._dropHandlers.hasOwnProperty(evName)) {\n\t dropTarget.off(evName, this._dropHandlers[evName]);\n\t }\n\t }\n\t this.$('.history-drop-target').remove();\n\t this.$('.history-drop-target-help').remove();\n\t return this;\n\t },\n\t /** toggle the target on/off */\n\t dropTargetToggle: function () {\n\t if (this.dropTarget) {\n\t this.dropTargetOff();\n\t } else {\n\t this.dropTargetOn();\n\t }\n\t return this;\n\t },\n\t\n\t dragenter: function (ev) {\n\t //console.debug( 'dragenter:', this, ev );\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t this.$('.history-drop-target').css('border', '2px solid black');\n\t },\n\t dragover: function (ev) {\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t },\n\t dragleave: function (ev) {\n\t //console.debug( 'dragleave:', this, ev );\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t this.$('.history-drop-target').css('border', '1px dashed black');\n\t },\n\t /** when (text) is dropped try to parse as json and trigger an event */\n\t drop: function (ev) {\n\t ev.preventDefault();\n\t //ev.stopPropagation();\n\t\n\t var self = this;\n\t var dataTransfer = ev.originalEvent.dataTransfer;\n\t var data = dataTransfer.getData(\"text\");\n\t\n\t dataTransfer.dropEffect = 'move';\n\t try {\n\t data = JSON.parse(data);\n\t } catch (err) {\n\t self.warn('error parsing JSON from drop:', data);\n\t }\n\t\n\t self.trigger('droptarget:drop', ev, data, self);\n\t return false;\n\t },\n\t\n\t /** handler that copies data into the contents */\n\t dataDropped: function (data) {\n\t var self = this;\n\t // HDA: dropping will copy it to the history\n\t if (_.isObject(data) && data.model_class === 'HistoryDatasetAssociation' && data.id) {\n\t if (self.contents.currentPage !== 0) {\n\t return self.contents.fetchPage(0).then(function () {\n\t return self.model.contents.copy(data.id);\n\t });\n\t }\n\t return self.model.contents.copy(data.id);\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t // ........................................................................ misc\n\t /** Return a string rep of the history */\n\t toString: function () {\n\t return 'HistoryViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t HistoryViewEdit.prototype.templates = function () {\n\t\n\t var countsTemplate = BASE_MVC.wrapTemplate(['<% var shown = Math.max( view.views.length, history.contents_active.active ) %>', '<% if( shown ){ %>', '', '<%- shown %> ', _l('shown'), '', '<% } %>', '<% if( history.contents_active.deleted ){ %>', '', '<% if( view.model.contents.includeDeleted ){ %>', '', _l('hide deleted'), '', '<% } else { %>', '<%- history.contents_active.deleted %> ', '', _l('deleted'), '', '<% } %>', '', '<% } %>', '<% if( history.contents_active.hidden ){ %>', '', '<% if( view.model.contents.includeHidden ){ %>', '', _l('hide hidden'), '', '<% } else { %>', '<%- history.contents_active.hidden %> ', '', _l('hidden'), '', '<% } %>', '', '<% } %>'], 'history');\n\t\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t counts: countsTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HistoryViewEdit: HistoryViewEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 134 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(91), __webpack_require__(65), __webpack_require__(64), __webpack_require__(66), __webpack_require__(87), __webpack_require__(89), __webpack_require__(95), __webpack_require__(94), __webpack_require__(25), __webpack_require__(7), __webpack_require__(6), __webpack_require__(98)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_VIEW, HISTORY_MODEL, HISTORY_CONTENTS, HISTORY_PREFS, HDA_LI, HDCA_LI, USER, ERROR_MODAL, faIconButton, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t /** @class non-editable, read-only View/Controller for a history model.\n\t * Allows:\n\t * changing the loaded history\n\t * displaying data, info, and download\n\t * tracking history attrs: size, tags, annotations, name, etc.\n\t * Does not allow:\n\t * changing the name\n\t */\n\t\n\t var _super = LIST_VIEW.ModelListPanel;\n\t var HistoryView = _super.extend(\n\t /** @lends HistoryView.prototype */{\n\t _logNamespace: 'history',\n\t\n\t /** class to use for constructing the HDA views */\n\t HDAViewClass: HDA_LI.HDAListItemView,\n\t /** class to use for constructing the HDCA views */\n\t HDCAViewClass: HDCA_LI.HDCAListItemView,\n\t /** class to used for constructing collection of sub-view models */\n\t collectionClass: HISTORY_CONTENTS.HistoryContents,\n\t /** key of attribute in model to assign to this.collection */\n\t modelCollectionKey: 'contents',\n\t\n\t tagName: 'div',\n\t className: _super.prototype.className + ' history-panel',\n\t\n\t /** string to display when the collection is empty */\n\t emptyMsg: _l('This history is empty'),\n\t /** displayed when no items match the search terms */\n\t noneFoundMsg: _l('No matching datasets found'),\n\t /** string used for search placeholder */\n\t searchPlaceholder: _l('search datasets'),\n\t\n\t /** @type {Number} ms to wait after history load to fetch/decorate hdcas with element_count */\n\t FETCH_COLLECTION_COUNTS_DELAY: 2000,\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, bind listeners.\n\t * @param {Object} attributes optional settings for the panel\n\t */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t // ---- instance vars\n\t // control contents/behavior based on where (and in what context) the panel is being used\n\t /** where should pages from links be displayed? (default to new tab/window) */\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t },\n\t\n\t /** create and return a collection for when none is initially passed */\n\t _createDefaultCollection: function () {\n\t // override\n\t return new this.collectionClass([], { history: this.model });\n\t },\n\t\n\t /** In this override, clear the update timer on the model */\n\t freeModel: function () {\n\t _super.prototype.freeModel.call(this);\n\t if (this.model) {\n\t this.model.clearUpdateTimeout();\n\t }\n\t return this;\n\t },\n\t\n\t /** create any event listeners for the panel\n\t * @fires: rendered:initial on the first render\n\t * @fires: empty-history when switching to a history with no contents or creating a new history\n\t */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t this.on({\n\t error: function (model, xhr, options, msg, details) {\n\t this.errorHandler(model, xhr, options, msg, details);\n\t },\n\t 'loading-done': function () {\n\t var self = this;\n\t // after the initial load, decorate with more time consuming fields (like HDCA element_counts)\n\t _.delay(function () {\n\t self.model.contents.fetchCollectionCounts();\n\t }, self.FETCH_COLLECTION_COUNTS_DELAY);\n\t },\n\t 'views:ready view:attached view:removed': function (view) {\n\t this._renderSelectButton();\n\t },\n\t 'view:attached': function (view) {\n\t this.scrollTo(0);\n\t }\n\t });\n\t // this.on( 'all', function(){ console.debug( arguments ); });\n\t },\n\t\n\t // ------------------------------------------------------------------------ loading history/hda models\n\t /** load the history with the given id then it's contents, sending ajax options to both */\n\t loadHistory: function (historyId, options, contentsOptions) {\n\t contentsOptions = _.extend(contentsOptions || { silent: true });\n\t this.info('loadHistory:', historyId, options, contentsOptions);\n\t var self = this;\n\t self.setModel(new HISTORY_MODEL.History({ id: historyId }));\n\t\n\t contentsOptions.silent = true;\n\t self.trigger('loading');\n\t return self.model.fetchWithContents(options, contentsOptions).always(function () {\n\t self.render();\n\t self.trigger('loading-done');\n\t });\n\t },\n\t\n\t /** convenience alias to the model. Updates the item list only (not the history) */\n\t refreshContents: function (options) {\n\t if (this.model) {\n\t return this.model.refresh(options);\n\t }\n\t // may have callbacks - so return an empty promise\n\t return $.when();\n\t },\n\t\n\t /** Override to reset web storage when the id changes (since it needs the id) */\n\t _setUpCollectionListeners: function () {\n\t _super.prototype._setUpCollectionListeners.call(this);\n\t return this.listenTo(this.collection, {\n\t // 'all' : function(){ console.log( this.collection + ':', arguments ); },\n\t 'fetching-more': function () {\n\t this._toggleContentsLoadingIndicator(true);\n\t this.$emptyMessage().hide();\n\t },\n\t 'fetching-more-done': function () {\n\t this._toggleContentsLoadingIndicator(false);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel rendering\n\t /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n\t _showLoadingIndicator: function (msg, speed, callback) {\n\t var $indicator = $('
                                            ');\n\t this.$el.html($indicator.text(msg).slideDown(!_.isUndefined(speed) ? speed : this.fxSpeed));\n\t },\n\t\n\t /** hide the loading indicator */\n\t _hideLoadingIndicator: function (speed) {\n\t // make speed a bit slower to compensate for slow rendering of up to 500 contents\n\t this.$('.loading-indicator').slideUp(!_.isUndefined(speed) ? speed : this.fxSpeed + 200, function () {\n\t $(this).remove();\n\t });\n\t },\n\t\n\t /** In this override, add a btn to toggle the selectors */\n\t _buildNewRender: function () {\n\t var $newRender = _super.prototype._buildNewRender.call(this);\n\t this._renderSelectButton($newRender);\n\t return $newRender;\n\t },\n\t\n\t /** button for starting select mode */\n\t _renderSelectButton: function ($where) {\n\t $where = $where || this.$el;\n\t // do not render selector option if no actions\n\t if (!this.multiselectActions().length) {\n\t return null;\n\t }\n\t // do not render (and remove even) if nothing to select\n\t if (!this.views.length) {\n\t this.hideSelectors();\n\t $where.find('.controls .actions .show-selectors-btn').remove();\n\t return null;\n\t }\n\t // don't bother rendering if there's one already\n\t var $existing = $where.find('.controls .actions .show-selectors-btn');\n\t if ($existing.length) {\n\t return $existing;\n\t }\n\t\n\t return faIconButton({\n\t title: _l('Operations on multiple datasets'),\n\t classes: 'show-selectors-btn',\n\t faIcon: 'fa-check-square-o'\n\t }).prependTo($where.find('.controls .actions'));\n\t },\n\t\n\t /** override to avoid showing intial empty message using contents_active */\n\t _renderEmptyMessage: function ($whereTo) {\n\t var self = this;\n\t var $emptyMsg = self.$emptyMessage($whereTo);\n\t\n\t var empty = self.model.get('contents_active').active <= 0;\n\t if (empty) {\n\t return $emptyMsg.empty().append(self.emptyMsg).show();\n\t } else if (self.searchFor && self.model.contents.haveSearchDetails() && !self.views.length) {\n\t return $emptyMsg.empty().append(self.noneFoundMsg).show();\n\t }\n\t $emptyMsg.hide();\n\t return $();\n\t },\n\t\n\t /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n\t $scrollContainer: function ($where) {\n\t // override or set via attributes.$scrollContainer\n\t return this.$list($where);\n\t },\n\t\n\t // ------------------------------------------------------------------------ subviews\n\t _toggleContentsLoadingIndicator: function (show) {\n\t if (!show) {\n\t this.$list().find('.contents-loading-indicator').remove();\n\t } else {\n\t this.$list().html('
                                            ' + '
                                            ');\n\t }\n\t },\n\t\n\t /** override to render pagination also */\n\t renderItems: function ($whereTo) {\n\t // console.log( this + '.renderItems-----------------', new Date() );\n\t $whereTo = $whereTo || this.$el;\n\t var self = this;\n\t var $list = self.$list($whereTo);\n\t\n\t // TODO: bootstrap hack to remove orphaned tooltips\n\t $('.tooltip').remove();\n\t\n\t $list.empty();\n\t self.views = [];\n\t\n\t var models = self._filterCollection();\n\t if (models.length) {\n\t self._renderPagination($whereTo);\n\t self.views = self._renderSomeItems(models, $list);\n\t } else {\n\t // TODO: consolidate with _renderPagination above by (???) passing in models/length?\n\t $whereTo.find('> .controls .list-pagination').empty();\n\t }\n\t self._renderEmptyMessage($whereTo).toggle(!models.length);\n\t\n\t self.trigger('views:ready', self.views);\n\t return self.views;\n\t },\n\t\n\t /** render pagination controls if not searching and contents says we're paginating */\n\t _renderPagination: function ($whereTo) {\n\t var $paginationControls = $whereTo.find('> .controls .list-pagination');\n\t if (this.searchFor || !this.model.contents.shouldPaginate()) return $paginationControls.empty();\n\t\n\t $paginationControls.html(this.templates.pagination({\n\t // pagination is 1-based for the user\n\t current: this.model.contents.currentPage + 1,\n\t last: this.model.contents.getLastPage() + 1\n\t }, this));\n\t $paginationControls.find('select.pages').tooltip();\n\t return $paginationControls;\n\t },\n\t\n\t /** render a subset of the entire collection (client-side pagination) */\n\t _renderSomeItems: function (models, $list) {\n\t var self = this;\n\t var views = [];\n\t $list.append(models.map(function (m) {\n\t var view = self._createItemView(m);\n\t views.push(view);\n\t return self._renderItemView$el(view);\n\t }));\n\t return views;\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** in this override, check if the contents would also display based on includeDeleted/hidden */\n\t _filterItem: function (model) {\n\t var self = this;\n\t var contents = self.model.contents;\n\t return (contents.includeHidden || !model.hidden()) && (contents.includeDeleted || !model.isDeletedOrPurged()) && _super.prototype._filterItem.call(self, model);\n\t },\n\t\n\t /** In this override, since history contents are mixed,\n\t * get the appropo view class based on history_content_type\n\t */\n\t _getItemViewClass: function (model) {\n\t var contentType = model.get(\"history_content_type\");\n\t switch (contentType) {\n\t case 'dataset':\n\t return this.HDAViewClass;\n\t case 'dataset_collection':\n\t return this.HDCAViewClass;\n\t }\n\t throw new TypeError('Unknown history_content_type: ' + contentType);\n\t },\n\t\n\t /** in this override, add a linktarget, and expand if id is in web storage */\n\t _getItemViewOptions: function (model) {\n\t var options = _super.prototype._getItemViewOptions.call(this, model);\n\t return _.extend(options, {\n\t linkTarget: this.linkTarget,\n\t expanded: this.model.contents.storage.isExpanded(model.id),\n\t hasUser: this.model.ownedByCurrUser()\n\t });\n\t },\n\t\n\t /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t _super.prototype._setUpItemViewListeners.call(panel, view);\n\t //TODO: send from content view: this.model.collection.storage.addExpanded\n\t // maintain a list of items whose bodies are expanded\n\t return panel.listenTo(view, {\n\t 'expanded': function (v) {\n\t panel.model.contents.storage.addExpanded(v.model);\n\t },\n\t 'collapsed': function (v) {\n\t panel.model.contents.storage.removeExpanded(v.model);\n\t }\n\t });\n\t },\n\t\n\t /** override to remove expandedIds from webstorage */\n\t collapseAll: function () {\n\t this.model.contents.storage.clearExpanded();\n\t _super.prototype.collapseAll.call(this);\n\t },\n\t\n\t // ------------------------------------------------------------------------ selection\n\t /** Override to correctly set the historyId of the new collection */\n\t getSelectedModels: function () {\n\t var collection = _super.prototype.getSelectedModels.call(this);\n\t collection.historyId = this.collection.historyId;\n\t return collection;\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .show-selectors-btn': 'toggleSelectors',\n\t 'click > .controls .prev': '_clickPrevPage',\n\t 'click > .controls .next': '_clickNextPage',\n\t 'change > .controls .pages': '_changePageSelect',\n\t // allow (error) messages to be clicked away\n\t 'click .messages [class$=message]': 'clearMessages'\n\t }),\n\t\n\t _clickPrevPage: function (ev) {\n\t this.model.clearUpdateTimeout();\n\t this.model.contents.fetchPrevPage();\n\t },\n\t\n\t _clickNextPage: function (ev) {\n\t this.model.clearUpdateTimeout();\n\t this.model.contents.fetchNextPage();\n\t },\n\t\n\t _changePageSelect: function (ev) {\n\t this.model.clearUpdateTimeout();\n\t var page = $(ev.currentTarget).val();\n\t this.model.contents.fetchPage(page);\n\t },\n\t\n\t /** Toggle and store the deleted visibility and re-render items\n\t * @returns {Boolean} new setting\n\t */\n\t toggleShowDeleted: function (show, options) {\n\t show = show !== undefined ? show : !this.model.contents.includeDeleted;\n\t var self = this;\n\t var contents = self.model.contents;\n\t contents.setIncludeDeleted(show, options);\n\t self.trigger('show-deleted', show);\n\t\n\t contents.fetchCurrentPage({ renderAll: true });\n\t return show;\n\t },\n\t\n\t /** Toggle and store whether to render explicity hidden contents\n\t * @returns {Boolean} new setting\n\t */\n\t toggleShowHidden: function (show, store, options) {\n\t // console.log( 'toggleShowHidden', show, store );\n\t show = show !== undefined ? show : !this.model.contents.includeHidden;\n\t var self = this;\n\t var contents = self.model.contents;\n\t contents.setIncludeHidden(show, options);\n\t self.trigger('show-hidden', show);\n\t\n\t contents.fetchCurrentPage({ renderAll: true });\n\t return show;\n\t },\n\t\n\t /** On the first search, if there are no details - load them, then search */\n\t _firstSearch: function (searchFor) {\n\t var self = this;\n\t var inputSelector = '> .controls .search-input';\n\t this.log('onFirstSearch', searchFor);\n\t\n\t // if the contents already have enough details to search, search and return now\n\t if (self.model.contents.haveSearchDetails()) {\n\t self.searchItems(searchFor);\n\t return;\n\t }\n\t\n\t // otherwise, load the details progressively here\n\t self.$(inputSelector).searchInput('toggle-loading');\n\t // set this now so that only results will show during progress\n\t self.searchFor = searchFor;\n\t var xhr = self.model.contents.progressivelyFetchDetails({ silent: true }).progress(function (response, limit, offset) {\n\t self.renderItems();\n\t self.trigger('search:loading-progress', limit, offset);\n\t }).always(function () {\n\t self.$el.find(inputSelector).searchInput('toggle-loading');\n\t }).done(function () {\n\t self.searchItems(searchFor, 'force');\n\t });\n\t },\n\t\n\t /** clear the search filters and show all views that are normally shown */\n\t clearSearch: function (searchFor) {\n\t var self = this;\n\t if (!self.searchFor) return self;\n\t //self.log( 'onSearchClear', self );\n\t self.searchFor = '';\n\t self.trigger('search:clear', self);\n\t self.$('> .controls .search-query').val('');\n\t // NOTE: silent + render prevents collection update event with merge only\n\t // - which causes an empty page due to event handler above\n\t self.model.contents.fetchCurrentPage({ silent: true }).done(function () {\n\t self.renderItems();\n\t });\n\t return self;\n\t },\n\t\n\t // ........................................................................ error handling\n\t /** Event handler for errors (from the panel, the history, or the history's contents)\n\t * Alternately use two strings for model and xhr to use custom message and title (respectively)\n\t * @param {Model or View} model the (Backbone) source of the error\n\t * @param {XMLHTTPRequest} xhr any ajax obj. assoc. with the error\n\t * @param {Object} options the options map commonly used with bbone ajax\n\t */\n\t errorHandler: function (model, xhr, options) {\n\t //TODO: to mixin or base model\n\t // interrupted ajax or no connection\n\t if (xhr && xhr.status === 0 && xhr.readyState === 0) {\n\t // return ERROR_MODAL.offlineErrorModal();\n\t // fail silently\n\t return;\n\t }\n\t // otherwise, leave something to report in the console\n\t this.error(model, xhr, options);\n\t // and feedback to a modal\n\t // if sent two strings (and possibly details as 'options'), use those as message and title\n\t if (_.isString(model) && _.isString(xhr)) {\n\t var message = model;\n\t var title = xhr;\n\t return ERROR_MODAL.errorModal(message, title, options);\n\t }\n\t // bad gateway\n\t // TODO: possibly to global handler\n\t if (xhr && xhr.status === 502) {\n\t return ERROR_MODAL.badGatewayErrorModal();\n\t }\n\t return ERROR_MODAL.ajaxErrorModal(model, xhr, options);\n\t },\n\t\n\t /** Remove all messages from the panel. */\n\t clearMessages: function (ev) {\n\t var $target = !_.isUndefined(ev) ? $(ev.currentTarget) : this.$messages().children('[class$=\"message\"]');\n\t $target.fadeOut(this.fxSpeed, function () {\n\t $(this).remove();\n\t });\n\t return this;\n\t },\n\t\n\t // ........................................................................ scrolling\n\t /** Scrolls the panel to show the content sub-view with the given hid.\n\t * @param {Integer} hid the hid of item to scroll into view\n\t * @returns {HistoryView} the panel\n\t */\n\t scrollToHid: function (hid) {\n\t return this.scrollToItem(_.first(this.viewsWhereModel({ hid: hid })));\n\t },\n\t\n\t // ........................................................................ misc\n\t /** utility for adding -st, -nd, -rd, -th to numbers */\n\t ordinalIndicator: function (number) {\n\t var numStr = number + '';\n\t switch (numStr.charAt(numStr.length - 1)) {\n\t case '1':\n\t return numStr + 'st';\n\t case '2':\n\t return numStr + 'nd';\n\t case '3':\n\t return numStr + 'rd';\n\t default:\n\t return numStr + 'th';\n\t }\n\t },\n\t\n\t /** Return a string rep of the history */\n\t toString: function () {\n\t return 'HistoryView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t HistoryView.prototype.templates = function () {\n\t\n\t var mainTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
                                            ', '
                                            ', '
                                              ', '
                                              ', '
                                              ']);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
                                              ', '
                                              ', '
                                              <%- history.name %>
                                              ', '
                                              ', '
                                              ', '
                                              <%- history.nice_size %>
                                              ', '
                                              ', '
                                              ', '<% if( history.deleted && history.purged ){ %>', '
                                              ', _l('This history has been purged and deleted'), '
                                              ', '<% } else if( history.deleted ){ %>', '
                                              ', _l('This history has been deleted'), '
                                              ', '<% } else if( history.purged ){ %>', '
                                              ', _l('This history has been purged'), '
                                              ', '<% } %>', '<% if( history.message ){ %>',\n\t // should already be localized\n\t '
                                              messagesmall\">', '<%= history.message.text %>', '
                                              ', '<% } %>', '
                                              ',\n\t\n\t // add tags and annotations\n\t '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '', '', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              '], 'history');\n\t\n\t var paginationTemplate = BASE_MVC.wrapTemplate(['', '', ''], 'pages');\n\t\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t el: mainTemplate,\n\t controls: controlsTemplate,\n\t pagination: paginationTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HistoryView: HistoryView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 135 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(18), __webpack_require__(86), __webpack_require__(7), __webpack_require__(6), __webpack_require__(44)], __WEBPACK_AMD_DEFINE_RESULT__ = function (PopupMenu, historyCopyDialog, BASE_MVC, _l, Webhooks) {\n\t\n\t 'use strict';\n\t\n\t // ============================================================================\n\t\n\t var menu = [{\n\t html: _l('History Lists'),\n\t header: true\n\t }, {\n\t html: _l('Saved Histories'),\n\t href: 'histories/list',\n\t target: '_top'\n\t\n\t }, {\n\t html: _l('Histories Shared with Me'),\n\t href: 'histories/list_shared',\n\t target: '_top'\n\t }, {\n\t html: _l('Current History'),\n\t header: true,\n\t anon: true\n\t }, {\n\t html: _l('Create New'),\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel) {\n\t Galaxy.currHistoryPanel.createNewHistory();\n\t }\n\t }\n\t }, {\n\t html: _l('Copy History'),\n\t func: function () {\n\t historyCopyDialog(Galaxy.currHistoryPanel.model).done(function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }, {\n\t html: _l('Share or Publish'),\n\t href: 'history/sharing'\n\t }, {\n\t html: _l('Show Structure'),\n\t href: 'history/display_structured',\n\t anon: true\n\t }, {\n\t html: _l('Extract Workflow'),\n\t href: 'workflow/build_from_current_history'\n\t }, {\n\t html: _l('Delete'),\n\t anon: true,\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really delete the current history?'))) {\n\t Galaxy.currHistoryPanel.model._delete().done(function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Delete Permanently'),\n\t purge: true,\n\t anon: true,\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really delete the current history permanently? This cannot be undone.'))) {\n\t Galaxy.currHistoryPanel.model.purge().done(function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Dataset Actions'),\n\t header: true,\n\t anon: true\n\t }, {\n\t html: _l('Copy Datasets'),\n\t href: 'dataset/copy_datasets'\n\t }, {\n\t html: _l('Dataset Security'),\n\t href: 'root/history_set_default_permissions'\n\t }, {\n\t html: _l('Resume Paused Jobs'),\n\t href: 'history/resume_paused_jobs?current=True',\n\t anon: true\n\t }, {\n\t html: _l('Collapse Expanded Datasets'),\n\t func: function () {\n\t if (Galaxy && Galaxy.currHistoryPanel) {\n\t Galaxy.currHistoryPanel.collapseAll();\n\t }\n\t }\n\t }, {\n\t html: _l('Unhide Hidden Datasets'),\n\t anon: true,\n\t func: function () {\n\t // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really unhide all hidden datasets?'))) {\n\t $.post(Galaxy.root + \"history/adjust_hidden\", { 'user_action': 'unhide' }, function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Delete Hidden Datasets'),\n\t anon: true,\n\t func: function () {\n\t // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n\t if (Galaxy && Galaxy.currHistoryPanel && confirm(_l('Really delete all hidden datasets?'))) {\n\t $.post(Galaxy.root + \"history/adjust_hidden\", { 'user_action': 'delete' }, function () {\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t }\n\t }\n\t }, {\n\t html: _l('Purge Deleted Datasets'),\n\t confirm: _l('Really delete all deleted datasets permanently? This cannot be undone.'),\n\t href: 'history/purge_deleted_datasets',\n\t purge: true,\n\t anon: true\n\t }, {\n\t html: _l('Downloads'),\n\t header: true\n\t }, {\n\t html: _l('Export Tool Citations'),\n\t href: 'history/citations',\n\t anon: true\n\t }, {\n\t html: _l('Export History to File'),\n\t href: 'history/export_archive?preview=True',\n\t anon: true\n\t }, {\n\t html: _l('Other Actions'),\n\t header: true\n\t }, {\n\t html: _l('Import from File'),\n\t href: 'history/import_archive'\n\t }];\n\t\n\t // Webhooks\n\t Webhooks.add({\n\t url: 'api/webhooks/history-menu/all',\n\t async: false, // (hypothetically) slows down the performance\n\t callback: function (webhooks) {\n\t var webhooks_menu = [];\n\t\n\t $.each(webhooks.models, function (index, model) {\n\t var webhook = model.toJSON();\n\t if (webhook.activate) {\n\t webhooks_menu.push({\n\t html: _l(webhook.config.title),\n\t // func: function() {},\n\t anon: true\n\t });\n\t }\n\t });\n\t\n\t if (webhooks_menu.length > 0) {\n\t webhooks_menu.unshift({\n\t html: _l('Webhooks'),\n\t header: true\n\t });\n\t $.merge(menu, webhooks_menu);\n\t }\n\t }\n\t });\n\t\n\t function buildMenu(isAnon, purgeAllowed, urlRoot) {\n\t return _.clone(menu).filter(function (menuOption) {\n\t if (isAnon && !menuOption.anon) {\n\t return false;\n\t }\n\t if (!purgeAllowed && menuOption.purge) {\n\t return false;\n\t }\n\t\n\t //TODO:?? hard-coded galaxy_main\n\t if (menuOption.href) {\n\t menuOption.href = urlRoot + menuOption.href;\n\t menuOption.target = menuOption.target || 'galaxy_main';\n\t }\n\t\n\t if (menuOption.confirm) {\n\t menuOption.func = function () {\n\t if (confirm(menuOption.confirm)) {\n\t galaxy_main.location = menuOption.href;\n\t }\n\t };\n\t }\n\t return true;\n\t });\n\t }\n\t\n\t var create = function ($button, options) {\n\t options = options || {};\n\t var isAnon = options.anonymous === undefined ? true : options.anonymous,\n\t purgeAllowed = options.purgeAllowed || false,\n\t menu = buildMenu(isAnon, purgeAllowed, Galaxy.root);\n\t //console.debug( 'menu:', menu );\n\t return new PopupMenu($button, menu);\n\t };\n\t\n\t // ============================================================================\n\t return create;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 136 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** Renders the collection uploader rows */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(43), __webpack_require__(70), __webpack_require__(21), __webpack_require__(22)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, UploadModel, UploadSettings, Popover, Select) {\n\t return Backbone.View.extend({\n\t /** Dictionary of upload states and associated icons */\n\t status_classes: {\n\t init: 'upload-icon-button fa fa-trash-o',\n\t queued: 'upload-icon fa fa-spinner fa-spin',\n\t running: 'upload-icon fa fa-spinner fa-spin',\n\t success: 'upload-icon-button fa fa-check',\n\t error: 'upload-icon-button fa fa-exclamation-triangle'\n\t },\n\t\n\t initialize: function (app, options) {\n\t var self = this;\n\t this.app = app;\n\t this.model = options.model;\n\t this.setElement(this._template(options.model));\n\t this.$mode = this.$('.upload-mode');\n\t this.$title = this.$('.upload-title-extended');\n\t this.$text = this.$('.upload-text');\n\t this.$size = this.$('.upload-size');\n\t this.$info_text = this.$('.upload-info-text');\n\t this.$info_progress = this.$('.upload-info-progress');\n\t this.$text_content = this.$('.upload-text-content');\n\t this.$symbol = this.$('.upload-symbol');\n\t this.$progress_bar = this.$('.upload-progress-bar');\n\t this.$percentage = this.$('.upload-percentage');\n\t\n\t // append popup to settings icon\n\t this.settings = new Popover.View({\n\t title: 'Upload configuration',\n\t container: this.$('.upload-settings'),\n\t placement: 'bottom'\n\t });\n\t\n\t // identify default genome and extension values\n\t var default_genome = this.app.select_genome.value();\n\t var default_extension = this.app.select_extension.value();\n\t\n\t // handle click event\n\t this.$symbol.on('click', function () {\n\t self._removeRow();\n\t });\n\t\n\t // handle text editing event\n\t this.$text_content.on('change input', function (e) {\n\t self.model.set({ 'url_paste': $(e.target).val(),\n\t 'file_size': $(e.target).val().length });\n\t });\n\t\n\t // model events\n\t this.listenTo(this.model, 'change:percentage', function () {\n\t self._refreshPercentage();\n\t });\n\t this.listenTo(this.model, 'change:status', function () {\n\t self._refreshStatus();\n\t });\n\t this.listenTo(this.model, 'change:info', function () {\n\t self._refreshInfo();\n\t });\n\t this.listenTo(this.model, 'change:file_size', function () {\n\t self._refreshFileSize();\n\t });\n\t this.listenTo(this.model, 'remove', function () {\n\t self.remove();\n\t });\n\t this.app.collection.on('reset', function () {\n\t self.remove();\n\t });\n\t },\n\t\n\t render: function () {\n\t var options = this.model.attributes;\n\t this.$title.html(_.escape(options.file_name));\n\t this.$size.html(Utils.bytesToString(options.file_size));\n\t this.$mode.removeClass().addClass('upload-mode').addClass('text-primary');\n\t if (options.file_mode == 'new') {\n\t this.$text.css({ 'width': this.$el.width() - 16 + 'px', 'top': this.$el.height() - 8 + 'px' }).show();\n\t this.$el.height(this.$el.height() - 8 + this.$text.height() + 16);\n\t this.$mode.addClass('fa fa-edit');\n\t } else if (options.file_mode == 'local') {\n\t this.$mode.addClass('fa fa-laptop');\n\t } else if (options.file_mode == 'ftp') {\n\t this.$mode.addClass('fa fa-folder-open-o');\n\t }\n\t },\n\t\n\t /** Refresh info text */\n\t _refreshInfo: function () {\n\t var info = this.model.get('info');\n\t if (info) {\n\t this.$info_text.html('Failed: ' + info).show();\n\t } else {\n\t this.$info_text.hide();\n\t }\n\t },\n\t\n\t /** Refresh percentage status */\n\t _refreshPercentage: function () {\n\t var percentage = parseInt(this.model.get('percentage'));\n\t this.$progress_bar.css({ width: percentage + '%' });\n\t this.$percentage.html(percentage != 100 ? percentage + '%' : 'Adding to history...');\n\t },\n\t\n\t /** Refresh status */\n\t _refreshStatus: function () {\n\t var status = this.model.get('status');\n\t this.$symbol.removeClass().addClass('upload-symbol').addClass(this.status_classes[status]);\n\t this.model.set('enabled', status == 'init');\n\t var enabled = this.model.get('enabled');\n\t this.$text_content.attr('disabled', !enabled);\n\t if (status == 'success') {\n\t this.$el.addClass('success');\n\t this.$percentage.html('100%');\n\t }\n\t if (status == 'error') {\n\t this.$el.addClass('danger');\n\t this.$info_progress.hide();\n\t }\n\t },\n\t\n\t /** Refresh file size */\n\t _refreshFileSize: function () {\n\t this.$size.html(Utils.bytesToString(this.model.get('file_size')));\n\t },\n\t\n\t /** Remove row */\n\t _removeRow: function () {\n\t if (['init', 'success', 'error'].indexOf(this.model.get('status')) !== -1) {\n\t this.app.collection.remove(this.model);\n\t }\n\t },\n\t\n\t /** Attach file info popup */\n\t _showSettings: function () {\n\t if (!this.settings.visible) {\n\t this.settings.empty();\n\t this.settings.append(new UploadSettings(this).$el);\n\t this.settings.show();\n\t } else {\n\t this.settings.hide();\n\t }\n\t },\n\t\n\t /** View template */\n\t _template: function (options) {\n\t return '
                                              ' + '' +\n '' +\n '' +\n '' +\n '' +\n '';\n },\n\n /** Template of table */\n _templateTable: function() {\n return 'Available files: ' +\n '' +\n '' +\n '  ' +\n '' +\n '' +\n '' +\n '
                                              ').append($checkbox)).append($('').append(parameter.title)));\n\t });\n\t this.$cover[this.model.get('enabled') && 'hide' || 'show']();\n\t }\n\t });\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 71 */,\n/* 72 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(jQuery, _) {/*\n\t galaxy upload plugins - requires FormData and XMLHttpRequest\n\t*/\n\t;(function ($) {\n\t // add event properties\n\t jQuery.event.props.push(\"dataTransfer\");\n\t\n\t /**\n\t Posts file data to the API\n\t */\n\t $.uploadpost = function (config) {\n\t // parse options\n\t var cnf = $.extend({}, {\n\t data: {},\n\t success: function () {},\n\t error: function () {},\n\t progress: function () {},\n\t url: null,\n\t maxfilesize: 2048,\n\t error_filesize: 'File exceeds 2GB. Please use a FTP client.',\n\t error_default: 'Please make sure the file is available.',\n\t error_server: 'Upload request failed.',\n\t error_login: 'Uploads require you to log in.'\n\t }, config);\n\t\n\t // link data\n\t var data = cnf.data;\n\t\n\t // check errors\n\t if (data.error_message) {\n\t cnf.error(data.error_message);\n\t return;\n\t }\n\t\n\t // construct form data\n\t var form = new FormData();\n\t for (var key in data.payload) {\n\t form.append(key, data.payload[key]);\n\t }\n\t\n\t // add files to submission\n\t var sizes = 0;\n\t for (var key in data.files) {\n\t var d = data.files[key];\n\t form.append(d.name, d.file, d.file.name);\n\t sizes += d.file.size;\n\t }\n\t\n\t // check file size, unless it's an ftp file\n\t if (sizes > 1048576 * cnf.maxfilesize) {\n\t cnf.error(cnf.error_filesize);\n\t return;\n\t }\n\t\n\t // prepare request\n\t var xhr = new XMLHttpRequest();\n\t xhr.open('POST', cnf.url, true);\n\t xhr.setRequestHeader('Accept', 'application/json');\n\t xhr.setRequestHeader('Cache-Control', 'no-cache');\n\t xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\t\n\t // captures state changes\n\t xhr.onreadystatechange = function () {\n\t // check for request completed, server connection closed\n\t if (xhr.readyState == xhr.DONE) {\n\t // parse response\n\t var response = null;\n\t var extra_info = \"\";\n\t if (xhr.responseText) {\n\t try {\n\t response = jQuery.parseJSON(xhr.responseText);\n\t extra_info = response.err_msg;\n\t } catch (e) {\n\t response = xhr.responseText;\n\t extra_info = response;\n\t }\n\t }\n\t // pass any error to the error option\n\t if (xhr.status < 200 || xhr.status > 299) {\n\t var text = xhr.statusText;\n\t if (xhr.status == 403) {\n\t text = cnf.error_login;\n\t } else if (xhr.status == 0) {\n\t text = cnf.error_server;\n\t } else if (!text) {\n\t text = cnf.error_default;\n\t }\n\t cnf.error(text + ' (' + xhr.status + '). ' + extra_info);\n\t } else {\n\t cnf.success(response);\n\t }\n\t }\n\t };\n\t\n\t // prepare upload progress\n\t xhr.upload.addEventListener('progress', function (e) {\n\t if (e.lengthComputable) {\n\t cnf.progress(Math.round(e.loaded * 100 / e.total));\n\t }\n\t }, false);\n\t\n\t // send request\n\t Galaxy.emit.debug('uploadbox::uploadpost()', 'Posting following data.', cnf);\n\t xhr.send(form);\n\t };\n\t\n\t /**\n\t Handles the upload events drag/drop etc.\n\t */\n\t $.fn.uploadinput = function (options) {\n\t // initialize\n\t var el = this;\n\t var opts = $.extend({}, {\n\t ondragover: function () {},\n\t ondragleave: function () {},\n\t onchange: function () {},\n\t multiple: false\n\t }, options);\n\t\n\t // append hidden upload field\n\t var $input = $('');\n\t el.append($input.change(function (e) {\n\t opts.onchange(e.target.files);\n\t $(this).val('');\n\t }));\n\t\n\t // drag/drop events\n\t el.on('drop', function (e) {\n\t opts.ondragleave(e);\n\t if (e.dataTransfer) {\n\t opts.onchange(e.dataTransfer.files);\n\t e.preventDefault();\n\t }\n\t });\n\t el.on('dragover', function (e) {\n\t e.preventDefault();\n\t opts.ondragover(e);\n\t });\n\t el.on('dragleave', function (e) {\n\t e.stopPropagation();\n\t opts.ondragleave(e);\n\t });\n\t\n\t // exports\n\t return {\n\t dialog: function () {\n\t $input.trigger('click');\n\t }\n\t };\n\t };\n\t\n\t /**\n\t Handles the upload queue and events such as drag/drop etc.\n\t */\n\t $.fn.uploadbox = function (options) {\n\t // parse options\n\t var opts = $.extend({}, {\n\t dragover: function () {},\n\t dragleave: function () {},\n\t announce: function (d) {},\n\t initialize: function (d) {},\n\t progress: function (d, m) {},\n\t success: function (d, m) {},\n\t error: function (d, m) {\n\t alert(m);\n\t },\n\t complete: function () {}\n\t }, options);\n\t\n\t // file queue\n\t var queue = {};\n\t\n\t // queue index/length counter\n\t var queue_index = 0;\n\t var queue_length = 0;\n\t\n\t // indicates if queue is currently running\n\t var queue_running = false;\n\t var queue_stop = false;\n\t\n\t // element\n\t var uploadinput = $(this).uploadinput({\n\t multiple: true,\n\t onchange: function (files) {\n\t add(files);\n\t },\n\t ondragover: options.ondragover,\n\t ondragleave: options.ondragleave\n\t });\n\t\n\t // add new files to upload queue\n\t function add(files) {\n\t if (files && files.length && !queue_running) {\n\t var current_index = queue_index;\n\t _.each(files, function (file, key) {\n\t if (file.mode !== 'new' && _.filter(queue, function (f) {\n\t return f.name === file.name && f.size === file.size;\n\t }).length) {\n\t file.duplicate = true;\n\t }\n\t });\n\t _.each(files, function (file) {\n\t if (!file.duplicate) {\n\t var index = String(queue_index++);\n\t queue[index] = file;\n\t opts.announce(index, queue[index]);\n\t queue_length++;\n\t }\n\t });\n\t return current_index;\n\t }\n\t }\n\t\n\t // remove file from queue\n\t function remove(index) {\n\t if (queue[index]) {\n\t delete queue[index];\n\t queue_length--;\n\t }\n\t }\n\t\n\t // process an upload, recursive\n\t function process() {\n\t // validate\n\t if (queue_length == 0 || queue_stop) {\n\t queue_stop = false;\n\t queue_running = false;\n\t opts.complete();\n\t return;\n\t } else {\n\t queue_running = true;\n\t }\n\t\n\t // get an identifier from the queue\n\t var index = -1;\n\t for (var key in queue) {\n\t index = key;\n\t break;\n\t }\n\t\n\t // get current file from queue\n\t var file = queue[index];\n\t\n\t // remove from queue\n\t remove(index);\n\t\n\t // create and submit data\n\t $.uploadpost({\n\t url: opts.url,\n\t data: opts.initialize(index),\n\t success: function (message) {\n\t opts.success(index, message);process();\n\t },\n\t error: function (message) {\n\t opts.error(index, message);process();\n\t },\n\t progress: function (percentage) {\n\t opts.progress(index, percentage);\n\t }\n\t });\n\t }\n\t\n\t /*\n\t public interface\n\t */\n\t\n\t // open file browser for selection\n\t function select() {\n\t uploadinput.dialog();\n\t }\n\t\n\t // remove all entries from queue\n\t function reset(index) {\n\t for (index in queue) {\n\t remove(index);\n\t }\n\t }\n\t\n\t // initiate upload process\n\t function start() {\n\t if (!queue_running) {\n\t queue_running = true;\n\t process();\n\t }\n\t }\n\t\n\t // stop upload process\n\t function stop() {\n\t queue_stop = true;\n\t }\n\t\n\t // set options\n\t function configure(options) {\n\t opts = $.extend({}, opts, options);\n\t return opts;\n\t }\n\t\n\t // verify browser compatibility\n\t function compatible() {\n\t return window.File && window.FormData && window.XMLHttpRequest && window.FileList;\n\t }\n\t\n\t // export functions\n\t return {\n\t 'select': select,\n\t 'add': add,\n\t 'remove': remove,\n\t 'start': start,\n\t 'stop': stop,\n\t 'reset': reset,\n\t 'configure': configure,\n\t 'compatible': compatible\n\t };\n\t };\n\t})(jQuery);\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 73 */,\n/* 74 */,\n/* 75 */,\n/* 76 */,\n/* 77 */,\n/* 78 */,\n/* 79 */,\n/* 80 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(7), __webpack_require__(6), __webpack_require__(24)], __WEBPACK_AMD_DEFINE_RESULT__ = function (baseMVC, _l) {\n\t // =============================================================================\n\t /** A view on any model that has a 'annotation' attribute\n\t */\n\t var AnnotationEditor = Backbone.View.extend(baseMVC.LoggableMixin).extend(baseMVC.HiddenUntilActivatedViewMixin).extend({\n\t\n\t tagName: 'div',\n\t className: 'annotation-display',\n\t\n\t /** Set up listeners, parse options */\n\t initialize: function (options) {\n\t options = options || {};\n\t this.tooltipConfig = options.tooltipConfig || { placement: 'bottom' };\n\t //console.debug( this, options );\n\t // only listen to the model only for changes to annotations\n\t this.listenTo(this.model, 'change:annotation', function () {\n\t this.render();\n\t });\n\t this.hiddenUntilActivated(options.$activator, options);\n\t },\n\t\n\t /** Build the DOM elements, call select to on the created input, and set up behaviors */\n\t render: function () {\n\t var view = this;\n\t this.$el.html(this._template());\n\t\n\t //TODO: handle empties better\n\t this.$annotation().make_text_editable({\n\t use_textarea: true,\n\t on_finish: function (newAnnotation) {\n\t view.$annotation().text(newAnnotation);\n\t view.model.save({ annotation: newAnnotation }, { silent: true }).fail(function () {\n\t view.$annotation().text(view.model.previous('annotation'));\n\t });\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** @returns {String} the html text used to build the view's DOM */\n\t _template: function () {\n\t var annotation = this.model.get('annotation');\n\t return [\n\t //TODO: make prompt optional\n\t '',\n\t // set up initial tags by adding as CSV to input vals (necc. to init select2)\n\t '
                                              ', _.escape(annotation), '
                                              '].join('');\n\t },\n\t\n\t /** @returns {jQuery} the main element for this view */\n\t $annotation: function () {\n\t return this.$el.find('.annotation');\n\t },\n\t\n\t /** shut down event listeners and remove this view's DOM */\n\t remove: function () {\n\t this.$annotation.off();\n\t this.stopListening(this.model);\n\t Backbone.View.prototype.remove.call(this);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return ['AnnotationEditor(', this.model + '', ')'].join('');\n\t }\n\t });\n\t // =============================================================================\n\t return {\n\t AnnotationEditor: AnnotationEditor\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3)))\n\n/***/ },\n/* 81 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3), __webpack_require__(2), __webpack_require__(7)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_, Backbone, BASE_MVC) {\n\t 'use strict';\n\t\n\t //=============================================================================\n\t /**\n\t * A Collection that can be limited/offset/re-ordered/filtered.\n\t * @type {Backbone.Collection}\n\t */\n\t\n\t var ControlledFetchCollection = Backbone.Collection.extend({\n\t\n\t /** call setOrder on initialization to build the comparator based on options */\n\t initialize: function (models, options) {\n\t Backbone.Collection.prototype.initialize.call(this, models, options);\n\t this.setOrder(options.order || this.order, { silent: true });\n\t },\n\t\n\t /** set up to track order changes and re-sort when changed */\n\t _setUpListeners: function () {\n\t return this.on({\n\t 'changed-order': this.sort\n\t });\n\t },\n\t\n\t /** override to provide order and offsets based on instance vars, set limit if passed,\n\t * and set allFetched/fire 'all-fetched' when xhr returns\n\t */\n\t fetch: function (options) {\n\t options = this._buildFetchOptions(options);\n\t // console.log( 'fetch options:', options );\n\t return Backbone.Collection.prototype.fetch.call(this, options);\n\t },\n\t\n\t /** build ajax data/parameters from options */\n\t _buildFetchOptions: function (options) {\n\t // note: we normally want options passed in to override the defaults built here\n\t // so most of these fns will generate defaults\n\t options = _.clone(options) || {};\n\t var self = this;\n\t\n\t // jquery ajax option; allows multiple q/qv for filters (instead of 'q[]')\n\t options.traditional = true;\n\t\n\t // options.data\n\t // we keep limit, offset, etc. in options *as well as move it into data* because:\n\t // - it makes fetch calling convenient to add it to a single options map (instead of as mult. args)\n\t // - it allows the std. event handlers (for fetch, etc.) to have access\n\t // to the pagination options too\n\t // (i.e. this.on( 'sync', function( options ){ if( options.limit ){ ... } }))\n\t // however, when we send to xhr/jquery we copy them to data also so that they become API query params\n\t options.data = options.data || self._buildFetchData(options);\n\t // console.log( 'data:', options.data );\n\t\n\t // options.data.filters --> options.data.q, options.data.qv\n\t var filters = this._buildFetchFilters(options);\n\t // console.log( 'filters:', filters );\n\t if (!_.isEmpty(filters)) {\n\t _.extend(options.data, this._fetchFiltersToAjaxData(filters));\n\t }\n\t // console.log( 'data:', options.data );\n\t return options;\n\t },\n\t\n\t /** Build the dictionary to send to fetch's XHR as data */\n\t _buildFetchData: function (options) {\n\t var defaults = {};\n\t if (this.order) {\n\t defaults.order = this.order;\n\t }\n\t return _.defaults(_.pick(options, this._fetchParams), defaults);\n\t },\n\t\n\t /** These attribute keys are valid params to fetch/API-index */\n\t _fetchParams: [\n\t /** model dependent string to control the order of models returned */\n\t 'order',\n\t /** limit the number of models returned from a fetch */\n\t 'limit',\n\t /** skip this number of models when fetching */\n\t 'offset',\n\t /** what series of attributes to return (model dependent) */\n\t 'view',\n\t /** individual keys to return for the models (see api/histories.index) */\n\t 'keys'],\n\t\n\t /** add any needed filters here based on collection state */\n\t _buildFetchFilters: function (options) {\n\t // override\n\t return _.clone(options.filters || {});\n\t },\n\t\n\t /** Convert dictionary filters to qqv style arrays */\n\t _fetchFiltersToAjaxData: function (filters) {\n\t // return as a map so ajax.data can extend from it\n\t var filterMap = {\n\t q: [],\n\t qv: []\n\t };\n\t _.each(filters, function (v, k) {\n\t // don't send if filter value is empty\n\t if (v === undefined || v === '') {\n\t return;\n\t }\n\t // json to python\n\t if (v === true) {\n\t v = 'True';\n\t }\n\t if (v === false) {\n\t v = 'False';\n\t }\n\t if (v === null) {\n\t v = 'None';\n\t }\n\t // map to k/v arrays (q/qv)\n\t filterMap.q.push(k);\n\t filterMap.qv.push(v);\n\t });\n\t return filterMap;\n\t },\n\t\n\t /** override to reset allFetched flag to false */\n\t reset: function (models, options) {\n\t this.allFetched = false;\n\t return Backbone.Collection.prototype.reset.call(this, models, options);\n\t },\n\t\n\t // ........................................................................ order\n\t order: null,\n\t\n\t /** @type {Object} map of collection available sorting orders containing comparator fns */\n\t comparators: {\n\t 'update_time': BASE_MVC.buildComparator('update_time', { ascending: false }),\n\t 'update_time-asc': BASE_MVC.buildComparator('update_time', { ascending: true }),\n\t 'create_time': BASE_MVC.buildComparator('create_time', { ascending: false }),\n\t 'create_time-asc': BASE_MVC.buildComparator('create_time', { ascending: true })\n\t },\n\t\n\t /** set the order and comparator for this collection then sort with the new order\n\t * @event 'changed-order' passed the new order and the collection\n\t */\n\t setOrder: function (order, options) {\n\t options = options || {};\n\t var collection = this;\n\t var comparator = collection.comparators[order];\n\t if (_.isUndefined(comparator)) {\n\t throw new Error('unknown order: ' + order);\n\t }\n\t // if( _.isUndefined( comparator ) ){ return; }\n\t if (comparator === collection.comparator) {\n\t return;\n\t }\n\t\n\t var oldOrder = collection.order;\n\t collection.order = order;\n\t collection.comparator = comparator;\n\t\n\t if (!options.silent) {\n\t collection.trigger('changed-order', options);\n\t }\n\t return collection;\n\t }\n\t\n\t });\n\t\n\t //=============================================================================\n\t /**\n\t *\n\t */\n\t var PaginatedCollection = ControlledFetchCollection.extend({\n\t\n\t /** @type {Number} limit used for each page's fetch */\n\t limitPerPage: 500,\n\t\n\t initialize: function (models, options) {\n\t ControlledFetchCollection.prototype.initialize.call(this, models, options);\n\t this.currentPage = options.currentPage || 0;\n\t },\n\t\n\t getTotalItemCount: function () {\n\t return this.length;\n\t },\n\t\n\t shouldPaginate: function () {\n\t return this.getTotalItemCount() >= this.limitPerPage;\n\t },\n\t\n\t getLastPage: function () {\n\t return Math.floor(this.getTotalItemCount() / this.limitPerPage);\n\t },\n\t\n\t getPageCount: function () {\n\t return this.getLastPage() + 1;\n\t },\n\t\n\t getPageLimitOffset: function (pageNum) {\n\t pageNum = this.constrainPageNum(pageNum);\n\t return {\n\t limit: this.limitPerPage,\n\t offset: pageNum * this.limitPerPage\n\t };\n\t },\n\t\n\t constrainPageNum: function (pageNum) {\n\t return Math.max(0, Math.min(pageNum, this.getLastPage()));\n\t },\n\t\n\t /** fetch the next page of data */\n\t fetchPage: function (pageNum, options) {\n\t var self = this;\n\t pageNum = self.constrainPageNum(pageNum);\n\t self.currentPage = pageNum;\n\t options = _.defaults(options || {}, self.getPageLimitOffset(pageNum));\n\t\n\t self.trigger('fetching-more');\n\t return self.fetch(options).always(function () {\n\t self.trigger('fetching-more-done');\n\t });\n\t },\n\t\n\t fetchCurrentPage: function (options) {\n\t return this.fetchPage(this.currentPage, options);\n\t },\n\t\n\t fetchPrevPage: function (options) {\n\t return this.fetchPage(this.currentPage - 1, options);\n\t },\n\t\n\t fetchNextPage: function (options) {\n\t return this.fetchPage(this.currentPage + 1, options);\n\t }\n\t });\n\t\n\t //=============================================================================\n\t /**\n\t * A Collection that will load more elements without reseting.\n\t */\n\t var InfinitelyScrollingCollection = ControlledFetchCollection.extend({\n\t\n\t /** @type {Number} limit used for the first fetch (or a reset) */\n\t limitOnFirstFetch: null,\n\t /** @type {Number} limit used for each subsequent fetch */\n\t limitPerFetch: 100,\n\t\n\t initialize: function (models, options) {\n\t ControlledFetchCollection.prototype.initialize.call(this, models, options);\n\t /** @type {Integer} number of contents to return from the first fetch */\n\t this.limitOnFirstFetch = options.limitOnFirstFetch || this.limitOnFirstFetch;\n\t /** @type {Integer} limit for every fetch after the first */\n\t this.limitPerFetch = options.limitPerFetch || this.limitPerFetch;\n\t /** @type {Boolean} are all contents fetched? */\n\t this.allFetched = false;\n\t /** @type {Integer} what was the offset of the last content returned */\n\t this.lastFetched = options.lastFetched || 0;\n\t },\n\t\n\t /** build ajax data/parameters from options */\n\t _buildFetchOptions: function (options) {\n\t // options (options for backbone.fetch and jquery.ajax generally)\n\t // backbone option; false here to make fetching an addititive process\n\t options.remove = options.remove || false;\n\t return ControlledFetchCollection.prototype._buildFetchOptions.call(this, options);\n\t },\n\t\n\t /** fetch the first 'page' of data */\n\t fetchFirst: function (options) {\n\t // console.log( 'ControlledFetchCollection.fetchFirst:', options );\n\t options = options ? _.clone(options) : {};\n\t this.allFetched = false;\n\t this.lastFetched = 0;\n\t return this.fetchMore(_.defaults(options, {\n\t reset: true,\n\t limit: this.limitOnFirstFetch\n\t }));\n\t },\n\t\n\t /** fetch the next page of data */\n\t fetchMore: function (options) {\n\t // console.log( 'ControlledFetchCollection.fetchMore:', options );\n\t options = _.clone(options || {});\n\t var collection = this;\n\t\n\t // console.log( 'fetchMore, options.reset:', options.reset );\n\t if (!options.reset && collection.allFetched) {\n\t return jQuery.when();\n\t }\n\t\n\t // TODO: this fails in the edge case where\n\t // the first fetch offset === limit (limit 4, offset 4, collection.length 4)\n\t options.offset = options.reset ? 0 : options.offset || collection.lastFetched;\n\t var limit = options.limit = options.limit || collection.limitPerFetch || null;\n\t // console.log( 'fetchMore, limit:', limit, 'offset:', options.offset );\n\t\n\t collection.trigger('fetching-more');\n\t return collection.fetch(options).always(function () {\n\t collection.trigger('fetching-more-done');\n\t })\n\t // maintain allFetched flag and trigger if all were fetched this time\n\t .done(function _postFetchMore(fetchedData) {\n\t var numFetched = _.isArray(fetchedData) ? fetchedData.length : 0;\n\t collection.lastFetched += numFetched;\n\t // console.log( 'fetchMore, lastFetched:', collection.lastFetched );\n\t // anything less than a full page means we got all there is to get\n\t if (!limit || numFetched < limit) {\n\t collection.allFetched = true;\n\t collection.trigger('all-fetched', this);\n\t }\n\t });\n\t },\n\t\n\t /** fetch all the collection */\n\t fetchAll: function (options) {\n\t // whitelist options to prevent allowing limit/offset/filters\n\t // (use vanilla fetch instead)\n\t options = options || {};\n\t var self = this;\n\t options = _.pick(options, 'silent');\n\t options.filters = {};\n\t return self.fetch(options).done(function (fetchData) {\n\t self.allFetched = true;\n\t self.trigger('all-fetched', self);\n\t });\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t ControlledFetchCollection: ControlledFetchCollection,\n\t PaginatedCollection: PaginatedCollection,\n\t InfinitelyScrollingCollection: InfinitelyScrollingCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 82 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t\n\t /* For presentation-related functionality shared across collection creators.\n\t Particularily overlapping functionality related to name processing and help.\n\t */\n\t var CollectionCreatorMixin = {\n\t\n\t /** add (or clear if clear is truthy) a validation warning to the DOM element described in what */\n\t _validationWarning: function (what, clear) {\n\t var VALIDATION_CLASS = 'validation-warning';\n\t if (what === 'name') {\n\t what = this.$('.collection-name').add(this.$('.collection-name-prompt'));\n\t this.$('.collection-name').focus().select();\n\t }\n\t if (clear) {\n\t what = what || this.$('.' + VALIDATION_CLASS);\n\t what.removeClass(VALIDATION_CLASS);\n\t } else {\n\t what.addClass(VALIDATION_CLASS);\n\t }\n\t },\n\t\n\t _changeHideOriginals: function (ev) {\n\t this.hideOriginals = this.$('.hide-originals').prop(\"checked\");\n\t },\n\t\n\t // ........................................................................ footer\n\t /** handle a collection name change */\n\t _changeName: function (ev) {\n\t this._validationWarning('name', !!this._getName());\n\t },\n\t\n\t /** check for enter key press when in the collection name and submit */\n\t _nameCheckForEnter: function (ev) {\n\t if (ev.keyCode === 13 && !this.blocking) {\n\t this._clickCreate();\n\t }\n\t },\n\t\n\t /** get the current collection name */\n\t _getName: function () {\n\t return _.escape(this.$('.collection-name').val());\n\t },\n\t\n\t // ........................................................................ header\n\t /** expand help */\n\t _clickMoreHelp: function (ev) {\n\t ev.stopPropagation();\n\t this.$('.main-help').addClass('expanded');\n\t this.$('.more-help').hide();\n\t },\n\t /** collapse help */\n\t _clickLessHelp: function (ev) {\n\t ev.stopPropagation();\n\t this.$('.main-help').removeClass('expanded');\n\t this.$('.more-help').show();\n\t },\n\t /** toggle help */\n\t _toggleHelp: function (ev) {\n\t ev.stopPropagation();\n\t this.$('.main-help').toggleClass('expanded');\n\t this.$('.more-help').toggle();\n\t },\n\t\n\t /** show an alert on the top of the interface containing message (alertClass is bootstrap's alert-*) */\n\t _showAlert: function (message, alertClass) {\n\t alertClass = alertClass || 'alert-danger';\n\t this.$('.main-help').hide();\n\t this.$('.header .alert').attr('class', 'alert alert-dismissable').addClass(alertClass).show().find('.alert-message').html(message);\n\t },\n\t /** hide the alerts at the top */\n\t _hideAlert: function (message) {\n\t this.$('.main-help').show();\n\t this.$('.header .alert').hide();\n\t },\n\t\n\t _cancelCreate: function (ev) {\n\t if (typeof this.oncancel === 'function') {\n\t this.oncancel.call(this);\n\t }\n\t },\n\t\n\t /** attempt to create the current collection */\n\t _clickCreate: function (ev) {\n\t var name = this._getName();\n\t if (!name) {\n\t this._validationWarning('name');\n\t } else if (!this.blocking) {\n\t this.createList(name);\n\t }\n\t },\n\t\n\t _setUpCommonSettings: function (attributes) {\n\t this.hideOriginals = attributes.defaultHideSourceItems || false;\n\t },\n\t\n\t /** render the footer, completion controls, and cancel controls */\n\t _renderFooter: function (speed, callback) {\n\t var instance = this;\n\t var $footer = this.$('.footer').empty().html(this.templates.footer());\n\t _.each(this.footerSettings, function (property, selector) {\n\t this.$(selector).prop('checked', instance[property]);\n\t });\n\t if (typeof this.oncancel === 'function') {\n\t this.$('.cancel-create.btn').show();\n\t }\n\t return $footer;\n\t },\n\t\n\t _creatorTemplates: {\n\t main: _.template(['
                                              ', '
                                              ', '
                                              '].join(''))\n\t }\n\t\n\t };\n\t\n\t //==============================================================================\n\t return {\n\t CollectionCreatorMixin: CollectionCreatorMixin\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 83 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(91), __webpack_require__(59), __webpack_require__(58), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_VIEW, DC_MODEL, DC_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t /** @class non-editable, read-only View/Controller for a dataset collection.\n\t */\n\t var _super = LIST_VIEW.ModelListPanel;\n\t var CollectionView = _super.extend(\n\t /** @lends CollectionView.prototype */{\n\t //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n\t _logNamespace: logNamespace,\n\t\n\t className: _super.prototype.className + ' dataset-collection-panel',\n\t\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView,\n\t /** key of attribute in model to assign to this.collection */\n\t modelCollectionKey: 'elements',\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes optional settings for the panel\n\t */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t this.linkTarget = attributes.linkTarget || '_blank';\n\t\n\t this.hasUser = attributes.hasUser;\n\t /** A stack of panels that currently cover or hide this panel */\n\t this.panelStack = [];\n\t /** The text of the link to go back to the panel containing this one */\n\t this.parentName = attributes.parentName;\n\t /** foldout or drilldown */\n\t this.foldoutStyle = attributes.foldoutStyle || 'foldout';\n\t this.downloadUrl = this.model.attributes.url + '/download';\n\t },\n\t\n\t _queueNewRender: function ($newRender, speed) {\n\t speed = speed === undefined ? this.fxSpeed : speed;\n\t var panel = this;\n\t panel.log('_queueNewRender:', $newRender, speed);\n\t\n\t // TODO: jquery@1.12 doesn't change display when the elem has display: flex\n\t // this causes display: block for those elems after the use of show/hide animations\n\t // animations are removed from this view for now until fixed\n\t panel._swapNewRender($newRender);\n\t panel.trigger('rendered', panel);\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-views\n\t /** In this override, use model.getVisibleContents */\n\t _filterCollection: function () {\n\t //TODO: should *not* be model.getVisibleContents - visibility is not model related\n\t return this.model.getVisibleContents();\n\t },\n\t\n\t /** override to return proper view class based on element_type */\n\t _getItemViewClass: function (model) {\n\t //this.debug( this + '._getItemViewClass:', model );\n\t //TODO: subclasses use DCEViewClass - but are currently unused - decide\n\t switch (model.get('element_type')) {\n\t case 'hda':\n\t return this.DatasetDCEViewClass;\n\t case 'dataset_collection':\n\t return this.NestedDCDCEViewClass;\n\t }\n\t throw new TypeError('Unknown element type:', model.get('element_type'));\n\t },\n\t\n\t /** override to add link target and anon */\n\t _getItemViewOptions: function (model) {\n\t var options = _super.prototype._getItemViewOptions.call(this, model);\n\t return _.extend(options, {\n\t linkTarget: this.linkTarget,\n\t hasUser: this.hasUser,\n\t //TODO: could move to only nested: list:paired\n\t foldoutStyle: this.foldoutStyle\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ collection sub-views\n\t /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t _super.prototype._setUpItemViewListeners.call(panel, view);\n\t\n\t // use pub-sub to: handle drilldown expansion and collapse\n\t panel.listenTo(view, {\n\t 'expanded:drilldown': function (v, drilldown) {\n\t this._expandDrilldownPanel(drilldown);\n\t },\n\t 'collapsed:drilldown': function (v, drilldown) {\n\t this._collapseDrilldownPanel(drilldown);\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n\t _expandDrilldownPanel: function (drilldown) {\n\t this.panelStack.push(drilldown);\n\t // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n\t this.$('> .controls').add(this.$list()).hide();\n\t drilldown.parentName = this.model.get('name');\n\t this.$el.append(drilldown.render().$el);\n\t },\n\t\n\t /** Handle drilldown close by freeing the panel and re-rendering this panel */\n\t _collapseDrilldownPanel: function (drilldown) {\n\t this.panelStack.pop();\n\t this.render();\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: {\n\t 'click .navigation .back': 'close'\n\t },\n\t\n\t /** close/remove this collection panel */\n\t close: function (event) {\n\t this.remove();\n\t this.trigger('close');\n\t },\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'CollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //------------------------------------------------------------------------------ TEMPLATES\n\t CollectionView.prototype.templates = function () {\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
                                              ', '', '
                                              ', '
                                              <%- collection.name || collection.element_identifier %>
                                              ', '
                                              ', '<% if( collection.collection_type === \"list\" ){ %>', _l('a list of datasets'), '<% } else if( collection.collection_type === \"paired\" ){ %>', _l('a pair of datasets'), '<% } else if( collection.collection_type === \"list:paired\" ){ %>', _l('a list of paired datasets'), '<% } else if( collection.collection_type === \"list:list\" ){ %>', _l('a list of dataset lists'), '<% } %>', '
                                              ', '
                                              ', '
                                              ', '', '
                                              '], 'collection');\n\t\n\t return _.extend(_.clone(_super.prototype.templates), {\n\t controls: controlsTemplate\n\t });\n\t }();\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var ListCollectionView = CollectionView.extend(\n\t /** @lends ListCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var PairCollectionView = ListCollectionView.extend(\n\t /** @lends PairCollectionView.prototype */{\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'PairCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var ListOfPairsCollectionView = CollectionView.extend(\n\t /** @lends ListOfPairsCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n\t foldoutPanelClass: PairCollectionView\n\t }),\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfPairsCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\n\t var ListOfListsCollectionView = CollectionView.extend({\n\t\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n\t foldoutPanelClass: PairCollectionView\n\t }),\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfListsCollectionView(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t CollectionView: CollectionView,\n\t ListCollectionView: ListCollectionView,\n\t PairCollectionView: PairCollectionView,\n\t ListOfPairsCollectionView: ListOfPairsCollectionView,\n\t ListOfListsCollectionView: ListOfListsCollectionView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 84 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(61), __webpack_require__(45), __webpack_require__(80), __webpack_require__(25), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, DATASET_LI, TAGS, ANNOTATIONS, faIconButton, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t //==============================================================================\n\t\n\t var _super = DATASET_LI.DatasetListItemView;\n\t /** @class Editing view for DatasetAssociation.\n\t */\n\t var DatasetListItemEdit = _super.extend(\n\t /** @lends DatasetListItemEdit.prototype */{\n\t\n\t /** set up: options */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t this.hasUser = attributes.hasUser;\n\t\n\t /** allow user purge of dataset files? */\n\t this.purgeAllowed = attributes.purgeAllowed || false;\n\t\n\t //TODO: move to HiddenUntilActivatedViewMixin\n\t /** should the tags editor be shown or hidden initially? */\n\t this.tagsEditorShown = attributes.tagsEditorShown || false;\n\t /** should the tags editor be shown or hidden initially? */\n\t this.annotationEditorShown = attributes.annotationEditorShown || false;\n\t },\n\t\n\t // ......................................................................... titlebar actions\n\t /** In this override, add the other two primary actions: edit and delete */\n\t _renderPrimaryActions: function () {\n\t var actions = _super.prototype._renderPrimaryActions.call(this);\n\t if (this.model.get('state') === STATES.NOT_VIEWABLE) {\n\t return actions;\n\t }\n\t // render the display, edit attr and delete icon-buttons\n\t return _super.prototype._renderPrimaryActions.call(this).concat([this._renderEditButton(), this._renderDeleteButton()]);\n\t },\n\t\n\t //TODO: move titleButtons into state renderers, remove state checks in the buttons\n\t\n\t /** Render icon-button to edit the attributes (format, permissions, etc.) this dataset. */\n\t _renderEditButton: function () {\n\t // don't show edit while uploading, in-accessible\n\t // DO show if in error (ala previous history panel)\n\t if (this.model.get('state') === STATES.DISCARDED || !this.model.get('accessible')) {\n\t return null;\n\t }\n\t\n\t var purged = this.model.get('purged'),\n\t deleted = this.model.get('deleted'),\n\t editBtnData = {\n\t title: _l('Edit attributes'),\n\t href: Galaxy.root + 'datasets/edit?dataset_id=' + this.model.attributes.id,\n\t faIcon: 'fa-pencil',\n\t classes: 'edit-btn'\n\t };\n\t // disable if purged or deleted and explain why in the tooltip\n\t if (deleted || purged) {\n\t editBtnData.disabled = true;\n\t if (purged) {\n\t editBtnData.title = _l('Cannot edit attributes of datasets removed from disk');\n\t } else if (deleted) {\n\t editBtnData.title = _l('Undelete dataset to edit attributes');\n\t }\n\t\n\t // disable if still uploading or new\n\t } else if (_.contains([STATES.UPLOAD, STATES.NEW], this.model.get('state'))) {\n\t editBtnData.disabled = true;\n\t editBtnData.title = _l('This dataset is not yet editable');\n\t }\n\t return faIconButton(editBtnData);\n\t },\n\t\n\t /** Render icon-button to delete this hda. */\n\t _renderDeleteButton: function () {\n\t // don't show delete if...\n\t if (!this.model.get('accessible')) {\n\t return null;\n\t }\n\t\n\t var self = this,\n\t deletedAlready = this.model.isDeletedOrPurged();\n\t return faIconButton({\n\t title: !deletedAlready ? _l('Delete') : _l('Dataset is already deleted'),\n\t disabled: deletedAlready,\n\t faIcon: 'fa-times',\n\t classes: 'delete-btn',\n\t onclick: function () {\n\t // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n\t self.$el.find('.icon-btn.delete-btn').trigger('mouseout');\n\t self.model['delete']();\n\t }\n\t });\n\t },\n\t\n\t // ......................................................................... details\n\t /** In this override, add tags and annotations controls, make the ? dbkey a link to editing page */\n\t _renderDetails: function () {\n\t //TODO: generalize to be allow different details for each state\n\t var $details = _super.prototype._renderDetails.call(this),\n\t state = this.model.get('state');\n\t\n\t if (!this.model.isDeletedOrPurged() && _.contains([STATES.OK, STATES.FAILED_METADATA], state)) {\n\t this._renderTags($details);\n\t this._renderAnnotation($details);\n\t this._makeDbkeyEditLink($details);\n\t }\n\t\n\t this._setUpBehaviors($details);\n\t return $details;\n\t },\n\t\n\t /**************************************************************************\n\t * Render help button to show tool help text without rerunning the tool.\n\t * Issue #2100\n\t */\n\t _renderToolHelpButton: function () {\n\t var datasetID = this.model.attributes.dataset_id;\n\t var jobID = this.model.attributes.creating_job;\n\t var self = this;\n\t\n\t var parseToolBuild = function (data) {\n\t var helpString = '
                                              ';\n\t if (data.name && data.help) {\n\t helpString += 'Tool help for ' + data.name + '
                                              ';\n\t helpString += data.help;\n\t } else {\n\t helpString += 'Tool help is unavailable for this dataset.
                                              ';\n\t }\n\t helpString += '
                                              ';\n\t self.$el.find('.details').append($.parseHTML(helpString));\n\t };\n\t var parseToolID = function (data) {\n\t $.ajax({\n\t url: Galaxy.root + 'api/tools/' + data.tool_id + '/build'\n\t }).done(function (data) {\n\t parseToolBuild(data);\n\t }).fail(function () {\n\t parseToolBuild({});\n\t });\n\t };\n\t if (Galaxy.user.id === null) {\n\t return null;\n\t }\n\t return faIconButton({\n\t title: _l('Tool Help'),\n\t classes: 'icon-btn',\n\t href: '#',\n\t faIcon: 'fa-question',\n\t onclick: function () {\n\t var divString = 'thdiv-' + datasetID;\n\t if (self.$el.find(\".toolhelp\").length > 0) {\n\t self.$el.find(\".toolhelp\").toggle();\n\t } else {\n\t $.ajax({\n\t url: Galaxy.root + 'api/jobs/' + jobID\n\t }).done(function (data) {\n\t parseToolID(data);\n\t }).fail(function () {\n\t console.log('Failed at recovering job information from the Galaxy API for job id \"' + jobID + '\".');\n\t });\n\t }\n\t }\n\t });\n\t },\n\t //*************************************************************************\n\t\n\t /** Add less commonly used actions in the details section based on state */\n\t _renderSecondaryActions: function () {\n\t var actions = _super.prototype._renderSecondaryActions.call(this);\n\t switch (this.model.get('state')) {\n\t case STATES.UPLOAD:\n\t case STATES.NOT_VIEWABLE:\n\t return actions;\n\t case STATES.ERROR:\n\t // error button comes first\n\t actions.unshift(this._renderErrButton());\n\t return actions.concat([this._renderRerunButton(), this._renderToolHelpButton()]);\n\t case STATES.OK:\n\t case STATES.FAILED_METADATA:\n\t return actions.concat([this._renderRerunButton(), this._renderVisualizationsButton(), this._renderToolHelpButton()]);\n\t }\n\t return actions.concat([this._renderRerunButton(), this._renderToolHelpButton()]);\n\t },\n\t\n\t /** Render icon-button to report an error on this dataset to the galaxy admin. */\n\t _renderErrButton: function () {\n\t return faIconButton({\n\t title: _l('View or report this error'),\n\t href: Galaxy.root + 'datasets/error?dataset_id=' + this.model.attributes.id,\n\t classes: 'report-error-btn',\n\t faIcon: 'fa-bug'\n\t });\n\t },\n\t\n\t /** Render icon-button to re-run the job that created this dataset. */\n\t _renderRerunButton: function () {\n\t var creating_job = this.model.get('creating_job');\n\t if (this.model.get('rerunnable')) {\n\t return faIconButton({\n\t title: _l('Run this job again'),\n\t href: this.model.urls.rerun,\n\t classes: 'rerun-btn',\n\t target: this.linkTarget,\n\t faIcon: 'fa-refresh',\n\t onclick: function (ev) {\n\t ev.preventDefault();\n\t Galaxy.router.push('/', { job_id: creating_job });\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** Render an icon-button or popupmenu of links based on the applicable visualizations */\n\t _renderVisualizationsButton: function () {\n\t //TODO: someday - lazyload visualizations\n\t var visualizations = this.model.get('visualizations');\n\t if (this.model.isDeletedOrPurged() || !this.hasUser || !this.model.hasData() || _.isEmpty(visualizations)) {\n\t return null;\n\t }\n\t if (!_.isObject(visualizations[0])) {\n\t this.warn('Visualizations have been switched off');\n\t return null;\n\t }\n\t\n\t var $visualizations = $(this.templates.visualizations(visualizations, this));\n\t //HACK: need to re-write those directed at galaxy_main with linkTarget\n\t $visualizations.find('[target=\"galaxy_main\"]').attr('target', this.linkTarget);\n\t // use addBack here to include the root $visualizations elem (for the case of 1 visualization)\n\t this._addScratchBookFn($visualizations.find('.visualization-link').addBack('.visualization-link'));\n\t return $visualizations;\n\t },\n\t\n\t /** add scratchbook functionality to visualization links */\n\t _addScratchBookFn: function ($links) {\n\t var li = this;\n\t $links.click(function (ev) {\n\t if (Galaxy.frame && Galaxy.frame.active) {\n\t Galaxy.frame.add({\n\t title: 'Visualization',\n\t url: $(this).attr('href')\n\t });\n\t ev.preventDefault();\n\t ev.stopPropagation();\n\t }\n\t });\n\t },\n\t\n\t //TODO: if possible move these to readonly view - but display the owner's tags/annotation (no edit)\n\t /** Render the tags list/control */\n\t _renderTags: function ($where) {\n\t if (!this.hasUser) {\n\t return;\n\t }\n\t var view = this;\n\t this.tagsEditor = new TAGS.TagsEditor({\n\t model: this.model,\n\t el: $where.find('.tags-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow: function () {\n\t view.tagsEditorShown = true;\n\t },\n\t onhide: function () {\n\t view.tagsEditorShown = false;\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit dataset tags'),\n\t classes: 'tag-btn',\n\t faIcon: 'fa-tags'\n\t }).appendTo($where.find('.actions .right'))\n\t });\n\t if (this.tagsEditorShown) {\n\t this.tagsEditor.toggle(true);\n\t }\n\t },\n\t\n\t /** Render the annotation display/control */\n\t _renderAnnotation: function ($where) {\n\t if (!this.hasUser) {\n\t return;\n\t }\n\t var view = this;\n\t this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n\t model: this.model,\n\t el: $where.find('.annotation-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow: function () {\n\t view.annotationEditorShown = true;\n\t },\n\t onhide: function () {\n\t view.annotationEditorShown = false;\n\t },\n\t $activator: faIconButton({\n\t title: _l('Edit dataset annotation'),\n\t classes: 'annotate-btn',\n\t faIcon: 'fa-comment'\n\t }).appendTo($where.find('.actions .right'))\n\t });\n\t if (this.annotationEditorShown) {\n\t this.annotationEditor.toggle(true);\n\t }\n\t },\n\t\n\t /** If the format/dbkey/genome_build isn't set, make the display a link to the edit page */\n\t _makeDbkeyEditLink: function ($details) {\n\t // make the dbkey a link to editing\n\t if (this.model.get('metadata_dbkey') === '?' && !this.model.isDeletedOrPurged()) {\n\t var editableDbkey = $('?').attr('href', this.model.urls.edit).attr('target', this.linkTarget);\n\t $details.find('.dbkey .value').replaceWith(editableDbkey);\n\t }\n\t },\n\t\n\t // ......................................................................... events\n\t /** event map */\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .undelete-link': '_clickUndeleteLink',\n\t 'click .purge-link': '_clickPurgeLink',\n\t\n\t 'click .edit-btn': function (ev) {\n\t this.trigger('edit', this, ev);\n\t },\n\t 'click .delete-btn': function (ev) {\n\t this.trigger('delete', this, ev);\n\t },\n\t 'click .rerun-btn': function (ev) {\n\t this.trigger('rerun', this, ev);\n\t },\n\t 'click .report-err-btn': function (ev) {\n\t this.trigger('report-err', this, ev);\n\t },\n\t 'click .visualization-btn': function (ev) {\n\t this.trigger('visualize', this, ev);\n\t },\n\t 'click .dbkey a': function (ev) {\n\t this.trigger('edit', this, ev);\n\t }\n\t }),\n\t\n\t /** listener for item undelete (in the messages section) */\n\t _clickUndeleteLink: function (ev) {\n\t this.model.undelete();\n\t return false;\n\t },\n\t\n\t /** listener for item purge (in the messages section) */\n\t _clickPurgeLink: function (ev) {\n\t if (confirm(_l('This will permanently remove the data in your dataset. Are you sure?'))) {\n\t this.model.purge();\n\t }\n\t return false;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** string rep */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDAEditView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetListItemEdit.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t failed_metadata: BASE_MVC.wrapTemplate([\n\t // in this override, provide a link to the edit page\n\t '<% if( dataset.state === \"failed_metadata\" ){ %>', '', '<% } %>'], 'dataset'),\n\t\n\t deleted: BASE_MVC.wrapTemplate([\n\t // in this override, provide links to undelete or purge the dataset\n\t '<% if( dataset.deleted && !dataset.purged ){ %>',\n\t // deleted not purged\n\t '
                                              ', _l('This dataset has been deleted'), '
                                              ', _l('Undelete it'), '', '<% if( view.purgeAllowed ){ %>', '
                                              ', _l('Permanently remove it from disk'), '', '<% } %>', '
                                              ', '<% } %>'], 'dataset')\n\t });\n\t\n\t var visualizationsTemplate = BASE_MVC.wrapTemplate(['<% if( visualizations.length === 1 ){ %>', '\"', ' target=\"<%- visualizations[0].target %>\" title=\"', _l('Visualize in'), ' <%- visualizations[0].html %>\">', '', '', '<% } else { %>', '
                                              ', '', '', '', '', '
                                              ', '<% } %>'], 'visualizations');\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t warnings: warnings,\n\t visualizations: visualizationsTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t DatasetListItemEdit: DatasetListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 85 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t var logNamespace = 'dataset';\n\t //==============================================================================\n\t var searchableMixin = BASE_MVC.SearchableModelMixin;\n\t /** @class base model for any DatasetAssociation (HDAs, LDDAs, DatasetCollectionDAs).\n\t * No knowledge of what type (HDA/LDDA/DCDA) should be needed here.\n\t * The DA's are made searchable (by attribute) by mixing in SearchableModelMixin.\n\t */\n\t var DatasetAssociation = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(BASE_MVC.mixin(searchableMixin, /** @lends DatasetAssociation.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t /** default attributes for a model */\n\t defaults: {\n\t state: STATES.NEW,\n\t deleted: false,\n\t purged: false,\n\t name: '(unnamed dataset)',\n\t accessible: true,\n\t // sniffed datatype (sam, tabular, bed, etc.)\n\t data_type: '',\n\t file_ext: '',\n\t file_size: 0,\n\t\n\t // array of associated file types (eg. [ 'bam_index', ... ])\n\t meta_files: [],\n\t\n\t misc_blurb: '',\n\t misc_info: '',\n\t\n\t tags: []\n\t // do NOT default on annotation, as this default is valid and will be passed on 'save'\n\t // which is incorrect behavior when the model is only partially fetched (annos are not passed in summary data)\n\t //annotation : ''\n\t },\n\t\n\t /** instance vars and listeners */\n\t initialize: function (attributes, options) {\n\t this.debug(this + '(Dataset).initialize', attributes, options);\n\t\n\t //!! this state is not in trans.app.model.Dataset.states - set it here -\n\t if (!this.get('accessible')) {\n\t this.set('state', STATES.NOT_VIEWABLE);\n\t }\n\t\n\t /** Datasets rely/use some web controllers - have the model generate those URLs on startup */\n\t this.urls = this._generateUrls();\n\t\n\t this._setUpListeners();\n\t },\n\t\n\t /** returns misc. web urls for rendering things like re-run, display, etc. */\n\t _generateUrls: function () {\n\t var id = this.get('id');\n\t if (!id) {\n\t return {};\n\t }\n\t var urls = {\n\t 'purge': 'datasets/' + id + '/purge_async',\n\t 'display': 'datasets/' + id + '/display/?preview=True',\n\t 'edit': 'datasets/' + id + '/edit',\n\t 'download': 'datasets/' + id + '/display' + this._downloadQueryParameters(),\n\t 'report_error': 'dataset/errors?id=' + id,\n\t 'rerun': 'tool_runner/rerun?id=' + id,\n\t 'show_params': 'datasets/' + id + '/show_params',\n\t 'visualization': 'visualization',\n\t 'meta_download': 'dataset/get_metadata_file?hda_id=' + id + '&metadata_name='\n\t };\n\t _.each(urls, function (value, key) {\n\t urls[key] = Galaxy.root + value;\n\t });\n\t this.urls = urls;\n\t return urls;\n\t },\n\t\n\t _downloadQueryParameters: function () {\n\t return '?to_ext=' + this.get('file_ext');\n\t },\n\t\n\t /** set up any event listeners\n\t * event: state:ready fired when this DA moves into/is already in a ready state\n\t */\n\t _setUpListeners: function () {\n\t // if the state has changed and the new state is a ready state, fire an event\n\t this.on('change:state', function (currModel, newState) {\n\t this.log(this + ' has changed state:', currModel, newState);\n\t if (this.inReadyState()) {\n\t this.trigger('state:ready', currModel, newState, this.previous('state'));\n\t }\n\t });\n\t // the download url (currently) relies on having a correct file extension\n\t this.on('change:id change:file_ext', function (currModel) {\n\t this._generateUrls();\n\t });\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** override to add urls */\n\t toJSON: function () {\n\t var json = Backbone.Model.prototype.toJSON.call(this);\n\t //console.warn( 'returning json?' );\n\t //return json;\n\t return _.extend(json, {\n\t urls: this.urls\n\t });\n\t },\n\t\n\t /** Is this dataset deleted or purged? */\n\t isDeletedOrPurged: function () {\n\t return this.get('deleted') || this.get('purged');\n\t },\n\t\n\t /** Is this dataset in a 'ready' state; where 'Ready' states are states where no\n\t * processing (for the ds) is left to do on the server.\n\t */\n\t inReadyState: function () {\n\t var ready = _.contains(STATES.READY_STATES, this.get('state'));\n\t return this.isDeletedOrPurged() || ready;\n\t },\n\t\n\t /** Does this model already contain detailed data (as opposed to just summary level data)? */\n\t hasDetails: function () {\n\t // if it's inaccessible assume it has everything it needs\n\t if (!this.get('accessible')) {\n\t return true;\n\t }\n\t return this.has('annotation');\n\t },\n\t\n\t /** Convenience function to match dataset.has_data. */\n\t hasData: function () {\n\t return this.get('file_size') > 0;\n\t },\n\t\n\t // ........................................................................ ajax\n\t fetch: function (options) {\n\t var dataset = this;\n\t return Backbone.Model.prototype.fetch.call(this, options).always(function () {\n\t dataset._generateUrls();\n\t });\n\t },\n\t\n\t /** override to use actual Dates objects for create/update times */\n\t parse: function (response, options) {\n\t var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n\t if (parsed.create_time) {\n\t parsed.create_time = new Date(parsed.create_time);\n\t }\n\t if (parsed.update_time) {\n\t parsed.update_time = new Date(parsed.update_time);\n\t }\n\t return parsed;\n\t },\n\t\n\t /** override to wait by default */\n\t save: function (attrs, options) {\n\t options = options || {};\n\t options.wait = _.isUndefined(options.wait) ? true : options.wait;\n\t return Backbone.Model.prototype.save.call(this, attrs, options);\n\t },\n\t\n\t //NOTE: subclasses of DA's will need to implement url and urlRoot in order to have these work properly\n\t /** save this dataset, _Mark_ing it as deleted (just a flag) */\n\t 'delete': function (options) {\n\t if (this.get('deleted')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: true }, options);\n\t },\n\t /** save this dataset, _Mark_ing it as undeleted */\n\t undelete: function (options) {\n\t if (!this.get('deleted') || this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ deleted: false }, options);\n\t },\n\t\n\t /** remove the file behind this dataset from the filesystem (if permitted) */\n\t purge: function _purge(options) {\n\t //TODO: use, override model.destroy, HDA.delete({ purge: true })\n\t if (this.get('purged')) {\n\t return jQuery.when();\n\t }\n\t options = options || {};\n\t options.url = this.urls.purge;\n\t\n\t //TODO: ideally this would be a DELETE call to the api\n\t // using purge async for now\n\t var hda = this,\n\t xhr = jQuery.ajax(options);\n\t xhr.done(function (message, status, responseObj) {\n\t hda.set({ deleted: true, purged: true });\n\t });\n\t xhr.fail(function (xhr, status, message) {\n\t // Exception messages are hidden within error page including: '...not allowed in this Galaxy instance.'\n\t // unbury and re-add to xhr\n\t var error = _l(\"Unable to purge dataset\");\n\t var messageBuriedInUnfortunatelyFormattedError = 'Removal of datasets by users ' + 'is not allowed in this Galaxy instance';\n\t if (xhr.responseJSON && xhr.responseJSON.error) {\n\t error = xhr.responseJSON.error;\n\t } else if (xhr.responseText.indexOf(messageBuriedInUnfortunatelyFormattedError) !== -1) {\n\t error = messageBuriedInUnfortunatelyFormattedError;\n\t }\n\t xhr.responseText = error;\n\t hda.trigger('error', hda, xhr, options, _l(error), { error: error });\n\t });\n\t return xhr;\n\t },\n\t\n\t // ........................................................................ searching\n\t /** what attributes of an HDA will be used in a text search */\n\t searchAttributes: ['name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'],\n\t\n\t /** our attr keys don't often match the labels we display to the user - so, when using\n\t * attribute specifiers ('name=\"bler\"') in a term, allow passing in aliases for the\n\t * following attr keys.\n\t */\n\t searchAliases: {\n\t title: 'name',\n\t format: 'file_ext',\n\t database: 'genome_build',\n\t blurb: 'misc_blurb',\n\t description: 'misc_blurb',\n\t info: 'misc_info',\n\t tag: 'tags'\n\t },\n\t\n\t // ........................................................................ misc\n\t /** String representation */\n\t toString: function () {\n\t var nameAndId = this.get('id') || '';\n\t if (this.get('name')) {\n\t nameAndId = '\"' + this.get('name') + '\",' + nameAndId;\n\t }\n\t return 'Dataset(' + nameAndId + ')';\n\t }\n\t }));\n\t\n\t //==============================================================================\n\t /** @class Backbone collection for dataset associations.\n\t */\n\t var DatasetAssociationCollection = Backbone.Collection.extend(BASE_MVC.LoggableMixin).extend(\n\t /** @lends HistoryContents.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t model: DatasetAssociation,\n\t\n\t /** root api url */\n\t urlRoot: Galaxy.root + 'api/datasets',\n\t\n\t /** url fn */\n\t url: function () {\n\t return this.urlRoot;\n\t },\n\t\n\t // ........................................................................ common queries\n\t /** Get the ids of every item in this collection\n\t * @returns array of encoded ids\n\t */\n\t ids: function () {\n\t return this.map(function (item) {\n\t return item.get('id');\n\t });\n\t },\n\t\n\t /** Get contents that are not ready\n\t * @returns array of content models\n\t */\n\t notReady: function () {\n\t return this.filter(function (content) {\n\t return !content.inReadyState();\n\t });\n\t },\n\t\n\t /** return true if any datasets don't have details */\n\t haveDetails: function () {\n\t return this.all(function (dataset) {\n\t return dataset.hasDetails();\n\t });\n\t },\n\t\n\t // ........................................................................ ajax\n\t /** using a queue, perform ajaxFn on each of the models in this collection */\n\t ajaxQueue: function (ajaxFn, options) {\n\t var deferred = jQuery.Deferred(),\n\t startingLength = this.length,\n\t responses = [];\n\t\n\t if (!startingLength) {\n\t deferred.resolve([]);\n\t return deferred;\n\t }\n\t\n\t // use reverse order (stylistic choice)\n\t var ajaxFns = this.chain().reverse().map(function (dataset, i) {\n\t return function () {\n\t var xhr = ajaxFn.call(dataset, options);\n\t // if successful, notify using the deferred to allow tracking progress\n\t xhr.done(function (response) {\n\t deferred.notify({ curr: i, total: startingLength, response: response, model: dataset });\n\t });\n\t // (regardless of previous error or success) if not last ajax call, shift and call the next\n\t // if last fn, resolve deferred\n\t xhr.always(function (response) {\n\t responses.push(response);\n\t if (ajaxFns.length) {\n\t ajaxFns.shift()();\n\t } else {\n\t deferred.resolve(responses);\n\t }\n\t });\n\t };\n\t }).value();\n\t // start the queue\n\t ajaxFns.shift()();\n\t\n\t return deferred;\n\t },\n\t\n\t // ........................................................................ sorting/filtering\n\t /** return a new collection of datasets whose attributes contain the substring matchesWhat */\n\t matches: function (matchesWhat) {\n\t return this.filter(function (dataset) {\n\t return dataset.matches(matchesWhat);\n\t });\n\t },\n\t\n\t /** String representation. */\n\t toString: function () {\n\t return ['DatasetAssociationCollection(', this.length, ')'].join('');\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t DatasetAssociation: DatasetAssociation,\n\t DatasetAssociationCollection: DatasetAssociationCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 86 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_, jQuery, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(8), __webpack_require__(94), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (MODAL, ERROR_MODAL, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /**\n\t * A dialog/modal that allows copying a user history or 'importing' from user\n\t * another. Generally called via historyCopyDialog below.\n\t * @type {Object}\n\t */\n\t\n\t var CopyDialog = {\n\t\n\t // language related strings/fns\n\t defaultName: _.template(\"Copy of '<%- name %>'\"),\n\t title: _.template(_l('Copying history') + ' \"<%- name %>\"'),\n\t submitLabel: _l('Copy'),\n\t errorMessage: _l('History could not be copied.'),\n\t progressive: _l('Copying history'),\n\t activeLabel: _l('Copy only the active, non-deleted datasets'),\n\t allLabel: _l('Copy all datasets including deleted ones'),\n\t anonWarning: _l('As an anonymous user, unless you login or register, you will lose your current history ') + _l('after copying this history. '),\n\t\n\t // template for modal body\n\t _template: _.template([\n\t //TODO: remove inline styles\n\t // show a warning message for losing current to anon users\n\t '<% if( isAnon ){ %>', '
                                              ', '<%- anonWarning %>', _l('You can'), ' ', _l('login here'), ' ', _l('or'), ' ', ' ', _l('register here'), '.', '
                                              ', '<% } %>', '
                                              ', '
                                              ',\n\t // TODO: could use required here and the form validators\n\t // NOTE: use unescaped here if escaped in the modal function below\n\t '\" />', '

                                              ', _l('Please enter a valid history title'), '

                                              ',\n\t // if allowAll, add the option to copy deleted datasets, too\n\t '<% if( allowAll ){ %>', '
                                              ', '

                                              ', _l('Choose which datasets from the original history to include:'), '

                                              ',\n\t // copy non-deleted is the default\n\t '/>', '', '
                                              ', '/>', '', '<% } %>', '
                                              '].join('')),\n\t\n\t // empty modal body and let the user know the copy is happening\n\t _showAjaxIndicator: function _showAjaxIndicator() {\n\t var indicator = '

                                              ' + this.progressive + '...

                                              ';\n\t this.modal.$('.modal-body').empty().append(indicator).css({ 'margin-top': '8px' });\n\t },\n\t\n\t // (sorta) public interface - display the modal, render the form, and potentially copy the history\n\t // returns a jQuery.Deferred done->history copied, fail->user cancelled\n\t dialog: function _dialog(modal, history, options) {\n\t options = options || {};\n\t\n\t var dialog = this,\n\t deferred = jQuery.Deferred(),\n\t\n\t // TODO: getting a little byzantine here\n\t defaultCopyNameFn = options.nameFn || this.defaultName,\n\t defaultCopyName = defaultCopyNameFn({ name: history.get('name') }),\n\t\n\t // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n\t defaultCopyWhat = options.allDatasets ? 'copy-all' : 'copy-non-deleted',\n\t allowAll = !_.isUndefined(options.allowAll) ? options.allowAll : true,\n\t autoClose = !_.isUndefined(options.autoClose) ? options.autoClose : true;\n\t\n\t this.modal = modal;\n\t\n\t // validate the name and copy if good\n\t function checkNameAndCopy() {\n\t var name = modal.$('#copy-modal-title').val();\n\t if (!name) {\n\t modal.$('.invalid-title').show();\n\t return;\n\t }\n\t // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n\t var copyAllDatasets = modal.$('input[name=\"copy-what\"]:checked').val() === 'copy-all';\n\t modal.$('button').prop('disabled', true);\n\t dialog._showAjaxIndicator();\n\t history.copy(true, name, copyAllDatasets).done(function (response) {\n\t deferred.resolve(response);\n\t }).fail(function (xhr, status, message) {\n\t var options = { name: name, copyAllDatasets: copyAllDatasets };\n\t ERROR_MODAL.ajaxErrorModal(history, xhr, options, dialog.errorMessage);\n\t deferred.rejectWith(deferred, arguments);\n\t }).done(function () {\n\t if (autoClose) {\n\t modal.hide();\n\t }\n\t });\n\t }\n\t\n\t var originalClosingCallback = options.closing_callback;\n\t modal.show(_.extend(options, {\n\t title: this.title({ name: history.get('name') }),\n\t body: $(dialog._template({\n\t name: defaultCopyName,\n\t isAnon: Galaxy.user.isAnonymous(),\n\t allowAll: allowAll,\n\t copyWhat: defaultCopyWhat,\n\t activeLabel: this.activeLabel,\n\t allLabel: this.allLabel,\n\t anonWarning: this.anonWarning\n\t })),\n\t buttons: _.object([[_l('Cancel'), function () {\n\t modal.hide();\n\t }], [this.submitLabel, checkNameAndCopy]]),\n\t height: 'auto',\n\t closing_events: true,\n\t closing_callback: function _historyCopyClose(cancelled) {\n\t if (cancelled) {\n\t deferred.reject({ cancelled: true });\n\t }\n\t if (originalClosingCallback) {\n\t originalClosingCallback(cancelled);\n\t }\n\t }\n\t }));\n\t\n\t // set the default dataset copy, autofocus the title, and set up for a simple return\n\t modal.$('#copy-modal-title').focus().select();\n\t modal.$('#copy-modal-title').on('keydown', function (ev) {\n\t if (ev.keyCode === 13) {\n\t ev.preventDefault();\n\t checkNameAndCopy();\n\t }\n\t });\n\t\n\t return deferred;\n\t }\n\t };\n\t\n\t //==============================================================================\n\t // maintain the (slight) distinction between copy and import\n\t /**\n\t * Subclass CopyDialog to use the import language.\n\t */\n\t var ImportDialog = _.extend({}, CopyDialog, {\n\t defaultName: _.template(\"imported: <%- name %>\"),\n\t title: _.template(_l('Importing history') + ' \"<%- name %>\"'),\n\t submitLabel: _l('Import'),\n\t errorMessage: _l('History could not be imported.'),\n\t progressive: _l('Importing history'),\n\t activeLabel: _l('Import only the active, non-deleted datasets'),\n\t allLabel: _l('Import all datasets including deleted ones'),\n\t anonWarning: _l('As an anonymous user, unless you login or register, you will lose your current history ') + _l('after importing this history. ')\n\t\n\t });\n\t\n\t //==============================================================================\n\t /**\n\t * Main interface for both history import and history copy dialogs.\n\t * @param {Backbone.Model} history the history to copy\n\t * @param {Object} options a hash\n\t * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n\t *\n\t * options:\n\t * (this object is also passed to the modal used to display the dialog and accepts modal options)\n\t * {Function} nameFn if defined, use this to build the default name shown to the user\n\t * (the fn is passed: {name: })\n\t * {bool} useImport if true, use the 'import' language (instead of Copy)\n\t * {bool} allowAll if true, allow the user to choose between copying all datasets and\n\t * only non-deleted datasets\n\t * {String} allDatasets default initial checked radio button: 'copy-all' or 'copy-non-deleted',\n\t */\n\t var historyCopyDialog = function (history, options) {\n\t options = options || {};\n\t // create our own modal if Galaxy doesn't have one (mako tab without use_panels)\n\t var modal = window.parent.Galaxy.modal || new MODAL.View({});\n\t return options.useImport ? ImportDialog.dialog(modal, history, options) : CopyDialog.dialog(modal, history, options);\n\t };\n\t\n\t //==============================================================================\n\t return historyCopyDialog;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 87 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(61), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET_LI, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DATASET_LI.DatasetListItemView;\n\t /** @class Read only view for HistoryDatasetAssociation.\n\t * Since there are no controls on the HDAView to hide the dataset,\n\t * the primary thing this class does (currently) is override templates\n\t * to render the HID.\n\t */\n\t var HDAListItemView = _super.extend(\n\t /** @lends HDAListItemView.prototype */{\n\t\n\t className: _super.prototype.className + \" history-content\",\n\t\n\t initialize: function (attributes, options) {\n\t _super.prototype.initialize.call(this, attributes, options);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDAListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t HDAListItemView.prototype.templates = function () {\n\t\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t // adding the hid display to the title\n\t '
                                              ', '', '
                                              ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- dataset.hid %> ', '<%- dataset.name %>', '
                                              ', '
                                              ', '', '<% _.each(_.sortBy(_.uniq(dataset.tags), function(x) { return x }), function(tag){ %>', '<% if (tag.indexOf(\"name:\") == 0){ %>', '<%- tag.slice(5) %>', '<% } %>', '<% }); %>', '', '
                                              '], 'dataset');\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t hidden: BASE_MVC.wrapTemplate([\n\t // add a warning when hidden\n\t '<% if( !dataset.visible ){ %>', '
                                              ', _l('This dataset has been hidden'), '
                                              ', '<% } %>'], 'dataset')\n\t });\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t titleBar: titleBarTemplate,\n\t warnings: warnings\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HDAListItemView: HDAListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 88 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(85), __webpack_require__(90), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DATASET, HISTORY_CONTENT, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DATASET.DatasetAssociation,\n\t hcontentMixin = HISTORY_CONTENT.HistoryContentMixin;\n\t /** @class (HDA) model for a Galaxy dataset contained in and related to a history.\n\t */\n\t var HistoryDatasetAssociation = _super.extend(BASE_MVC.mixin(hcontentMixin,\n\t /** @lends HistoryDatasetAssociation.prototype */{\n\t\n\t /** default attributes for a model */\n\t defaults: _.extend({}, _super.prototype.defaults, hcontentMixin.defaults, {\n\t history_content_type: 'dataset',\n\t model_class: 'HistoryDatasetAssociation'\n\t })\n\t }));\n\t\n\t //==============================================================================\n\t return {\n\t HistoryDatasetAssociation: HistoryDatasetAssociation\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 89 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(58), __webpack_require__(83), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, DC_LI, DC_VIEW, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t //==============================================================================\n\t\n\t var _super = DC_LI.DCListItemView;\n\t /** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n\t */\n\t var HDCAListItemView = _super.extend(\n\t /** @lends HDCAListItemView.prototype */{\n\t\n\t className: _super.prototype.className + \" history-content\",\n\t\n\t /** event listeners */\n\t _setUpListeners: function () {\n\t _super.prototype._setUpListeners.call(this);\n\t this.listenTo(this.model, {\n\t 'change:tags change:populated change:visible': function (model, options) {\n\t this.render();\n\t }\n\t });\n\t },\n\t\n\t /** Override to provide the proper collections panels as the foldout */\n\t _getFoldoutPanelClass: function () {\n\t switch (this.model.get('collection_type')) {\n\t case 'list':\n\t return DC_VIEW.ListCollectionView;\n\t case 'paired':\n\t return DC_VIEW.PairCollectionView;\n\t case 'list:paired':\n\t return DC_VIEW.ListOfPairsCollectionView;\n\t case 'list:list':\n\t return DC_VIEW.ListOfListsCollectionView;\n\t }\n\t throw new TypeError('Uknown collection_type: ' + this.model.get('collection_type'));\n\t },\n\t\n\t /** In this override, add the state as a class for use with state-based CSS */\n\t _swapNewRender: function ($newRender) {\n\t _super.prototype._swapNewRender.call(this, $newRender);\n\t //TODO: model currently has no state\n\t var state = !this.model.get('populated') ? STATES.RUNNING : STATES.OK;\n\t //if( this.model.has( 'state' ) ){\n\t this.$el.addClass('state-' + state);\n\t //}\n\t return this.$el;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'HDCAListItemView(' + modelString + ')';\n\t }\n\t });\n\t\n\t /** underscore templates */\n\t HDCAListItemView.prototype.templates = function () {\n\t\n\t var warnings = _.extend({}, _super.prototype.templates.warnings, {\n\t hidden: BASE_MVC.wrapTemplate([\n\t // add a warning when hidden\n\t '<% if( !collection.visible ){ %>', '
                                              ', _l('This collection has been hidden'), '
                                              ', '<% } %>'], 'collection')\n\t });\n\t\n\t // could steal this from hda-base (or use mixed content)\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t // adding the hid display to the title\n\t '
                                              ', '', '
                                              ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- collection.hid %> ', '<%- collection.name %>', '
                                              ', '
                                              ', '', '<% _.each(_.sortBy(_.uniq(collection.tags), function(x) { return x }), function(tag){ %>', '<% if (tag.indexOf(\"name:\") == 0){ %>', '<%- tag.slice(5) %>', '<% } %>', '<% }); %>', '', '
                                              '], 'collection');\n\t\n\t return _.extend({}, _super.prototype.templates, {\n\t warnings: warnings,\n\t titleBar: titleBarTemplate\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t return {\n\t HDCAListItemView: HDCAListItemView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 90 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(17), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (STATES, BASE_MVC, _l) {\n\t 'use strict';\n\t\n\t //==============================================================================\n\t /** @class Mixin for HistoryContents content (HDAs, HDCAs).\n\t */\n\t\n\t var HistoryContentMixin = {\n\t\n\t /** default attributes for a model */\n\t defaults: {\n\t /** parent (containing) history */\n\t history_id: null,\n\t /** some content_type (HistoryContents can contain mixed model classes) */\n\t history_content_type: null,\n\t /** indicating when/what order the content was generated in the context of the history */\n\t hid: null,\n\t /** whether the user wants the content shown (visible) */\n\t visible: true\n\t },\n\t\n\t // ........................................................................ mixed content element\n\t // In order to be part of a MIXED bbone collection, we can't rely on the id\n\t // (which may collide btwn models of different classes)\n\t // Instead, use type_id which prefixes the history_content_type so the bbone collection can differentiate\n\t idAttribute: 'type_id',\n\t\n\t // ........................................................................ common queries\n\t /** the more common alias of visible */\n\t hidden: function () {\n\t return !this.get('visible');\n\t },\n\t\n\t //TODO: remove\n\t /** based on includeDeleted, includeHidden (gen. from the container control),\n\t * would this ds show in the list of ds's?\n\t * @param {Boolean} includeDeleted are we showing deleted hdas?\n\t * @param {Boolean} includeHidden are we showing hidden hdas?\n\t */\n\t isVisible: function (includeDeleted, includeHidden) {\n\t var isVisible = true;\n\t if (!includeDeleted && (this.get('deleted') || this.get('purged'))) {\n\t isVisible = false;\n\t }\n\t if (!includeHidden && !this.get('visible')) {\n\t isVisible = false;\n\t }\n\t return isVisible;\n\t },\n\t\n\t // ........................................................................ ajax\n\t //TODO?: these are probably better done on the leaf classes\n\t /** history content goes through the 'api/histories' API */\n\t urlRoot: Galaxy.root + 'api/histories/',\n\t\n\t /** full url spec. for this content */\n\t url: function () {\n\t var url = this.urlRoot + this.get('history_id') + '/contents/' + this.get('history_content_type') + 's/' + this.get('id');\n\t return url;\n\t },\n\t\n\t /** save this content as not visible */\n\t hide: function (options) {\n\t if (!this.get('visible')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ visible: false }, options);\n\t },\n\t /** save this content as visible */\n\t unhide: function (options) {\n\t if (this.get('visible')) {\n\t return jQuery.when();\n\t }\n\t return this.save({ visible: true }, options);\n\t },\n\t\n\t // ........................................................................ misc\n\t toString: function () {\n\t return [this.get('type_id'), this.get('hid'), this.get('name')].join(':');\n\t }\n\t };\n\t\n\t //==============================================================================\n\t return {\n\t HistoryContentMixin: HistoryContentMixin\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 91 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(67), __webpack_require__(152), __webpack_require__(7), __webpack_require__(6), __webpack_require__(98)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_ITEM, LoadingIndicator, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'list';\n\t /* ============================================================================\n\t TODO:\n\t \n\t ============================================================================ */\n\t /** @class View for a list/collection of models and the sub-views of those models.\n\t * Sub-views must (at least have the interface if not) inherit from ListItemView.\n\t * (For a list panel that also includes some 'container' model (History->HistoryContents)\n\t * use ModelWithListPanel)\n\t *\n\t * Allows for:\n\t * searching collection/sub-views\n\t * selecting/multi-selecting sub-views\n\t *\n\t * Currently used:\n\t * for dataset/dataset-choice\n\t * as superclass of ModelListPanel\n\t */\n\t var ListPanel = Backbone.View.extend(BASE_MVC.LoggableMixin).extend( /** @lends ListPanel.prototype */{\n\t _logNamespace: logNamespace,\n\t\n\t /** class to use for constructing the sub-views */\n\t viewClass: LIST_ITEM.ListItemView,\n\t /** class to used for constructing collection of sub-view models */\n\t collectionClass: Backbone.Collection,\n\t\n\t tagName: 'div',\n\t className: 'list-panel',\n\t\n\t /** (in ms) that jquery effects will use */\n\t fxSpeed: 'fast',\n\t\n\t /** string to display when the collection has no contents */\n\t emptyMsg: _l('This list is empty'),\n\t /** displayed when no items match the search terms */\n\t noneFoundMsg: _l('No matching items found'),\n\t /** string used for search placeholder */\n\t searchPlaceholder: _l('search'),\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes optional settings for the list\n\t */\n\t initialize: function (attributes, options) {\n\t attributes = attributes || {};\n\t // set the logger if requested\n\t if (attributes.logger) {\n\t this.logger = attributes.logger;\n\t }\n\t this.log(this + '.initialize:', attributes);\n\t\n\t // ---- instance vars\n\t /** how quickly should jquery fx run? */\n\t this.fxSpeed = _.has(attributes, 'fxSpeed') ? attributes.fxSpeed : this.fxSpeed;\n\t\n\t /** filters for displaying subviews */\n\t this.filters = [];\n\t /** current search terms */\n\t this.searchFor = attributes.searchFor || '';\n\t\n\t /** loading indicator */\n\t // this.indicator = new LoadingIndicator( this.$el );\n\t\n\t /** currently showing selectors on items? */\n\t this.selecting = attributes.selecting !== undefined ? attributes.selecting : true;\n\t //this.selecting = false;\n\t\n\t /** cached selected item.model.ids to persist btwn renders */\n\t this.selected = attributes.selected || [];\n\t /** the last selected item.model.id */\n\t this.lastSelected = null;\n\t\n\t /** are sub-views draggable */\n\t this.dragItems = attributes.dragItems || false;\n\t\n\t /** list item view class (when passed models) */\n\t this.viewClass = attributes.viewClass || this.viewClass;\n\t\n\t /** list item views */\n\t this.views = [];\n\t /** list item models */\n\t this.collection = attributes.collection || this._createDefaultCollection();\n\t\n\t /** filter fns run over collection items to see if they should show in the list */\n\t this.filters = attributes.filters || [];\n\t\n\t /** override $scrollContainer fn via attributes - fn should return jq for elem to call scrollTo on */\n\t this.$scrollContainer = attributes.$scrollContainer || this.$scrollContainer;\n\t\n\t /** @type {String} generic title */\n\t this.title = attributes.title || '';\n\t /** @type {String} generic subtitle */\n\t this.subtitle = attributes.subtitle || '';\n\t\n\t this._setUpListeners();\n\t },\n\t\n\t // ------------------------------------------------------------------------ listeners\n\t /** create any event listeners for the list */\n\t _setUpListeners: function () {\n\t this.off();\n\t\n\t //TODO: move errorHandler down into list-view from history-view or\n\t // pass to global error handler (Galaxy)\n\t this.on({\n\t error: function (model, xhr, options, msg, details) {\n\t //this.errorHandler( model, xhr, options, msg, details );\n\t console.error(model, xhr, options, msg, details);\n\t },\n\t // show hide the loading indicator\n\t loading: function () {\n\t this._showLoadingIndicator('loading...', 40);\n\t },\n\t 'loading-done': function () {\n\t this._hideLoadingIndicator(40);\n\t }\n\t });\n\t\n\t // throw the first render up as a diff namespace using once (for outside consumption)\n\t this.once('rendered', function () {\n\t this.trigger('rendered:initial', this);\n\t });\n\t\n\t this._setUpCollectionListeners();\n\t this._setUpViewListeners();\n\t return this;\n\t },\n\t\n\t /** create and return a collection for when none is initially passed */\n\t _createDefaultCollection: function () {\n\t // override\n\t return new this.collectionClass([]);\n\t },\n\t\n\t /** listening for collection events */\n\t _setUpCollectionListeners: function () {\n\t this.log(this + '._setUpCollectionListeners', this.collection);\n\t this.stopListening(this.collection);\n\t\n\t // bubble up error events\n\t this.listenTo(this.collection, {\n\t error: function (model, xhr, options, msg, details) {\n\t this.trigger('error', model, xhr, options, msg, details);\n\t },\n\t update: function (collection, options) {\n\t var changes = options.changes;\n\t // console.info( collection + ', update:', changes, '\\noptions:', options );\n\t // more than one: render everything\n\t if (options.renderAll || changes.added.length + changes.removed.length > 1) {\n\t return this.renderItems();\n\t }\n\t // otherwise, let the single add/remove handlers do it\n\t if (changes.added.length === 1) {\n\t return this.addItemView(_.first(changes.added), collection, options);\n\t }\n\t if (changes.removed.length === 1) {\n\t return this.removeItemView(_.first(changes.removed), collection, options);\n\t }\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /** listening for sub-view events that bubble up with the 'view:' prefix */\n\t _setUpViewListeners: function () {\n\t this.log(this + '._setUpViewListeners');\n\t\n\t // shift to select a range\n\t this.on({\n\t 'view:selected': function (view, ev) {\n\t if (ev && ev.shiftKey && this.lastSelected) {\n\t var lastSelectedView = this.viewFromModelId(this.lastSelected);\n\t if (lastSelectedView) {\n\t this.selectRange(view, lastSelectedView);\n\t }\n\t } else if (ev && ev.altKey && !this.selecting) {\n\t this.showSelectors();\n\t }\n\t this.selected.push(view.model.id);\n\t this.lastSelected = view.model.id;\n\t },\n\t\n\t 'view:de-selected': function (view, ev) {\n\t this.selected = _.without(this.selected, view.model.id);\n\t }\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering\n\t /** Render this content, set up ui.\n\t * @param {Number or String} speed the speed of the render\n\t */\n\t render: function (speed) {\n\t this.log(this + '.render', speed);\n\t var $newRender = this._buildNewRender();\n\t this._setUpBehaviors($newRender);\n\t this._queueNewRender($newRender, speed);\n\t return this;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el. */\n\t _buildNewRender: function () {\n\t this.debug(this + '(ListPanel)._buildNewRender');\n\t var $newRender = $(this.templates.el({}, this));\n\t this._renderControls($newRender);\n\t this._renderTitle($newRender);\n\t this._renderSubtitle($newRender);\n\t this._renderSearch($newRender);\n\t this.renderItems($newRender);\n\t return $newRender;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el. */\n\t _renderControls: function ($newRender) {\n\t this.debug(this + '(ListPanel)._renderControls');\n\t var $controls = $(this.templates.controls({}, this));\n\t $newRender.find('.controls').replaceWith($controls);\n\t return $controls;\n\t },\n\t\n\t /** return a jQuery object containing the title DOM */\n\t _renderTitle: function ($where) {\n\t //$where = $where || this.$el;\n\t //$where.find( '.title' ).replaceWith( ... )\n\t },\n\t\n\t /** return a jQuery object containing the subtitle DOM (if any) */\n\t _renderSubtitle: function ($where) {\n\t //$where = $where || this.$el;\n\t //$where.find( '.title' ).replaceWith( ... )\n\t },\n\t\n\t /** Fade out the old el, swap in the new contents, then fade in.\n\t * @param {Number or String} speed jq speed to use for rendering effects\n\t * @fires rendered when rendered\n\t */\n\t _queueNewRender: function ($newRender, speed) {\n\t speed = speed === undefined ? this.fxSpeed : speed;\n\t var panel = this;\n\t panel.log('_queueNewRender:', $newRender, speed);\n\t\n\t $(panel).queue('fx', [function (next) {\n\t panel.$el.fadeOut(speed, next);\n\t }, function (next) {\n\t panel._swapNewRender($newRender);\n\t next();\n\t }, function (next) {\n\t panel.$el.fadeIn(speed, next);\n\t }, function (next) {\n\t panel.trigger('rendered', panel);\n\t next();\n\t }]);\n\t },\n\t\n\t /** empty out the current el, move the $newRender's children in */\n\t _swapNewRender: function ($newRender) {\n\t this.$el.empty().attr('class', this.className).append($newRender.children());\n\t if (this.selecting) {\n\t this.showSelectors(0);\n\t }\n\t return this;\n\t },\n\t\n\t /** Set up any behaviors, handlers (ep. plugins) that need to be called when the entire view has been built but\n\t * not attached to the page yet.\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t this.$controls($where).find('[title]').tooltip();\n\t // set up the pupup for actions available when multi selecting\n\t this._renderMultiselectActionMenu($where);\n\t return this;\n\t },\n\t\n\t /** render a menu containing the actions available to sets of selected items */\n\t _renderMultiselectActionMenu: function ($where) {\n\t $where = $where || this.$el;\n\t var $menu = $where.find('.list-action-menu'),\n\t actions = this.multiselectActions();\n\t if (!actions.length) {\n\t return $menu.empty();\n\t }\n\t\n\t var $newMenu = $(['
                                              ', '', '
                                                ', '
                                              ', '
                                              '].join(''));\n\t var $actions = actions.map(function (action) {\n\t var html = ['
                                            • ', action.html, '
                                            • '].join('');\n\t return $(html).click(function (ev) {\n\t ev.preventDefault();\n\t return action.func(ev);\n\t });\n\t });\n\t $newMenu.find('ul').append($actions);\n\t $menu.replaceWith($newMenu);\n\t return $newMenu;\n\t },\n\t\n\t /** return a list of plain objects used to render multiselect actions menu. Each object should have:\n\t * html: an html string used as the anchor contents\n\t * func: a function called when the anchor is clicked (passed the click event)\n\t */\n\t multiselectActions: function () {\n\t return [];\n\t },\n\t\n\t // ------------------------------------------------------------------------ sub-$element shortcuts\n\t /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n\t $scrollContainer: function ($where) {\n\t // override or set via attributes.$scrollContainer\n\t return ($where || this.$el).parent().parent();\n\t },\n\t /** convenience selector for the section that displays the list controls */\n\t $controls: function ($where) {\n\t return ($where || this.$el).find('> .controls');\n\t },\n\t /** list-items: where the subviews are contained in the view's dom */\n\t $list: function ($where) {\n\t return ($where || this.$el).find('> .list-items');\n\t },\n\t /** container where list messages are attached */\n\t $messages: function ($where) {\n\t //TODO: controls isn't really correct here (only for ModelListPanel)\n\t return ($where || this.$el).find('> .controls .messages');\n\t },\n\t /** the message displayed when no views can be shown (no views, none matching search) */\n\t $emptyMessage: function ($where) {\n\t return ($where || this.$el).find('> .empty-message');\n\t },\n\t\n\t // ------------------------------------------------------------------------ hda sub-views\n\t /** render the subviews for the list's collection */\n\t renderItems: function ($whereTo) {\n\t $whereTo = $whereTo || this.$el;\n\t var panel = this;\n\t panel.log(this + '.renderItems', $whereTo);\n\t\n\t var $list = panel.$list($whereTo);\n\t panel.freeViews();\n\t // console.log( 'views freed' );\n\t //TODO:? cache and re-use views?\n\t var shownModels = panel._filterCollection();\n\t // console.log( 'models filtered:', shownModels );\n\t\n\t panel.views = shownModels.map(function (itemModel) {\n\t var view = panel._createItemView(itemModel);\n\t return view;\n\t });\n\t\n\t $list.empty();\n\t // console.log( 'list emptied' );\n\t if (panel.views.length) {\n\t panel._attachItems($whereTo);\n\t // console.log( 'items attached' );\n\t }\n\t panel._renderEmptyMessage($whereTo).toggle(!panel.views.length);\n\t panel.trigger('views:ready', panel.views);\n\t\n\t // console.log( '------------------------------------------- rendering items' );\n\t return panel.views;\n\t },\n\t\n\t /** Filter the collection to only those models that should be currently viewed */\n\t _filterCollection: function () {\n\t // override this\n\t var panel = this;\n\t return panel.collection.filter(_.bind(panel._filterItem, panel));\n\t },\n\t\n\t /** Should the model be viewable in the current state?\n\t * Checks against this.filters and this.searchFor\n\t */\n\t _filterItem: function (model) {\n\t // override this\n\t var panel = this;\n\t return _.every(panel.filters.map(function (fn) {\n\t return fn.call(model);\n\t })) && (!panel.searchFor || model.matchesAll(panel.searchFor));\n\t },\n\t\n\t /** Create a view for a model and set up it's listeners */\n\t _createItemView: function (model) {\n\t var ViewClass = this._getItemViewClass(model);\n\t var options = _.extend(this._getItemViewOptions(model), {\n\t model: model\n\t });\n\t var view = new ViewClass(options);\n\t this._setUpItemViewListeners(view);\n\t return view;\n\t },\n\t\n\t /** Free a view for a model. Note: does not remove it from the DOM */\n\t _destroyItemView: function (view) {\n\t this.stopListening(view);\n\t this.views = _.without(this.views, view);\n\t },\n\t\n\t _destroyItemViews: function (view) {\n\t var self = this;\n\t self.views.forEach(function (v) {\n\t self.stopListening(v);\n\t });\n\t self.views = [];\n\t return self;\n\t },\n\t\n\t /** free any sub-views the list has */\n\t freeViews: function () {\n\t return this._destroyItemViews();\n\t },\n\t\n\t /** Get the bbone view class based on the model */\n\t _getItemViewClass: function (model) {\n\t // override this\n\t return this.viewClass;\n\t },\n\t\n\t /** Get the options passed to the new view based on the model */\n\t _getItemViewOptions: function (model) {\n\t // override this\n\t return {\n\t //logger : this.logger,\n\t fxSpeed: this.fxSpeed,\n\t expanded: false,\n\t selectable: this.selecting,\n\t selected: _.contains(this.selected, model.id),\n\t draggable: this.dragItems\n\t };\n\t },\n\t\n\t /** Set up listeners for new models */\n\t _setUpItemViewListeners: function (view) {\n\t var panel = this;\n\t // send all events to the panel, re-namspaceing them with the view prefix\n\t this.listenTo(view, 'all', function () {\n\t var args = Array.prototype.slice.call(arguments, 0);\n\t args[0] = 'view:' + args[0];\n\t panel.trigger.apply(panel, args);\n\t });\n\t\n\t // drag multiple - hijack ev.setData to add all selected items\n\t this.listenTo(view, 'draggable:dragstart', function (ev, v) {\n\t //TODO: set multiple drag data here\n\t var json = {},\n\t selected = this.getSelectedModels();\n\t if (selected.length) {\n\t json = selected.toJSON();\n\t } else {\n\t json = [v.model.toJSON()];\n\t }\n\t ev.dataTransfer.setData('text', JSON.stringify(json));\n\t //ev.dataTransfer.setDragImage( v.el, 60, 60 );\n\t }, this);\n\t\n\t return panel;\n\t },\n\t\n\t /** Attach views in this.views to the model based on $whereTo */\n\t _attachItems: function ($whereTo) {\n\t var self = this;\n\t // console.log( '_attachItems:', $whereTo, this.$list( $whereTo ) );\n\t //ASSUMES: $list has been emptied\n\t this.$list($whereTo).append(this.views.map(function (view) {\n\t return self._renderItemView$el(view);\n\t }));\n\t return this;\n\t },\n\t\n\t /** get a given subview's $el (or whatever may wrap it) and return it */\n\t _renderItemView$el: function (view) {\n\t // useful to wrap and override\n\t return view.render(0).$el;\n\t },\n\t\n\t /** render the empty/none-found message */\n\t _renderEmptyMessage: function ($whereTo) {\n\t this.debug('_renderEmptyMessage', $whereTo, this.searchFor);\n\t var text = this.searchFor ? this.noneFoundMsg : this.emptyMsg;\n\t return this.$emptyMessage($whereTo).text(text);\n\t },\n\t\n\t /** expand all item views */\n\t expandAll: function () {\n\t _.each(this.views, function (view) {\n\t view.expand();\n\t });\n\t },\n\t\n\t /** collapse all item views */\n\t collapseAll: function () {\n\t _.each(this.views, function (view) {\n\t view.collapse();\n\t });\n\t },\n\t\n\t // ------------------------------------------------------------------------ collection/views syncing\n\t /** Add a view (if the model should be viewable) to the panel */\n\t addItemView: function (model, collection, options) {\n\t // console.log( this + '.addItemView:', model );\n\t var panel = this;\n\t // get the index of the model in the list of filtered models shown by this list\n\t // in order to insert the view in the proper place\n\t //TODO:? potentially expensive\n\t var modelIndex = panel._filterCollection().indexOf(model);\n\t if (modelIndex === -1) {\n\t return undefined;\n\t }\n\t var view = panel._createItemView(model);\n\t // console.log( 'adding and rendering:', modelIndex, view.toString() );\n\t\n\t $(view).queue('fx', [function (next) {\n\t // hide the empty message first if only view\n\t if (panel.$emptyMessage().is(':visible')) {\n\t panel.$emptyMessage().fadeOut(panel.fxSpeed, next);\n\t } else {\n\t next();\n\t }\n\t }, function (next) {\n\t panel._attachView(view, modelIndex);\n\t next();\n\t }]);\n\t return view;\n\t },\n\t\n\t /** internal fn to add view (to both panel.views and panel.$list) */\n\t _attachView: function (view, modelIndex, useFx) {\n\t // console.log( this + '._attachView:', view, modelIndex, useFx );\n\t useFx = _.isUndefined(useFx) ? true : useFx;\n\t modelIndex = modelIndex || 0;\n\t var panel = this;\n\t\n\t // use the modelIndex to splice into views and insert at the proper index in the DOM\n\t panel.views.splice(modelIndex, 0, view);\n\t panel._insertIntoListAt(modelIndex, panel._renderItemView$el(view).hide());\n\t\n\t panel.trigger('view:attached', view);\n\t if (useFx) {\n\t view.$el.slideDown(panel.fxSpeed, function () {\n\t panel.trigger('view:attached:rendered');\n\t });\n\t } else {\n\t view.$el.show();\n\t panel.trigger('view:attached:rendered');\n\t }\n\t return view;\n\t },\n\t\n\t /** insert a jq object as a child of list-items at the specified *DOM index* */\n\t _insertIntoListAt: function (index, $what) {\n\t // console.log( this + '._insertIntoListAt:', index, $what );\n\t var $list = this.$list();\n\t if (index === 0) {\n\t $list.prepend($what);\n\t } else {\n\t $list.children().eq(index - 1).after($what);\n\t }\n\t return $what;\n\t },\n\t\n\t /** Remove a view from the panel (if found) */\n\t removeItemView: function (model, collection, options) {\n\t var panel = this;\n\t var view = _.find(panel.views, function (v) {\n\t return v.model === model;\n\t });\n\t if (!view) {\n\t return undefined;\n\t }\n\t panel.views = _.without(panel.views, view);\n\t panel.trigger('view:removed', view);\n\t\n\t // potentially show the empty message if no views left\n\t // use anonymous queue here - since remove can happen multiple times\n\t $({}).queue('fx', [function (next) {\n\t view.$el.fadeOut(panel.fxSpeed, next);\n\t }, function (next) {\n\t view.remove();\n\t panel.trigger('view:removed:rendered');\n\t if (!panel.views.length) {\n\t panel._renderEmptyMessage().fadeIn(panel.fxSpeed, next);\n\t } else {\n\t next();\n\t }\n\t }]);\n\t return view;\n\t },\n\t\n\t /** get views based on model.id */\n\t viewFromModelId: function (id) {\n\t return _.find(this.views, function (v) {\n\t return v.model.id === id;\n\t });\n\t },\n\t\n\t /** get views based on model */\n\t viewFromModel: function (model) {\n\t return model ? this.viewFromModelId(model.id) : undefined;\n\t },\n\t\n\t /** get views based on model properties */\n\t viewsWhereModel: function (properties) {\n\t return this.views.filter(function (view) {\n\t return _.isMatch(view.model.attributes, properties);\n\t });\n\t },\n\t\n\t /** A range of views between (and including) viewA and viewB */\n\t viewRange: function (viewA, viewB) {\n\t if (viewA === viewB) {\n\t return viewA ? [viewA] : [];\n\t }\n\t\n\t var indexA = this.views.indexOf(viewA),\n\t indexB = this.views.indexOf(viewB);\n\t\n\t // handle not found\n\t if (indexA === -1 || indexB === -1) {\n\t if (indexA === indexB) {\n\t return [];\n\t }\n\t return indexA === -1 ? [viewB] : [viewA];\n\t }\n\t // reverse if indeces are\n\t //note: end inclusive\n\t return indexA < indexB ? this.views.slice(indexA, indexB + 1) : this.views.slice(indexB, indexA + 1);\n\t },\n\t\n\t // ------------------------------------------------------------------------ searching\n\t /** render a search input for filtering datasets shown\n\t * (see SearchableMixin in base-mvc for implementation of the actual searching)\n\t * return will start the search\n\t * esc will clear the search\n\t * clicking the clear button will clear the search\n\t * uses searchInput in ui.js\n\t */\n\t _renderSearch: function ($where) {\n\t $where.find('.controls .search-input').searchInput({\n\t placeholder: this.searchPlaceholder,\n\t initialVal: this.searchFor,\n\t onfirstsearch: _.bind(this._firstSearch, this),\n\t onsearch: _.bind(this.searchItems, this),\n\t onclear: _.bind(this.clearSearch, this)\n\t });\n\t return $where;\n\t },\n\t\n\t /** What to do on the first search entered */\n\t _firstSearch: function (searchFor) {\n\t // override to load model details if necc.\n\t this.log('onFirstSearch', searchFor);\n\t return this.searchItems(searchFor);\n\t },\n\t\n\t /** filter view list to those that contain the searchFor terms */\n\t searchItems: function (searchFor, force) {\n\t this.log('searchItems', searchFor, this.searchFor, force);\n\t if (!force && this.searchFor === searchFor) {\n\t return this;\n\t }\n\t this.searchFor = searchFor;\n\t this.renderItems();\n\t this.trigger('search:searching', searchFor, this);\n\t var $search = this.$('> .controls .search-query');\n\t if ($search.val() !== searchFor) {\n\t $search.val(searchFor);\n\t }\n\t return this;\n\t },\n\t\n\t /** clear the search filters and show all views that are normally shown */\n\t clearSearch: function (searchFor) {\n\t //this.log( 'onSearchClear', this );\n\t this.searchFor = '';\n\t this.trigger('search:clear', this);\n\t this.$('> .controls .search-query').val('');\n\t this.renderItems();\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ selection\n\t /** @type Integer when the number of list item views is >= to this, don't animate selectors */\n\t THROTTLE_SELECTOR_FX_AT: 20,\n\t\n\t /** show selectors on all visible itemViews and associated controls */\n\t showSelectors: function (speed) {\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t this.selecting = true;\n\t this.$('.list-actions').slideDown(speed);\n\t speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT ? 0 : speed;\n\t _.each(this.views, function (view) {\n\t view.showSelector(speed);\n\t });\n\t //this.selected = [];\n\t //this.lastSelected = null;\n\t },\n\t\n\t /** hide selectors on all visible itemViews and associated controls */\n\t hideSelectors: function (speed) {\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t this.selecting = false;\n\t this.$('.list-actions').slideUp(speed);\n\t speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT ? 0 : speed;\n\t _.each(this.views, function (view) {\n\t view.hideSelector(speed);\n\t });\n\t this.selected = [];\n\t this.lastSelected = null;\n\t },\n\t\n\t /** show or hide selectors on all visible itemViews and associated controls */\n\t toggleSelectors: function () {\n\t if (!this.selecting) {\n\t this.showSelectors();\n\t } else {\n\t this.hideSelectors();\n\t }\n\t },\n\t\n\t /** select all visible items */\n\t selectAll: function (event) {\n\t _.each(this.views, function (view) {\n\t view.select(event);\n\t });\n\t },\n\t\n\t /** deselect all visible items */\n\t deselectAll: function (event) {\n\t this.lastSelected = null;\n\t _.each(this.views, function (view) {\n\t view.deselect(event);\n\t });\n\t },\n\t\n\t /** select a range of datasets between A and B */\n\t selectRange: function (viewA, viewB) {\n\t var range = this.viewRange(viewA, viewB);\n\t _.each(range, function (view) {\n\t view.select();\n\t });\n\t return range;\n\t },\n\t\n\t /** return an array of all currently selected itemViews */\n\t getSelectedViews: function () {\n\t return _.filter(this.views, function (v) {\n\t return v.selected;\n\t });\n\t },\n\t\n\t /** return a collection of the models of all currenly selected items */\n\t getSelectedModels: function () {\n\t // console.log( '(getSelectedModels)' );\n\t return new this.collection.constructor(_.map(this.getSelectedViews(), function (view) {\n\t return view.model;\n\t }));\n\t },\n\t\n\t // ------------------------------------------------------------------------ loading indicator\n\t /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n\t _showLoadingIndicator: function (msg, speed, callback) {\n\t this.debug('_showLoadingIndicator', this.indicator, msg, speed, callback);\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t if (!this.indicator) {\n\t this.indicator = new LoadingIndicator(this.$el);\n\t this.debug('\\t created', this.indicator);\n\t }\n\t if (!this.$el.is(':visible')) {\n\t this.indicator.show(0, callback);\n\t } else {\n\t this.$el.fadeOut(speed);\n\t this.indicator.show(msg, speed, callback);\n\t }\n\t },\n\t\n\t /** hide the loading indicator */\n\t _hideLoadingIndicator: function (speed, callback) {\n\t this.debug('_hideLoadingIndicator', this.indicator, speed, callback);\n\t speed = speed !== undefined ? speed : this.fxSpeed;\n\t if (this.indicator) {\n\t this.indicator.hide(speed, callback);\n\t }\n\t },\n\t\n\t // ------------------------------------------------------------------------ scrolling\n\t /** get the current scroll position of the panel in its parent */\n\t scrollPosition: function () {\n\t return this.$scrollContainer().scrollTop();\n\t },\n\t\n\t /** set the current scroll position of the panel in its parent */\n\t scrollTo: function (pos, speed) {\n\t speed = speed || 0;\n\t this.$scrollContainer().animate({ scrollTop: pos }, speed);\n\t return this;\n\t },\n\t\n\t /** Scrolls the panel to the top. */\n\t scrollToTop: function (speed) {\n\t return this.scrollTo(0, speed);\n\t },\n\t\n\t /** scroll to the given view in list-items */\n\t scrollToItem: function (view, speed) {\n\t if (!view) {\n\t return this;\n\t }\n\t return this;\n\t },\n\t\n\t /** Scrolls the panel to show the content with the given id. */\n\t scrollToId: function (id, speed) {\n\t return this.scrollToItem(this.viewFromModelId(id), speed);\n\t },\n\t\n\t // ------------------------------------------------------------------------ panel events\n\t /** event map */\n\t events: {\n\t 'click .select-all': 'selectAll',\n\t 'click .deselect-all': 'deselectAll'\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** Return a string rep of the panel */\n\t toString: function () {\n\t return 'ListPanel(' + this.collection + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t ListPanel.prototype.templates = function () {\n\t\n\t var elTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ']);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
                                              ', '
                                              ', '
                                              <%- view.title %>
                                              ', '
                                              ', '
                                              <%- view.subtitle %>
                                              ',\n\t // buttons, controls go here\n\t '
                                              ',\n\t // deleted msg, etc.\n\t '
                                              ', '
                                              ', '
                                              ', '
                                              ',\n\t\n\t // show when selectors are shown\n\t '
                                              ', '
                                              ', '', '', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ']);\n\t\n\t return {\n\t el: elTemplate,\n\t controls: controlsTemplate\n\t };\n\t }();\n\t\n\t //=============================================================================\n\t /** View for a model that has a sub-collection (e.g. History, DatasetCollection)\n\t * Allows:\n\t * the model to be reset\n\t * auto assign panel.collection to panel.model[ panel.modelCollectionKey ]\n\t *\n\t */\n\t var ModelListPanel = ListPanel.extend({\n\t\n\t /** key of attribute in model to assign to this.collection */\n\t modelCollectionKey: 'contents',\n\t\n\t initialize: function (attributes) {\n\t ListPanel.prototype.initialize.call(this, attributes);\n\t this.selecting = attributes.selecting !== undefined ? attributes.selecting : false;\n\t\n\t this.setModel(this.model, attributes);\n\t },\n\t\n\t /** release/free/shutdown old models and set up panel for new models\n\t * @fires new-model with the panel as parameter\n\t */\n\t setModel: function (model, attributes) {\n\t attributes = attributes || {};\n\t this.debug(this + '.setModel:', model, attributes);\n\t\n\t this.freeModel();\n\t this.freeViews();\n\t\n\t if (model) {\n\t var oldModelId = this.model ? this.model.get('id') : null;\n\t\n\t // set up the new model with user, logger, storage, events\n\t this.model = model;\n\t if (this.logger) {\n\t this.model.logger = this.logger;\n\t }\n\t this._setUpModelListeners();\n\t\n\t //TODO: relation btwn model, collection becoming tangled here\n\t // free the collection, and assign the new collection to either\n\t // the model[ modelCollectionKey ], attributes.collection, or an empty vanilla collection\n\t this.stopListening(this.collection);\n\t this.collection = this.model[this.modelCollectionKey] || attributes.collection || this._createDefaultCollection();\n\t this._setUpCollectionListeners();\n\t\n\t if (oldModelId && model.get('id') !== oldModelId) {\n\t this.trigger('new-model', this);\n\t }\n\t }\n\t return this;\n\t },\n\t\n\t /** free the current model and all listeners for it, free any views for the model */\n\t freeModel: function () {\n\t // stop/release the previous model, and clear cache to sub-views\n\t if (this.model) {\n\t this.stopListening(this.model);\n\t //TODO: see base-mvc\n\t //this.model.free();\n\t //this.model = null;\n\t }\n\t return this;\n\t },\n\t\n\t // ------------------------------------------------------------------------ listening\n\t /** listening for model events */\n\t _setUpModelListeners: function () {\n\t // override\n\t this.log(this + '._setUpModelListeners', this.model);\n\t // bounce model errors up to the panel\n\t this.listenTo(this.model, 'error', function () {\n\t var args = Array.prototype.slice.call(arguments, 0);\n\t //args.unshift( 'model:error' );\n\t args.unshift('error');\n\t this.trigger.apply(this, args);\n\t }, this);\n\t\n\t // debugging\n\t if (this.logger) {\n\t this.listenTo(this.model, 'all', function (event) {\n\t this.info(this + '(model)', event, arguments);\n\t });\n\t }\n\t return this;\n\t },\n\t\n\t /** Build a temp div containing the new children for the view's $el.\n\t */\n\t _renderControls: function ($newRender) {\n\t this.debug(this + '(ModelListPanel)._renderControls');\n\t var json = this.model ? this.model.toJSON() : {},\n\t $controls = $(this.templates.controls(json, this));\n\t $newRender.find('.controls').replaceWith($controls);\n\t return $controls;\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** Return a string rep of the panel */\n\t toString: function () {\n\t return 'ModelListPanel(' + this.model + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t ModelListPanel.prototype.templates = function () {\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate(['
                                              ', '
                                              ',\n\t //TODO: this is really the only difference - consider factoring titlebar out\n\t '
                                              <%- model.name %>
                                              ', '
                                              ', '
                                              <%- view.subtitle %>
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '', '', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ']);\n\t\n\t return _.extend(_.clone(ListPanel.prototype.templates), {\n\t controls: controlsTemplate\n\t });\n\t }();\n\t\n\t //=============================================================================\n\t return {\n\t ListPanel: ListPanel,\n\t ModelListPanel: ModelListPanel\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 92 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This is the run workflow tool form view. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(50), __webpack_require__(5), __webpack_require__(10), __webpack_require__(19), __webpack_require__(46), __webpack_require__(8), __webpack_require__(44), __webpack_require__(147)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Deferred, Ui, Form, FormData, ToolFormBase, Modal, Webhooks, WorkflowIcons) {\n\t\n\t var View = Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.modal = parent.Galaxy.modal || new Modal.View();\n\t this.model = options && options.model || new Backbone.Model(options);\n\t this.deferred = new Deferred();\n\t this.setElement($('
                                              ').addClass('ui-form-composite').append(this.$message = $('
                                              ')).append(this.$header = $('
                                              ')).append(this.$steps = $('
                                              ')));\n\t $('body').append(this.$el);\n\t this._configure();\n\t this.render();\n\t $(window).resize(function () {\n\t self._refresh();\n\t });\n\t },\n\t\n\t /** Refresh height of scrollable div below header, handle scrolling by lazy loading steps */\n\t _refresh: function (step_index) {\n\t var margin = _.reduce(this.$el.children(), function (memo, child) {\n\t return memo + $(child).outerHeight();\n\t }, 0) - this.$steps.height() + 90;\n\t this.$steps.css('height', $(window).height() - margin);\n\t },\n\t\n\t /** Configures form/step options for each workflow step */\n\t _configure: function () {\n\t var self = this;\n\t this.forms = [];\n\t this.steps = [];\n\t this.links = [];\n\t this.parms = [];\n\t _.each(this.model.get('steps'), function (step, i) {\n\t Galaxy.emit.debug('tool-form-composite::initialize()', i + ' : Preparing workflow step.');\n\t var icon = WorkflowIcons[step.step_type];\n\t var title = parseInt(i + 1) + ': ' + (step.step_label || step.step_name);\n\t if (step.annotation) {\n\t title += ' - ' + step.annotation;\n\t }\n\t if (step.step_version) {\n\t title += ' (Galaxy Version ' + step.step_version + ')';\n\t }\n\t step = Utils.merge({\n\t index: i,\n\t fixed_title: _.escape(title),\n\t icon: icon || '',\n\t help: null,\n\t citations: null,\n\t collapsible: true,\n\t collapsed: i > 0 && !self._isDataStep(step),\n\t sustain_version: true,\n\t sustain_repeats: true,\n\t sustain_conditionals: true,\n\t narrow: true,\n\t text_enable: 'Edit',\n\t text_disable: 'Undo',\n\t cls_enable: 'fa fa-edit',\n\t cls_disable: 'fa fa-undo',\n\t errors: step.messages,\n\t initial_errors: true,\n\t cls: 'ui-portlet-narrow',\n\t hide_operations: true,\n\t needs_refresh: false,\n\t always_refresh: step.step_type != 'tool'\n\t }, step);\n\t self.steps[i] = step;\n\t self.links[i] = [];\n\t self.parms[i] = {};\n\t });\n\t\n\t // build linear index of step input pairs\n\t _.each(this.steps, function (step, i) {\n\t FormData.visitInputs(step.inputs, function (input, name) {\n\t self.parms[i][name] = input;\n\t });\n\t });\n\t\n\t // iterate through data input modules and collect linked sub steps\n\t _.each(this.steps, function (step, i) {\n\t _.each(step.output_connections, function (output_connection) {\n\t _.each(self.steps, function (sub_step, j) {\n\t sub_step.step_index === output_connection.input_step_index && self.links[i].push(sub_step);\n\t });\n\t });\n\t });\n\t\n\t // convert all connected data inputs to hidden fields with proper labels,\n\t // and track the linked source step\n\t _.each(this.steps, function (step, i) {\n\t _.each(self.steps, function (sub_step, j) {\n\t var connections_by_name = {};\n\t _.each(step.output_connections, function (connection) {\n\t sub_step.step_index === connection.input_step_index && (connections_by_name[connection.input_name] = connection);\n\t });\n\t _.each(self.parms[j], function (input, name) {\n\t var connection = connections_by_name[name];\n\t if (connection) {\n\t input.type = 'hidden';\n\t input.help = input.step_linked ? input.help + ', ' : '';\n\t input.help += 'Output dataset \\'' + connection.output_name + '\\' from step ' + (parseInt(i) + 1);\n\t input.step_linked = input.step_linked || [];\n\t input.step_linked.push(step);\n\t }\n\t });\n\t });\n\t });\n\t\n\t // identify and configure workflow parameters\n\t var wp_count = 0;\n\t this.wp_inputs = {};\n\t function _handleWorkflowParameter(value, callback) {\n\t var re = /\\$\\{(.+?)\\}/g,\n\t match;\n\t while (match = re.exec(String(value))) {\n\t var wp_name = match[1];\n\t callback(self.wp_inputs[wp_name] = self.wp_inputs[wp_name] || {\n\t label: wp_name,\n\t name: wp_name,\n\t type: 'text',\n\t color: 'hsl( ' + ++wp_count * 100 + ', 70%, 30% )',\n\t style: 'ui-form-wp-source',\n\t links: []\n\t });\n\t }\n\t }\n\t _.each(this.steps, function (step, i) {\n\t _.each(self.parms[i], function (input, name) {\n\t _handleWorkflowParameter(input.value, function (wp_input) {\n\t wp_input.links.push(step);\n\t input.wp_linked = true;\n\t input.type = 'text';\n\t input.backdrop = true;\n\t input.style = 'ui-form-wp-target';\n\t });\n\t });\n\t _.each(step.post_job_actions, function (pja) {\n\t _.each(pja.action_arguments, function (arg) {\n\t _handleWorkflowParameter(arg, function () {});\n\t });\n\t });\n\t });\n\t\n\t // select fields are shown for dynamic fields if all putative data inputs are available,\n\t // or if an explicit reference is specified as data_ref and available\n\t _.each(this.steps, function (step, i) {\n\t if (step.step_type == 'tool') {\n\t var data_resolved = true;\n\t FormData.visitInputs(step.inputs, function (input, name, context) {\n\t var is_runtime_value = input.value && input.value.__class__ == 'RuntimeValue';\n\t var is_data_input = ['data', 'data_collection'].indexOf(input.type) != -1;\n\t var data_ref = context[input.data_ref];\n\t input.step_linked && !self._isDataStep(input.step_linked) && (data_resolved = false);\n\t input.options && (input.options.length == 0 && !data_resolved || input.wp_linked) && (input.is_workflow = true);\n\t data_ref && (input.is_workflow = data_ref.step_linked && !self._isDataStep(data_ref.step_linked) || input.wp_linked);\n\t (is_data_input || input.value && input.value.__class__ == 'RuntimeValue' && !input.step_linked) && (step.collapsed = false);\n\t is_runtime_value && (input.value = input.default_value);\n\t input.flavor = 'workflow';\n\t if (!is_runtime_value && !is_data_input && input.type !== 'hidden' && !input.wp_linked) {\n\t if (input.optional || !Utils.isEmpty(input.value) && input.value !== '') {\n\t input.collapsible_value = input.value;\n\t input.collapsible_preview = true;\n\t }\n\t }\n\t });\n\t }\n\t });\n\t },\n\t\n\t render: function () {\n\t var self = this;\n\t this.deferred.reset();\n\t this._renderHeader();\n\t this._renderMessage();\n\t this._renderParameters();\n\t this._renderHistory();\n\t _.each(this.steps, function (step) {\n\t self._renderStep(step);\n\t });\n\t },\n\t\n\t /** Render header */\n\t _renderHeader: function () {\n\t var self = this;\n\t this.execute_btn = new Ui.Button({\n\t icon: 'fa-check',\n\t title: 'Run workflow',\n\t cls: 'btn btn-primary',\n\t onclick: function () {\n\t self._execute();\n\t }\n\t });\n\t this.$header.addClass('ui-form-header').empty().append(new Ui.Label({ title: 'Workflow: ' + this.model.get('name') }).$el).append(this.execute_btn.$el);\n\t },\n\t\n\t /** Render message */\n\t _renderMessage: function () {\n\t this.$message.empty();\n\t if (this.model.get('has_upgrade_messages')) {\n\t this.$message.append(new Ui.Message({\n\t message: 'Some tools in this workflow may have changed since it was last saved or some errors were found. The workflow may still run, but any new options will have default values. Please review the messages below to make a decision about whether the changes will affect your analysis.',\n\t status: 'warning',\n\t persistent: true,\n\t fade: false\n\t }).$el);\n\t }\n\t var step_version_changes = this.model.get('step_version_changes');\n\t if (step_version_changes && step_version_changes.length > 0) {\n\t this.$message.append(new Ui.Message({\n\t message: 'Some tools are being executed with different versions compared to those available when this workflow was last saved because the other versions are not or no longer available on this Galaxy instance. To upgrade your workflow and dismiss this message simply edit the workflow and re-save it.',\n\t status: 'warning',\n\t persistent: true,\n\t fade: false\n\t }).$el);\n\t }\n\t },\n\t\n\t /** Render workflow parameters */\n\t _renderParameters: function () {\n\t var self = this;\n\t this.wp_form = null;\n\t if (!_.isEmpty(this.wp_inputs)) {\n\t this.wp_form = new Form({ title: 'Workflow Parameters', inputs: this.wp_inputs, cls: 'ui-portlet-narrow', onchange: function () {\n\t _.each(self.wp_form.input_list, function (input_def, i) {\n\t _.each(input_def.links, function (step) {\n\t self._refreshStep(step);\n\t });\n\t });\n\t }\n\t });\n\t this._append(this.$steps.empty(), this.wp_form.$el);\n\t }\n\t },\n\t\n\t /** Render workflow parameters */\n\t _renderHistory: function () {\n\t this.history_form = new Form({\n\t cls: 'ui-portlet-narrow',\n\t title: 'History Options',\n\t inputs: [{\n\t type: 'conditional',\n\t name: 'new_history',\n\t test_param: {\n\t name: 'check',\n\t label: 'Send results to a new history',\n\t type: 'boolean',\n\t value: 'false',\n\t help: ''\n\t },\n\t cases: [{\n\t value: 'true',\n\t inputs: [{\n\t name: 'name',\n\t label: 'History name',\n\t type: 'text',\n\t value: this.model.get('name')\n\t }]\n\t }]\n\t }]\n\t });\n\t this._append(this.$steps, this.history_form.$el);\n\t },\n\t\n\t /** Render step */\n\t _renderStep: function (step) {\n\t var self = this;\n\t var form = null;\n\t this.deferred.execute(function (promise) {\n\t self.$steps.addClass('ui-steps');\n\t if (step.step_type == 'tool') {\n\t step.postchange = function (process, form) {\n\t var self = this;\n\t var current_state = {\n\t tool_id: step.id,\n\t tool_version: step.version,\n\t inputs: $.extend(true, {}, form.data.create())\n\t };\n\t form.wait(true);\n\t Galaxy.emit.debug('tool-form-composite::postchange()', 'Sending current state.', current_state);\n\t Utils.request({\n\t type: 'POST',\n\t url: Galaxy.root + 'api/tools/' + step.id + '/build',\n\t data: current_state,\n\t success: function (data) {\n\t form.update(data);\n\t form.wait(false);\n\t Galaxy.emit.debug('tool-form-composite::postchange()', 'Received new model.', data);\n\t process.resolve();\n\t },\n\t error: function (response) {\n\t Galaxy.emit.debug('tool-form-composite::postchange()', 'Refresh request failed.', response);\n\t process.reject();\n\t }\n\t });\n\t };\n\t form = new ToolFormBase(step);\n\t if (step.post_job_actions && step.post_job_actions.length) {\n\t form.portlet.append($('
                                              ').addClass('ui-form-element-disabled').append($('
                                              ').addClass('ui-form-title').html('Job Post Actions')).append($('
                                              ').addClass('ui-form-preview').html(_.reduce(step.post_job_actions, function (memo, value) {\n\t return memo + ' ' + value.short_str;\n\t }, ''))));\n\t }\n\t } else {\n\t var is_simple_input = ['data_input', 'data_collection_input'].indexOf(step.step_type) != -1;\n\t _.each(step.inputs, function (input) {\n\t input.flavor = 'module';input.hide_label = is_simple_input;\n\t });\n\t form = new Form(Utils.merge({\n\t title: step.fixed_title,\n\t onchange: function () {\n\t _.each(self.links[step.index], function (link) {\n\t self._refreshStep(link);\n\t });\n\t },\n\t inputs: step.inputs && step.inputs.length > 0 ? step.inputs : [{ type: 'hidden', name: 'No options available.', ignore: null }]\n\t }, step));\n\t }\n\t self.forms[step.index] = form;\n\t self._append(self.$steps, form.$el);\n\t self._refresh();\n\t step.needs_refresh && self._refreshStep(step);\n\t form.portlet[!self.show_progress ? 'enable' : 'disable']();\n\t self.show_progress && self.execute_btn.model.set({ wait: true,\n\t wait_text: 'Preparing...',\n\t percentage: (step.index + 1) * 100.0 / self.steps.length });\n\t Galaxy.emit.debug('tool-form-composite::initialize()', step.index + ' : Workflow step state ready.', step);\n\t setTimeout(function () {\n\t promise.resolve();\n\t }, 0);\n\t });\n\t },\n\t\n\t /** Refreshes step values from source step values */\n\t _refreshStep: function (step) {\n\t var self = this;\n\t var form = this.forms[step.index];\n\t if (form) {\n\t _.each(self.parms[step.index], function (input, name) {\n\t if (input.step_linked || input.wp_linked) {\n\t var field = form.field_list[form.data.match(name)];\n\t if (field) {\n\t var new_value = undefined;\n\t if (input.step_linked) {\n\t new_value = { values: [] };\n\t _.each(input.step_linked, function (source_step) {\n\t if (self._isDataStep(source_step)) {\n\t var value = self.forms[source_step.index].data.create().input;\n\t value && _.each(value.values, function (v) {\n\t new_value.values.push(v);\n\t });\n\t }\n\t });\n\t if (!input.multiple && new_value.values.length > 0) {\n\t new_value = { values: [new_value.values[0]] };\n\t }\n\t } else if (input.wp_linked) {\n\t new_value = input.value;\n\t var re = /\\$\\{(.+?)\\}/g,\n\t match;\n\t while (match = re.exec(input.value)) {\n\t var wp_field = self.wp_form.field_list[self.wp_form.data.match(match[1])];\n\t var wp_value = wp_field && wp_field.value();\n\t if (wp_value) {\n\t new_value = new_value.split(match[0]).join(wp_value);\n\t }\n\t }\n\t }\n\t if (new_value !== undefined) {\n\t field.value(new_value);\n\t }\n\t }\n\t }\n\t });\n\t form.trigger('change');\n\t } else {\n\t step.needs_refresh = true;\n\t }\n\t },\n\t\n\t /** Refresh the history after job submission while form is shown */\n\t _refreshHistory: function () {\n\t var self = this;\n\t var history = parent.Galaxy && parent.Galaxy.currHistoryPanel && parent.Galaxy.currHistoryPanel.model;\n\t this._refresh_history && clearTimeout(this._refresh_history);\n\t if (history) {\n\t history.refresh().success(function () {\n\t if (history.numOfUnfinishedShownContents() === 0) {\n\t self._refresh_history = setTimeout(function () {\n\t self._refreshHistory();\n\t }, history.UPDATE_DELAY);\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** Build remaining steps */\n\t _execute: function () {\n\t var self = this;\n\t this.show_progress = true;\n\t this._enabled(false);\n\t this.deferred.execute(function (promise) {\n\t setTimeout(function () {\n\t promise.resolve();self._submit();\n\t }, 0);\n\t });\n\t },\n\t\n\t /** Validate and submit workflow */\n\t _submit: function () {\n\t var self = this;\n\t var history_form_data = this.history_form.data.create();\n\t var job_def = {\n\t new_history_name: history_form_data['new_history|name'] ? history_form_data['new_history|name'] : null,\n\t history_id: !history_form_data['new_history|name'] ? this.model.get('history_id') : null,\n\t replacement_params: this.wp_form ? this.wp_form.data.create() : {},\n\t parameters: {},\n\t // Tool form will submit flat maps for each parameter\n\t // (e.g. \"repeat_0|cond|param\": \"foo\" instead of nested\n\t // data structures).\n\t parameters_normalized: true,\n\t // Tool form always wants a list of invocations back\n\t // so that inputs can be batched.\n\t batch: true\n\t };\n\t var validated = true;\n\t for (var i in this.forms) {\n\t var form = this.forms[i];\n\t var job_inputs = form.data.create();\n\t var step = self.steps[i];\n\t var step_index = step.step_index;\n\t form.trigger('reset');\n\t for (var job_input_id in job_inputs) {\n\t var input_value = job_inputs[job_input_id];\n\t var input_id = form.data.match(job_input_id);\n\t var input_field = form.field_list[input_id];\n\t var input_def = form.input_list[input_id];\n\t if (!input_def.step_linked) {\n\t if (this._isDataStep(step)) {\n\t validated = input_value && input_value.values && input_value.values.length > 0;\n\t } else {\n\t validated = input_def.optional || input_def.is_workflow && input_value !== '' || !input_def.is_workflow && input_value !== null;\n\t }\n\t if (!validated) {\n\t form.highlight(input_id);\n\t break;\n\t }\n\t job_def.parameters[step_index] = job_def.parameters[step_index] || {};\n\t job_def.parameters[step_index][job_input_id] = job_inputs[job_input_id];\n\t }\n\t }\n\t if (!validated) {\n\t break;\n\t }\n\t }\n\t if (!validated) {\n\t self._enabled(true);\n\t Galaxy.emit.debug('tool-form-composite::submit()', 'Validation failed.', job_def);\n\t } else {\n\t Galaxy.emit.debug('tool-form-composite::submit()', 'Validation complete.', job_def);\n\t Utils.request({\n\t type: 'POST',\n\t url: Galaxy.root + 'api/workflows/' + this.model.id + '/invocations',\n\t data: job_def,\n\t success: function (response) {\n\t Galaxy.emit.debug('tool-form-composite::submit', 'Submission successful.', response);\n\t self.$el.children().hide();\n\t self.$el.append(self._templateSuccess(response));\n\t\n\t // Show Webhook if job is running\n\t if ($.isArray(response) && response.length > 0) {\n\t self.$el.append($('
                                              ', { id: 'webhook-view' }));\n\t var WebhookApp = new Webhooks.WebhookView({\n\t urlRoot: Galaxy.root + 'api/webhooks/workflow',\n\t toolId: job_def.tool_id,\n\t toolVersion: job_def.tool_version\n\t });\n\t }\n\t\n\t self._refreshHistory();\n\t },\n\t error: function (response) {\n\t Galaxy.emit.debug('tool-form-composite::submit', 'Submission failed.', response);\n\t var input_found = false;\n\t if (response && response.err_data) {\n\t for (var i in self.forms) {\n\t var form = self.forms[i];\n\t var step_related_errors = response.err_data[form.model.get('step_index')];\n\t if (step_related_errors) {\n\t var error_messages = form.data.matchResponse(step_related_errors);\n\t for (var input_id in error_messages) {\n\t form.highlight(input_id, error_messages[input_id]);\n\t input_found = true;\n\t break;\n\t }\n\t }\n\t }\n\t }\n\t if (!input_found) {\n\t self.modal.show({\n\t title: 'Workflow submission failed',\n\t body: self._templateError(job_def, response && response.err_msg),\n\t buttons: {\n\t 'Close': function () {\n\t self.modal.hide();\n\t }\n\t }\n\t });\n\t }\n\t },\n\t complete: function () {\n\t self._enabled(true);\n\t }\n\t });\n\t }\n\t },\n\t\n\t /** Append new dom to body */\n\t _append: function ($container, $el) {\n\t $container.append('

                                              ').append($el);\n\t },\n\t\n\t /** Set enabled/disabled state */\n\t _enabled: function (enabled) {\n\t this.execute_btn.model.set({ wait: !enabled, wait_text: 'Sending...', percentage: -1 });\n\t this.wp_form && this.wp_form.portlet[enabled ? 'enable' : 'disable']();\n\t this.history_form && this.history_form.portlet[enabled ? 'enable' : 'disable']();\n\t _.each(this.forms, function (form) {\n\t form && form.portlet[enabled ? 'enable' : 'disable']();\n\t });\n\t },\n\t\n\t /** Is data input module/step */\n\t _isDataStep: function (steps) {\n\t var lst = $.isArray(steps) ? steps : [steps];\n\t for (var i = 0; i < lst.length; i++) {\n\t var step = lst[i];\n\t if (!step || !step.step_type || !step.step_type.startsWith('data')) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t },\n\t\n\t /** Templates */\n\t _templateSuccess: function (response) {\n\t if ($.isArray(response) && response.length > 0) {\n\t return $('

                                              ').addClass('donemessagelarge').append($('

                                              ').html('Successfully invoked workflow ' + Utils.sanitize(this.model.get('name')) + '' + (response.length > 1 ? ' ' + response.length + ' times' : '') + '.')).append($('

                                              ').append('').text('You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from \\'running\\' to \\'finished\\' if completed successfully or \\'error\\' if problems were encountered.'));\n\t } else {\n\t return this._templateError(response, 'Invalid success response. No invocations found.');\n\t }\n\t },\n\t\n\t _templateError: function (response, err_msg) {\n\t return $('

                                              ').addClass('errormessagelarge').append($('

                                              ').text('The server could not complete the request. Please contact the Galaxy Team if this error persists. ' + (JSON.stringify(err_msg) || ''))).append($('

                                              ').text(JSON.stringify(response, null, 4)));\n\t        }\n\t    });\n\t    return {\n\t        View: View\n\t    };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 93 */,\n/* 94 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (_l) {\n\t    'use strict';\n\t\n\t    //TODO: toastr is another possibility - I didn't see where I might add details, tho\n\t\n\t    /* ============================================================================\n\t    Error modals meant to replace the o-so-easy alerts.\n\t    \n\t    These are currently styled as errormessages but use the Galaxy.modal\n\t    infrastructure to be shown/closed. They're capable of showing details in a\n\t    togglable dropdown and the details are formatted in a pre.\n\t    \n\t    Example:\n\t        errorModal( 'Heres a message', 'A Title', { some_details: 'here' });\n\t        errorModal( 'Heres a message' ); // no details, title is 'Error'\n\t    \n\t    There are three specialized forms:\n\t        offlineErrorModal       a canned response for when there's no connection\n\t        badGatewayErrorModal    canned response for when Galaxy is restarting\n\t        ajaxErrorModal          plugable into any Backbone class as an\n\t            error event handler by accepting the error args: model, xhr, options\n\t    \n\t    Examples:\n\t        if( navigator.offLine ){ offlineErrorModal(); }\n\t        if( xhr.status === 502 ){ badGatewayErrorModal(); }\n\t        this.listenTo( this.model, 'error', ajaxErrorModal );\n\t    \n\t    ============================================================================ */\n\t\n\t    var CONTACT_MSG = _l('Please contact a Galaxy administrator if the problem persists.');\n\t    var DEFAULT_AJAX_ERR_MSG = _l('An error occurred while updating information with the server.');\n\t    var DETAILS_MSG = _l('The following information can assist the developers in finding the source of the error:');\n\t\n\t    /** private helper that builds the modal and handles adding details */\n\t    function _errorModal(message, title, details) {\n\t        // create and return the modal, adding details button only if needed\n\t        Galaxy.modal.show({\n\t            title: title,\n\t            body: message,\n\t            closing_events: true,\n\t            buttons: { Ok: function () {\n\t                    Galaxy.modal.hide();\n\t                } }\n\t        });\n\t        Galaxy.modal.$el.addClass('error-modal');\n\t\n\t        if (details) {\n\t            Galaxy.modal.$('.error-details').add(Galaxy.modal.$('button:contains(\"Details\")')).remove();\n\t            $('
                                              ').addClass('error-details').hide().appendTo(Galaxy.modal.$('.modal-content')).append([$('

                                              ').text(DETAILS_MSG), $('

                                              ').text(JSON.stringify(details, null, '  '))]);\n\t\n\t            $('').appendTo(Galaxy.modal.$('.buttons')).click(function () {\n\t                Galaxy.modal.$('.error-details').toggle();\n\t            });\n\t        }\n\t        return Galaxy.modal;\n\t    }\n\t\n\t    /** Display a modal showing an error message but fallback to alert if there's no modal */\n\t    function errorModal(message, title, details) {\n\t        if (!message) {\n\t            return;\n\t        }\n\t\n\t        message = _l(message);\n\t        title = _l(title) || _l('Error:');\n\t        if (window.Galaxy && Galaxy.modal) {\n\t            return _errorModal(message, title, details);\n\t        }\n\t\n\t        alert(title + '\\n\\n' + message);\n\t        console.log('error details:', JSON.stringify(details));\n\t    }\n\t\n\t    // ----------------------------------------------------------------------------\n\t    /** display a modal when the user may be offline */\n\t    function offlineErrorModal() {\n\t        return errorModal(_l('You appear to be offline. Please check your connection and try again.'), _l('Offline?'));\n\t    }\n\t\n\t    // ----------------------------------------------------------------------------\n\t    /** 502 messages that should be displayed when galaxy is restarting */\n\t    function badGatewayErrorModal() {\n\t        return errorModal(_l('Galaxy is currently unreachable. Please try again in a few minutes.') + ' ' + CONTACT_MSG, _l('Cannot connect to Galaxy'));\n\t    }\n\t\n\t    // ----------------------------------------------------------------------------\n\t    /** display a modal (with details) about a failed Backbone ajax operation */\n\t    function ajaxErrorModal(model, xhr, options, message, title) {\n\t        message = message || DEFAULT_AJAX_ERR_MSG;\n\t        message += ' ' + CONTACT_MSG;\n\t        title = title || _l('An error occurred');\n\t        var details = _ajaxDetails(model, xhr, options);\n\t        return errorModal(message, title, details);\n\t    }\n\t\n\t    /** build details which may help debugging the ajax call */\n\t    function _ajaxDetails(model, xhr, options) {\n\t        return {\n\t            //TODO: still can't manage Raven id\n\t            raven: _.result(window.Raven, 'lastEventId'),\n\t            userAgent: navigator.userAgent,\n\t            onLine: navigator.onLine,\n\t            version: _.result(Galaxy.config, 'version_major'),\n\t            xhr: _.omit(xhr, _.functions(xhr)),\n\t            options: _.omit(options, 'xhr'),\n\t            // add ajax data from Galaxy object cache\n\t            url: _.result(Galaxy.lastAjax, 'url'),\n\t            data: _.result(Galaxy.lastAjax, 'data'),\n\t            // backbone stuff (auto-redacting email for user)\n\t            model: _.result(model, 'toJSON', model + ''),\n\t            user: _.omit(_.result(Galaxy.user, 'toJSON'), 'email')\n\t        };\n\t    }\n\t\n\t    //=============================================================================\n\t    return {\n\t        errorModal: errorModal,\n\t        offlineErrorModal: offlineErrorModal,\n\t        badGatewayErrorModal: badGatewayErrorModal,\n\t        ajaxErrorModal: ajaxErrorModal\n\t    };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 95 */,\n/* 96 */,\n/* 97 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, $) {(function (factory) {\n\t    if (true) {\n\t        !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t    } else {\n\t        // Browser globals\n\t        factory(jQuery);\n\t    }\n\t})(function () {\n\t    //=============================================================================\n\t\n\t    jQuery.fn.extend({\n\t        hoverhighlight: function $hoverhighlight(scope, color) {\n\t            scope = scope || 'body';\n\t            if (!this.length) {\n\t                return this;\n\t            }\n\t\n\t            $(this).each(function () {\n\t                var $this = $(this),\n\t                    targetSelector = $this.data('target');\n\t\n\t                if (targetSelector) {\n\t                    $this.mouseover(function (ev) {\n\t                        $(targetSelector, scope).css({\n\t                            background: color\n\t                        });\n\t                    }).mouseout(function (ev) {\n\t                        $(targetSelector).css({\n\t                            background: ''\n\t                        });\n\t                    });\n\t                }\n\t            });\n\t            return this;\n\t        }\n\t    });\n\t});\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 98 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, jQuery) {// from: https://raw.githubusercontent.com/umdjs/umd/master/jqueryPlugin.js\n\t// Uses AMD or browser globals to create a jQuery plugin.\n\t(function (factory) {\n\t    if (true) {\n\t        //TODO: So...this turns out to be an all or nothing thing. If I load jQuery in the define below, it will\n\t        //  (of course) wipe the old jquery *and all the plugins loaded into it*. So the define below *is still\n\t        //  relying on jquery being loaded globally* in order to preserve plugins.\n\t        !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t    } else {\n\t        // Browser globals\n\t        factory(jQuery);\n\t    }\n\t})(function () {\n\t    var _l = window._l || function (s) {\n\t        return s;\n\t    };\n\t\n\t    //TODO: consolidate with tool menu functionality, use there\n\t\n\t    /** searchInput: (jQuery plugin)\n\t     *      Creates a search input, a clear button, and loading indicator\n\t     *      within the selected node.\n\t     *\n\t     *      When the user either presses return or enters some minimal number\n\t     *      of characters, a callback is called. Pressing ESC when the input\n\t     *      is focused will clear the input and call a separate callback.\n\t     */\n\t    function searchInput(parentNode, options) {\n\t        var KEYCODE_ESC = 27,\n\t            KEYCODE_RETURN = 13,\n\t            $parentNode = $(parentNode),\n\t            firstSearch = true,\n\t            defaults = {\n\t            initialVal: '',\n\t            name: 'search',\n\t            placeholder: 'search',\n\t            classes: '',\n\t            onclear: function () {},\n\t            onfirstsearch: null,\n\t            onsearch: function (inputVal) {},\n\t            minSearchLen: 0,\n\t            escWillClear: true,\n\t            oninit: function () {}\n\t        };\n\t\n\t        // .................................................................... input rendering and events\n\t        // visually clear the search, trigger an event, and call the callback\n\t        function clearSearchInput(event) {\n\t            var $input = $(this).parent().children('input');\n\t            $input.val('').trigger('searchInput.clear').blur();\n\t            options.onclear();\n\t        }\n\t\n\t        // search for searchTerms, trigger an event, call the appropo callback (based on whether this is the first)\n\t        function search(event, searchTerms) {\n\t            if (!searchTerms) {\n\t                return clearSearchInput();\n\t            }\n\t            $(this).trigger('search.search', searchTerms);\n\t            if (typeof options.onfirstsearch === 'function' && firstSearch) {\n\t                firstSearch = false;\n\t                options.onfirstsearch(searchTerms);\n\t            } else {\n\t                options.onsearch(searchTerms);\n\t            }\n\t        }\n\t\n\t        // .................................................................... input rendering and events\n\t        function inputTemplate() {\n\t            // class search-query is bootstrap 2.3 style that now lives in base.less\n\t            return [''].join('');\n\t        }\n\t\n\t        // the search input that responds to keyboard events and displays the search value\n\t        function $input() {\n\t            return $(inputTemplate())\n\t            // select all text on a focus\n\t            .focus(function (event) {\n\t                $(this).select();\n\t            })\n\t            // attach behaviors to esc, return if desired, search on some min len string\n\t            .keyup(function (event) {\n\t                event.preventDefault();\n\t                event.stopPropagation();\n\t\n\t                // esc key will clear if desired\n\t                if (event.which === KEYCODE_ESC && options.escWillClear) {\n\t                    clearSearchInput.call(this, event);\n\t                } else {\n\t                    var searchTerms = $(this).val();\n\t                    // return key or the search string len > minSearchLen (if not 0) triggers search\n\t                    if (event.which === KEYCODE_RETURN || options.minSearchLen && searchTerms.length >= options.minSearchLen) {\n\t                        search.call(this, event, searchTerms);\n\t                    }\n\t                }\n\t            }).val(options.initialVal);\n\t        }\n\t\n\t        // .................................................................... clear button rendering and events\n\t        // a button for clearing the search bar, placed on the right hand side\n\t        function $clearBtn() {\n\t            return $([''].join('')).tooltip({ placement: 'bottom' }).click(function (event) {\n\t                clearSearchInput.call(this, event);\n\t            });\n\t        }\n\t\n\t        // .................................................................... loadingIndicator rendering\n\t        // a button for clearing the search bar, placed on the right hand side\n\t        function $loadingIndicator() {\n\t            return $([''].join('')).hide().tooltip({ placement: 'bottom' });\n\t        }\n\t\n\t        // .................................................................... commands\n\t        // visually swap the load, clear buttons\n\t        function toggleLoadingIndicator() {\n\t            $parentNode.find('.search-loading').toggle();\n\t            $parentNode.find('.search-clear').toggle();\n\t        }\n\t\n\t        // .................................................................... init\n\t        // string command (not constructor)\n\t        if (jQuery.type(options) === 'string') {\n\t            if (options === 'toggle-loading') {\n\t                toggleLoadingIndicator();\n\t            }\n\t            return $parentNode;\n\t        }\n\t\n\t        // initial render\n\t        if (jQuery.type(options) === 'object') {\n\t            options = jQuery.extend(true, {}, defaults, options);\n\t        }\n\t        //NOTE: prepended\n\t        return $parentNode.addClass('search-input').prepend([$input(), $clearBtn(), $loadingIndicator()]);\n\t    }\n\t\n\t    // as jq plugin\n\t    jQuery.fn.extend({\n\t        searchInput: function $searchInput(options) {\n\t            return this.each(function () {\n\t                return searchInput(this, options);\n\t            });\n\t        }\n\t    });\n\t});\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 99 */,\n/* 100 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t    // Alphanumeric/natural sort fn\n\t    function naturalSort(a, b) {\n\t        // setup temp-scope variables for comparison evauluation\n\t        var re = /(-?[0-9\\.]+)/g,\n\t            x = a.toString().toLowerCase() || '',\n\t            y = b.toString().toLowerCase() || '',\n\t            nC = String.fromCharCode(0),\n\t            xN = x.replace(re, nC + '$1' + nC).split(nC),\n\t            yN = y.replace(re, nC + '$1' + nC).split(nC),\n\t            xD = new Date(x).getTime(),\n\t            yD = xD ? new Date(y).getTime() : null;\n\t        // natural sorting of dates\n\t        if (yD) {\n\t            if (xD < yD) {\n\t                return -1;\n\t            } else if (xD > yD) {\n\t                return 1;\n\t            }\n\t        }\n\t        // natural sorting through split numeric strings and default strings\n\t        var oFxNcL, oFyNcL;\n\t        for (var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {\n\t            oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];\n\t            oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];\n\t            if (oFxNcL < oFyNcL) {\n\t                return -1;\n\t            } else if (oFxNcL > oFyNcL) {\n\t                return 1;\n\t            }\n\t        }\n\t        return 0;\n\t    }\n\t\n\t    return naturalSort;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ },\n/* 101 */,\n/* 102 */,\n/* 103 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Backbone) {var Ui = __webpack_require__(5),\n\t    historyOptionsMenu = __webpack_require__(135);\n\tCurrentHistoryView = __webpack_require__(132).CurrentHistoryView, _l = __webpack_require__(6);\n\t\n\t/** the right hand panel in the analysis page that shows the current history */\n\tvar HistoryPanel = Backbone.View.extend({\n\t\n\t    initialize: function (page, options) {\n\t        var self = this;\n\t        this.userIsAnonymous = Galaxy.user.isAnonymous();\n\t        this.allow_user_dataset_purge = options.config.allow_user_dataset_purge;\n\t        this.root = options.root;\n\t\n\t        // view of the current history\n\t        this.historyView = new CurrentHistoryView({\n\t            className: CurrentHistoryView.prototype.className + ' middle',\n\t            purgeAllowed: this.allow_user_dataset_purge,\n\t            linkTarget: 'galaxy_main'\n\t        });\n\t\n\t        // add history panel to Galaxy object\n\t        Galaxy.currHistoryPanel = this.historyView;\n\t        Galaxy.currHistoryPanel.listenToGalaxy(Galaxy);\n\t\n\t        // build buttons\n\t        this.buttonRefresh = new Ui.ButtonLink({\n\t            id: 'history-refresh-button',\n\t            title: 'Refresh history',\n\t            cls: 'panel-header-button',\n\t            icon: 'fa fa-refresh',\n\t            onclick: function () {\n\t                self.historyView.loadCurrentHistory();\n\t            }\n\t        });\n\t        this.buttonOptions = new Ui.ButtonLink({\n\t            id: 'history-options-button',\n\t            title: 'History options',\n\t            cls: 'panel-header-button',\n\t            target: 'galaxy_main',\n\t            icon: 'fa fa-cog',\n\t            href: this.root + 'root/history_options'\n\t        });\n\t        this.buttonViewMulti = new Ui.ButtonLink({\n\t            id: 'history-view-multi-button',\n\t            title: 'View all histories',\n\t            cls: 'panel-header-button',\n\t            icon: 'fa fa-columns',\n\t            href: this.root + 'history/view_multiple'\n\t        });\n\t\n\t        // define components\n\t        this.model = new Backbone.Model({\n\t            cls: 'history-right-panel',\n\t            title: _l('History'),\n\t            buttons: [this.buttonRefresh, this.buttonOptions, this.buttonViewMulti]\n\t        });\n\t\n\t        // build body template and connect history view\n\t        this.setElement(this._template());\n\t        this.historyView.setElement(this.$el);\n\t        this.historyView.connectToQuotaMeter(Galaxy.quotaMeter);\n\t        this.historyView.loadCurrentHistory();\n\t\n\t        // fetch to update the quota meter adding 'current' for any anon-user's id\n\t        Galaxy.listenTo(this.historyView, 'history-size-change', function () {\n\t            Galaxy.user.fetch({ url: Galaxy.user.urlRoot() + '/' + (Galaxy.user.id || 'current') });\n\t        });\n\t    },\n\t\n\t    render: function () {\n\t        this.optionsMenu = historyOptionsMenu(this.buttonOptions.$el, {\n\t            anonymous: this.userIsAnonymous,\n\t            purgeAllowed: this.allow_user_dataset_purge,\n\t            root: this.root\n\t        });\n\t        this.buttonViewMulti.$el[!this.userIsAnonymous ? 'show' : 'hide']();\n\t    },\n\t\n\t    /** add history view div */\n\t    _template: function (data) {\n\t        return ['
                                              '].join('');\n\t },\n\t\n\t toString: function () {\n\t return 'historyPanel';\n\t }\n\t});\n\t\n\tmodule.exports = HistoryPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 104 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Backbone, _) {var Tools = __webpack_require__(68),\n\t Upload = __webpack_require__(143),\n\t _l = __webpack_require__(6),\n\t ToolForm = __webpack_require__(92);\n\t\n\tvar ToolPanel = Backbone.View.extend({\n\t initialize: function (page, options) {\n\t // access configuration options\n\t var config = options.config;\n\t this.root = options.root;\n\t\n\t /** @type {Object[]} descriptions of user's workflows to be shown in the tool menu */\n\t this.stored_workflow_menu_entries = config.stored_workflow_menu_entries || [];\n\t\n\t // create tool search, tool panel, and tool panel view.\n\t var tool_search = new Tools.ToolSearch({\n\t hidden: false\n\t });\n\t var tools = new Tools.ToolCollection(config.toolbox);\n\t this.tool_panel = new Tools.ToolPanel({\n\t tool_search: tool_search,\n\t tools: tools,\n\t layout: config.toolbox_in_panel\n\t });\n\t this.tool_panel_view = new Tools.ToolPanelView({ model: this.tool_panel });\n\t\n\t // add upload modal\n\t this.upload_button = new Upload({\n\t nginx_upload_path: config.nginx_upload_path,\n\t ftp_upload_site: config.ftp_upload_site,\n\t default_genome: config.default_genome,\n\t default_extension: config.default_extension\n\t });\n\t\n\t // add uploader button to Galaxy object\n\t Galaxy.upload = this.upload_button;\n\t\n\t // components for panel definition\n\t this.model = new Backbone.Model({\n\t title: _l('Tools'),\n\t buttons: [this.upload_button]\n\t });\n\t\n\t // build body template\n\t this.setElement(this._template());\n\t },\n\t\n\t render: function () {\n\t // if there are tools, render panel and display everything\n\t var self = this;\n\t if (this.tool_panel.get('layout').size() > 0) {\n\t this.$el.prepend(this.tool_panel_view.$el);\n\t this.tool_panel_view.render();\n\t }\n\t // build the dom for the workflow portion of the tool menu\n\t // add internal workflow list\n\t self.$('#internal-workflows').append(self._templateAllWorkflow({\n\t title: _l('All workflows'),\n\t href: 'workflow'\n\t }));\n\t _.each(this.stored_workflow_menu_entries, function (menu_entry) {\n\t self.$('#internal-workflows').append(self._templateWorkflowLink({\n\t title: menu_entry.stored_workflow.name,\n\t href: 'workflow/run?id=' + menu_entry.encoded_stored_workflow_id\n\t }));\n\t });\n\t },\n\t\n\t /** build a link to one tool */\n\t _templateTool: function (tool) {\n\t return [''].join('');\n\t },\n\t\n\t /** build a link to 'All Workflows' */\n\t _templateAllWorkflow: function (tool) {\n\t return ['
                                              ',\n\t // global\n\t '', tool.title, '', '
                                              '].join('');\n\t },\n\t\n\t /** build links to workflows in toolpanel */\n\t _templateWorkflowLink: function (wf) {\n\t return [''].join('');\n\t },\n\t\n\t /** override to include inital menu dom and workflow section */\n\t _template: function () {\n\t return ['
                                              ', '
                                              ', '
                                              ', '', _l('Search did not match any tools.'), '', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '', _l('Workflows'), '', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              '].join('');\n\t },\n\t\n\t toString: function () {\n\t return 'toolPanel';\n\t }\n\t});\n\t\n\tmodule.exports = ToolPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3)))\n\n/***/ },\n/* 105 */,\n/* 106 */,\n/* 107 */,\n/* 108 */,\n/* 109 */,\n/* 110 */,\n/* 111 */,\n/* 112 */,\n/* 113 */,\n/* 114 */,\n/* 115 */,\n/* 116 */,\n/* 117 */,\n/* 118 */,\n/* 119 */,\n/* 120 */,\n/* 121 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {/*\n\t * Toastr\n\t * Version 2.0.1\n\t * Copyright 2012 John Papa and Hans Fjällemark. \n\t * All Rights Reserved. \n\t * Use, reproduction, distribution, and modification of this code is subject to the terms and \n\t * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php\n\t *\n\t * Author: John Papa and Hans Fjällemark\n\t * Project: https://github.com/CodeSeven/toastr\n\t */\n\t;(function (define) {\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t\t\tvar $ = jQuery;\n\t\t\treturn function () {\n\t\t\t\tvar version = '2.0.1';\n\t\t\t\tvar $container;\n\t\t\t\tvar listener;\n\t\t\t\tvar toastId = 0;\n\t\t\t\tvar toastType = {\n\t\t\t\t\terror: 'error',\n\t\t\t\t\tinfo: 'info',\n\t\t\t\t\tsuccess: 'success',\n\t\t\t\t\twarning: 'warning'\n\t\t\t\t};\n\t\n\t\t\t\tvar toastr = {\n\t\t\t\t\tclear: clear,\n\t\t\t\t\terror: error,\n\t\t\t\t\tgetContainer: getContainer,\n\t\t\t\t\tinfo: info,\n\t\t\t\t\toptions: {},\n\t\t\t\t\tsubscribe: subscribe,\n\t\t\t\t\tsuccess: success,\n\t\t\t\t\tversion: version,\n\t\t\t\t\twarning: warning\n\t\t\t\t};\n\t\n\t\t\t\treturn toastr;\n\t\n\t\t\t\t//#region Accessible Methods\n\t\t\t\tfunction error(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.error,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.error,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction info(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.info,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.info,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction subscribe(callback) {\n\t\t\t\t\tlistener = callback;\n\t\t\t\t}\n\t\n\t\t\t\tfunction success(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.success,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.success,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction warning(message, title, optionsOverride) {\n\t\t\t\t\treturn notify({\n\t\t\t\t\t\ttype: toastType.warning,\n\t\t\t\t\t\ticonClass: getOptions().iconClasses.warning,\n\t\t\t\t\t\tmessage: message,\n\t\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\t\ttitle: title\n\t\t\t\t\t});\n\t\t\t\t}\n\t\n\t\t\t\tfunction clear($toastElement) {\n\t\t\t\t\tvar options = getOptions();\n\t\t\t\t\tif (!$container) {\n\t\t\t\t\t\tgetContainer(options);\n\t\t\t\t\t}\n\t\t\t\t\tif ($toastElement && $(':focus', $toastElement).length === 0) {\n\t\t\t\t\t\t$toastElement[options.hideMethod]({\n\t\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\t\tremoveToast($toastElement);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif ($container.children().length) {\n\t\t\t\t\t\t$container[options.hideMethod]({\n\t\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\t\t$container.remove();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//#endregion\n\t\n\t\t\t\t//#region Internal Methods\n\t\n\t\t\t\tfunction getDefaults() {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttapToDismiss: true,\n\t\t\t\t\t\ttoastClass: 'toast',\n\t\t\t\t\t\tcontainerId: 'toast-container',\n\t\t\t\t\t\tdebug: false,\n\t\n\t\t\t\t\t\tshowMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery\n\t\t\t\t\t\tshowDuration: 300,\n\t\t\t\t\t\tshowEasing: 'swing', //swing and linear are built into jQuery\n\t\t\t\t\t\tonShown: undefined,\n\t\t\t\t\t\thideMethod: 'fadeOut',\n\t\t\t\t\t\thideDuration: 1000,\n\t\t\t\t\t\thideEasing: 'swing',\n\t\t\t\t\t\tonHidden: undefined,\n\t\n\t\t\t\t\t\textendedTimeOut: 1000,\n\t\t\t\t\t\ticonClasses: {\n\t\t\t\t\t\t\terror: 'toast-error',\n\t\t\t\t\t\t\tinfo: 'toast-info',\n\t\t\t\t\t\t\tsuccess: 'toast-success',\n\t\t\t\t\t\t\twarning: 'toast-warning'\n\t\t\t\t\t\t},\n\t\t\t\t\t\ticonClass: 'toast-info',\n\t\t\t\t\t\tpositionClass: 'toast-top-right',\n\t\t\t\t\t\ttimeOut: 5000, // Set timeOut and extendedTimeout to 0 to make it sticky\n\t\t\t\t\t\ttitleClass: 'toast-title',\n\t\t\t\t\t\tmessageClass: 'toast-message',\n\t\t\t\t\t\ttarget: 'body',\n\t\t\t\t\t\tcloseHtml: '',\n\t\t\t\t\t\tnewestOnTop: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\n\t\t\t\tfunction publish(args) {\n\t\t\t\t\tif (!listener) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlistener(args);\n\t\t\t\t}\n\t\n\t\t\t\tfunction notify(map) {\n\t\t\t\t\tvar options = getOptions(),\n\t\t\t\t\t iconClass = map.iconClass || options.iconClass;\n\t\n\t\t\t\t\tif (typeof map.optionsOverride !== 'undefined') {\n\t\t\t\t\t\toptions = $.extend(options, map.optionsOverride);\n\t\t\t\t\t\ticonClass = map.optionsOverride.iconClass || iconClass;\n\t\t\t\t\t}\n\t\n\t\t\t\t\ttoastId++;\n\t\n\t\t\t\t\t$container = getContainer(options);\n\t\t\t\t\tvar intervalId = null,\n\t\t\t\t\t $toastElement = $('
                                              '),\n\t\t\t\t\t $titleElement = $('
                                              '),\n\t\t\t\t\t $messageElement = $('
                                              '),\n\t\t\t\t\t $closeElement = $(options.closeHtml),\n\t\t\t\t\t response = {\n\t\t\t\t\t\ttoastId: toastId,\n\t\t\t\t\t\tstate: 'visible',\n\t\t\t\t\t\tstartTime: new Date(),\n\t\t\t\t\t\toptions: options,\n\t\t\t\t\t\tmap: map\n\t\t\t\t\t};\n\t\n\t\t\t\t\tif (map.iconClass) {\n\t\t\t\t\t\t$toastElement.addClass(options.toastClass).addClass(iconClass);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (map.title) {\n\t\t\t\t\t\t$titleElement.append(map.title).addClass(options.titleClass);\n\t\t\t\t\t\t$toastElement.append($titleElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (map.message) {\n\t\t\t\t\t\t$messageElement.append(map.message).addClass(options.messageClass);\n\t\t\t\t\t\t$toastElement.append($messageElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (options.closeButton) {\n\t\t\t\t\t\t$closeElement.addClass('toast-close-button');\n\t\t\t\t\t\t$toastElement.prepend($closeElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$toastElement.hide();\n\t\t\t\t\tif (options.newestOnTop) {\n\t\t\t\t\t\t$container.prepend($toastElement);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$container.append($toastElement);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$toastElement[options.showMethod]({ duration: options.showDuration, easing: options.showEasing, complete: options.onShown });\n\t\t\t\t\tif (options.timeOut > 0) {\n\t\t\t\t\t\tintervalId = setTimeout(hideToast, options.timeOut);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$toastElement.hover(stickAround, delayedhideToast);\n\t\t\t\t\tif (!options.onclick && options.tapToDismiss) {\n\t\t\t\t\t\t$toastElement.click(hideToast);\n\t\t\t\t\t}\n\t\t\t\t\tif (options.closeButton && $closeElement) {\n\t\t\t\t\t\t$closeElement.click(function (event) {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\thideToast(true);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (options.onclick) {\n\t\t\t\t\t\t$toastElement.click(function () {\n\t\t\t\t\t\t\toptions.onclick();\n\t\t\t\t\t\t\thideToast();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\tpublish(response);\n\t\n\t\t\t\t\tif (options.debug && console) {\n\t\t\t\t\t\tconsole.log(response);\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn $toastElement;\n\t\n\t\t\t\t\tfunction hideToast(override) {\n\t\t\t\t\t\tif ($(':focus', $toastElement).length && !override) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn $toastElement[options.hideMethod]({\n\t\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\t\tremoveToast($toastElement);\n\t\t\t\t\t\t\t\tif (options.onHidden) {\n\t\t\t\t\t\t\t\t\toptions.onHidden();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tresponse.state = 'hidden';\n\t\t\t\t\t\t\t\tresponse.endTime = new Date(), publish(response);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\n\t\t\t\t\tfunction delayedhideToast() {\n\t\t\t\t\t\tif (options.timeOut > 0 || options.extendedTimeOut > 0) {\n\t\t\t\t\t\t\tintervalId = setTimeout(hideToast, options.extendedTimeOut);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\tfunction stickAround() {\n\t\t\t\t\t\tclearTimeout(intervalId);\n\t\t\t\t\t\t$toastElement.stop(true, true)[options.showMethod]({ duration: options.showDuration, easing: options.showEasing });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction getContainer(options) {\n\t\t\t\t\tif (!options) {\n\t\t\t\t\t\toptions = getOptions();\n\t\t\t\t\t}\n\t\t\t\t\t$container = $('#' + options.containerId);\n\t\t\t\t\tif ($container.length) {\n\t\t\t\t\t\treturn $container;\n\t\t\t\t\t}\n\t\t\t\t\t$container = $('
                                              ').attr('id', options.containerId).addClass(options.positionClass);\n\t\t\t\t\t$container.appendTo($(options.target));\n\t\t\t\t\treturn $container;\n\t\t\t\t}\n\t\n\t\t\t\tfunction getOptions() {\n\t\t\t\t\treturn $.extend({}, getDefaults(), toastr.options);\n\t\t\t\t}\n\t\n\t\t\t\tfunction removeToast($toastElement) {\n\t\t\t\t\tif (!$container) {\n\t\t\t\t\t\t$container = getContainer();\n\t\t\t\t\t}\n\t\t\t\t\tif ($toastElement.is(':visible')) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t$toastElement.remove();\n\t\t\t\t\t$toastElement = null;\n\t\t\t\t\tif ($container.children().length === 0) {\n\t\t\t\t\t\t$container.remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//#endregion\n\t\t\t}();\n\t\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t})(__webpack_require__(165));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 122 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery, _) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(58), __webpack_require__(84), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DC_LI, DATASET_LI_EDIT, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t //==============================================================================\n\t\n\t var DCListItemView = DC_LI.DCListItemView;\n\t /** @class Edit view for DatasetCollection.\n\t */\n\t var DCListItemEdit = DCListItemView.extend(\n\t /** @lends DCListItemEdit.prototype */{\n\t\n\t /** override to add linkTarget */\n\t initialize: function (attributes) {\n\t DCListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t var DCEListItemView = DC_LI.DCEListItemView;\n\t /** @class Read only view for DatasetCollectionElement.\n\t */\n\t var DCEListItemEdit = DCEListItemView.extend(\n\t /** @lends DCEListItemEdit.prototype */{\n\t //TODO: this might be expendable - compacted with HDAListItemView\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t DCEListItemView.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DCEListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t // NOTE: this does not inherit from DatasetDCEListItemView as you would expect\n\t //TODO: but should - if we can find something simpler than using diamond\n\t /** @class Editable view for a DatasetCollectionElement that is also an DatasetAssociation\n\t * (a dataset contained in a dataset collection).\n\t */\n\t var DatasetDCEListItemEdit = DATASET_LI_EDIT.DatasetListItemEdit.extend(\n\t /** @lends DatasetDCEListItemEdit.prototype */{\n\t\n\t /** set up */\n\t initialize: function (attributes) {\n\t DATASET_LI_EDIT.DatasetListItemEdit.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t // NOTE: this does not inherit from DatasetDCEListItemView - so we duplicate this here\n\t //TODO: fix\n\t /** In this override, only get details if in the ready state.\n\t * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n\t */\n\t _fetchModelDetails: function () {\n\t var view = this;\n\t if (view.model.inReadyState() && !view.model.hasDetails()) {\n\t return view.model.fetch({ silent: true });\n\t }\n\t return jQuery.when();\n\t },\n\t\n\t /** Override to remove delete button */\n\t _renderDeleteButton: function () {\n\t return null;\n\t },\n\t\n\t // ......................................................................... misc\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'DatasetDCEListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t // ............................................................................ TEMPLATES\n\t /** underscore templates */\n\t DatasetDCEListItemEdit.prototype.templates = function () {\n\t\n\t return _.extend({}, DATASET_LI_EDIT.DatasetListItemEdit.prototype.templates, {\n\t titleBar: DC_LI.DatasetDCEListItemView.prototype.templates.titleBar\n\t });\n\t }();\n\t\n\t //==============================================================================\n\t /** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\t var NestedDCDCEListItemEdit = DC_LI.NestedDCDCEListItemView.extend(\n\t /** @lends NestedDCDCEListItemEdit.prototype */{\n\t\n\t /** String representation */\n\t toString: function () {\n\t var modelString = this.model ? this.model + '' : '(no model)';\n\t return 'NestedDCDCEListItemEdit(' + modelString + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t DCListItemEdit: DCListItemEdit,\n\t DCEListItemEdit: DCEListItemEdit,\n\t DatasetDCEListItemEdit: DatasetDCEListItemEdit,\n\t NestedDCDCEListItemEdit: NestedDCDCEListItemEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 123 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(83), __webpack_require__(59), __webpack_require__(122), __webpack_require__(7), __webpack_require__(45), __webpack_require__(25), __webpack_require__(6), __webpack_require__(24)], __WEBPACK_AMD_DEFINE_RESULT__ = function (DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, TAGS, faIconButton, _l) {\n\t\n\t 'use strict';\n\t /* =============================================================================\n\t TODO:\n\t \n\t ============================================================================= */\n\t /** @class editable View/Controller for a dataset collection.\n\t */\n\t\n\t var _super = DC_VIEW.CollectionView;\n\t var CollectionViewEdit = _super.extend(\n\t /** @lends CollectionView.prototype */{\n\t //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n\t\n\t /** logger used to record this.log messages, commonly set to console */\n\t //logger : console,\n\t\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_EDIT.DatasetDCEListItemEdit,\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit,\n\t\n\t // ......................................................................... SET UP\n\t /** Set up the view, set up storage, bind listeners to HistoryContents events\n\t * @param {Object} attributes optional settings for the panel\n\t */\n\t initialize: function (attributes) {\n\t _super.prototype.initialize.call(this, attributes);\n\t },\n\t\n\t /** In this override, make the collection name editable\n\t */\n\t _setUpBehaviors: function ($where) {\n\t $where = $where || this.$el;\n\t _super.prototype._setUpBehaviors.call(this, $where);\n\t if (!this.model) {\n\t return;\n\t }\n\t\n\t // anon users shouldn't have access to any of the following\n\t if (!Galaxy.user || Galaxy.user.isAnonymous()) {\n\t return;\n\t }\n\t\n\t this.tagsEditorShown = true;\n\t\n\t //TODO: extract\n\t var panel = this,\n\t nameSelector = '> .controls .name';\n\t $where.find(nameSelector).attr('title', _l('Click to rename collection')).tooltip({ placement: 'bottom' }).make_text_editable({\n\t on_finish: function (newName) {\n\t var previousName = panel.model.get('name');\n\t if (newName && newName !== previousName) {\n\t panel.$el.find(nameSelector).text(newName);\n\t panel.model.save({ name: newName }).fail(function () {\n\t panel.$el.find(nameSelector).text(panel.model.previous('name'));\n\t });\n\t } else {\n\t panel.$el.find(nameSelector).text(previousName);\n\t }\n\t }\n\t });\n\t this.tagsEditor = new TAGS.TagsEditor({\n\t model: this.model,\n\t el: $where.find('.tags-display'),\n\t onshowFirstTime: function () {\n\t this.render();\n\t },\n\t usePrompt: false\n\t });\n\t this.tagsEditor.toggle(true);\n\t },\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'CollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class non-editable, read-only View/Controller for a dataset collection. */\n\t var ListCollectionViewEdit = CollectionViewEdit.extend(\n\t /** @lends ListCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for datasets */\n\t DatasetDCEViewClass: DC_EDIT.DatasetDCEListItemEdit,\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class Editable, read-only View/Controller for a dataset collection. */\n\t var PairCollectionViewEdit = ListCollectionViewEdit.extend(\n\t /** @lends PairCollectionViewEdit.prototype */{\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'PairCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class Editable (roughly since these collections are immutable),\n\t * View/Controller for a dataset collection.\n\t */\n\t var NestedPairCollectionViewEdit = PairCollectionViewEdit.extend(\n\t /** @lends NestedPairCollectionViewEdit.prototype */{\n\t\n\t /** Override to remove the editable text from the name/identifier - these collections are considered immutable */\n\t _setUpBehaviors: function ($where) {\n\t _super.prototype._setUpBehaviors.call(this, $where);\n\t },\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'NestedPairCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class editable, View/Controller for a list of pairs dataset collection. */\n\t var ListOfPairsCollectionViewEdit = CollectionViewEdit.extend(\n\t /** @lends ListOfPairsCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit.extend({\n\t foldoutPanelClass: NestedPairCollectionViewEdit\n\t }),\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfPairsCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t // =============================================================================\n\t /** @class View/Controller for a list of lists dataset collection. */\n\t var ListOfListsCollectionViewEdit = CollectionViewEdit.extend(\n\t /** @lends ListOfListsCollectionView.prototype */{\n\t\n\t //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n\t /** sub view class used for nested collections */\n\t NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit.extend({\n\t foldoutPanelClass: NestedPairCollectionViewEdit\n\t }),\n\t\n\t // ........................................................................ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'ListOfListsCollectionViewEdit(' + (this.model ? this.model.get('name') : '') + ')';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t return {\n\t CollectionViewEdit: CollectionViewEdit,\n\t ListCollectionViewEdit: ListCollectionViewEdit,\n\t PairCollectionViewEdit: PairCollectionViewEdit,\n\t ListOfPairsCollectionViewEdit: ListOfPairsCollectionViewEdit,\n\t ListOfListsCollectionViewEdit: ListOfListsCollectionViewEdit\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ },\n/* 124 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(156), __webpack_require__(100), __webpack_require__(82), __webpack_require__(7), __webpack_require__(6), __webpack_require__(97)], __WEBPACK_AMD_DEFINE_RESULT__ = function (levenshteinDistance, naturalSort, baseCreator, baseMVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t /* ============================================================================\n\t TODO:\n\t \n\t \n\t PROGRAMMATICALLY:\n\t currPanel.once( 'rendered', function(){\n\t currPanel.showSelectors();\n\t currPanel.selectAll();\n\t _.last( currPanel.actionsPopup.options ).func();\n\t });\n\t \n\t ============================================================================ */\n\t /** A view for paired datasets in the collections creator.\n\t */\n\t var PairView = Backbone.View.extend(baseMVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t tagName: 'li',\n\t className: 'dataset paired',\n\t\n\t initialize: function (attributes) {\n\t this.pair = attributes.pair || {};\n\t },\n\t\n\t template: _.template(['<%- pair.forward.name %>', '', '<%- pair.name %>', '', '<%- pair.reverse.name %>'].join('')),\n\t\n\t render: function () {\n\t this.$el.attr('draggable', true).data('pair', this.pair).html(this.template({ pair: this.pair })).addClass('flex-column-container');\n\t return this;\n\t },\n\t\n\t events: {\n\t 'dragstart': '_dragstart',\n\t 'dragend': '_dragend',\n\t 'dragover': '_sendToParent',\n\t 'drop': '_sendToParent'\n\t },\n\t\n\t /** dragging pairs for re-ordering */\n\t _dragstart: function (ev) {\n\t ev.currentTarget.style.opacity = '0.4';\n\t if (ev.originalEvent) {\n\t ev = ev.originalEvent;\n\t }\n\t\n\t ev.dataTransfer.effectAllowed = 'move';\n\t ev.dataTransfer.setData('text/plain', JSON.stringify(this.pair));\n\t\n\t this.$el.parent().trigger('pair.dragstart', [this]);\n\t },\n\t\n\t /** dragging pairs for re-ordering */\n\t _dragend: function (ev) {\n\t ev.currentTarget.style.opacity = '1.0';\n\t this.$el.parent().trigger('pair.dragend', [this]);\n\t },\n\t\n\t /** manually bubble up an event to the parent/container */\n\t _sendToParent: function (ev) {\n\t this.$el.parent().trigger(ev);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'PairView(' + this.pair.name + ')';\n\t }\n\t });\n\t\n\t // ============================================================================\n\t /** returns an autopair function that uses the provided options.match function */\n\t function autoPairFnBuilder(options) {\n\t options = options || {};\n\t options.createPair = options.createPair || function _defaultCreatePair(params) {\n\t params = params || {};\n\t var a = params.listA.splice(params.indexA, 1)[0],\n\t b = params.listB.splice(params.indexB, 1)[0],\n\t aInBIndex = params.listB.indexOf(a),\n\t bInAIndex = params.listA.indexOf(b);\n\t if (aInBIndex !== -1) {\n\t params.listB.splice(aInBIndex, 1);\n\t }\n\t if (bInAIndex !== -1) {\n\t params.listA.splice(bInAIndex, 1);\n\t }\n\t return this._pair(a, b, { silent: true });\n\t };\n\t // compile these here outside of the loop\n\t var _regexps = [];\n\t function getRegExps() {\n\t if (!_regexps.length) {\n\t _regexps = [new RegExp(this.filters[0]), new RegExp(this.filters[1])];\n\t }\n\t return _regexps;\n\t }\n\t // mangle params as needed\n\t options.preprocessMatch = options.preprocessMatch || function _defaultPreprocessMatch(params) {\n\t var regexps = getRegExps.call(this);\n\t return _.extend(params, {\n\t matchTo: params.matchTo.name.replace(regexps[0], ''),\n\t possible: params.possible.name.replace(regexps[1], '')\n\t });\n\t };\n\t\n\t return function _strategy(params) {\n\t this.debug('autopair _strategy ---------------------------');\n\t params = params || {};\n\t var listA = params.listA,\n\t listB = params.listB,\n\t indexA = 0,\n\t indexB,\n\t bestMatch = {\n\t score: 0.0,\n\t index: null\n\t },\n\t paired = [];\n\t //console.debug( 'params:', JSON.stringify( params, null, ' ' ) );\n\t this.debug('starting list lens:', listA.length, listB.length);\n\t this.debug('bestMatch (starting):', JSON.stringify(bestMatch, null, ' '));\n\t\n\t while (indexA < listA.length) {\n\t var matchTo = listA[indexA];\n\t bestMatch.score = 0.0;\n\t\n\t for (indexB = 0; indexB < listB.length; indexB++) {\n\t var possible = listB[indexB];\n\t this.debug(indexA + ':' + matchTo.name);\n\t this.debug(indexB + ':' + possible.name);\n\t\n\t // no matching with self\n\t if (listA[indexA] !== listB[indexB]) {\n\t bestMatch = options.match.call(this, options.preprocessMatch.call(this, {\n\t matchTo: matchTo,\n\t possible: possible,\n\t index: indexB,\n\t bestMatch: bestMatch\n\t }));\n\t this.debug('bestMatch:', JSON.stringify(bestMatch, null, ' '));\n\t if (bestMatch.score === 1.0) {\n\t this.debug('breaking early due to perfect match');\n\t break;\n\t }\n\t }\n\t }\n\t var scoreThreshold = options.scoreThreshold.call(this);\n\t this.debug('scoreThreshold:', scoreThreshold);\n\t this.debug('bestMatch.score:', bestMatch.score);\n\t\n\t if (bestMatch.score >= scoreThreshold) {\n\t //console.debug( 'autoPairFnBuilder.strategy', listA[ indexA ].name, listB[ bestMatch.index ].name );\n\t paired.push(options.createPair.call(this, {\n\t listA: listA,\n\t indexA: indexA,\n\t listB: listB,\n\t indexB: bestMatch.index\n\t }));\n\t //console.debug( 'list lens now:', listA.length, listB.length );\n\t } else {\n\t indexA += 1;\n\t }\n\t if (!listA.length || !listB.length) {\n\t return paired;\n\t }\n\t }\n\t this.debug('paired:', JSON.stringify(paired, null, ' '));\n\t this.debug('autopair _strategy ---------------------------');\n\t return paired;\n\t };\n\t }\n\t\n\t // ============================================================================\n\t /** An interface for building collections of paired datasets.\n\t */\n\t var PairedCollectionCreator = Backbone.View.extend(baseMVC.LoggableMixin).extend(baseCreator.CollectionCreatorMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t className: 'list-of-pairs-collection-creator collection-creator flex-row-container',\n\t\n\t /** set up initial options, instance vars, behaviors, and autopair (if set to do so) */\n\t initialize: function (attributes) {\n\t this.metric('PairedCollectionCreator.initialize', attributes);\n\t //this.debug( '-- PairedCollectionCreator:', attributes );\n\t\n\t attributes = _.defaults(attributes, {\n\t datasets: [],\n\t filters: this.DEFAULT_FILTERS,\n\t automaticallyPair: true,\n\t strategy: 'lcs',\n\t matchPercentage: 0.9,\n\t twoPassAutopairing: true\n\t });\n\t\n\t /** unordered, original list */\n\t this.initialList = attributes.datasets;\n\t\n\t /** is this from a history? if so, what's its id? */\n\t this.historyId = attributes.historyId;\n\t\n\t /** which filters should be used initially? (String[2] or name in commonFilters) */\n\t this.filters = this.commonFilters[attributes.filters] || this.commonFilters[this.DEFAULT_FILTERS];\n\t if (_.isArray(attributes.filters)) {\n\t this.filters = attributes.filters;\n\t }\n\t\n\t /** try to auto pair the unpaired datasets on load? */\n\t this.automaticallyPair = attributes.automaticallyPair;\n\t\n\t /** what method to use for auto pairing (will be passed aggression level) */\n\t this.strategy = this.strategies[attributes.strategy] || this.strategies[this.DEFAULT_STRATEGY];\n\t if (_.isFunction(attributes.strategy)) {\n\t this.strategy = attributes.strategy;\n\t }\n\t\n\t /** distance/mismatch level allowed for autopairing */\n\t this.matchPercentage = attributes.matchPercentage;\n\t\n\t /** try to autopair using simple first, then this.strategy on the remainder */\n\t this.twoPassAutopairing = attributes.twoPassAutopairing;\n\t\n\t /** remove file extensions (\\.*) from created pair names? */\n\t this.removeExtensions = true;\n\t //this.removeExtensions = false;\n\t\n\t /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n\t this.oncancel = attributes.oncancel;\n\t /** fn to call when the collection is created (scoped to this) */\n\t this.oncreate = attributes.oncreate;\n\t\n\t /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n\t this.autoscrollDist = attributes.autoscrollDist || 24;\n\t\n\t /** is the unpaired panel shown? */\n\t this.unpairedPanelHidden = false;\n\t /** is the paired panel shown? */\n\t this.pairedPanelHidden = false;\n\t\n\t /** DOM elements currently being dragged */\n\t this.$dragging = null;\n\t\n\t /** Used for blocking UI events during ajax/operations (don't post twice) */\n\t this.blocking = false;\n\t\n\t this._setUpCommonSettings(attributes);\n\t this._setUpBehaviors();\n\t this._dataSetUp();\n\t },\n\t\n\t /** map of common filter pairs by name */\n\t commonFilters: {\n\t illumina: ['_1', '_2'],\n\t Rs: ['_R1', '_R2']\n\t },\n\t /** which commonFilter to use by default */\n\t DEFAULT_FILTERS: 'illumina',\n\t\n\t /** map of name->fn for autopairing */\n\t strategies: {\n\t 'simple': 'autopairSimple',\n\t 'lcs': 'autopairLCS',\n\t 'levenshtein': 'autopairLevenshtein'\n\t },\n\t /** default autopair strategy name */\n\t DEFAULT_STRATEGY: 'lcs',\n\t\n\t // ------------------------------------------------------------------------ process raw list\n\t /** set up main data: cache initialList, sort, and autopair */\n\t _dataSetUp: function () {\n\t //this.debug( '-- _dataSetUp' );\n\t\n\t this.paired = [];\n\t this.unpaired = [];\n\t\n\t this.selectedIds = [];\n\t\n\t // sort initial list, add ids if needed, and save new working copy to unpaired\n\t this._sortInitialList();\n\t this._ensureIds();\n\t this.unpaired = this.initialList.slice(0);\n\t\n\t if (this.automaticallyPair) {\n\t this.autoPair();\n\t this.once('rendered:initial', function () {\n\t this.trigger('autopair');\n\t });\n\t }\n\t },\n\t\n\t /** sort initial list */\n\t _sortInitialList: function () {\n\t //this.debug( '-- _sortInitialList' );\n\t this._sortDatasetList(this.initialList);\n\t },\n\t\n\t /** sort a list of datasets */\n\t _sortDatasetList: function (list) {\n\t // currently only natural sort by name\n\t list.sort(function (a, b) {\n\t return naturalSort(a.name, b.name);\n\t });\n\t return list;\n\t },\n\t\n\t /** add ids to dataset objs in initial list if none */\n\t _ensureIds: function () {\n\t this.initialList.forEach(function (dataset) {\n\t if (!dataset.hasOwnProperty('id')) {\n\t dataset.id = _.uniqueId();\n\t }\n\t });\n\t return this.initialList;\n\t },\n\t\n\t /** split initial list into two lists, those that pass forward filters & those passing reverse */\n\t _splitByFilters: function () {\n\t var regexFilters = this.filters.map(function (stringFilter) {\n\t return new RegExp(stringFilter);\n\t }),\n\t split = [[], []];\n\t\n\t function _filter(unpaired, filter) {\n\t return filter.test(unpaired.name);\n\t //return dataset.name.indexOf( filter ) >= 0;\n\t }\n\t this.unpaired.forEach(function _filterEach(unpaired) {\n\t // 90% of the time this seems to work, but:\n\t //TODO: this treats *all* strings as regex which may confuse people - possibly check for // surrounding?\n\t // would need explanation in help as well\n\t regexFilters.forEach(function (filter, i) {\n\t if (_filter(unpaired, filter)) {\n\t split[i].push(unpaired);\n\t }\n\t });\n\t });\n\t return split;\n\t },\n\t\n\t /** add a dataset to the unpaired list in it's proper order */\n\t _addToUnpaired: function (dataset) {\n\t // currently, unpaired is natural sorted by name, use binary search to find insertion point\n\t var binSearchSortedIndex = function (low, hi) {\n\t if (low === hi) {\n\t return low;\n\t }\n\t\n\t var mid = Math.floor((hi - low) / 2) + low,\n\t compared = naturalSort(dataset.name, this.unpaired[mid].name);\n\t\n\t if (compared < 0) {\n\t return binSearchSortedIndex(low, mid);\n\t } else if (compared > 0) {\n\t return binSearchSortedIndex(mid + 1, hi);\n\t }\n\t // walk the equal to find the last\n\t while (this.unpaired[mid] && this.unpaired[mid].name === dataset.name) {\n\t mid++;\n\t }\n\t return mid;\n\t }.bind(this);\n\t\n\t this.unpaired.splice(binSearchSortedIndex(0, this.unpaired.length), 0, dataset);\n\t },\n\t\n\t // ------------------------------------------------------------------------ auto pairing\n\t /** two passes to automatically create pairs:\n\t * use both simpleAutoPair, then the fn mentioned in strategy\n\t */\n\t autoPair: function (strategy) {\n\t // split first using exact matching\n\t var split = this._splitByFilters(),\n\t paired = [];\n\t if (this.twoPassAutopairing) {\n\t paired = this.autopairSimple({\n\t listA: split[0],\n\t listB: split[1]\n\t });\n\t split = this._splitByFilters();\n\t }\n\t\n\t // uncomment to see printlns while running tests\n\t //this.debug = function(){ console.log.apply( console, arguments ); };\n\t\n\t // then try the remainder with something less strict\n\t strategy = strategy || this.strategy;\n\t split = this._splitByFilters();\n\t paired = paired.concat(this[strategy].call(this, {\n\t listA: split[0],\n\t listB: split[1]\n\t }));\n\t return paired;\n\t },\n\t\n\t /** autopair by exact match */\n\t autopairSimple: autoPairFnBuilder({\n\t scoreThreshold: function () {\n\t return 0.6;\n\t },\n\t match: function _match(params) {\n\t params = params || {};\n\t if (params.matchTo === params.possible) {\n\t return {\n\t index: params.index,\n\t score: 1.0\n\t };\n\t }\n\t return params.bestMatch;\n\t }\n\t }),\n\t\n\t /** autopair by levenshtein edit distance scoring */\n\t autopairLevenshtein: autoPairFnBuilder({\n\t scoreThreshold: function () {\n\t return this.matchPercentage;\n\t },\n\t match: function _matches(params) {\n\t params = params || {};\n\t var distance = levenshteinDistance(params.matchTo, params.possible),\n\t score = 1.0 - distance / Math.max(params.matchTo.length, params.possible.length);\n\t if (score > params.bestMatch.score) {\n\t return {\n\t index: params.index,\n\t score: score\n\t };\n\t }\n\t return params.bestMatch;\n\t }\n\t }),\n\t\n\t /** autopair by longest common substrings scoring */\n\t autopairLCS: autoPairFnBuilder({\n\t scoreThreshold: function () {\n\t return this.matchPercentage;\n\t },\n\t match: function _matches(params) {\n\t params = params || {};\n\t var match = this._naiveStartingAndEndingLCS(params.matchTo, params.possible).length,\n\t score = match / Math.max(params.matchTo.length, params.possible.length);\n\t if (score > params.bestMatch.score) {\n\t return {\n\t index: params.index,\n\t score: score\n\t };\n\t }\n\t return params.bestMatch;\n\t }\n\t }),\n\t\n\t /** return the concat'd longest common prefix and suffix from two strings */\n\t _naiveStartingAndEndingLCS: function (s1, s2) {\n\t var fwdLCS = '',\n\t revLCS = '',\n\t i = 0,\n\t j = 0;\n\t while (i < s1.length && i < s2.length) {\n\t if (s1[i] !== s2[i]) {\n\t break;\n\t }\n\t fwdLCS += s1[i];\n\t i += 1;\n\t }\n\t if (i === s1.length) {\n\t return s1;\n\t }\n\t if (i === s2.length) {\n\t return s2;\n\t }\n\t\n\t i = s1.length - 1;\n\t j = s2.length - 1;\n\t while (i >= 0 && j >= 0) {\n\t if (s1[i] !== s2[j]) {\n\t break;\n\t }\n\t revLCS = [s1[i], revLCS].join('');\n\t i -= 1;\n\t j -= 1;\n\t }\n\t return fwdLCS + revLCS;\n\t },\n\t\n\t // ------------------------------------------------------------------------ pairing / unpairing\n\t /** create a pair from fwd and rev, removing them from unpaired, and placing the new pair in paired */\n\t _pair: function (fwd, rev, options) {\n\t options = options || {};\n\t this.debug('_pair:', fwd, rev);\n\t var pair = this._createPair(fwd, rev, options.name);\n\t this.paired.push(pair);\n\t this.unpaired = _.without(this.unpaired, fwd, rev);\n\t if (!options.silent) {\n\t this.trigger('pair:new', pair);\n\t }\n\t return pair;\n\t },\n\t\n\t /** create a pair Object from fwd and rev, adding the name attribute (will guess if not given) */\n\t _createPair: function (fwd, rev, name) {\n\t // ensure existance and don't pair something with itself\n\t if (!(fwd && rev) || fwd === rev) {\n\t throw new Error('Bad pairing: ' + [JSON.stringify(fwd), JSON.stringify(rev)]);\n\t }\n\t name = name || this._guessNameForPair(fwd, rev);\n\t return { forward: fwd, name: name, reverse: rev };\n\t },\n\t\n\t /** try to find a good pair name for the given fwd and rev datasets */\n\t _guessNameForPair: function (fwd, rev, removeExtensions) {\n\t removeExtensions = removeExtensions !== undefined ? removeExtensions : this.removeExtensions;\n\t var fwdName = fwd.name,\n\t revName = rev.name,\n\t lcs = this._naiveStartingAndEndingLCS(fwdName.replace(new RegExp(this.filters[0]), ''), revName.replace(new RegExp(this.filters[1]), ''));\n\t if (removeExtensions) {\n\t var lastDotIndex = lcs.lastIndexOf('.');\n\t if (lastDotIndex > 0) {\n\t var extension = lcs.slice(lastDotIndex, lcs.length);\n\t lcs = lcs.replace(extension, '');\n\t fwdName = fwdName.replace(extension, '');\n\t revName = revName.replace(extension, '');\n\t }\n\t }\n\t return lcs || fwdName + ' & ' + revName;\n\t },\n\t\n\t /** unpair a pair, removing it from paired, and adding the fwd,rev datasets back into unpaired */\n\t _unpair: function (pair, options) {\n\t options = options || {};\n\t if (!pair) {\n\t throw new Error('Bad pair: ' + JSON.stringify(pair));\n\t }\n\t this.paired = _.without(this.paired, pair);\n\t this._addToUnpaired(pair.forward);\n\t this._addToUnpaired(pair.reverse);\n\t\n\t if (!options.silent) {\n\t this.trigger('pair:unpair', [pair]);\n\t }\n\t return pair;\n\t },\n\t\n\t /** unpair all paired datasets */\n\t unpairAll: function () {\n\t var pairs = [];\n\t while (this.paired.length) {\n\t pairs.push(this._unpair(this.paired[0], { silent: true }));\n\t }\n\t this.trigger('pair:unpair', pairs);\n\t },\n\t\n\t // ------------------------------------------------------------------------ API\n\t /** convert a pair into JSON compatible with the collections API */\n\t _pairToJSON: function (pair, src) {\n\t src = src || 'hda';\n\t //TODO: consider making this the pair structure when created instead\n\t return {\n\t collection_type: 'paired',\n\t src: 'new_collection',\n\t name: pair.name,\n\t element_identifiers: [{\n\t name: 'forward',\n\t id: pair.forward.id,\n\t src: src\n\t }, {\n\t name: 'reverse',\n\t id: pair.reverse.id,\n\t src: src\n\t }]\n\t };\n\t },\n\t\n\t /** create the collection via the API\n\t * @returns {jQuery.xhr Object} the jquery ajax request\n\t */\n\t createList: function (name) {\n\t var creator = this,\n\t url = Galaxy.root + 'api/histories/' + this.historyId + '/contents/dataset_collections';\n\t\n\t //TODO: use ListPairedCollection.create()\n\t var ajaxData = {\n\t type: 'dataset_collection',\n\t collection_type: 'list:paired',\n\t hide_source_items: creator.hideOriginals || false,\n\t name: _.escape(name || creator.$('.collection-name').val()),\n\t element_identifiers: creator.paired.map(function (pair) {\n\t return creator._pairToJSON(pair);\n\t })\n\t\n\t };\n\t //this.debug( JSON.stringify( ajaxData ) );\n\t creator.blocking = true;\n\t return jQuery.ajax(url, {\n\t type: 'POST',\n\t contentType: 'application/json',\n\t dataType: 'json',\n\t data: JSON.stringify(ajaxData)\n\t }).always(function () {\n\t creator.blocking = false;\n\t }).fail(function (xhr, status, message) {\n\t creator._ajaxErrHandler(xhr, status, message);\n\t }).done(function (response, message, xhr) {\n\t //this.info( 'ok', response, message, xhr );\n\t creator.trigger('collection:created', response, message, xhr);\n\t creator.metric('collection:created', response);\n\t if (typeof creator.oncreate === 'function') {\n\t creator.oncreate.call(this, response, message, xhr);\n\t }\n\t });\n\t },\n\t\n\t /** handle ajax errors with feedback and details to the user (if available) */\n\t _ajaxErrHandler: function (xhr, status, message) {\n\t this.error(xhr, status, message);\n\t var content = _l('An error occurred while creating this collection');\n\t if (xhr) {\n\t if (xhr.readyState === 0 && xhr.status === 0) {\n\t content += ': ' + _l('Galaxy could not be reached and may be updating.') + _l(' Try again in a few minutes.');\n\t } else if (xhr.responseJSON) {\n\t content += '
                                              ' + JSON.stringify(xhr.responseJSON) + '
                                              ';\n\t } else {\n\t content += ': ' + message;\n\t }\n\t }\n\t creator._showAlert(content, 'alert-danger');\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering\n\t /** render the entire interface */\n\t render: function (speed, callback) {\n\t //this.debug( '-- _render' );\n\t //this.$el.empty().html( this.templates.main() );\n\t this.$el.empty().html(this.templates.main());\n\t this._renderHeader(speed);\n\t this._renderMiddle(speed);\n\t this._renderFooter(speed);\n\t this._addPluginComponents();\n\t this.trigger('rendered', this);\n\t return this;\n\t },\n\t\n\t /** render the header section */\n\t _renderHeader: function (speed, callback) {\n\t //this.debug( '-- _renderHeader' );\n\t var $header = this.$('.header').empty().html(this.templates.header()).find('.help-content').prepend($(this.templates.helpContent()));\n\t\n\t this._renderFilters();\n\t return $header;\n\t },\n\t /** fill the filter inputs with the filter values */\n\t _renderFilters: function () {\n\t return this.$('.forward-column .column-header input').val(this.filters[0]).add(this.$('.reverse-column .column-header input').val(this.filters[1]));\n\t },\n\t\n\t /** render the middle including unpaired and paired sections (which may be hidden) */\n\t _renderMiddle: function (speed, callback) {\n\t var $middle = this.$('.middle').empty().html(this.templates.middle());\n\t\n\t // (re-) hide the un/paired panels based on instance vars\n\t if (this.unpairedPanelHidden) {\n\t this.$('.unpaired-columns').hide();\n\t } else if (this.pairedPanelHidden) {\n\t this.$('.paired-columns').hide();\n\t }\n\t\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t return $middle;\n\t },\n\t /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n\t _renderUnpaired: function (speed, callback) {\n\t //this.debug( '-- _renderUnpaired' );\n\t var creator = this,\n\t $fwd,\n\t $rev,\n\t $prd = [],\n\t split = this._splitByFilters();\n\t // update unpaired counts\n\t this.$('.forward-column .title').text([split[0].length, _l('unpaired forward')].join(' '));\n\t this.$('.forward-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[0].length));\n\t this.$('.reverse-column .title').text([split[1].length, _l('unpaired reverse')].join(' '));\n\t this.$('.reverse-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[1].length));\n\t\n\t this.$('.unpaired-columns .column-datasets').empty();\n\t\n\t // show/hide the auto pair button if any unpaired are left\n\t this.$('.autopair-link').toggle(this.unpaired.length !== 0);\n\t if (this.unpaired.length === 0) {\n\t this._renderUnpairedEmpty();\n\t return;\n\t }\n\t\n\t // create the dataset dom arrays\n\t $rev = split[1].map(function (dataset, i) {\n\t // if there'll be a fwd dataset across the way, add a button to pair the row\n\t if (split[0][i] !== undefined && split[0][i] !== dataset) {\n\t $prd.push(creator._renderPairButton());\n\t }\n\t return creator._renderUnpairedDataset(dataset);\n\t });\n\t $fwd = split[0].map(function (dataset) {\n\t return creator._renderUnpairedDataset(dataset);\n\t });\n\t\n\t if (!$fwd.length && !$rev.length) {\n\t this._renderUnpairedNotShown();\n\t return;\n\t }\n\t // add to appropo cols\n\t //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n\t // and swapping out that\n\t this.$('.unpaired-columns .forward-column .column-datasets').append($fwd).add(this.$('.unpaired-columns .paired-column .column-datasets').append($prd)).add(this.$('.unpaired-columns .reverse-column .column-datasets').append($rev));\n\t this._adjUnpairedOnScrollbar();\n\t },\n\t /** return a string to display the count of filtered out datasets */\n\t _renderUnpairedDisplayStr: function (numFiltered) {\n\t return ['(', numFiltered, ' ', _l('filtered out'), ')'].join('');\n\t },\n\t /** return an unattached jQuery DOM element to represent an unpaired dataset */\n\t _renderUnpairedDataset: function (dataset) {\n\t //TODO: to underscore template\n\t return $('
                                            • ').attr('id', 'dataset-' + dataset.id).addClass('dataset unpaired').attr('draggable', true).addClass(dataset.selected ? 'selected' : '').append($('').addClass('dataset-name').text(dataset.name))\n\t //??\n\t .data('dataset', dataset);\n\t },\n\t /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n\t _renderPairButton: function () {\n\t //TODO: *not* a dataset - don't pretend like it is\n\t return $('
                                            • ').addClass('dataset unpaired').append($('').addClass('dataset-name').text(_l('Pair these datasets')));\n\t },\n\t /** a message to display when no unpaired left */\n\t _renderUnpairedEmpty: function () {\n\t //this.debug( '-- renderUnpairedEmpty' );\n\t var $msg = $('
                                              ').text('(' + _l('no remaining unpaired datasets') + ')');\n\t this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n\t return $msg;\n\t },\n\t /** a message to display when no unpaired can be shown with the current filters */\n\t _renderUnpairedNotShown: function () {\n\t //this.debug( '-- renderUnpairedEmpty' );\n\t var $msg = $('
                                              ').text('(' + _l('no datasets were found matching the current filters') + ')');\n\t this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n\t return $msg;\n\t },\n\t /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n\t _adjUnpairedOnScrollbar: function () {\n\t var $unpairedColumns = this.$('.unpaired-columns').last(),\n\t $firstDataset = this.$('.unpaired-columns .reverse-column .dataset').first();\n\t if (!$firstDataset.length) {\n\t return;\n\t }\n\t var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n\t dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n\t rightDiff = Math.floor(ucRight) - Math.floor(dsRight);\n\t //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n\t this.$('.unpaired-columns .forward-column').css('margin-left', rightDiff > 0 ? rightDiff : 0);\n\t },\n\t\n\t /** render the paired section and update counts of paired datasets */\n\t _renderPaired: function (speed, callback) {\n\t //this.debug( '-- _renderPaired' );\n\t this.$('.paired-column-title .title').text([this.paired.length, _l('paired')].join(' '));\n\t // show/hide the unpair all link\n\t this.$('.unpair-all-link').toggle(this.paired.length !== 0);\n\t if (this.paired.length === 0) {\n\t this._renderPairedEmpty();\n\t return;\n\t //TODO: would be best to return here (the $columns)\n\t } else {\n\t // show/hide 'remove extensions link' when any paired and they seem to have extensions\n\t this.$('.remove-extensions-link').show();\n\t }\n\t\n\t this.$('.paired-columns .column-datasets').empty();\n\t var creator = this;\n\t this.paired.forEach(function (pair, i) {\n\t //TODO: cache these?\n\t var pairView = new PairView({ pair: pair });\n\t creator.$('.paired-columns .column-datasets').append(pairView.render().$el).append([''].join(''));\n\t });\n\t },\n\t /** a message to display when none paired */\n\t _renderPairedEmpty: function () {\n\t var $msg = $('
                                              ').text('(' + _l('no paired datasets yet') + ')');\n\t this.$('.paired-columns .column-datasets').empty().prepend($msg);\n\t return $msg;\n\t },\n\t\n\t footerSettings: {\n\t '.hide-originals': 'hideOriginals',\n\t '.remove-extensions': 'removeExtensions'\n\t },\n\t\n\t /** add any jQuery/bootstrap/custom plugins to elements rendered */\n\t _addPluginComponents: function () {\n\t this._chooseFiltersPopover('.choose-filters-link');\n\t this.$('.help-content i').hoverhighlight('.collection-creator', 'rgba( 64, 255, 255, 1.0 )');\n\t },\n\t\n\t /** build a filter selection popover allowing selection of common filter pairs */\n\t _chooseFiltersPopover: function (selector) {\n\t function filterChoice(val1, val2) {\n\t return [''].join('');\n\t }\n\t var $popoverContent = $(_.template(['
                                              ', '
                                              ', _l('Choose from the following filters to change which unpaired reads are shown in the display'), ':
                                              ', _.values(this.commonFilters).map(function (filterSet) {\n\t return filterChoice(filterSet[0], filterSet[1]);\n\t }).join(''), '
                                              '].join(''))({}));\n\t\n\t return this.$(selector).popover({\n\t container: '.collection-creator',\n\t placement: 'bottom',\n\t html: true,\n\t //animation : false,\n\t content: $popoverContent\n\t });\n\t },\n\t\n\t /** add (or clear if clear is truthy) a validation warning to what */\n\t _validationWarning: function (what, clear) {\n\t var VALIDATION_CLASS = 'validation-warning';\n\t if (what === 'name') {\n\t what = this.$('.collection-name').add(this.$('.collection-name-prompt'));\n\t this.$('.collection-name').focus().select();\n\t }\n\t if (clear) {\n\t what = what || this.$('.' + VALIDATION_CLASS);\n\t what.removeClass(VALIDATION_CLASS);\n\t } else {\n\t what.addClass(VALIDATION_CLASS);\n\t }\n\t },\n\t\n\t // ------------------------------------------------------------------------ events\n\t /** set up event handlers on self */\n\t _setUpBehaviors: function () {\n\t this.once('rendered', function () {\n\t this.trigger('rendered:initial', this);\n\t });\n\t\n\t this.on('pair:new', function () {\n\t //TODO: ideally only re-render the columns (or even elements) involved\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t\n\t // scroll to bottom where new pairs are added\n\t //TODO: this doesn't seem to work - innerHeight sticks at 133...\n\t // may have to do with improper flex columns\n\t //var $pairedView = this.$( '.paired-columns' );\n\t //$pairedView.scrollTop( $pairedView.innerHeight() );\n\t //this.debug( $pairedView.height() )\n\t this.$('.paired-columns').scrollTop(8000000);\n\t });\n\t this.on('pair:unpair', function (pairs) {\n\t //TODO: ideally only re-render the columns (or even elements) involved\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t this.splitView();\n\t });\n\t\n\t this.on('filter-change', function () {\n\t this.filters = [this.$('.forward-unpaired-filter input').val(), this.$('.reverse-unpaired-filter input').val()];\n\t this.metric('filter-change', this.filters);\n\t this._renderFilters();\n\t this._renderUnpaired();\n\t });\n\t\n\t this.on('autopair', function () {\n\t this._renderUnpaired();\n\t this._renderPaired();\n\t\n\t var message,\n\t msgClass = null;\n\t if (this.paired.length) {\n\t msgClass = 'alert-success';\n\t message = this.paired.length + ' ' + _l('pairs created');\n\t if (!this.unpaired.length) {\n\t message += ': ' + _l('all datasets have been successfully paired');\n\t this.hideUnpaired();\n\t this.$('.collection-name').focus();\n\t }\n\t } else {\n\t message = _l(['Could not automatically create any pairs from the given dataset names.', 'You may want to choose or enter different filters and try auto-pairing again.', 'Close this message using the X on the right to view more help.'].join(' '));\n\t }\n\t this._showAlert(message, msgClass);\n\t });\n\t\n\t //this.on( 'all', function(){\n\t // this.info( arguments );\n\t //});\n\t return this;\n\t },\n\t\n\t events: {\n\t // header\n\t 'click .more-help': '_clickMoreHelp',\n\t 'click .less-help': '_clickLessHelp',\n\t 'click .main-help': '_toggleHelp',\n\t 'click .header .alert button': '_hideAlert',\n\t 'click .forward-column .column-title': '_clickShowOnlyUnpaired',\n\t 'click .reverse-column .column-title': '_clickShowOnlyUnpaired',\n\t 'click .unpair-all-link': '_clickUnpairAll',\n\t //TODO: this seems kinda backasswards - re-sending jq event as a backbone event, can we listen directly?\n\t 'change .forward-unpaired-filter input': function (ev) {\n\t this.trigger('filter-change');\n\t },\n\t 'focus .forward-unpaired-filter input': function (ev) {\n\t $(ev.currentTarget).select();\n\t },\n\t 'click .autopair-link': '_clickAutopair',\n\t 'click .choose-filters .filter-choice': '_clickFilterChoice',\n\t 'click .clear-filters-link': '_clearFilters',\n\t 'change .reverse-unpaired-filter input': function (ev) {\n\t this.trigger('filter-change');\n\t },\n\t 'focus .reverse-unpaired-filter input': function (ev) {\n\t $(ev.currentTarget).select();\n\t },\n\t // unpaired\n\t 'click .forward-column .dataset.unpaired': '_clickUnpairedDataset',\n\t 'click .reverse-column .dataset.unpaired': '_clickUnpairedDataset',\n\t 'click .paired-column .dataset.unpaired': '_clickPairRow',\n\t 'click .unpaired-columns': 'clearSelectedUnpaired',\n\t 'mousedown .unpaired-columns .dataset': '_mousedownUnpaired',\n\t // divider\n\t 'click .paired-column-title': '_clickShowOnlyPaired',\n\t 'mousedown .flexible-partition-drag': '_startPartitionDrag',\n\t // paired\n\t 'click .paired-columns .dataset.paired': 'selectPair',\n\t 'click .paired-columns': 'clearSelectedPaired',\n\t 'click .paired-columns .pair-name': '_clickPairName',\n\t 'click .unpair-btn': '_clickUnpair',\n\t // paired - drop target\n\t //'dragenter .paired-columns' : '_dragenterPairedColumns',\n\t //'dragleave .paired-columns .column-datasets': '_dragleavePairedColumns',\n\t 'dragover .paired-columns .column-datasets': '_dragoverPairedColumns',\n\t 'drop .paired-columns .column-datasets': '_dropPairedColumns',\n\t\n\t 'pair.dragstart .paired-columns .column-datasets': '_pairDragstart',\n\t 'pair.dragend .paired-columns .column-datasets': '_pairDragend',\n\t\n\t // footer\n\t 'change .remove-extensions': function (ev) {\n\t this.toggleExtensions();\n\t },\n\t 'change .collection-name': '_changeName',\n\t 'keydown .collection-name': '_nameCheckForEnter',\n\t 'change .hide-originals': '_changeHideOriginals',\n\t 'click .cancel-create': '_cancelCreate',\n\t 'click .create-collection': '_clickCreate' //,\n\t },\n\t\n\t /** toggle between showing only unpaired and split view */\n\t _clickShowOnlyUnpaired: function (ev) {\n\t //this.debug( 'click unpaired', ev.currentTarget );\n\t if (this.$('.paired-columns').is(':visible')) {\n\t this.hidePaired();\n\t } else {\n\t this.splitView();\n\t }\n\t },\n\t /** toggle between showing only paired and split view */\n\t _clickShowOnlyPaired: function (ev) {\n\t //this.debug( 'click paired' );\n\t if (this.$('.unpaired-columns').is(':visible')) {\n\t this.hideUnpaired();\n\t } else {\n\t this.splitView();\n\t }\n\t },\n\t\n\t /** hide unpaired, show paired */\n\t hideUnpaired: function (speed, callback) {\n\t this.unpairedPanelHidden = true;\n\t this.pairedPanelHidden = false;\n\t this._renderMiddle(speed, callback);\n\t },\n\t /** hide paired, show unpaired */\n\t hidePaired: function (speed, callback) {\n\t this.unpairedPanelHidden = false;\n\t this.pairedPanelHidden = true;\n\t this._renderMiddle(speed, callback);\n\t },\n\t /** show both paired and unpaired (splitting evenly) */\n\t splitView: function (speed, callback) {\n\t this.unpairedPanelHidden = this.pairedPanelHidden = false;\n\t this._renderMiddle(speed, callback);\n\t return this;\n\t },\n\t\n\t /** unpair all paired and do other super neat stuff which I'm not really sure about yet... */\n\t _clickUnpairAll: function (ev) {\n\t this.metric('unpairAll');\n\t this.unpairAll();\n\t },\n\t\n\t /** attempt to autopair */\n\t _clickAutopair: function (ev) {\n\t var paired = this.autoPair();\n\t this.metric('autopair', paired.length, this.unpaired.length);\n\t this.trigger('autopair');\n\t },\n\t\n\t /** set the filters based on the data attributes of the button click target */\n\t _clickFilterChoice: function (ev) {\n\t var $selected = $(ev.currentTarget);\n\t this.$('.forward-unpaired-filter input').val($selected.data('forward'));\n\t this.$('.reverse-unpaired-filter input').val($selected.data('reverse'));\n\t this._hideChooseFilters();\n\t this.trigger('filter-change');\n\t },\n\t\n\t /** hide the choose filters popover */\n\t _hideChooseFilters: function () {\n\t //TODO: update bootstrap and remove the following hack\n\t // see also: https://github.com/twbs/bootstrap/issues/10260\n\t this.$('.choose-filters-link').popover('hide');\n\t this.$('.popover').css('display', 'none');\n\t },\n\t\n\t /** clear both filters */\n\t _clearFilters: function (ev) {\n\t this.$('.forward-unpaired-filter input').val('');\n\t this.$('.reverse-unpaired-filter input').val('');\n\t this.trigger('filter-change');\n\t },\n\t\n\t // ........................................................................ unpaired\n\t /** select an unpaired dataset */\n\t _clickUnpairedDataset: function (ev) {\n\t ev.stopPropagation();\n\t return this.toggleSelectUnpaired($(ev.currentTarget));\n\t },\n\t\n\t /** Toggle the selection of an unpaired dataset representation.\n\t * @param [jQuery] $dataset the unpaired dataset dom rep to select\n\t * @param [Boolean] options.force if defined, force selection based on T/F; otherwise, toggle\n\t */\n\t toggleSelectUnpaired: function ($dataset, options) {\n\t options = options || {};\n\t var dataset = $dataset.data('dataset'),\n\t select = options.force !== undefined ? options.force : !$dataset.hasClass('selected');\n\t //this.debug( id, options.force, $dataset, dataset );\n\t if (!$dataset.length || dataset === undefined) {\n\t return $dataset;\n\t }\n\t\n\t if (select) {\n\t $dataset.addClass('selected');\n\t if (!options.waitToPair) {\n\t this.pairAllSelected();\n\t }\n\t } else {\n\t $dataset.removeClass('selected');\n\t //delete dataset.selected;\n\t }\n\t return $dataset;\n\t },\n\t\n\t /** pair all the currently selected unpaired datasets */\n\t pairAllSelected: function (options) {\n\t options = options || {};\n\t var creator = this,\n\t fwds = [],\n\t revs = [],\n\t pairs = [];\n\t creator.$('.unpaired-columns .forward-column .dataset.selected').each(function () {\n\t fwds.push($(this).data('dataset'));\n\t });\n\t creator.$('.unpaired-columns .reverse-column .dataset.selected').each(function () {\n\t revs.push($(this).data('dataset'));\n\t });\n\t fwds.length = revs.length = Math.min(fwds.length, revs.length);\n\t //this.debug( fwds );\n\t //this.debug( revs );\n\t fwds.forEach(function (fwd, i) {\n\t try {\n\t pairs.push(creator._pair(fwd, revs[i], { silent: true }));\n\t } catch (err) {\n\t //TODO: preserve selected state of those that couldn't be paired\n\t //TODO: warn that some could not be paired\n\t creator.error(err);\n\t }\n\t });\n\t if (pairs.length && !options.silent) {\n\t this.trigger('pair:new', pairs);\n\t }\n\t return pairs;\n\t },\n\t\n\t /** clear the selection on all unpaired datasets */\n\t clearSelectedUnpaired: function () {\n\t this.$('.unpaired-columns .dataset.selected').removeClass('selected');\n\t },\n\t\n\t /** when holding down the shift key on a click, 'paint' the moused over datasets as selected */\n\t _mousedownUnpaired: function (ev) {\n\t if (ev.shiftKey) {\n\t var creator = this,\n\t $startTarget = $(ev.target).addClass('selected'),\n\t moveListener = function (ev) {\n\t creator.$(ev.target).filter('.dataset').addClass('selected');\n\t };\n\t $startTarget.parent().on('mousemove', moveListener);\n\t\n\t // on any mouseup, stop listening to the move and try to pair any selected\n\t $(document).one('mouseup', function (ev) {\n\t $startTarget.parent().off('mousemove', moveListener);\n\t creator.pairAllSelected();\n\t });\n\t }\n\t },\n\t\n\t /** attempt to pair two datasets directly across from one another */\n\t _clickPairRow: function (ev) {\n\t //if( !ev.currentTarget ){ return true; }\n\t var rowIndex = $(ev.currentTarget).index(),\n\t fwd = $('.unpaired-columns .forward-column .dataset').eq(rowIndex).data('dataset'),\n\t rev = $('.unpaired-columns .reverse-column .dataset').eq(rowIndex).data('dataset');\n\t //this.debug( 'row:', rowIndex, fwd, rev );\n\t this._pair(fwd, rev);\n\t },\n\t\n\t // ........................................................................ divider/partition\n\t /** start dragging the visible divider/partition between unpaired and paired panes */\n\t _startPartitionDrag: function (ev) {\n\t var creator = this,\n\t startingY = ev.pageY;\n\t //this.debug( 'partition drag START:', ev );\n\t $('body').css('cursor', 'ns-resize');\n\t creator.$('.flexible-partition-drag').css('color', 'black');\n\t\n\t function endDrag(ev) {\n\t //creator.debug( 'partition drag STOP:', ev );\n\t // doing this by an added class didn't really work well - kept flashing still\n\t creator.$('.flexible-partition-drag').css('color', '');\n\t $('body').css('cursor', '').unbind('mousemove', trackMouse);\n\t }\n\t function trackMouse(ev) {\n\t var offset = ev.pageY - startingY;\n\t //creator.debug( 'partition:', startingY, offset );\n\t if (!creator.adjPartition(offset)) {\n\t //creator.debug( 'mouseup triggered' );\n\t $('body').trigger('mouseup');\n\t }\n\t creator._adjUnpairedOnScrollbar();\n\t startingY += offset;\n\t }\n\t $('body').mousemove(trackMouse);\n\t $('body').one('mouseup', endDrag);\n\t },\n\t\n\t /** adjust the parition up/down +/-adj pixels */\n\t adjPartition: function (adj) {\n\t var $unpaired = this.$('.unpaired-columns'),\n\t $paired = this.$('.paired-columns'),\n\t unpairedHi = parseInt($unpaired.css('height'), 10),\n\t pairedHi = parseInt($paired.css('height'), 10);\n\t //this.debug( adj, 'hi\\'s:', unpairedHi, pairedHi, unpairedHi + adj, pairedHi - adj );\n\t\n\t unpairedHi = Math.max(10, unpairedHi + adj);\n\t pairedHi = pairedHi - adj;\n\t\n\t var movingUpwards = adj < 0;\n\t // when the divider gets close to the top - lock into hiding the unpaired section\n\t if (movingUpwards) {\n\t if (this.unpairedPanelHidden) {\n\t return false;\n\t } else if (unpairedHi <= 10) {\n\t this.hideUnpaired();\n\t return false;\n\t }\n\t } else {\n\t if (this.unpairedPanelHidden) {\n\t $unpaired.show();\n\t this.unpairedPanelHidden = false;\n\t }\n\t }\n\t\n\t // when the divider gets close to the bottom - lock into hiding the paired section\n\t if (!movingUpwards) {\n\t if (this.pairedPanelHidden) {\n\t return false;\n\t } else if (pairedHi <= 15) {\n\t this.hidePaired();\n\t return false;\n\t }\n\t } else {\n\t if (this.pairedPanelHidden) {\n\t $paired.show();\n\t this.pairedPanelHidden = false;\n\t }\n\t }\n\t\n\t $unpaired.css({\n\t height: unpairedHi + 'px',\n\t flex: '0 0 auto'\n\t });\n\t return true;\n\t },\n\t\n\t // ........................................................................ paired\n\t /** select a pair when clicked */\n\t selectPair: function (ev) {\n\t ev.stopPropagation();\n\t $(ev.currentTarget).toggleClass('selected');\n\t },\n\t\n\t /** deselect all pairs */\n\t clearSelectedPaired: function (ev) {\n\t this.$('.paired-columns .dataset.selected').removeClass('selected');\n\t },\n\t\n\t /** rename a pair when the pair name is clicked */\n\t _clickPairName: function (ev) {\n\t ev.stopPropagation();\n\t var $name = $(ev.currentTarget),\n\t $pair = $name.parent().parent(),\n\t index = $pair.index('.dataset.paired'),\n\t pair = this.paired[index],\n\t response = prompt('Enter a new name for the pair:', pair.name);\n\t if (response) {\n\t pair.name = response;\n\t // set a flag (which won't be passed in json creation) for manual naming so we don't overwrite these\n\t // when adding/removing extensions\n\t //hackish\n\t pair.customizedName = true;\n\t $name.text(pair.name);\n\t }\n\t },\n\t\n\t /** unpair this pair */\n\t _clickUnpair: function (ev) {\n\t //if( !ev.currentTarget ){ return true; }\n\t var pairIndex = Math.floor($(ev.currentTarget).index('.unpair-btn'));\n\t //this.debug( 'pair:', pairIndex );\n\t this._unpair(this.paired[pairIndex]);\n\t },\n\t\n\t // ........................................................................ paired - drag and drop re-ordering\n\t //_dragenterPairedColumns : function( ev ){\n\t // this.debug( '_dragenterPairedColumns:', ev );\n\t //},\n\t //_dragleavePairedColumns : function( ev ){\n\t // //this.debug( '_dragleavePairedColumns:', ev );\n\t //},\n\t /** track the mouse drag over the paired list adding a placeholder to show where the drop would occur */\n\t _dragoverPairedColumns: function (ev) {\n\t //this.debug( '_dragoverPairedColumns:', ev );\n\t ev.preventDefault();\n\t\n\t var $list = this.$('.paired-columns .column-datasets');\n\t this._checkForAutoscroll($list, ev.originalEvent.clientY);\n\t //this.debug( ev.originalEvent.clientX, ev.originalEvent.clientY );\n\t var $nearest = this._getNearestPairedDatasetLi(ev.originalEvent.clientY);\n\t\n\t $('.element-drop-placeholder').remove();\n\t var $placeholder = $('
                                              ');\n\t if (!$nearest.length) {\n\t $list.append($placeholder);\n\t } else {\n\t $nearest.before($placeholder);\n\t }\n\t },\n\t\n\t /** If the mouse is near enough to the list's top or bottom, scroll the list */\n\t _checkForAutoscroll: function ($element, y) {\n\t var AUTOSCROLL_SPEED = 2;\n\t var offset = $element.offset(),\n\t scrollTop = $element.scrollTop(),\n\t upperDist = y - offset.top,\n\t lowerDist = offset.top + $element.outerHeight() - y;\n\t //this.debug( '_checkForAutoscroll:', scrollTop, upperDist, lowerDist );\n\t if (upperDist >= 0 && upperDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop - AUTOSCROLL_SPEED);\n\t } else if (lowerDist >= 0 && lowerDist < this.autoscrollDist) {\n\t $element.scrollTop(scrollTop + AUTOSCROLL_SPEED);\n\t }\n\t },\n\t\n\t /** get the nearest *previous* paired dataset PairView based on the mouse's Y coordinate.\n\t * If the y is at the end of the list, return an empty jQuery object.\n\t */\n\t _getNearestPairedDatasetLi: function (y) {\n\t var WIGGLE = 4,\n\t lis = this.$('.paired-columns .column-datasets li').toArray();\n\t for (var i = 0; i < lis.length; i++) {\n\t var $li = $(lis[i]),\n\t top = $li.offset().top,\n\t halfHeight = Math.floor($li.outerHeight() / 2) + WIGGLE;\n\t if (top + halfHeight > y && top - halfHeight < y) {\n\t //this.debug( y, top + halfHeight, top - halfHeight )\n\t return $li;\n\t }\n\t }\n\t return $();\n\t },\n\t /** drop (dragged/selected PairViews) onto the list, re-ordering both the DOM and the internal array of pairs */\n\t _dropPairedColumns: function (ev) {\n\t // both required for firefox\n\t ev.preventDefault();\n\t ev.dataTransfer.dropEffect = 'move';\n\t\n\t var $nearest = this._getNearestPairedDatasetLi(ev.originalEvent.clientY);\n\t if ($nearest.length) {\n\t this.$dragging.insertBefore($nearest);\n\t } else {\n\t // no nearest before - insert after last element (unpair button)\n\t this.$dragging.insertAfter(this.$('.paired-columns .unpair-btn').last());\n\t }\n\t // resync the creator's list of paired based on the new DOM order\n\t this._syncPairsToDom();\n\t return false;\n\t },\n\t /** resync the creator's list of paired based on the DOM order of pairs */\n\t _syncPairsToDom: function () {\n\t var newPaired = [];\n\t //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n\t this.$('.paired-columns .dataset.paired').each(function () {\n\t newPaired.push($(this).data('pair'));\n\t });\n\t //this.debug( newPaired );\n\t this.paired = newPaired;\n\t this._renderPaired();\n\t },\n\t /** drag communication with pair sub-views: dragstart */\n\t _pairDragstart: function (ev, pair) {\n\t //this.debug( '_pairDragstart', ev, pair )\n\t // auto select the pair causing the event and move all selected\n\t pair.$el.addClass('selected');\n\t var $selected = this.$('.paired-columns .dataset.selected');\n\t this.$dragging = $selected;\n\t },\n\t /** drag communication with pair sub-views: dragend - remove the placeholder */\n\t _pairDragend: function (ev, pair) {\n\t //this.debug( '_pairDragend', ev, pair )\n\t $('.element-drop-placeholder').remove();\n\t this.$dragging = null;\n\t },\n\t\n\t // ........................................................................ footer\n\t toggleExtensions: function (force) {\n\t var creator = this;\n\t creator.removeExtensions = force !== undefined ? force : !creator.removeExtensions;\n\t\n\t _.each(creator.paired, function (pair) {\n\t // don't overwrite custom names\n\t if (pair.customizedName) {\n\t return;\n\t }\n\t pair.name = creator._guessNameForPair(pair.forward, pair.reverse);\n\t });\n\t\n\t creator._renderPaired();\n\t creator._renderFooter();\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** debug a dataset list */\n\t _printList: function (list) {\n\t var creator = this;\n\t _.each(list, function (e) {\n\t if (list === creator.paired) {\n\t creator._printPair(e);\n\t } else {\n\t //creator.debug( e );\n\t }\n\t });\n\t },\n\t\n\t /** print a pair Object */\n\t _printPair: function (pair) {\n\t this.debug(pair.forward.name, pair.reverse.name, ': ->', pair.name);\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'PairedCollectionCreator';\n\t },\n\t\n\t templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\t\n\t /** the header (not including help text) */\n\t header: _.template(['', '
                                              ', '', '', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '
                                              ', '', _l('Unpaired forward'), '', '', '
                                              ', '
                                              ', '', '
                                              ', '
                                              ', '
                                              ', '', '
                                              ', '
                                              ', '
                                              ', '', _l('Unpaired reverse'), '', '', '
                                              ', '
                                              ', '', '
                                              ', '
                                              ', '
                                              ', '
                                              '].join('')),\n\t\n\t /** the middle: unpaired, divider, and paired */\n\t middle: _.template([\n\t // contains two flex rows (rows that fill available space) and a divider btwn\n\t '
                                              ', '
                                              ', '
                                                ', '
                                                ', '
                                                ', '
                                                  ', '
                                                  ', '
                                                  ', '
                                                    ', '
                                                    ', '
                                                    ', '
                                                    ', '
                                                    ', '
                                                    ', '
                                                    ', '', '
                                                    ', '', _l('Unpair all'), '', '
                                                    ', '
                                                    ', '
                                                    ', '
                                                      ', '
                                                      '].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer: _.template(['
                                                      ', '
                                                      ', '', '', '
                                                      ', '
                                                      ', '', '
                                                      ', _l('Name'), ':
                                                      ', '
                                                      ', '
                                                      ', '
                                                      ', '
                                                      ', '', '
                                                      ', '', '', '
                                                      ', '
                                                      ', '
                                                      ', '', '
                                                      ', '
                                                      '].join('')),\n\t\n\t /** help content */\n\t helpContent: _.template(['

                                                      ', _l(['Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ', 'These collections can be passed to tools and workflows in order to have analyses done on each member of ', 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ', 'and re-order the final collection.'].join('')), '

                                                      ', '

                                                      ', _l(['Unpaired datasets are shown in the unpaired section ', '(hover over the underlined words to highlight below). ', 'Paired datasets are shown in the paired section.', '

                                                        To pair datasets, you can:', '
                                                      • Click a dataset in the ', 'forward column ', 'to select it then click a dataset in the ', 'reverse column.', '
                                                      • ', '
                                                      • Click one of the \"Pair these datasets\" buttons in the ', 'middle column ', 'to pair the datasets in a particular row.', '
                                                      • ', '
                                                      • Click \"Auto-pair\" ', 'to have your datasets automatically paired based on name.', '
                                                      • ', '
                                                      '].join('')), '

                                                      ', '

                                                      ', _l(['

                                                        You can filter what is shown in the unpaired sections by:', '
                                                      • Entering partial dataset names in either the ', 'forward filter or ', 'reverse filter.', '
                                                      • ', '
                                                      • Choosing from a list of preset filters by clicking the ', '\"Choose filters\" link.', '
                                                      • ', '
                                                      • Entering regular expressions to match dataset names. See: ', 'MDN\\'s JavaScript Regular Expression Tutorial. ', 'Note: forward slashes (\\\\) are not needed.', '
                                                      • ', '
                                                      • Clearing the filters by clicking the ', '\"Clear filters\" link.', '
                                                      • ', '
                                                      '].join('')), '

                                                      ', '

                                                      ', _l(['To unpair individual dataset pairs, click the ', 'unpair buttons ( ). ', 'Click the \"Unpair all\" link to unpair all pairs.'].join('')), '

                                                      ', '

                                                      ', _l(['You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ', '\"Remove file extensions from pair names?\" control.'].join('')), '

                                                      ', '

                                                      ', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\". ', '(Note: you do not have to pair all unpaired datasets to finish.)'].join('')), '

                                                      '].join(''))\n\t })\n\t });\n\t\n\t //=============================================================================\n\t /** a modal version of the paired collection creator */\n\t var pairedCollectionCreatorModal = function _pairedCollectionCreatorModal(datasets, options) {\n\t\n\t var deferred = jQuery.Deferred(),\n\t creator;\n\t\n\t options = _.defaults(options || {}, {\n\t datasets: datasets,\n\t oncancel: function () {\n\t Galaxy.modal.hide();\n\t deferred.reject('cancelled');\n\t },\n\t oncreate: function (creator, response) {\n\t Galaxy.modal.hide();\n\t deferred.resolve(response);\n\t }\n\t });\n\t\n\t if (!window.Galaxy || !Galaxy.modal) {\n\t throw new Error('Galaxy or Galaxy.modal not found');\n\t }\n\t\n\t creator = new PairedCollectionCreator(options);\n\t Galaxy.modal.show({\n\t title: 'Create a collection of paired datasets',\n\t body: creator.$el,\n\t width: '80%',\n\t height: '800px',\n\t closing_events: true\n\t });\n\t creator.render();\n\t window.creator = creator;\n\t\n\t //TODO: remove modal header\n\t return deferred;\n\t };\n\t\n\t //=============================================================================\n\t function createListOfPairsCollection(collection, defaultHideSourceItems) {\n\t var elements = collection.toJSON();\n\t //TODO: validate elements\n\t return pairedCollectionCreatorModal(elements, {\n\t historyId: collection.historyId,\n\t defaultHideSourceItems: defaultHideSourceItems\n\t });\n\t }\n\t\n\t //=============================================================================\n\t return {\n\t PairedCollectionCreator: PairedCollectionCreator,\n\t pairedCollectionCreatorModal: pairedCollectionCreatorModal,\n\t createListOfPairsCollection: createListOfPairsCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 125 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(60), __webpack_require__(63), __webpack_require__(7), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_CREATOR, HDCA, BASE_MVC, _l) {\n\t\n\t 'use strict';\n\t\n\t var logNamespace = 'collections';\n\t /*==============================================================================\n\t TODO:\n\t the paired creator doesn't really mesh with the list creator as parent\n\t it may be better to make an abstract super class for both\n\t composites may inherit from this (or vis-versa)\n\t PairedDatasetCollectionElementView doesn't make a lot of sense\n\t \n\t ==============================================================================*/\n\t /** */\n\t var PairedDatasetCollectionElementView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n\t _logNamespace: logNamespace,\n\t\n\t //TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n\t tagName: 'li',\n\t className: 'collection-element',\n\t\n\t initialize: function (attributes) {\n\t this.element = attributes.element || {};\n\t this.identifier = attributes.identifier;\n\t },\n\t\n\t render: function () {\n\t this.$el.attr('data-element-id', this.element.id).html(this.template({ identifier: this.identifier, element: this.element }));\n\t return this;\n\t },\n\t\n\t //TODO: lots of unused space in the element - possibly load details and display them horiz.\n\t template: _.template(['<%- identifier %>', '<%- element.name %>'].join('')),\n\t\n\t /** remove the DOM and any listeners */\n\t destroy: function () {\n\t this.off();\n\t this.$el.remove();\n\t },\n\t\n\t /** string rep */\n\t toString: function () {\n\t return 'DatasetCollectionElementView()';\n\t }\n\t });\n\t\n\t // ============================================================================\n\t var _super = LIST_CREATOR.ListCollectionCreator;\n\t\n\t /** An interface for building collections.\n\t */\n\t var PairCollectionCreator = _super.extend({\n\t\n\t /** the class used to display individual elements */\n\t elementViewClass: PairedDatasetCollectionElementView,\n\t /** the class this creator will create and save */\n\t collectionClass: HDCA.HistoryPairDatasetCollection,\n\t className: 'pair-collection-creator collection-creator flex-row-container',\n\t\n\t /** override to no-op */\n\t _mangleDuplicateNames: function () {},\n\t\n\t // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n\t // bad inital choices and\n\t // when the user has painted his/her self into a corner during creation/use-of-the-creator\n\t /** render the entire interface */\n\t render: function (speed, callback) {\n\t if (this.workingElements.length === 2) {\n\t return _super.prototype.render.call(this, speed, callback);\n\t }\n\t return this._renderInvalid(speed, callback);\n\t },\n\t\n\t // ------------------------------------------------------------------------ rendering elements\n\t /** render forward/reverse */\n\t _renderList: function (speed, callback) {\n\t //this.debug( '-- _renderList' );\n\t //precondition: there are two valid elements in workingElements\n\t var creator = this,\n\t $tmp = jQuery('
                                                      '),\n\t $list = creator.$list();\n\t\n\t // lose the original views, create the new, append all at once, then call their renders\n\t _.each(this.elementViews, function (view) {\n\t view.destroy();\n\t creator.removeElementView(view);\n\t });\n\t $tmp.append(creator._createForwardElementView().$el);\n\t $tmp.append(creator._createReverseElementView().$el);\n\t $list.empty().append($tmp.children());\n\t _.invoke(creator.elementViews, 'render');\n\t },\n\t\n\t /** create the forward element view */\n\t _createForwardElementView: function () {\n\t return this._createElementView(this.workingElements[0], { identifier: 'forward' });\n\t },\n\t\n\t /** create the forward element view */\n\t _createReverseElementView: function () {\n\t return this._createElementView(this.workingElements[1], { identifier: 'reverse' });\n\t },\n\t\n\t /** create an element view, cache in elementViews, and return */\n\t _createElementView: function (element, options) {\n\t var elementView = new this.elementViewClass(_.extend(options, {\n\t element: element\n\t }));\n\t this.elementViews.push(elementView);\n\t return elementView;\n\t },\n\t\n\t /** swap the forward, reverse elements and re-render */\n\t swap: function () {\n\t this.workingElements = [this.workingElements[1], this.workingElements[0]];\n\t this._renderList();\n\t },\n\t\n\t events: _.extend(_.clone(_super.prototype.events), {\n\t 'click .swap': 'swap'\n\t }),\n\t\n\t // ------------------------------------------------------------------------ templates\n\t //TODO: move to require text plugin and load these as text\n\t //TODO: underscore currently unnecc. bc no vars are used\n\t //TODO: better way of localizing text-nodes in long strings\n\t /** underscore template fns attached to class */\n\t templates: _.extend(_.clone(_super.prototype.templates), {\n\t /** the middle: element list */\n\t middle: _.template(['', '
                                                      ', '
                                                      '].join('')),\n\t\n\t /** help content */\n\t helpContent: _.template(['

                                                      ', _l(['Pair collections are permanent collections containing two datasets: one forward and one reverse. ', 'Often these are forward and reverse reads. The pair collections can be passed to tools and ', 'workflows in order to have analyses done on both datasets. This interface allows ', 'you to create a pair, name it, and swap which is forward and which reverse.'].join('')), '

                                                      ', '
                                                        ', '
                                                      • ', _l(['Click the \"Swap\" link to make your forward dataset the reverse ', 'and the reverse dataset forward.'].join('')), '
                                                      • ', '
                                                      • ', _l(['Click the \"Cancel\" button to exit the interface.'].join('')), '
                                                      • ', '

                                                      ', '

                                                      ', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '

                                                      '].join('')),\n\t\n\t /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n\t invalidInitial: _.template(['
                                                      ', '
                                                      ', '', '<% if( _.size( problems ) ){ %>', _l('The following selections could not be included due to problems'), '
                                                        <% _.each( problems, function( problem ){ %>', '
                                                      • <%- problem.element.name %>: <%- problem.text %>
                                                      • ', '<% }); %>
                                                      ', '<% } else if( _.size( elements ) === 0 ){ %>', _l('No datasets were selected'), '.', '<% } else if( _.size( elements ) === 1 ){ %>', _l('Only one dataset was selected'), ': <%- elements[0].name %>', '<% } else if( _.size( elements ) > 2 ){ %>', _l('Too many datasets were selected'), ': <%- _.pluck( elements, \"name\" ).join( \", \") %>', '<% } %>', '
                                                      ', _l('Two (and only two) elements are needed for the pair'), '. ', _l('You may need to '), '', _l('cancel'), ' ', _l('and reselect new elements'), '.', '
                                                      ', '
                                                      ', '
                                                      ', '
                                                      ', '
                                                      ', '
                                                      ', '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
                                                      ', '
                                                      ', '
                                                      '].join(''))\n\t }),\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString: function () {\n\t return 'PairCollectionCreator';\n\t }\n\t });\n\t\n\t //==============================================================================\n\t /** List collection flavor of collectionCreatorModal. */\n\t var pairCollectionCreatorModal = function _pairCollectionCreatorModal(elements, options) {\n\t options = options || {};\n\t options.title = _l('Create a collection from a pair of datasets');\n\t return LIST_CREATOR.collectionCreatorModal(elements, options, PairCollectionCreator);\n\t };\n\t\n\t //==============================================================================\n\t /** Use a modal to create a pair collection, then add it to the given history contents.\n\t * @returns {Deferred} resolved when the collection is added to the history.\n\t */\n\t function createPairCollection(contents, defaultHideSourceItems) {\n\t var elements = contents.toJSON(),\n\t promise = pairCollectionCreatorModal(elements, {\n\t defaultHideSourceItems: defaultHideSourceItems,\n\t creationFn: function (elements, name, hideSourceItems) {\n\t elements = [{ name: \"forward\", src: \"hda\", id: elements[0].id }, { name: \"reverse\", src: \"hda\", id: elements[1].id }];\n\t return contents.createHDCA(elements, 'paired', name, hideSourceItems);\n\t }\n\t });\n\t return promise;\n\t }\n\t\n\t //==============================================================================\n\t return {\n\t PairCollectionCreator: PairCollectionCreator,\n\t pairCollectionCreatorModal: pairCollectionCreatorModal,\n\t createPairCollection: createPairCollection\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 126 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(49), __webpack_require__(5), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Tabs, Ui, Form) {\n\t\n\t /** Dataset edit attributes view */\n\t var View = Backbone.View.extend({\n\t initialize: function () {\n\t this.setElement('
                                                      ');\n\t this.model = new Backbone.Model({ 'dataset_id': Galaxy.params.dataset_id });\n\t this.render();\n\t },\n\t\n\t // Fetch data for the selected dataset and \n\t // build tabs for editing its attributes\n\t render: function () {\n\t var url = Galaxy.root + 'dataset/edit',\n\t self = this;\n\t Utils.get({\n\t url: url,\n\t data: { 'dataset_id': self.model.get('dataset_id') },\n\t success: function (response) {\n\t self.render_attribute_page(self, response);\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while loading the dataset.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t\n\t /** Render all the tabs view */\n\t render_attribute_page: function (self, response) {\n\t var message = {\n\t 'message': response.message,\n\t 'status': response.status,\n\t 'persistent': true,\n\t 'cls': response.status + 'message'\n\t };\n\t self.$el.empty().append(self._templateHeader());\n\t self.display_message(message, self.$('.response-message'));\n\t // Create all tabs\n\t self.create_tabs(response, self.$('.edit-attr'));\n\t },\n\t\n\t /** Perform AJAX post call */\n\t call_ajax: function (self, data, tab_name) {\n\t var post_url = Galaxy.root + 'dataset/edit';\n\t $.ajax({\n\t type: \"PUT\",\n\t url: post_url,\n\t data: data,\n\t success: function (response) {\n\t self.render_attribute_page(self, response);\n\t self.reload_history();\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t\n\t /** Display actions messages */\n\t display_message: function (response, $el) {\n\t $el.empty().html(new Ui.Message(response).$el);\n\t },\n\t\n\t /** Create tabs for different attributes of dataset*/\n\t create_tabs: function (response, $el_edit_attr) {\n\t var self = this;\n\t self.tabs = new Tabs.View();\n\t self.tabs.add({\n\t id: 'attributes',\n\t title: 'Attributes',\n\t icon: 'fa fa-bars',\n\t tooltip: 'Edit dataset attributes',\n\t $el: self._getAttributesFormTemplate(response)\n\t });\n\t\n\t self.tabs.add({\n\t id: 'convert',\n\t title: 'Convert',\n\t icon: 'fa-gear',\n\t tooltip: 'Convert to new format',\n\t $el: self._getConvertFormTemplate(response)\n\t });\n\t\n\t self.tabs.add({\n\t id: 'datatype',\n\t title: 'Datatypes',\n\t icon: 'fa-database',\n\t tooltip: 'Change data type',\n\t $el: self._getChangeDataTypeFormTemplate(response)\n\t });\n\t\n\t self.tabs.add({\n\t id: 'permissions',\n\t title: 'Permissions',\n\t icon: 'fa-user',\n\t tooltip: 'Permissions',\n\t $el: self._getPermissionsFormTemplate(response)\n\t });\n\t $el_edit_attr.append(self.tabs.$el);\n\t self.tabs.showTab('attributes');\n\t },\n\t\n\t /** Main template */\n\t _templateHeader: function () {\n\t return '
                                                      ' + '
                                                      ' + '

                                                      Edit Dataset Attributes

                                                      ' + '
                                                      ';\n\t },\n\t\n\t /** Attributes tab template */\n\t _getAttributesFormTemplate: function (response) {\n\t var self = this;\n\t var form = new Form({\n\t title: 'Edit attributes',\n\t inputs: response.edit_attributes_inputs,\n\t operations: {\n\t 'submit_editattr': new Ui.ButtonIcon({\n\t tooltip: 'Save attributes of the dataset.',\n\t icon: 'fa-floppy-o ',\n\t title: 'Save attributes',\n\t onclick: function () {\n\t self._submit(self, form, response, \"edit_attributes\");\n\t }\n\t }),\n\t 'submit_autocorrect': new Ui.ButtonIcon({\n\t tooltip: 'This will inspect the dataset and attempt to correct the values of fields if they are not accurate.',\n\t icon: 'fa-undo ',\n\t title: 'Auto-detect',\n\t onclick: function () {\n\t self._submit(self, form, response, \"auto-detect\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Convert tab template */\n\t _getConvertFormTemplate: function (response) {\n\t var self = this;\n\t var form = new Form({\n\t title: 'Convert to new format',\n\t inputs: response.convert_inputs,\n\t operations: {\n\t 'submit': new Ui.ButtonIcon({\n\t tooltip: 'Convert the datatype to a new format.',\n\t title: 'Convert datatype',\n\t icon: 'fa-exchange ',\n\t onclick: function () {\n\t self._submit(self, form, response, \"convert\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Change datatype template */\n\t _getChangeDataTypeFormTemplate: function (response) {\n\t var self = this;\n\t var form = new Form({\n\t title: 'Change datatype',\n\t inputs: response.convert_datatype_inputs,\n\t operations: {\n\t 'submit': new Ui.ButtonIcon({\n\t tooltip: 'Change the datatype to a new type.',\n\t title: 'Change datatype',\n\t icon: 'fa-exchange ',\n\t onclick: function () {\n\t self._submit(self, form, response, \"change\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Permissions template */\n\t _getPermissionsFormTemplate: function (response) {\n\t var template = \"\",\n\t self = this;\n\t if (response.can_manage_dataset) {\n\t var form = new Form({\n\t title: 'Manage dataset permissions on ' + response.display_name,\n\t inputs: response.permission_inputs,\n\t operations: {\n\t 'submit': new Ui.ButtonIcon({\n\t tooltip: 'Save permissions.',\n\t title: 'Save permissions',\n\t icon: 'fa-floppy-o ',\n\t onclick: function () {\n\t self._submit(self, form, response, \"permissions\");\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t } else {\n\t var form = new Form({\n\t title: 'View permissions',\n\t inputs: response.permission_inputs\n\t });\n\t return form.$el;\n\t }\n\t },\n\t\n\t /** Submit action */\n\t _submit: function (self, form, response, type) {\n\t var form_data = form.data.create();\n\t form_data.dataset_id = response.dataset_id;\n\t switch (type) {\n\t case \"edit_attributes\":\n\t form_data.save = 'Save';\n\t break;\n\t\n\t case \"auto-detect\":\n\t form_data.detect = 'Auto-detect';\n\t break;\n\t\n\t case \"convert\":\n\t if (form_data.target_type !== null && form_data.target_type) {\n\t form_data.dataset_id = response.dataset_id;\n\t form_data.convert_data = 'Convert';\n\t }\n\t break;\n\t\n\t case \"change\":\n\t form_data.change = 'Save';\n\t break;\n\t\n\t case \"permissions\":\n\t var post_data = {};\n\t post_data.permissions = JSON.stringify(form_data);\n\t post_data.update_roles_button = \"Save\";\n\t post_data.dataset_id = response.dataset_id;\n\t form_data = post_data;\n\t break;\n\t }\n\t self.call_ajax(self, form_data);\n\t },\n\t\n\t /** Reload Galaxy's history after updating dataset's attributes */\n\t reload_history: function () {\n\t if (window.Galaxy) {\n\t window.Galaxy.currHistoryPanel.loadCurrentHistory();\n\t }\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 127 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(5), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Utils, Ui, Form) {\n\t\n\t /** Dataset edit attributes view */\n\t var View = Backbone.View.extend({\n\t initialize: function () {\n\t this.setElement('
                                                      ');\n\t this.model = new Backbone.Model({ 'dataset_id': Galaxy.params.dataset_id });\n\t this.render();\n\t },\n\t\n\t // Fetch data for the selected dataset and\n\t render: function () {\n\t var data_url = Galaxy.root + 'api/datasets/' + this.model.get('dataset_id'),\n\t self = this;\n\t\n\t Utils.get({\n\t url: data_url,\n\t success: function (dataset) {\n\t var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n\t Utils.get({\n\t url: job_url,\n\t success: function (job) {\n\t var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n\t self.render_error_page(self, dataset, job);\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while loading the job.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while loading the dataset.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t },\n\t\n\t /** Render the view */\n\t render_error_page: function (self, dataset, job) {\n\t self.$el.empty().append(self._templateHeader());\n\t self.$el.append('

                                                      Dataset Error

                                                      ');\n\t self.$el.append('

                                                      An error occured while running the tool ' + job.tool_id + '.

                                                      ');\n\t self.$el.append('

                                                      Tool execution generated the following messages:

                                                      ');\n\t self.$el.append('
                                                      ' + job.stderr + '
                                                      ');\n\t self.$el.append('

                                                      Report This Error

                                                    1. ');\n\t self.$el.append('

                                                      Usually the local Galaxy administrators regularly review errors that occur on the server. However, if you would like to provide additional information (such as what you were trying to do when the error occurred) and a contact e-mail address, we will be better able to investigate your problem and get back to you.

                                                      ');\n\t self.$el.append(self._getBugFormTemplate(dataset, job));\n\t },\n\t\n\t /** Display actions messages */\n\t display_message: function (response, $el, doNotClear, safe) {\n\t if (!safe) {\n\t if (doNotClear) {\n\t $el.append(new Ui.Message(response).$el);\n\t } else {\n\t $el.empty().html(new Ui.Message(response).$el);\n\t }\n\t } else {\n\t if (doNotClear) {\n\t $el.append(new Ui.UnescapedMessage(response).$el);\n\t } else {\n\t $el.empty().html(new Ui.UnescapedMessage(response).$el);\n\t }\n\t }\n\t },\n\t\n\t /** Main template */\n\t _templateHeader: function () {\n\t return '
                                                      ' + '
                                                      ' + '
                                                      ';\n\t },\n\t\n\t /** Convert tab template */\n\t _getBugFormTemplate: function (dataset, job) {\n\t var self = this;\n\t var inputs = [{\n\t \"help\": \"Your email address\",\n\t \"options\": [],\n\t \"type\": \"text\",\n\t \"name\": \"email\",\n\t \"label\": \"Your email\",\n\t \"value\": Galaxy.user.get('email')\n\t }, {\n\t \"help\": \"Any additional comments you can provide regarding what you were doing at the time of the bug.\",\n\t \"options\": [],\n\t \"type\": \"text\",\n\t \"area\": true,\n\t \"name\": \"message\",\n\t \"label\": \"Message\"\n\t }];\n\t\n\t // TODO\n\t if (false) {\n\t inputs.push({\n\t \"name\": \"public_consent\",\n\t \"label\": \"Public Disclosure Consent\",\n\t \"help\": \"This Galaxy is configured to report to one or more error reporting backends that public to the world. By selecting 'yes', you acknowledge that this bug report will be made public.\",\n\t \"value\": String(Boolean(false)),\n\t \"options\": [],\n\t \"type\": \"boolean\"\n\t });\n\t }\n\t\n\t var form = new Form({\n\t title: 'Error Report',\n\t inputs: inputs,\n\t buttons: {\n\t save: new Ui.Button({\n\t icon: 'fa-bug',\n\t title: 'Report',\n\t cls: 'ui-button btn btn-primary',\n\t floating: 'clear',\n\t onclick: function () {\n\t var form_data = form.data.create();\n\t var url = Galaxy.root + 'api/jobs/' + job.id + '/error';\n\t form_data.dataset_id = dataset.id;\n\t self.submit(form_data, url);\n\t }\n\t })\n\t }\n\t });\n\t return form.$el;\n\t },\n\t\n\t /** Make ajax request */\n\t submit: function (form_data, url) {\n\t var self = this;\n\t // Some required metadata\n\t $.ajax({\n\t type: \"POST\",\n\t url: url,\n\t data: form_data,\n\t success: function (response) {\n\t // Clear out the div\n\t self.$el.empty().append(self._templateHeader());\n\t // And display the messages.\n\t response.messages.forEach(function (message) {\n\t self.display_message({\n\t 'status': message[1],\n\t 'message': message[0],\n\t 'persistent': true\n\t }, self.$('.response-message'), true, true);\n\t });\n\t },\n\t error: function (response) {\n\t var error_response = {\n\t 'status': 'error',\n\t 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n\t 'persistent': true,\n\t 'cls': 'errormessage'\n\t };\n\t self.display_message(error_response, self.$('.response-message'));\n\t }\n\t });\n\t }\n\t });\n\t\n\t return {\n\t View: View\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 128 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This class renders the grid list with shared section. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(12)], __WEBPACK_AMD_DEFINE_RESULT__ = function (GridView) {\n\t var View = Backbone.View.extend({\n\t initialize: function (options) {\n\t var self = this;\n\t this.setElement($('
                                                      '));\n\t this.model = new Backbone.Model(options);\n\t this.item = this.model.get('item');\n\t $.ajax({\n\t url: Galaxy.root + this.item + '/' + this.model.get('action_id'),\n\t success: function (response) {\n\t response['dict_format'] = true;\n\t self.model.set(response);\n\t self.render();\n\t }\n\t });\n\t },\n\t\n\t render: function () {\n\t var grid = new GridView(this.model.attributes);\n\t this.$el.empty().append(grid.$el);\n\t this.$el.append(this._templateShared());\n\t },\n\t\n\t _templateShared: function () {\n\t var self = this;\n\t var $tmpl = $('
                                                      ' + '

                                                      ' + this.model.get('plural') + ' shared with you by others

                                                      ' + '
                                                      ');\n\t var options = this.model.attributes;\n\t if (options.shared_by_others && options.shared_by_others.length > 0) {\n\t var $table = $('' + '' + '' + '' + '' + '
                                                      TitleOwner
                                                      ');\n\t _.each(options.shared_by_others, function (it, index) {\n\t var display_url = Galaxy.root + self.item + '/display_by_username_and_slug?username=' + it.username + '&slug=' + it.slug;\n\t $table.append('
                                                      ' + '' + _.escape(it.title) + '' + '' + _.escape(it.username) + '
                                                      ' + '
                                                      ' + '
                                                      ' + '
                                                      ' + '
                                                      ' + '
                                                      You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.
                                                      ' + '',\n '
                                                      ',\n '
                                                      '\n ].join( '' );\n }\n});\n\n//==============================================================================\nreturn {\n CitationView : CitationView,\n CitationListView : CitationListView\n};\n\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/citation/citation-view.js","define([\n \"mvc/list/list-item\",\n \"mvc/dataset/dataset-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_ITEM, DATASET_LI, BASE_MVC, _l ){\n\n'use strict';\n//==============================================================================\nvar FoldoutListItemView = LIST_ITEM.FoldoutListItemView,\n ListItemView = LIST_ITEM.ListItemView;\n/** @class Read only view for DatasetCollection.\n */\nvar DCListItemView = FoldoutListItemView.extend(\n/** @lends DCListItemView.prototype */{\n\n className : FoldoutListItemView.prototype.className + \" dataset-collection\",\n id : function(){\n return [ 'dataset_collection', this.model.get( 'id' ) ].join( '-' );\n },\n\n /** override to add linkTarget */\n initialize : function( attributes ){\n this.linkTarget = attributes.linkTarget || '_blank';\n this.hasUser = attributes.hasUser;\n FoldoutListItemView.prototype.initialize.call( this, attributes );\n },\n\n /** event listeners */\n _setUpListeners : function(){\n FoldoutListItemView.prototype._setUpListeners.call( this );\n this.listenTo( this.model, 'change', function( model, options ){\n // if the model has changed deletion status render it entirely\n if( _.has( model.changed, 'deleted' ) ){\n this.render();\n\n // if the model has been decorated after the fact with the element count,\n // render the subtitle where the count is displayed\n } else if( _.has( model.changed, 'element_count' ) ){\n this.$( '> .title-bar .subtitle' ).replaceWith( this._renderSubtitle() );\n }\n });\n },\n\n // ......................................................................... rendering\n /** render a subtitle to show the user what sort of collection this is */\n _renderSubtitle : function(){\n return $( this.templates.subtitle( this.model.toJSON(), this ) );\n },\n\n // ......................................................................... foldout\n /** override to add linktarget to sub-panel */\n _getFoldoutPanelOptions : function(){\n var options = FoldoutListItemView.prototype._getFoldoutPanelOptions.call( this );\n return _.extend( options, {\n linkTarget : this.linkTarget,\n hasUser : this.hasUser\n });\n },\n\n /** override to not catch sub-panel selectors */\n $selector : function(){\n return this.$( '> .selector' );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDCListItemView.prototype.templates = (function(){\n\n var warnings = _.extend( {}, FoldoutListItemView.prototype.templates.warnings, {\n error : BASE_MVC.wrapTemplate([\n // error during index fetch - show error on dataset\n '<% if( model.error ){ %>',\n '
                                                      ',\n _l( 'There was an error getting the data for this collection' ), ': <%- model.error %>',\n '
                                                      ',\n '<% } %>'\n ]),\n purged : BASE_MVC.wrapTemplate([\n '<% if( model.purged ){ %>',\n '
                                                      ',\n _l( 'This collection has been deleted and removed from disk' ),\n '
                                                      ',\n '<% } %>'\n ]),\n deleted : BASE_MVC.wrapTemplate([\n // deleted not purged\n '<% if( model.deleted && !model.purged ){ %>',\n '
                                                      ',\n _l( 'This collection has been deleted' ),\n '
                                                      ',\n '<% } %>'\n ])\n });\n\n // use element identifier\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n '
                                                      ',\n '
                                                      ',\n '<%- collection.element_identifier || collection.name %>',\n '
                                                      ',\n '
                                                      ',\n '
                                                      '\n ], 'collection' );\n\n // use element identifier\n var subtitleTemplate = BASE_MVC.wrapTemplate([\n '
                                                      ',\n '<% var countText = collection.element_count? ( collection.element_count + \" \" ) : \"\"; %>',\n '<% if( collection.collection_type === \"list\" ){ %>',\n _l( 'a list of <%- countText %>datasets' ),\n '<% } else if( collection.collection_type === \"paired\" ){ %>',\n _l( 'a pair of datasets' ),\n '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n _l( 'a list of <%- countText %>dataset pairs' ),\n '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n _l( 'a list of <%- countText %>dataset lists' ),\n '<% } %>',\n '
                                                      '\n ], 'collection' );\n\n return _.extend( {}, FoldoutListItemView.prototype.templates, {\n warnings : warnings,\n titleBar : titleBarTemplate,\n subtitle : subtitleTemplate\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for DatasetCollectionElement.\n */\nvar DCEListItemView = ListItemView.extend(\n/** @lends DCEListItemView.prototype */{\n\n /** add the DCE class to the list item */\n className : ListItemView.prototype.className + \" dataset-collection-element\",\n\n /** set up */\n initialize : function( attributes ){\n if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }\n this.log( 'DCEListItemView.initialize:', attributes );\n ListItemView.prototype.initialize.call( this, attributes );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCEListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDCEListItemView.prototype.templates = (function(){\n\n // use the element identifier here - since that will persist and the user will need it\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n '
                                                      ',\n '
                                                      ',\n '<%- element.element_identifier %>',\n '
                                                      ',\n '
                                                      ',\n '
                                                      '\n ], 'element' );\n\n return _.extend( {}, ListItemView.prototype.templates, {\n titleBar : titleBarTemplate\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for a DatasetCollectionElement that is also an DatasetAssociation\n * (a dataset contained in a dataset collection).\n */\nvar DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend(\n/** @lends DatasetDCEListItemView.prototype */{\n\n className : DATASET_LI.DatasetListItemView.prototype.className + \" dataset-collection-element\",\n\n /** set up */\n initialize : function( attributes ){\n if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }\n this.log( 'DatasetDCEListItemView.initialize:', attributes );\n DATASET_LI.DatasetListItemView.prototype.initialize.call( this, attributes );\n },\n\n /** In this override, only get details if in the ready state.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n }\n return jQuery.when();\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DatasetDCEListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetDCEListItemView.prototype.templates = (function(){\n\n // use the element identifier here and not the dataset name\n //TODO:?? can we steal the DCE titlebar?\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n '
                                                      ',\n '',\n '
                                                      ',\n '<%- element.element_identifier %>',\n '
                                                      ',\n '
                                                      '\n ], 'element' );\n\n return _.extend( {}, DATASET_LI.DatasetListItemView.prototype.templates, {\n titleBar : titleBarTemplate\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n * (a nested DC).\n */\nvar NestedDCDCEListItemView = DCListItemView.extend(\n/** @lends NestedDCDCEListItemView.prototype */{\n\n className : DCListItemView.prototype.className + \" dataset-collection-element\",\n\n /** In this override, add the state as a class for use with state-based CSS */\n _swapNewRender : function( $newRender ){\n DCListItemView.prototype._swapNewRender.call( this, $newRender );\n var state = this.model.get( 'state' ) || 'ok';\n this.$el.addClass( 'state-' + state );\n return this.$el;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'NestedDCDCEListItemView(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\n return {\n DCListItemView : DCListItemView,\n DCEListItemView : DCEListItemView,\n DatasetDCEListItemView : DatasetDCEListItemView,\n NestedDCDCEListItemView : NestedDCDCEListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-li.js","define([\n \"mvc/dataset/dataset-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET_MODEL, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\n/*\nNotes:\n\nTerminology:\n DatasetCollection/DC : a container of datasets or nested DatasetCollections\n Element/DatasetCollectionElement/DCE : an item contained in a DatasetCollection\n HistoryDatasetCollectionAssociation/HDCA: a DatasetCollection contained in a history\n\n\nThis all seems too complex unfortunately:\n\n- Terminology collision between DatasetCollections (DCs) and Backbone Collections.\n- In the DatasetCollections API JSON, DC Elements use a 'Has A' stucture to *contain*\n either a dataset or a nested DC. This would make the hierarchy much taller. I've\n decided to merge the contained JSON with the DC element json - making the 'has a'\n relation into an 'is a' relation. This seems simpler to me and allowed a lot of\n DRY in both models and views, but may make tracking or tracing within these models\n more difficult (since DatasetCollectionElements are now *also* DatasetAssociations\n or DatasetCollections (nested)). This also violates the rule of thumb about\n favoring aggregation over inheritance.\n- Currently, there are three DatasetCollection subclasses: List, Pair, and ListPaired.\n These each should a) be usable on their own, b) be usable in the context of\n nesting within a collection model (at least in the case of ListPaired), and\n c) be usable within the context of other container models (like History or\n LibraryFolder, etc.). I've tried to separate/extract classes in order to\n handle those three situations, but it's proven difficult to do in a simple,\n readable manner.\n- Ideally, histories and libraries would inherit from the same server models as\n dataset collections do since they are (in essence) dataset collections themselves -\n making the whole nested structure simpler. This would be a large, error-prone\n refactoring and migration.\n\nMany of the classes and heirarchy are meant as extension points so, while the\nrelations and flow may be difficult to understand initially, they'll allow us to\nhandle the growth or flux dataset collection in the future (w/o actually implementing\nany YAGNI).\n\n*/\n//_________________________________________________________________________________________________ ELEMENTS\n/** @class mixin for Dataset collection elements.\n * When collection elements are passed from the API, the underlying element is\n * in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).\n * This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues\n * effectively changing a DCE from a container to a subclass (has a --> is a).\n */\nvar DatasetCollectionElementMixin = {\n\n /** default attributes used by elements in a dataset collection */\n defaults : {\n model_class : 'DatasetCollectionElement',\n element_identifier : null,\n element_index : null,\n element_type : null\n },\n\n /** merge the attributes of the sub-object 'object' into this model */\n _mergeObject : function( attributes ){\n // if we don't preserve and correct ids here, the element id becomes the object id\n // and collision in backbone's _byId will occur and only\n _.extend( attributes, attributes.object, { element_id: attributes.id });\n delete attributes.object;\n return attributes;\n },\n\n /** override to merge this.object into this */\n constructor : function( attributes, options ){\n // console.debug( '\\t DatasetCollectionElement.constructor:', attributes, options );\n attributes = this._mergeObject( attributes );\n this.idAttribute = 'element_id';\n Backbone.Model.apply( this, arguments );\n },\n\n /** when the model is fetched, merge this.object into this */\n parse : function( response, options ){\n var attributes = response;\n attributes = this._mergeObject( attributes );\n return attributes;\n }\n};\n\n/** @class Concrete class of Generic DatasetCollectionElement */\nvar DatasetCollectionElement = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( DatasetCollectionElementMixin )\n .extend({ _logNamespace : 'collections' });\n\n\n//==============================================================================\n/** @class Base/Abstract Backbone collection for Generic DCEs. */\nvar DCECollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).extend(\n/** @lends DCECollection.prototype */{\n _logNamespace : 'collections',\n\n model: DatasetCollectionElement,\n\n /** String representation. */\n toString : function(){\n return ([ 'DatasetCollectionElementCollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for a dataset collection element that is a dataset (HDA).\n */\nvar DatasetDCE = DATASET_MODEL.DatasetAssociation.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends DatasetDCE.prototype */{\n\n /** url fn */\n url : function(){\n // won't always be an hda\n if( !this.has( 'history_id' ) ){\n console.warn( 'no endpoint for non-hdas within a collection yet' );\n // (a little silly since this api endpoint *also* points at hdas)\n return Galaxy.root + 'api/datasets';\n }\n return Galaxy.root + 'api/histories/' + this.get( 'history_id' ) + '/contents/' + this.get( 'id' );\n },\n\n defaults : _.extend( {},\n DATASET_MODEL.DatasetAssociation.prototype.defaults,\n DatasetCollectionElementMixin.defaults\n ),\n\n _downloadQueryParameters : function() {\n return '?to_ext=' + this.get( 'file_ext' ) + '&hdca_id=' + this.get( 'parent_hdca_id' ) + '&element_identifier=' + this.get( 'element_identifier' );\n },\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually for now\n /** call the mixin constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t DatasetDCE.constructor:', attributes, options );\n //DATASET_MODEL.DatasetAssociation.prototype.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** Does this model already contain detailed data (as opposed to just summary level data)? */\n hasDetails : function(){\n return this.elements && this.elements.length;\n },\n\n /** String representation. */\n toString : function(){\n var objStr = this.get( 'element_identifier' );\n return ([ 'DatasetDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n */\nvar DatasetDCECollection = DCECollection.extend(\n/** @lends DatasetDCECollection.prototype */{\n model: DatasetDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'DatasetDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//_________________________________________________________________________________________________ COLLECTIONS\n/** @class Backbone model for Dataset Collections.\n * The DC API returns an array of JSON objects under the attribute elements.\n * This model:\n * - removes that array/attribute ('elements') from the model,\n * - creates a bbone collection (of the class defined in the 'collectionClass' attribute),\n * - passes that json onto the bbone collection\n * - caches the bbone collection in this.elements\n */\nvar DatasetCollection = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( BASE_MVC.SearchableModelMixin )\n .extend(/** @lends DatasetCollection.prototype */{\n _logNamespace : 'collections',\n\n /** default attributes for a model */\n defaults : {\n /* 'list', 'paired', or 'list:paired' */\n collection_type : null,\n //??\n deleted : false\n },\n\n /** Which class to use for elements */\n collectionClass : DCECollection,\n\n /** set up: create elements instance var and (on changes to elements) update them */\n initialize : function( model, options ){\n this.debug( this + '(DatasetCollection).initialize:', model, options, this );\n this.elements = this._createElementsModel();\n this.on( 'change:elements', function(){\n this.log( 'change:elements' );\n //TODO: prob. better to update the collection instead of re-creating it\n this.elements = this._createElementsModel();\n });\n },\n\n /** move elements model attribute to full collection */\n _createElementsModel : function(){\n this.debug( this + '._createElementsModel', this.collectionClass, this.get( 'elements' ), this.elements );\n //TODO: same patterns as DatasetCollectionElement _createObjectModel - refactor to BASE_MVC.hasSubModel?\n var elements = this.get( 'elements' ) || [];\n this.unset( 'elements', { silent: true });\n var self = this;\n _.each(elements, function(element, index) {\n _.extend(element, {\"parent_hdca_id\": self.get(\"id\")});\n });\n this.elements = new this.collectionClass( elements );\n //this.debug( 'collectionClass:', this.collectionClass + '', this.elements );\n return this.elements;\n },\n\n // ........................................................................ common queries\n /** pass the elements back within the model json when this is serialized */\n toJSON : function(){\n var json = Backbone.Model.prototype.toJSON.call( this );\n if( this.elements ){\n json.elements = this.elements.toJSON();\n }\n return json;\n },\n\n /** Is this collection in a 'ready' state no processing (for the collection) is left\n * to do on the server.\n */\n inReadyState : function(){\n var populated = this.get( 'populated' );\n return ( this.isDeletedOrPurged() || populated );\n },\n\n //TODO:?? the following are the same interface as DatasetAssociation - can we combine?\n /** Does the DC contain any elements yet? Is a fetch() required? */\n hasDetails : function(){\n return this.elements.length !== 0;\n },\n\n /** Given the filters, what models in this.elements would be returned? */\n getVisibleContents : function( filters ){\n // filters unused for now\n return this.elements;\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse : function( response, options ){\n var parsed = Backbone.Model.prototype.parse.call( this, response, options );\n if( parsed.create_time ){\n parsed.create_time = new Date( parsed.create_time );\n }\n if( parsed.update_time ){\n parsed.update_time = new Date( parsed.update_time );\n }\n return parsed;\n },\n\n /** save this dataset, _Mark_ing it as deleted (just a flag) */\n 'delete' : function( options ){\n if( this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: true }, options );\n },\n /** save this dataset, _Mark_ing it as undeleted */\n undelete : function( options ){\n if( !this.get( 'deleted' ) || this.get( 'purged' ) ){ return jQuery.when(); }\n return this.save( { deleted: false }, options );\n },\n\n /** Is this collection deleted or purged? */\n isDeletedOrPurged : function(){\n return ( this.get( 'deleted' ) || this.get( 'purged' ) );\n },\n\n // ........................................................................ searchable\n /** searchable attributes for collections */\n searchAttributes : [\n 'name', 'tags'\n ],\n\n // ........................................................................ misc\n /** String representation */\n toString : function(){\n var idAndName = [ this.get( 'id' ), this.get( 'name' ) || this.get( 'element_identifier' ) ];\n return 'DatasetCollection(' + ( idAndName.join(',') ) + ')';\n }\n});\n\n\n//==============================================================================\n/** Model for a DatasetCollection containing datasets (non-nested).\n */\nvar ListDatasetCollection = DatasetCollection.extend(\n/** @lends ListDatasetCollection.prototype */{\n\n /** override since we know the collection will only contain datasets */\n collectionClass : DatasetDCECollection,\n\n /** String representation. */\n toString : function(){ return 'List' + DatasetCollection.prototype.toString.call( this ); }\n});\n\n\n//==============================================================================\n/** Model for a DatasetCollection containing fwd/rev datasets (a list of 2).\n */\nvar PairDatasetCollection = ListDatasetCollection.extend(\n/** @lends PairDatasetCollection.prototype */{\n\n /** String representation. */\n toString : function(){ return 'Pair' + DatasetCollection.prototype.toString.call( this ); }\n});\n\n\n//_________________________________________________________________________________________________ NESTED COLLECTIONS\n// this is where things get weird, man. Weird.\n//TODO: it might be possible to compact all the following...I think.\n//==============================================================================\n/** @class Backbone model for a Generic DatasetCollectionElement that is also a DatasetCollection\n * (a nested collection). Currently only list:paired.\n */\nvar NestedDCDCE = DatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends NestedDCDCE.prototype */{\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** call the mixin constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t NestedDCDCE.constructor:', attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** String representation. */\n toString : function(){\n var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );\n return ([ 'NestedDCDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n */\nvar NestedDCDCECollection = DCECollection.extend(\n/** @lends NestedDCDCECollection.prototype */{\n\n /** This is a collection of nested collections */\n model: NestedDCDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'NestedDCDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n */\nvar NestedPairDCDCE = PairDatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends NestedPairDCDCE.prototype */{\n//TODO:?? possibly rename to NestedDatasetCollection?\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** This is both a collection and a collection element - call the constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t NestedPairDCDCE.constructor:', attributes, options );\n //DatasetCollection.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** String representation. */\n toString : function(){\n var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );\n return ([ 'NestedPairDCDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection for a backbone collection containing paired dataset collections.\n */\nvar NestedPairDCDCECollection = NestedDCDCECollection.extend(\n/** @lends PairDCDCECollection.prototype */{\n\n /** We know this collection is composed of only nested pair collections */\n model: NestedPairDCDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'NestedPairDCDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n */\nvar ListPairedDatasetCollection = DatasetCollection.extend(\n/** @lends ListPairedDatasetCollection.prototype */{\n\n /** list:paired is the only collection that itself contains collections */\n collectionClass : NestedPairDCDCECollection,\n\n /** String representation. */\n toString : function(){\n return ([ 'ListPairedDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for a list dataset collection within a list:list dataset collection. */\nvar NestedListDCDCE = ListDatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,\n/** @lends NestedListDCDCE.prototype */{\n\n /** This is both a collection and a collection element - call the constructor */\n constructor : function( attributes, options ){\n this.debug( '\\t NestedListDCDCE.constructor:', attributes, options );\n DatasetCollectionElementMixin.constructor.call( this, attributes, options );\n },\n\n /** String representation. */\n toString : function(){\n var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );\n return ([ 'NestedListDCDCE(', objStr, ')' ].join( '' ));\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection containing list dataset collections. */\nvar NestedListDCDCECollection = NestedDCDCECollection.extend({\n\n /** We know this collection is composed of only nested pair collections */\n model: NestedListDCDCE,\n\n /** String representation. */\n toString : function(){\n return ([ 'NestedListDCDCECollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\nvar ListOfListsDatasetCollection = DatasetCollection.extend({\n\n /** list:paired is the only collection that itself contains collections */\n collectionClass : NestedListDCDCECollection,\n\n /** String representation. */\n toString : function(){\n return ([ 'ListOfListsDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n ListDatasetCollection : ListDatasetCollection,\n PairDatasetCollection : PairDatasetCollection,\n ListPairedDatasetCollection : ListPairedDatasetCollection,\n ListOfListsDatasetCollection: ListOfListsDatasetCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-model.js","\ndefine([\n \"mvc/history/hdca-model\",\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"mvc/collection/base-creator\",\n \"mvc/ui/ui-modal\",\n \"utils/natural-sort\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( HDCA, STATES, BASE_MVC, baseCreator, UI_MODAL, naturalSort, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n\n/*==============================================================================\nTODO:\n use proper Element model and not just json\n straighten out createFn, collection.createHDCA\n possibly stop using modals for this\n It would be neat to do a drag and drop\n\n==============================================================================*/\n/** A view for both DatasetDCEs and NestedDCDCEs\n * (things that implement collection-model:DatasetCollectionElementMixin)\n */\nvar DatasetCollectionElementView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n//TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName : 'li',\n className : 'collection-element',\n\n initialize : function( attributes ){\n this.element = attributes.element || {};\n this.selected = attributes.selected || false;\n },\n\n render : function(){\n this.$el\n .attr( 'data-element-id', this.element.id )\n .attr( 'draggable', true )\n .html( this.template({ element: this.element }) );\n if( this.selected ){\n this.$el.addClass( 'selected' );\n }\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template : _.template([\n '',\n '<%- element.name %>',\n '',\n '',\n ].join('')),\n\n /** select this element and pub */\n select : function( toggle ){\n this.$el.toggleClass( 'selected', toggle );\n this.trigger( 'select', {\n source : this,\n selected : this.$el.hasClass( 'selected' )\n });\n },\n\n /** animate the removal of this element and pub */\n discard : function(){\n var view = this,\n parentWidth = this.$el.parent().width();\n this.$el.animate({ 'margin-right' : parentWidth }, 'fast', function(){\n view.trigger( 'discard', {\n source : view\n });\n view.destroy();\n });\n },\n\n /** remove the DOM and any listeners */\n destroy : function(){\n this.off();\n this.$el.remove();\n },\n\n events : {\n 'click' : '_click',\n 'click .name' : '_clickName',\n 'click .discard': '_clickDiscard',\n\n 'dragstart' : '_dragstart',\n 'dragend' : '_dragend',\n 'dragover' : '_sendToParent',\n 'drop' : '_sendToParent'\n },\n\n /** select when the li is clicked */\n _click : function( ev ){\n ev.stopPropagation();\n this.select( ev );\n },\n\n /** rename a pair when the name is clicked */\n _clickName : function( ev ){\n ev.stopPropagation();\n ev.preventDefault();\n var promptString = [ _l( 'Enter a new name for the element' ), ':\\n(',\n _l( 'Note that changing the name here will not rename the dataset' ), ')' ].join( '' ),\n response = prompt( _l( 'Enter a new name for the element' ) + ':', this.element.name );\n if( response ){\n this.element.name = response;\n this.render();\n }\n //TODO: cancelling with ESC leads to closure of the creator...\n },\n\n /** discard when the discard button is clicked */\n _clickDiscard : function( ev ){\n ev.stopPropagation();\n this.discard();\n },\n\n /** dragging pairs for re-ordering */\n _dragstart : function( ev ){\n if( ev.originalEvent ){ ev = ev.originalEvent; }\n ev.dataTransfer.effectAllowed = 'move';\n ev.dataTransfer.setData( 'text/plain', JSON.stringify( this.element ) );\n\n this.$el.addClass( 'dragging' );\n this.$el.parent().trigger( 'collection-element.dragstart', [ this ] );\n },\n\n /** dragging for re-ordering */\n _dragend : function( ev ){\n this.$el.removeClass( 'dragging' );\n this.$el.parent().trigger( 'collection-element.dragend', [ this ] );\n },\n\n /** manually bubble up an event to the parent/container */\n _sendToParent : function( ev ){\n this.$el.parent().trigger( ev );\n },\n\n /** string rep */\n toString : function(){\n return 'DatasetCollectionElementView()';\n }\n});\n\n\n// ============================================================================\n/** An interface for building collections.\n */\nvar ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend( baseCreator.CollectionCreatorMixin ).extend({\n _logNamespace : logNamespace,\n\n /** the class used to display individual elements */\n elementViewClass : DatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass : HDCA.HistoryListDatasetCollection,\n className : 'list-collection-creator collection-creator flex-row-container',\n\n /** minimum number of valid elements to start with in order to build a collection of this type */\n minElements : 1,\n\n defaultAttributes : {\n//TODO: remove - use new collectionClass().save()\n /** takes elements and creates the proper collection - returns a promise */\n creationFn : function(){ throw new TypeError( 'no creation fn for creator' ); },\n /** fn to call when the collection is created (scoped to this) */\n oncreate : function(){},\n /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n oncancel : function(){},\n /** distance from list edge to begin autoscrolling list */\n autoscrollDist : 24,\n /** Color passed to hoverhighlight */\n highlightClr : 'rgba( 64, 255, 255, 1.0 )'\n },\n\n footerSettings : {\n '.hide-originals': 'hideOriginals'\n },\n\n /** set up initial options, instance vars, behaviors */\n initialize : function( attributes ){\n this.metric( 'ListCollectionCreator.initialize', attributes );\n var creator = this;\n _.each( this.defaultAttributes, function( value, key ){\n value = attributes[ key ] || value;\n creator[ key ] = value;\n });\n\n /** unordered, original list - cache to allow reversal */\n creator.initialElements = attributes.elements || [];\n\n this._setUpCommonSettings( attributes );\n this._instanceSetUp();\n this._elementsSetUp();\n this._setUpBehaviors();\n },\n\n /** set up instance vars */\n _instanceSetUp : function(){\n /** Ids of elements that have been selected by the user - to preserve over renders */\n this.selectedIds = {};\n /** DOM elements currently being dragged */\n this.$dragging = null;\n /** Used for blocking UI events during ajax/operations (don't post twice) */\n this.blocking = false;\n },\n\n // ------------------------------------------------------------------------ process raw list\n /** set up main data */\n _elementsSetUp : function(){\n //this.debug( '-- _dataSetUp' );\n /** a list of invalid elements and the reasons they aren't valid */\n this.invalidElements = [];\n//TODO: handle fundamental problem of syncing DOM, views, and list here\n /** data for list in progress */\n this.workingElements = [];\n /** views for workingElements */\n this.elementViews = [];\n\n // copy initial list, sort, add ids if needed\n this.workingElements = this.initialElements.slice( 0 );\n this._ensureElementIds();\n this._validateElements();\n this._mangleDuplicateNames();\n this._sortElements();\n },\n\n /** add ids to dataset objs in initial list if none */\n _ensureElementIds : function(){\n this.workingElements.forEach( function( element ){\n if( !element.hasOwnProperty( 'id' ) ){\n element.id = _.uniqueId();\n }\n });\n return this.workingElements;\n },\n\n /** separate working list into valid and invalid elements for this collection */\n _validateElements : function(){\n var creator = this,\n existingNames = {};\n creator.invalidElements = [];\n\n this.workingElements = this.workingElements.filter( function( element ){\n var problem = creator._isElementInvalid( element );\n if( problem ){\n creator.invalidElements.push({\n element : element,\n text : problem\n });\n }\n return !problem;\n });\n return this.workingElements;\n },\n\n /** describe what is wrong with a particular element if anything */\n _isElementInvalid : function( element ){\n if( element.history_content_type !== 'dataset' ){\n return _l( \"is not a dataset\" );\n }\n var validState = element.state === STATES.OK || _.contains( STATES.NOT_READY_STATES, element.state );\n if( ! validState ){\n return _l( \"has errored, is paused, or is not accessible\" );\n }\n if( element.deleted || element.purged ){\n return _l( \"has been deleted or purged\" );\n }\n return null;\n },\n\n /** mangle duplicate names using a mac-like '(counter)' addition to any duplicates */\n _mangleDuplicateNames : function(){\n var SAFETY = 900,\n counter = 1,\n existingNames = {};\n this.workingElements.forEach( function( element ){\n var currName = element.name;\n while( existingNames.hasOwnProperty( currName ) ){\n currName = element.name + ' (' + counter + ')';\n counter += 1;\n if( counter >= SAFETY ){\n throw new Error( 'Safety hit in while loop - thats impressive' );\n }\n }\n element.name = currName;\n existingNames[ element.name ] = true;\n });\n },\n\n /** sort a list of elements */\n _sortElements : function( list ){\n // // currently only natural sort by name\n // this.workingElements.sort( function( a, b ){ return naturalSort( a.name, b.name ); });\n // return this.workingElements;\n },\n\n // ------------------------------------------------------------------------ rendering\n // templates : ListCollectionCreator.templates,\n /** render the entire interface */\n render : function( speed, callback ){\n //this.debug( '-- _render' );\n if( this.workingElements.length < this.minElements ){\n return this._renderInvalid( speed, callback );\n }\n\n this.$el.empty().html( this.templates.main() );\n this._renderHeader( speed );\n this._renderMiddle( speed );\n this._renderFooter( speed );\n this._addPluginComponents();\n this.$( '.collection-name' ).focus();\n this.trigger( 'rendered', this );\n return this;\n },\n\n\n /** render a simplified interface aimed at telling the user why they can't move forward */\n _renderInvalid : function( speed, callback ){\n //this.debug( '-- _render' );\n this.$el.empty().html( this.templates.invalidInitial({\n problems: this.invalidElements,\n elements: this.workingElements,\n }));\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n this.trigger( 'rendered', this );\n return this;\n },\n\n /** render the header section */\n _renderHeader : function( speed, callback ){\n var $header = this.$( '.header' ).empty().html( this.templates.header() )\n .find( '.help-content' ).prepend( $( this.templates.helpContent() ) );\n //TODO: should only show once despite calling _renderHeader again\n if( this.invalidElements.length ){\n this._invalidElementsAlert();\n }\n return $header;\n },\n\n /** render the middle including the elements */\n _renderMiddle : function( speed, callback ){\n var $middle = this.$( '.middle' ).empty().html( this.templates.middle() );\n this._renderList( speed );\n return $middle;\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents : function(){\n this.$( '.help-content i' ).hoverhighlight( '.collection-creator', this.highlightClr );\n },\n\n /** build and show an alert describing any elements that could not be included due to problems */\n _invalidElementsAlert : function(){\n this._showAlert( this.templates.invalidElements({ problems: this.invalidElements }), 'alert-warning' );\n },\n\n _disableNameAndCreate : function( disable ){\n disable = !_.isUndefined( disable )? disable : true;\n if( disable ){\n this.$( '.collection-name' ).prop( 'disabled', true );\n this.$( '.create-collection' ).toggleClass( 'disabled', true );\n // } else {\n // this.$( '.collection-name' ).prop( 'disabled', false );\n // this.$( '.create-collection' ).removeClass( 'disable' );\n }\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** conv. to the main list display DOM */\n $list : function(){\n return this.$( '.collection-elements' );\n },\n\n /** show or hide the clear selected control based on the num of selected elements */\n _renderClearSelected : function(){\n if( _.size( this.selectedIds ) ){\n this.$( '.collection-elements-controls > .clear-selected' ).show();\n } else {\n this.$( '.collection-elements-controls > .clear-selected' ).hide();\n }\n },\n\n /** render the elements in order (or a warning if no elements found) */\n _renderList : function( speed, callback ){\n //this.debug( '-- _renderList' );\n var creator = this,\n $tmp = jQuery( '
                                                      ' ),\n $list = creator.$list();\n\n _.each( this.elementViews, function( view ){\n view.destroy();\n creator.removeElementView( view );\n });\n\n // if( !this.workingElements.length ){\n // this._renderNoValidElements();\n // return;\n // }\n\n creator.workingElements.forEach( function( element ){\n var elementView = creator._createElementView( element );\n $tmp.append( elementView.$el );\n });\n\n creator._renderClearSelected();\n $list.empty().append( $tmp.children() );\n _.invoke( creator.elementViews, 'render' );\n\n if( $list.height() > $list.css( 'max-height' ) ){\n $list.css( 'border-width', '1px 0px 1px 0px' );\n } else {\n $list.css( 'border-width', '0px' );\n }\n },\n\n /** create an element view, cache in elementViews, set up listeners, and return */\n _createElementView : function( element ){\n var elementView = new this.elementViewClass({\n//TODO: use non-generic class or not all\n // model : COLLECTION.DatasetDCE( element )\n element : element,\n selected: _.has( this.selectedIds, element.id )\n });\n this.elementViews.push( elementView );\n this._listenToElementView( elementView );\n return elementView;\n },\n\n /** listen to any element events */\n _listenToElementView : function( view ){\n var creator = this;\n creator.listenTo( view, {\n select : function( data ){\n var element = data.source.element;\n if( data.selected ){\n creator.selectedIds[ element.id ] = true;\n } else {\n delete creator.selectedIds[ element.id ];\n }\n creator.trigger( 'elements:select', data );\n },\n discard : function( data ){\n creator.trigger( 'elements:discard', data );\n }\n });\n },\n\n /** add a new element view based on the json in element */\n addElementView : function( element ){\n//TODO: workingElements is sorted, add element in appropo index\n // add element, sort elements, find element index\n // var view = this._createElementView( element );\n // return view;\n },\n\n /** stop listening to view and remove from caches */\n removeElementView : function( view ){\n delete this.selectedIds[ view.element.id ];\n this._renderClearSelected();\n\n this.elementViews = _.without( this.elementViews, view );\n this.stopListening( view );\n },\n\n /** render a message in the list that no elements remain to create a collection */\n _renderNoElementsLeft : function(){\n this._disableNameAndCreate( true );\n this.$( '.collection-elements' ).append( this.templates.noElementsLeft() );\n },\n\n // /** render a message in the list that no valid elements were found to create a collection */\n // _renderNoValidElements : function(){\n // this._disableNameAndCreate( true );\n // this.$( '.collection-elements' ).append( this.templates.noValidElements() );\n // },\n\n // ------------------------------------------------------------------------ API\n /** convert element into JSON compatible with the collections API */\n _elementToJSON : function( element ){\n // return element.toJSON();\n return element;\n },\n\n /** create the collection via the API\n * @returns {jQuery.xhr Object} the jquery ajax request\n */\n createList : function( name ){\n if( !this.workingElements.length ){\n var message = _l( 'No valid elements for final list' ) + '. ';\n message += '' + _l( 'Cancel' ) + ' ';\n message += _l( 'or' );\n message += ' ' + _l( 'start over' ) + '.';\n this._showAlert( message );\n return;\n }\n\n var creator = this,\n elements = this.workingElements.map( function( element ){\n return creator._elementToJSON( element );\n });\n\n creator.blocking = true;\n return creator.creationFn( elements, name, creator.hideOriginals )\n .always( function(){\n creator.blocking = false;\n })\n .fail( function( xhr, status, message ){\n creator.trigger( 'error', {\n xhr : xhr,\n status : status,\n message : _l( 'An error occurred while creating this collection' )\n });\n })\n .done( function( response, message, xhr ){\n creator.trigger( 'collection:created', response, message, xhr );\n creator.metric( 'collection:created', response );\n if( typeof creator.oncreate === 'function' ){\n creator.oncreate.call( this, response, message, xhr );\n }\n });\n },\n\n // ------------------------------------------------------------------------ events\n /** set up event handlers on self */\n _setUpBehaviors : function(){\n this.on( 'error', this._errorHandler );\n\n this.once( 'rendered', function(){\n this.trigger( 'rendered:initial', this );\n });\n\n this.on( 'elements:select', function( data ){\n this._renderClearSelected();\n });\n\n this.on( 'elements:discard', function( data ){\n var element = data.source.element;\n this.removeElementView( data.source );\n\n this.workingElements = _.without( this.workingElements, element );\n if( !this.workingElements.length ){\n this._renderNoElementsLeft();\n }\n });\n\n //this.on( 'all', function(){\n // this.info( arguments );\n //});\n return this;\n },\n\n /** handle errors with feedback and details to the user (if available) */\n _errorHandler : function( data ){\n this.error( data );\n\n var creator = this,\n content = data.message || _l( 'An error occurred' );\n if( data.xhr ){\n var xhr = data.xhr,\n message = data.message;\n if( xhr.readyState === 0 && xhr.status === 0 ){\n content += ': ' + _l( 'Galaxy could not be reached and may be updating.' ) +\n _l( ' Try again in a few minutes.' );\n } else if( xhr.responseJSON ){\n content += ':
                                                      ' + JSON.stringify( xhr.responseJSON ) + '
                                                      ';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n events : {\n // header\n 'click .more-help' : '_clickMoreHelp',\n 'click .less-help' : '_clickLessHelp',\n 'click .main-help' : '_toggleHelp',\n 'click .header .alert button' : '_hideAlert',\n\n 'click .reset' : 'reset',\n 'click .clear-selected' : 'clearSelectedElements',\n\n // elements - selection\n 'click .collection-elements' : 'clearSelectedElements',\n\n // elements - drop target\n // 'dragenter .collection-elements': '_dragenterElements',\n // 'dragleave .collection-elements': '_dragleaveElements',\n 'dragover .collection-elements' : '_dragoverElements',\n 'drop .collection-elements' : '_dropElements',\n\n // these bubble up from the elements as custom events\n 'collection-element.dragstart .collection-elements' : '_elementDragstart',\n 'collection-element.dragend .collection-elements' : '_elementDragend',\n\n // footer\n 'change .collection-name' : '_changeName',\n 'keydown .collection-name' : '_nameCheckForEnter',\n 'change .hide-originals' : '_changeHideOriginals',\n 'click .cancel-create' : '_cancelCreate',\n 'click .create-collection' : '_clickCreate'//,\n },\n\n // ........................................................................ elements\n /** reset all data to the initial state */\n reset : function(){\n this._instanceSetUp();\n this._elementsSetUp();\n this.render();\n },\n\n /** deselect all elements */\n clearSelectedElements : function( ev ){\n this.$( '.collection-elements .collection-element' ).removeClass( 'selected' );\n this.$( '.collection-elements-controls > .clear-selected' ).hide();\n },\n\n //_dragenterElements : function( ev ){\n // //this.debug( '_dragenterElements:', ev );\n //},\n//TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n // _dragleaveElements : function( ev ){\n // //this.debug( '_dragleaveElements:', ev );\n // },\n\n /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n _dragoverElements : function( ev ){\n //this.debug( '_dragoverElements:', ev );\n ev.preventDefault();\n\n var $list = this.$list();\n this._checkForAutoscroll( $list, ev.originalEvent.clientY );\n var $nearest = this._getNearestElement( ev.originalEvent.clientY );\n\n //TODO: no need to re-create - move instead\n this.$( '.element-drop-placeholder' ).remove();\n var $placeholder = $( '
                                                      ' );\n if( !$nearest.length ){\n $list.append( $placeholder );\n } else {\n $nearest.before( $placeholder );\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll : function( $element, y ){\n var AUTOSCROLL_SPEED = 2,\n offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = ( offset.top + $element.outerHeight() ) - y;\n if( upperDist >= 0 && upperDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop - AUTOSCROLL_SPEED );\n } else if( lowerDist >= 0 && lowerDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop + AUTOSCROLL_SPEED );\n }\n },\n\n /** get the nearest element based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestElement : function( y ){\n var WIGGLE = 4,\n lis = this.$( '.collection-elements li.collection-element' ).toArray();\n for( var i=0; i y && top - halfHeight < y ){\n return $li;\n }\n }\n return $();\n },\n\n /** drop (dragged/selected elements) onto the list, re-ordering the internal list */\n _dropElements : function( ev ){\n if( ev.originalEvent ){ ev = ev.originalEvent; }\n // both required for firefox\n ev.preventDefault();\n ev.dataTransfer.dropEffect = 'move';\n\n // insert before the nearest element or after the last.\n var $nearest = this._getNearestElement( ev.clientY );\n if( $nearest.length ){\n this.$dragging.insertBefore( $nearest );\n } else {\n // no nearest before - insert after last element\n this.$dragging.insertAfter( this.$( '.collection-elements .collection-element' ).last() );\n }\n // resync the creator's list based on the new DOM order\n this._syncOrderToDom();\n return false;\n },\n\n /** resync the creator's list of elements based on the DOM order */\n _syncOrderToDom : function(){\n var creator = this,\n newElements = [];\n //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n this.$( '.collection-elements .collection-element' ).each( function(){\n var id = $( this ).attr( 'data-element-id' ),\n element = _.findWhere( creator.workingElements, { id: id });\n if( element ){\n newElements.push( element );\n } else {\n console.error( 'missing element: ', id );\n }\n });\n this.workingElements = newElements;\n this._renderList();\n },\n\n /** drag communication with element sub-views: dragstart */\n _elementDragstart : function( ev, element ){\n // auto select the element causing the event and move all selected\n element.select( true );\n this.$dragging = this.$( '.collection-elements .collection-element.selected' );\n },\n\n /** drag communication with element sub-views: dragend - remove the placeholder */\n _elementDragend : function( ev, element ){\n $( '.element-drop-placeholder' ).remove();\n this.$dragging = null;\n },\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates : _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\n /** the header (not including help text) */\n header : _.template([\n '
                                                      ',\n '', _l( 'More help' ), '',\n '
                                                      ',\n '', _l( 'Less' ), '',\n '
                                                      ',\n '
                                                      ',\n '
                                                      ',\n '',\n '',\n '
                                                      ',\n ].join('')),\n\n /** the middle: element list */\n middle : _.template([\n '',\n '
                                                      ',\n '
                                                      '\n ].join('')),\n\n /** creation and cancel controls */\n footer : _.template([\n '
                                                      ',\n '
                                                      ',\n '',\n '
                                                      ',\n '
                                                      ',\n '',\n '
                                                      ', _l( 'Name' ), ':
                                                      ',\n '
                                                      ',\n '
                                                      ',\n\n '
                                                      ',\n '
                                                      ',\n '',\n '
                                                      ',\n '',\n '',\n '
                                                      ',\n '
                                                      ',\n\n '
                                                      ',\n '',\n '
                                                      ',\n '
                                                      '\n ].join('')),\n\n /** help content */\n helpContent : _.template([\n '

                                                      ', _l([\n 'Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ',\n 'workflows in order to have analyses done on each member of the entire group. This interface allows ',\n 'you to create a collection and re-order the final collection.'\n ].join( '' )), '

                                                      ',\n '
                                                        ',\n '
                                                      • ', _l([\n 'Rename elements in the list by clicking on ',\n 'the existing name.'\n ].join( '' )), '
                                                      • ',\n '
                                                      • ', _l([\n 'Discard elements from the final created list by clicking on the ',\n '\"Discard\" button.'\n ].join( '' )), '
                                                      • ',\n '
                                                      • ', _l([\n 'Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ',\n 'them and you can then move those selected by dragging the ',\n 'entire group. Deselect them by clicking them again or by clicking the ',\n 'the \"Clear selected\" link.'\n ].join( '' )), '
                                                      • ',\n '
                                                      • ', _l([\n 'Click the \"Start over\" link to begin again as if you had just opened ',\n 'the interface.'\n ].join( '' )), '
                                                      • ',\n '
                                                      • ', _l([\n 'Click the \"Cancel\" button to exit the interface.'\n ].join( '' )), '
                                                      • ',\n '

                                                      ',\n '

                                                      ', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '

                                                      '\n ].join('')),\n\n /** shown in list when all elements are discarded */\n invalidElements : _.template([\n _l( 'The following selections could not be included due to problems:' ),\n '
                                                        <% _.each( problems, function( problem ){ %>',\n '
                                                      • <%- problem.element.name %>: <%- problem.text %>
                                                      • ',\n '<% }); %>
                                                      '\n ].join('')),\n\n /** shown in list when all elements are discarded */\n noElementsLeft : _.template([\n '
                                                    2. ',\n _l( 'No elements left! ' ),\n _l( 'Would you like to ' ), '', _l( 'start over' ), '?',\n '
                                                    3. '\n ].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial : _.template([\n '
                                                      ',\n '
                                                      ',\n '',\n '<% if( _.size( problems ) ){ %>',\n _l( 'The following selections could not be included due to problems' ), ':',\n '
                                                        <% _.each( problems, function( problem ){ %>',\n '
                                                      • <%- problem.element.name %>: <%- problem.text %>
                                                      • ',\n '<% }); %>
                                                      ',\n '<% } else if( _.size( elements ) < 1 ){ %>',\n _l( 'No datasets were selected' ), '.',\n '<% } %>',\n '
                                                      ',\n _l( 'At least one element is needed for the collection' ), '. ',\n _l( 'You may need to ' ),\n '', _l( 'cancel' ), ' ',\n _l( 'and reselect new elements' ), '.',\n '
                                                      ',\n '
                                                      ',\n '
                                                      ',\n '
                                                      ',\n '
                                                      ',\n '
                                                      ',\n '',\n // _l( 'Create a different kind of collection' ),\n '
                                                      ',\n '
                                                      ',\n '
                                                      '\n ].join('')),\n }),\n\n // ------------------------------------------------------------------------ misc\n /** string rep */\n toString : function(){ return 'ListCollectionCreator'; }\n});\n\n\n\n//=============================================================================\n/** Create a modal and load its body with the given CreatorClass creator type\n * @returns {Deferred} resolved when creator has built a collection.\n */\nvar collectionCreatorModal = function _collectionCreatorModal( elements, options, CreatorClass ){\n\n var deferred = jQuery.Deferred(),\n modal = Galaxy.modal || ( new UI_MODAL.View() ),\n creator;\n\n options = _.defaults( options || {}, {\n elements : elements,\n oncancel : function(){\n modal.hide();\n deferred.reject( 'cancelled' );\n },\n oncreate : function( creator, response ){\n modal.hide();\n deferred.resolve( response );\n }\n });\n\n creator = new CreatorClass( options );\n modal.show({\n title : options.title || _l( 'Create a collection' ),\n body : creator.$el,\n width : '80%',\n height : '100%',\n closing_events: true\n });\n creator.render();\n window._collectionCreator = creator;\n\n //TODO: remove modal header\n return deferred;\n};\n\n/** List collection flavor of collectionCreatorModal. */\nvar listCollectionCreatorModal = function _listCollectionCreatorModal( elements, options ){\n options = options || {};\n options.title = _l( 'Create a collection from a list of datasets' );\n return collectionCreatorModal( elements, options, ListCollectionCreator );\n};\n\n\n//==============================================================================\n/** Use a modal to create a list collection, then add it to the given history contents.\n * @returns {Deferred} resolved when the collection is added to the history.\n */\nfunction createListCollection( contents, defaultHideSourceItems ){\n var elements = contents.toJSON(),\n promise = listCollectionCreatorModal( elements, {\n defaultHideSourceItems: defaultHideSourceItems,\n creationFn : function( elements, name, hideSourceItems ){\n elements = elements.map( function( element ){\n return {\n id : element.id,\n name : element.name,\n //TODO: this allows for list:list even if the filter above does not - reconcile\n src : ( element.history_content_type === 'dataset'? 'hda' : 'hdca' )\n };\n });\n return contents.createHDCA( elements, 'list', name, hideSourceItems );\n }\n });\n return promise;\n}\n\n//==============================================================================\n return {\n DatasetCollectionElementView: DatasetCollectionElementView,\n ListCollectionCreator : ListCollectionCreator,\n\n collectionCreatorModal : collectionCreatorModal,\n listCollectionCreatorModal : listCollectionCreatorModal,\n createListCollection : createListCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/list-collection-creator.js","define([\n \"mvc/list/list-item\",\n \"mvc/dataset/states\",\n \"ui/fa-icon-button\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_ITEM, STATES, faIconButton, BASE_MVC, _l ){\n'use strict';\n\nvar logNamespace = 'dataset';\n/*==============================================================================\nTODO:\n straighten out state rendering and templates used\n inaccessible/STATES.NOT_VIEWABLE is a special case\n simplify button rendering\n\n==============================================================================*/\nvar _super = LIST_ITEM.ListItemView;\n/** @class Read only list view for either LDDAs, HDAs, or HDADCEs.\n * Roughly, any DatasetInstance (and not a raw Dataset).\n */\nvar DatasetListItemView = _super.extend(\n/** @lends DatasetListItemView.prototype */{\n _logNamespace : logNamespace,\n\n className : _super.prototype.className + \" dataset\",\n //TODO:?? doesn't exactly match an hda's type_id\n id : function(){\n return [ 'dataset', this.model.get( 'id' ) ].join( '-' );\n },\n\n /** Set up: instance vars, options, and event handlers */\n initialize : function( attributes ){\n if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }\n this.log( this + '.initialize:', attributes );\n _super.prototype.initialize.call( this, attributes );\n\n /** where should pages from links be displayed? (default to new tab/window) */\n this.linkTarget = attributes.linkTarget || '_blank';\n },\n\n /** event listeners */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n var self = this;\n\n // re-rendering on any model changes\n return self.listenTo( self.model, {\n 'change': function( model ){\n // if the model moved into the ready state and is expanded without details, fetch those details now\n if( self.model.changedAttributes().state &&\n self.model.inReadyState() &&\n self.expanded &&\n !self.model.hasDetails() ){\n // normally, will render automatically (due to fetch -> change),\n // but! setting_metadata sometimes doesn't cause any other changes besides state\n // so, not rendering causes it to seem frozen in setting_metadata state\n self.model.fetch({ silent : true })\n .done( function(){ self.render(); });\n } else {\n if( _.has( model.changed, 'tags' ) && _.keys( model.changed ).length === 1 ){\n // If only the tags have changed, rerender specifically\n // the titlebar region. Otherwise default to the full\n // render.\n self.$( '.nametags' ).html( self._renderNametags() );\n } else {\n self.render();\n }\n }\n }\n });\n },\n\n // ......................................................................... expandable\n /** In this override, only get details if in the ready state, get rerunnable if in other states.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n }\n return jQuery.when();\n },\n\n // ......................................................................... removal\n /** Remove this view's html from the DOM and remove all event listeners.\n * @param {Number or String} speed jq effect speed\n * @param {Function} callback an optional function called when removal is done (scoped to this view)\n */\n remove : function( speed, callback ){\n var view = this;\n speed = speed || this.fxSpeed;\n this.$el.fadeOut( speed, function(){\n Backbone.View.prototype.remove.call( view );\n if( callback ){ callback.call( view ); }\n });\n },\n\n // ......................................................................... rendering\n /* TODO:\n dataset states are the issue primarily making dataset rendering complex\n each state should have it's own way of displaying/set of details\n often with different actions that can be applied\n throw in deleted/purged/visible and things get complicated easily\n I've considered (a couple of times) - creating a view for each state\n - but recreating the view during an update...seems wrong\n */\n /** In this override, add the dataset state as a class for use with state-based CSS */\n _swapNewRender : function( $newRender ){\n _super.prototype._swapNewRender.call( this, $newRender );\n if( this.model.has( 'state' ) ){\n this.$el.addClass( 'state-' + this.model.get( 'state' ) );\n }\n return this.$el;\n },\n\n // ................................................................................ titlebar\n /** In this override, add the dataset display button. */\n _renderPrimaryActions : function(){\n // render just the display for read-only\n return [ this._renderDisplayButton() ];\n },\n\n /** Render icon-button to display dataset data */\n _renderDisplayButton : function(){\n // don't show display if not viewable or not accessible\n var state = this.model.get( 'state' );\n if( ( state === STATES.NOT_VIEWABLE ) ||\n ( state === STATES.DISCARDED ) ||\n ( !this.model.get( 'accessible' ) ) ){\n return null;\n }\n\n var displayBtnData = {\n target : this.linkTarget,\n classes : 'display-btn'\n };\n\n // show a disabled display if the data's been purged\n if( this.model.get( 'purged' ) ){\n displayBtnData.disabled = true;\n displayBtnData.title = _l( 'Cannot display datasets removed from disk' );\n\n // disable if still uploading\n } else if( state === STATES.UPLOAD ){\n displayBtnData.disabled = true;\n displayBtnData.title = _l( 'This dataset must finish uploading before it can be viewed' );\n\n // disable if still new\n } else if( state === STATES.NEW ){\n displayBtnData.disabled = true;\n displayBtnData.title = _l( 'This dataset is not yet viewable' );\n\n } else {\n displayBtnData.title = _l( 'View data' );\n\n // default link for dataset\n displayBtnData.href = this.model.urls.display;\n\n // add frame manager option onclick event\n var self = this;\n displayBtnData.onclick = function( ev ){\n if (Galaxy.frame && Galaxy.frame.active) {\n // Add dataset to frames.\n Galaxy.frame.addDataset(self.model.get('id'));\n ev.preventDefault();\n }\n };\n }\n displayBtnData.faIcon = 'fa-eye';\n return faIconButton( displayBtnData );\n },\n\n // ......................................................................... rendering details\n /** Render the enclosing div of the hda body and, if expanded, the html in the body\n * @returns {jQuery} rendered DOM\n */\n _renderDetails : function(){\n //TODO: generalize to be allow different details for each state\n\n // no access - render nothing but a message\n if( this.model.get( 'state' ) === STATES.NOT_VIEWABLE ){\n return $( this.templates.noAccess( this.model.toJSON(), this ) );\n }\n\n var $details = _super.prototype._renderDetails.call( this );\n $details.find( '.actions .left' ).empty().append( this._renderSecondaryActions() );\n $details.find( '.summary' ).html( this._renderSummary() )\n .prepend( this._renderDetailMessages() );\n $details.find( '.display-applications' ).html( this._renderDisplayApplications() );\n\n this._setUpBehaviors( $details );\n return $details;\n },\n\n /** Defer to the appropo summary rendering fn based on state */\n _renderSummary : function(){\n var json = this.model.toJSON(),\n summaryRenderFn = this.templates.summaries[ json.state ];\n summaryRenderFn = summaryRenderFn || this.templates.summaries.unknown;\n return summaryRenderFn( json, this );\n },\n\n /** Render messages to be displayed only when the details are shown */\n _renderDetailMessages : function(){\n var view = this,\n $warnings = $( '
                                                      ' ),\n json = view.model.toJSON();\n //TODO:! unordered (map)\n _.each( view.templates.detailMessages, function( templateFn ){\n $warnings.append( $( templateFn( json, view ) ) );\n });\n return $warnings;\n },\n\n /** Render the external display application links */\n _renderDisplayApplications : function(){\n if( this.model.isDeletedOrPurged() ){ return ''; }\n // render both old and new display apps using the same template\n return [\n this.templates.displayApplications( this.model.get( 'display_apps' ), this ),\n this.templates.displayApplications( this.model.get( 'display_types' ), this )\n ].join( '' );\n },\n\n // ......................................................................... secondary/details actions\n /** A series of links/buttons for less commonly used actions: re-run, info, etc. */\n _renderSecondaryActions : function(){\n this.debug( '_renderSecondaryActions' );\n switch( this.model.get( 'state' ) ){\n case STATES.NOT_VIEWABLE:\n return [];\n case STATES.OK:\n case STATES.FAILED_METADATA:\n case STATES.ERROR:\n return [ this._renderDownloadButton(), this._renderShowParamsButton() ];\n }\n return [ this._renderShowParamsButton() ];\n },\n\n /** Render icon-button to show the input and output (stdout/err) for the job that created this.\n * @returns {jQuery} rendered DOM\n */\n _renderShowParamsButton : function(){\n // gen. safe to show in all cases\n return faIconButton({\n title : _l( 'View details' ),\n classes : 'params-btn',\n href : this.model.urls.show_params,\n target : this.linkTarget,\n faIcon : 'fa-info-circle',\n onclick : function( ev ) {\n if ( Galaxy.frame && Galaxy.frame.active ) {\n Galaxy.frame.add( { title: 'Dataset details', url: this.href } );\n ev.preventDefault();\n ev.stopPropagation();\n }\n }\n });\n },\n\n\n /** Render icon-button/popupmenu to download the data (and/or the associated meta files (bai, etc.)) for this.\n * @returns {jQuery} rendered DOM\n */\n _renderDownloadButton : function(){\n // don't show anything if the data's been purged\n if( this.model.get( 'purged' ) || !this.model.hasData() ){ return null; }\n\n // return either: a popupmenu with links to download assoc. meta files (if there are meta files)\n // or a single download icon-button (if there are no meta files)\n if( !_.isEmpty( this.model.get( 'meta_files' ) ) ){\n return this._renderMetaFileDownloadButton();\n }\n\n return $([\n '',\n '',\n ''\n ].join( '' ));\n },\n\n /** Render the download button which opens a dropdown with links to download assoc. meta files (indeces, etc.) */\n _renderMetaFileDownloadButton : function(){\n var urls = this.model.urls;\n return $([\n '
                                                      ',\n '',\n '',\n '',\n '',\n '
                                                      '\n ].join( '\\n' ));\n },\n\n _renderNametags : function(){\n var tpl = _.template([\n '<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>',\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n '<% } %>',\n '<% }); %>'].join(''));\n return tpl({tags: this.model.get('tags')});\n },\n\n // ......................................................................... misc\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .display-btn' : function( ev ){ this.trigger( 'display', this, ev ); },\n 'click .params-btn' : function( ev ){ this.trigger( 'params', this, ev ); },\n 'click .download-btn' : function( ev ){ this.trigger( 'download', this, ev ); }\n }),\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DatasetListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetListItemView.prototype.templates = (function(){\n//TODO: move to require text! plugin\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n failed_metadata : BASE_MVC.wrapTemplate([\n // failed metadata is rendered as a warning on an otherwise ok dataset view\n '<% if( model.state === \"failed_metadata\" ){ %>',\n '
                                                      ',\n _l( 'An error occurred setting the metadata for this dataset' ),\n '
                                                      ',\n '<% } %>'\n ]),\n error : BASE_MVC.wrapTemplate([\n // error during index fetch - show error on dataset\n '<% if( model.error ){ %>',\n '
                                                      ',\n _l( 'There was an error getting the data for this dataset' ), ': <%- model.error %>',\n '
                                                      ',\n '<% } %>'\n ]),\n purged : BASE_MVC.wrapTemplate([\n '<% if( model.purged ){ %>',\n '
                                                      ',\n _l( 'This dataset has been deleted and removed from disk' ),\n '
                                                      ',\n '<% } %>'\n ]),\n deleted : BASE_MVC.wrapTemplate([\n // deleted not purged\n '<% if( model.deleted && !model.purged ){ %>',\n '
                                                      ',\n _l( 'This dataset has been deleted' ),\n '
                                                      ',\n '<% } %>'\n ])\n\n //NOTE: hidden warning is only needed for HDAs\n });\n\n var detailsTemplate = BASE_MVC.wrapTemplate([\n '
                                                      ',\n '
                                                      ',\n\n '
                                                      ',\n '
                                                      ',\n '
                                                      ',\n '
                                                      ',\n\n // do not display tags, annotation, display apps, or peek when deleted\n '<% if( !dataset.deleted && !dataset.purged ){ %>',\n '
                                                      ',\n '
                                                      ',\n\n '
                                                      ',\n\n '<% if( dataset.peek ){ %>',\n '
                                                      <%= dataset.peek %>
                                                      ',\n '<% } %>',\n '<% } %>',\n '
                                                      '\n ], 'dataset' );\n\n var noAccessTemplate = BASE_MVC.wrapTemplate([\n '
                                                      ',\n '
                                                      ',\n _l( 'You do not have permission to view this dataset' ),\n '
                                                      ',\n '
                                                      '\n ], 'dataset' );\n\n//TODO: still toooooooooooooo complex - rework\n var summaryTemplates = {};\n summaryTemplates[ STATES.OK ] = summaryTemplates[ STATES.FAILED_METADATA ] = BASE_MVC.wrapTemplate([\n '<% if( dataset.misc_blurb ){ %>',\n '
                                                      ',\n '<%- dataset.misc_blurb %>',\n '
                                                      ',\n '<% } %>',\n\n '<% if( dataset.file_ext ){ %>',\n '
                                                      ',\n '',\n '<%- dataset.file_ext %>',\n '
                                                      ',\n '<% } %>',\n\n '<% if( dataset.metadata_dbkey ){ %>',\n '
                                                      ',\n '',\n '',\n '<%- dataset.metadata_dbkey %>',\n '',\n '
                                                      ',\n '<% } %>',\n\n '<% if( dataset.misc_info ){ %>',\n '
                                                      ',\n '<%- dataset.misc_info %>',\n '
                                                      ',\n '<% } %>'\n ], 'dataset' );\n summaryTemplates[ STATES.NEW ] = BASE_MVC.wrapTemplate([\n '
                                                      ', _l( 'This is a new dataset and not all of its data are available yet' ), '
                                                      '\n ], 'dataset' );\n summaryTemplates[ STATES.NOT_VIEWABLE ] = BASE_MVC.wrapTemplate([\n '
                                                      ', _l( 'You do not have permission to view this dataset' ), '
                                                      '\n ], 'dataset' );\n summaryTemplates[ STATES.DISCARDED ] = BASE_MVC.wrapTemplate([\n '
                                                      ', _l( 'The job creating this dataset was cancelled before completion' ), '
                                                      '\n ], 'dataset' );\n summaryTemplates[ STATES.QUEUED ] = BASE_MVC.wrapTemplate([\n '
                                                      ', _l( 'This job is waiting to run' ), '
                                                      '\n ], 'dataset' );\n summaryTemplates[ STATES.RUNNING ] = BASE_MVC.wrapTemplate([\n '
                                                      ', _l( 'This job is currently running' ), '
                                                      '\n ], 'dataset' );\n summaryTemplates[ STATES.UPLOAD ] = BASE_MVC.wrapTemplate([\n '
                                                      ', _l( 'This dataset is currently uploading' ), '
                                                      '\n ], 'dataset' );\n summaryTemplates[ STATES.SETTING_METADATA ] = BASE_MVC.wrapTemplate([\n '
                                                      ', _l( 'Metadata is being auto-detected' ), '
                                                      '\n ], 'dataset' );\n summaryTemplates[ STATES.PAUSED ] = BASE_MVC.wrapTemplate([\n '
                                                      ', _l( 'This job is paused. Use the \"Resume Paused Jobs\" in the history menu to resume' ), '
                                                      '\n ], 'dataset' );\n summaryTemplates[ STATES.ERROR ] = BASE_MVC.wrapTemplate([\n '<% if( !dataset.purged ){ %>',\n '
                                                      <%- dataset.misc_blurb %>
                                                      ',\n '<% } %>',\n '', _l( 'An error occurred with this dataset' ), ':',\n '
                                                      <%- dataset.misc_info %>
                                                      '\n ], 'dataset' );\n summaryTemplates[ STATES.EMPTY ] = BASE_MVC.wrapTemplate([\n '
                                                      ', _l( 'No data' ), ': <%- dataset.misc_blurb %>
                                                      '\n ], 'dataset' );\n summaryTemplates.unknown = BASE_MVC.wrapTemplate([\n '
                                                      Error: unknown dataset state: \"<%- dataset.state %>\"
                                                      '\n ], 'dataset' );\n\n // messages to be displayed only within the details section ('below the fold')\n var detailMessageTemplates = {\n resubmitted : BASE_MVC.wrapTemplate([\n // deleted not purged\n '<% if( model.resubmitted ){ %>',\n '
                                                      ',\n _l( 'The job creating this dataset has been resubmitted' ),\n '
                                                      ',\n '<% } %>'\n ])\n };\n\n // this is applied to both old and new style display apps\n var displayApplicationsTemplate = BASE_MVC.wrapTemplate([\n '<% _.each( apps, function( app ){ %>',\n '
                                                      ',\n '<%- app.label %> ',\n '',\n '<% _.each( app.links, function( link ){ %>',\n '\" href=\"<%- link.href %>\">',\n '<% print( _l( link.text ) ); %>',\n ' ',\n '<% }); %>',\n '',\n '
                                                      ',\n '<% }); %>'\n ], 'apps' );\n\n return _.extend( {}, _super.prototype.templates, {\n warnings : warnings,\n details : detailsTemplate,\n noAccess : noAccessTemplate,\n summaries : summaryTemplates,\n detailMessages : detailMessageTemplates,\n displayApplications : displayApplicationsTemplate\n });\n}());\n\n\n// ============================================================================\n return {\n DatasetListItemView : DatasetListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-li.js","/** Generic form view */\ndefine( [ 'mvc/form/form-view', 'mvc/ui/ui-misc' ], function( Form, Ui ) {\n\n var View = Backbone.View.extend({\n\n initialize: function( options ) {\n this.model = new Backbone.Model( options );\n this.url = this.model.get( 'url' );\n this.redirect = this.model.get( 'redirect' );\n this.setElement( '
                                                      ' );\n this.render();\n },\n\n render: function() {\n var self = this;\n $.ajax({\n url : Galaxy.root + this.url,\n type : 'GET'\n }).done( function( response ) {\n var options = $.extend( {}, self.model.attributes, response );\n var form = new Form({\n title : options.title,\n message: options.message,\n status : options.status || 'warning',\n icon : options.icon,\n inputs : options.inputs,\n buttons: {\n 'submit': new Ui.Button({\n tooltip : options.submit_tooltip,\n title : options.submit_title || 'Save',\n icon : options.submit_icon || 'fa-save',\n cls : 'btn btn-primary ui-clear-float',\n onclick : function() { self._submit( form ) }\n })\n }\n });\n self.$el.empty().append( form.$el );\n }).fail( function( response ) {\n self.$el.empty().append( new Ui.Message({\n message : 'Failed to load resource ' + self.url + '.',\n status : 'danger',\n persistent : true\n }).$el );\n });\n },\n\n _submit: function( form ) {\n var self = this;\n $.ajax( {\n url : Galaxy.root + self.url,\n data : JSON.stringify( form.data.create() ),\n type : 'PUT',\n contentType : 'application/json'\n }).done( function( response ) {\n var success_message = { message: response.message, status: 'success', persistent: false };\n if ( self.redirect ) {\n window.location = Galaxy.root + self.redirect + '?' + $.param( success_message );\n } else {\n form.data.matchModel( response, function ( input, input_id ) {\n form.field_list[ input_id ].value( input.value );\n });\n self._showMessage( form, success_message );\n }\n }).fail( function( response ) {\n self._showMessage( form, { message: response.responseJSON.err_msg, status: 'danger', persistent: false } );\n });\n },\n\n _showMessage: function( form, options ) {\n var $panel = form.$el.parents().filter(function() {\n return [ 'auto', 'scroll' ].indexOf( $( this ).css( 'overflow' ) ) != -1;\n }).first();\n $panel.animate( { scrollTop : 0 }, 500 );\n form.message.update( options );\n }\n });\n\n return {\n View : View\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/form/form-wrapper.js","define([\n \"mvc/collection/collection-model\",\n \"mvc/history/history-content-model\",\n \"utils/localization\"\n], function( DC_MODEL, HISTORY_CONTENT, _l ){\n\n'use strict';\n\n/*==============================================================================\n\nModels for DatasetCollections contained within a history.\n\nTODO:\n these might be compactable to one class if some duplication with\n collection-model is used.\n\n==============================================================================*/\nvar hcontentMixin = HISTORY_CONTENT.HistoryContentMixin,\n ListDC = DC_MODEL.ListDatasetCollection,\n PairDC = DC_MODEL.PairDatasetCollection,\n ListPairedDC = DC_MODEL.ListPairedDatasetCollection,\n ListOfListsDC = DC_MODEL.ListOfListsDatasetCollection;\n\n//==============================================================================\n/** Override to post to contents route w/o id. */\nfunction buildHDCASave( _super ){\n return function _save( attributes, options ){\n if( this.isNew() ){\n options = options || {};\n options.url = this.urlRoot + this.get( 'history_id' ) + '/contents';\n attributes = attributes || {};\n attributes.type = 'dataset_collection';\n }\n return _super.call( this, attributes, options );\n };\n}\n\n\n//==============================================================================\n/** @class Backbone model for List Dataset Collection within a History.\n */\nvar HistoryListDatasetCollection = ListDC.extend( hcontentMixin ).extend(\n/** @lends HistoryListDatasetCollection.prototype */{\n\n defaults : _.extend( _.clone( ListDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'list',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( ListDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return 'History' + ListDC.prototype.toString.call( this );\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for Pair Dataset Collection within a History.\n * @constructs\n */\nvar HistoryPairDatasetCollection = PairDC.extend( hcontentMixin ).extend(\n/** @lends HistoryPairDatasetCollection.prototype */{\n\n defaults : _.extend( _.clone( PairDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'paired',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( PairDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return 'History' + PairDC.prototype.toString.call( this );\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for List of Pairs Dataset Collection within a History. */\nvar HistoryListPairedDatasetCollection = ListPairedDC.extend( hcontentMixin ).extend({\n\n defaults : _.extend( _.clone( ListPairedDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'list:paired',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( ListPairedDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return 'History' + ListPairedDC.prototype.toString.call( this );\n }\n});\n\n\n//==============================================================================\n/** @class Backbone model for List of Lists Dataset Collection within a History. */\nvar HistoryListOfListsDatasetCollection = ListOfListsDC.extend( hcontentMixin ).extend({\n\n defaults : _.extend( _.clone( ListOfListsDC.prototype.defaults ), {\n history_content_type: 'dataset_collection',\n collection_type : 'list:list',\n model_class : 'HistoryDatasetCollectionAssociation'\n }),\n\n /** Override to post to contents route w/o id. */\n save : buildHDCASave( ListOfListsDC.prototype.save ),\n\n /** String representation. */\n toString : function(){\n return ([ 'HistoryListOfListsDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n HistoryListDatasetCollection : HistoryListDatasetCollection,\n HistoryPairDatasetCollection : HistoryPairDatasetCollection,\n HistoryListPairedDatasetCollection : HistoryListPairedDatasetCollection,\n HistoryListOfListsDatasetCollection : HistoryListOfListsDatasetCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hdca-model.js","define([\n \"mvc/base/controlled-fetch-collection\",\n \"mvc/history/hda-model\",\n \"mvc/history/hdca-model\",\n \"mvc/history/history-preferences\",\n \"mvc/base-mvc\",\n \"utils/ajax-queue\"\n], function( CONTROLLED_FETCH_COLLECTION, HDA_MODEL, HDCA_MODEL, HISTORY_PREFS, BASE_MVC, AJAX_QUEUE ){\n'use strict';\n\n//==============================================================================\nvar _super = CONTROLLED_FETCH_COLLECTION.PaginatedCollection;\n/** @class Backbone collection for history content.\n * NOTE: history content seems like a dataset collection, but differs in that it is mixed:\n * each element can be either an HDA (dataset) or a DatasetCollection and co-exist on\n * the same level.\n * Dataset collections on the other hand are not mixed and (so far) can only contain either\n * HDAs or child dataset collections on one level.\n * This is why this does not inherit from any of the DatasetCollections (currently).\n */\nvar HistoryContents = _super.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : 'history',\n\n // ........................................................................ composite collection\n /** since history content is a mix, override model fn into a factory, creating based on history_content_type */\n model : function( attrs, options ) {\n if( attrs.history_content_type === \"dataset\" ) {\n return new HDA_MODEL.HistoryDatasetAssociation( attrs, options );\n\n } else if( attrs.history_content_type === \"dataset_collection\" ) {\n switch( attrs.collection_type ){\n case 'list':\n return new HDCA_MODEL.HistoryListDatasetCollection( attrs, options );\n case 'paired':\n return new HDCA_MODEL.HistoryPairDatasetCollection( attrs, options );\n case 'list:paired':\n return new HDCA_MODEL.HistoryListPairedDatasetCollection( attrs, options );\n case 'list:list':\n return new HDCA_MODEL.HistoryListOfListsDatasetCollection( attrs, options );\n }\n // This is a hack inside a hack:\n // Raise a plain object with validationError to fake a model.validationError\n // (since we don't have a model to use validate with)\n // (the outer hack being the mixed content/model function in this collection)\n var msg = 'Unknown collection_type: ' + attrs.collection_type;\n console.warn( msg, attrs );\n return { validationError : msg };\n }\n return { validationError : 'Unknown history_content_type: ' + attrs.history_content_type };\n },\n\n // ........................................................................ set up\n limitPerPage : 500,\n\n /** @type {Integer} how many contents per call to fetch when using progressivelyFetchDetails */\n limitPerProgressiveFetch : 500,\n\n /** @type {String} order used here and when fetching from server */\n order : 'hid',\n\n /** root api url */\n urlRoot : Galaxy.root + 'api/histories',\n\n /** complete api url */\n url : function(){\n return this.urlRoot + '/' + this.historyId + '/contents';\n },\n\n /** Set up */\n initialize : function( models, options ){\n options = options || {};\n _super.prototype.initialize.call( this, models, options );\n\n this.history = options.history || null;\n this.setHistoryId( options.historyId || null );\n /** @type {Boolean} does this collection contain and fetch deleted elements */\n this.includeDeleted = options.includeDeleted || this.includeDeleted;\n /** @type {Boolean} does this collection contain and fetch non-visible elements */\n this.includeHidden = options.includeHidden || this.includeHidden;\n\n // backbonejs uses collection.model.prototype.idAttribute to determine if a model is *already* in a collection\n // and either merged or replaced. In this case, our 'model' is a function so we need to add idAttribute\n // manually here - if we don't, contents will not merge but be replaced/swapped.\n this.model.prototype.idAttribute = 'type_id';\n },\n\n setHistoryId : function( newId ){\n this.historyId = newId;\n this._setUpWebStorage();\n },\n\n /** Set up client side storage. Currently PersistanStorage keyed under 'history:' */\n _setUpWebStorage : function( initialSettings ){\n // TODO: use initialSettings\n if( !this.historyId ){ return; }\n this.storage = new HISTORY_PREFS.HistoryPrefs({\n id: HISTORY_PREFS.HistoryPrefs.historyStorageKey( this.historyId )\n });\n this.trigger( 'new-storage', this.storage, this );\n\n this.on({\n 'include-deleted' : function( newVal ){\n this.storage.includeDeleted( newVal );\n },\n 'include-hidden' : function( newVal ){\n this.storage.includeHidden( newVal );\n }\n });\n\n this.includeDeleted = this.storage.includeDeleted() || false;\n this.includeHidden = this.storage.includeHidden() || false;\n return this;\n },\n\n // ........................................................................ common queries\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators : _.extend( _.clone( _super.prototype.comparators ), {\n 'name' : BASE_MVC.buildComparator( 'name', { ascending: true }),\n 'name-dsc' : BASE_MVC.buildComparator( 'name', { ascending: false }),\n 'hid' : BASE_MVC.buildComparator( 'hid', { ascending: false }),\n 'hid-asc' : BASE_MVC.buildComparator( 'hid', { ascending: true }),\n }),\n\n /** Get every model in this collection not in a 'ready' state (running). */\n running : function(){\n return this.filter( function( c ){ return !c.inReadyState(); });\n },\n\n /** return contents that are not ready and not deleted/hidden */\n runningAndActive : function(){\n return this.filter( function( c ){\n return ( !c.inReadyState() )\n && ( c.get( 'visible' ) )\n // TODO: deletedOrPurged?\n && ( !c.get( 'deleted' ) );\n });\n },\n\n /** Get the model with the given hid\n * @param {Int} hid the hid to search for\n * @returns {HistoryDatasetAssociation} the model with the given hid or undefined if not found\n */\n getByHid : function( hid ){\n // note: there *can* be more than one content with a given hid, this finds the first based on order\n return this.findWhere({ hid: hid });\n },\n\n /** return true if all contents have details */\n haveDetails : function(){\n return this.all( function( c ){ return c.hasDetails(); });\n },\n\n // ........................................................................ hidden / deleted\n /** return a new contents collection of only hidden items */\n hidden : function(){\n return this.filter( function( c ){ return c.hidden(); });\n },\n\n /** return a new contents collection of only hidden items */\n deleted : function(){\n return this.filter( function( c ){ return c.get( 'deleted' ); });\n },\n\n /** return a new contents collection of only hidden items */\n visibleAndUndeleted : function(){\n return this.filter( function( c ){\n return ( c.get( 'visible' ) )\n // TODO: deletedOrPurged?\n && ( !c.get( 'deleted' ) );\n });\n },\n\n /** create a setter in order to publish the change */\n setIncludeDeleted : function( setting, options ){\n if( _.isBoolean( setting ) && setting !== this.includeDeleted ){\n this.includeDeleted = setting;\n if( _.result( options, 'silent' ) ){ return; }\n this.trigger( 'include-deleted', setting, this );\n }\n },\n\n /** create a setter in order to publish the change */\n setIncludeHidden : function( setting, options ){\n if( _.isBoolean( setting ) && setting !== this.includeHidden ){\n this.includeHidden = setting;\n options = options || {};\n if( _.result( options, 'silent' ) ){ return; }\n this.trigger( 'include-hidden', setting, this );\n }\n },\n\n // ........................................................................ ajax\n // ............ controlled fetch collection\n /** override to get expanded ids from sessionStorage and pass to API as details */\n fetch : function( options ){\n options = options || {};\n if( this.historyId && !options.details ){\n var prefs = HISTORY_PREFS.HistoryPrefs.get( this.historyId ).toJSON();\n if( !_.isEmpty( prefs.expandedIds ) ){\n options.details = _.values( prefs.expandedIds ).join( ',' );\n }\n }\n return _super.prototype.fetch.call( this, options );\n },\n\n // ............. ControlledFetch stuff\n /** override to include the API versioning flag */\n _buildFetchData : function( options ){\n return _.extend( _super.prototype._buildFetchData.call( this, options ), {\n v : 'dev'\n });\n },\n\n /** Extend to include details and version */\n _fetchParams : _super.prototype._fetchParams.concat([\n // TODO: remove (the need for) both\n /** version */\n 'v',\n /** dataset ids to get full details of */\n 'details',\n ]),\n\n /** override to add deleted/hidden filters */\n _buildFetchFilters : function( options ){\n var superFilters = _super.prototype._buildFetchFilters.call( this, options ) || {};\n var filters = {};\n if( !this.includeDeleted ){\n filters.deleted = false;\n filters.purged = false;\n }\n if( !this.includeHidden ){\n filters.visible = true;\n }\n return _.defaults( superFilters, filters );\n },\n\n // ............ paginated collection\n getTotalItemCount : function(){\n return this.history.contentsShown();\n },\n\n // ............ history contents specific ajax\n /** override to filter requested contents to those updated after the Date 'since' */\n fetchUpdated : function( since, options ){\n if( since ){\n options = options || { filters: {} };\n options.remove = false;\n options.filters = {\n 'update_time-ge' : since.toISOString(),\n // workflows will produce hidden datasets (non-output datasets) that still\n // need to be updated in the collection or they'll update forever\n // we can remove the default visible filter by using an 'empty' value\n visible : ''\n };\n }\n return this.fetch( options );\n },\n\n /** fetch all the deleted==true contents of this collection */\n fetchDeleted : function( options ){\n options = options || {};\n var self = this;\n options.filters = _.extend( options.filters, {\n // all deleted, purged or not\n deleted : true,\n purged : undefined\n });\n options.remove = false;\n\n self.trigger( 'fetching-deleted', self );\n return self.fetch( options )\n .always( function(){ self.trigger( 'fetching-deleted-done', self ); });\n },\n\n /** fetch all the visible==false contents of this collection */\n fetchHidden : function( options ){\n options = options || {};\n var self = this;\n options.filters = _.extend( options.filters, {\n visible : false\n });\n options.remove = false;\n\n self.trigger( 'fetching-hidden', self );\n return self.fetch( options )\n .always( function(){ self.trigger( 'fetching-hidden-done', self ); });\n },\n\n /** fetch detailed model data for all contents in this collection */\n fetchAllDetails : function( options ){\n options = options || {};\n var detailsFlag = { details: 'all' };\n options.data = _.extend( options.data || {}, detailsFlag );\n return this.fetch( options );\n },\n\n /** specialty fetch method for retrieving the element_counts of all hdcas in the history */\n fetchCollectionCounts : function( options ){\n options = options || {};\n options.keys = [ 'type_id', 'element_count' ].join( ',' );\n options.filters = _.extend( options.filters || {}, {\n history_content_type: 'dataset_collection',\n });\n options.remove = false;\n return this.fetch( options );\n },\n\n // ............. quasi-batch ops\n // TODO: to batch\n /** helper that fetches using filterParams then calls save on each fetched using updateWhat as the save params */\n _filterAndUpdate : function( filterParams, updateWhat ){\n var self = this;\n var idAttribute = self.model.prototype.idAttribute;\n var updateArgs = [ updateWhat ];\n\n return self.fetch({ filters: filterParams, remove: false })\n .then( function( fetched ){\n // convert filtered json array to model array\n fetched = fetched.reduce( function( modelArray, currJson, i ){\n var model = self.get( currJson[ idAttribute ] );\n return model? modelArray.concat( model ) : modelArray;\n }, []);\n return self.ajaxQueue( 'save', updateArgs, fetched );\n });\n },\n\n /** using a queue, perform ajaxFn on each of the models in this collection */\n ajaxQueue : function( ajaxFn, args, collection ){\n collection = collection || this.models;\n return new AJAX_QUEUE.AjaxQueue( collection.slice().reverse().map( function( content, i ){\n var fn = _.isString( ajaxFn )? content[ ajaxFn ] : ajaxFn;\n return function(){ return fn.apply( content, args ); };\n })).deferred;\n },\n\n /** fetch contents' details in batches of limitPerCall - note: only get searchable details here */\n progressivelyFetchDetails : function( options ){\n options = options || {};\n var deferred = jQuery.Deferred();\n var self = this;\n var limit = options.limitPerCall || self.limitPerProgressiveFetch;\n // TODO: only fetch tags and annotations if specifically requested\n var searchAttributes = HDA_MODEL.HistoryDatasetAssociation.prototype.searchAttributes;\n var detailKeys = searchAttributes.join( ',' );\n\n function _recursivelyFetch( offset ){\n offset = offset || 0;\n var _options = _.extend( _.clone( options ), {\n view : 'summary',\n keys : detailKeys,\n limit : limit,\n offset : offset,\n reset : offset === 0,\n remove : false\n });\n\n _.defer( function(){\n self.fetch.call( self, _options )\n .fail( deferred.reject )\n .done( function( response ){\n deferred.notify( response, limit, offset );\n if( response.length !== limit ){\n self.allFetched = true;\n deferred.resolve( response, limit, offset );\n\n } else {\n _recursivelyFetch( offset + limit );\n }\n });\n });\n }\n _recursivelyFetch();\n return deferred;\n },\n\n /** does some bit of JSON represent something that can be copied into this contents collection */\n isCopyable : function( contentsJSON ){\n var copyableModelClasses = [\n 'HistoryDatasetAssociation',\n 'HistoryDatasetCollectionAssociation'\n ];\n return ( ( _.isObject( contentsJSON ) && contentsJSON.id )\n && ( _.contains( copyableModelClasses, contentsJSON.model_class ) ) );\n },\n\n /** copy an existing, accessible hda into this collection */\n copy : function( json ){\n // TODO: somehow showhorn all this into 'save'\n var id, type, contentType;\n if( _.isString( json ) ){\n id = json;\n contentType = 'hda';\n type = 'dataset';\n } else {\n id = json.id;\n contentType = ({\n 'HistoryDatasetAssociation' : 'hda',\n 'LibraryDatasetDatasetAssociation' : 'ldda',\n 'HistoryDatasetCollectionAssociation' : 'hdca'\n })[ json.model_class ] || 'hda';\n type = ( contentType === 'hdca'? 'dataset_collection' : 'dataset' );\n }\n var collection = this,\n xhr = jQuery.ajax( this.url(), {\n method: 'POST',\n contentType: 'application/json',\n data: JSON.stringify({\n content : id,\n source : contentType,\n type : type\n })\n })\n .done( function( response ){\n collection.add([ response ], { parse: true });\n })\n .fail( function( error, status, message ){\n collection.trigger( 'error', collection, xhr, {},\n 'Error copying contents', { type: type, id: id, source: contentType });\n });\n return xhr;\n },\n\n /** create a new HDCA in this collection */\n createHDCA : function( elementIdentifiers, collectionType, name, hideSourceItems, options ){\n // normally collection.create returns the new model, but we need the promise from the ajax, so we fake create\n //precondition: elementIdentifiers is an array of plain js objects\n // in the proper form to create the collectionType\n var hdca = this.model({\n history_content_type: 'dataset_collection',\n collection_type : collectionType,\n history_id : this.historyId,\n name : name,\n hide_source_items : hideSourceItems || false,\n // should probably be able to just send in a bunch of json here and restruct per class\n // note: element_identifiers is now (incorrectly) an attribute\n element_identifiers : elementIdentifiers\n // do not create the model on the client until the ajax returns\n });\n return hdca.save( options );\n },\n\n // ........................................................................ searching\n /** return true if all contents have the searchable attributes */\n haveSearchDetails : function(){\n return this.allFetched && this.all( function( content ){\n // null (which is a valid returned annotation value)\n // will return false when using content.has( 'annotation' )\n //TODO: a bit hacky - formalize\n return _.has( content.attributes, 'annotation' );\n });\n },\n\n /** return a new collection of contents whose attributes contain the substring matchesWhat */\n matches : function( matchesWhat ){\n return this.filter( function( content ){\n return content.matches( matchesWhat );\n });\n },\n\n // ........................................................................ misc\n /** In this override, copy the historyId to the clone */\n clone : function(){\n var clone = Backbone.Collection.prototype.clone.call( this );\n clone.historyId = this.historyId;\n return clone;\n },\n\n /** String representation. */\n toString : function(){\n return ([ 'HistoryContents(', [ this.historyId, this.length ].join(), ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n HistoryContents : HistoryContents\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-contents.js","\ndefine([\n \"mvc/history/history-contents\",\n \"mvc/history/history-preferences\",\n \"mvc/base/controlled-fetch-collection\",\n \"utils/utils\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( HISTORY_CONTENTS, HISTORY_PREFS, CONTROLLED_FETCH_COLLECTION, UTILS, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\n/** @class Model for a Galaxy history resource - both a record of user\n * tool use and a collection of the datasets those tools produced.\n * @name History\n * @augments Backbone.Model\n */\nvar History = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( BASE_MVC.mixin( BASE_MVC.SearchableModelMixin, /** @lends History.prototype */{\n _logNamespace : 'history',\n\n /** ms between fetches when checking running jobs/datasets for updates */\n UPDATE_DELAY : 4000,\n\n // values from api (may need more)\n defaults : {\n model_class : 'History',\n id : null,\n name : 'Unnamed History',\n state : 'new',\n\n deleted : false,\n contents_active : {},\n contents_states : {},\n },\n\n urlRoot: Galaxy.root + 'api/histories',\n\n contentsClass : HISTORY_CONTENTS.HistoryContents,\n\n /** What model fields to search with */\n searchAttributes : [\n 'name', 'annotation', 'tags'\n ],\n\n /** Adding title and singular tag */\n searchAliases : {\n title : 'name',\n tag : 'tags'\n },\n\n // ........................................................................ set up/tear down\n /** Set up the model\n * @param {Object} historyJSON model data for this History\n * @param {Object} options any extra settings including logger\n */\n initialize : function( historyJSON, options ){\n options = options || {};\n this.logger = options.logger || null;\n this.log( this + \".initialize:\", historyJSON, options );\n\n /** HistoryContents collection of the HDAs contained in this history. */\n this.contents = new this.contentsClass( [], {\n history : this,\n historyId : this.get( 'id' ),\n order : options.order,\n });\n\n this._setUpListeners();\n this._setUpCollectionListeners();\n\n /** cached timeout id for the dataset updater */\n this.updateTimeoutId = null;\n },\n\n /** set up any event listeners for this history including those to the contained HDAs\n * events: error:contents if an error occurred with the contents collection\n */\n _setUpListeners : function(){\n // if the model's id changes ('current' or null -> an actual id), update the contents history_id\n return this.on({\n 'error' : function( model, xhr, options, msg, details ){\n this.clearUpdateTimeout();\n },\n 'change:id' : function( model, newId ){\n if( this.contents ){\n this.contents.historyId = newId;\n }\n },\n });\n },\n\n /** event handlers for the contents submodels */\n _setUpCollectionListeners : function(){\n if( !this.contents ){ return this; }\n // bubble up errors\n return this.listenTo( this.contents, {\n 'error' : function(){\n this.trigger.apply( this, jQuery.makeArray( arguments ) );\n },\n });\n },\n\n // ........................................................................ derived attributes\n /** */\n contentsShown : function(){\n var contentsActive = this.get( 'contents_active' );\n var shown = contentsActive.active || 0;\n shown += this.contents.includeDeleted? contentsActive.deleted : 0;\n shown += this.contents.includeHidden? contentsActive.hidden : 0;\n return shown;\n },\n\n /** convert size in bytes to a more human readable version */\n nice_size : function(){\n var size = this.get( 'size' );\n return size? UTILS.bytesToString( size, true, 2 ) : _l( '(empty)' );\n },\n\n /** override to add nice_size */\n toJSON : function(){\n return _.extend( Backbone.Model.prototype.toJSON.call( this ), {\n nice_size : this.nice_size()\n });\n },\n\n /** override to allow getting nice_size */\n get : function( key ){\n if( key === 'nice_size' ){\n return this.nice_size();\n }\n return Backbone.Model.prototype.get.apply( this, arguments );\n },\n\n // ........................................................................ common queries\n /** T/F is this history owned by the current user (Galaxy.user)\n * Note: that this will return false for an anon user even if the history is theirs.\n */\n ownedByCurrUser : function(){\n // no currUser\n if( !Galaxy || !Galaxy.user ){\n return false;\n }\n // user is anon or history isn't owned\n if( Galaxy.user.isAnonymous() || Galaxy.user.id !== this.get( 'user_id' ) ){\n return false;\n }\n return true;\n },\n\n /** Return the number of running jobs assoc with this history (note: unknown === 0) */\n numOfUnfinishedJobs : function(){\n var unfinishedJobIds = this.get( 'non_ready_jobs' );\n return unfinishedJobIds? unfinishedJobIds.length : 0;\n },\n\n /** Return the number of running hda/hdcas in this history (note: unknown === 0) */\n numOfUnfinishedShownContents : function(){\n return this.contents.runningAndActive().length || 0;\n },\n\n // ........................................................................ updates\n _fetchContentRelatedAttributes : function(){\n var contentRelatedAttrs = [ 'size', 'non_ready_jobs', 'contents_active', 'hid_counter' ];\n return this.fetch({ data : $.param({ keys : contentRelatedAttrs.join( ',' ) }) });\n },\n\n /** check for any changes since the last time we updated (or fetch all if ) */\n refresh : function( options ){\n // console.log( this + '.refresh' );\n options = options || {};\n var self = this;\n\n // note if there was no previous update time, all summary contents will be fetched\n var lastUpdateTime = self.lastUpdateTime;\n // if we don't flip this, then a fully-fetched list will not be re-checked via fetch\n this.contents.allFetched = false;\n var fetchFn = self.contents.currentPage !== 0\n ? function(){ return self.contents.fetchPage( self.contents.currentPage ); }\n : function(){ return self.contents.fetchUpdated( lastUpdateTime ); };\n // note: if there was no previous update time, all summary contents will be fetched\n return fetchFn()\n .done( function( response, status, xhr ){\n var serverResponseDatetime;\n try {\n serverResponseDatetime = new Date( xhr.getResponseHeader( 'Date' ) );\n } catch( err ){}\n self.lastUpdateTime = serverResponseDatetime || new Date();\n self.checkForUpdates( options );\n });\n },\n\n /** continuously fetch updated contents every UPDATE_DELAY ms if this history's datasets or jobs are unfinished */\n checkForUpdates : function( options ){\n // console.log( this + '.checkForUpdates' );\n options = options || {};\n var delay = this.UPDATE_DELAY;\n var self = this;\n if( !self.id ){ return; }\n\n function _delayThenUpdate(){\n // prevent buildup of updater timeouts by clearing previous if any, then set new and cache id\n self.clearUpdateTimeout();\n self.updateTimeoutId = setTimeout( function(){\n self.refresh( options );\n }, delay );\n }\n\n // if there are still datasets in the non-ready state, recurse into this function with the new time\n var nonReadyContentCount = this.numOfUnfinishedShownContents();\n // console.log( 'nonReadyContentCount:', nonReadyContentCount );\n if( nonReadyContentCount > 0 ){\n _delayThenUpdate();\n\n } else {\n // no datasets are running, but currently runnning jobs may still produce new datasets\n // see if the history has any running jobs and continue to update if so\n // (also update the size for the user in either case)\n self._fetchContentRelatedAttributes()\n .done( function( historyData ){\n // console.log( 'non_ready_jobs:', historyData.non_ready_jobs );\n if( self.numOfUnfinishedJobs() > 0 ){\n _delayThenUpdate();\n\n } else {\n // otherwise, let listeners know that all updates have stopped\n self.trigger( 'ready' );\n }\n });\n }\n },\n\n /** clear the timeout and the cached timeout id */\n clearUpdateTimeout : function(){\n if( this.updateTimeoutId ){\n clearTimeout( this.updateTimeoutId );\n this.updateTimeoutId = null;\n }\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse : function( response, options ){\n var parsed = Backbone.Model.prototype.parse.call( this, response, options );\n if( parsed.create_time ){\n parsed.create_time = new Date( parsed.create_time );\n }\n if( parsed.update_time ){\n parsed.update_time = new Date( parsed.update_time );\n }\n return parsed;\n },\n\n /** fetch this histories data (using options) then it's contents (using contentsOptions) */\n fetchWithContents : function( options, contentsOptions ){\n options = options || {};\n var self = this;\n\n // console.log( this + '.fetchWithContents' );\n // TODO: push down to a base class\n options.view = 'dev-detailed';\n\n // fetch history then use history data to fetch (paginated) contents\n return this.fetch( options ).then( function getContents( history ){\n self.contents.history = self;\n self.contents.setHistoryId( history.id );\n return self.fetchContents( contentsOptions );\n });\n },\n\n /** fetch this histories contents, adjusting options based on the stored history preferences */\n fetchContents : function( options ){\n options = options || {};\n var self = this;\n\n // we're updating, reset the update time\n self.lastUpdateTime = new Date();\n return self.contents.fetchCurrentPage( options );\n },\n\n /** save this history, _Mark_ing it as deleted (just a flag) */\n _delete : function( options ){\n if( this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: true }, options );\n },\n /** purge this history, _Mark_ing it as purged and removing all dataset data from the server */\n purge : function( options ){\n if( this.get( 'purged' ) ){ return jQuery.when(); }\n return this.save( { deleted: true, purged: true }, options );\n },\n /** save this history, _Mark_ing it as undeleted */\n undelete : function( options ){\n if( !this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: false }, options );\n },\n\n /** Make a copy of this history on the server\n * @param {Boolean} current if true, set the copy as the new current history (default: true)\n * @param {String} name name of new history (default: none - server sets to: Copy of )\n * @fires copied passed this history and the response JSON from the copy\n * @returns {xhr}\n */\n copy : function( current, name, allDatasets ){\n current = ( current !== undefined )?( current ):( true );\n if( !this.id ){\n throw new Error( 'You must set the history ID before copying it.' );\n }\n\n var postData = { history_id : this.id };\n if( current ){\n postData.current = true;\n }\n if( name ){\n postData.name = name;\n }\n if( !allDatasets ){\n postData.all_datasets = false;\n }\n postData.view = 'dev-detailed';\n\n var history = this;\n var copy = jQuery.post( this.urlRoot, postData );\n // if current - queue to setAsCurrent before firing 'copied'\n if( current ){\n return copy.then( function( response ){\n var newHistory = new History( response );\n return newHistory.setAsCurrent()\n .done( function(){\n history.trigger( 'copied', history, response );\n });\n });\n }\n return copy.done( function( response ){\n history.trigger( 'copied', history, response );\n });\n },\n\n setAsCurrent : function(){\n var history = this,\n xhr = jQuery.getJSON( Galaxy.root + 'history/set_as_current?id=' + this.id );\n\n xhr.done( function(){\n history.trigger( 'set-as-current', history );\n });\n return xhr;\n },\n\n // ........................................................................ misc\n toString : function(){\n return 'History(' + this.get( 'id' ) + ',' + this.get( 'name' ) + ')';\n }\n}));\n\n\n//==============================================================================\nvar _collectionSuper = CONTROLLED_FETCH_COLLECTION.InfinitelyScrollingCollection;\n/** @class A collection of histories (per user)\n * that maintains the current history as the first in the collection.\n * New or copied histories become the current history.\n */\nvar HistoryCollection = _collectionSuper.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : 'history',\n\n model : History,\n /** @type {String} initial order used by collection */\n order : 'update_time',\n /** @type {Number} limit used for the first fetch (or a reset) */\n limitOnFirstFetch : 10,\n /** @type {Number} limit used for each subsequent fetch */\n limitPerFetch : 10,\n\n initialize : function( models, options ){\n options = options || {};\n this.log( 'HistoryCollection.initialize', models, options );\n _collectionSuper.prototype.initialize.call( this, models, options );\n\n /** @type {boolean} should deleted histories be included */\n this.includeDeleted = options.includeDeleted || false;\n\n /** @type {String} encoded id of the history that's current */\n this.currentHistoryId = options.currentHistoryId;\n\n this.setUpListeners();\n // note: models are sent to reset *after* this fn ends; up to this point\n // the collection *is empty*\n },\n\n urlRoot : Galaxy.root + 'api/histories',\n url : function(){ return this.urlRoot; },\n\n /** set up reflexive event handlers */\n setUpListeners : function setUpListeners(){\n return this.on({\n // when a history is deleted, remove it from the collection (if optionally set to do so)\n 'change:deleted' : function( history ){\n // TODO: this becomes complicated when more filters are used\n this.debug( 'change:deleted', this.includeDeleted, history.get( 'deleted' ) );\n if( !this.includeDeleted && history.get( 'deleted' ) ){\n this.remove( history );\n }\n },\n // listen for a history copy, setting it to current\n 'copied' : function( original, newData ){\n this.setCurrent( new History( newData, [] ) );\n },\n // when a history is made current, track the id in the collection\n 'set-as-current' : function( history ){\n var oldCurrentId = this.currentHistoryId;\n this.trigger( 'no-longer-current', oldCurrentId );\n this.currentHistoryId = history.id;\n }\n });\n },\n\n /** override to change view */\n _buildFetchData : function( options ){\n return _.extend( _collectionSuper.prototype._buildFetchData.call( this, options ), {\n view : 'dev-detailed'\n });\n },\n\n /** override to filter out deleted and purged */\n _buildFetchFilters : function( options ){\n var superFilters = _collectionSuper.prototype._buildFetchFilters.call( this, options ) || {};\n var filters = {};\n if( !this.includeDeleted ){\n filters.deleted = false;\n filters.purged = false;\n } else {\n // force API to return both deleted and non\n //TODO: when the API is updated, remove this\n filters.deleted = null;\n }\n return _.defaults( superFilters, filters );\n },\n\n /** override to fetch current as well (as it may be outside the first 10, etc.) */\n fetchFirst : function( options ){\n var self = this;\n // TODO: batch?\n var xhr = $.when();\n if( this.currentHistoryId ){\n xhr = _collectionSuper.prototype.fetchFirst.call( self, {\n silent: true,\n limit : 1,\n filters: {\n // without these a deleted current history will return [] here and block the other xhr\n 'purged' : '',\n 'deleted' : '',\n 'encoded_id-in' : this.currentHistoryId,\n }\n });\n }\n return xhr.then( function(){\n options = options || {};\n options.offset = 0;\n return self.fetchMore( options );\n });\n },\n\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators : _.extend( _.clone( _collectionSuper.prototype.comparators ), {\n 'name' : BASE_MVC.buildComparator( 'name', { ascending: true }),\n 'name-dsc' : BASE_MVC.buildComparator( 'name', { ascending: false }),\n 'size' : BASE_MVC.buildComparator( 'size', { ascending: false }),\n 'size-asc' : BASE_MVC.buildComparator( 'size', { ascending: true }),\n }),\n\n /** override to always have the current history first */\n sort : function( options ){\n options = options || {};\n var silent = options.silent;\n var currentHistory = this.remove( this.get( this.currentHistoryId ) );\n _collectionSuper.prototype.sort.call( this, _.defaults({ silent: true }, options ) );\n this.unshift( currentHistory, { silent: true });\n if( !silent ){\n this.trigger( 'sort', this, options );\n }\n return this;\n },\n\n /** create a new history and by default set it to be the current history */\n create : function create( data, hdas, historyOptions, xhrOptions ){\n //TODO: .create is actually a collection function that's overridden here\n var collection = this,\n xhr = jQuery.getJSON( Galaxy.root + 'history/create_new_current' );\n return xhr.done( function( newData ){\n collection.setCurrent( new History( newData, [], historyOptions || {} ) );\n });\n },\n\n /** set the current history to the given history, placing it first in the collection.\n * Pass standard bbone options for use in unshift.\n * @triggers new-current passed history and this collection\n */\n setCurrent : function( history, options ){\n options = options || {};\n // new histories go in the front\n this.unshift( history, options );\n this.currentHistoryId = history.get( 'id' );\n if( !options.silent ){\n this.trigger( 'new-current', history, this );\n }\n return this;\n },\n\n toString: function toString(){\n return 'HistoryCollection(' + this.length + ',current:' + this.currentHistoryId + ')';\n }\n});\n\n\n//==============================================================================\nreturn {\n History : History,\n HistoryCollection : HistoryCollection\n};});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-model.js","define([\n \"mvc/base-mvc\"\n], function( BASE_MVC ){\n\n'use strict';\n\nvar logNamespace = 'history';\n\n// ============================================================================\n/** session storage for individual history preferences */\nvar HistoryPrefs = BASE_MVC.SessionStorageModel.extend(\n/** @lends HistoryPrefs.prototype */{\n //TODO:?? move to user prefs?\n defaults : {\n //TODO:?? expandedIds to array?\n expandedIds : {},\n show_deleted : false,\n show_hidden : false\n },\n\n /** add an hda id to the hash of expanded hdas */\n addExpanded : function( model ){\n//TODO: use type_id and not model\n var current = this.get( 'expandedIds' );\n current[ model.id ] = model.get( 'id' );\n this.save( 'expandedIds', current );\n },\n\n /** remove an hda id from the hash of expanded hdas */\n removeExpanded : function( model ){\n var current = this.get( 'expandedIds' );\n delete current[ model.id ];\n this.save( 'expandedIds', current );\n },\n\n isExpanded : function( contentId ){\n return _.result( this.get( 'expandedIds' ), contentId, false );\n },\n\n allExpanded : function(){\n return _.values( this.get( 'expandedIds' ) );\n },\n\n clearExpanded : function(){\n this.set( 'expandedIds', {} );\n },\n\n includeDeleted : function( val ){\n // moving the invocation here so other components don't need to know the key\n // TODO: change this key later\n if( !_.isUndefined( val ) ){ this.set( 'show_deleted', val ); }\n return this.get( 'show_deleted' );\n },\n\n includeHidden : function( val ){\n // TODO: change this key later\n if( !_.isUndefined( val ) ){ this.set( 'show_hidden', val ); }\n return this.get( 'show_hidden' );\n },\n\n toString : function(){\n return 'HistoryPrefs(' + this.id + ')';\n }\n\n}, {\n // ........................................................................ class vars\n // class lvl for access w/o instantiation\n storageKeyPrefix : 'history:',\n\n /** key string to store each histories settings under */\n historyStorageKey : function historyStorageKey( historyId ){\n if( !historyId ){\n throw new Error( 'HistoryPrefs.historyStorageKey needs valid id: ' + historyId );\n }\n // single point of change\n return ( HistoryPrefs.storageKeyPrefix + historyId );\n },\n\n /** return the existing storage for the history with the given id (or create one if it doesn't exist) */\n get : function get( historyId ){\n return new HistoryPrefs({ id: HistoryPrefs.historyStorageKey( historyId ) });\n },\n\n /** clear all history related items in sessionStorage */\n clearAll : function clearAll( historyId ){\n for( var key in sessionStorage ){\n if( key.indexOf( HistoryPrefs.storageKeyPrefix ) === 0 ){\n sessionStorage.removeItem( key );\n }\n }\n }\n});\n\n//==============================================================================\n return {\n HistoryPrefs: HistoryPrefs\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-preferences.js","define([\n 'mvc/base-mvc',\n 'utils/localization'\n], function( BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'list';\n//==============================================================================\n/** A view which, when first rendered, shows only summary data/attributes, but\n * can be expanded to show further details (and optionally fetch those\n * details from the server).\n */\nvar ExpandableView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n //TODO: Although the reasoning behind them is different, this shares a lot with HiddenUntilActivated above: combine them\n //PRECONDITION: model must have method hasDetails\n //PRECONDITION: subclasses must have templates.el and templates.details\n\n initialize : function( attributes ){\n /** are the details of this view expanded/shown or not? */\n this.expanded = attributes.expanded || false;\n this.log( '\\t expanded:', this.expanded );\n this.fxSpeed = attributes.fxSpeed !== undefined? attributes.fxSpeed : this.fxSpeed;\n },\n\n // ........................................................................ render main\n /** jq fx speed */\n fxSpeed : 'fast',\n\n /** Render this content, set up ui.\n * @param {Number or String} speed the speed of the render\n */\n render : function( speed ){\n var $newRender = this._buildNewRender();\n this._setUpBehaviors( $newRender );\n this._queueNewRender( $newRender, speed );\n return this;\n },\n\n /** Build a temp div containing the new children for the view's $el.\n * If the view is already expanded, build the details as well.\n */\n _buildNewRender : function(){\n // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n var $newRender = $( this.templates.el( this.model.toJSON(), this ) );\n if( this.expanded ){\n this.$details( $newRender ).replaceWith( this._renderDetails().show() );\n }\n return $newRender;\n },\n\n /** Fade out the old el, swap in the new contents, then fade in.\n * @param {Number or String} speed jq speed to use for rendering effects\n * @fires rendered when rendered\n */\n _queueNewRender : function( $newRender, speed ) {\n speed = ( speed === undefined )?( this.fxSpeed ):( speed );\n var view = this;\n\n if( speed === 0 ){\n view._swapNewRender( $newRender );\n view.trigger( 'rendered', view );\n\n } else {\n $( view ).queue( 'fx', [\n function( next ){\n view.$el.fadeOut( speed, next );\n },\n function( next ){\n view._swapNewRender( $newRender );\n next();\n },\n function( next ){\n view.$el.fadeIn( speed, next );\n },\n function( next ){\n view.trigger( 'rendered', view );\n next();\n }\n ]);\n }\n },\n\n /** empty out the current el, move the $newRender's children in */\n _swapNewRender : function( $newRender ){\n return this.$el.empty()\n .attr( 'class', _.isFunction( this.className )? this.className(): this.className )\n .append( $newRender.children() );\n },\n\n /** set up js behaviors, event handlers for elements within the given container\n * @param {jQuery} $container jq object that contains the elements to process (defaults to this.$el)\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n // set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)\n //make_popup_menus( $where );\n $where.find( '[title]' ).tooltip({ placement : 'bottom' });\n },\n\n // ......................................................................... details\n /** shortcut to details DOM (as jQ) */\n $details : function( $where ){\n $where = $where || this.$el;\n return $where.find( '> .details' );\n },\n\n /** build the DOM for the details and set up behaviors on it */\n _renderDetails : function(){\n var $newDetails = $( this.templates.details( this.model.toJSON(), this ) );\n this._setUpBehaviors( $newDetails );\n return $newDetails;\n },\n\n // ......................................................................... expansion/details\n /** Show or hide the details\n * @param {Boolean} expand if true, expand; if false, collapse\n */\n toggleExpanded : function( expand ){\n expand = ( expand === undefined )?( !this.expanded ):( expand );\n if( expand ){\n this.expand();\n } else {\n this.collapse();\n }\n return this;\n },\n\n /** Render and show the full, detailed body of this view including extra data and controls.\n * note: if the model does not have detailed data, fetch that data before showing the body\n * @fires expanded when a body has been expanded\n */\n expand : function(){\n var view = this;\n return view._fetchModelDetails().always( function(){\n view._expand();\n });\n },\n\n /** Check for model details and, if none, fetch them.\n * @returns {jQuery.promise} the model.fetch.xhr if details are being fetched, an empty promise if not\n */\n _fetchModelDetails : function(){\n if( !this.model.hasDetails() ){\n return this.model.fetch();\n }\n return jQuery.when();\n },\n\n /** Inner fn called when expand (public) has fetched the details */\n _expand : function(){\n var view = this,\n $newDetails = view._renderDetails();\n view.$details().replaceWith( $newDetails );\n // needs to be set after the above or the slide will not show\n view.expanded = true;\n view.$details().slideDown( view.fxSpeed, function(){\n view.trigger( 'expanded', view );\n });\n },\n\n /** Hide the body/details of an HDA.\n * @fires collapsed when a body has been collapsed\n */\n collapse : function(){\n this.debug( this + '(ExpandableView).collapse' );\n var view = this;\n view.expanded = false;\n this.$details().slideUp( view.fxSpeed, function(){\n view.trigger( 'collapsed', view );\n });\n }\n\n});\n\n\n//==============================================================================\n/** A view that is displayed in some larger list/grid/collection.\n * Inherits from Expandable, Selectable, Draggable.\n * The DOM contains warnings, a title bar, and a series of primary action controls.\n * Primary actions are meant to be easily accessible item functions (such as delete)\n * that are rendered in the title bar.\n *\n * Details are rendered when the user clicks the title bar or presses enter/space when\n * the title bar is in focus.\n *\n * Designed as a base class for history panel contents - but usable elsewhere (I hope).\n */\nvar ListItemView = ExpandableView.extend(\n BASE_MVC.mixin( BASE_MVC.SelectableViewMixin, BASE_MVC.DraggableViewMixin, {\n\n tagName : 'div',\n className : 'list-item',\n\n /** Set up the base class and all mixins */\n initialize : function( attributes ){\n ExpandableView.prototype.initialize.call( this, attributes );\n BASE_MVC.SelectableViewMixin.initialize.call( this, attributes );\n BASE_MVC.DraggableViewMixin.initialize.call( this, attributes );\n this._setUpListeners();\n },\n\n /** event listeners */\n _setUpListeners : function(){\n // hide the primary actions in the title bar when selectable and narrow\n this.on( 'selectable', function( isSelectable ){\n if( isSelectable ){\n this.$( '.primary-actions' ).hide();\n } else {\n this.$( '.primary-actions' ).show();\n }\n }, this );\n return this;\n },\n\n // ........................................................................ rendering\n /** In this override, call methods to build warnings, titlebar and primary actions */\n _buildNewRender : function(){\n var $newRender = ExpandableView.prototype._buildNewRender.call( this );\n $newRender.children( '.warnings' ).replaceWith( this._renderWarnings() );\n $newRender.children( '.title-bar' ).replaceWith( this._renderTitleBar() );\n $newRender.children( '.primary-actions' ).append( this._renderPrimaryActions() );\n $newRender.find( '> .title-bar .subtitle' ).replaceWith( this._renderSubtitle() );\n return $newRender;\n },\n\n /** In this override, render the selector controls and set up dragging before the swap */\n _swapNewRender : function( $newRender ){\n ExpandableView.prototype._swapNewRender.call( this, $newRender );\n if( this.selectable ){ this.showSelector( 0 ); }\n if( this.draggable ){ this.draggableOn(); }\n return this.$el;\n },\n\n /** Render any warnings the item may need to show (e.g. \"I'm deleted\") */\n _renderWarnings : function(){\n var view = this,\n $warnings = $( '
                                                      ' ),\n json = view.model.toJSON();\n //TODO:! unordered (map)\n _.each( view.templates.warnings, function( templateFn ){\n $warnings.append( $( templateFn( json, view ) ) );\n });\n return $warnings;\n },\n\n /** Render the title bar (the main/exposed SUMMARY dom element) */\n _renderTitleBar : function(){\n return $( this.templates.titleBar( this.model.toJSON(), this ) );\n },\n\n /** Return an array of jQ objects containing common/easily-accessible item controls */\n _renderPrimaryActions : function(){\n // override this\n return [];\n },\n\n /** Render the title bar (the main/exposed SUMMARY dom element) */\n _renderSubtitle : function(){\n return $( this.templates.subtitle( this.model.toJSON(), this ) );\n },\n\n // ......................................................................... events\n /** event map */\n events : {\n // expand the body when the title is clicked or when in focus and space or enter is pressed\n 'click .title-bar' : '_clickTitleBar',\n 'keydown .title-bar' : '_keyDownTitleBar',\n 'click .selector' : 'toggleSelect'\n },\n\n /** expand when the title bar is clicked */\n _clickTitleBar : function( event ){\n event.stopPropagation();\n if( event.altKey ){\n this.toggleSelect( event );\n if( !this.selectable ){\n this.showSelector();\n }\n } else {\n this.toggleExpanded();\n }\n },\n\n /** expand when the title bar is in focus and enter or space is pressed */\n _keyDownTitleBar : function( event ){\n // bail (with propagation) if keydown and not space or enter\n var KEYCODE_SPACE = 32, KEYCODE_RETURN = 13;\n if( event && ( event.type === 'keydown' )\n &&( event.keyCode === KEYCODE_SPACE || event.keyCode === KEYCODE_RETURN ) ){\n this.toggleExpanded();\n event.stopPropagation();\n return false;\n }\n return true;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'ListItemView(' + modelString + ')';\n }\n}));\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nListItemView.prototype.templates = (function(){\n\n var elTemplato = BASE_MVC.wrapTemplate([\n '
                                                      ',\n // errors, messages, etc.\n '
                                                      ',\n\n // multi-select checkbox\n '
                                                      ',\n '',\n '
                                                      ',\n // space for title bar buttons - gen. floated to the right\n '
                                                      ',\n '
                                                      ',\n\n // expandable area for more details\n '
                                                      ',\n '
                                                      '\n ]);\n\n var warnings = {};\n\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n // adding a tabindex here allows focusing the title bar and the use of keydown to expand the dataset display\n '
                                                      ',\n //TODO: prob. belongs in dataset-list-item\n '',\n '
                                                      ',\n '<%- element.name %>',\n '
                                                      ',\n '
                                                      ',\n '
                                                      '\n ], 'element' );\n\n var subtitleTemplate = BASE_MVC.wrapTemplate([\n // override this\n '
                                                      '\n ]);\n\n var detailsTemplate = BASE_MVC.wrapTemplate([\n // override this\n '
                                                      '\n ]);\n\n return {\n el : elTemplato,\n warnings : warnings,\n titleBar : titleBarTemplate,\n subtitle : subtitleTemplate,\n details : detailsTemplate\n };\n}());\n\n\n//==============================================================================\n/** A view that is displayed in some larger list/grid/collection.\n * *AND* can display some sub-list of it's own when expanded (e.g. dataset collections).\n * This list will 'foldout' when the item is expanded depending on this.foldoutStyle:\n * If 'foldout': will expand vertically to show the nested list\n * If 'drilldown': will overlay the parent list\n *\n * Inherits from ListItemView.\n *\n * _renderDetails does the work of creating this.details: a sub-view that shows the nested list\n */\nvar FoldoutListItemView = ListItemView.extend({\n\n /** If 'foldout': show the sub-panel inside the expanded item\n * If 'drilldown': only fire events and handle by pub-sub\n * (allow the panel containing this item to attach it, hide itself, etc.)\n */\n foldoutStyle : 'foldout',\n /** Panel view class to instantiate for the sub-panel */\n foldoutPanelClass : null,\n\n /** override to:\n * add attributes foldoutStyle and foldoutPanelClass for config poly\n * disrespect attributes.expanded if drilldown\n */\n initialize : function( attributes ){\n if( this.foldoutStyle === 'drilldown' ){ this.expanded = false; }\n this.foldoutStyle = attributes.foldoutStyle || this.foldoutStyle;\n this.foldoutPanelClass = attributes.foldoutPanelClass || this.foldoutPanelClass;\n\n ListItemView.prototype.initialize.call( this, attributes );\n this.foldout = this._createFoldoutPanel();\n },\n\n /** in this override, attach the foldout panel when rendering details */\n _renderDetails : function(){\n if( this.foldoutStyle === 'drilldown' ){ return $(); }\n var $newDetails = ListItemView.prototype._renderDetails.call( this );\n return this._attachFoldout( this.foldout, $newDetails );\n },\n\n /** In this override, handle collection expansion. */\n _createFoldoutPanel : function(){\n var model = this.model;\n var FoldoutClass = this._getFoldoutPanelClass( model ),\n options = this._getFoldoutPanelOptions( model ),\n foldout = new FoldoutClass( _.extend( options, {\n model : model\n }));\n return foldout;\n },\n\n /** Stub to return proper foldout panel class */\n _getFoldoutPanelClass : function(){\n // override\n return this.foldoutPanelClass;\n },\n\n /** Stub to return proper foldout panel options */\n _getFoldoutPanelOptions : function(){\n return {\n // propagate foldout style down\n foldoutStyle : this.foldoutStyle,\n fxSpeed : this.fxSpeed\n };\n },\n\n /** Render the foldout panel inside the view, hiding controls */\n _attachFoldout : function( foldout, $whereTo ){\n $whereTo = $whereTo || this.$( '> .details' );\n this.foldout = foldout.render( 0 );\n foldout.$( '> .controls' ).hide();\n return $whereTo.append( foldout.$el );\n },\n\n /** In this override, branch on foldoutStyle to show expanded */\n expand : function(){\n var view = this;\n return view._fetchModelDetails()\n .always(function(){\n if( view.foldoutStyle === 'foldout' ){\n view._expand();\n } else if( view.foldoutStyle === 'drilldown' ){\n view._expandByDrilldown();\n }\n });\n },\n\n /** For drilldown, set up close handler and fire expanded:drilldown\n * containing views can listen to this and handle other things\n * (like hiding themselves) by listening for expanded/collapsed:drilldown\n */\n _expandByDrilldown : function(){\n var view = this;\n // attachment and rendering done by listener\n view.listenTo( view.foldout, 'close', function(){\n view.trigger( 'collapsed:drilldown', view, view.foldout );\n });\n view.trigger( 'expanded:drilldown', view, view.foldout );\n }\n\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nFoldoutListItemView.prototype.templates = (function(){\n\n var detailsTemplate = BASE_MVC.wrapTemplate([\n '
                                                      ',\n // override with more info (that goes above the panel)\n '
                                                      '\n ], 'collection' );\n\n return _.extend( {}, ListItemView.prototype.templates, {\n details : detailsTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n ExpandableView : ExpandableView,\n ListItemView : ListItemView,\n FoldoutListItemView : FoldoutListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/list/list-item.js","/**\n * Model, view, and controller objects for Galaxy tools and tool panel.\n */\n\n define([\n \"libs/underscore\",\n \"viz/trackster/util\",\n \"mvc/dataset/data\",\n \"mvc/tool/tool-form\"\n\n], function(_, util, data, ToolForm) {\n 'use strict';\n\n/**\n * Mixin for tracking model visibility.\n */\nvar VisibilityMixin = {\n hidden: false,\n\n show: function() {\n this.set(\"hidden\", false);\n },\n\n hide: function() {\n this.set(\"hidden\", true);\n },\n\n toggle: function() {\n this.set(\"hidden\", !this.get(\"hidden\"));\n },\n\n is_visible: function() {\n return !this.attributes.hidden;\n }\n\n};\n\n/**\n * A tool parameter.\n */\nvar ToolParameter = Backbone.Model.extend({\n defaults: {\n name: null,\n label: null,\n type: null,\n value: null,\n html: null,\n num_samples: 5\n },\n\n initialize: function(options) {\n this.attributes.html = unescape(this.attributes.html);\n },\n\n copy: function() {\n return new ToolParameter(this.toJSON());\n },\n\n set_value: function(value) {\n this.set('value', value || '');\n }\n});\n\nvar ToolParameterCollection = Backbone.Collection.extend({\n model: ToolParameter\n});\n\n/**\n * A data tool parameter.\n */\nvar DataToolParameter = ToolParameter.extend({});\n\n/**\n * An integer tool parameter.\n */\nvar IntegerToolParameter = ToolParameter.extend({\n set_value: function(value) {\n this.set('value', parseInt(value, 10));\n },\n\n /**\n * Returns samples from a tool input.\n */\n get_samples: function() {\n return d3.scale.linear()\n .domain([this.get('min'), this.get('max')])\n .ticks(this.get('num_samples'));\n }\n});\n\nvar FloatToolParameter = IntegerToolParameter.extend({\n set_value: function(value) {\n this.set('value', parseFloat(value));\n }\n});\n\n/**\n * A select tool parameter.\n */\nvar SelectToolParameter = ToolParameter.extend({\n /**\n * Returns tool options.\n */\n get_samples: function() {\n return _.map(this.get('options'), function(option) {\n return option[0];\n });\n }\n});\n\n// Set up dictionary of parameter types.\nToolParameter.subModelTypes = {\n 'integer': IntegerToolParameter,\n 'float': FloatToolParameter,\n 'data': DataToolParameter,\n 'select': SelectToolParameter\n};\n\n/**\n * A Galaxy tool.\n */\nvar Tool = Backbone.Model.extend({\n // Default attributes.\n defaults: {\n id: null,\n name: null,\n description: null,\n target: null,\n inputs: [],\n outputs: []\n },\n\n urlRoot: Galaxy.root + 'api/tools',\n\n initialize: function(options) {\n\n // Set parameters.\n this.set('inputs', new ToolParameterCollection(_.map(options.inputs, function(p) {\n var p_class = ToolParameter.subModelTypes[p.type] || ToolParameter;\n return new p_class(p);\n })));\n },\n\n /**\n *\n */\n toJSON: function() {\n var rval = Backbone.Model.prototype.toJSON.call(this);\n\n // Convert inputs to JSON manually.\n rval.inputs = this.get('inputs').map(function(i) { return i.toJSON(); });\n return rval;\n },\n\n /**\n * Removes inputs of a particular type; this is useful because not all inputs can be handled by\n * client and server yet.\n */\n remove_inputs: function(types) {\n var tool = this,\n incompatible_inputs = tool.get('inputs').filter( function(input) {\n return ( types.indexOf( input.get('type') ) !== -1);\n });\n tool.get('inputs').remove(incompatible_inputs);\n },\n\n /**\n * Returns object copy, optionally including only inputs that can be sampled.\n */\n copy: function(only_samplable_inputs) {\n var copy = new Tool(this.toJSON());\n\n // Return only samplable inputs if flag is set.\n if (only_samplable_inputs) {\n var valid_inputs = new Backbone.Collection();\n copy.get('inputs').each(function(input) {\n if (input.get_samples()) {\n valid_inputs.push(input);\n }\n });\n copy.set('inputs', valid_inputs);\n }\n\n return copy;\n },\n\n apply_search_results: function(results) {\n ( _.indexOf(results, this.attributes.id) !== -1 ? this.show() : this.hide() );\n return this.is_visible();\n },\n\n /**\n * Set a tool input's value.\n */\n set_input_value: function(name, value) {\n this.get('inputs').find(function(input) {\n return input.get('name') === name;\n }).set('value', value);\n },\n\n /**\n * Set many input values at once.\n */\n set_input_values: function(inputs_dict) {\n var self = this;\n _.each(_.keys(inputs_dict), function(input_name) {\n self.set_input_value(input_name, inputs_dict[input_name]);\n });\n },\n\n /**\n * Run tool; returns a Deferred that resolves to the tool's output(s).\n */\n run: function() {\n return this._run();\n },\n\n /**\n * Rerun tool using regions and a target dataset.\n */\n rerun: function(target_dataset, regions) {\n return this._run({\n action: 'rerun',\n target_dataset_id: target_dataset.id,\n regions: regions\n });\n },\n\n /**\n * Returns input dict for tool's inputs.\n */\n get_inputs_dict: function() {\n var input_dict = {};\n this.get('inputs').each(function(input) {\n input_dict[input.get('name')] = input.get('value');\n });\n return input_dict;\n },\n\n /**\n * Run tool; returns a Deferred that resolves to the tool's output(s).\n * NOTE: this method is a helper method and should not be called directly.\n */\n _run: function(additional_params) {\n // Create payload.\n var payload = _.extend({\n tool_id: this.id,\n inputs: this.get_inputs_dict()\n }, additional_params);\n\n // Because job may require indexing datasets, use server-side\n // deferred to ensure that job is run. Also use deferred that\n // resolves to outputs from tool.\n var run_deferred = $.Deferred(),\n ss_deferred = new util.ServerStateDeferred({\n ajax_settings: {\n url: this.urlRoot,\n data: JSON.stringify(payload),\n dataType: \"json\",\n contentType: 'application/json',\n type: \"POST\"\n },\n interval: 2000,\n success_fn: function(response) {\n return response !== \"pending\";\n }\n });\n\n // Run job and resolve run_deferred to tool outputs.\n $.when(ss_deferred.go()).then(function(result) {\n run_deferred.resolve(new data.DatasetCollection(result));\n });\n return run_deferred;\n }\n});\n_.extend(Tool.prototype, VisibilityMixin);\n\n/**\n * Tool view.\n */\nvar ToolView = Backbone.View.extend({\n\n});\n\n/**\n * Wrap collection of tools for fast access/manipulation.\n */\nvar ToolCollection = Backbone.Collection.extend({\n model: Tool\n});\n\n/**\n * Label or section header in tool panel.\n */\nvar ToolSectionLabel = Backbone.Model.extend(VisibilityMixin);\n\n/**\n * Section of tool panel with elements (labels and tools).\n */\nvar ToolSection = Backbone.Model.extend({\n defaults: {\n elems: [],\n open: false\n },\n\n clear_search_results: function() {\n _.each(this.attributes.elems, function(elt) {\n elt.show();\n });\n\n this.show();\n this.set(\"open\", false);\n },\n\n apply_search_results: function(results) {\n var all_hidden = true,\n cur_label;\n _.each(this.attributes.elems, function(elt) {\n if (elt instanceof ToolSectionLabel) {\n cur_label = elt;\n cur_label.hide();\n }\n else if (elt instanceof Tool) {\n if (elt.apply_search_results(results)) {\n all_hidden = false;\n if (cur_label) {\n cur_label.show();\n }\n }\n }\n });\n\n if (all_hidden) {\n this.hide();\n }\n else {\n this.show();\n this.set(\"open\", true);\n }\n }\n});\n_.extend(ToolSection.prototype, VisibilityMixin);\n\n/**\n * Tool search that updates results when query is changed. Result value of null\n * indicates that query was not run; if not null, results are from search using\n * query.\n */\nvar ToolSearch = Backbone.Model.extend({\n defaults: {\n search_hint_string: \"search tools\",\n min_chars_for_search: 3,\n clear_btn_url: \"\",\n visible: true,\n query: \"\",\n results: null,\n // ESC (27) will clear the input field and tool search filters\n clear_key: 27\n },\n\n urlRoot: Galaxy.root + 'api/tools',\n\n initialize: function() {\n this.on(\"change:query\", this.do_search);\n },\n\n /**\n * Do the search and update the results.\n */\n do_search: function() {\n var query = this.attributes.query;\n\n // If query is too short, do not search.\n if (query.length < this.attributes.min_chars_for_search) {\n this.set(\"results\", null);\n return;\n }\n\n // Do search via AJAX.\n var q = query;\n // Stop previous ajax-request\n if (this.timer) {\n clearTimeout(this.timer);\n }\n // Start a new ajax-request in X ms\n $(\"#search-clear-btn\").hide();\n $(\"#search-spinner\").show();\n var self = this;\n this.timer = setTimeout(function () {\n // log the search to analytics if present\n if ( typeof ga !== 'undefined' ) {\n ga( 'send', 'pageview', Galaxy.root + '?q=' + q );\n }\n $.get( self.urlRoot, { q: q }, function (data) {\n self.set(\"results\", data);\n $(\"#search-spinner\").hide();\n $(\"#search-clear-btn\").show();\n }, \"json\" );\n }, 400 );\n },\n\n clear_search: function() {\n this.set(\"query\", \"\");\n this.set(\"results\", null);\n }\n\n});\n_.extend(ToolSearch.prototype, VisibilityMixin);\n\n/**\n * Tool Panel.\n */\nvar ToolPanel = Backbone.Model.extend({\n\n initialize: function(options) {\n this.attributes.tool_search = options.tool_search;\n this.attributes.tool_search.on(\"change:results\", this.apply_search_results, this);\n this.attributes.tools = options.tools;\n this.attributes.layout = new Backbone.Collection( this.parse(options.layout) );\n },\n\n /**\n * Parse tool panel dictionary and return collection of tool panel elements.\n */\n parse: function(response) {\n // Recursive function to parse tool panel elements.\n var self = this,\n // Helper to recursively parse tool panel.\n parse_elt = function(elt_dict) {\n var type = elt_dict.model_class;\n // There are many types of tools; for now, anything that ends in 'Tool'\n // is treated as a generic tool.\n if ( type.indexOf('Tool') === type.length - 4 ) {\n return self.attributes.tools.get(elt_dict.id);\n }\n else if (type === 'ToolSection') {\n // Parse elements.\n var elems = _.map(elt_dict.elems, parse_elt);\n elt_dict.elems = elems;\n return new ToolSection(elt_dict);\n }\n else if (type === 'ToolSectionLabel') {\n return new ToolSectionLabel(elt_dict);\n }\n };\n\n return _.map(response, parse_elt);\n },\n\n clear_search_results: function() {\n this.get('layout').each(function(panel_elt) {\n if (panel_elt instanceof ToolSection) {\n panel_elt.clear_search_results();\n }\n else {\n // Label or tool, so just show.\n panel_elt.show();\n }\n });\n },\n\n apply_search_results: function() {\n var results = this.get('tool_search').get('results');\n if (results === null) {\n this.clear_search_results();\n return;\n }\n\n var cur_label = null;\n this.get('layout').each(function(panel_elt) {\n if (panel_elt instanceof ToolSectionLabel) {\n cur_label = panel_elt;\n cur_label.hide();\n }\n else if (panel_elt instanceof Tool) {\n if (panel_elt.apply_search_results(results)) {\n if (cur_label) {\n cur_label.show();\n }\n }\n }\n else {\n // Starting new section, so clear current label.\n cur_label = null;\n panel_elt.apply_search_results(results);\n }\n });\n }\n});\n\n/**\n * View classes for Galaxy tools and tool panel.\n *\n * Views use the templates defined below for rendering. Views update as needed\n * based on (a) model/collection events and (b) user interactions; in this sense,\n * they are controllers are well and the HTML is the real view in the MVC architecture.\n */\n\n/**\n * Base view that handles visibility based on model's hidden attribute.\n */\nvar BaseView = Backbone.View.extend({\n initialize: function() {\n this.model.on(\"change:hidden\", this.update_visible, this);\n this.update_visible();\n },\n update_visible: function() {\n ( this.model.attributes.hidden ? this.$el.hide() : this.$el.show() );\n }\n});\n\n/**\n * Link to a tool.\n */\nvar ToolLinkView = BaseView.extend({\n tagName: 'div',\n\n render: function() {\n // create element\n var $link = $('
                                                      ');\n $link.append(templates.tool_link(this.model.toJSON()));\n\n var formStyle = this.model.get( 'form_style', null );\n // open upload dialog for upload tool\n if (this.model.id === 'upload1') {\n $link.find('a').on('click', function(e) {\n e.preventDefault();\n Galaxy.upload.show();\n });\n }\n else if ( formStyle === 'regular' ) { // regular tools\n var self = this;\n $link.find('a').on('click', function(e) {\n e.preventDefault();\n Galaxy.router.push( '/', { tool_id : self.model.id, version : self.model.get('version') } );\n });\n }\n\n // add element\n this.$el.append($link);\n return this;\n }\n});\n\n/**\n * Panel label/section header.\n */\nvar ToolSectionLabelView = BaseView.extend({\n tagName: 'div',\n className: 'toolPanelLabel',\n\n render: function() {\n this.$el.append( $(\"\").text(this.model.attributes.text) );\n return this;\n }\n});\n\n/**\n * Panel section.\n */\nvar ToolSectionView = BaseView.extend({\n tagName: 'div',\n className: 'toolSectionWrapper',\n\n initialize: function() {\n BaseView.prototype.initialize.call(this);\n this.model.on(\"change:open\", this.update_open, this);\n },\n\n render: function() {\n // Build using template.\n this.$el.append( templates.panel_section(this.model.toJSON()) );\n\n // Add tools to section.\n var section_body = this.$el.find(\".toolSectionBody\");\n _.each(this.model.attributes.elems, function(elt) {\n if (elt instanceof Tool) {\n var tool_view = new ToolLinkView({model: elt, className: \"toolTitle\"});\n tool_view.render();\n section_body.append(tool_view.$el);\n }\n else if (elt instanceof ToolSectionLabel) {\n var label_view = new ToolSectionLabelView({model: elt});\n label_view.render();\n section_body.append(label_view.$el);\n }\n else {\n // TODO: handle nested section bodies?\n }\n });\n return this;\n },\n\n events: {\n 'click .toolSectionTitle > a': 'toggle'\n },\n\n /**\n * Toggle visibility of tool section.\n */\n toggle: function() {\n this.model.set(\"open\", !this.model.attributes.open);\n },\n\n /**\n * Update whether section is open or close.\n */\n update_open: function() {\n (this.model.attributes.open ?\n this.$el.children(\".toolSectionBody\").slideDown(\"fast\") :\n this.$el.children(\".toolSectionBody\").slideUp(\"fast\")\n );\n }\n});\n\nvar ToolSearchView = Backbone.View.extend({\n tagName: 'div',\n id: 'tool-search',\n className: 'bar',\n\n events: {\n 'click': 'focus_and_select',\n 'keyup :input': 'query_changed',\n 'change :input': 'query_changed',\n 'click #search-clear-btn': 'clear'\n },\n\n render: function() {\n this.$el.append( templates.tool_search(this.model.toJSON()) );\n if (!this.model.is_visible()) {\n this.$el.hide();\n }\n\n // Adjust top for issue 2907 depending on whether the messagebox is visible.\n if ($(\"#messagebox\").is(\":visible\")) {\n this.$el.css(\"top\",\"95px\");\n }\n\n this.$el.find('[title]').tooltip();\n return this;\n },\n\n focus_and_select: function() {\n this.$el.find(\":input\").focus().select();\n },\n\n clear: function() {\n this.model.clear_search();\n this.$el.find(\":input\").val('');\n this.focus_and_select();\n return false;\n },\n\n query_changed: function( evData ) {\n // check for the 'clear key' (ESC) first\n if( ( this.model.attributes.clear_key ) &&\n ( this.model.attributes.clear_key === evData.which ) ){\n this.clear();\n return false;\n }\n this.model.set(\"query\", this.$el.find(\":input\").val());\n }\n});\n\n/**\n * Tool panel view. Events triggered include:\n * tool_link_click(click event, tool_model)\n */\nvar ToolPanelView = Backbone.View.extend({\n tagName: 'div',\n className: 'toolMenu',\n\n /**\n * Set up view.\n */\n initialize: function() {\n this.model.get('tool_search').on(\"change:results\", this.handle_search_results, this);\n },\n\n render: function() {\n var self = this;\n\n // Render search.\n var search_view = new ToolSearchView( { model: this.model.get('tool_search') } );\n search_view.render();\n self.$el.append(search_view.$el);\n\n // Render panel.\n this.model.get('layout').each(function(panel_elt) {\n if (panel_elt instanceof ToolSection) {\n var section_title_view = new ToolSectionView({model: panel_elt});\n section_title_view.render();\n self.$el.append(section_title_view.$el);\n }\n else if (panel_elt instanceof Tool) {\n var tool_view = new ToolLinkView({model: panel_elt, className: \"toolTitleNoSection\"});\n tool_view.render();\n self.$el.append(tool_view.$el);\n }\n else if (panel_elt instanceof ToolSectionLabel) {\n var label_view = new ToolSectionLabelView({model: panel_elt});\n label_view.render();\n self.$el.append(label_view.$el);\n }\n });\n\n // Setup tool link click eventing.\n self.$el.find(\"a.tool-link\").click(function(e) {\n // Tool id is always the first class.\n var\n tool_id = $(this).attr('class').split(/\\s+/)[0],\n tool = self.model.get('tools').get(tool_id);\n\n self.trigger(\"tool_link_click\", e, tool);\n });\n\n return this;\n },\n\n handle_search_results: function() {\n var results = this.model.get('tool_search').get('results');\n if (results && results.length === 0) {\n $(\"#search-no-results\").show();\n }\n else {\n $(\"#search-no-results\").hide();\n }\n }\n});\n\n/**\n * View for working with a tool: setting parameters and inputs and executing the tool.\n */\nvar ToolFormView = Backbone.View.extend({\n className: 'toolForm',\n\n render: function() {\n this.$el.children().remove();\n this.$el.append( templates.tool_form(this.model.toJSON()) );\n }\n});\n\n/**\n * Integrated tool menu + tool execution.\n */\nvar IntegratedToolMenuAndView = Backbone.View.extend({\n className: 'toolMenuAndView',\n\n initialize: function() {\n this.tool_panel_view = new ToolPanelView({collection: this.collection});\n this.tool_form_view = new ToolFormView();\n },\n\n render: function() {\n // Render and append tool panel.\n this.tool_panel_view.render();\n this.tool_panel_view.$el.css(\"float\", \"left\");\n this.$el.append(this.tool_panel_view.$el);\n\n // Append tool form view.\n this.tool_form_view.$el.hide();\n this.$el.append(this.tool_form_view.$el);\n\n // On tool link click, show tool.\n var self = this;\n this.tool_panel_view.on(\"tool_link_click\", function(e, tool) {\n // Prevents click from activating link:\n e.preventDefault();\n // Show tool that was clicked on:\n self.show_tool(tool);\n });\n },\n\n /**\n * Fetch and display tool.\n */\n show_tool: function(tool) {\n var self = this;\n tool.fetch().done( function() {\n self.tool_form_view.model = tool;\n self.tool_form_view.render();\n self.tool_form_view.$el.show();\n $('#left').width(\"650px\");\n });\n }\n});\n\n// TODO: move into relevant views\nvar templates = {\n // the search bar at the top of the tool panel\n tool_search : _.template([\n '\" autocomplete=\"off\" type=\"text\" />',\n ' ',\n //TODO: replace with icon\n '',\n ].join('')),\n\n // the category level container in the tool panel (e.g. 'Get Data', 'Text Manipulation')\n panel_section : _.template([\n '
                                                      \">',\n '<%- name %>',\n '
                                                      ',\n '
                                                      \" class=\"toolSectionBody\" style=\"display: none;\">',\n '
                                                      ',\n '
                                                      '\n ].join('')),\n\n // a single tool's link in the tool panel; will load the tool form in the center panel\n tool_link : _.template([\n ' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">',\n '',\n '<% _.each( labels, function( label ){ %>',\n '\">',\n '<%- label %>',\n '',\n '<% }); %>',\n '',\n '',\n '<%- name %>',\n '',\n ' <%- description %>',\n ''\n ].join('')),\n\n // the tool form for entering tool parameters, viewing help and executing the tool\n // loaded when a tool link is clicked in the tool panel\n tool_form : _.template([\n '
                                                      <%- tool.name %> (version <%- tool.version %>)
                                                      ',\n '
                                                      ',\n '<% _.each( tool.inputs, function( input ){ %>',\n '
                                                      ',\n '',\n '
                                                      ',\n '<%= input.html %>',\n '
                                                      ',\n '
                                                      ',\n '<%- input.help %>',\n '
                                                      ',\n '
                                                      ',\n '
                                                      ',\n '<% }); %>',\n '
                                                      ',\n '
                                                      ',\n '',\n '
                                                      ',\n '
                                                      ',\n '
                                                      <% tool.help %>
                                                      ',\n '
                                                      ',\n // TODO: we need scoping here because 'help' is the dom for the help menu in the masthead\n // which implies a leaky variable that I can't find\n ].join(''), { variable: 'tool' }),\n};\n\n\n// Exports\nreturn {\n ToolParameter: ToolParameter,\n IntegerToolParameter: IntegerToolParameter,\n SelectToolParameter: SelectToolParameter,\n Tool: Tool,\n ToolCollection: ToolCollection,\n ToolSearch: ToolSearch,\n ToolPanel: ToolPanel,\n ToolPanelView: ToolPanelView,\n ToolFormView: ToolFormView\n};\n\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/tool/tools.js","/** This renders the content of the ftp popup **/\ndefine( [ 'utils/utils' ], function( Utils ) {\n return Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.options = Utils.merge( options, {\n class_add : 'upload-icon-button fa fa-square-o',\n class_remove : 'upload-icon-button fa fa-check-square-o',\n class_partial : 'upload-icon-button fa fa-minus-square-o',\n collection : null,\n onchange : function() {},\n onadd : function() {},\n onremove : function() {}\n } );\n this.collection = this.options.collection;\n this.setElement( this._template() );\n this.rows = [];\n Utils.get({\n url : Galaxy.root + 'api/remote_files',\n success : function( ftp_files ) { self._fill( ftp_files ) },\n error : function() { self._fill(); }\n });\n },\n\n /** Fill table with ftp entries */\n _fill: function( ftp_files ) {\n if ( ftp_files && ftp_files.length > 0 ) {\n this.$( '.upload-ftp-content' ).html( $( this._templateTable() ) );\n var size = 0;\n for (var index in ftp_files ) {\n this.rows.push( this._add( ftp_files[ index ] ) );\n size += ftp_files[ index ].size;\n }\n this.$( '.upload-ftp-number' ).html( ftp_files.length + ' files' );\n this.$( '.upload-ftp-disk' ).html( Utils.bytesToString ( size, true ) );\n if ( this.collection ) {\n var self = this;\n this.$( '._has_collection' ).show();\n this.$select_all = this.$( '.upload-selectall' ).addClass( this.options.class_add );\n this.$select_all.on( 'click', function() {\n var add = self.$select_all.hasClass( self.options.class_add );\n for (var index in ftp_files ) {\n var ftp_file = ftp_files[ index ];\n var model_index = self._find( ftp_file );\n if( !model_index && add || model_index && !add ) {\n self.rows[ index ].trigger( 'click' );\n }\n }\n });\n this._refresh();\n }\n } else {\n this.$( '.upload-ftp-content' ).html( $( this._templateInfo() ) );\n }\n this.$( '.upload-ftp-wait' ).hide();\n },\n\n /** Add file to table */\n _add: function( ftp_file ) {\n var self = this;\n var $it = $( this._templateRow( ftp_file ) );\n var $icon = $it.find( '.icon' );\n this.$( 'tbody' ).append( $it );\n if ( this.collection ) {\n $icon.addClass( this._find( ftp_file ) ? this.options.class_remove : this.options.class_add );\n $it.on('click', function() {\n var model_index = self._find( ftp_file );\n $icon.removeClass();\n if ( !model_index ) {\n self.options.onadd( ftp_file );\n $icon.addClass( self.options.class_remove );\n } else {\n self.options.onremove( model_index );\n $icon.addClass( self.options.class_add );\n }\n self._refresh();\n });\n } else {\n $it.on('click', function() { self.options.onchange( ftp_file ) } );\n }\n return $it;\n },\n\n /** Refresh select all button state */\n _refresh: function() {\n var filtered = this.collection.where( { file_mode: 'ftp', enabled: true } );\n this.$select_all.removeClass();\n if ( filtered.length == 0 ) {\n this.$select_all.addClass( this.options.class_add );\n } else {\n this.$select_all.addClass( filtered.length == this.rows.length ? this.options.class_remove : this.options.class_partial );\n }\n },\n\n /** Get model index */\n _find: function( ftp_file ) {\n var item = this.collection.findWhere({\n file_path : ftp_file.path,\n file_mode : 'ftp',\n enabled : true\n });\n return item && item.get('id');\n },\n\n /** Template of row */\n _templateRow: function( options ) {\n return '
                                                      ' + _.escape(options.path) + '' + Utils.bytesToString( options.size ) + '' + options.ctime + '
                                                      ' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '
                                                      NameSizeCreated
                                                      ';\n },\n\n /** Template of info message */\n _templateInfo: function() {\n return '
                                                      ' +\n 'Your FTP directory does not contain any files.' +\n '
                                                      ';\n },\n\n /** Template of main view */\n _template: function() {\n return '
                                                      ' +\n '
                                                      ' +\n '
                                                      This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at ' + this.options.ftp_upload_site + ' using your Galaxy credentials (email address and password).
                                                      ' +\n '
                                                      ' +\n '
                                                      ';\n }\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/upload/upload-ftp.js","/** This renders the content of the settings popup, allowing users to specify flags i.e. for space-to-tab conversion **/\ndefine( [ 'utils/utils' ], function( Utils ) {\n return Backbone.View.extend({\n options: {\n class_check : 'fa-check-square-o',\n class_uncheck : 'fa-square-o',\n parameters : [{\n id : 'space_to_tab',\n title : 'Convert spaces to tabs',\n },{\n id : 'to_posix_lines',\n title : 'Use POSIX standard'\n }]\n },\n\n initialize: function( options ) {\n var self = this;\n this.model = options.model;\n this.setElement( $( '
                                                      ' ).addClass( 'upload-settings' ) );\n this.$el.append( $( '
                                                      ' ).addClass( 'upload-settings-cover' ) );\n this.$el.append( $( '' ).addClass( 'upload-settings-table ui-table-striped' ).append( '' ) );\n this.$cover = this.$( '.upload-settings-cover' );\n this.$table = this.$( '.upload-settings-table > tbody' );\n this.listenTo ( this.model, 'change', this.render, this );\n this.model.trigger( 'change' );\n },\n\n render: function() {\n var self = this;\n this.$table.empty();\n _.each( this.options.parameters, function( parameter ) {\n var $checkbox = $( '
                                                      ' ).addClass( 'upload-' + parameter.id + ' upload-icon-button fa' )\n .addClass( self.model.get( parameter.id ) && self.options.class_check || self.options.class_uncheck )\n .on( 'click', function() {\n self.model.get( 'enabled' ) && self.model.set( parameter.id, !self.model.get( parameter.id ) )\n });\n self.$table.append( $( '
                                                      ' ).append( $( '' +\n '' +\n '' +\n '' );\n });\n $tmpl.append( $table );\n } else {\n $tmpl.append( 'No ' + this.model.get( 'plural' ).toLowerCase() + ' have been shared with you.' );\n }\n return $tmpl;\n }\n });\n\n return {\n View: View\n }\n});\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/grid/grid-shared.js","define([\n \"mvc/dataset/dataset-li-edit\",\n \"mvc/history/hda-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET_LI_EDIT, HDA_LI, BASE_MVC, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = DATASET_LI_EDIT.DatasetListItemEdit;\n/** @class Editing view for HistoryDatasetAssociation.\n */\nvar HDAListItemEdit = _super.extend(\n/** @lends HDAListItemEdit.prototype */{\n\n className : _super.prototype.className + \" history-content\",\n\n /** In this override, only get details if in the ready state, get rerunnable if in other states.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n\n // special case the need for the rerunnable and creating_job attributes\n // needed for rendering re-run button on queued, running datasets\n } else if( !view.model.has( 'rerunnable' ) ){\n return view.model.fetch({ silent: true, data: {\n // only fetch rerunnable and creating_job to keep overhead down\n keys: [ 'rerunnable', 'creating_job' ].join(',')\n }});\n }\n return jQuery.when();\n },\n\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .unhide-link' : function( ev ){ this.model.unhide(); return false; }\n }),\n\n /** string rep */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDAListItemEdit(' + modelString + ')';\n }\n});\n\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nHDAListItemEdit.prototype.templates = (function(){\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n hidden : BASE_MVC.wrapTemplate([\n '<% if( !dataset.visible ){ %>',\n // add a link to unhide a dataset\n '
                                                      ',\n _l( 'This dataset has been hidden' ),\n '
                                                      ', _l( 'Unhide it' ), '',\n '
                                                      ',\n '<% } %>'\n ], 'dataset' )\n });\n\n return _.extend( {}, _super.prototype.templates, {\n //NOTE: *steal* the HDAListItemView titleBar\n titleBar : HDA_LI.HDAListItemView.prototype.templates.titleBar,\n warnings : warnings\n });\n}());\n\n\n//==============================================================================\n return {\n HDAListItemEdit : HDAListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hda-li-edit.js","define([\n \"mvc/history/hdca-li\",\n \"mvc/collection/collection-view-edit\",\n \"ui/fa-icon-button\",\n \"utils/localization\"\n], function( HDCA_LI, DC_VIEW_EDIT, faIconButton, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = HDCA_LI.HDCAListItemView;\n/** @class Editing view for HistoryDatasetCollectionAssociation.\n */\nvar HDCAListItemEdit = _super.extend(\n/** @lends HDCAListItemEdit.prototype */{\n\n /** logger used to record this.log messages, commonly set to console */\n //logger : console,\n\n /** Override to return editable versions of the collection panels */\n _getFoldoutPanelClass : function(){\n switch( this.model.get( 'collection_type' ) ){\n case 'list':\n return DC_VIEW_EDIT.ListCollectionViewEdit;\n case 'paired':\n return DC_VIEW_EDIT.PairCollectionViewEdit;\n case 'list:paired':\n return DC_VIEW_EDIT.ListOfPairsCollectionViewEdit;\n case 'list:list':\n return DC_VIEW_EDIT.ListOfListsCollectionViewEdit;\n }\n throw new TypeError( 'Uknown collection_type: ' + this.model.get( 'collection_type' ) );\n },\n\n // ......................................................................... delete\n /** In this override, add the delete button. */\n _renderPrimaryActions : function(){\n this.log( this + '._renderPrimaryActions' );\n // render the display, edit attr and delete icon-buttons\n return _super.prototype._renderPrimaryActions.call( this )\n .concat([\n this._renderDeleteButton()\n ]);\n },\n\n /** Render icon-button to delete this collection. */\n _renderDeleteButton : function(){\n var self = this,\n deleted = this.model.get( 'deleted' );\n return faIconButton({\n title : deleted? _l( 'Dataset collection is already deleted' ): _l( 'Delete' ),\n classes : 'delete-btn',\n faIcon : 'fa-times',\n disabled : deleted,\n onclick : function() {\n // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n self.$el.find( '.icon-btn.delete-btn' ).trigger( 'mouseout' );\n self.model[ 'delete' ]();\n }\n });\n },\n\n // ......................................................................... misc\n /** string rep */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDCAListItemEdit(' + modelString + ')';\n }\n});\n\n//==============================================================================\n return {\n HDCAListItemEdit : HDCAListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hdca-li-edit.js","/** This class renders the grid list. */\ndefine( [ 'utils/utils', 'mvc/grid/grid-view', 'mvc/history/history-model', 'mvc/history/copy-dialog' ], function( Utils, GridView, HistoryModel, historyCopyDialog ) {\n\n var View = Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.setElement( $( '
                                                      ' ) );\n this.model = new Backbone.Model();\n Utils.get({\n url : Galaxy.root + 'history/' + options.action_id,\n success : function( response ) {\n response[ 'dict_format' ] = true;\n _.each( response[ 'operations' ], function( operation ) {\n if ( operation.label == 'Copy' ) {\n operation.onclick = function( id ) { self._showCopyDialog( id ) };\n }\n });\n self.model.set( response );\n self.render();\n }\n });\n },\n\n render: function() {\n var grid = new GridView( this.model.attributes );\n this.$el.empty().append( grid.$el );\n },\n\n _showCopyDialog: function( id ) {\n var history = new HistoryModel.History( { id : id } );\n history.fetch()\n .fail( function() {\n alert( 'History could not be fetched. Please contact an administrator' );\n })\n .done( function(){\n historyCopyDialog( history, {} ).done( function() {\n if( window.parent && window.parent.Galaxy && window.parent.Galaxy.currHistoryPanel ) {\n window.parent.Galaxy.currHistoryPanel.loadCurrentHistory();\n }\n window.location.reload( true );\n } );\n });\n }\n });\n\n return {\n View: View\n }\n});\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-list.js","define([\n \"mvc/history/history-model\",\n \"mvc/history/history-view-edit\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( HISTORY_MODEL, HISTORY_VIEW_EDIT, BASE_MVC, _l ){\n\n'use strict';\n\n// ============================================================================\n/** session storage for history panel preferences (and to maintain state)\n */\nvar HistoryViewPrefs = BASE_MVC.SessionStorageModel.extend(\n/** @lends HistoryViewPrefs.prototype */{\n defaults : {\n /** should the tags editor be shown or hidden initially? */\n tagsEditorShown : false,\n /** should the annotation editor be shown or hidden initially? */\n annotationEditorShown : false,\n ///** what is the currently focused content (dataset or collection) in the current history?\n // * (the history panel will highlight and scroll to the focused content view)\n // */\n //focusedContentId : null\n /** Current scroll position */\n scrollPosition : 0\n },\n toString : function(){\n return 'HistoryViewPrefs(' + JSON.stringify( this.toJSON() ) + ')';\n }\n});\n\n/** key string to store panel prefs (made accessible on class so you can access sessionStorage directly) */\nHistoryViewPrefs.storageKey = function storageKey(){\n return ( 'history-panel' );\n};\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\nvar _super = HISTORY_VIEW_EDIT.HistoryViewEdit;\n// used in root/index.mako\n/** @class View/Controller for the user's current history model as used in the history\n * panel (current right hand panel) of the analysis page.\n *\n * The only history panel that:\n * will poll for updates.\n * displays datasets in reverse hid order.\n */\nvar CurrentHistoryView = _super.extend(/** @lends CurrentHistoryView.prototype */{\n\n className : _super.prototype.className + ' current-history-panel',\n\n /** override to use drilldown (and not foldout) for how collections are displayed */\n HDCAViewClass : _super.prototype.HDCAViewClass.extend({\n foldoutStyle : 'drilldown'\n }),\n\n emptyMsg : [\n _l( 'This history is empty' ), '. ',\n _l( 'You can ' ),\n '',\n _l( 'load your own data' ),\n '',\n _l( ' or ' ),\n '',\n _l( 'get data from an external source' ),\n ''\n ].join(''),\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events */\n initialize : function( attributes ){\n attributes = attributes || {};\n\n // ---- persistent preferences\n /** maintain state / preferences over page loads */\n this.preferences = new HistoryViewPrefs( _.extend({\n id : HistoryViewPrefs.storageKey()\n }, _.pick( attributes, _.keys( HistoryViewPrefs.prototype.defaults ) )));\n\n _super.prototype.initialize.call( this, attributes );\n\n /** sub-views that will overlay this panel (collections) */\n this.panelStack = [];\n\n /** id of currently focused content */\n this.currentContentId = attributes.currentContentId || null;\n //NOTE: purposely not sent to localstorage since panel recreation roughly lines up with a reset of this value\n },\n\n /** Override to cache the current scroll position with a listener */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n\n var panel = this;\n // reset scroll position when there's a new history\n this.on( 'new-model', function(){\n panel.preferences.set( 'scrollPosition', 0 );\n });\n },\n\n // ------------------------------------------------------------------------ loading history/item models\n // TODO: next three more appropriate moved to the app level\n /** (re-)loads the user's current history & contents w/ details */\n loadCurrentHistory : function(){\n return this.loadHistory( null, { url : Galaxy.root + 'history/current_history_json' });\n },\n\n /** loads a history & contents w/ details and makes them the current history */\n switchToHistory : function( historyId, attributes ){\n if( Galaxy.user.isAnonymous() ){\n this.trigger( 'error', _l( 'You must be logged in to switch histories' ), _l( 'Anonymous user' ) );\n return $.when();\n }\n return this.loadHistory( historyId, { url : Galaxy.root + 'history/set_as_current?id=' + historyId });\n },\n\n /** creates a new history on the server and sets it as the user's current history */\n createNewHistory : function( attributes ){\n if( Galaxy.user.isAnonymous() ){\n this.trigger( 'error', _l( 'You must be logged in to create histories' ), _l( 'Anonymous user' ) );\n return $.when();\n }\n return this.loadHistory( null, { url : Galaxy.root + 'history/create_new_current' });\n },\n\n /** release/free/shutdown old models and set up panel for new models */\n setModel : function( model, attributes, render ){\n _super.prototype.setModel.call( this, model, attributes, render );\n if( this.model && this.model.id ){\n this.log( 'checking for updates' );\n this.model.checkForUpdates();\n }\n return this;\n },\n\n // ------------------------------------------------------------------------ history/content event listening\n /** listening for history events */\n _setUpModelListeners : function(){\n _super.prototype._setUpModelListeners.call( this );\n // re-broadcast any model change events so that listeners don't have to re-bind to each history\n return this.listenTo( this.model, {\n 'change:nice_size change:size' : function(){\n this.trigger( 'history-size-change', this, this.model, arguments );\n },\n 'change:id' : function(){\n this.once( 'loading-done', function(){ this.model.checkForUpdates(); });\n }\n });\n },\n\n /** listening for collection events */\n _setUpCollectionListeners : function(){\n _super.prototype._setUpCollectionListeners.call( this );\n // if a hidden item is created (gen. by a workflow), moves thru the updater to the ready state,\n // then: remove it from the collection if the panel is set to NOT show hidden datasets\n this.listenTo( this.collection, 'state:ready', function( model, newState, oldState ){\n if( ( !model.get( 'visible' ) )\n && ( !this.collection.storage.includeHidden() ) ){\n this.removeItemView( model );\n }\n });\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** override to add a handler to capture the scroll position when the parent scrolls */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n // console.log( '_setUpBehaviors', this.$scrollContainer( $where ).get(0), this.$list( $where ) );\n // we need to call this in _setUpBehaviors which is called after render since the $el\n // may not be attached to $el.parent and $scrollContainer() may not work\n var panel = this;\n _super.prototype._setUpBehaviors.call( panel, $where );\n\n // cache the handler to remove and re-add so we don't pile up the handlers\n if( !this._debouncedScrollCaptureHandler ){\n this._debouncedScrollCaptureHandler = _.debounce( function scrollCapture(){\n // cache the scroll position (only if visible)\n if( panel.$el.is( ':visible' ) ){\n panel.preferences.set( 'scrollPosition', $( this ).scrollTop() );\n }\n }, 40 );\n }\n\n panel.$scrollContainer( $where )\n .off( 'scroll', this._debouncedScrollCaptureHandler )\n .on( 'scroll', this._debouncedScrollCaptureHandler );\n return panel;\n },\n\n /** In this override, handle null models and move the search input to the top */\n _buildNewRender : function(){\n if( !this.model ){ return $(); }\n var $newRender = _super.prototype._buildNewRender.call( this );\n $newRender.find( '.search' ).prependTo( $newRender.find( '> .controls' ) );\n this._renderQuotaMessage( $newRender );\n return $newRender;\n },\n\n /** render the message displayed when a user is over quota and can't run jobs */\n _renderQuotaMessage : function( $whereTo ){\n $whereTo = $whereTo || this.$el;\n return $( this.templates.quotaMsg( {}, this ) ).prependTo( $whereTo.find( '.messages' ) );\n },\n\n /** In this override, get and set current panel preferences when editor is used */\n _renderTags : function( $where ){\n var panel = this;\n // render tags and show/hide based on preferences\n _super.prototype._renderTags.call( panel, $where );\n if( panel.preferences.get( 'tagsEditorShown' ) ){\n panel.tagsEditor.toggle( true );\n }\n // store preference when shown or hidden\n panel.listenTo( panel.tagsEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden',\n function( tagsEditor ){\n panel.preferences.set( 'tagsEditorShown', tagsEditor.hidden );\n }\n );\n },\n\n /** In this override, get and set current panel preferences when editor is used */\n _renderAnnotation : function( $where ){\n var panel = this;\n // render annotation and show/hide based on preferences\n _super.prototype._renderAnnotation.call( panel, $where );\n if( panel.preferences.get( 'annotationEditorShown' ) ){\n panel.annotationEditor.toggle( true );\n }\n // store preference when shown or hidden\n panel.listenTo( panel.annotationEditor, 'hiddenUntilActivated:shown hiddenUntilActivated:hidden',\n function( annotationEditor ){\n panel.preferences.set( 'annotationEditorShown', annotationEditor.hidden );\n }\n );\n },\n\n /** Override to scroll to cached position (in prefs) after swapping */\n _swapNewRender : function( $newRender ){\n _super.prototype._swapNewRender.call( this, $newRender );\n var panel = this;\n _.delay( function(){\n var pos = panel.preferences.get( 'scrollPosition' );\n if( pos ){\n panel.scrollTo( pos, 0 );\n }\n }, 10 );\n //TODO: is this enough of a delay on larger histories?\n\n return this;\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** Override to add the current-content highlight class to currentContentId's view */\n _attachItems : function( $whereTo ){\n _super.prototype._attachItems.call( this, $whereTo );\n var panel = this;\n if( panel.currentContentId ){\n panel._setCurrentContentById( panel.currentContentId );\n }\n return this;\n },\n\n /** Override to remove any drill down panels */\n addItemView : function( model, collection, options ){\n var view = _super.prototype.addItemView.call( this, model, collection, options );\n if( !view ){ return view; }\n if( this.panelStack.length ){ return this._collapseDrilldownPanel(); }\n return view;\n },\n\n // ------------------------------------------------------------------------ collection sub-views\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n _super.prototype._setUpItemViewListeners.call( panel, view );\n // use pub-sub to: handle drilldown expansion and collapse\n return panel.listenTo( view, {\n 'expanded:drilldown' : function( v, drilldown ){\n this._expandDrilldownPanel( drilldown );\n },\n 'collapsed:drilldown' : function( v, drilldown ){\n this._collapseDrilldownPanel( drilldown );\n },\n });\n },\n\n /** display 'current content': add a visible highlight and store the id of a content item */\n setCurrentContent : function( view ){\n this.$( '.history-content.current-content' ).removeClass( 'current-content' );\n if( view ){\n view.$el.addClass( 'current-content' );\n this.currentContentId = view.model.id;\n } else {\n this.currentContentId = null;\n }\n },\n\n /** find the view with the id and then call setCurrentContent on it */\n _setCurrentContentById : function( id ){\n var view = this.viewFromModelId( id ) || null;\n this.setCurrentContent( view );\n },\n\n /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n _expandDrilldownPanel : function( drilldown ){\n this.panelStack.push( drilldown );\n // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n this.$controls().add( this.$list() ).hide();\n drilldown.parentName = this.model.get( 'name' );\n drilldown.delegateEvents().render().$el.appendTo( this.$el );\n },\n\n /** Handle drilldown close by freeing the panel and re-rendering this panel */\n _collapseDrilldownPanel : function( drilldown ){\n this.panelStack.pop();\n //TODO: MEM: free the panel\n this.$controls().add( this.$list() ).show();\n },\n\n // ........................................................................ panel events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n // the two links in the empty message\n 'click .uploader-link' : function( ev ){ Galaxy.upload.show( ev ); },\n 'click .get-data-link' : function( ev ){\n var $toolMenu = $( '.toolMenuContainer' );\n $toolMenu.parent().scrollTop( 0 );\n $toolMenu.find( 'span:contains(\"Get Data\")' ).click();\n }\n }),\n\n // ........................................................................ external objects/MVC\n listenToGalaxy : function( galaxy ){\n this.listenTo( galaxy, {\n // when the galaxy_main iframe is loaded with a new page,\n // compare the url to the following list and if there's a match\n // pull the id from url and indicate in the history view that\n // the dataset with that id is the 'current'ly active dataset\n 'center-frame:load': function( data ){\n var pathToMatch = data.fullpath;\n var hdaId = null;\n var useToURLRegexMap = {\n 'display' : /datasets\\/([a-f0-9]+)\\/display/,\n 'edit' : /datasets\\/([a-f0-9]+)\\/edit/,\n 'report_error' : /dataset\\/errors\\?id=([a-f0-9]+)/,\n 'rerun' : /tool_runner\\/rerun\\?id=([a-f0-9]+)/,\n 'show_params' : /datasets\\/([a-f0-9]+)\\/show_params/,\n // no great way to do this here? (leave it in the dataset event handlers above?)\n // 'visualization' : 'visualization',\n };\n _.find( useToURLRegexMap, function( regex, use ){\n // grab the more specific match result (1), save, and use it as the find flag\n hdaId = _.result( pathToMatch.match( regex ), 1 );\n return hdaId;\n });\n // need to type mangle to go from web route to history contents\n this._setCurrentContentById( hdaId? ( 'dataset-' + hdaId ) : null );\n },\n // when the center panel is given a new view, clear the current indicator\n 'center-panel:load': function( view ){\n this._setCurrentContentById();\n }\n });\n },\n\n //TODO: remove quota meter from panel and remove this\n /** add listeners to an external quota meter (mvc/user/user-quotameter.js) */\n connectToQuotaMeter : function( quotaMeter ){\n if( !quotaMeter ){\n return this;\n }\n // show/hide the 'over quota message' in the history when the meter tells it to\n this.listenTo( quotaMeter, 'quota:over', this.showQuotaMessage );\n this.listenTo( quotaMeter, 'quota:under', this.hideQuotaMessage );\n\n // having to add this to handle re-render of hview while overquota (the above do not fire)\n this.on( 'rendered rendered:initial', function(){\n if( quotaMeter && quotaMeter.isOverQuota() ){\n this.showQuotaMessage();\n }\n });\n return this;\n },\n\n /** Override to preserve the quota message */\n clearMessages : function( ev ){\n var $target = !_.isUndefined( ev )?\n $( ev.currentTarget )\n :this.$messages().children( '[class$=\"message\"]' );\n $target = $target.not( '.quota-message' );\n $target.fadeOut( this.fxSpeed, function(){\n $( this ).remove();\n });\n return this;\n },\n\n /** Show the over quota message (which happens to be in the history panel).\n */\n showQuotaMessage : function(){\n var $msg = this.$( '.quota-message' );\n if( $msg.is( ':hidden' ) ){ $msg.slideDown( this.fxSpeed ); }\n },\n\n /** Hide the over quota message (which happens to be in the history panel).\n */\n hideQuotaMessage : function(){\n var $msg = this.$( '.quota-message' );\n if( !$msg.is( ':hidden' ) ){ $msg.slideUp( this.fxSpeed ); }\n },\n\n // ........................................................................ options menu\n //TODO: remove to batch\n /** unhide any hidden datasets */\n unhideHidden : function() {\n var self = this;\n if( confirm( _l( 'Really unhide all hidden datasets?' ) ) ){\n // get all hidden, regardless of deleted/purged\n return self.model.contents._filterAndUpdate(\n { visible: false, deleted: '', purged: '' },\n { visible : true }\n ).done( function(){\n // TODO: would be better to render these as they're unhidden instead of all at once\n if( !self.model.contents.includeHidden ){\n self.renderItems();\n }\n });\n }\n return jQuery.when();\n },\n\n /** delete any hidden datasets */\n deleteHidden : function() {\n var self = this;\n if( confirm( _l( 'Really delete all hidden datasets?' ) ) ){\n return self.model.contents._filterAndUpdate(\n // get all hidden, regardless of deleted/purged\n { visible: false, deleted: '', purged: '' },\n // both delete *and* unhide them\n { deleted : true, visible: true }\n );\n }\n return jQuery.when();\n },\n\n /** Return a string rep of the history */\n toString : function(){\n return 'CurrentHistoryView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//------------------------------------------------------------------------------ TEMPLATES\nCurrentHistoryView.prototype.templates = (function(){\n\n var quotaMsgTemplate = BASE_MVC.wrapTemplate([\n '
                                                      ',\n _l( 'You are over your disk quota' ), '. ',\n _l( 'Tool execution is on hold until your disk usage drops below your allocated quota' ), '.',\n '
                                                      '\n ], 'history' );\n return _.extend( _.clone( _super.prototype.templates ), {\n quotaMsg : quotaMsgTemplate\n });\n\n}());\n\n\n//==============================================================================\n return {\n CurrentHistoryView : CurrentHistoryView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-view-edit-current.js","define([\n \"mvc/history/history-view\",\n \"mvc/history/history-contents\",\n \"mvc/dataset/states\",\n \"mvc/history/hda-model\",\n \"mvc/history/hda-li-edit\",\n \"mvc/history/hdca-li-edit\",\n \"mvc/tag\",\n \"mvc/annotation\",\n \"mvc/collection/list-collection-creator\",\n \"mvc/collection/pair-collection-creator\",\n \"mvc/collection/list-of-pairs-collection-creator\",\n \"ui/fa-icon-button\",\n \"mvc/ui/popup-menu\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function(\n HISTORY_VIEW,\n HISTORY_CONTENTS,\n STATES,\n HDA_MODEL,\n HDA_LI_EDIT,\n HDCA_LI_EDIT,\n TAGS,\n ANNOTATIONS,\n LIST_COLLECTION_CREATOR,\n PAIR_COLLECTION_CREATOR,\n LIST_OF_PAIRS_COLLECTION_CREATOR,\n faIconButton,\n PopupMenu,\n BASE_MVC,\n _l\n){\n\n'use strict';\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\nvar _super = HISTORY_VIEW.HistoryView;\n// base class for history-view-edit-current and used as-is in history/view.mako\n/** @class Editable View/Controller for the history model.\n *\n * Allows:\n * (everything HistoryView allows)\n * changing the name\n * displaying and editing tags and annotations\n * multi-selection and operations on mulitple content items\n */\nvar HistoryViewEdit = _super.extend(\n/** @lends HistoryViewEdit.prototype */{\n\n /** class to use for constructing the HistoryDatasetAssociation views */\n HDAViewClass : HDA_LI_EDIT.HDAListItemEdit,\n /** class to use for constructing the HistoryDatasetCollectionAssociation views */\n HDCAViewClass : HDCA_LI_EDIT.HDCAListItemEdit,\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes\n */\n initialize : function( attributes ){\n attributes = attributes || {};\n _super.prototype.initialize.call( this, attributes );\n\n // ---- set up instance vars\n /** editor for tags - sub-view */\n this.tagsEditor = null;\n\n /** enable drag and drop - sub-view */\n this.dragItems = true;\n\n /** editor for annotations - sub-view */\n this.annotationEditor = null;\n\n /** allow user purge of dataset files? */\n this.purgeAllowed = attributes.purgeAllowed || false;\n\n // states/modes the panel can be in\n /** is the panel currently showing the dataset selection controls? */\n this.annotationEditorShown = attributes.annotationEditorShown || false;\n this.tagsEditorShown = attributes.tagsEditorShown || false;\n },\n\n /** Override to handle history as drag-drop target */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n return this.on({\n 'droptarget:drop': function( ev, data ){\n // process whatever was dropped and re-hide the drop target\n this.dataDropped( data );\n this.dropTargetOff();\n },\n 'view:attached view:removed': function(){\n this._renderCounts();\n },\n 'search:loading-progress': this._renderSearchProgress,\n 'search:searching': this._renderSearchFindings,\n });\n },\n\n // ------------------------------------------------------------------------ listeners\n /** listening for history and HDA events */\n _setUpModelListeners : function(){\n _super.prototype._setUpModelListeners.call( this );\n this.listenTo( this.model, 'change:size', this.updateHistoryDiskSize );\n return this;\n },\n\n /** listening for collection events */\n _setUpCollectionListeners : function(){\n _super.prototype._setUpCollectionListeners.call( this );\n this.listenTo( this.collection, {\n 'change:deleted': this._handleItemDeletedChange,\n 'change:visible': this._handleItemVisibleChange,\n 'change:purged' : function( model ){\n // hafta get the new nice-size w/o the purged model\n this.model.fetch();\n },\n // loading indicators for deleted/hidden\n 'fetching-deleted' : function( collection ){\n this.$( '> .controls .deleted-count' )\n .html( '' + _l( 'loading...' ) + '' );\n },\n 'fetching-hidden' : function( collection ){\n this.$( '> .controls .hidden-count' )\n .html( '' + _l( 'loading...' ) + '' );\n },\n 'fetching-deleted-done fetching-hidden-done' : this._renderCounts,\n });\n return this;\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** In this override, add tag and annotation editors and a btn to toggle the selectors */\n _buildNewRender : function(){\n // create a new render using a skeleton template, render title buttons, render body, and set up events, etc.\n var $newRender = _super.prototype._buildNewRender.call( this );\n if( !this.model ){ return $newRender; }\n\n if( Galaxy && Galaxy.user && Galaxy.user.id && Galaxy.user.id === this.model.get( 'user_id' ) ){\n this._renderTags( $newRender );\n this._renderAnnotation( $newRender );\n }\n return $newRender;\n },\n\n /** Update the history size display (curr. upper right of panel). */\n updateHistoryDiskSize : function(){\n this.$( '.history-size' ).text( this.model.get( 'nice_size' ) );\n },\n\n /** override to render counts when the items are rendered */\n renderItems : function( $whereTo ){\n var views = _super.prototype.renderItems.call( this, $whereTo );\n if( !this.searchFor ){ this._renderCounts( $whereTo ); }\n return views;\n },\n\n /** override to show counts, what's deleted/hidden, and links to toggle those */\n _renderCounts : function( $whereTo ){\n $whereTo = $whereTo instanceof jQuery? $whereTo : this.$el;\n var html = this.templates.counts( this.model.toJSON(), this );\n return $whereTo.find( '> .controls .subtitle' ).html( html );\n },\n\n /** render the tags sub-view controller */\n _renderTags : function( $where ){\n var panel = this;\n this.tagsEditor = new TAGS.TagsEditor({\n model : this.model,\n el : $where.find( '.controls .tags-display' ),\n onshowFirstTime : function(){ this.render(); },\n // show hide sub-view tag editors when this is shown/hidden\n onshow : function(){\n panel.toggleHDATagEditors( true, panel.fxSpeed );\n },\n onhide : function(){\n panel.toggleHDATagEditors( false, panel.fxSpeed );\n },\n $activator : faIconButton({\n title : _l( 'Edit history tags' ),\n classes : 'history-tag-btn',\n faIcon : 'fa-tags'\n }).appendTo( $where.find( '.controls .actions' ) )\n });\n },\n /** render the annotation sub-view controller */\n _renderAnnotation : function( $where ){\n var panel = this;\n this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n model : this.model,\n el : $where.find( '.controls .annotation-display' ),\n onshowFirstTime : function(){ this.render(); },\n // show hide sub-view view annotation editors when this is shown/hidden\n onshow : function(){\n panel.toggleHDAAnnotationEditors( true, panel.fxSpeed );\n },\n onhide : function(){\n panel.toggleHDAAnnotationEditors( false, panel.fxSpeed );\n },\n $activator : faIconButton({\n title : _l( 'Edit history annotation' ),\n classes : 'history-annotate-btn',\n faIcon : 'fa-comment'\n }).appendTo( $where.find( '.controls .actions' ) )\n });\n },\n\n /** Set up HistoryViewEdit js/widget behaviours\n * In this override, make the name editable\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n _super.prototype._setUpBehaviors.call( this, $where );\n if( !this.model ){ return; }\n\n // anon users shouldn't have access to any of the following\n if( ( !Galaxy.user || Galaxy.user.isAnonymous() )\n || ( Galaxy.user.id !== this.model.get( 'user_id' ) ) ){\n return;\n }\n\n var panel = this,\n nameSelector = '> .controls .name';\n $where.find( nameSelector )\n .attr( 'title', _l( 'Click to rename history' ) )\n .tooltip({ placement: 'bottom' })\n .make_text_editable({\n on_finish: function( newName ){\n var previousName = panel.model.get( 'name' );\n if( newName && newName !== previousName ){\n panel.$el.find( nameSelector ).text( newName );\n panel.model.save({ name: newName })\n .fail( function(){\n panel.$el.find( nameSelector ).text( panel.model.previous( 'name' ) );\n });\n } else {\n panel.$el.find( nameSelector ).text( previousName );\n }\n }\n });\n },\n\n /** return a new popup menu for choosing a multi selection action\n * ajax calls made for multiple datasets are queued\n */\n multiselectActions : function(){\n var panel = this,\n actions = [\n { html: _l( 'Hide datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.hide;\n panel.getSelectedModels().ajaxQueue( action );\n }\n },\n { html: _l( 'Unhide datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.unhide;\n panel.getSelectedModels().ajaxQueue( action );\n }\n },\n { html: _l( 'Delete datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype['delete'];\n panel.getSelectedModels().ajaxQueue( action );\n }\n },\n { html: _l( 'Undelete datasets' ), func: function(){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.undelete;\n panel.getSelectedModels().ajaxQueue( action );\n }\n }\n ];\n if( panel.purgeAllowed ){\n actions.push({\n html: _l( 'Permanently delete datasets' ), func: function(){\n if( confirm( _l( 'This will permanently remove the data in your datasets. Are you sure?' ) ) ){\n var action = HDA_MODEL.HistoryDatasetAssociation.prototype.purge;\n panel.getSelectedModels().ajaxQueue( action );\n }\n }\n });\n }\n actions = actions.concat( panel._collectionActions() );\n return actions;\n },\n\n /** */\n _collectionActions : function(){\n var panel = this;\n return [\n { html: _l( 'Build Dataset List' ), func: function() { panel.buildCollection( \"list\") }\n },\n // TODO: Only show quick pair if two things selected.\n { html: _l( 'Build Dataset Pair' ), func: function() { panel.buildCollection( \"paired\") }\n },\n { html: _l( 'Build List of Dataset Pairs' ), func: function() { panel.buildCollection( \"list:paired\" ) }\n },\n ];\n },\n\n buildCollection : function( collectionType, selection, hideSourceItems ) {\n var panel = this;\n var selection = selection || panel.getSelectedModels();\n var hideSourceItems = hideSourceItems || false;\n var createFunc;\n if( collectionType == \"list\" ) {\n createFunc = LIST_COLLECTION_CREATOR.createListCollection;\n } else if( collectionType == \"paired\" ) {\n createFunc = PAIR_COLLECTION_CREATOR.createPairCollection;\n } else if( collectionType == \"list:paired\" ) {\n createFunc = LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection;\n } else {\n console.warn( \"Unknown collectionType encountered \" + collectionType );\n }\n createFunc( selection, hideSourceItems ).done( function() { panel.model.refresh() } );\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** In this override, add purgeAllowed and whether tags/annotation editors should be shown */\n _getItemViewOptions : function( model ){\n var options = _super.prototype._getItemViewOptions.call( this, model );\n _.extend( options, {\n purgeAllowed : this.purgeAllowed,\n tagsEditorShown : ( this.tagsEditor && !this.tagsEditor.hidden ),\n annotationEditorShown : ( this.annotationEditor && !this.annotationEditor.hidden )\n });\n return options;\n },\n\n /** If this item is deleted and we're not showing deleted items, remove the view\n * @param {Model} the item model to check\n */\n _handleItemDeletedChange : function( itemModel ){\n if( itemModel.get( 'deleted' ) ){\n this._handleItemDeletion( itemModel );\n } else {\n this._handleItemUndeletion( itemModel );\n }\n this._renderCounts();\n },\n\n _handleItemDeletion : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.deleted += 1;\n contentsShown.active -= 1;\n if( !this.model.contents.includeDeleted ){\n this.removeItemView( itemModel );\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n _handleItemUndeletion : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.deleted -= 1;\n if( !this.model.contents.includeDeleted ){\n contentsShown.active -= 1;\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n /** If this item is hidden and we're not showing hidden items, remove the view\n * @param {Model} the item model to check\n */\n _handleItemVisibleChange : function( itemModel ){\n if( itemModel.hidden() ){\n this._handleItemHidden( itemModel );\n } else {\n this._handleItemUnhidden( itemModel );\n }\n this._renderCounts();\n },\n\n _handleItemHidden : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.hidden += 1;\n contentsShown.active -= 1;\n if( !this.model.contents.includeHidden ){\n this.removeItemView( itemModel );\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n _handleItemUnhidden : function( itemModel ){\n var contentsShown = this.model.get( 'contents_active' );\n contentsShown.hidden -= 1;\n if( !this.model.contents.includeHidden ){\n contentsShown.active -= 1;\n }\n this.model.set( 'contents_active', contentsShown );\n },\n\n /** toggle the visibility of each content's tagsEditor applying all the args sent to this function */\n toggleHDATagEditors : function( showOrHide, speed ){\n _.each( this.views, function( view ){\n if( view.tagsEditor ){\n view.tagsEditor.toggle( showOrHide, speed );\n }\n });\n },\n\n /** toggle the visibility of each content's annotationEditor applying all the args sent to this function */\n toggleHDAAnnotationEditors : function( showOrHide, speed ){\n _.each( this.views, function( view ){\n if( view.annotationEditor ){\n view.annotationEditor.toggle( showOrHide, speed );\n }\n });\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .show-selectors-btn' : 'toggleSelectors',\n 'click .toggle-deleted-link' : function( ev ){ this.toggleShowDeleted(); },\n 'click .toggle-hidden-link' : function( ev ){ this.toggleShowHidden(); }\n }),\n\n // ------------------------------------------------------------------------ search\n _renderSearchProgress : function( limit, offset ){\n var stop = limit + offset;\n return this.$( '> .controls .subtitle' ).html([\n '',\n _l( 'Searching ' ), stop, '/', this.model.contentsShown(),\n ''\n ].join(''));\n },\n\n /** override to display number found in subtitle */\n _renderSearchFindings : function(){\n this.$( '> .controls .subtitle' ).html([\n _l( 'Found' ), this.views.length\n ].join(' '));\n return this;\n },\n\n // ------------------------------------------------------------------------ as drop target\n /** turn all the drag and drop handlers on and add some help text above the drop area */\n dropTargetOn : function(){\n if( this.dropTarget ){ return this; }\n this.dropTarget = true;\n\n //TODO: to init\n var dropHandlers = {\n 'dragenter' : _.bind( this.dragenter, this ),\n 'dragover' : _.bind( this.dragover, this ),\n 'dragleave' : _.bind( this.dragleave, this ),\n 'drop' : _.bind( this.drop, this )\n };\n\n var $dropTarget = this._renderDropTarget();\n this.$list().before([ this._renderDropTargetHelp(), $dropTarget ]);\n for( var evName in dropHandlers ){\n if( dropHandlers.hasOwnProperty( evName ) ){\n //console.debug( evName, dropHandlers[ evName ] );\n $dropTarget.on( evName, dropHandlers[ evName ] );\n }\n }\n return this;\n },\n\n /** render a box to serve as a 'drop here' area on the history */\n _renderDropTarget : function(){\n this.$( '.history-drop-target' ).remove();\n return $( '
                                                      ' ).addClass( 'history-drop-target' );\n },\n\n /** tell the user how it works */\n _renderDropTargetHelp : function(){\n this.$( '.history-drop-target-help' ).remove();\n return $( '
                                                      ' ).addClass( 'history-drop-target-help' )\n .text( _l( 'Drag datasets here to copy them to the current history' ) );\n },\n\n /** shut down drag and drop event handlers and remove drop target */\n dropTargetOff : function(){\n if( !this.dropTarget ){ return this; }\n //this.log( 'dropTargetOff' );\n this.dropTarget = false;\n var dropTarget = this.$( '.history-drop-target' ).get(0);\n for( var evName in this._dropHandlers ){\n if( this._dropHandlers.hasOwnProperty( evName ) ){\n dropTarget.off( evName, this._dropHandlers[ evName ] );\n }\n }\n this.$( '.history-drop-target' ).remove();\n this.$( '.history-drop-target-help' ).remove();\n return this;\n },\n /** toggle the target on/off */\n dropTargetToggle : function(){\n if( this.dropTarget ){\n this.dropTargetOff();\n } else {\n this.dropTargetOn();\n }\n return this;\n },\n\n dragenter : function( ev ){\n //console.debug( 'dragenter:', this, ev );\n ev.preventDefault();\n ev.stopPropagation();\n this.$( '.history-drop-target' ).css( 'border', '2px solid black' );\n },\n dragover : function( ev ){\n ev.preventDefault();\n ev.stopPropagation();\n },\n dragleave : function( ev ){\n //console.debug( 'dragleave:', this, ev );\n ev.preventDefault();\n ev.stopPropagation();\n this.$( '.history-drop-target' ).css( 'border', '1px dashed black' );\n },\n /** when (text) is dropped try to parse as json and trigger an event */\n drop : function( ev ){\n ev.preventDefault();\n //ev.stopPropagation();\n\n var self = this;\n var dataTransfer = ev.originalEvent.dataTransfer;\n var data = dataTransfer.getData( \"text\" );\n\n dataTransfer.dropEffect = 'move';\n try {\n data = JSON.parse( data );\n } catch( err ){\n self.warn( 'error parsing JSON from drop:', data );\n }\n\n self.trigger( 'droptarget:drop', ev, data, self );\n return false;\n },\n\n /** handler that copies data into the contents */\n dataDropped : function( data ){\n var self = this;\n // HDA: dropping will copy it to the history\n if( _.isObject( data ) && data.model_class === 'HistoryDatasetAssociation' && data.id ){\n if( self.contents.currentPage !== 0 ){\n return self.contents.fetchPage( 0 )\n .then( function(){\n return self.model.contents.copy( data.id );\n });\n }\n return self.model.contents.copy( data.id );\n }\n return jQuery.when();\n },\n\n // ........................................................................ misc\n /** Return a string rep of the history */\n toString : function(){\n return 'HistoryViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n//------------------------------------------------------------------------------ TEMPLATES\nHistoryViewEdit.prototype.templates = (function(){\n\n var countsTemplate = BASE_MVC.wrapTemplate([\n '<% var shown = Math.max( view.views.length, history.contents_active.active ) %>',\n '<% if( shown ){ %>',\n '',\n '<%- shown %> ', _l( 'shown' ),\n '',\n '<% } %>',\n\n '<% if( history.contents_active.deleted ){ %>',\n '',\n '<% if( view.model.contents.includeDeleted ){ %>',\n '',\n _l( 'hide deleted' ),\n '',\n '<% } else { %>',\n '<%- history.contents_active.deleted %> ',\n '',\n _l( 'deleted' ),\n '',\n '<% } %>',\n '',\n '<% } %>',\n\n '<% if( history.contents_active.hidden ){ %>',\n '',\n '<% if( view.model.contents.includeHidden ){ %>',\n '',\n _l( 'hide hidden' ),\n '',\n '<% } else { %>',\n '<%- history.contents_active.hidden %> ',\n '',\n _l( 'hidden' ),\n '',\n '<% } %>',\n '',\n '<% } %>',\n ], 'history' );\n\n return _.extend( _.clone( _super.prototype.templates ), {\n counts : countsTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n HistoryViewEdit : HistoryViewEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-view-edit.js","define([\n \"mvc/list/list-view\",\n \"mvc/history/history-model\",\n \"mvc/history/history-contents\",\n \"mvc/history/history-preferences\",\n \"mvc/history/hda-li\",\n \"mvc/history/hdca-li\",\n \"mvc/user/user-model\",\n \"mvc/ui/error-modal\",\n \"ui/fa-icon-button\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/search-input\"\n], function(\n LIST_VIEW,\n HISTORY_MODEL,\n HISTORY_CONTENTS,\n HISTORY_PREFS,\n HDA_LI,\n HDCA_LI,\n USER,\n ERROR_MODAL,\n faIconButton,\n BASE_MVC,\n _l\n){\n'use strict';\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a history model.\n * Allows:\n * changing the loaded history\n * displaying data, info, and download\n * tracking history attrs: size, tags, annotations, name, etc.\n * Does not allow:\n * changing the name\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar HistoryView = _super.extend(\n/** @lends HistoryView.prototype */{\n _logNamespace : 'history',\n\n /** class to use for constructing the HDA views */\n HDAViewClass : HDA_LI.HDAListItemView,\n /** class to use for constructing the HDCA views */\n HDCAViewClass : HDCA_LI.HDCAListItemView,\n /** class to used for constructing collection of sub-view models */\n collectionClass : HISTORY_CONTENTS.HistoryContents,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey : 'contents',\n\n tagName : 'div',\n className : _super.prototype.className + ' history-panel',\n\n /** string to display when the collection is empty */\n emptyMsg : _l( 'This history is empty' ),\n /** displayed when no items match the search terms */\n noneFoundMsg : _l( 'No matching datasets found' ),\n /** string used for search placeholder */\n searchPlaceholder : _l( 'search datasets' ),\n\n /** @type {Number} ms to wait after history load to fetch/decorate hdcas with element_count */\n FETCH_COLLECTION_COUNTS_DELAY : 2000,\n\n // ......................................................................... SET UP\n /** Set up the view, bind listeners.\n * @param {Object} attributes optional settings for the panel\n */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n // ---- instance vars\n // control contents/behavior based on where (and in what context) the panel is being used\n /** where should pages from links be displayed? (default to new tab/window) */\n this.linkTarget = attributes.linkTarget || '_blank';\n },\n\n /** create and return a collection for when none is initially passed */\n _createDefaultCollection : function(){\n // override\n return new this.collectionClass([], { history: this.model });\n },\n\n /** In this override, clear the update timer on the model */\n freeModel : function(){\n _super.prototype.freeModel.call( this );\n if( this.model ){\n this.model.clearUpdateTimeout();\n }\n return this;\n },\n\n /** create any event listeners for the panel\n * @fires: rendered:initial on the first render\n * @fires: empty-history when switching to a history with no contents or creating a new history\n */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n this.on({\n error : function( model, xhr, options, msg, details ){\n this.errorHandler( model, xhr, options, msg, details );\n },\n 'loading-done' : function(){\n var self = this;\n // after the initial load, decorate with more time consuming fields (like HDCA element_counts)\n _.delay( function(){\n self.model.contents.fetchCollectionCounts();\n }, self.FETCH_COLLECTION_COUNTS_DELAY );\n },\n 'views:ready view:attached view:removed' : function( view ){\n this._renderSelectButton();\n },\n 'view:attached' : function( view ){\n this.scrollTo(0);\n },\n });\n // this.on( 'all', function(){ console.debug( arguments ); });\n },\n\n // ------------------------------------------------------------------------ loading history/hda models\n /** load the history with the given id then it's contents, sending ajax options to both */\n loadHistory : function( historyId, options, contentsOptions ){\n contentsOptions = _.extend( contentsOptions || { silent: true });\n this.info( 'loadHistory:', historyId, options, contentsOptions );\n var self = this;\n self.setModel( new HISTORY_MODEL.History({ id : historyId }) );\n\n contentsOptions.silent = true;\n self.trigger( 'loading' );\n return self.model\n .fetchWithContents( options, contentsOptions )\n .always( function(){\n self.render();\n self.trigger( 'loading-done' );\n });\n },\n\n /** convenience alias to the model. Updates the item list only (not the history) */\n refreshContents : function( options ){\n if( this.model ){\n return this.model.refresh( options );\n }\n // may have callbacks - so return an empty promise\n return $.when();\n },\n\n /** Override to reset web storage when the id changes (since it needs the id) */\n _setUpCollectionListeners : function(){\n _super.prototype._setUpCollectionListeners.call( this );\n return this.listenTo( this.collection, {\n // 'all' : function(){ console.log( this.collection + ':', arguments ); },\n 'fetching-more' : function(){\n this._toggleContentsLoadingIndicator( true );\n this.$emptyMessage().hide();\n },\n 'fetching-more-done': function(){ this._toggleContentsLoadingIndicator( false ); },\n });\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n _showLoadingIndicator : function( msg, speed, callback ){\n var $indicator = $( '
                                                      ' );\n this.$el.html( $indicator.text( msg ).slideDown( !_.isUndefined( speed )? speed : this.fxSpeed ) );\n },\n\n /** hide the loading indicator */\n _hideLoadingIndicator : function( speed ){\n // make speed a bit slower to compensate for slow rendering of up to 500 contents\n this.$( '.loading-indicator' ).slideUp( !_.isUndefined( speed )? speed : ( this.fxSpeed + 200 ), function(){\n $( this ).remove();\n });\n },\n\n /** In this override, add a btn to toggle the selectors */\n _buildNewRender : function(){\n var $newRender = _super.prototype._buildNewRender.call( this );\n this._renderSelectButton( $newRender );\n return $newRender;\n },\n\n /** button for starting select mode */\n _renderSelectButton : function( $where ){\n $where = $where || this.$el;\n // do not render selector option if no actions\n if( !this.multiselectActions().length ){\n return null;\n }\n // do not render (and remove even) if nothing to select\n if( !this.views.length ){\n this.hideSelectors();\n $where.find( '.controls .actions .show-selectors-btn' ).remove();\n return null;\n }\n // don't bother rendering if there's one already\n var $existing = $where.find( '.controls .actions .show-selectors-btn' );\n if( $existing.length ){\n return $existing;\n }\n\n return faIconButton({\n title : _l( 'Operations on multiple datasets' ),\n classes : 'show-selectors-btn',\n faIcon : 'fa-check-square-o'\n }).prependTo( $where.find( '.controls .actions' ) );\n },\n\n /** override to avoid showing intial empty message using contents_active */\n _renderEmptyMessage : function( $whereTo ){\n var self = this;\n var $emptyMsg = self.$emptyMessage( $whereTo );\n\n var empty = self.model.get( 'contents_active' ).active <= 0;\n if( empty ){\n return $emptyMsg.empty().append( self.emptyMsg ).show();\n\n } else if( self.searchFor && self.model.contents.haveSearchDetails() && !self.views.length ){\n return $emptyMsg.empty().append( self.noneFoundMsg ).show();\n }\n $emptyMsg.hide();\n return $();\n },\n\n /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n $scrollContainer : function( $where ){\n // override or set via attributes.$scrollContainer\n return this.$list( $where );\n },\n\n // ------------------------------------------------------------------------ subviews\n _toggleContentsLoadingIndicator : function( show ){\n if( !show ){\n this.$list().find( '.contents-loading-indicator' ).remove();\n } else {\n this.$list().html( '
                                                      '\n + '
                                                      ' );\n }\n },\n\n /** override to render pagination also */\n renderItems: function( $whereTo ){\n // console.log( this + '.renderItems-----------------', new Date() );\n $whereTo = $whereTo || this.$el;\n var self = this;\n var $list = self.$list( $whereTo );\n\n // TODO: bootstrap hack to remove orphaned tooltips\n $( '.tooltip' ).remove();\n\n $list.empty();\n self.views = [];\n\n var models = self._filterCollection();\n if( models.length ){\n self._renderPagination( $whereTo );\n self.views = self._renderSomeItems( models, $list );\n } else {\n // TODO: consolidate with _renderPagination above by (???) passing in models/length?\n $whereTo.find( '> .controls .list-pagination' ).empty();\n }\n self._renderEmptyMessage( $whereTo ).toggle( !models.length );\n\n self.trigger( 'views:ready', self.views );\n return self.views;\n },\n\n /** render pagination controls if not searching and contents says we're paginating */\n _renderPagination: function( $whereTo ){\n var $paginationControls = $whereTo.find( '> .controls .list-pagination' );\n if( this.searchFor || !this.model.contents.shouldPaginate() ) return $paginationControls.empty();\n\n $paginationControls.html( this.templates.pagination({\n // pagination is 1-based for the user\n current : this.model.contents.currentPage + 1,\n last : this.model.contents.getLastPage() + 1,\n }, this ));\n $paginationControls.find( 'select.pages' ).tooltip();\n return $paginationControls;\n },\n\n /** render a subset of the entire collection (client-side pagination) */\n _renderSomeItems: function( models, $list ){\n var self = this;\n var views = [];\n $list.append( models.map( function( m ){\n var view = self._createItemView( m );\n views.push( view );\n return self._renderItemView$el( view );\n }));\n return views;\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** in this override, check if the contents would also display based on includeDeleted/hidden */\n _filterItem : function( model ){\n var self = this;\n var contents = self.model.contents;\n return ( contents.includeHidden || !model.hidden() )\n && ( contents.includeDeleted || !model.isDeletedOrPurged() )\n && ( _super.prototype._filterItem.call( self, model ) );\n },\n\n /** In this override, since history contents are mixed,\n * get the appropo view class based on history_content_type\n */\n _getItemViewClass : function( model ){\n var contentType = model.get( \"history_content_type\" );\n switch( contentType ){\n case 'dataset':\n return this.HDAViewClass;\n case 'dataset_collection':\n return this.HDCAViewClass;\n }\n throw new TypeError( 'Unknown history_content_type: ' + contentType );\n },\n\n /** in this override, add a linktarget, and expand if id is in web storage */\n _getItemViewOptions : function( model ){\n var options = _super.prototype._getItemViewOptions.call( this, model );\n return _.extend( options, {\n linkTarget : this.linkTarget,\n expanded : this.model.contents.storage.isExpanded( model.id ),\n hasUser : this.model.ownedByCurrUser()\n });\n },\n\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n _super.prototype._setUpItemViewListeners.call( panel, view );\n //TODO: send from content view: this.model.collection.storage.addExpanded\n // maintain a list of items whose bodies are expanded\n return panel.listenTo( view, {\n 'expanded': function( v ){\n panel.model.contents.storage.addExpanded( v.model );\n },\n 'collapsed': function( v ){\n panel.model.contents.storage.removeExpanded( v.model );\n }\n });\n },\n\n /** override to remove expandedIds from webstorage */\n collapseAll : function(){\n this.model.contents.storage.clearExpanded();\n _super.prototype.collapseAll.call( this );\n },\n\n // ------------------------------------------------------------------------ selection\n /** Override to correctly set the historyId of the new collection */\n getSelectedModels : function(){\n var collection = _super.prototype.getSelectedModels.call( this );\n collection.historyId = this.collection.historyId;\n return collection;\n },\n\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .show-selectors-btn' : 'toggleSelectors',\n 'click > .controls .prev' : '_clickPrevPage',\n 'click > .controls .next' : '_clickNextPage',\n 'change > .controls .pages' : '_changePageSelect',\n // allow (error) messages to be clicked away\n 'click .messages [class$=message]' : 'clearMessages',\n }),\n\n _clickPrevPage : function( ev ){\n this.model.clearUpdateTimeout();\n this.model.contents.fetchPrevPage();\n },\n\n _clickNextPage : function( ev ){\n this.model.clearUpdateTimeout();\n this.model.contents.fetchNextPage();\n },\n\n _changePageSelect : function( ev ){\n this.model.clearUpdateTimeout();\n var page = $( ev.currentTarget ).val();\n this.model.contents.fetchPage( page );\n },\n\n /** Toggle and store the deleted visibility and re-render items\n * @returns {Boolean} new setting\n */\n toggleShowDeleted : function( show, options ){\n show = ( show !== undefined )?( show ):( !this.model.contents.includeDeleted );\n var self = this;\n var contents = self.model.contents;\n contents.setIncludeDeleted( show, options );\n self.trigger( 'show-deleted', show );\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** Toggle and store whether to render explicity hidden contents\n * @returns {Boolean} new setting\n */\n toggleShowHidden : function( show, store, options ){\n // console.log( 'toggleShowHidden', show, store );\n show = ( show !== undefined )?( show ):( !this.model.contents.includeHidden );\n var self = this;\n var contents = self.model.contents;\n contents.setIncludeHidden( show, options );\n self.trigger( 'show-hidden', show );\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** On the first search, if there are no details - load them, then search */\n _firstSearch : function( searchFor ){\n var self = this;\n var inputSelector = '> .controls .search-input';\n this.log( 'onFirstSearch', searchFor );\n\n // if the contents already have enough details to search, search and return now\n if( self.model.contents.haveSearchDetails() ){\n self.searchItems( searchFor );\n return;\n }\n\n // otherwise, load the details progressively here\n self.$( inputSelector ).searchInput( 'toggle-loading' );\n // set this now so that only results will show during progress\n self.searchFor = searchFor;\n var xhr = self.model.contents.progressivelyFetchDetails({ silent: true })\n .progress( function( response, limit, offset ){\n self.renderItems();\n self.trigger( 'search:loading-progress', limit, offset );\n })\n .always( function(){\n self.$el.find( inputSelector ).searchInput( 'toggle-loading' );\n })\n .done( function(){\n self.searchItems( searchFor, 'force' );\n });\n },\n\n /** clear the search filters and show all views that are normally shown */\n clearSearch : function( searchFor ){\n var self = this;\n if( !self.searchFor ) return self;\n //self.log( 'onSearchClear', self );\n self.searchFor = '';\n self.trigger( 'search:clear', self );\n self.$( '> .controls .search-query' ).val( '' );\n // NOTE: silent + render prevents collection update event with merge only\n // - which causes an empty page due to event handler above\n self.model.contents.fetchCurrentPage({ silent: true })\n .done( function(){\n self.renderItems();\n });\n return self;\n },\n\n // ........................................................................ error handling\n /** Event handler for errors (from the panel, the history, or the history's contents)\n * Alternately use two strings for model and xhr to use custom message and title (respectively)\n * @param {Model or View} model the (Backbone) source of the error\n * @param {XMLHTTPRequest} xhr any ajax obj. assoc. with the error\n * @param {Object} options the options map commonly used with bbone ajax\n */\n errorHandler : function( model, xhr, options ){\n //TODO: to mixin or base model\n // interrupted ajax or no connection\n if( xhr && xhr.status === 0 && xhr.readyState === 0 ){\n // return ERROR_MODAL.offlineErrorModal();\n // fail silently\n return;\n }\n // otherwise, leave something to report in the console\n this.error( model, xhr, options );\n // and feedback to a modal\n // if sent two strings (and possibly details as 'options'), use those as message and title\n if( _.isString( model ) && _.isString( xhr ) ){\n var message = model;\n var title = xhr;\n return ERROR_MODAL.errorModal( message, title, options );\n }\n // bad gateway\n // TODO: possibly to global handler\n if( xhr && xhr.status === 502 ){\n return ERROR_MODAL.badGatewayErrorModal();\n }\n return ERROR_MODAL.ajaxErrorModal( model, xhr, options );\n },\n\n /** Remove all messages from the panel. */\n clearMessages : function( ev ){\n var $target = !_.isUndefined( ev )?\n $( ev.currentTarget )\n :this.$messages().children( '[class$=\"message\"]' );\n $target.fadeOut( this.fxSpeed, function(){\n $( this ).remove();\n });\n return this;\n },\n\n // ........................................................................ scrolling\n /** Scrolls the panel to show the content sub-view with the given hid.\n * @param {Integer} hid the hid of item to scroll into view\n * @returns {HistoryView} the panel\n */\n scrollToHid : function( hid ){\n return this.scrollToItem( _.first( this.viewsWhereModel({ hid: hid }) ) );\n },\n\n // ........................................................................ misc\n /** utility for adding -st, -nd, -rd, -th to numbers */\n ordinalIndicator : function( number ){\n var numStr = number + '';\n switch( numStr.charAt( numStr.length - 1 )){\n case '1': return numStr + 'st';\n case '2': return numStr + 'nd';\n case '3': return numStr + 'rd';\n default : return numStr + 'th';\n }\n },\n\n /** Return a string rep of the history */\n toString : function(){\n return 'HistoryView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//------------------------------------------------------------------------------ TEMPLATES\nHistoryView.prototype.templates = (function(){\n\n var mainTemplate = BASE_MVC.wrapTemplate([\n // temp container\n '
                                                      ',\n '
                                                      ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        '\n ]);\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                                                        ',\n '
                                                        ',\n '
                                                        <%- history.name %>
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        <%- history.nice_size %>
                                                        ',\n\n '
                                                        ',\n\n '
                                                        ',\n '<% if( history.deleted && history.purged ){ %>',\n '
                                                        ',\n _l( 'This history has been purged and deleted' ),\n '
                                                        ',\n '<% } else if( history.deleted ){ %>',\n '
                                                        ',\n _l( 'This history has been deleted' ),\n '
                                                        ',\n '<% } else if( history.purged ){ %>',\n '
                                                        ',\n _l( 'This history has been purged' ),\n '
                                                        ',\n '<% } %>',\n\n '<% if( history.message ){ %>',\n // should already be localized\n '
                                                        messagesmall\">',\n '<%= history.message.text %>',\n '
                                                        ',\n '<% } %>',\n '
                                                        ',\n\n // add tags and annotations\n '
                                                        ',\n '
                                                        ',\n\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n\n '
                                                        ',\n '
                                                        ',\n '',\n '',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        '\n ], 'history' );\n\n var paginationTemplate = BASE_MVC.wrapTemplate([\n '',\n '',\n '',\n ], 'pages' );\n\n return _.extend( _.clone( _super.prototype.templates ), {\n el : mainTemplate,\n controls : controlsTemplate,\n pagination : paginationTemplate,\n });\n}());\n\n\n//==============================================================================\n return {\n HistoryView: HistoryView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-view.js","define([\n \"mvc/ui/popup-menu\",\n \"mvc/history/copy-dialog\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"mvc/webhooks\"\n], function( PopupMenu, historyCopyDialog, BASE_MVC, _l, Webhooks ){\n\n'use strict';\n\n// ============================================================================\nvar menu = [\n {\n html : _l( 'History Lists' ),\n header : true\n },\n {\n html : _l( 'Saved Histories' ),\n href : 'histories/list',\n target : '_top'\n\n },\n {\n html : _l( 'Histories Shared with Me' ),\n href : 'histories/list_shared',\n target : '_top'\n },\n {\n html : _l( 'Current History' ),\n header : true,\n anon : true\n },\n {\n html : _l( 'Create New' ),\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel ){\n Galaxy.currHistoryPanel.createNewHistory();\n }\n },\n },\n {\n html : _l( 'Copy History' ),\n func : function() {\n historyCopyDialog( Galaxy.currHistoryPanel.model )\n .done( function(){\n Galaxy.currHistoryPanel.loadCurrentHistory();\n });\n },\n },\n {\n html : _l( 'Share or Publish' ),\n href : 'history/sharing',\n },\n {\n html : _l( 'Show Structure' ),\n href : 'history/display_structured',\n anon : true,\n },\n {\n html : _l( 'Extract Workflow' ),\n href : 'workflow/build_from_current_history',\n },\n {\n html : _l( 'Delete' ),\n anon : true,\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really delete the current history?' ) ) ){\n Galaxy.currHistoryPanel.model._delete().done(function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n {\n html : _l( 'Delete Permanently' ),\n purge : true,\n anon : true,\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel\n && confirm( _l( 'Really delete the current history permanently? This cannot be undone.' ) ) ){\n Galaxy.currHistoryPanel.model.purge().done(function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n\n\n {\n html : _l( 'Dataset Actions' ),\n header : true,\n anon : true\n },\n {\n html : _l( 'Copy Datasets' ),\n href : 'dataset/copy_datasets',\n },\n {\n html : _l( 'Dataset Security' ),\n href : 'root/history_set_default_permissions',\n },\n {\n html : _l( 'Resume Paused Jobs' ),\n href : 'history/resume_paused_jobs?current=True',\n anon : true,\n },\n {\n html : _l( 'Collapse Expanded Datasets' ),\n func : function() {\n if( Galaxy && Galaxy.currHistoryPanel ){\n Galaxy.currHistoryPanel.collapseAll();\n }\n },\n },\n {\n html : _l( 'Unhide Hidden Datasets' ),\n anon : true,\n func : function() {\n // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really unhide all hidden datasets?' ) ) ){\n $.post(Galaxy.root + \"history/adjust_hidden\",\n { 'user_action' : 'unhide' },\n function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n {\n html : _l( 'Delete Hidden Datasets' ),\n anon : true,\n func : function() {\n // TODO: Deprecate this functionality and replace with group dataset selector and action combination\n if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really delete all hidden datasets?' ) ) ){\n $.post(Galaxy.root + \"history/adjust_hidden\",\n { 'user_action' : 'delete' },\n function(){Galaxy.currHistoryPanel.loadCurrentHistory();});\n }\n },\n },\n {\n html : _l( 'Purge Deleted Datasets' ),\n confirm : _l( 'Really delete all deleted datasets permanently? This cannot be undone.' ),\n href : 'history/purge_deleted_datasets',\n purge : true,\n anon : true,\n },\n\n\n {\n html : _l( 'Downloads' ),\n header : true\n },\n {\n html : _l( 'Export Tool Citations' ),\n href : 'history/citations',\n anon : true,\n },\n {\n html : _l( 'Export History to File' ),\n href : 'history/export_archive?preview=True',\n anon : true,\n },\n\n {\n html : _l( 'Other Actions' ),\n header : true\n },\n {\n html : _l( 'Import from File' ),\n href : 'history/import_archive',\n }\n];\n\n// Webhooks\nWebhooks.add({\n url: 'api/webhooks/history-menu/all',\n async: false, // (hypothetically) slows down the performance\n callback: function(webhooks) {\n var webhooks_menu = [];\n\n $.each(webhooks.models, function(index, model) {\n var webhook = model.toJSON();\n if (webhook.activate) {\n webhooks_menu.push({\n html : _l( webhook.config.title ),\n // func: function() {},\n anon : true\n });\n }\n });\n\n if (webhooks_menu.length > 0) {\n webhooks_menu.unshift({\n html : _l( 'Webhooks' ),\n header : true\n });\n $.merge(menu, webhooks_menu);\n }\n }\n});\n\n\nfunction buildMenu( isAnon, purgeAllowed, urlRoot ){\n return _.clone( menu ).filter( function( menuOption ){\n if( isAnon && !menuOption.anon ){\n return false;\n }\n if( !purgeAllowed && menuOption.purge ){\n return false;\n }\n\n //TODO:?? hard-coded galaxy_main\n if( menuOption.href ){\n menuOption.href = urlRoot + menuOption.href;\n menuOption.target = menuOption.target || 'galaxy_main';\n }\n\n if( menuOption.confirm ){\n menuOption.func = function(){\n if( confirm( menuOption.confirm ) ){\n galaxy_main.location = menuOption.href;\n }\n };\n }\n return true;\n });\n}\n\nvar create = function( $button, options ){\n options = options || {};\n var isAnon = options.anonymous === undefined? true : options.anonymous,\n purgeAllowed = options.purgeAllowed || false,\n menu = buildMenu( isAnon, purgeAllowed, Galaxy.root );\n //console.debug( 'menu:', menu );\n return new PopupMenu( $button, menu );\n};\n\n\n// ============================================================================\n return create;\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/options-menu.js","/** Renders the collection uploader rows */\ndefine( [ 'utils/utils', 'mvc/upload/upload-model', 'mvc/upload/upload-settings', 'mvc/ui/ui-popover', 'mvc/ui/ui-select' ],\nfunction( Utils, UploadModel, UploadSettings, Popover, Select ) {\n return Backbone.View.extend({\n /** Dictionary of upload states and associated icons */\n status_classes : {\n init : 'upload-icon-button fa fa-trash-o',\n queued : 'upload-icon fa fa-spinner fa-spin',\n running : 'upload-icon fa fa-spinner fa-spin',\n success : 'upload-icon-button fa fa-check',\n error : 'upload-icon-button fa fa-exclamation-triangle'\n },\n\n initialize: function( app, options ) {\n var self = this;\n this.app = app;\n this.model = options.model;\n this.setElement( this._template( options.model ) );\n this.$mode = this.$( '.upload-mode' );\n this.$title = this.$( '.upload-title-extended' );\n this.$text = this.$( '.upload-text' );\n this.$size = this.$( '.upload-size' );\n this.$info_text = this.$( '.upload-info-text' );\n this.$info_progress = this.$( '.upload-info-progress' );\n this.$text_content = this.$( '.upload-text-content' );\n this.$symbol = this.$( '.upload-symbol' );\n this.$progress_bar = this.$( '.upload-progress-bar' );\n this.$percentage = this.$( '.upload-percentage' );\n\n // append popup to settings icon\n this.settings = new Popover.View({\n title : 'Upload configuration',\n container : this.$( '.upload-settings' ),\n placement : 'bottom'\n });\n\n // identify default genome and extension values\n var default_genome = this.app.select_genome.value();\n var default_extension = this.app.select_extension.value();\n\n // handle click event\n this.$symbol.on('click', function() { self._removeRow(); });\n\n // handle text editing event\n this.$text_content.on( 'change input', function( e ) {\n self.model.set( { 'url_paste': $( e.target ).val(),\n 'file_size': $( e.target ).val().length } );\n });\n\n // model events\n this.listenTo( this.model, 'change:percentage', function() { self._refreshPercentage() } );\n this.listenTo( this.model, 'change:status', function() { self._refreshStatus() } );\n this.listenTo( this.model, 'change:info', function() { self._refreshInfo() } );\n this.listenTo( this.model, 'change:file_size', function() { self._refreshFileSize() } );\n this.listenTo( this.model, 'remove', function() { self.remove() } );\n this.app.collection.on('reset', function() { self.remove() } );\n },\n\n render: function() {\n var options = this.model.attributes;\n this.$title.html( _.escape( options.file_name ) );\n this.$size.html( Utils.bytesToString ( options.file_size ) );\n this.$mode.removeClass().addClass( 'upload-mode' ).addClass( 'text-primary' );\n if ( options.file_mode == 'new' ) {\n this.$text.css( { 'width' : this.$el.width() - 16 + 'px', 'top' : this.$el.height() - 8 + 'px' } ).show();\n this.$el.height( this.$el.height() - 8 + this.$text.height() + 16 );\n this.$mode.addClass( 'fa fa-edit' );\n } else if ( options.file_mode == 'local' ) {\n this.$mode.addClass( 'fa fa-laptop' );\n } else if ( options.file_mode == 'ftp' ) {\n this.$mode.addClass( 'fa fa-folder-open-o' );\n }\n },\n\n /** Refresh info text */\n _refreshInfo: function() {\n var info = this.model.get( 'info' );\n if ( info ) {\n this.$info_text.html( 'Failed: ' + info ).show();\n } else {\n this.$info_text.hide();\n }\n },\n\n /** Refresh percentage status */\n _refreshPercentage : function() {\n var percentage = parseInt( this.model.get( 'percentage' ) );\n this.$progress_bar.css( { width : percentage + '%' } );\n this.$percentage.html( percentage != 100 ? percentage + '%' : 'Adding to history...' );\n },\n\n /** Refresh status */\n _refreshStatus : function() {\n var status = this.model.get( 'status' );\n this.$symbol.removeClass().addClass( 'upload-symbol' ).addClass( this.status_classes[ status ] );\n this.model.set( 'enabled', status == 'init' );\n var enabled = this.model.get( 'enabled' );\n this.$text_content.attr( 'disabled', !enabled );\n if ( status == 'success' ) {\n this.$el.addClass( 'success' );\n this.$percentage.html( '100%' );\n }\n if ( status == 'error' ) {\n this.$el.addClass( 'danger' );\n this.$info_progress.hide();\n }\n },\n\n /** Refresh file size */\n _refreshFileSize: function() {\n this.$size.html( Utils.bytesToString ( this.model.get( 'file_size' ) ) );\n },\n\n /** Remove row */\n _removeRow: function() {\n if ( [ 'init', 'success', 'error' ].indexOf( this.model.get( 'status' ) ) !== -1 ) {\n this.app.collection.remove( this.model );\n }\n },\n\n /** Attach file info popup */\n _showSettings : function() {\n if ( !this.settings.visible ) {\n this.settings.empty();\n this.settings.append( ( new UploadSettings( this ) ).$el );\n this.settings.show();\n } else {\n this.settings.hide();\n }\n },\n\n /** View template */\n _template: function( options ) {\n return '
                                                        ' +\n ' from table fragments\n\t\t\t\t\t\tif (!support.tbody) {\n\t\n\t\t\t\t\t\t\t// String was a
                                                        ' ).append( $checkbox ) )\n .append( $( '' ).append( parameter.title ) ) )\n });\n this.$cover[ this.model.get( 'enabled' ) && 'hide' || 'show' ]();\n }\n });\n});\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/upload/upload-settings.js","/*\n galaxy upload plugins - requires FormData and XMLHttpRequest\n*/\n;(function($){\n // add event properties\n jQuery.event.props.push(\"dataTransfer\");\n\n /**\n Posts file data to the API\n */\n $.uploadpost = function (config) {\n // parse options\n var cnf = $.extend({}, {\n data : {},\n success : function() {},\n error : function() {},\n progress : function() {},\n url : null,\n maxfilesize : 2048,\n error_filesize : 'File exceeds 2GB. Please use a FTP client.',\n error_default : 'Please make sure the file is available.',\n error_server : 'Upload request failed.',\n error_login : 'Uploads require you to log in.'\n }, config);\n\n // link data\n var data = cnf.data;\n\n // check errors\n if (data.error_message) {\n cnf.error(data.error_message);\n return;\n }\n\n // construct form data\n var form = new FormData();\n for (var key in data.payload) {\n form.append(key, data.payload[key]);\n }\n\n // add files to submission\n var sizes = 0;\n for (var key in data.files) {\n var d = data.files[key];\n form.append(d.name, d.file, d.file.name);\n sizes += d.file.size;\n }\n\n // check file size, unless it's an ftp file\n if (sizes > 1048576 * cnf.maxfilesize) {\n cnf.error(cnf.error_filesize);\n return;\n }\n\n // prepare request\n var xhr = new XMLHttpRequest();\n xhr.open('POST', cnf.url, true);\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.setRequestHeader('Cache-Control', 'no-cache');\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\n // captures state changes\n xhr.onreadystatechange = function() {\n // check for request completed, server connection closed\n if (xhr.readyState == xhr.DONE) {\n // parse response\n var response = null;\n var extra_info = \"\";\n if (xhr.responseText) {\n try {\n response = jQuery.parseJSON(xhr.responseText);\n extra_info = response.err_msg;\n } catch (e) {\n response = xhr.responseText;\n extra_info = response;\n }\n }\n // pass any error to the error option\n if (xhr.status < 200 || xhr.status > 299) {\n var text = xhr.statusText;\n if (xhr.status == 403) {\n text = cnf.error_login;\n } else if (xhr.status == 0) {\n text = cnf.error_server;\n } else if (!text) {\n text = cnf.error_default;\n }\n cnf.error(text + ' (' + xhr.status + '). ' + extra_info);\n } else {\n cnf.success(response);\n }\n }\n }\n\n // prepare upload progress\n xhr.upload.addEventListener('progress', function(e) {\n if (e.lengthComputable) {\n cnf.progress(Math.round((e.loaded * 100) / e.total));\n }\n }, false);\n\n // send request\n Galaxy.emit.debug('uploadbox::uploadpost()', 'Posting following data.', cnf);\n xhr.send(form);\n }\n\n /**\n Handles the upload events drag/drop etc.\n */\n $.fn.uploadinput = function(options) {\n // initialize\n var el = this;\n var opts = $.extend({}, {\n ondragover : function() {},\n ondragleave : function() {},\n onchange : function() {},\n multiple : false\n }, options);\n\n // append hidden upload field\n var $input = $('');\n el.append($input.change(function (e) {\n opts.onchange(e.target.files);\n $(this).val('');\n }));\n\n // drag/drop events\n el.on('drop', function (e) {\n opts.ondragleave(e);\n if(e.dataTransfer) {\n opts.onchange(e.dataTransfer.files);\n e.preventDefault();\n }\n });\n el.on('dragover', function (e) {\n e.preventDefault();\n opts.ondragover(e);\n });\n el.on('dragleave', function (e) {\n e.stopPropagation();\n opts.ondragleave(e);\n });\n\n // exports\n return {\n dialog: function () {\n $input.trigger('click');\n }\n }\n }\n\n /**\n Handles the upload queue and events such as drag/drop etc.\n */\n $.fn.uploadbox = function(options) {\n // parse options\n var opts = $.extend({}, {\n dragover : function() {},\n dragleave : function() {},\n announce : function(d) {},\n initialize : function(d) {},\n progress : function(d, m) {},\n success : function(d, m) {},\n error : function(d, m) { alert(m); },\n complete : function() {}\n }, options);\n\n // file queue\n var queue = {};\n\n // queue index/length counter\n var queue_index = 0;\n var queue_length = 0;\n\n // indicates if queue is currently running\n var queue_running = false;\n var queue_stop = false;\n\n // element\n var uploadinput = $(this).uploadinput({\n multiple : true,\n onchange : function(files) { add(files); },\n ondragover : options.ondragover,\n ondragleave : options.ondragleave\n });\n\n // add new files to upload queue\n function add(files) {\n if (files && files.length && !queue_running) {\n var current_index = queue_index;\n _.each(files, function(file, key) {\n if (file.mode !== 'new' && _.filter(queue, function(f) {\n return f.name === file.name && f.size === file.size;\n }).length) {\n file.duplicate = true;\n }\n });\n _.each(files, function(file) {\n if (!file.duplicate) {\n var index = String(queue_index++);\n queue[index] = file;\n opts.announce(index, queue[index]);\n queue_length++;\n }\n });\n return current_index;\n }\n }\n\n // remove file from queue\n function remove(index) {\n if (queue[index]) {\n delete queue[index];\n queue_length--;\n }\n }\n\n // process an upload, recursive\n function process() {\n // validate\n if (queue_length == 0 || queue_stop) {\n queue_stop = false;\n queue_running = false;\n opts.complete();\n return;\n } else {\n queue_running = true;\n }\n\n // get an identifier from the queue\n var index = -1;\n for (var key in queue) {\n index = key;\n break;\n }\n\n // get current file from queue\n var file = queue[index];\n\n // remove from queue\n remove(index)\n\n // create and submit data\n $.uploadpost({\n url : opts.url,\n data : opts.initialize(index),\n success : function(message) { opts.success(index, message); process();},\n error : function(message) { opts.error(index, message); process();},\n progress : function(percentage) { opts.progress(index, percentage); }\n });\n }\n\n /*\n public interface\n */\n\n // open file browser for selection\n function select() {\n uploadinput.dialog();\n }\n\n // remove all entries from queue\n function reset(index) {\n for (index in queue) {\n remove(index);\n }\n }\n\n // initiate upload process\n function start() {\n if (!queue_running) {\n queue_running = true;\n process();\n }\n }\n\n // stop upload process\n function stop() {\n queue_stop = true;\n }\n\n // set options\n function configure(options) {\n opts = $.extend({}, opts, options);\n return opts;\n }\n\n // verify browser compatibility\n function compatible() {\n return window.File && window.FormData && window.XMLHttpRequest && window.FileList;\n }\n\n // export functions\n return {\n 'select' : select,\n 'add' : add,\n 'remove' : remove,\n 'start' : start,\n 'stop' : stop,\n 'reset' : reset,\n 'configure' : configure,\n 'compatible' : compatible\n };\n }\n})(jQuery);\n\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/utils/uploadbox.js","define([\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function( baseMVC, _l ){\n// =============================================================================\n/** A view on any model that has a 'annotation' attribute\n */\nvar AnnotationEditor = Backbone.View\n .extend( baseMVC.LoggableMixin )\n .extend( baseMVC.HiddenUntilActivatedViewMixin ).extend({\n\n tagName : 'div',\n className : 'annotation-display',\n\n /** Set up listeners, parse options */\n initialize : function( options ){\n options = options || {};\n this.tooltipConfig = options.tooltipConfig || { placement: 'bottom' };\n //console.debug( this, options );\n // only listen to the model only for changes to annotations\n this.listenTo( this.model, 'change:annotation', function(){\n this.render();\n });\n this.hiddenUntilActivated( options.$activator, options );\n },\n\n /** Build the DOM elements, call select to on the created input, and set up behaviors */\n render : function(){\n var view = this;\n this.$el.html( this._template() );\n\n //TODO: handle empties better\n this.$annotation().make_text_editable({\n use_textarea: true,\n on_finish: function( newAnnotation ){\n view.$annotation().text( newAnnotation );\n view.model.save({ annotation: newAnnotation }, { silent: true })\n .fail( function(){\n view.$annotation().text( view.model.previous( 'annotation' ) );\n });\n }\n });\n return this;\n },\n\n /** @returns {String} the html text used to build the view's DOM */\n _template : function(){\n var annotation = this.model.get( 'annotation' );\n return [\n //TODO: make prompt optional\n '',\n // set up initial tags by adding as CSV to input vals (necc. to init select2)\n '
                                                        ',\n _.escape( annotation ),\n '
                                                        '\n ].join( '' );\n },\n\n /** @returns {jQuery} the main element for this view */\n $annotation : function(){\n return this.$el.find( '.annotation' );\n },\n\n /** shut down event listeners and remove this view's DOM */\n remove : function(){\n this.$annotation.off();\n this.stopListening( this.model );\n Backbone.View.prototype.remove.call( this );\n },\n\n /** string rep */\n toString : function(){ return [ 'AnnotationEditor(', this.model + '', ')' ].join(''); }\n});\n// =============================================================================\nreturn {\n AnnotationEditor : AnnotationEditor\n};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/annotation.js","define([\n 'libs/underscore',\n 'libs/backbone',\n 'mvc/base-mvc',\n], function( _, Backbone, BASE_MVC ){\n'use strict';\n\n//=============================================================================\n/**\n * A Collection that can be limited/offset/re-ordered/filtered.\n * @type {Backbone.Collection}\n */\nvar ControlledFetchCollection = Backbone.Collection.extend({\n\n /** call setOrder on initialization to build the comparator based on options */\n initialize : function( models, options ){\n Backbone.Collection.prototype.initialize.call( this, models, options );\n this.setOrder( options.order || this.order, { silent: true });\n },\n\n /** set up to track order changes and re-sort when changed */\n _setUpListeners : function(){\n return this.on({\n 'changed-order' : this.sort\n });\n },\n\n /** override to provide order and offsets based on instance vars, set limit if passed,\n * and set allFetched/fire 'all-fetched' when xhr returns\n */\n fetch : function( options ){\n options = this._buildFetchOptions( options );\n // console.log( 'fetch options:', options );\n return Backbone.Collection.prototype.fetch.call( this, options );\n },\n\n /** build ajax data/parameters from options */\n _buildFetchOptions : function( options ){\n // note: we normally want options passed in to override the defaults built here\n // so most of these fns will generate defaults\n options = _.clone( options ) || {};\n var self = this;\n\n // jquery ajax option; allows multiple q/qv for filters (instead of 'q[]')\n options.traditional = true;\n\n // options.data\n // we keep limit, offset, etc. in options *as well as move it into data* because:\n // - it makes fetch calling convenient to add it to a single options map (instead of as mult. args)\n // - it allows the std. event handlers (for fetch, etc.) to have access\n // to the pagination options too\n // (i.e. this.on( 'sync', function( options ){ if( options.limit ){ ... } }))\n // however, when we send to xhr/jquery we copy them to data also so that they become API query params\n options.data = options.data || self._buildFetchData( options );\n // console.log( 'data:', options.data );\n\n // options.data.filters --> options.data.q, options.data.qv\n var filters = this._buildFetchFilters( options );\n // console.log( 'filters:', filters );\n if( !_.isEmpty( filters ) ){\n _.extend( options.data, this._fetchFiltersToAjaxData( filters ) );\n }\n // console.log( 'data:', options.data );\n return options;\n },\n\n /** Build the dictionary to send to fetch's XHR as data */\n _buildFetchData : function( options ){\n var defaults = {};\n if( this.order ){ defaults.order = this.order; }\n return _.defaults( _.pick( options, this._fetchParams ), defaults );\n },\n\n /** These attribute keys are valid params to fetch/API-index */\n _fetchParams : [\n /** model dependent string to control the order of models returned */\n 'order',\n /** limit the number of models returned from a fetch */\n 'limit',\n /** skip this number of models when fetching */\n 'offset',\n /** what series of attributes to return (model dependent) */\n 'view',\n /** individual keys to return for the models (see api/histories.index) */\n 'keys'\n ],\n\n /** add any needed filters here based on collection state */\n _buildFetchFilters : function( options ){\n // override\n return _.clone( options.filters || {} );\n },\n\n /** Convert dictionary filters to qqv style arrays */\n _fetchFiltersToAjaxData : function( filters ){\n // return as a map so ajax.data can extend from it\n var filterMap = {\n q : [],\n qv : []\n };\n _.each( filters, function( v, k ){\n // don't send if filter value is empty\n if( v === undefined || v === '' ){ return; }\n // json to python\n if( v === true ){ v = 'True'; }\n if( v === false ){ v = 'False'; }\n if( v === null ){ v = 'None'; }\n // map to k/v arrays (q/qv)\n filterMap.q.push( k );\n filterMap.qv.push( v );\n });\n return filterMap;\n },\n\n /** override to reset allFetched flag to false */\n reset : function( models, options ){\n this.allFetched = false;\n return Backbone.Collection.prototype.reset.call( this, models, options );\n },\n\n // ........................................................................ order\n order : null,\n\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators : {\n 'update_time' : BASE_MVC.buildComparator( 'update_time', { ascending: false }),\n 'update_time-asc' : BASE_MVC.buildComparator( 'update_time', { ascending: true }),\n 'create_time' : BASE_MVC.buildComparator( 'create_time', { ascending: false }),\n 'create_time-asc' : BASE_MVC.buildComparator( 'create_time', { ascending: true }),\n },\n\n /** set the order and comparator for this collection then sort with the new order\n * @event 'changed-order' passed the new order and the collection\n */\n setOrder : function( order, options ){\n options = options || {};\n var collection = this;\n var comparator = collection.comparators[ order ];\n if( _.isUndefined( comparator ) ){ throw new Error( 'unknown order: ' + order ); }\n // if( _.isUndefined( comparator ) ){ return; }\n if( comparator === collection.comparator ){ return; }\n\n var oldOrder = collection.order;\n collection.order = order;\n collection.comparator = comparator;\n\n if( !options.silent ){\n collection.trigger( 'changed-order', options );\n }\n return collection;\n },\n\n});\n\n\n//=============================================================================\n/**\n *\n */\nvar PaginatedCollection = ControlledFetchCollection.extend({\n\n /** @type {Number} limit used for each page's fetch */\n limitPerPage : 500,\n\n initialize : function( models, options ){\n ControlledFetchCollection.prototype.initialize.call( this, models, options );\n this.currentPage = options.currentPage || 0;\n },\n\n getTotalItemCount : function(){\n return this.length;\n },\n\n shouldPaginate : function(){\n return this.getTotalItemCount() >= this.limitPerPage;\n },\n\n getLastPage : function(){\n return Math.floor( this.getTotalItemCount() / this.limitPerPage );\n },\n\n getPageCount : function(){\n return this.getLastPage() + 1;\n },\n\n getPageLimitOffset : function( pageNum ){\n pageNum = this.constrainPageNum( pageNum );\n return {\n limit : this.limitPerPage,\n offset: pageNum * this.limitPerPage\n };\n },\n\n constrainPageNum : function( pageNum ){\n return Math.max( 0, Math.min( pageNum, this.getLastPage() ));\n },\n\n /** fetch the next page of data */\n fetchPage : function( pageNum, options ){\n var self = this;\n pageNum = self.constrainPageNum( pageNum );\n self.currentPage = pageNum;\n options = _.defaults( options || {}, self.getPageLimitOffset( pageNum ) );\n\n self.trigger( 'fetching-more' );\n return self.fetch( options )\n .always( function(){\n self.trigger( 'fetching-more-done' );\n });\n },\n\n fetchCurrentPage : function( options ){\n return this.fetchPage( this.currentPage, options );\n },\n\n fetchPrevPage : function( options ){\n return this.fetchPage( this.currentPage - 1, options );\n },\n\n fetchNextPage : function( options ){\n return this.fetchPage( this.currentPage + 1, options );\n },\n});\n\n\n//=============================================================================\n/**\n * A Collection that will load more elements without reseting.\n */\nvar InfinitelyScrollingCollection = ControlledFetchCollection.extend({\n\n /** @type {Number} limit used for the first fetch (or a reset) */\n limitOnFirstFetch : null,\n /** @type {Number} limit used for each subsequent fetch */\n limitPerFetch : 100,\n\n initialize : function( models, options ){\n ControlledFetchCollection.prototype.initialize.call( this, models, options );\n /** @type {Integer} number of contents to return from the first fetch */\n this.limitOnFirstFetch = options.limitOnFirstFetch || this.limitOnFirstFetch;\n /** @type {Integer} limit for every fetch after the first */\n this.limitPerFetch = options.limitPerFetch || this.limitPerFetch;\n /** @type {Boolean} are all contents fetched? */\n this.allFetched = false;\n /** @type {Integer} what was the offset of the last content returned */\n this.lastFetched = options.lastFetched || 0;\n },\n\n /** build ajax data/parameters from options */\n _buildFetchOptions : function( options ){\n // options (options for backbone.fetch and jquery.ajax generally)\n // backbone option; false here to make fetching an addititive process\n options.remove = options.remove || false;\n return ControlledFetchCollection.prototype._buildFetchOptions.call( this, options );\n },\n\n /** fetch the first 'page' of data */\n fetchFirst : function( options ){\n // console.log( 'ControlledFetchCollection.fetchFirst:', options );\n options = options? _.clone( options ) : {};\n this.allFetched = false;\n this.lastFetched = 0;\n return this.fetchMore( _.defaults( options, {\n reset : true,\n limit : this.limitOnFirstFetch,\n }));\n },\n\n /** fetch the next page of data */\n fetchMore : function( options ){\n // console.log( 'ControlledFetchCollection.fetchMore:', options );\n options = _.clone( options || {} );\n var collection = this;\n\n // console.log( 'fetchMore, options.reset:', options.reset );\n if( ( !options.reset && collection.allFetched ) ){\n return jQuery.when();\n }\n\n // TODO: this fails in the edge case where\n // the first fetch offset === limit (limit 4, offset 4, collection.length 4)\n options.offset = options.reset? 0 : ( options.offset || collection.lastFetched );\n var limit = options.limit = options.limit || collection.limitPerFetch || null;\n // console.log( 'fetchMore, limit:', limit, 'offset:', options.offset );\n\n collection.trigger( 'fetching-more' );\n return collection.fetch( options )\n .always( function(){\n collection.trigger( 'fetching-more-done' );\n })\n // maintain allFetched flag and trigger if all were fetched this time\n .done( function _postFetchMore( fetchedData ){\n var numFetched = _.isArray( fetchedData )? fetchedData.length : 0;\n collection.lastFetched += numFetched;\n // console.log( 'fetchMore, lastFetched:', collection.lastFetched );\n // anything less than a full page means we got all there is to get\n if( !limit || numFetched < limit ){\n collection.allFetched = true;\n collection.trigger( 'all-fetched', this );\n }\n }\n );\n },\n\n /** fetch all the collection */\n fetchAll : function( options ){\n // whitelist options to prevent allowing limit/offset/filters\n // (use vanilla fetch instead)\n options = options || {};\n var self = this;\n options = _.pick( options, 'silent' );\n options.filters = {};\n return self.fetch( options ).done( function( fetchData ){\n self.allFetched = true;\n self.trigger( 'all-fetched', self );\n });\n },\n});\n\n\n//==============================================================================\n return {\n ControlledFetchCollection : ControlledFetchCollection,\n PaginatedCollection : PaginatedCollection,\n InfinitelyScrollingCollection : InfinitelyScrollingCollection,\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/base/controlled-fetch-collection.js","define([\n], function( ){\n\n/* For presentation-related functionality shared across collection creators.\n Particularily overlapping functionality related to name processing and help.\n*/\nvar CollectionCreatorMixin = {\n\n /** add (or clear if clear is truthy) a validation warning to the DOM element described in what */\n _validationWarning : function( what, clear ){\n var VALIDATION_CLASS = 'validation-warning';\n if( what === 'name' ){\n what = this.$( '.collection-name' ).add( this.$( '.collection-name-prompt' ) );\n this.$( '.collection-name' ).focus().select();\n }\n if( clear ){\n what = what || this.$( '.' + VALIDATION_CLASS );\n what.removeClass( VALIDATION_CLASS );\n } else {\n what.addClass( VALIDATION_CLASS );\n }\n },\n\n _changeHideOriginals: function( ev ) {\n this.hideOriginals = this.$( '.hide-originals' ).prop(\"checked\");\n },\n\n // ........................................................................ footer\n /** handle a collection name change */\n _changeName : function( ev ){\n this._validationWarning( 'name', !!this._getName() );\n },\n\n /** check for enter key press when in the collection name and submit */\n _nameCheckForEnter : function( ev ){\n if( ev.keyCode === 13 && !this.blocking ){\n this._clickCreate();\n }\n },\n\n /** get the current collection name */\n _getName : function(){\n return _.escape( this.$( '.collection-name' ).val() );\n },\n\n // ........................................................................ header\n /** expand help */\n _clickMoreHelp : function( ev ){\n ev.stopPropagation();\n this.$( '.main-help' ).addClass( 'expanded' );\n this.$( '.more-help' ).hide();\n },\n /** collapse help */\n _clickLessHelp : function( ev ){\n ev.stopPropagation();\n this.$( '.main-help' ).removeClass( 'expanded' );\n this.$( '.more-help' ).show();\n },\n /** toggle help */\n _toggleHelp : function( ev ){\n ev.stopPropagation();\n this.$( '.main-help' ).toggleClass( 'expanded' );\n this.$( '.more-help' ).toggle();\n },\n\n /** show an alert on the top of the interface containing message (alertClass is bootstrap's alert-*) */\n _showAlert : function( message, alertClass ){\n alertClass = alertClass || 'alert-danger';\n this.$( '.main-help' ).hide();\n this.$( '.header .alert' )\n .attr( 'class', 'alert alert-dismissable' ).addClass( alertClass ).show()\n .find( '.alert-message' ).html( message );\n },\n /** hide the alerts at the top */\n _hideAlert : function( message ){\n this.$( '.main-help' ).show();\n this.$( '.header .alert' ).hide();\n },\n\n _cancelCreate: function( ev ){\n if( typeof this.oncancel === 'function' ){\n this.oncancel.call( this );\n }\n },\n\n /** attempt to create the current collection */\n _clickCreate : function( ev ){\n var name = this._getName();\n if( !name ){\n this._validationWarning( 'name' );\n } else if( !this.blocking ){\n this.createList( name );\n }\n },\n\n _setUpCommonSettings : function( attributes ) {\n this.hideOriginals = attributes.defaultHideSourceItems || false;\n },\n\n /** render the footer, completion controls, and cancel controls */\n _renderFooter : function( speed, callback ){\n var instance = this;\n var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );\n _.each( this.footerSettings, function( property, selector ) {\n this.$( selector ).prop( 'checked', instance[ property ] );\n });\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n return $footer;\n },\n\n _creatorTemplates: {\n main : _.template([\n '
                                                        ',\n '
                                                        ',\n '
                                                        '\n ].join('')),\n }\n\n}\n\n//==============================================================================\n return {\n CollectionCreatorMixin: CollectionCreatorMixin\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/base-creator.js","define([\n \"mvc/list/list-view\",\n \"mvc/collection/collection-model\",\n \"mvc/collection/collection-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_VIEW, DC_MODEL, DC_LI, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a dataset collection.\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar CollectionView = _super.extend(\n/** @lends CollectionView.prototype */{\n //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n _logNamespace : logNamespace,\n\n className : _super.prototype.className + ' dataset-collection-panel',\n\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_LI.DatasetDCEListItemView,\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey : 'elements',\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the panel\n */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n this.linkTarget = attributes.linkTarget || '_blank';\n\n this.hasUser = attributes.hasUser;\n /** A stack of panels that currently cover or hide this panel */\n this.panelStack = [];\n /** The text of the link to go back to the panel containing this one */\n this.parentName = attributes.parentName;\n /** foldout or drilldown */\n this.foldoutStyle = attributes.foldoutStyle || 'foldout';\n this.downloadUrl = this.model.attributes.url + '/download';\n },\n\n _queueNewRender : function( $newRender, speed ) {\n speed = ( speed === undefined )?( this.fxSpeed ):( speed );\n var panel = this;\n panel.log( '_queueNewRender:', $newRender, speed );\n\n // TODO: jquery@1.12 doesn't change display when the elem has display: flex\n // this causes display: block for those elems after the use of show/hide animations\n // animations are removed from this view for now until fixed\n panel._swapNewRender( $newRender );\n panel.trigger( 'rendered', panel );\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** In this override, use model.getVisibleContents */\n _filterCollection : function(){\n //TODO: should *not* be model.getVisibleContents - visibility is not model related\n return this.model.getVisibleContents();\n },\n\n /** override to return proper view class based on element_type */\n _getItemViewClass : function( model ){\n //this.debug( this + '._getItemViewClass:', model );\n //TODO: subclasses use DCEViewClass - but are currently unused - decide\n switch( model.get( 'element_type' ) ){\n case 'hda':\n return this.DatasetDCEViewClass;\n case 'dataset_collection':\n return this.NestedDCDCEViewClass;\n }\n throw new TypeError( 'Unknown element type:', model.get( 'element_type' ) );\n },\n\n /** override to add link target and anon */\n _getItemViewOptions : function( model ){\n var options = _super.prototype._getItemViewOptions.call( this, model );\n return _.extend( options, {\n linkTarget : this.linkTarget,\n hasUser : this.hasUser,\n //TODO: could move to only nested: list:paired\n foldoutStyle : this.foldoutStyle\n });\n },\n\n // ------------------------------------------------------------------------ collection sub-views\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n _super.prototype._setUpItemViewListeners.call( panel, view );\n\n // use pub-sub to: handle drilldown expansion and collapse\n panel.listenTo( view, {\n 'expanded:drilldown': function( v, drilldown ){\n this._expandDrilldownPanel( drilldown );\n },\n 'collapsed:drilldown': function( v, drilldown ){\n this._collapseDrilldownPanel( drilldown );\n }\n });\n return this;\n },\n\n /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n _expandDrilldownPanel : function( drilldown ){\n this.panelStack.push( drilldown );\n // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n this.$( '> .controls' ).add( this.$list() ).hide();\n drilldown.parentName = this.model.get( 'name' );\n this.$el.append( drilldown.render().$el );\n },\n\n /** Handle drilldown close by freeing the panel and re-rendering this panel */\n _collapseDrilldownPanel : function( drilldown ){\n this.panelStack.pop();\n this.render();\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : {\n 'click .navigation .back' : 'close'\n },\n\n /** close/remove this collection panel */\n close : function( event ){\n this.remove();\n this.trigger( 'close' );\n },\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'CollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//------------------------------------------------------------------------------ TEMPLATES\nCollectionView.prototype.templates = (function(){\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                                                        ',\n '',\n\n '
                                                        ',\n '
                                                        <%- collection.name || collection.element_identifier %>
                                                        ',\n '
                                                        ',\n '<% if( collection.collection_type === \"list\" ){ %>',\n _l( 'a list of datasets' ),\n '<% } else if( collection.collection_type === \"paired\" ){ %>',\n _l( 'a pair of datasets' ),\n '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n _l( 'a list of paired datasets' ),\n '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n _l( 'a list of dataset lists' ),\n '<% } %>',\n '
                                                        ',\n '
                                                        ',\n\n '
                                                        ',\n\n '',\n '
                                                        ',\n ], 'collection' );\n\n return _.extend( _.clone( _super.prototype.templates ), {\n controls : controlsTemplate\n });\n}());\n\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListCollectionView = CollectionView.extend(\n/** @lends ListCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_LI.DatasetDCEListItemView,\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar PairCollectionView = ListCollectionView.extend(\n/** @lends PairCollectionView.prototype */{\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'PairCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListOfPairsCollectionView = CollectionView.extend(\n/** @lends ListOfPairsCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass : PairCollectionView\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListOfPairsCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\nvar ListOfListsCollectionView = CollectionView.extend({\n\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass : PairCollectionView\n }),\n\n /** string rep */\n toString : function(){\n return 'ListOfListsCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//==============================================================================\n return {\n CollectionView : CollectionView,\n ListCollectionView : ListCollectionView,\n PairCollectionView : PairCollectionView,\n ListOfPairsCollectionView : ListOfPairsCollectionView,\n ListOfListsCollectionView : ListOfListsCollectionView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-view.js","define([\n \"mvc/dataset/states\",\n \"mvc/dataset/dataset-li\",\n \"mvc/tag\",\n \"mvc/annotation\",\n \"ui/fa-icon-button\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, DATASET_LI, TAGS, ANNOTATIONS, faIconButton, BASE_MVC, _l ){\n\n'use strict';\n//==============================================================================\nvar _super = DATASET_LI.DatasetListItemView;\n/** @class Editing view for DatasetAssociation.\n */\nvar DatasetListItemEdit = _super.extend(\n/** @lends DatasetListItemEdit.prototype */{\n\n /** set up: options */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n this.hasUser = attributes.hasUser;\n\n /** allow user purge of dataset files? */\n this.purgeAllowed = attributes.purgeAllowed || false;\n\n //TODO: move to HiddenUntilActivatedViewMixin\n /** should the tags editor be shown or hidden initially? */\n this.tagsEditorShown = attributes.tagsEditorShown || false;\n /** should the tags editor be shown or hidden initially? */\n this.annotationEditorShown = attributes.annotationEditorShown || false;\n },\n\n // ......................................................................... titlebar actions\n /** In this override, add the other two primary actions: edit and delete */\n _renderPrimaryActions : function(){\n var actions = _super.prototype._renderPrimaryActions.call( this );\n if( this.model.get( 'state' ) === STATES.NOT_VIEWABLE ){\n return actions;\n }\n // render the display, edit attr and delete icon-buttons\n return _super.prototype._renderPrimaryActions.call( this ).concat([\n this._renderEditButton(),\n this._renderDeleteButton()\n ]);\n },\n\n //TODO: move titleButtons into state renderers, remove state checks in the buttons\n\n /** Render icon-button to edit the attributes (format, permissions, etc.) this dataset. */\n _renderEditButton : function(){\n // don't show edit while uploading, in-accessible\n // DO show if in error (ala previous history panel)\n if( ( this.model.get( 'state' ) === STATES.DISCARDED )\n || ( !this.model.get( 'accessible' ) ) ){\n return null;\n }\n\n var purged = this.model.get( 'purged' ),\n deleted = this.model.get( 'deleted' ),\n editBtnData = {\n title : _l( 'Edit attributes' ),\n href : Galaxy.root + 'datasets/edit?dataset_id=' + this.model.attributes.id,\n faIcon : 'fa-pencil',\n classes : 'edit-btn'\n };\n // disable if purged or deleted and explain why in the tooltip\n if( deleted || purged ){\n editBtnData.disabled = true;\n if( purged ){\n editBtnData.title = _l( 'Cannot edit attributes of datasets removed from disk' );\n } else if( deleted ){\n editBtnData.title = _l( 'Undelete dataset to edit attributes' );\n }\n\n // disable if still uploading or new\n } else if( _.contains( [ STATES.UPLOAD, STATES.NEW ], this.model.get( 'state' ) ) ){\n editBtnData.disabled = true;\n editBtnData.title = _l( 'This dataset is not yet editable' );\n }\n return faIconButton( editBtnData );\n },\n\n /** Render icon-button to delete this hda. */\n _renderDeleteButton : function(){\n // don't show delete if...\n if( ( !this.model.get( 'accessible' ) ) ){\n return null;\n }\n\n var self = this,\n deletedAlready = this.model.isDeletedOrPurged();\n return faIconButton({\n title : !deletedAlready? _l( 'Delete' ) : _l( 'Dataset is already deleted' ),\n disabled : deletedAlready,\n faIcon : 'fa-times',\n classes : 'delete-btn',\n onclick : function() {\n // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n self.$el.find( '.icon-btn.delete-btn' ).trigger( 'mouseout' );\n self.model[ 'delete' ]();\n }\n });\n },\n\n // ......................................................................... details\n /** In this override, add tags and annotations controls, make the ? dbkey a link to editing page */\n _renderDetails : function(){\n //TODO: generalize to be allow different details for each state\n var $details = _super.prototype._renderDetails.call( this ),\n state = this.model.get( 'state' );\n\n if( !this.model.isDeletedOrPurged() && _.contains([ STATES.OK, STATES.FAILED_METADATA ], state ) ){\n this._renderTags( $details );\n this._renderAnnotation( $details );\n this._makeDbkeyEditLink( $details );\n }\n\n this._setUpBehaviors( $details );\n return $details;\n },\n\n /**************************************************************************\n * Render help button to show tool help text without rerunning the tool.\n * Issue #2100\n */\n _renderToolHelpButton : function() {\n var datasetID = this.model.attributes.dataset_id;\n var jobID = this.model.attributes.creating_job;\n var self = this;\n\n var parseToolBuild = function(data) {\n var helpString = '
                                                        '\n if (data.name && data.help){\n helpString += 'Tool help for ' + data.name + '
                                                        ';\n helpString += data.help;\n } else {\n helpString += 'Tool help is unavailable for this dataset.
                                                        ';\n }\n helpString += '
                                                        ';\n self.$el.find( '.details' ).append($.parseHTML(helpString));\n };\n var parseToolID = function(data) {\n $.ajax({\n url: Galaxy.root + 'api/tools/' + data.tool_id + '/build'\n }).done(function(data){\n parseToolBuild(data);\n }).fail(function(){\n parseToolBuild({})\n });\n };\n if (Galaxy.user.id === null){\n return null\n }\n return faIconButton({\n title: _l('Tool Help'),\n classes: 'icon-btn',\n href: '#',\n faIcon: 'fa-question',\n onclick: function() {\n var divString = 'thdiv-' + datasetID;\n if (self.$el.find(\".toolhelp\").length > 0){\n self.$el.find(\".toolhelp\").toggle();\n } else {\n $.ajax({\n url: Galaxy.root + 'api/jobs/' + jobID\n }).done(function(data){\n parseToolID(data);\n }).fail(function(){\n console.log('Failed at recovering job information from the Galaxy API for job id \"' + jobID + '\".');\n });\n }\n }\n });\n },\n //*************************************************************************\n\n /** Add less commonly used actions in the details section based on state */\n _renderSecondaryActions : function(){\n var actions = _super.prototype._renderSecondaryActions.call( this );\n switch( this.model.get( 'state' ) ){\n case STATES.UPLOAD:\n case STATES.NOT_VIEWABLE:\n return actions;\n case STATES.ERROR:\n // error button comes first\n actions.unshift( this._renderErrButton() );\n return actions.concat([ this._renderRerunButton(), this._renderToolHelpButton() ]);\n case STATES.OK:\n case STATES.FAILED_METADATA:\n return actions.concat([ this._renderRerunButton(), this._renderVisualizationsButton(), this._renderToolHelpButton() ]);\n }\n return actions.concat([ this._renderRerunButton(), this._renderToolHelpButton() ]);\n },\n\n /** Render icon-button to report an error on this dataset to the galaxy admin. */\n _renderErrButton : function(){\n return faIconButton({\n title : _l( 'View or report this error' ),\n href : Galaxy.root + 'datasets/error?dataset_id=' + this.model.attributes.id,\n classes : 'report-error-btn',\n faIcon : 'fa-bug'\n });\n },\n\n /** Render icon-button to re-run the job that created this dataset. */\n _renderRerunButton : function(){\n var creating_job = this.model.get( 'creating_job' );\n if( this.model.get( 'rerunnable' ) ){\n return faIconButton({\n title : _l( 'Run this job again' ),\n href : this.model.urls.rerun,\n classes : 'rerun-btn',\n target : this.linkTarget,\n faIcon : 'fa-refresh',\n onclick : function( ev ) {\n ev.preventDefault();\n Galaxy.router.push( '/', { job_id : creating_job } );\n }\n });\n }\n },\n\n /** Render an icon-button or popupmenu of links based on the applicable visualizations */\n _renderVisualizationsButton : function(){\n //TODO: someday - lazyload visualizations\n var visualizations = this.model.get( 'visualizations' );\n if( ( this.model.isDeletedOrPurged() )\n || ( !this.hasUser )\n || ( !this.model.hasData() )\n || ( _.isEmpty( visualizations ) ) ){\n return null;\n }\n if( !_.isObject( visualizations[0] ) ){\n this.warn( 'Visualizations have been switched off' );\n return null;\n }\n\n var $visualizations = $( this.templates.visualizations( visualizations, this ) );\n //HACK: need to re-write those directed at galaxy_main with linkTarget\n $visualizations.find( '[target=\"galaxy_main\"]').attr( 'target', this.linkTarget );\n // use addBack here to include the root $visualizations elem (for the case of 1 visualization)\n this._addScratchBookFn( $visualizations.find( '.visualization-link' ).addBack( '.visualization-link' ) );\n return $visualizations;\n },\n\n /** add scratchbook functionality to visualization links */\n _addScratchBookFn : function( $links ){\n var li = this;\n $links.click( function( ev ){\n if( Galaxy.frame && Galaxy.frame.active ){\n Galaxy.frame.add({\n title : 'Visualization',\n url : $( this ).attr( 'href' )\n });\n ev.preventDefault();\n ev.stopPropagation();\n }\n });\n },\n\n //TODO: if possible move these to readonly view - but display the owner's tags/annotation (no edit)\n /** Render the tags list/control */\n _renderTags : function( $where ){\n if( !this.hasUser ){ return; }\n var view = this;\n this.tagsEditor = new TAGS.TagsEditor({\n model : this.model,\n el : $where.find( '.tags-display' ),\n onshowFirstTime : function(){ this.render(); },\n // persist state on the hda view (and not the editor) since these are currently re-created each time\n onshow : function(){ view.tagsEditorShown = true; },\n onhide : function(){ view.tagsEditorShown = false; },\n $activator : faIconButton({\n title : _l( 'Edit dataset tags' ),\n classes : 'tag-btn',\n faIcon : 'fa-tags'\n }).appendTo( $where.find( '.actions .right' ) )\n });\n if( this.tagsEditorShown ){ this.tagsEditor.toggle( true ); }\n },\n\n /** Render the annotation display/control */\n _renderAnnotation : function( $where ){\n if( !this.hasUser ){ return; }\n var view = this;\n this.annotationEditor = new ANNOTATIONS.AnnotationEditor({\n model : this.model,\n el : $where.find( '.annotation-display' ),\n onshowFirstTime : function(){ this.render(); },\n // persist state on the hda view (and not the editor) since these are currently re-created each time\n onshow : function(){ view.annotationEditorShown = true; },\n onhide : function(){ view.annotationEditorShown = false; },\n $activator : faIconButton({\n title : _l( 'Edit dataset annotation' ),\n classes : 'annotate-btn',\n faIcon : 'fa-comment'\n }).appendTo( $where.find( '.actions .right' ) )\n });\n if( this.annotationEditorShown ){ this.annotationEditor.toggle( true ); }\n },\n\n /** If the format/dbkey/genome_build isn't set, make the display a link to the edit page */\n _makeDbkeyEditLink : function( $details ){\n // make the dbkey a link to editing\n if( this.model.get( 'metadata_dbkey' ) === '?'\n && !this.model.isDeletedOrPurged() ){\n var editableDbkey = $( '?' )\n .attr( 'href', this.model.urls.edit )\n .attr( 'target', this.linkTarget );\n $details.find( '.dbkey .value' ).replaceWith( editableDbkey );\n }\n },\n\n // ......................................................................... events\n /** event map */\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .undelete-link' : '_clickUndeleteLink',\n 'click .purge-link' : '_clickPurgeLink',\n\n 'click .edit-btn' : function( ev ){ this.trigger( 'edit', this, ev ); },\n 'click .delete-btn' : function( ev ){ this.trigger( 'delete', this, ev ); },\n 'click .rerun-btn' : function( ev ){ this.trigger( 'rerun', this, ev ); },\n 'click .report-err-btn' : function( ev ){ this.trigger( 'report-err', this, ev ); },\n 'click .visualization-btn' : function( ev ){ this.trigger( 'visualize', this, ev ); },\n 'click .dbkey a' : function( ev ){ this.trigger( 'edit', this, ev ); }\n }),\n\n /** listener for item undelete (in the messages section) */\n _clickUndeleteLink : function( ev ){\n this.model.undelete();\n return false;\n },\n\n /** listener for item purge (in the messages section) */\n _clickPurgeLink : function( ev ){\n if( confirm( _l( 'This will permanently remove the data in your dataset. Are you sure?' ) ) ){\n this.model.purge();\n }\n return false;\n },\n\n // ......................................................................... misc\n /** string rep */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDAEditView(' + modelString + ')';\n }\n});\n\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetListItemEdit.prototype.templates = (function(){\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n failed_metadata : BASE_MVC.wrapTemplate([\n // in this override, provide a link to the edit page\n '<% if( dataset.state === \"failed_metadata\" ){ %>',\n '',\n '<% } %>'\n ], 'dataset' ),\n\n deleted : BASE_MVC.wrapTemplate([\n // in this override, provide links to undelete or purge the dataset\n '<% if( dataset.deleted && !dataset.purged ){ %>',\n // deleted not purged\n '
                                                        ',\n _l( 'This dataset has been deleted' ),\n '
                                                        ', _l( 'Undelete it' ), '',\n '<% if( view.purgeAllowed ){ %>',\n '
                                                        ',\n _l( 'Permanently remove it from disk' ),\n '',\n '<% } %>',\n '
                                                        ',\n '<% } %>'\n ], 'dataset' )\n });\n\n var visualizationsTemplate = BASE_MVC.wrapTemplate([\n '<% if( visualizations.length === 1 ){ %>',\n '\"',\n ' target=\"<%- visualizations[0].target %>\" title=\"', _l( 'Visualize in' ),\n ' <%- visualizations[0].html %>\">',\n '',\n '',\n\n '<% } else { %>',\n '
                                                        ',\n '',\n '',\n '',\n '',\n '
                                                        ',\n '<% } %>'\n ], 'visualizations' );\n\n return _.extend( {}, _super.prototype.templates, {\n warnings : warnings,\n visualizations : visualizationsTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n DatasetListItemEdit : DatasetListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-li-edit.js","define([\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, BASE_MVC, _l ){\n'use strict';\n\nvar logNamespace = 'dataset';\n//==============================================================================\nvar searchableMixin = BASE_MVC.SearchableModelMixin;\n/** @class base model for any DatasetAssociation (HDAs, LDDAs, DatasetCollectionDAs).\n * No knowledge of what type (HDA/LDDA/DCDA) should be needed here.\n * The DA's are made searchable (by attribute) by mixing in SearchableModelMixin.\n */\nvar DatasetAssociation = Backbone.Model\n .extend( BASE_MVC.LoggableMixin )\n .extend( BASE_MVC.mixin( searchableMixin, /** @lends DatasetAssociation.prototype */{\n _logNamespace : logNamespace,\n\n /** default attributes for a model */\n defaults : {\n state : STATES.NEW,\n deleted : false,\n purged : false,\n name : '(unnamed dataset)',\n accessible : true,\n // sniffed datatype (sam, tabular, bed, etc.)\n data_type : '',\n file_ext : '',\n file_size : 0,\n\n // array of associated file types (eg. [ 'bam_index', ... ])\n meta_files : [],\n\n misc_blurb : '',\n misc_info : '',\n\n tags : []\n // do NOT default on annotation, as this default is valid and will be passed on 'save'\n // which is incorrect behavior when the model is only partially fetched (annos are not passed in summary data)\n //annotation : ''\n },\n\n /** instance vars and listeners */\n initialize : function( attributes, options ){\n this.debug( this + '(Dataset).initialize', attributes, options );\n\n //!! this state is not in trans.app.model.Dataset.states - set it here -\n if( !this.get( 'accessible' ) ){\n this.set( 'state', STATES.NOT_VIEWABLE );\n }\n\n /** Datasets rely/use some web controllers - have the model generate those URLs on startup */\n this.urls = this._generateUrls();\n\n this._setUpListeners();\n },\n\n /** returns misc. web urls for rendering things like re-run, display, etc. */\n _generateUrls : function(){\n var id = this.get( 'id' );\n if( !id ){ return {}; }\n var urls = {\n 'purge' : 'datasets/' + id + '/purge_async',\n 'display' : 'datasets/' + id + '/display/?preview=True',\n 'edit' : 'datasets/' + id + '/edit',\n 'download' : 'datasets/' + id + '/display' + this._downloadQueryParameters(),\n 'report_error' : 'dataset/errors?id=' + id,\n 'rerun' : 'tool_runner/rerun?id=' + id,\n 'show_params' : 'datasets/' + id + '/show_params',\n 'visualization' : 'visualization',\n 'meta_download' : 'dataset/get_metadata_file?hda_id=' + id + '&metadata_name='\n };\n _.each( urls, function( value, key ){\n urls[ key ] = Galaxy.root + value;\n });\n this.urls = urls;\n return urls;\n },\n\n _downloadQueryParameters : function() {\n return '?to_ext=' + this.get( 'file_ext' );\n },\n\n /** set up any event listeners\n * event: state:ready fired when this DA moves into/is already in a ready state\n */\n _setUpListeners : function(){\n // if the state has changed and the new state is a ready state, fire an event\n this.on( 'change:state', function( currModel, newState ){\n this.log( this + ' has changed state:', currModel, newState );\n if( this.inReadyState() ){\n this.trigger( 'state:ready', currModel, newState, this.previous( 'state' ) );\n }\n });\n // the download url (currently) relies on having a correct file extension\n this.on( 'change:id change:file_ext', function( currModel ){\n this._generateUrls();\n });\n },\n\n // ........................................................................ common queries\n /** override to add urls */\n toJSON : function(){\n var json = Backbone.Model.prototype.toJSON.call( this );\n //console.warn( 'returning json?' );\n //return json;\n return _.extend( json, {\n urls : this.urls\n });\n },\n\n /** Is this dataset deleted or purged? */\n isDeletedOrPurged : function(){\n return ( this.get( 'deleted' ) || this.get( 'purged' ) );\n },\n\n /** Is this dataset in a 'ready' state; where 'Ready' states are states where no\n * processing (for the ds) is left to do on the server.\n */\n inReadyState : function(){\n var ready = _.contains( STATES.READY_STATES, this.get( 'state' ) );\n return ( this.isDeletedOrPurged() || ready );\n },\n\n /** Does this model already contain detailed data (as opposed to just summary level data)? */\n hasDetails : function(){\n // if it's inaccessible assume it has everything it needs\n if( !this.get( 'accessible' ) ){ return true; }\n return this.has( 'annotation' );\n },\n\n /** Convenience function to match dataset.has_data. */\n hasData : function(){\n return ( this.get( 'file_size' ) > 0 );\n },\n\n // ........................................................................ ajax\n fetch : function( options ){\n var dataset = this;\n return Backbone.Model.prototype.fetch.call( this, options )\n .always( function(){\n dataset._generateUrls();\n });\n },\n\n /** override to use actual Dates objects for create/update times */\n parse : function( response, options ){\n var parsed = Backbone.Model.prototype.parse.call( this, response, options );\n if( parsed.create_time ){\n parsed.create_time = new Date( parsed.create_time );\n }\n if( parsed.update_time ){\n parsed.update_time = new Date( parsed.update_time );\n }\n return parsed;\n },\n\n /** override to wait by default */\n save : function( attrs, options ){\n options = options || {};\n options.wait = _.isUndefined( options.wait ) ? true : options.wait;\n return Backbone.Model.prototype.save.call( this, attrs, options );\n },\n\n //NOTE: subclasses of DA's will need to implement url and urlRoot in order to have these work properly\n /** save this dataset, _Mark_ing it as deleted (just a flag) */\n 'delete' : function( options ){\n if( this.get( 'deleted' ) ){ return jQuery.when(); }\n return this.save( { deleted: true }, options );\n },\n /** save this dataset, _Mark_ing it as undeleted */\n undelete : function( options ){\n if( !this.get( 'deleted' ) || this.get( 'purged' ) ){ return jQuery.when(); }\n return this.save( { deleted: false }, options );\n },\n\n /** remove the file behind this dataset from the filesystem (if permitted) */\n purge : function _purge( options ){\n //TODO: use, override model.destroy, HDA.delete({ purge: true })\n if( this.get( 'purged' ) ){ return jQuery.when(); }\n options = options || {};\n options.url = this.urls.purge;\n\n //TODO: ideally this would be a DELETE call to the api\n // using purge async for now\n var hda = this,\n xhr = jQuery.ajax( options );\n xhr.done( function( message, status, responseObj ){\n hda.set({ deleted: true, purged: true });\n });\n xhr.fail( function( xhr, status, message ){\n // Exception messages are hidden within error page including: '...not allowed in this Galaxy instance.'\n // unbury and re-add to xhr\n var error = _l( \"Unable to purge dataset\" );\n var messageBuriedInUnfortunatelyFormattedError = ( 'Removal of datasets by users '\n + 'is not allowed in this Galaxy instance' );\n if( xhr.responseJSON && xhr.responseJSON.error ){\n error = xhr.responseJSON.error;\n } else if( xhr.responseText.indexOf( messageBuriedInUnfortunatelyFormattedError ) !== -1 ){\n error = messageBuriedInUnfortunatelyFormattedError;\n }\n xhr.responseText = error;\n hda.trigger( 'error', hda, xhr, options, _l( error ), { error: error } );\n });\n return xhr;\n },\n\n // ........................................................................ searching\n /** what attributes of an HDA will be used in a text search */\n searchAttributes : [\n 'name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'\n ],\n\n /** our attr keys don't often match the labels we display to the user - so, when using\n * attribute specifiers ('name=\"bler\"') in a term, allow passing in aliases for the\n * following attr keys.\n */\n searchAliases : {\n title : 'name',\n format : 'file_ext',\n database : 'genome_build',\n blurb : 'misc_blurb',\n description : 'misc_blurb',\n info : 'misc_info',\n tag : 'tags'\n },\n\n // ........................................................................ misc\n /** String representation */\n toString : function(){\n var nameAndId = this.get( 'id' ) || '';\n if( this.get( 'name' ) ){\n nameAndId = '\"' + this.get( 'name' ) + '\",' + nameAndId;\n }\n return 'Dataset(' + nameAndId + ')';\n }\n}));\n\n\n//==============================================================================\n/** @class Backbone collection for dataset associations.\n */\nvar DatasetAssociationCollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).extend(\n/** @lends HistoryContents.prototype */{\n _logNamespace : logNamespace,\n\n model : DatasetAssociation,\n\n /** root api url */\n urlRoot : Galaxy.root + 'api/datasets',\n\n /** url fn */\n url : function(){\n return this.urlRoot;\n },\n\n // ........................................................................ common queries\n /** Get the ids of every item in this collection\n * @returns array of encoded ids\n */\n ids : function(){\n return this.map( function( item ){ return item.get('id'); });\n },\n\n /** Get contents that are not ready\n * @returns array of content models\n */\n notReady : function(){\n return this.filter( function( content ){\n return !content.inReadyState();\n });\n },\n\n /** return true if any datasets don't have details */\n haveDetails : function(){\n return this.all( function( dataset ){ return dataset.hasDetails(); });\n },\n\n // ........................................................................ ajax\n /** using a queue, perform ajaxFn on each of the models in this collection */\n ajaxQueue : function( ajaxFn, options ){\n var deferred = jQuery.Deferred(),\n startingLength = this.length,\n responses = [];\n\n if( !startingLength ){\n deferred.resolve([]);\n return deferred;\n }\n\n // use reverse order (stylistic choice)\n var ajaxFns = this.chain().reverse().map( function( dataset, i ){\n return function(){\n var xhr = ajaxFn.call( dataset, options );\n // if successful, notify using the deferred to allow tracking progress\n xhr.done( function( response ){\n deferred.notify({ curr: i, total: startingLength, response: response, model: dataset });\n });\n // (regardless of previous error or success) if not last ajax call, shift and call the next\n // if last fn, resolve deferred\n xhr.always( function( response ){\n responses.push( response );\n if( ajaxFns.length ){\n ajaxFns.shift()();\n } else {\n deferred.resolve( responses );\n }\n });\n };\n }).value();\n // start the queue\n ajaxFns.shift()();\n\n return deferred;\n },\n\n // ........................................................................ sorting/filtering\n /** return a new collection of datasets whose attributes contain the substring matchesWhat */\n matches : function( matchesWhat ){\n return this.filter( function( dataset ){\n return dataset.matches( matchesWhat );\n });\n },\n\n /** String representation. */\n toString : function(){\n return ([ 'DatasetAssociationCollection(', this.length, ')' ].join( '' ));\n }\n});\n\n\n//==============================================================================\n return {\n DatasetAssociation : DatasetAssociation,\n DatasetAssociationCollection : DatasetAssociationCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-model.js","define([\n \"mvc/ui/ui-modal\",\n \"mvc/ui/error-modal\",\n \"utils/localization\"\n], function( MODAL, ERROR_MODAL, _l ){\n\n'use strict';\n\n//==============================================================================\n/**\n * A dialog/modal that allows copying a user history or 'importing' from user\n * another. Generally called via historyCopyDialog below.\n * @type {Object}\n */\nvar CopyDialog = {\n\n // language related strings/fns\n defaultName : _.template( \"Copy of '<%- name %>'\" ),\n title : _.template( _l( 'Copying history' ) + ' \"<%- name %>\"' ),\n submitLabel : _l( 'Copy' ),\n errorMessage : _l( 'History could not be copied.' ),\n progressive : _l( 'Copying history' ),\n activeLabel : _l( 'Copy only the active, non-deleted datasets' ),\n allLabel : _l( 'Copy all datasets including deleted ones' ),\n anonWarning : _l( 'As an anonymous user, unless you login or register, you will lose your current history ' ) +\n _l( 'after copying this history. ' ),\n\n // template for modal body\n _template : _.template([\n //TODO: remove inline styles\n // show a warning message for losing current to anon users\n '<% if( isAnon ){ %>',\n '
                                                        ',\n '<%- anonWarning %>',\n _l( 'You can' ),\n ' ', _l( 'login here' ), ' ', _l( 'or' ), ' ',\n ' ', _l( 'register here' ), '.',\n '
                                                        ',\n '<% } %>',\n '
                                                        ',\n '
                                                        ',\n // TODO: could use required here and the form validators\n // NOTE: use unescaped here if escaped in the modal function below\n '\" />',\n '

                                                        ',\n _l( 'Please enter a valid history title' ),\n '

                                                        ',\n // if allowAll, add the option to copy deleted datasets, too\n '<% if( allowAll ){ %>',\n '
                                                        ',\n '

                                                        ', _l( 'Choose which datasets from the original history to include:' ), '

                                                        ',\n // copy non-deleted is the default\n '/>',\n '',\n '
                                                        ',\n '/>',\n '',\n '<% } %>',\n '
                                                        '\n ].join( '' )),\n\n // empty modal body and let the user know the copy is happening\n _showAjaxIndicator : function _showAjaxIndicator(){\n var indicator = '

                                                        ' + this.progressive + '...

                                                        ';\n this.modal.$( '.modal-body' ).empty().append( indicator ).css({ 'margin-top': '8px' });\n },\n\n // (sorta) public interface - display the modal, render the form, and potentially copy the history\n // returns a jQuery.Deferred done->history copied, fail->user cancelled\n dialog : function _dialog( modal, history, options ){\n options = options || {};\n\n var dialog = this,\n deferred = jQuery.Deferred(),\n // TODO: getting a little byzantine here\n defaultCopyNameFn = options.nameFn || this.defaultName,\n defaultCopyName = defaultCopyNameFn({ name: history.get( 'name' ) }),\n // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n defaultCopyWhat = options.allDatasets? 'copy-all' : 'copy-non-deleted',\n allowAll = !_.isUndefined( options.allowAll )? options.allowAll : true,\n autoClose = !_.isUndefined( options.autoClose )? options.autoClose : true;\n\n this.modal = modal;\n\n\n // validate the name and copy if good\n function checkNameAndCopy(){\n var name = modal.$( '#copy-modal-title' ).val();\n if( !name ){\n modal.$( '.invalid-title' ).show();\n return;\n }\n // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n var copyAllDatasets = modal.$( 'input[name=\"copy-what\"]:checked' ).val() === 'copy-all';\n modal.$( 'button' ).prop( 'disabled', true );\n dialog._showAjaxIndicator();\n history.copy( true, name, copyAllDatasets )\n .done( function( response ){\n deferred.resolve( response );\n })\n .fail( function( xhr, status, message ){\n var options = { name: name, copyAllDatasets: copyAllDatasets };\n ERROR_MODAL.ajaxErrorModal( history, xhr, options, dialog.errorMessage );\n deferred.rejectWith( deferred, arguments );\n })\n .done( function(){\n if( autoClose ){ modal.hide(); }\n });\n }\n\n var originalClosingCallback = options.closing_callback;\n modal.show( _.extend( options, {\n title : this.title({ name: history.get( 'name' ) }),\n body : $( dialog._template({\n name : defaultCopyName,\n isAnon : Galaxy.user.isAnonymous(),\n allowAll : allowAll,\n copyWhat : defaultCopyWhat,\n activeLabel : this.activeLabel,\n allLabel : this.allLabel,\n anonWarning : this.anonWarning,\n })),\n buttons : _.object([\n [ _l( 'Cancel' ), function(){ modal.hide(); } ],\n [ this.submitLabel, checkNameAndCopy ]\n ]),\n height : 'auto',\n closing_events : true,\n closing_callback: function _historyCopyClose( cancelled ){\n if( cancelled ){\n deferred.reject({ cancelled : true });\n }\n if( originalClosingCallback ){\n originalClosingCallback( cancelled );\n }\n }\n }));\n\n // set the default dataset copy, autofocus the title, and set up for a simple return\n modal.$( '#copy-modal-title' ).focus().select();\n modal.$( '#copy-modal-title' ).on( 'keydown', function( ev ){\n if( ev.keyCode === 13 ){\n ev.preventDefault();\n checkNameAndCopy();\n }\n });\n\n return deferred;\n },\n};\n\n//==============================================================================\n// maintain the (slight) distinction between copy and import\n/**\n * Subclass CopyDialog to use the import language.\n */\nvar ImportDialog = _.extend( {}, CopyDialog, {\n defaultName : _.template( \"imported: <%- name %>\" ),\n title : _.template( _l( 'Importing history' ) + ' \"<%- name %>\"' ),\n submitLabel : _l( 'Import' ),\n errorMessage : _l( 'History could not be imported.' ),\n progressive : _l( 'Importing history' ),\n activeLabel : _l( 'Import only the active, non-deleted datasets' ),\n allLabel : _l( 'Import all datasets including deleted ones' ),\n anonWarning : _l( 'As an anonymous user, unless you login or register, you will lose your current history ' ) +\n _l( 'after importing this history. ' ),\n\n});\n\n//==============================================================================\n/**\n * Main interface for both history import and history copy dialogs.\n * @param {Backbone.Model} history the history to copy\n * @param {Object} options a hash\n * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n *\n * options:\n * (this object is also passed to the modal used to display the dialog and accepts modal options)\n * {Function} nameFn if defined, use this to build the default name shown to the user\n * (the fn is passed: {name: })\n * {bool} useImport if true, use the 'import' language (instead of Copy)\n * {bool} allowAll if true, allow the user to choose between copying all datasets and\n * only non-deleted datasets\n * {String} allDatasets default initial checked radio button: 'copy-all' or 'copy-non-deleted',\n */\nvar historyCopyDialog = function( history, options ){\n options = options || {};\n // create our own modal if Galaxy doesn't have one (mako tab without use_panels)\n var modal = window.parent.Galaxy.modal || new MODAL.View({});\n return options.useImport?\n ImportDialog.dialog( modal, history, options ):\n CopyDialog.dialog( modal, history, options );\n};\n\n\n//==============================================================================\n return historyCopyDialog;\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/copy-dialog.js","define([\n \"mvc/dataset/dataset-li\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET_LI, BASE_MVC, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = DATASET_LI.DatasetListItemView;\n/** @class Read only view for HistoryDatasetAssociation.\n * Since there are no controls on the HDAView to hide the dataset,\n * the primary thing this class does (currently) is override templates\n * to render the HID.\n */\nvar HDAListItemView = _super.extend(\n/** @lends HDAListItemView.prototype */{\n\n className : _super.prototype.className + \" history-content\",\n\n initialize : function( attributes, options ){\n _super.prototype.initialize.call( this, attributes, options );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDAListItemView(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nHDAListItemView.prototype.templates = (function(){\n\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n // adding the hid display to the title\n '
                                                        ',\n '',\n '
                                                        ',\n //TODO: remove whitespace and use margin-right\n '<%- dataset.hid %> ',\n '<%- dataset.name %>',\n '
                                                        ',\n '
                                                        ',\n '',\n '<% _.each(_.sortBy(_.uniq(dataset.tags), function(x) { return x }), function(tag){ %>',\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n '<% } %>',\n '<% }); %>',\n '',\n '
                                                        '\n ], 'dataset' );\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n hidden : BASE_MVC.wrapTemplate([\n // add a warning when hidden\n '<% if( !dataset.visible ){ %>',\n '
                                                        ',\n _l( 'This dataset has been hidden' ),\n '
                                                        ',\n '<% } %>'\n ], 'dataset' )\n });\n\n return _.extend( {}, _super.prototype.templates, {\n titleBar : titleBarTemplate,\n warnings : warnings\n });\n}());\n\n\n\n//==============================================================================\n return {\n HDAListItemView : HDAListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hda-li.js","define([\n \"mvc/dataset/dataset-model\",\n \"mvc/history/history-content-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DATASET, HISTORY_CONTENT, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\nvar _super = DATASET.DatasetAssociation,\n hcontentMixin = HISTORY_CONTENT.HistoryContentMixin;\n/** @class (HDA) model for a Galaxy dataset contained in and related to a history.\n */\nvar HistoryDatasetAssociation = _super.extend( BASE_MVC.mixin( hcontentMixin,\n/** @lends HistoryDatasetAssociation.prototype */{\n\n /** default attributes for a model */\n defaults : _.extend( {}, _super.prototype.defaults, hcontentMixin.defaults, {\n history_content_type: 'dataset',\n model_class : 'HistoryDatasetAssociation'\n }),\n}));\n\n//==============================================================================\n return {\n HistoryDatasetAssociation : HistoryDatasetAssociation\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hda-model.js","define([\n \"mvc/dataset/states\",\n \"mvc/collection/collection-li\",\n \"mvc/collection/collection-view\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, DC_LI, DC_VIEW, BASE_MVC, _l ){\n\n'use strict';\n\n//==============================================================================\nvar _super = DC_LI.DCListItemView;\n/** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n */\nvar HDCAListItemView = _super.extend(\n/** @lends HDCAListItemView.prototype */{\n\n className : _super.prototype.className + \" history-content\",\n\n /** event listeners */\n _setUpListeners : function(){\n _super.prototype._setUpListeners.call( this );\n this.listenTo( this.model, {\n 'change:tags change:populated change:visible' : function( model, options ){ this.render(); },\n });\n },\n\n /** Override to provide the proper collections panels as the foldout */\n _getFoldoutPanelClass : function(){\n switch( this.model.get( 'collection_type' ) ){\n case 'list':\n return DC_VIEW.ListCollectionView;\n case 'paired':\n return DC_VIEW.PairCollectionView;\n case 'list:paired':\n return DC_VIEW.ListOfPairsCollectionView;\n case 'list:list':\n return DC_VIEW.ListOfListsCollectionView;\n }\n throw new TypeError( 'Uknown collection_type: ' + this.model.get( 'collection_type' ) );\n },\n\n /** In this override, add the state as a class for use with state-based CSS */\n _swapNewRender : function( $newRender ){\n _super.prototype._swapNewRender.call( this, $newRender );\n //TODO: model currently has no state\n var state = !this.model.get( 'populated' ) ? STATES.RUNNING : STATES.OK;\n //if( this.model.has( 'state' ) ){\n this.$el.addClass( 'state-' + state );\n //}\n return this.$el;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'HDCAListItemView(' + modelString + ')';\n }\n});\n\n/** underscore templates */\nHDCAListItemView.prototype.templates = (function(){\n\n var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n hidden : BASE_MVC.wrapTemplate([\n // add a warning when hidden\n '<% if( !collection.visible ){ %>',\n '
                                                        ',\n _l( 'This collection has been hidden' ),\n '
                                                        ',\n '<% } %>'\n ], 'collection' )\n });\n\n// could steal this from hda-base (or use mixed content)\n var titleBarTemplate = BASE_MVC.wrapTemplate([\n // adding the hid display to the title\n '
                                                        ',\n '',\n '
                                                        ',\n //TODO: remove whitespace and use margin-right\n '<%- collection.hid %> ',\n '<%- collection.name %>',\n '
                                                        ',\n '
                                                        ',\n '',\n '<% _.each(_.sortBy(_.uniq(collection.tags), function(x) { return x }), function(tag){ %>',\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n '<% } %>',\n '<% }); %>',\n '',\n '
                                                        '\n ], 'collection' );\n\n return _.extend( {}, _super.prototype.templates, {\n warnings : warnings,\n titleBar : titleBarTemplate\n });\n}());\n\n\n//==============================================================================\n return {\n HDCAListItemView : HDCAListItemView\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/hdca-li.js","define([\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( STATES, BASE_MVC, _l ){\n'use strict';\n\n//==============================================================================\n/** @class Mixin for HistoryContents content (HDAs, HDCAs).\n */\nvar HistoryContentMixin = {\n\n /** default attributes for a model */\n defaults : {\n /** parent (containing) history */\n history_id : null,\n /** some content_type (HistoryContents can contain mixed model classes) */\n history_content_type: null,\n /** indicating when/what order the content was generated in the context of the history */\n hid : null,\n /** whether the user wants the content shown (visible) */\n visible : true\n },\n\n // ........................................................................ mixed content element\n // In order to be part of a MIXED bbone collection, we can't rely on the id\n // (which may collide btwn models of different classes)\n // Instead, use type_id which prefixes the history_content_type so the bbone collection can differentiate\n idAttribute : 'type_id',\n\n // ........................................................................ common queries\n /** the more common alias of visible */\n hidden : function(){\n return !this.get( 'visible' );\n },\n\n//TODO: remove\n /** based on includeDeleted, includeHidden (gen. from the container control),\n * would this ds show in the list of ds's?\n * @param {Boolean} includeDeleted are we showing deleted hdas?\n * @param {Boolean} includeHidden are we showing hidden hdas?\n */\n isVisible : function( includeDeleted, includeHidden ){\n var isVisible = true;\n if( ( !includeDeleted )\n && ( this.get( 'deleted' ) || this.get( 'purged' ) ) ){\n isVisible = false;\n }\n if( ( !includeHidden )\n && ( !this.get( 'visible' ) ) ){\n isVisible = false;\n }\n return isVisible;\n },\n\n // ........................................................................ ajax\n //TODO?: these are probably better done on the leaf classes\n /** history content goes through the 'api/histories' API */\n urlRoot: Galaxy.root + 'api/histories/',\n\n /** full url spec. for this content */\n url : function(){\n var url = this.urlRoot + this.get( 'history_id' ) + '/contents/'\n + this.get('history_content_type') + 's/' + this.get( 'id' );\n return url;\n },\n\n /** save this content as not visible */\n hide : function( options ){\n if( !this.get( 'visible' ) ){ return jQuery.when(); }\n return this.save( { visible: false }, options );\n },\n /** save this content as visible */\n unhide : function( options ){\n if( this.get( 'visible' ) ){ return jQuery.when(); }\n return this.save( { visible: true }, options );\n },\n\n // ........................................................................ misc\n toString : function(){\n return ([ this.get( 'type_id' ), this.get( 'hid' ), this.get( 'name' ) ].join(':'));\n }\n};\n\n\n//==============================================================================\n return {\n HistoryContentMixin : HistoryContentMixin\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/history/history-content-model.js","define([\n \"mvc/list/list-item\",\n \"ui/loading-indicator\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/search-input\"\n], function( LIST_ITEM, LoadingIndicator, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'list';\n/* ============================================================================\nTODO:\n\n============================================================================ */\n/** @class View for a list/collection of models and the sub-views of those models.\n * Sub-views must (at least have the interface if not) inherit from ListItemView.\n * (For a list panel that also includes some 'container' model (History->HistoryContents)\n * use ModelWithListPanel)\n *\n * Allows for:\n * searching collection/sub-views\n * selecting/multi-selecting sub-views\n *\n * Currently used:\n * for dataset/dataset-choice\n * as superclass of ModelListPanel\n */\nvar ListPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(/** @lends ListPanel.prototype */{\n _logNamespace : logNamespace,\n\n /** class to use for constructing the sub-views */\n viewClass : LIST_ITEM.ListItemView,\n /** class to used for constructing collection of sub-view models */\n collectionClass : Backbone.Collection,\n\n tagName : 'div',\n className : 'list-panel',\n\n /** (in ms) that jquery effects will use */\n fxSpeed : 'fast',\n\n /** string to display when the collection has no contents */\n emptyMsg : _l( 'This list is empty' ),\n /** displayed when no items match the search terms */\n noneFoundMsg : _l( 'No matching items found' ),\n /** string used for search placeholder */\n searchPlaceholder : _l( 'search' ),\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the list\n */\n initialize : function( attributes, options ){\n attributes = attributes || {};\n // set the logger if requested\n if( attributes.logger ){\n this.logger = attributes.logger;\n }\n this.log( this + '.initialize:', attributes );\n\n // ---- instance vars\n /** how quickly should jquery fx run? */\n this.fxSpeed = _.has( attributes, 'fxSpeed' )?( attributes.fxSpeed ):( this.fxSpeed );\n\n /** filters for displaying subviews */\n this.filters = [];\n /** current search terms */\n this.searchFor = attributes.searchFor || '';\n\n /** loading indicator */\n // this.indicator = new LoadingIndicator( this.$el );\n\n /** currently showing selectors on items? */\n this.selecting = ( attributes.selecting !== undefined )? attributes.selecting : true;\n //this.selecting = false;\n\n /** cached selected item.model.ids to persist btwn renders */\n this.selected = attributes.selected || [];\n /** the last selected item.model.id */\n this.lastSelected = null;\n\n /** are sub-views draggable */\n this.dragItems = attributes.dragItems || false;\n\n /** list item view class (when passed models) */\n this.viewClass = attributes.viewClass || this.viewClass;\n\n /** list item views */\n this.views = [];\n /** list item models */\n this.collection = attributes.collection || this._createDefaultCollection();\n\n /** filter fns run over collection items to see if they should show in the list */\n this.filters = attributes.filters || [];\n\n /** override $scrollContainer fn via attributes - fn should return jq for elem to call scrollTo on */\n this.$scrollContainer = attributes.$scrollContainer || this.$scrollContainer;\n\n /** @type {String} generic title */\n this.title = attributes.title || '';\n /** @type {String} generic subtitle */\n this.subtitle = attributes.subtitle || '';\n\n this._setUpListeners();\n },\n\n // ------------------------------------------------------------------------ listeners\n /** create any event listeners for the list */\n _setUpListeners : function(){\n this.off();\n\n //TODO: move errorHandler down into list-view from history-view or\n // pass to global error handler (Galaxy)\n this.on({\n error: function( model, xhr, options, msg, details ){\n //this.errorHandler( model, xhr, options, msg, details );\n console.error( model, xhr, options, msg, details );\n },\n // show hide the loading indicator\n loading: function(){\n this._showLoadingIndicator( 'loading...', 40 );\n },\n 'loading-done': function(){\n this._hideLoadingIndicator( 40 );\n },\n });\n\n // throw the first render up as a diff namespace using once (for outside consumption)\n this.once( 'rendered', function(){\n this.trigger( 'rendered:initial', this );\n });\n\n this._setUpCollectionListeners();\n this._setUpViewListeners();\n return this;\n },\n\n /** create and return a collection for when none is initially passed */\n _createDefaultCollection : function(){\n // override\n return new this.collectionClass([]);\n },\n\n /** listening for collection events */\n _setUpCollectionListeners : function(){\n this.log( this + '._setUpCollectionListeners', this.collection );\n this.stopListening( this.collection );\n\n // bubble up error events\n this.listenTo( this.collection, {\n error : function( model, xhr, options, msg, details ){\n this.trigger( 'error', model, xhr, options, msg, details );\n },\n update : function( collection, options ){\n var changes = options.changes;\n // console.info( collection + ', update:', changes, '\\noptions:', options );\n // more than one: render everything\n if( options.renderAll || ( changes.added.length + changes.removed.length > 1 ) ){\n return this.renderItems();\n }\n // otherwise, let the single add/remove handlers do it\n if( changes.added.length === 1 ){\n return this.addItemView( _.first( changes.added ), collection, options );\n }\n if( changes.removed.length === 1 ){\n return this.removeItemView( _.first( changes.removed ), collection, options );\n }\n }\n });\n return this;\n },\n\n /** listening for sub-view events that bubble up with the 'view:' prefix */\n _setUpViewListeners : function(){\n this.log( this + '._setUpViewListeners' );\n\n // shift to select a range\n this.on({\n 'view:selected': function( view, ev ){\n if( ev && ev.shiftKey && this.lastSelected ){\n var lastSelectedView = this.viewFromModelId( this.lastSelected );\n if( lastSelectedView ){\n this.selectRange( view, lastSelectedView );\n }\n } else if( ev && ev.altKey && !this.selecting ){\n this.showSelectors();\n }\n this.selected.push( view.model.id );\n this.lastSelected = view.model.id;\n },\n\n 'view:de-selected': function( view, ev ){\n this.selected = _.without( this.selected, view.model.id );\n }\n });\n },\n\n // ------------------------------------------------------------------------ rendering\n /** Render this content, set up ui.\n * @param {Number or String} speed the speed of the render\n */\n render : function( speed ){\n this.log( this + '.render', speed );\n var $newRender = this._buildNewRender();\n this._setUpBehaviors( $newRender );\n this._queueNewRender( $newRender, speed );\n return this;\n },\n\n /** Build a temp div containing the new children for the view's $el. */\n _buildNewRender : function(){\n this.debug( this + '(ListPanel)._buildNewRender' );\n var $newRender = $( this.templates.el( {}, this ) );\n this._renderControls( $newRender );\n this._renderTitle( $newRender );\n this._renderSubtitle( $newRender );\n this._renderSearch( $newRender );\n this.renderItems( $newRender );\n return $newRender;\n },\n\n /** Build a temp div containing the new children for the view's $el. */\n _renderControls : function( $newRender ){\n this.debug( this + '(ListPanel)._renderControls' );\n var $controls = $( this.templates.controls( {}, this ) );\n $newRender.find( '.controls' ).replaceWith( $controls );\n return $controls;\n },\n\n /** return a jQuery object containing the title DOM */\n _renderTitle : function( $where ){\n //$where = $where || this.$el;\n //$where.find( '.title' ).replaceWith( ... )\n },\n\n /** return a jQuery object containing the subtitle DOM (if any) */\n _renderSubtitle : function( $where ){\n //$where = $where || this.$el;\n //$where.find( '.title' ).replaceWith( ... )\n },\n\n /** Fade out the old el, swap in the new contents, then fade in.\n * @param {Number or String} speed jq speed to use for rendering effects\n * @fires rendered when rendered\n */\n _queueNewRender : function( $newRender, speed ) {\n speed = ( speed === undefined )?( this.fxSpeed ):( speed );\n var panel = this;\n panel.log( '_queueNewRender:', $newRender, speed );\n\n $( panel ).queue( 'fx', [\n function( next ){\n panel.$el.fadeOut( speed, next );\n },\n function( next ){\n panel._swapNewRender( $newRender );\n next();\n },\n function( next ){\n panel.$el.fadeIn( speed, next );\n },\n function( next ){\n panel.trigger( 'rendered', panel );\n next();\n }\n ]);\n },\n\n /** empty out the current el, move the $newRender's children in */\n _swapNewRender : function( $newRender ){\n this.$el.empty().attr( 'class', this.className ).append( $newRender.children() );\n if( this.selecting ){ this.showSelectors( 0 ); }\n return this;\n },\n\n /** Set up any behaviors, handlers (ep. plugins) that need to be called when the entire view has been built but\n * not attached to the page yet.\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n this.$controls( $where ).find('[title]').tooltip();\n // set up the pupup for actions available when multi selecting\n this._renderMultiselectActionMenu( $where );\n return this;\n },\n\n /** render a menu containing the actions available to sets of selected items */\n _renderMultiselectActionMenu : function( $where ){\n $where = $where || this.$el;\n var $menu = $where.find( '.list-action-menu' ),\n actions = this.multiselectActions();\n if( !actions.length ){\n return $menu.empty();\n }\n\n var $newMenu = $([\n '
                                                        ',\n '',\n '
                                                          ', '
                                                        ',\n '
                                                        '\n ].join(''));\n var $actions = actions.map( function( action ){\n var html = [ '
                                                      • ', action.html, '
                                                      • ' ].join( '' );\n return $( html ).click( function( ev ){\n ev.preventDefault();\n return action.func( ev );\n });\n });\n $newMenu.find( 'ul' ).append( $actions );\n $menu.replaceWith( $newMenu );\n return $newMenu;\n },\n\n /** return a list of plain objects used to render multiselect actions menu. Each object should have:\n * html: an html string used as the anchor contents\n * func: a function called when the anchor is clicked (passed the click event)\n */\n multiselectActions : function(){\n return [];\n },\n\n // ------------------------------------------------------------------------ sub-$element shortcuts\n /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n $scrollContainer : function( $where ){\n // override or set via attributes.$scrollContainer\n return ( $where || this.$el ).parent().parent();\n },\n /** convenience selector for the section that displays the list controls */\n $controls : function( $where ){\n return ( $where || this.$el ).find( '> .controls' );\n },\n /** list-items: where the subviews are contained in the view's dom */\n $list : function( $where ){\n return ( $where || this.$el ).find( '> .list-items' );\n },\n /** container where list messages are attached */\n $messages : function( $where ){\n //TODO: controls isn't really correct here (only for ModelListPanel)\n return ( $where || this.$el ).find( '> .controls .messages' );\n },\n /** the message displayed when no views can be shown (no views, none matching search) */\n $emptyMessage : function( $where ){\n return ( $where || this.$el ).find( '> .empty-message' );\n },\n\n // ------------------------------------------------------------------------ hda sub-views\n /** render the subviews for the list's collection */\n renderItems : function( $whereTo ){\n $whereTo = $whereTo || this.$el;\n var panel = this;\n panel.log( this + '.renderItems', $whereTo );\n\n var $list = panel.$list( $whereTo );\n panel.freeViews();\n // console.log( 'views freed' );\n //TODO:? cache and re-use views?\n var shownModels = panel._filterCollection();\n // console.log( 'models filtered:', shownModels );\n\n panel.views = shownModels.map( function( itemModel ){\n var view = panel._createItemView( itemModel );\n return view;\n });\n\n $list.empty();\n // console.log( 'list emptied' );\n if( panel.views.length ){\n panel._attachItems( $whereTo );\n // console.log( 'items attached' );\n }\n panel._renderEmptyMessage( $whereTo ).toggle( !panel.views.length );\n panel.trigger( 'views:ready', panel.views );\n\n // console.log( '------------------------------------------- rendering items' );\n return panel.views;\n },\n\n /** Filter the collection to only those models that should be currently viewed */\n _filterCollection : function(){\n // override this\n var panel = this;\n return panel.collection.filter( _.bind( panel._filterItem, panel ) );\n },\n\n /** Should the model be viewable in the current state?\n * Checks against this.filters and this.searchFor\n */\n _filterItem : function( model ){\n // override this\n var panel = this;\n return ( _.every( panel.filters.map( function( fn ){ return fn.call( model ); }) ) )\n && ( !panel.searchFor || model.matchesAll( panel.searchFor ) );\n },\n\n /** Create a view for a model and set up it's listeners */\n _createItemView : function( model ){\n var ViewClass = this._getItemViewClass( model );\n var options = _.extend( this._getItemViewOptions( model ), {\n model : model\n });\n var view = new ViewClass( options );\n this._setUpItemViewListeners( view );\n return view;\n },\n\n /** Free a view for a model. Note: does not remove it from the DOM */\n _destroyItemView : function( view ){\n this.stopListening( view );\n this.views = _.without( this.views, view );\n },\n\n _destroyItemViews : function( view ){\n var self = this;\n self.views.forEach( function( v ){\n self.stopListening( v );\n });\n self.views = [];\n return self;\n },\n\n /** free any sub-views the list has */\n freeViews : function(){\n return this._destroyItemViews();\n },\n\n /** Get the bbone view class based on the model */\n _getItemViewClass : function( model ){\n // override this\n return this.viewClass;\n },\n\n /** Get the options passed to the new view based on the model */\n _getItemViewOptions : function( model ){\n // override this\n return {\n //logger : this.logger,\n fxSpeed : this.fxSpeed,\n expanded : false,\n selectable : this.selecting,\n selected : _.contains( this.selected, model.id ),\n draggable : this.dragItems\n };\n },\n\n /** Set up listeners for new models */\n _setUpItemViewListeners : function( view ){\n var panel = this;\n // send all events to the panel, re-namspaceing them with the view prefix\n this.listenTo( view, 'all', function(){\n var args = Array.prototype.slice.call( arguments, 0 );\n args[0] = 'view:' + args[0];\n panel.trigger.apply( panel, args );\n });\n\n // drag multiple - hijack ev.setData to add all selected items\n this.listenTo( view, 'draggable:dragstart', function( ev, v ){\n //TODO: set multiple drag data here\n var json = {},\n selected = this.getSelectedModels();\n if( selected.length ){\n json = selected.toJSON();\n } else {\n json = [ v.model.toJSON() ];\n }\n ev.dataTransfer.setData( 'text', JSON.stringify( json ) );\n //ev.dataTransfer.setDragImage( v.el, 60, 60 );\n }, this );\n\n return panel;\n },\n\n /** Attach views in this.views to the model based on $whereTo */\n _attachItems : function( $whereTo ){\n var self = this;\n // console.log( '_attachItems:', $whereTo, this.$list( $whereTo ) );\n //ASSUMES: $list has been emptied\n this.$list( $whereTo ).append( this.views.map( function( view ){\n return self._renderItemView$el( view );\n }));\n return this;\n },\n\n /** get a given subview's $el (or whatever may wrap it) and return it */\n _renderItemView$el : function( view ){\n // useful to wrap and override\n return view.render(0).$el;\n },\n\n /** render the empty/none-found message */\n _renderEmptyMessage : function( $whereTo ){\n this.debug( '_renderEmptyMessage', $whereTo, this.searchFor );\n var text = this.searchFor? this.noneFoundMsg : this.emptyMsg;\n return this.$emptyMessage( $whereTo ).text( text );\n },\n\n /** expand all item views */\n expandAll : function(){\n _.each( this.views, function( view ){\n view.expand();\n });\n },\n\n /** collapse all item views */\n collapseAll : function(){\n _.each( this.views, function( view ){\n view.collapse();\n });\n },\n\n // ------------------------------------------------------------------------ collection/views syncing\n /** Add a view (if the model should be viewable) to the panel */\n addItemView : function( model, collection, options ){\n // console.log( this + '.addItemView:', model );\n var panel = this;\n // get the index of the model in the list of filtered models shown by this list\n // in order to insert the view in the proper place\n //TODO:? potentially expensive\n var modelIndex = panel._filterCollection().indexOf( model );\n if( modelIndex === -1 ){ return undefined; }\n var view = panel._createItemView( model );\n // console.log( 'adding and rendering:', modelIndex, view.toString() );\n\n $( view ).queue( 'fx', [\n function( next ){\n // hide the empty message first if only view\n if( panel.$emptyMessage().is( ':visible' ) ){\n panel.$emptyMessage().fadeOut( panel.fxSpeed, next );\n } else {\n next();\n }\n },\n function( next ){\n panel._attachView( view, modelIndex );\n next();\n }\n ]);\n return view;\n },\n\n /** internal fn to add view (to both panel.views and panel.$list) */\n _attachView : function( view, modelIndex, useFx ){\n // console.log( this + '._attachView:', view, modelIndex, useFx );\n useFx = _.isUndefined( useFx )? true : useFx;\n modelIndex = modelIndex || 0;\n var panel = this;\n\n // use the modelIndex to splice into views and insert at the proper index in the DOM\n panel.views.splice( modelIndex, 0, view );\n panel._insertIntoListAt( modelIndex, panel._renderItemView$el( view ).hide() );\n\n panel.trigger( 'view:attached', view );\n if( useFx ){\n view.$el.slideDown( panel.fxSpeed, function(){\n panel.trigger( 'view:attached:rendered' );\n });\n } else {\n view.$el.show();\n panel.trigger( 'view:attached:rendered' );\n }\n return view;\n },\n\n /** insert a jq object as a child of list-items at the specified *DOM index* */\n _insertIntoListAt : function( index, $what ){\n // console.log( this + '._insertIntoListAt:', index, $what );\n var $list = this.$list();\n if( index === 0 ){\n $list.prepend( $what );\n } else {\n $list.children().eq( index - 1 ).after( $what );\n }\n return $what;\n },\n\n /** Remove a view from the panel (if found) */\n removeItemView : function( model, collection, options ){\n var panel = this;\n var view = _.find( panel.views, function( v ){ return v.model === model; });\n if( !view ){ return undefined; }\n panel.views = _.without( panel.views, view );\n panel.trigger( 'view:removed', view );\n\n // potentially show the empty message if no views left\n // use anonymous queue here - since remove can happen multiple times\n $({}).queue( 'fx', [\n function( next ){\n view.$el.fadeOut( panel.fxSpeed, next );\n },\n function( next ){\n view.remove();\n panel.trigger( 'view:removed:rendered' );\n if( !panel.views.length ){\n panel._renderEmptyMessage().fadeIn( panel.fxSpeed, next );\n } else {\n next();\n }\n }\n ]);\n return view;\n },\n\n /** get views based on model.id */\n viewFromModelId : function( id ){\n return _.find( this.views, function( v ){ return v.model.id === id; });\n },\n\n /** get views based on model */\n viewFromModel : function( model ){\n return model ? this.viewFromModelId( model.id ) : undefined;\n },\n\n /** get views based on model properties */\n viewsWhereModel : function( properties ){\n return this.views.filter( function( view ){\n return _.isMatch( view.model.attributes, properties );\n });\n },\n\n /** A range of views between (and including) viewA and viewB */\n viewRange : function( viewA, viewB ){\n if( viewA === viewB ){ return ( viewA )?( [ viewA ] ):( [] ); }\n\n var indexA = this.views.indexOf( viewA ),\n indexB = this.views.indexOf( viewB );\n\n // handle not found\n if( indexA === -1 || indexB === -1 ){\n if( indexA === indexB ){ return []; }\n return ( indexA === -1 )?( [ viewB ] ):( [ viewA ] );\n }\n // reverse if indeces are\n //note: end inclusive\n return ( indexA < indexB )?\n this.views.slice( indexA, indexB + 1 ) :\n this.views.slice( indexB, indexA + 1 );\n },\n\n // ------------------------------------------------------------------------ searching\n /** render a search input for filtering datasets shown\n * (see SearchableMixin in base-mvc for implementation of the actual searching)\n * return will start the search\n * esc will clear the search\n * clicking the clear button will clear the search\n * uses searchInput in ui.js\n */\n _renderSearch : function( $where ){\n $where.find( '.controls .search-input' ).searchInput({\n placeholder : this.searchPlaceholder,\n initialVal : this.searchFor,\n onfirstsearch : _.bind( this._firstSearch, this ),\n onsearch : _.bind( this.searchItems, this ),\n onclear : _.bind( this.clearSearch, this )\n });\n return $where;\n },\n\n /** What to do on the first search entered */\n _firstSearch : function( searchFor ){\n // override to load model details if necc.\n this.log( 'onFirstSearch', searchFor );\n return this.searchItems( searchFor );\n },\n\n /** filter view list to those that contain the searchFor terms */\n searchItems : function( searchFor, force ){\n this.log( 'searchItems', searchFor, this.searchFor, force );\n if( !force && this.searchFor === searchFor ){ return this; }\n this.searchFor = searchFor;\n this.renderItems();\n this.trigger( 'search:searching', searchFor, this );\n var $search = this.$( '> .controls .search-query' );\n if( $search.val() !== searchFor ){\n $search.val( searchFor );\n }\n return this;\n },\n\n /** clear the search filters and show all views that are normally shown */\n clearSearch : function( searchFor ){\n //this.log( 'onSearchClear', this );\n this.searchFor = '';\n this.trigger( 'search:clear', this );\n this.$( '> .controls .search-query' ).val( '' );\n this.renderItems();\n return this;\n },\n\n // ------------------------------------------------------------------------ selection\n /** @type Integer when the number of list item views is >= to this, don't animate selectors */\n THROTTLE_SELECTOR_FX_AT : 20,\n\n /** show selectors on all visible itemViews and associated controls */\n showSelectors : function( speed ){\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n this.selecting = true;\n this.$( '.list-actions' ).slideDown( speed );\n speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT? 0 : speed;\n _.each( this.views, function( view ){\n view.showSelector( speed );\n });\n //this.selected = [];\n //this.lastSelected = null;\n },\n\n /** hide selectors on all visible itemViews and associated controls */\n hideSelectors : function( speed ){\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n this.selecting = false;\n this.$( '.list-actions' ).slideUp( speed );\n speed = this.views.length >= this.THROTTLE_SELECTOR_FX_AT? 0 : speed;\n _.each( this.views, function( view ){\n view.hideSelector( speed );\n });\n this.selected = [];\n this.lastSelected = null;\n },\n\n /** show or hide selectors on all visible itemViews and associated controls */\n toggleSelectors : function(){\n if( !this.selecting ){\n this.showSelectors();\n } else {\n this.hideSelectors();\n }\n },\n\n /** select all visible items */\n selectAll : function( event ){\n _.each( this.views, function( view ){\n view.select( event );\n });\n },\n\n /** deselect all visible items */\n deselectAll : function( event ){\n this.lastSelected = null;\n _.each( this.views, function( view ){\n view.deselect( event );\n });\n },\n\n /** select a range of datasets between A and B */\n selectRange : function( viewA, viewB ){\n var range = this.viewRange( viewA, viewB );\n _.each( range, function( view ){\n view.select();\n });\n return range;\n },\n\n /** return an array of all currently selected itemViews */\n getSelectedViews : function(){\n return _.filter( this.views, function( v ){\n return v.selected;\n });\n },\n\n /** return a collection of the models of all currenly selected items */\n getSelectedModels : function(){\n // console.log( '(getSelectedModels)' );\n return new this.collection.constructor( _.map( this.getSelectedViews(), function( view ){\n return view.model;\n }));\n },\n\n // ------------------------------------------------------------------------ loading indicator\n /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n _showLoadingIndicator : function( msg, speed, callback ){\n this.debug( '_showLoadingIndicator', this.indicator, msg, speed, callback );\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n if( !this.indicator ){\n this.indicator = new LoadingIndicator( this.$el );\n this.debug( '\\t created', this.indicator );\n }\n if( !this.$el.is( ':visible' ) ){\n this.indicator.show( 0, callback );\n } else {\n this.$el.fadeOut( speed );\n this.indicator.show( msg, speed, callback );\n }\n },\n\n /** hide the loading indicator */\n _hideLoadingIndicator : function( speed, callback ){\n this.debug( '_hideLoadingIndicator', this.indicator, speed, callback );\n speed = ( speed !== undefined )?( speed ):( this.fxSpeed );\n if( this.indicator ){\n this.indicator.hide( speed, callback );\n }\n },\n\n // ------------------------------------------------------------------------ scrolling\n /** get the current scroll position of the panel in its parent */\n scrollPosition : function(){\n return this.$scrollContainer().scrollTop();\n },\n\n /** set the current scroll position of the panel in its parent */\n scrollTo : function( pos, speed ){\n speed = speed || 0;\n this.$scrollContainer().animate({ scrollTop: pos }, speed );\n return this;\n },\n\n /** Scrolls the panel to the top. */\n scrollToTop : function( speed ){\n return this.scrollTo( 0, speed );\n },\n\n /** scroll to the given view in list-items */\n scrollToItem : function( view, speed ){\n if( !view ){ return this; }\n return this;\n },\n\n /** Scrolls the panel to show the content with the given id. */\n scrollToId : function( id, speed ){\n return this.scrollToItem( this.viewFromModelId( id ), speed );\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events : {\n 'click .select-all' : 'selectAll',\n 'click .deselect-all' : 'deselectAll'\n },\n\n // ------------------------------------------------------------------------ misc\n /** Return a string rep of the panel */\n toString : function(){\n return 'ListPanel(' + this.collection + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nListPanel.prototype.templates = (function(){\n\n var elTemplate = BASE_MVC.wrapTemplate([\n // temp container\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        '\n ]);\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                                                        ',\n '
                                                        ',\n '
                                                        <%- view.title %>
                                                        ',\n '
                                                        ',\n '
                                                        <%- view.subtitle %>
                                                        ',\n // buttons, controls go here\n '
                                                        ',\n // deleted msg, etc.\n '
                                                        ',\n\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n\n // show when selectors are shown\n '
                                                        ',\n '
                                                        ',\n '',\n '',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        '\n ]);\n\n return {\n el : elTemplate,\n controls : controlsTemplate\n };\n}());\n\n\n//=============================================================================\n/** View for a model that has a sub-collection (e.g. History, DatasetCollection)\n * Allows:\n * the model to be reset\n * auto assign panel.collection to panel.model[ panel.modelCollectionKey ]\n *\n */\nvar ModelListPanel = ListPanel.extend({\n\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey : 'contents',\n\n initialize : function( attributes ){\n ListPanel.prototype.initialize.call( this, attributes );\n this.selecting = ( attributes.selecting !== undefined )? attributes.selecting : false;\n\n this.setModel( this.model, attributes );\n },\n\n /** release/free/shutdown old models and set up panel for new models\n * @fires new-model with the panel as parameter\n */\n setModel : function( model, attributes ){\n attributes = attributes || {};\n this.debug( this + '.setModel:', model, attributes );\n\n this.freeModel();\n this.freeViews();\n\n if( model ){\n var oldModelId = this.model? this.model.get( 'id' ): null;\n\n // set up the new model with user, logger, storage, events\n this.model = model;\n if( this.logger ){\n this.model.logger = this.logger;\n }\n this._setUpModelListeners();\n\n //TODO: relation btwn model, collection becoming tangled here\n // free the collection, and assign the new collection to either\n // the model[ modelCollectionKey ], attributes.collection, or an empty vanilla collection\n this.stopListening( this.collection );\n this.collection = this.model[ this.modelCollectionKey ]\n || attributes.collection\n || this._createDefaultCollection();\n this._setUpCollectionListeners();\n\n if( oldModelId && model.get( 'id' ) !== oldModelId ){\n this.trigger( 'new-model', this );\n }\n }\n return this;\n },\n\n /** free the current model and all listeners for it, free any views for the model */\n freeModel : function(){\n // stop/release the previous model, and clear cache to sub-views\n if( this.model ){\n this.stopListening( this.model );\n //TODO: see base-mvc\n //this.model.free();\n //this.model = null;\n }\n return this;\n },\n\n // ------------------------------------------------------------------------ listening\n /** listening for model events */\n _setUpModelListeners : function(){\n // override\n this.log( this + '._setUpModelListeners', this.model );\n // bounce model errors up to the panel\n this.listenTo( this.model, 'error', function(){\n var args = Array.prototype.slice.call( arguments, 0 );\n //args.unshift( 'model:error' );\n args.unshift( 'error' );\n this.trigger.apply( this, args );\n }, this );\n\n // debugging\n if( this.logger ){\n this.listenTo( this.model, 'all', function( event ){\n this.info( this + '(model)', event, arguments );\n });\n }\n return this;\n },\n\n /** Build a temp div containing the new children for the view's $el.\n */\n _renderControls : function( $newRender ){\n this.debug( this + '(ModelListPanel)._renderControls' );\n var json = this.model? this.model.toJSON() : {},\n $controls = $( this.templates.controls( json, this ) );\n $newRender.find( '.controls' ).replaceWith( $controls );\n return $controls;\n },\n\n // ------------------------------------------------------------------------ misc\n /** Return a string rep of the panel */\n toString : function(){\n return 'ModelListPanel(' + this.model + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nModelListPanel.prototype.templates = (function(){\n\n var controlsTemplate = BASE_MVC.wrapTemplate([\n '
                                                        ',\n '
                                                        ',\n //TODO: this is really the only difference - consider factoring titlebar out\n '
                                                        <%- model.name %>
                                                        ',\n '
                                                        ',\n '
                                                        <%- view.subtitle %>
                                                        ',\n '
                                                        ',\n '
                                                        ',\n\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n\n '
                                                        ',\n '
                                                        ',\n '',\n '',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        '\n ]);\n\n return _.extend( _.clone( ListPanel.prototype.templates ), {\n controls : controlsTemplate\n });\n}());\n\n\n//=============================================================================\n return {\n ListPanel : ListPanel,\n ModelListPanel : ModelListPanel\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/list/list-view.js","/** This is the run workflow tool form view. */\ndefine([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view', 'mvc/form/form-data', 'mvc/tool/tool-form-base', 'mvc/ui/ui-modal', 'mvc/webhooks', 'mvc/workflow/workflow-icons' ],\n function( Utils, Deferred, Ui, Form, FormData, ToolFormBase, Modal, Webhooks, WorkflowIcons ) {\n\n var View = Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.modal = parent.Galaxy.modal || new Modal.View();\n this.model = options && options.model || new Backbone.Model( options );\n this.deferred = new Deferred();\n this.setElement( $( '
                                                        ' ).addClass( 'ui-form-composite' )\n .append( this.$message = $( '
                                                        ' ) )\n .append( this.$header = $( '
                                                        ' ) )\n .append( this.$steps = $( '
                                                        ' ) ) );\n $( 'body' ).append( this.$el );\n this._configure();\n this.render();\n $( window ).resize( function() { self._refresh() } );\n },\n\n /** Refresh height of scrollable div below header, handle scrolling by lazy loading steps */\n _refresh: function( step_index ) {\n var margin = _.reduce( this.$el.children(), function( memo, child ) {\n return memo + $( child ).outerHeight();\n }, 0 ) - this.$steps.height() + 90;\n this.$steps.css( 'height', $( window ).height() - margin );\n },\n\n /** Configures form/step options for each workflow step */\n _configure: function() {\n var self = this;\n this.forms = [];\n this.steps = [];\n this.links = [];\n this.parms = [];\n _.each( this.model.get( 'steps' ), function( step, i ) {\n Galaxy.emit.debug( 'tool-form-composite::initialize()', i + ' : Preparing workflow step.' );\n var icon = WorkflowIcons[ step.step_type ];\n var title = parseInt( i + 1 ) + ': ' + ( step.step_label || step.step_name );\n if ( step.annotation ) {\n title += ' - ' + step.annotation;\n }\n if ( step.step_version ) {\n title += ' (Galaxy Version ' + step.step_version + ')';\n }\n step = Utils.merge( {\n index : i,\n fixed_title : _.escape( title ),\n icon : icon || '',\n help : null,\n citations : null,\n collapsible : true,\n collapsed : i > 0 && !self._isDataStep( step ),\n sustain_version : true,\n sustain_repeats : true,\n sustain_conditionals : true,\n narrow : true,\n text_enable : 'Edit',\n text_disable : 'Undo',\n cls_enable : 'fa fa-edit',\n cls_disable : 'fa fa-undo',\n errors : step.messages,\n initial_errors : true,\n cls : 'ui-portlet-narrow',\n hide_operations : true,\n needs_refresh : false,\n always_refresh : step.step_type != 'tool'\n }, step );\n self.steps[ i ] = step;\n self.links[ i ] = [];\n self.parms[ i ] = {};\n });\n\n // build linear index of step input pairs\n _.each( this.steps, function( step, i ) {\n FormData.visitInputs( step.inputs, function( input, name ) {\n self.parms[ i ][ name ] = input;\n });\n });\n\n // iterate through data input modules and collect linked sub steps\n _.each( this.steps, function( step, i ) {\n _.each( step.output_connections, function( output_connection ) {\n _.each( self.steps, function( sub_step, j ) {\n sub_step.step_index === output_connection.input_step_index && self.links[ i ].push( sub_step );\n });\n });\n });\n\n // convert all connected data inputs to hidden fields with proper labels,\n // and track the linked source step\n _.each( this.steps, function( step, i ) {\n _.each( self.steps, function( sub_step, j ) {\n var connections_by_name = {};\n _.each( step.output_connections, function( connection ) {\n sub_step.step_index === connection.input_step_index && ( connections_by_name[ connection.input_name ] = connection );\n });\n _.each( self.parms[ j ], function( input, name ) {\n var connection = connections_by_name[ name ];\n if ( connection ) {\n input.type = 'hidden';\n input.help = input.step_linked ? input.help + ', ' : '';\n input.help += 'Output dataset \\'' + connection.output_name + '\\' from step ' + ( parseInt( i ) + 1 );\n input.step_linked = input.step_linked || [];\n input.step_linked.push( step );\n }\n });\n });\n });\n\n // identify and configure workflow parameters\n var wp_count = 0;\n this.wp_inputs = {};\n function _handleWorkflowParameter( value, callback ) {\n var re = /\\$\\{(.+?)\\}/g, match;\n while ( match = re.exec( String( value ) ) ) {\n var wp_name = match[ 1 ];\n callback( self.wp_inputs[ wp_name ] = self.wp_inputs[ wp_name ] || {\n label : wp_name,\n name : wp_name,\n type : 'text',\n color : 'hsl( ' + ( ++wp_count * 100 ) + ', 70%, 30% )',\n style : 'ui-form-wp-source',\n links : []\n });\n }\n }\n _.each( this.steps, function( step, i ) {\n _.each( self.parms[ i ], function( input, name ) {\n _handleWorkflowParameter( input.value, function( wp_input ) {\n wp_input.links.push( step );\n input.wp_linked = true;\n input.type = 'text';\n input.backdrop = true;\n input.style = 'ui-form-wp-target';\n });\n });\n _.each( step.post_job_actions, function( pja ) {\n _.each( pja.action_arguments, function( arg ) {\n _handleWorkflowParameter( arg, function() {} );\n });\n });\n });\n\n // select fields are shown for dynamic fields if all putative data inputs are available,\n // or if an explicit reference is specified as data_ref and available\n _.each( this.steps, function( step, i ) {\n if ( step.step_type == 'tool' ) {\n var data_resolved = true;\n FormData.visitInputs( step.inputs, function ( input, name, context ) {\n var is_runtime_value = input.value && input.value.__class__ == 'RuntimeValue';\n var is_data_input = ([ 'data', 'data_collection' ]).indexOf( input.type ) != -1;\n var data_ref = context[ input.data_ref ];\n input.step_linked && !self._isDataStep( input.step_linked ) && ( data_resolved = false );\n input.options && ( ( input.options.length == 0 && !data_resolved ) || input.wp_linked ) && ( input.is_workflow = true );\n data_ref && ( input.is_workflow = ( data_ref.step_linked && !self._isDataStep( data_ref.step_linked ) ) || input.wp_linked );\n ( is_data_input || ( input.value && input.value.__class__ == 'RuntimeValue' && !input.step_linked ) ) && ( step.collapsed = false );\n is_runtime_value && ( input.value = input.default_value );\n input.flavor = 'workflow';\n if ( !is_runtime_value && !is_data_input && input.type !== 'hidden' && !input.wp_linked ) {\n if ( input.optional || ( !Utils.isEmpty( input.value ) && input.value !== '' ) ) {\n input.collapsible_value = input.value;\n input.collapsible_preview = true;\n }\n }\n });\n }\n });\n },\n\n render: function() {\n var self = this;\n this.deferred.reset();\n this._renderHeader();\n this._renderMessage();\n this._renderParameters();\n this._renderHistory();\n _.each ( this.steps, function( step ) { self._renderStep( step ) } );\n },\n\n /** Render header */\n _renderHeader: function() {\n var self = this;\n this.execute_btn = new Ui.Button({\n icon : 'fa-check',\n title : 'Run workflow',\n cls : 'btn btn-primary',\n onclick : function() { self._execute() }\n });\n this.$header.addClass( 'ui-form-header' ).empty()\n .append( new Ui.Label( { title: 'Workflow: ' + this.model.get( 'name' ) } ).$el )\n .append( this.execute_btn.$el );\n },\n\n /** Render message */\n _renderMessage: function() {\n this.$message.empty();\n if ( this.model.get( 'has_upgrade_messages' ) ) {\n this.$message.append( new Ui.Message( {\n message : 'Some tools in this workflow may have changed since it was last saved or some errors were found. The workflow may still run, but any new options will have default values. Please review the messages below to make a decision about whether the changes will affect your analysis.',\n status : 'warning',\n persistent : true,\n fade : false\n } ).$el );\n }\n var step_version_changes = this.model.get( 'step_version_changes' );\n if ( step_version_changes && step_version_changes.length > 0 ) {\n this.$message.append( new Ui.Message( {\n message : 'Some tools are being executed with different versions compared to those available when this workflow was last saved because the other versions are not or no longer available on this Galaxy instance. To upgrade your workflow and dismiss this message simply edit the workflow and re-save it.',\n status : 'warning',\n persistent : true,\n fade : false\n } ).$el );\n }\n },\n\n /** Render workflow parameters */\n _renderParameters: function() {\n var self = this;\n this.wp_form = null;\n if ( !_.isEmpty( this.wp_inputs ) ) {\n this.wp_form = new Form({ title: 'Workflow Parameters', inputs: this.wp_inputs, cls: 'ui-portlet-narrow', onchange: function() {\n _.each( self.wp_form.input_list, function( input_def, i ) {\n _.each( input_def.links, function( step ) { self._refreshStep( step ) } );\n });\n }\n });\n this._append( this.$steps.empty(), this.wp_form.$el );\n }\n },\n\n /** Render workflow parameters */\n _renderHistory: function() {\n this.history_form = new Form({\n cls : 'ui-portlet-narrow',\n title : 'History Options',\n inputs : [{\n type : 'conditional',\n name : 'new_history',\n test_param : {\n name : 'check',\n label : 'Send results to a new history',\n type : 'boolean',\n value : 'false',\n help : ''\n },\n cases : [{\n value : 'true',\n inputs : [{\n name : 'name',\n label : 'History name',\n type : 'text',\n value : this.model.get( 'name' )\n }]\n }]\n }]\n });\n this._append( this.$steps, this.history_form.$el );\n },\n\n /** Render step */\n _renderStep: function( step ) {\n var self = this;\n var form = null;\n this.deferred.execute( function( promise ) {\n self.$steps.addClass( 'ui-steps' );\n if ( step.step_type == 'tool' ) {\n step.postchange = function( process, form ) {\n var self = this;\n var current_state = {\n tool_id : step.id,\n tool_version : step.version,\n inputs : $.extend( true, {}, form.data.create() )\n }\n form.wait( true );\n Galaxy.emit.debug( 'tool-form-composite::postchange()', 'Sending current state.', current_state );\n Utils.request({\n type : 'POST',\n url : Galaxy.root + 'api/tools/' + step.id + '/build',\n data : current_state,\n success : function( data ) {\n form.update( data );\n form.wait( false );\n Galaxy.emit.debug( 'tool-form-composite::postchange()', 'Received new model.', data );\n process.resolve();\n },\n error : function( response ) {\n Galaxy.emit.debug( 'tool-form-composite::postchange()', 'Refresh request failed.', response );\n process.reject();\n }\n });\n };\n form = new ToolFormBase( step );\n if ( step.post_job_actions && step.post_job_actions.length ) {\n form.portlet.append( $( '
                                                        ' ).addClass( 'ui-form-element-disabled' )\n .append( $( '
                                                        ' ).addClass( 'ui-form-title' ).html( 'Job Post Actions' ) )\n .append( $( '
                                                        ' ).addClass( 'ui-form-preview' ).html(\n _.reduce( step.post_job_actions, function( memo, value ) {\n return memo + ' ' + value.short_str;\n }, '' ) ) )\n );\n }\n } else {\n var is_simple_input = ([ 'data_input', 'data_collection_input' ]).indexOf( step.step_type ) != -1;\n _.each( step.inputs, function( input ) { input.flavor = 'module'; input.hide_label = is_simple_input; } );\n form = new Form( Utils.merge({\n title : step.fixed_title,\n onchange : function() { _.each( self.links[ step.index ], function( link ) { self._refreshStep( link ) } ) },\n inputs : step.inputs && step.inputs.length > 0 ? step.inputs : [ { type: 'hidden', name: 'No options available.', ignore: null } ]\n }, step ) );\n }\n self.forms[ step.index ] = form;\n self._append( self.$steps, form.$el );\n self._refresh();\n step.needs_refresh && self._refreshStep( step );\n form.portlet[ !self.show_progress ? 'enable' : 'disable' ]();\n self.show_progress && self.execute_btn.model.set( { wait : true,\n wait_text : 'Preparing...',\n percentage : ( step.index + 1 ) * 100.0 / self.steps.length } );\n Galaxy.emit.debug( 'tool-form-composite::initialize()', step.index + ' : Workflow step state ready.', step );\n setTimeout( function() { promise.resolve() }, 0 );\n });\n },\n\n /** Refreshes step values from source step values */\n _refreshStep: function( step ) {\n var self = this;\n var form = this.forms[ step.index ];\n if ( form ) {\n _.each( self.parms[ step.index ], function( input, name ) {\n if ( input.step_linked || input.wp_linked ) {\n var field = form.field_list[ form.data.match( name ) ];\n if ( field ) {\n var new_value = undefined;\n if ( input.step_linked ) {\n new_value = { values: [] };\n _.each( input.step_linked, function( source_step ) {\n if ( self._isDataStep( source_step ) ) {\n var value = self.forms[ source_step.index ].data.create().input;\n value && _.each( value.values, function( v ) { new_value.values.push( v ) } );\n }\n });\n if ( !input.multiple && new_value.values.length > 0 ) {\n new_value = { values: [ new_value.values[ 0 ] ] };\n }\n } else if ( input.wp_linked ) {\n new_value = input.value;\n var re = /\\$\\{(.+?)\\}/g, match;\n while ( match = re.exec( input.value ) ) {\n var wp_field = self.wp_form.field_list[ self.wp_form.data.match( match[ 1 ] ) ];\n var wp_value = wp_field && wp_field.value();\n if ( wp_value ) {\n new_value = new_value.split( match[ 0 ] ).join( wp_value );\n }\n }\n }\n if ( new_value !== undefined ) {\n field.value( new_value );\n }\n }\n }\n });\n form.trigger( 'change' );\n } else {\n step.needs_refresh = true;\n }\n },\n\n /** Refresh the history after job submission while form is shown */\n _refreshHistory: function() {\n var self = this;\n var history = parent.Galaxy && parent.Galaxy.currHistoryPanel && parent.Galaxy.currHistoryPanel.model;\n this._refresh_history && clearTimeout( this._refresh_history );\n if ( history ) {\n history.refresh().success( function() {\n if ( history.numOfUnfinishedShownContents() === 0 ) {\n self._refresh_history = setTimeout( function() { self._refreshHistory() }, history.UPDATE_DELAY );\n }\n });\n }\n },\n\n /** Build remaining steps */\n _execute: function() {\n var self = this;\n this.show_progress = true;\n this._enabled( false );\n this.deferred.execute( function( promise ) {\n setTimeout( function() { promise.resolve(); self._submit(); }, 0 );\n });\n },\n\n /** Validate and submit workflow */\n _submit: function() {\n var self = this;\n var history_form_data = this.history_form.data.create();\n var job_def = {\n new_history_name : history_form_data[ 'new_history|name' ] ? history_form_data[ 'new_history|name' ] : null,\n history_id : !history_form_data[ 'new_history|name' ] ? this.model.get( 'history_id' ) : null,\n replacement_params : this.wp_form ? this.wp_form.data.create() : {},\n parameters : {},\n // Tool form will submit flat maps for each parameter\n // (e.g. \"repeat_0|cond|param\": \"foo\" instead of nested\n // data structures).\n parameters_normalized : true,\n // Tool form always wants a list of invocations back\n // so that inputs can be batched.\n batch : true\n };\n var validated = true;\n for ( var i in this.forms ) {\n var form = this.forms[ i ];\n var job_inputs = form.data.create();\n var step = self.steps[ i ];\n var step_index = step.step_index;\n form.trigger( 'reset' );\n for ( var job_input_id in job_inputs ) {\n var input_value = job_inputs[ job_input_id ];\n var input_id = form.data.match( job_input_id );\n var input_field = form.field_list[ input_id ];\n var input_def = form.input_list[ input_id ];\n if ( !input_def.step_linked ) {\n if ( this._isDataStep( step ) ) {\n validated = input_value && input_value.values && input_value.values.length > 0;\n } else {\n validated = input_def.optional || ( input_def.is_workflow && input_value !== '' ) || ( !input_def.is_workflow && input_value !== null );\n }\n if ( !validated ) {\n form.highlight( input_id );\n break;\n }\n job_def.parameters[ step_index ] = job_def.parameters[ step_index ] || {};\n job_def.parameters[ step_index ][ job_input_id ] = job_inputs[ job_input_id ];\n }\n }\n if ( !validated ) {\n break;\n }\n }\n if ( !validated ) {\n self._enabled( true );\n Galaxy.emit.debug( 'tool-form-composite::submit()', 'Validation failed.', job_def );\n } else {\n Galaxy.emit.debug( 'tool-form-composite::submit()', 'Validation complete.', job_def );\n Utils.request({\n type : 'POST',\n url : Galaxy.root + 'api/workflows/' + this.model.id + '/invocations',\n data : job_def,\n success : function( response ) {\n Galaxy.emit.debug( 'tool-form-composite::submit', 'Submission successful.', response );\n self.$el.children().hide();\n self.$el.append( self._templateSuccess( response ) );\n\n // Show Webhook if job is running\n if ($.isArray( response ) && response.length > 0) {\n self.$el.append( $( '
                                                        ', { id: 'webhook-view' } ) );\n var WebhookApp = new Webhooks.WebhookView({\n urlRoot: Galaxy.root + 'api/webhooks/workflow',\n toolId: job_def.tool_id,\n toolVersion: job_def.tool_version,\n });\n }\n\n self._refreshHistory();\n },\n error : function( response ) {\n Galaxy.emit.debug( 'tool-form-composite::submit', 'Submission failed.', response );\n var input_found = false;\n if ( response && response.err_data ) {\n for ( var i in self.forms ) {\n var form = self.forms[ i ];\n var step_related_errors = response.err_data[ form.model.get( 'step_index' ) ];\n if ( step_related_errors ) {\n var error_messages = form.data.matchResponse( step_related_errors );\n for ( var input_id in error_messages ) {\n form.highlight( input_id, error_messages[ input_id ] );\n input_found = true;\n break;\n }\n }\n }\n }\n if ( !input_found ) {\n self.modal.show({\n title : 'Workflow submission failed',\n body : self._templateError( job_def, response && response.err_msg ),\n buttons : {\n 'Close' : function() {\n self.modal.hide();\n }\n }\n });\n }\n },\n complete: function() {\n self._enabled( true );\n }\n });\n }\n },\n\n /** Append new dom to body */\n _append: function( $container, $el ) {\n $container.append( '

                                                        ' ).append( $el );\n },\n\n /** Set enabled/disabled state */\n _enabled: function( enabled ) {\n this.execute_btn.model.set( { wait: !enabled, wait_text: 'Sending...', percentage: -1 } );\n this.wp_form && this.wp_form.portlet[ enabled ? 'enable' : 'disable' ]();\n this.history_form && this.history_form.portlet[ enabled ? 'enable' : 'disable' ]();\n _.each( this.forms, function( form ) { form && form.portlet[ enabled ? 'enable' : 'disable' ]() } );\n },\n\n /** Is data input module/step */\n _isDataStep: function( steps ) {\n var lst = $.isArray( steps ) ? steps : [ steps ] ;\n for ( var i = 0; i < lst.length; i++ ) {\n var step = lst[ i ];\n if ( !step || !step.step_type || !step.step_type.startsWith( 'data' ) ) {\n return false;\n }\n }\n return true;\n },\n\n /** Templates */\n _templateSuccess: function( response ) {\n if ( $.isArray( response ) && response.length > 0 ) {\n return $( '

                                                        ' ).addClass( 'donemessagelarge' )\n .append( $( '

                                                        ' ).html( 'Successfully invoked workflow ' + Utils.sanitize( this.model.get( 'name' ) ) + '' + ( response.length > 1 ? ' ' + response.length + ' times' : '' ) + '.' ) )\n .append( $( '

                                                        ' ).append( '' ).text( 'You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from \\'running\\' to \\'finished\\' if completed successfully or \\'error\\' if problems were encountered.' ) );\n } else {\n return this._templateError( response, 'Invalid success response. No invocations found.' );\n }\n },\n\n _templateError: function( response, err_msg ) {\n return $( '

                                                        ' ).addClass( 'errormessagelarge' )\n .append( $( '

                                                        ' ).text( 'The server could not complete the request. Please contact the Galaxy Team if this error persists. ' + ( JSON.stringify( err_msg ) || '' ) ) )\n .append( $( '

                                                        ' ).text( JSON.stringify( response, null, 4 ) ) );\n        }\n    });\n    return {\n        View: View\n    };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/tool/tool-form-composite.js","define([\n    \"utils/localization\"\n], function( _l ){\n'use strict';\n\n//TODO: toastr is another possibility - I didn't see where I might add details, tho\n\n/* ============================================================================\nError modals meant to replace the o-so-easy alerts.\n\nThese are currently styled as errormessages but use the Galaxy.modal\ninfrastructure to be shown/closed. They're capable of showing details in a\ntogglable dropdown and the details are formatted in a pre.\n\nExample:\n    errorModal( 'Heres a message', 'A Title', { some_details: 'here' });\n    errorModal( 'Heres a message' ); // no details, title is 'Error'\n\nThere are three specialized forms:\n    offlineErrorModal       a canned response for when there's no connection\n    badGatewayErrorModal    canned response for when Galaxy is restarting\n    ajaxErrorModal          plugable into any Backbone class as an\n        error event handler by accepting the error args: model, xhr, options\n\nExamples:\n    if( navigator.offLine ){ offlineErrorModal(); }\n    if( xhr.status === 502 ){ badGatewayErrorModal(); }\n    this.listenTo( this.model, 'error', ajaxErrorModal );\n\n============================================================================ */\n\nvar CONTACT_MSG = _l( 'Please contact a Galaxy administrator if the problem persists.' );\nvar DEFAULT_AJAX_ERR_MSG = _l( 'An error occurred while updating information with the server.' );\nvar DETAILS_MSG = _l( 'The following information can assist the developers in finding the source of the error:' );\n\n/** private helper that builds the modal and handles adding details */\nfunction _errorModal( message, title, details ){\n    // create and return the modal, adding details button only if needed\n    Galaxy.modal.show({\n        title           : title,\n        body            : message,\n        closing_events  : true,\n        buttons         : { Ok: function(){ Galaxy.modal.hide(); } },\n    });\n    Galaxy.modal.$el.addClass( 'error-modal' );\n\n    if( details ){\n        Galaxy.modal.$( '.error-details' ).add( Galaxy.modal.$( 'button:contains(\"Details\")' ) ).remove();\n        $( '
                                                        ' ).addClass( 'error-details' )\n .hide().appendTo( Galaxy.modal.$( '.modal-content' ) )\n .append([\n $( '

                                                        ' ).text( DETAILS_MSG ),\n $( '

                                                        ' ).text( JSON.stringify( details, null, '  ' ) )\n            ]);\n\n        $( '' )\n            .appendTo( Galaxy.modal.$( '.buttons' ) )\n            .click( function(){ Galaxy.modal.$( '.error-details' ).toggle(); });\n    }\n    return Galaxy.modal;\n}\n\n/** Display a modal showing an error message but fallback to alert if there's no modal */\nfunction errorModal( message, title, details ){\n    if( !message ){ return; }\n\n    message = _l( message );\n    title = _l( title ) || _l( 'Error:' );\n    if( window.Galaxy && Galaxy.modal ){\n        return _errorModal( message, title, details );\n    }\n\n    alert( title + '\\n\\n' + message );\n    console.log( 'error details:', JSON.stringify( details ) );\n}\n\n\n// ----------------------------------------------------------------------------\n/** display a modal when the user may be offline */\nfunction offlineErrorModal(){\n    return errorModal(\n        _l( 'You appear to be offline. Please check your connection and try again.' ),\n        _l( 'Offline?' )\n    );\n}\n\n\n// ----------------------------------------------------------------------------\n/** 502 messages that should be displayed when galaxy is restarting */\nfunction badGatewayErrorModal(){\n    return errorModal(\n        _l( 'Galaxy is currently unreachable. Please try again in a few minutes.' ) + ' ' + CONTACT_MSG,\n        _l( 'Cannot connect to Galaxy' )\n    );\n}\n\n\n// ----------------------------------------------------------------------------\n/** display a modal (with details) about a failed Backbone ajax operation */\nfunction ajaxErrorModal( model, xhr, options, message, title ){\n    message = message || DEFAULT_AJAX_ERR_MSG;\n    message += ' ' + CONTACT_MSG;\n    title = title || _l( 'An error occurred' );\n    var details = _ajaxDetails( model, xhr, options );\n    return errorModal( message, title, details );\n}\n\n/** build details which may help debugging the ajax call */\nfunction _ajaxDetails( model, xhr, options ){\n    return {\n//TODO: still can't manage Raven id\n        raven       : _.result( window.Raven, 'lastEventId' ),\n        userAgent   : navigator.userAgent,\n        onLine      : navigator.onLine,\n        version     : _.result( Galaxy.config, 'version_major' ),\n        xhr         : _.omit( xhr, _.functions( xhr ) ),\n        options     : _.omit( options, 'xhr' ),\n        // add ajax data from Galaxy object cache\n        url         : _.result( Galaxy.lastAjax, 'url' ),\n        data        : _.result( Galaxy.lastAjax, 'data' ),\n        // backbone stuff (auto-redacting email for user)\n        model       : _.result( model, 'toJSON' , model + '' ),\n        user        : _.omit( _.result( Galaxy.user, 'toJSON' ), 'email' ),\n    };\n}\n\n\n//=============================================================================\n    return {\n        errorModal          : errorModal,\n        offlineErrorModal   : offlineErrorModal,\n        badGatewayErrorModal: badGatewayErrorModal,\n        ajaxErrorModal      : ajaxErrorModal\n    };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/ui/error-modal.js","(function (factory) {\n    if (typeof define === 'function' && define.amd) {\n        define([], factory);\n    } else {\n        // Browser globals\n        factory(jQuery);\n    }\n\n}(function () {\n//=============================================================================\n\n    jQuery.fn.extend({\n        hoverhighlight : function $hoverhighlight( scope, color ){\n            scope = scope || 'body';\n            if( !this.length ){ return this; }\n\n            $( this ).each( function(){\n                var $this = $( this ),\n                    targetSelector = $this.data( 'target' );\n\n                if( targetSelector ){\n                    $this.mouseover( function( ev ){\n                        $( targetSelector, scope ).css({\n                            background: color\n                        });\n                    })\n                    .mouseout( function( ev ){\n                        $( targetSelector ).css({\n                            background: ''\n                        });\n                    });\n                }\n            });\n            return this;\n        }\n    });\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/ui/hoverhighlight.js","// from: https://raw.githubusercontent.com/umdjs/umd/master/jqueryPlugin.js\n// Uses AMD or browser globals to create a jQuery plugin.\n(function (factory) {\n    if (typeof define === 'function' && define.amd) {\n        //TODO: So...this turns out to be an all or nothing thing. If I load jQuery in the define below, it will\n        //  (of course) wipe the old jquery *and all the plugins loaded into it*. So the define below *is still\n        //  relying on jquery being loaded globally* in order to preserve plugins.\n        define([], factory);\n    } else {\n        // Browser globals\n        factory(jQuery);\n    }\n\n}(function () {\n    var _l = window._l || function( s ){ return s; };\n\n    //TODO: consolidate with tool menu functionality, use there\n\n    /** searchInput: (jQuery plugin)\n     *      Creates a search input, a clear button, and loading indicator\n     *      within the selected node.\n     *\n     *      When the user either presses return or enters some minimal number\n     *      of characters, a callback is called. Pressing ESC when the input\n     *      is focused will clear the input and call a separate callback.\n     */\n    function searchInput( parentNode, options ){\n        var KEYCODE_ESC     = 27,\n            KEYCODE_RETURN  = 13,\n            $parentNode     = $( parentNode ),\n            firstSearch     = true,\n            defaults = {\n                initialVal      : '',\n                name            : 'search',\n                placeholder     : 'search',\n                classes         : '',\n                onclear         : function(){},\n                onfirstsearch   : null,\n                onsearch        : function( inputVal ){},\n                minSearchLen    : 0,\n                escWillClear    : true,\n                oninit          : function(){}\n            };\n\n        // .................................................................... input rendering and events\n        // visually clear the search, trigger an event, and call the callback\n        function clearSearchInput( event ){\n            var $input = $( this ).parent().children( 'input' );\n            $input.val( '' ).trigger( 'searchInput.clear' ).blur();\n            options.onclear();\n        }\n\n        // search for searchTerms, trigger an event, call the appropo callback (based on whether this is the first)\n        function search( event, searchTerms ){\n            if( !searchTerms ){\n                return clearSearchInput();\n            }\n            $( this ).trigger( 'search.search', searchTerms );\n            if( typeof options.onfirstsearch === 'function' && firstSearch ){\n                firstSearch = false;\n                options.onfirstsearch( searchTerms );\n            } else {\n                options.onsearch( searchTerms );\n            }\n        }\n\n        // .................................................................... input rendering and events\n        function inputTemplate(){\n            // class search-query is bootstrap 2.3 style that now lives in base.less\n            return [ '' ].join( '' );\n        }\n\n        // the search input that responds to keyboard events and displays the search value\n        function $input(){\n            return $( inputTemplate() )\n                // select all text on a focus\n                .focus( function( event ){\n                    $( this ).select();\n                })\n                // attach behaviors to esc, return if desired, search on some min len string\n                .keyup( function( event ){\n                    event.preventDefault();\n                    event.stopPropagation();\n\n                    // esc key will clear if desired\n                    if( event.which === KEYCODE_ESC && options.escWillClear ){\n                        clearSearchInput.call( this, event );\n\n                    } else {\n                        var searchTerms = $( this ).val();\n                        // return key or the search string len > minSearchLen (if not 0) triggers search\n                        if( ( event.which === KEYCODE_RETURN )\n                        ||  ( options.minSearchLen && searchTerms.length >= options.minSearchLen ) ){\n                            search.call( this, event, searchTerms );\n                        }\n                    }\n                })\n                .val( options.initialVal );\n        }\n\n        // .................................................................... clear button rendering and events\n        // a button for clearing the search bar, placed on the right hand side\n        function $clearBtn(){\n            return $([ '' ].join('') )\n            .tooltip({ placement: 'bottom' })\n            .click( function( event ){\n                clearSearchInput.call( this, event );\n            });\n        }\n\n        // .................................................................... loadingIndicator rendering\n        // a button for clearing the search bar, placed on the right hand side\n        function $loadingIndicator(){\n            return $([ '' ].join('') )\n                .hide().tooltip({ placement: 'bottom' });\n        }\n\n        // .................................................................... commands\n        // visually swap the load, clear buttons\n        function toggleLoadingIndicator(){\n            $parentNode.find( '.search-loading' ).toggle();\n            $parentNode.find( '.search-clear' ).toggle();\n        }\n\n        // .................................................................... init\n        // string command (not constructor)\n        if( jQuery.type( options ) === 'string' ){\n            if( options === 'toggle-loading' ){\n                toggleLoadingIndicator();\n            }\n            return $parentNode;\n        }\n\n        // initial render\n        if( jQuery.type( options ) === 'object' ){\n            options = jQuery.extend( true, {}, defaults, options );\n        }\n        //NOTE: prepended\n        return $parentNode.addClass( 'search-input' ).prepend([ $input(), $clearBtn(), $loadingIndicator() ]);\n    }\n\n    // as jq plugin\n    jQuery.fn.extend({\n        searchInput : function $searchInput( options ){\n            return this.each( function(){\n                return searchInput( this, options );\n            });\n        }\n    });\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/ui/search-input.js","define([], function(){\n// Alphanumeric/natural sort fn\nfunction naturalSort(a, b) {\n    // setup temp-scope variables for comparison evauluation\n    var re = /(-?[0-9\\.]+)/g,\n        x = a.toString().toLowerCase() || '',\n        y = b.toString().toLowerCase() || '',\n        nC = String.fromCharCode(0),\n        xN = x.replace( re, nC + '$1' + nC ).split(nC),\n        yN = y.replace( re, nC + '$1' + nC ).split(nC),\n        xD = (new Date(x)).getTime(),\n        yD = xD ? (new Date(y)).getTime() : null;\n    // natural sorting of dates\n    if ( yD ) {\n        if ( xD < yD ) { return -1; }\n        else if ( xD > yD ) { return 1; }\n    }\n    // natural sorting through split numeric strings and default strings\n    var oFxNcL, oFyNcL;\n    for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {\n        oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];\n        oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];\n        if (oFxNcL < oFyNcL) { return -1; }\n        else if (oFxNcL > oFyNcL) { return 1; }\n    }\n    return 0;\n}\n\nreturn naturalSort;\n})\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/utils/natural-sort.js","var Ui = require( 'mvc/ui/ui-misc' ),\n    historyOptionsMenu = require( 'mvc/history/options-menu' );\n    CurrentHistoryView = require( 'mvc/history/history-view-edit-current' ).CurrentHistoryView,\n    _l = require( 'utils/localization' );\n\n/** the right hand panel in the analysis page that shows the current history */\nvar HistoryPanel = Backbone.View.extend({\n\n    initialize : function( page, options ) {\n        var self = this;\n        this.userIsAnonymous            = Galaxy.user.isAnonymous();\n        this.allow_user_dataset_purge   = options.config.allow_user_dataset_purge;\n        this.root                       = options.root;\n\n        // view of the current history\n        this.historyView = new CurrentHistoryView({\n            className       : CurrentHistoryView.prototype.className + ' middle',\n            purgeAllowed    : this.allow_user_dataset_purge,\n            linkTarget      : 'galaxy_main'\n        });\n\n        // add history panel to Galaxy object\n        Galaxy.currHistoryPanel = this.historyView;\n        Galaxy.currHistoryPanel.listenToGalaxy( Galaxy );\n\n        // build buttons\n        this.buttonRefresh = new Ui.ButtonLink({\n            id      : 'history-refresh-button',\n            title   : 'Refresh history',\n            cls     : 'panel-header-button',\n            icon    : 'fa fa-refresh',\n            onclick : function() {\n                self.historyView.loadCurrentHistory();\n            }\n        });\n        this.buttonOptions = new Ui.ButtonLink({\n            id      : 'history-options-button',\n            title   : 'History options',\n            cls     : 'panel-header-button',\n            target  : 'galaxy_main',\n            icon    : 'fa fa-cog',\n            href    : this.root + 'root/history_options'\n        });\n        this.buttonViewMulti = new Ui.ButtonLink({\n            id      : 'history-view-multi-button',\n            title   : 'View all histories',\n            cls     : 'panel-header-button',\n            icon    : 'fa fa-columns',\n            href    : this.root + 'history/view_multiple'\n        });\n\n        // define components\n        this.model = new Backbone.Model({\n            cls     : 'history-right-panel',\n            title   : _l( 'History' ),\n            buttons : [ this.buttonRefresh, this.buttonOptions, this.buttonViewMulti ]\n        });\n\n        // build body template and connect history view\n        this.setElement( this._template() );\n        this.historyView.setElement( this.$el );\n        this.historyView.connectToQuotaMeter( Galaxy.quotaMeter );\n        this.historyView.loadCurrentHistory();\n\n        // fetch to update the quota meter adding 'current' for any anon-user's id\n        Galaxy.listenTo( this.historyView, 'history-size-change', function(){\n            Galaxy.user.fetch({ url: Galaxy.user.urlRoot() + '/' + ( Galaxy.user.id || 'current' ) });\n        });\n    },\n\n    render : function() {\n        this.optionsMenu = historyOptionsMenu( this.buttonOptions.$el, {\n            anonymous    : this.userIsAnonymous,\n            purgeAllowed : this.allow_user_dataset_purge,\n            root         : this.root\n        });\n        this.buttonViewMulti.$el[ !this.userIsAnonymous ? 'show' : 'hide' ]();\n    },\n\n    /** add history view div */\n    _template : function( data ){\n        return [\n            '
                                                        ',\n ].join('');\n },\n\n toString : function() { return 'historyPanel' }\n});\n\nmodule.exports = HistoryPanel;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/panels/history-panel.js","var Tools = require( 'mvc/tool/tools' ),\n Upload = require( 'mvc/upload/upload-view' ),\n _l = require( 'utils/localization' ),\n ToolForm = require( 'mvc/tool/tool-form-composite' );\n\nvar ToolPanel = Backbone.View.extend({\n initialize: function( page, options ) {\n // access configuration options\n var config = options.config;\n this.root = options.root;\n\n /** @type {Object[]} descriptions of user's workflows to be shown in the tool menu */\n this.stored_workflow_menu_entries = config.stored_workflow_menu_entries || [];\n\n // create tool search, tool panel, and tool panel view.\n var tool_search = new Tools.ToolSearch({\n hidden : false\n });\n var tools = new Tools.ToolCollection( config.toolbox );\n this.tool_panel = new Tools.ToolPanel({\n tool_search : tool_search,\n tools : tools,\n layout : config.toolbox_in_panel\n });\n this.tool_panel_view = new Tools.ToolPanelView({ model: this.tool_panel });\n\n // add upload modal\n this.upload_button = new Upload({\n nginx_upload_path : config.nginx_upload_path,\n ftp_upload_site : config.ftp_upload_site,\n default_genome : config.default_genome,\n default_extension : config.default_extension,\n });\n\n // add uploader button to Galaxy object\n Galaxy.upload = this.upload_button;\n\n // components for panel definition\n this.model = new Backbone.Model({\n title : _l( 'Tools' ),\n buttons : [ this.upload_button ]\n });\n\n // build body template\n this.setElement( this._template() );\n },\n\n render : function(){\n // if there are tools, render panel and display everything\n var self = this;\n if ( this.tool_panel.get( 'layout' ).size() > 0 ) {\n this.$el.prepend( this.tool_panel_view.$el );\n this.tool_panel_view.render();\n }\n // build the dom for the workflow portion of the tool menu\n // add internal workflow list\n self.$( '#internal-workflows' ).append( self._templateAllWorkflow({\n title : _l( 'All workflows' ),\n href : 'workflow'\n }));\n _.each( this.stored_workflow_menu_entries, function( menu_entry ){\n self.$( '#internal-workflows' ).append( self._templateWorkflowLink({\n title : menu_entry.stored_workflow.name,\n href : 'workflow/run?id=' + menu_entry.encoded_stored_workflow_id\n }));\n });\n },\n\n /** build a link to one tool */\n _templateTool: function( tool ) {\n return [\n '
                                                        ',\n '', tool.title, '',\n '
                                                        '\n ].join('');\n },\n\n /** build a link to 'All Workflows' */\n _templateAllWorkflow: function( tool ) {\n return [\n '
                                                        ',\n // global\n '', tool.title, '',\n '
                                                        '\n ].join('');\n },\n\n /** build links to workflows in toolpanel */\n _templateWorkflowLink: function( wf ) {\n return [\n '
                                                        ',\n '', wf.title, '',\n '
                                                        '\n ].join('');\n },\n\n /** override to include inital menu dom and workflow section */\n _template : function() {\n return [\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '', _l( 'Search did not match any tools.' ), '',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '', _l( 'Workflows' ), '',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        '\n ].join('');\n },\n\n toString : function() { return 'toolPanel' }\n});\n\nmodule.exports = ToolPanel;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/panels/tool-panel.js","/*\n * Toastr\n * Version 2.0.1\n * Copyright 2012 John Papa and Hans Fjällemark. \n * All Rights Reserved. \n * Use, reproduction, distribution, and modification of this code is subject to the terms and \n * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php\n *\n * Author: John Papa and Hans Fjällemark\n * Project: https://github.com/CodeSeven/toastr\n */\n; (function (define) {\n\tdefine([], function () {\n\t\tvar $ = jQuery;\n\t\treturn (function () {\n\t\t\tvar version = '2.0.1';\n\t\t\tvar $container;\n\t\t\tvar listener;\n\t\t\tvar toastId = 0;\n\t\t\tvar toastType = {\n\t\t\t\terror: 'error',\n\t\t\t\tinfo: 'info',\n\t\t\t\tsuccess: 'success',\n\t\t\t\twarning: 'warning'\n\t\t\t};\n\n\t\t\tvar toastr = {\n\t\t\t\tclear: clear,\n\t\t\t\terror: error,\n\t\t\t\tgetContainer: getContainer,\n\t\t\t\tinfo: info,\n\t\t\t\toptions: {},\n\t\t\t\tsubscribe: subscribe,\n\t\t\t\tsuccess: success,\n\t\t\t\tversion: version,\n\t\t\t\twarning: warning\n\t\t\t};\n\n\t\t\treturn toastr;\n\n\t\t\t//#region Accessible Methods\n\t\t\tfunction error(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.error,\n\t\t\t\t\ticonClass: getOptions().iconClasses.error,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction info(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.info,\n\t\t\t\t\ticonClass: getOptions().iconClasses.info,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction subscribe(callback) {\n\t\t\t\tlistener = callback;\n\t\t\t}\n\n\t\t\tfunction success(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.success,\n\t\t\t\t\ticonClass: getOptions().iconClasses.success,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction warning(message, title, optionsOverride) {\n\t\t\t\treturn notify({\n\t\t\t\t\ttype: toastType.warning,\n\t\t\t\t\ticonClass: getOptions().iconClasses.warning,\n\t\t\t\t\tmessage: message,\n\t\t\t\t\toptionsOverride: optionsOverride,\n\t\t\t\t\ttitle: title\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction clear($toastElement) {\n\t\t\t\tvar options = getOptions();\n\t\t\t\tif (!$container) { getContainer(options); }\n\t\t\t\tif ($toastElement && $(':focus', $toastElement).length === 0) {\n\t\t\t\t\t$toastElement[options.hideMethod]({\n\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\tcomplete: function () { removeToast($toastElement); }\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ($container.children().length) {\n\t\t\t\t\t$container[options.hideMethod]({\n\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\tcomplete: function () { $container.remove(); }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\t//#endregion\n\n\t\t\t//#region Internal Methods\n\n\t\t\tfunction getDefaults() {\n\t\t\t\treturn {\n\t\t\t\t\ttapToDismiss: true,\n\t\t\t\t\ttoastClass: 'toast',\n\t\t\t\t\tcontainerId: 'toast-container',\n\t\t\t\t\tdebug: false,\n\n\t\t\t\t\tshowMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery\n\t\t\t\t\tshowDuration: 300,\n\t\t\t\t\tshowEasing: 'swing', //swing and linear are built into jQuery\n\t\t\t\t\tonShown: undefined,\n\t\t\t\t\thideMethod: 'fadeOut',\n\t\t\t\t\thideDuration: 1000,\n\t\t\t\t\thideEasing: 'swing',\n\t\t\t\t\tonHidden: undefined,\n\n\t\t\t\t\textendedTimeOut: 1000,\n\t\t\t\t\ticonClasses: {\n\t\t\t\t\t\terror: 'toast-error',\n\t\t\t\t\t\tinfo: 'toast-info',\n\t\t\t\t\t\tsuccess: 'toast-success',\n\t\t\t\t\t\twarning: 'toast-warning'\n\t\t\t\t\t},\n\t\t\t\t\ticonClass: 'toast-info',\n\t\t\t\t\tpositionClass: 'toast-top-right',\n\t\t\t\t\ttimeOut: 5000, // Set timeOut and extendedTimeout to 0 to make it sticky\n\t\t\t\t\ttitleClass: 'toast-title',\n\t\t\t\t\tmessageClass: 'toast-message',\n\t\t\t\t\ttarget: 'body',\n\t\t\t\t\tcloseHtml: '',\n\t\t\t\t\tnewestOnTop: true\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfunction publish(args) {\n\t\t\t\tif (!listener) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlistener(args);\n\t\t\t}\n\n\t\t\tfunction notify(map) {\n\t\t\t\tvar\n\t\t\t\t\toptions = getOptions(),\n\t\t\t\t\ticonClass = map.iconClass || options.iconClass;\n\n\t\t\t\tif (typeof (map.optionsOverride) !== 'undefined') {\n\t\t\t\t\toptions = $.extend(options, map.optionsOverride);\n\t\t\t\t\ticonClass = map.optionsOverride.iconClass || iconClass;\n\t\t\t\t}\n\n\t\t\t\ttoastId++;\n\n\t\t\t\t$container = getContainer(options);\n\t\t\t\tvar\n\t\t\t\t\tintervalId = null,\n\t\t\t\t\t$toastElement = $('
                                                        '),\n\t\t\t\t\t$titleElement = $('
                                                        '),\n\t\t\t\t\t$messageElement = $('
                                                        '),\n\t\t\t\t\t$closeElement = $(options.closeHtml),\n\t\t\t\t\tresponse = {\n\t\t\t\t\t\ttoastId: toastId,\n\t\t\t\t\t\tstate: 'visible',\n\t\t\t\t\t\tstartTime: new Date(),\n\t\t\t\t\t\toptions: options,\n\t\t\t\t\t\tmap: map\n\t\t\t\t\t};\n\n\t\t\t\tif (map.iconClass) {\n\t\t\t\t\t$toastElement.addClass(options.toastClass).addClass(iconClass);\n\t\t\t\t}\n\n\t\t\t\tif (map.title) {\n\t\t\t\t\t$titleElement.append(map.title).addClass(options.titleClass);\n\t\t\t\t\t$toastElement.append($titleElement);\n\t\t\t\t}\n\n\t\t\t\tif (map.message) {\n\t\t\t\t\t$messageElement.append(map.message).addClass(options.messageClass);\n\t\t\t\t\t$toastElement.append($messageElement);\n\t\t\t\t}\n\n\t\t\t\tif (options.closeButton) {\n\t\t\t\t\t$closeElement.addClass('toast-close-button');\n\t\t\t\t\t$toastElement.prepend($closeElement);\n\t\t\t\t}\n\n\t\t\t\t$toastElement.hide();\n\t\t\t\tif (options.newestOnTop) {\n\t\t\t\t\t$container.prepend($toastElement);\n\t\t\t\t} else {\n\t\t\t\t\t$container.append($toastElement);\n\t\t\t\t}\n\n\n\t\t\t\t$toastElement[options.showMethod](\n\t\t\t\t\t{ duration: options.showDuration, easing: options.showEasing, complete: options.onShown }\n\t\t\t\t);\n\t\t\t\tif (options.timeOut > 0) {\n\t\t\t\t\tintervalId = setTimeout(hideToast, options.timeOut);\n\t\t\t\t}\n\n\t\t\t\t$toastElement.hover(stickAround, delayedhideToast);\n\t\t\t\tif (!options.onclick && options.tapToDismiss) {\n\t\t\t\t\t$toastElement.click(hideToast);\n\t\t\t\t}\n\t\t\t\tif (options.closeButton && $closeElement) {\n\t\t\t\t\t$closeElement.click(function (event) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\thideToast(true);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (options.onclick) {\n\t\t\t\t\t$toastElement.click(function () {\n\t\t\t\t\t\toptions.onclick();\n\t\t\t\t\t\thideToast();\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tpublish(response);\n\n\t\t\t\tif (options.debug && console) {\n\t\t\t\t\tconsole.log(response);\n\t\t\t\t}\n\n\t\t\t\treturn $toastElement;\n\n\t\t\t\tfunction hideToast(override) {\n\t\t\t\t\tif ($(':focus', $toastElement).length && !override) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\treturn $toastElement[options.hideMethod]({\n\t\t\t\t\t\tduration: options.hideDuration,\n\t\t\t\t\t\teasing: options.hideEasing,\n\t\t\t\t\t\tcomplete: function () {\n\t\t\t\t\t\t\tremoveToast($toastElement);\n\t\t\t\t\t\t\tif (options.onHidden) {\n\t\t\t\t\t\t\t\toptions.onHidden();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresponse.state = 'hidden';\n\t\t\t\t\t\t\tresponse.endTime = new Date(),\n\t\t\t\t\t\t\tpublish(response);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfunction delayedhideToast() {\n\t\t\t\t\tif (options.timeOut > 0 || options.extendedTimeOut > 0) {\n\t\t\t\t\t\tintervalId = setTimeout(hideToast, options.extendedTimeOut);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction stickAround() {\n\t\t\t\t\tclearTimeout(intervalId);\n\t\t\t\t\t$toastElement.stop(true, true)[options.showMethod](\n\t\t\t\t\t\t{ duration: options.showDuration, easing: options.showEasing }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfunction getContainer(options) {\n\t\t\t\tif (!options) { options = getOptions(); }\n\t\t\t\t$container = $('#' + options.containerId);\n\t\t\t\tif ($container.length) {\n\t\t\t\t\treturn $container;\n\t\t\t\t}\n\t\t\t\t$container = $('
                                                        ')\n\t\t\t\t\t.attr('id', options.containerId)\n\t\t\t\t\t.addClass(options.positionClass);\n\t\t\t\t$container.appendTo($(options.target));\n\t\t\t\treturn $container;\n\t\t\t}\n\n\t\t\tfunction getOptions() {\n\t\t\t\treturn $.extend({}, getDefaults(), toastr.options);\n\t\t\t}\n\n\t\t\tfunction removeToast($toastElement) {\n\t\t\t\tif (!$container) { $container = getContainer(); }\n\t\t\t\tif ($toastElement.is(':visible')) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$toastElement.remove();\n\t\t\t\t$toastElement = null;\n\t\t\t\tif ($container.children().length === 0) {\n\t\t\t\t\t$container.remove();\n\t\t\t\t}\n\t\t\t}\n\t\t\t//#endregion\n\n\t\t})();\n\t});\n}(typeof define === 'function' && define.amd ? define : function (deps, factory) {\n\tif (typeof module !== 'undefined' && module.exports) { //Node\n\t\tmodule.exports = factory(require(deps[0]));\n\t} else {\n\t\twindow['toastr'] = factory(window['jQuery']);\n\t}\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/libs/toastr.js","define([\n \"mvc/collection/collection-li\",\n \"mvc/dataset/dataset-li-edit\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( DC_LI, DATASET_LI_EDIT, BASE_MVC, _l ){\n\n'use strict';\n//==============================================================================\nvar DCListItemView = DC_LI.DCListItemView;\n/** @class Edit view for DatasetCollection.\n */\nvar DCListItemEdit = DCListItemView.extend(\n/** @lends DCListItemEdit.prototype */{\n\n /** override to add linkTarget */\n initialize : function( attributes ){\n DCListItemView.prototype.initialize.call( this, attributes );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCListItemEdit(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\nvar DCEListItemView = DC_LI.DCEListItemView;\n/** @class Read only view for DatasetCollectionElement.\n */\nvar DCEListItemEdit = DCEListItemView.extend(\n/** @lends DCEListItemEdit.prototype */{\n//TODO: this might be expendable - compacted with HDAListItemView\n\n /** set up */\n initialize : function( attributes ){\n DCEListItemView.prototype.initialize.call( this, attributes );\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DCEListItemEdit(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\n// NOTE: this does not inherit from DatasetDCEListItemView as you would expect\n//TODO: but should - if we can find something simpler than using diamond\n/** @class Editable view for a DatasetCollectionElement that is also an DatasetAssociation\n * (a dataset contained in a dataset collection).\n */\nvar DatasetDCEListItemEdit = DATASET_LI_EDIT.DatasetListItemEdit.extend(\n/** @lends DatasetDCEListItemEdit.prototype */{\n\n /** set up */\n initialize : function( attributes ){\n DATASET_LI_EDIT.DatasetListItemEdit.prototype.initialize.call( this, attributes );\n },\n\n // NOTE: this does not inherit from DatasetDCEListItemView - so we duplicate this here\n //TODO: fix\n /** In this override, only get details if in the ready state.\n * Note: fetch with no 'change' event triggering to prevent automatic rendering.\n */\n _fetchModelDetails : function(){\n var view = this;\n if( view.model.inReadyState() && !view.model.hasDetails() ){\n return view.model.fetch({ silent: true });\n }\n return jQuery.when();\n },\n\n /** Override to remove delete button */\n _renderDeleteButton : function(){\n return null;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'DatasetDCEListItemEdit(' + modelString + ')';\n }\n});\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nDatasetDCEListItemEdit.prototype.templates = (function(){\n\n return _.extend( {}, DATASET_LI_EDIT.DatasetListItemEdit.prototype.templates, {\n titleBar : DC_LI.DatasetDCEListItemView.prototype.templates.titleBar\n });\n}());\n\n\n//==============================================================================\n/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n * (a nested DC).\n */\nvar NestedDCDCEListItemEdit = DC_LI.NestedDCDCEListItemView.extend(\n/** @lends NestedDCDCEListItemEdit.prototype */{\n\n /** String representation */\n toString : function(){\n var modelString = ( this.model )?( this.model + '' ):( '(no model)' );\n return 'NestedDCDCEListItemEdit(' + modelString + ')';\n }\n});\n\n\n//==============================================================================\n return {\n DCListItemEdit : DCListItemEdit,\n DCEListItemEdit : DCEListItemEdit,\n DatasetDCEListItemEdit : DatasetDCEListItemEdit,\n NestedDCDCEListItemEdit : NestedDCDCEListItemEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-li-edit.js","define([\n \"mvc/collection/collection-view\",\n \"mvc/collection/collection-model\",\n \"mvc/collection/collection-li-edit\",\n \"mvc/base-mvc\",\n \"mvc/tag\",\n \"ui/fa-icon-button\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function( DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, TAGS, faIconButton, _l ){\n\n'use strict';\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class editable View/Controller for a dataset collection.\n */\nvar _super = DC_VIEW.CollectionView;\nvar CollectionViewEdit = _super.extend(\n/** @lends CollectionView.prototype */{\n //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n\n /** logger used to record this.log messages, commonly set to console */\n //logger : console,\n\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_EDIT.DatasetDCEListItemEdit,\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_EDIT.NestedDCDCEListItemEdit,\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the panel\n */\n initialize : function( attributes ){\n _super.prototype.initialize.call( this, attributes );\n },\n\n /** In this override, make the collection name editable\n */\n _setUpBehaviors : function( $where ){\n $where = $where || this.$el;\n _super.prototype._setUpBehaviors.call( this, $where );\n if( !this.model ){ return; }\n\n // anon users shouldn't have access to any of the following\n if( !Galaxy.user || Galaxy.user.isAnonymous() ){\n return;\n }\n\n this.tagsEditorShown = true;\n\n //TODO: extract\n var panel = this,\n nameSelector = '> .controls .name';\n $where.find( nameSelector )\n .attr( 'title', _l( 'Click to rename collection' ) )\n .tooltip({ placement: 'bottom' })\n .make_text_editable({\n on_finish: function( newName ){\n var previousName = panel.model.get( 'name' );\n if( newName && newName !== previousName ){\n panel.$el.find( nameSelector ).text( newName );\n panel.model.save({ name: newName })\n .fail( function(){\n panel.$el.find( nameSelector ).text( panel.model.previous( 'name' ) );\n });\n } else {\n panel.$el.find( nameSelector ).text( previousName );\n }\n }\n });\n this.tagsEditor = new TAGS.TagsEditor({\n model : this.model,\n el : $where.find( '.tags-display' ),\n onshowFirstTime : function(){ this.render(); },\n usePrompt : false\n });\n this.tagsEditor.toggle( true );\n },\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'CollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListCollectionViewEdit = CollectionViewEdit.extend(\n/** @lends ListCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for datasets */\n DatasetDCEViewClass : DC_EDIT.DatasetDCEListItemEdit,\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class Editable, read-only View/Controller for a dataset collection. */\nvar PairCollectionViewEdit = ListCollectionViewEdit.extend(\n/** @lends PairCollectionViewEdit.prototype */{\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'PairCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class Editable (roughly since these collections are immutable),\n * View/Controller for a dataset collection.\n */\nvar NestedPairCollectionViewEdit = PairCollectionViewEdit.extend(\n/** @lends NestedPairCollectionViewEdit.prototype */{\n\n /** Override to remove the editable text from the name/identifier - these collections are considered immutable */\n _setUpBehaviors : function( $where ){\n _super.prototype._setUpBehaviors.call( this, $where );\n },\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'NestedPairCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class editable, View/Controller for a list of pairs dataset collection. */\nvar ListOfPairsCollectionViewEdit = CollectionViewEdit.extend(\n/** @lends ListOfPairsCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_EDIT.NestedDCDCEListItemEdit.extend({\n foldoutPanelClass : NestedPairCollectionViewEdit\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListOfPairsCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n// =============================================================================\n/** @class View/Controller for a list of lists dataset collection. */\nvar ListOfListsCollectionViewEdit = CollectionViewEdit.extend(\n/** @lends ListOfListsCollectionView.prototype */{\n\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass : DC_EDIT.NestedDCDCEListItemEdit.extend({\n foldoutPanelClass : NestedPairCollectionViewEdit\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString : function(){\n return 'ListOfListsCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';\n }\n});\n\n\n//==============================================================================\n return {\n CollectionViewEdit : CollectionViewEdit,\n ListCollectionViewEdit : ListCollectionViewEdit,\n PairCollectionViewEdit : PairCollectionViewEdit,\n ListOfPairsCollectionViewEdit : ListOfPairsCollectionViewEdit,\n ListOfListsCollectionViewEdit : ListOfListsCollectionViewEdit\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/collection-view-edit.js","define([\n \"utils/levenshtein\",\n \"utils/natural-sort\",\n \"mvc/collection/base-creator\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( levenshteinDistance, naturalSort, baseCreator, baseMVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/* ============================================================================\nTODO:\n\n\nPROGRAMMATICALLY:\ncurrPanel.once( 'rendered', function(){\n currPanel.showSelectors();\n currPanel.selectAll();\n _.last( currPanel.actionsPopup.options ).func();\n});\n\n============================================================================ */\n/** A view for paired datasets in the collections creator.\n */\nvar PairView = Backbone.View.extend( baseMVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n tagName : 'li',\n className : 'dataset paired',\n\n initialize : function( attributes ){\n this.pair = attributes.pair || {};\n },\n\n template : _.template([\n '<%- pair.forward.name %>',\n '',\n '<%- pair.name %>',\n '',\n '<%- pair.reverse.name %>'\n ].join('')),\n\n render : function(){\n this.$el\n .attr( 'draggable', true )\n .data( 'pair', this.pair )\n .html( this.template({ pair: this.pair }) )\n .addClass( 'flex-column-container' );\n return this;\n },\n\n events : {\n 'dragstart' : '_dragstart',\n 'dragend' : '_dragend',\n 'dragover' : '_sendToParent',\n 'drop' : '_sendToParent'\n },\n\n /** dragging pairs for re-ordering */\n _dragstart : function( ev ){\n ev.currentTarget.style.opacity = '0.4';\n if( ev.originalEvent ){ ev = ev.originalEvent; }\n\n ev.dataTransfer.effectAllowed = 'move';\n ev.dataTransfer.setData( 'text/plain', JSON.stringify( this.pair ) );\n\n this.$el.parent().trigger( 'pair.dragstart', [ this ] );\n },\n\n /** dragging pairs for re-ordering */\n _dragend : function( ev ){\n ev.currentTarget.style.opacity = '1.0';\n this.$el.parent().trigger( 'pair.dragend', [ this ] );\n },\n\n /** manually bubble up an event to the parent/container */\n _sendToParent : function( ev ){\n this.$el.parent().trigger( ev );\n },\n\n /** string rep */\n toString : function(){\n return 'PairView(' + this.pair.name + ')';\n }\n});\n\n\n// ============================================================================\n/** returns an autopair function that uses the provided options.match function */\nfunction autoPairFnBuilder( options ){\n options = options || {};\n options.createPair = options.createPair || function _defaultCreatePair( params ){\n params = params || {};\n var a = params.listA.splice( params.indexA, 1 )[0],\n b = params.listB.splice( params.indexB, 1 )[0],\n aInBIndex = params.listB.indexOf( a ),\n bInAIndex = params.listA.indexOf( b );\n if( aInBIndex !== -1 ){ params.listB.splice( aInBIndex, 1 ); }\n if( bInAIndex !== -1 ){ params.listA.splice( bInAIndex, 1 ); }\n return this._pair( a, b, { silent: true });\n };\n // compile these here outside of the loop\n var _regexps = [];\n function getRegExps(){\n if( !_regexps.length ){\n _regexps = [\n new RegExp( this.filters[0] ),\n new RegExp( this.filters[1] )\n ];\n }\n return _regexps;\n }\n // mangle params as needed\n options.preprocessMatch = options.preprocessMatch || function _defaultPreprocessMatch( params ){\n var regexps = getRegExps.call( this );\n return _.extend( params, {\n matchTo : params.matchTo.name.replace( regexps[0], '' ),\n possible : params.possible.name.replace( regexps[1], '' )\n });\n };\n\n return function _strategy( params ){\n this.debug( 'autopair _strategy ---------------------------' );\n params = params || {};\n var listA = params.listA,\n listB = params.listB,\n indexA = 0, indexB,\n bestMatch = {\n score : 0.0,\n index : null\n },\n paired = [];\n //console.debug( 'params:', JSON.stringify( params, null, ' ' ) );\n this.debug( 'starting list lens:', listA.length, listB.length );\n this.debug( 'bestMatch (starting):', JSON.stringify( bestMatch, null, ' ' ) );\n\n while( indexA < listA.length ){\n var matchTo = listA[ indexA ];\n bestMatch.score = 0.0;\n\n for( indexB=0; indexB= scoreThreshold ){\n //console.debug( 'autoPairFnBuilder.strategy', listA[ indexA ].name, listB[ bestMatch.index ].name );\n paired.push( options.createPair.call( this, {\n listA : listA,\n indexA : indexA,\n listB : listB,\n indexB : bestMatch.index\n }));\n //console.debug( 'list lens now:', listA.length, listB.length );\n } else {\n indexA += 1;\n }\n if( !listA.length || !listB.length ){\n return paired;\n }\n }\n this.debug( 'paired:', JSON.stringify( paired, null, ' ' ) );\n this.debug( 'autopair _strategy ---------------------------' );\n return paired;\n };\n}\n\n\n// ============================================================================\n/** An interface for building collections of paired datasets.\n */\nvar PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).extend( baseCreator.CollectionCreatorMixin ).extend({\n _logNamespace : logNamespace,\n\n className: 'list-of-pairs-collection-creator collection-creator flex-row-container',\n\n /** set up initial options, instance vars, behaviors, and autopair (if set to do so) */\n initialize : function( attributes ){\n this.metric( 'PairedCollectionCreator.initialize', attributes );\n //this.debug( '-- PairedCollectionCreator:', attributes );\n\n attributes = _.defaults( attributes, {\n datasets : [],\n filters : this.DEFAULT_FILTERS,\n automaticallyPair : true,\n strategy : 'lcs',\n matchPercentage : 0.9,\n twoPassAutopairing : true\n });\n\n /** unordered, original list */\n this.initialList = attributes.datasets;\n\n /** is this from a history? if so, what's its id? */\n this.historyId = attributes.historyId;\n\n /** which filters should be used initially? (String[2] or name in commonFilters) */\n this.filters = this.commonFilters[ attributes.filters ] || this.commonFilters[ this.DEFAULT_FILTERS ];\n if( _.isArray( attributes.filters ) ){\n this.filters = attributes.filters;\n }\n\n /** try to auto pair the unpaired datasets on load? */\n this.automaticallyPair = attributes.automaticallyPair;\n\n /** what method to use for auto pairing (will be passed aggression level) */\n this.strategy = this.strategies[ attributes.strategy ] || this.strategies[ this.DEFAULT_STRATEGY ];\n if( _.isFunction( attributes.strategy ) ){\n this.strategy = attributes.strategy;\n }\n\n /** distance/mismatch level allowed for autopairing */\n this.matchPercentage = attributes.matchPercentage;\n\n /** try to autopair using simple first, then this.strategy on the remainder */\n this.twoPassAutopairing = attributes.twoPassAutopairing;\n\n /** remove file extensions (\\.*) from created pair names? */\n this.removeExtensions = true;\n //this.removeExtensions = false;\n\n /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n this.oncancel = attributes.oncancel;\n /** fn to call when the collection is created (scoped to this) */\n this.oncreate = attributes.oncreate;\n\n /** fn to call when the cancel button is clicked (scoped to this) - if falsy, no btn is displayed */\n this.autoscrollDist = attributes.autoscrollDist || 24;\n\n /** is the unpaired panel shown? */\n this.unpairedPanelHidden = false;\n /** is the paired panel shown? */\n this.pairedPanelHidden = false;\n\n /** DOM elements currently being dragged */\n this.$dragging = null;\n\n /** Used for blocking UI events during ajax/operations (don't post twice) */\n this.blocking = false;\n\n this._setUpCommonSettings( attributes );\n this._setUpBehaviors();\n this._dataSetUp();\n },\n\n /** map of common filter pairs by name */\n commonFilters : {\n illumina : [ '_1', '_2' ],\n Rs : [ '_R1', '_R2' ]\n },\n /** which commonFilter to use by default */\n DEFAULT_FILTERS : 'illumina',\n\n /** map of name->fn for autopairing */\n strategies : {\n 'simple' : 'autopairSimple',\n 'lcs' : 'autopairLCS',\n 'levenshtein' : 'autopairLevenshtein'\n },\n /** default autopair strategy name */\n DEFAULT_STRATEGY : 'lcs',\n\n // ------------------------------------------------------------------------ process raw list\n /** set up main data: cache initialList, sort, and autopair */\n _dataSetUp : function(){\n //this.debug( '-- _dataSetUp' );\n\n this.paired = [];\n this.unpaired = [];\n\n this.selectedIds = [];\n\n // sort initial list, add ids if needed, and save new working copy to unpaired\n this._sortInitialList();\n this._ensureIds();\n this.unpaired = this.initialList.slice( 0 );\n\n if( this.automaticallyPair ){\n this.autoPair();\n this.once( 'rendered:initial', function(){\n this.trigger( 'autopair' );\n });\n }\n },\n\n /** sort initial list */\n _sortInitialList : function(){\n //this.debug( '-- _sortInitialList' );\n this._sortDatasetList( this.initialList );\n },\n\n /** sort a list of datasets */\n _sortDatasetList : function( list ){\n // currently only natural sort by name\n list.sort( function( a, b ){ return naturalSort( a.name, b.name ); });\n return list;\n },\n\n /** add ids to dataset objs in initial list if none */\n _ensureIds : function(){\n this.initialList.forEach( function( dataset ){\n if( !dataset.hasOwnProperty( 'id' ) ){\n dataset.id = _.uniqueId();\n }\n });\n return this.initialList;\n },\n\n /** split initial list into two lists, those that pass forward filters & those passing reverse */\n _splitByFilters : function(){\n var regexFilters = this.filters.map( function( stringFilter ){\n return new RegExp( stringFilter );\n }),\n split = [ [], [] ];\n\n function _filter( unpaired, filter ){\n return filter.test( unpaired.name );\n //return dataset.name.indexOf( filter ) >= 0;\n }\n this.unpaired.forEach( function _filterEach( unpaired ){\n // 90% of the time this seems to work, but:\n //TODO: this treats *all* strings as regex which may confuse people - possibly check for // surrounding?\n // would need explanation in help as well\n regexFilters.forEach( function( filter, i ){\n if( _filter( unpaired, filter ) ){\n split[i].push( unpaired );\n }\n });\n });\n return split;\n },\n\n /** add a dataset to the unpaired list in it's proper order */\n _addToUnpaired : function( dataset ){\n // currently, unpaired is natural sorted by name, use binary search to find insertion point\n var binSearchSortedIndex = function( low, hi ){\n if( low === hi ){ return low; }\n\n var mid = Math.floor( ( hi - low ) / 2 ) + low,\n compared = naturalSort( dataset.name, this.unpaired[ mid ].name );\n\n if( compared < 0 ){\n return binSearchSortedIndex( low, mid );\n } else if( compared > 0 ){\n return binSearchSortedIndex( mid + 1, hi );\n }\n // walk the equal to find the last\n while( this.unpaired[ mid ] && this.unpaired[ mid ].name === dataset.name ){ mid++; }\n return mid;\n\n }.bind( this );\n\n this.unpaired.splice( binSearchSortedIndex( 0, this.unpaired.length ), 0, dataset );\n },\n\n // ------------------------------------------------------------------------ auto pairing\n /** two passes to automatically create pairs:\n * use both simpleAutoPair, then the fn mentioned in strategy\n */\n autoPair : function( strategy ){\n // split first using exact matching\n var split = this._splitByFilters(),\n paired = [];\n if( this.twoPassAutopairing ){\n paired = this.autopairSimple({\n listA : split[0],\n listB : split[1]\n });\n split = this._splitByFilters();\n }\n\n // uncomment to see printlns while running tests\n //this.debug = function(){ console.log.apply( console, arguments ); };\n\n // then try the remainder with something less strict\n strategy = strategy || this.strategy;\n split = this._splitByFilters();\n paired = paired.concat( this[ strategy ].call( this, {\n listA : split[0],\n listB : split[1]\n }));\n return paired;\n },\n\n /** autopair by exact match */\n autopairSimple : autoPairFnBuilder({\n scoreThreshold: function(){ return 0.6; },\n match : function _match( params ){\n params = params || {};\n if( params.matchTo === params.possible ){\n return {\n index: params.index,\n score: 1.0\n };\n }\n return params.bestMatch;\n }\n }),\n\n /** autopair by levenshtein edit distance scoring */\n autopairLevenshtein : autoPairFnBuilder({\n scoreThreshold: function(){ return this.matchPercentage; },\n match : function _matches( params ){\n params = params || {};\n var distance = levenshteinDistance( params.matchTo, params.possible ),\n score = 1.0 - ( distance / ( Math.max( params.matchTo.length, params.possible.length ) ) );\n if( score > params.bestMatch.score ){\n return {\n index: params.index,\n score: score\n };\n }\n return params.bestMatch;\n }\n }),\n\n /** autopair by longest common substrings scoring */\n autopairLCS : autoPairFnBuilder({\n scoreThreshold: function(){ return this.matchPercentage; },\n match : function _matches( params ){\n params = params || {};\n var match = this._naiveStartingAndEndingLCS( params.matchTo, params.possible ).length,\n score = match / ( Math.max( params.matchTo.length, params.possible.length ) );\n if( score > params.bestMatch.score ){\n return {\n index: params.index,\n score: score\n };\n }\n return params.bestMatch;\n }\n }),\n\n /** return the concat'd longest common prefix and suffix from two strings */\n _naiveStartingAndEndingLCS : function( s1, s2 ){\n var fwdLCS = '',\n revLCS = '',\n i = 0, j = 0;\n while( i < s1.length && i < s2.length ){\n if( s1[ i ] !== s2[ i ] ){\n break;\n }\n fwdLCS += s1[ i ];\n i += 1;\n }\n if( i === s1.length ){ return s1; }\n if( i === s2.length ){ return s2; }\n\n i = ( s1.length - 1 );\n j = ( s2.length - 1 );\n while( i >= 0 && j >= 0 ){\n if( s1[ i ] !== s2[ j ] ){\n break;\n }\n revLCS = [ s1[ i ], revLCS ].join( '' );\n i -= 1;\n j -= 1;\n }\n return fwdLCS + revLCS;\n },\n\n // ------------------------------------------------------------------------ pairing / unpairing\n /** create a pair from fwd and rev, removing them from unpaired, and placing the new pair in paired */\n _pair : function( fwd, rev, options ){\n options = options || {};\n this.debug( '_pair:', fwd, rev );\n var pair = this._createPair( fwd, rev, options.name );\n this.paired.push( pair );\n this.unpaired = _.without( this.unpaired, fwd, rev );\n if( !options.silent ){\n this.trigger( 'pair:new', pair );\n }\n return pair;\n },\n\n /** create a pair Object from fwd and rev, adding the name attribute (will guess if not given) */\n _createPair : function( fwd, rev, name ){\n // ensure existance and don't pair something with itself\n if( !( fwd && rev ) || ( fwd === rev ) ){\n throw new Error( 'Bad pairing: ' + [ JSON.stringify( fwd ), JSON.stringify( rev ) ] );\n }\n name = name || this._guessNameForPair( fwd, rev );\n return { forward : fwd, name : name, reverse : rev };\n },\n\n /** try to find a good pair name for the given fwd and rev datasets */\n _guessNameForPair : function( fwd, rev, removeExtensions ){\n removeExtensions = ( removeExtensions !== undefined )?( removeExtensions ):( this.removeExtensions );\n var fwdName = fwd.name,\n revName = rev.name,\n lcs = this._naiveStartingAndEndingLCS(\n fwdName.replace( new RegExp( this.filters[0] ), '' ),\n revName.replace( new RegExp( this.filters[1] ), '' )\n );\n if( removeExtensions ){\n var lastDotIndex = lcs.lastIndexOf( '.' );\n if( lastDotIndex > 0 ){\n var extension = lcs.slice( lastDotIndex, lcs.length );\n lcs = lcs.replace( extension, '' );\n fwdName = fwdName.replace( extension, '' );\n revName = revName.replace( extension, '' );\n }\n }\n return lcs || ( fwdName + ' & ' + revName );\n },\n\n /** unpair a pair, removing it from paired, and adding the fwd,rev datasets back into unpaired */\n _unpair : function( pair, options ){\n options = options || {};\n if( !pair ){\n throw new Error( 'Bad pair: ' + JSON.stringify( pair ) );\n }\n this.paired = _.without( this.paired, pair );\n this._addToUnpaired( pair.forward );\n this._addToUnpaired( pair.reverse );\n\n if( !options.silent ){\n this.trigger( 'pair:unpair', [ pair ] );\n }\n return pair;\n },\n\n /** unpair all paired datasets */\n unpairAll : function(){\n var pairs = [];\n while( this.paired.length ){\n pairs.push( this._unpair( this.paired[ 0 ], { silent: true }) );\n }\n this.trigger( 'pair:unpair', pairs );\n },\n\n // ------------------------------------------------------------------------ API\n /** convert a pair into JSON compatible with the collections API */\n _pairToJSON : function( pair, src ){\n src = src || 'hda';\n //TODO: consider making this the pair structure when created instead\n return {\n collection_type : 'paired',\n src : 'new_collection',\n name : pair.name,\n element_identifiers : [{\n name : 'forward',\n id : pair.forward.id,\n src : src\n }, {\n name : 'reverse',\n id : pair.reverse.id,\n src : src\n }]\n };\n },\n\n /** create the collection via the API\n * @returns {jQuery.xhr Object} the jquery ajax request\n */\n createList : function( name ){\n var creator = this,\n url = Galaxy.root + 'api/histories/' + this.historyId + '/contents/dataset_collections';\n\n //TODO: use ListPairedCollection.create()\n var ajaxData = {\n type : 'dataset_collection',\n collection_type : 'list:paired',\n hide_source_items : creator.hideOriginals || false,\n name : _.escape( name || creator.$( '.collection-name' ).val() ),\n element_identifiers : creator.paired.map( function( pair ){\n return creator._pairToJSON( pair );\n })\n\n };\n //this.debug( JSON.stringify( ajaxData ) );\n creator.blocking = true;\n return jQuery.ajax( url, {\n type : 'POST',\n contentType : 'application/json',\n dataType : 'json',\n data : JSON.stringify( ajaxData )\n })\n .always( function(){\n creator.blocking = false;\n })\n .fail( function( xhr, status, message ){\n creator._ajaxErrHandler( xhr, status, message );\n })\n .done( function( response, message, xhr ){\n //this.info( 'ok', response, message, xhr );\n creator.trigger( 'collection:created', response, message, xhr );\n creator.metric( 'collection:created', response );\n if( typeof creator.oncreate === 'function' ){\n creator.oncreate.call( this, response, message, xhr );\n }\n });\n },\n\n /** handle ajax errors with feedback and details to the user (if available) */\n _ajaxErrHandler : function( xhr, status, message ){\n this.error( xhr, status, message );\n var content = _l( 'An error occurred while creating this collection' );\n if( xhr ){\n if( xhr.readyState === 0 && xhr.status === 0 ){\n content += ': ' + _l( 'Galaxy could not be reached and may be updating.' )\n + _l( ' Try again in a few minutes.' );\n } else if( xhr.responseJSON ){\n content += '
                                                        ' + JSON.stringify( xhr.responseJSON ) + '
                                                        ';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n // ------------------------------------------------------------------------ rendering\n /** render the entire interface */\n render : function( speed, callback ){\n //this.debug( '-- _render' );\n //this.$el.empty().html( this.templates.main() );\n this.$el.empty().html( this.templates.main() );\n this._renderHeader( speed );\n this._renderMiddle( speed );\n this._renderFooter( speed );\n this._addPluginComponents();\n this.trigger( 'rendered', this );\n return this;\n },\n\n /** render the header section */\n _renderHeader : function( speed, callback ){\n //this.debug( '-- _renderHeader' );\n var $header = this.$( '.header' ).empty().html( this.templates.header() )\n .find( '.help-content' ).prepend( $( this.templates.helpContent() ) );\n\n this._renderFilters();\n return $header;\n },\n /** fill the filter inputs with the filter values */\n _renderFilters : function(){\n return this.$( '.forward-column .column-header input' ).val( this.filters[0] )\n .add( this.$( '.reverse-column .column-header input' ).val( this.filters[1] ) );\n },\n\n /** render the middle including unpaired and paired sections (which may be hidden) */\n _renderMiddle : function( speed, callback ){\n var $middle = this.$( '.middle' ).empty().html( this.templates.middle() );\n\n // (re-) hide the un/paired panels based on instance vars\n if( this.unpairedPanelHidden ){\n this.$( '.unpaired-columns' ).hide();\n } else if( this.pairedPanelHidden ){\n this.$( '.paired-columns' ).hide();\n }\n\n this._renderUnpaired();\n this._renderPaired();\n return $middle;\n },\n /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n _renderUnpaired : function( speed, callback ){\n //this.debug( '-- _renderUnpaired' );\n var creator = this,\n $fwd, $rev, $prd = [],\n split = this._splitByFilters();\n // update unpaired counts\n this.$( '.forward-column .title' )\n .text([ split[0].length, _l( 'unpaired forward' ) ].join( ' ' ));\n this.$( '.forward-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[0].length ) );\n this.$( '.reverse-column .title' )\n .text([ split[1].length, _l( 'unpaired reverse' ) ].join( ' ' ));\n this.$( '.reverse-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[1].length ) );\n\n this.$( '.unpaired-columns .column-datasets' ).empty();\n\n // show/hide the auto pair button if any unpaired are left\n this.$( '.autopair-link' ).toggle( this.unpaired.length !== 0 );\n if( this.unpaired.length === 0 ){\n this._renderUnpairedEmpty();\n return;\n }\n\n // create the dataset dom arrays\n $rev = split[1].map( function( dataset, i ){\n // if there'll be a fwd dataset across the way, add a button to pair the row\n if( ( split[0][ i ] !== undefined )\n && ( split[0][ i ] !== dataset ) ){\n $prd.push( creator._renderPairButton() );\n }\n return creator._renderUnpairedDataset( dataset );\n });\n $fwd = split[0].map( function( dataset ){\n return creator._renderUnpairedDataset( dataset );\n });\n\n if( !$fwd.length && !$rev.length ){\n this._renderUnpairedNotShown();\n return;\n }\n // add to appropo cols\n //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n // and swapping out that\n this.$( '.unpaired-columns .forward-column .column-datasets' ).append( $fwd )\n .add( this.$( '.unpaired-columns .paired-column .column-datasets' ).append( $prd ) )\n .add( this.$( '.unpaired-columns .reverse-column .column-datasets' ).append( $rev ) );\n this._adjUnpairedOnScrollbar();\n },\n /** return a string to display the count of filtered out datasets */\n _renderUnpairedDisplayStr : function( numFiltered ){\n return [ '(', numFiltered, ' ', _l( 'filtered out' ), ')' ].join('');\n },\n /** return an unattached jQuery DOM element to represent an unpaired dataset */\n _renderUnpairedDataset : function( dataset ){\n //TODO: to underscore template\n return $( '
                                                      • ')\n .attr( 'id', 'dataset-' + dataset.id )\n .addClass( 'dataset unpaired' )\n .attr( 'draggable', true )\n .addClass( dataset.selected? 'selected': '' )\n .append( $( '' ).addClass( 'dataset-name' ).text( dataset.name ) )\n //??\n .data( 'dataset', dataset );\n },\n /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n _renderPairButton : function(){\n //TODO: *not* a dataset - don't pretend like it is\n return $( '
                                                      • ').addClass( 'dataset unpaired' )\n .append( $( '' ).addClass( 'dataset-name' ).text( _l( 'Pair these datasets' ) ) );\n },\n /** a message to display when no unpaired left */\n _renderUnpairedEmpty : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '
                                                        ' )\n .text( '(' + _l( 'no remaining unpaired datasets' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** a message to display when no unpaired can be shown with the current filters */\n _renderUnpairedNotShown : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '
                                                        ' )\n .text( '(' + _l( 'no datasets were found matching the current filters' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n _adjUnpairedOnScrollbar : function(){\n var $unpairedColumns = this.$( '.unpaired-columns' ).last(),\n $firstDataset = this.$( '.unpaired-columns .reverse-column .dataset' ).first();\n if( !$firstDataset.length ){ return; }\n var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n rightDiff = Math.floor( ucRight ) - Math.floor( dsRight );\n //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n this.$( '.unpaired-columns .forward-column' )\n .css( 'margin-left', ( rightDiff > 0 )? rightDiff: 0 );\n },\n\n /** render the paired section and update counts of paired datasets */\n _renderPaired : function( speed, callback ){\n //this.debug( '-- _renderPaired' );\n this.$( '.paired-column-title .title' ).text([ this.paired.length, _l( 'paired' ) ].join( ' ' ) );\n // show/hide the unpair all link\n this.$( '.unpair-all-link' ).toggle( this.paired.length !== 0 );\n if( this.paired.length === 0 ){\n this._renderPairedEmpty();\n return;\n //TODO: would be best to return here (the $columns)\n } else {\n // show/hide 'remove extensions link' when any paired and they seem to have extensions\n this.$( '.remove-extensions-link' ).show();\n }\n\n this.$( '.paired-columns .column-datasets' ).empty();\n var creator = this;\n this.paired.forEach( function( pair, i ){\n //TODO: cache these?\n var pairView = new PairView({ pair: pair });\n creator.$( '.paired-columns .column-datasets' )\n .append( pairView.render().$el )\n .append([\n ''\n ].join( '' ));\n });\n },\n /** a message to display when none paired */\n _renderPairedEmpty : function(){\n var $msg = $( '
                                                        ' )\n .text( '(' + _l( 'no paired datasets yet' ) + ')' );\n this.$( '.paired-columns .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n\n footerSettings : {\n '.hide-originals': 'hideOriginals',\n '.remove-extensions': 'removeExtensions'\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents : function(){\n this._chooseFiltersPopover( '.choose-filters-link' );\n this.$( '.help-content i' ).hoverhighlight( '.collection-creator', 'rgba( 64, 255, 255, 1.0 )' );\n },\n\n /** build a filter selection popover allowing selection of common filter pairs */\n _chooseFiltersPopover : function( selector ){\n function filterChoice( val1, val2 ){\n return [\n ''\n ].join('');\n }\n var $popoverContent = $( _.template([\n '
                                                        ',\n '
                                                        ',\n _l( 'Choose from the following filters to change which unpaired reads are shown in the display' ),\n ':
                                                        ',\n _.values( this.commonFilters ).map( function( filterSet ){\n return filterChoice( filterSet[0], filterSet[1] );\n }).join( '' ),\n '
                                                        '\n ].join(''))({}));\n\n return this.$( selector ).popover({\n container : '.collection-creator',\n placement : 'bottom',\n html : true,\n //animation : false,\n content : $popoverContent\n });\n },\n\n /** add (or clear if clear is truthy) a validation warning to what */\n _validationWarning : function( what, clear ){\n var VALIDATION_CLASS = 'validation-warning';\n if( what === 'name' ){\n what = this.$( '.collection-name' ).add( this.$( '.collection-name-prompt' ) );\n this.$( '.collection-name' ).focus().select();\n }\n if( clear ){\n what = what || this.$( '.' + VALIDATION_CLASS );\n what.removeClass( VALIDATION_CLASS );\n } else {\n what.addClass( VALIDATION_CLASS );\n }\n },\n\n // ------------------------------------------------------------------------ events\n /** set up event handlers on self */\n _setUpBehaviors : function(){\n this.once( 'rendered', function(){\n this.trigger( 'rendered:initial', this );\n });\n\n this.on( 'pair:new', function(){\n //TODO: ideally only re-render the columns (or even elements) involved\n this._renderUnpaired();\n this._renderPaired();\n\n // scroll to bottom where new pairs are added\n //TODO: this doesn't seem to work - innerHeight sticks at 133...\n // may have to do with improper flex columns\n //var $pairedView = this.$( '.paired-columns' );\n //$pairedView.scrollTop( $pairedView.innerHeight() );\n //this.debug( $pairedView.height() )\n this.$( '.paired-columns' ).scrollTop( 8000000 );\n });\n this.on( 'pair:unpair', function( pairs ){\n //TODO: ideally only re-render the columns (or even elements) involved\n this._renderUnpaired();\n this._renderPaired();\n this.splitView();\n });\n\n this.on( 'filter-change', function(){\n this.filters = [\n this.$( '.forward-unpaired-filter input' ).val(),\n this.$( '.reverse-unpaired-filter input' ).val()\n ];\n this.metric( 'filter-change', this.filters );\n this._renderFilters();\n this._renderUnpaired();\n });\n\n this.on( 'autopair', function(){\n this._renderUnpaired();\n this._renderPaired();\n\n var message, msgClass = null;\n if( this.paired.length ){\n msgClass = 'alert-success';\n message = this.paired.length + ' ' + _l( 'pairs created' );\n if( !this.unpaired.length ){\n message += ': ' + _l( 'all datasets have been successfully paired' );\n this.hideUnpaired();\n this.$( '.collection-name' ).focus();\n }\n } else {\n message = _l([\n 'Could not automatically create any pairs from the given dataset names.',\n 'You may want to choose or enter different filters and try auto-pairing again.',\n 'Close this message using the X on the right to view more help.'\n ].join( ' ' ));\n }\n this._showAlert( message, msgClass );\n });\n\n //this.on( 'all', function(){\n // this.info( arguments );\n //});\n return this;\n },\n\n events : {\n // header\n 'click .more-help' : '_clickMoreHelp',\n 'click .less-help' : '_clickLessHelp',\n 'click .main-help' : '_toggleHelp',\n 'click .header .alert button' : '_hideAlert',\n 'click .forward-column .column-title' : '_clickShowOnlyUnpaired',\n 'click .reverse-column .column-title' : '_clickShowOnlyUnpaired',\n 'click .unpair-all-link' : '_clickUnpairAll',\n //TODO: this seems kinda backasswards - re-sending jq event as a backbone event, can we listen directly?\n 'change .forward-unpaired-filter input' : function( ev ){ this.trigger( 'filter-change' ); },\n 'focus .forward-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\n 'click .autopair-link' : '_clickAutopair',\n 'click .choose-filters .filter-choice' : '_clickFilterChoice',\n 'click .clear-filters-link' : '_clearFilters',\n 'change .reverse-unpaired-filter input' : function( ev ){ this.trigger( 'filter-change' ); },\n 'focus .reverse-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\n // unpaired\n 'click .forward-column .dataset.unpaired' : '_clickUnpairedDataset',\n 'click .reverse-column .dataset.unpaired' : '_clickUnpairedDataset',\n 'click .paired-column .dataset.unpaired' : '_clickPairRow',\n 'click .unpaired-columns' : 'clearSelectedUnpaired',\n 'mousedown .unpaired-columns .dataset' : '_mousedownUnpaired',\n // divider\n 'click .paired-column-title' : '_clickShowOnlyPaired',\n 'mousedown .flexible-partition-drag' : '_startPartitionDrag',\n // paired\n 'click .paired-columns .dataset.paired' : 'selectPair',\n 'click .paired-columns' : 'clearSelectedPaired',\n 'click .paired-columns .pair-name' : '_clickPairName',\n 'click .unpair-btn' : '_clickUnpair',\n // paired - drop target\n //'dragenter .paired-columns' : '_dragenterPairedColumns',\n //'dragleave .paired-columns .column-datasets': '_dragleavePairedColumns',\n 'dragover .paired-columns .column-datasets' : '_dragoverPairedColumns',\n 'drop .paired-columns .column-datasets' : '_dropPairedColumns',\n\n 'pair.dragstart .paired-columns .column-datasets' : '_pairDragstart',\n 'pair.dragend .paired-columns .column-datasets' : '_pairDragend',\n\n // footer\n 'change .remove-extensions' : function( ev ){ this.toggleExtensions(); },\n 'change .collection-name' : '_changeName',\n 'keydown .collection-name' : '_nameCheckForEnter',\n 'change .hide-originals' : '_changeHideOriginals',\n 'click .cancel-create' : '_cancelCreate',\n 'click .create-collection' : '_clickCreate'//,\n },\n\n /** toggle between showing only unpaired and split view */\n _clickShowOnlyUnpaired : function( ev ){\n //this.debug( 'click unpaired', ev.currentTarget );\n if( this.$( '.paired-columns' ).is( ':visible' ) ){\n this.hidePaired();\n } else {\n this.splitView();\n }\n },\n /** toggle between showing only paired and split view */\n _clickShowOnlyPaired : function( ev ){\n //this.debug( 'click paired' );\n if( this.$( '.unpaired-columns' ).is( ':visible' ) ){\n this.hideUnpaired();\n } else {\n this.splitView();\n }\n },\n\n /** hide unpaired, show paired */\n hideUnpaired : function( speed, callback ){\n this.unpairedPanelHidden = true;\n this.pairedPanelHidden = false;\n this._renderMiddle( speed, callback );\n },\n /** hide paired, show unpaired */\n hidePaired : function( speed, callback ){\n this.unpairedPanelHidden = false;\n this.pairedPanelHidden = true;\n this._renderMiddle( speed, callback );\n },\n /** show both paired and unpaired (splitting evenly) */\n splitView : function( speed, callback ){\n this.unpairedPanelHidden = this.pairedPanelHidden = false;\n this._renderMiddle( speed, callback );\n return this;\n },\n\n /** unpair all paired and do other super neat stuff which I'm not really sure about yet... */\n _clickUnpairAll : function( ev ){\n this.metric( 'unpairAll' );\n this.unpairAll();\n },\n\n /** attempt to autopair */\n _clickAutopair : function( ev ){\n var paired = this.autoPair();\n this.metric( 'autopair', paired.length, this.unpaired.length );\n this.trigger( 'autopair' );\n },\n\n /** set the filters based on the data attributes of the button click target */\n _clickFilterChoice : function( ev ){\n var $selected = $( ev.currentTarget );\n this.$( '.forward-unpaired-filter input' ).val( $selected.data( 'forward' ) );\n this.$( '.reverse-unpaired-filter input' ).val( $selected.data( 'reverse' ) );\n this._hideChooseFilters();\n this.trigger( 'filter-change' );\n },\n\n /** hide the choose filters popover */\n _hideChooseFilters : function(){\n //TODO: update bootstrap and remove the following hack\n // see also: https://github.com/twbs/bootstrap/issues/10260\n this.$( '.choose-filters-link' ).popover( 'hide' );\n this.$( '.popover' ).css( 'display', 'none' );\n },\n\n /** clear both filters */\n _clearFilters : function( ev ){\n this.$( '.forward-unpaired-filter input' ).val( '' );\n this.$( '.reverse-unpaired-filter input' ).val( '' );\n this.trigger( 'filter-change' );\n },\n\n // ........................................................................ unpaired\n /** select an unpaired dataset */\n _clickUnpairedDataset : function( ev ){\n ev.stopPropagation();\n return this.toggleSelectUnpaired( $( ev.currentTarget ) );\n },\n\n /** Toggle the selection of an unpaired dataset representation.\n * @param [jQuery] $dataset the unpaired dataset dom rep to select\n * @param [Boolean] options.force if defined, force selection based on T/F; otherwise, toggle\n */\n toggleSelectUnpaired : function( $dataset, options ){\n options = options || {};\n var dataset = $dataset.data( 'dataset' ),\n select = options.force !== undefined? options.force: !$dataset.hasClass( 'selected' );\n //this.debug( id, options.force, $dataset, dataset );\n if( !$dataset.length || dataset === undefined ){ return $dataset; }\n\n if( select ){\n $dataset.addClass( 'selected' );\n if( !options.waitToPair ){\n this.pairAllSelected();\n }\n\n } else {\n $dataset.removeClass( 'selected' );\n //delete dataset.selected;\n }\n return $dataset;\n },\n\n /** pair all the currently selected unpaired datasets */\n pairAllSelected : function( options ){\n options = options || {};\n var creator = this,\n fwds = [],\n revs = [],\n pairs = [];\n creator.$( '.unpaired-columns .forward-column .dataset.selected' ).each( function(){\n fwds.push( $( this ).data( 'dataset' ) );\n });\n creator.$( '.unpaired-columns .reverse-column .dataset.selected' ).each( function(){\n revs.push( $( this ).data( 'dataset' ) );\n });\n fwds.length = revs.length = Math.min( fwds.length, revs.length );\n //this.debug( fwds );\n //this.debug( revs );\n fwds.forEach( function( fwd, i ){\n try {\n pairs.push( creator._pair( fwd, revs[i], { silent: true }) );\n\n } catch( err ){\n //TODO: preserve selected state of those that couldn't be paired\n //TODO: warn that some could not be paired\n creator.error( err );\n }\n });\n if( pairs.length && !options.silent ){\n this.trigger( 'pair:new', pairs );\n }\n return pairs;\n },\n\n /** clear the selection on all unpaired datasets */\n clearSelectedUnpaired : function(){\n this.$( '.unpaired-columns .dataset.selected' ).removeClass( 'selected' );\n },\n\n /** when holding down the shift key on a click, 'paint' the moused over datasets as selected */\n _mousedownUnpaired : function( ev ){\n if( ev.shiftKey ){\n var creator = this,\n $startTarget = $( ev.target ).addClass( 'selected' ),\n moveListener = function( ev ){\n creator.$( ev.target ).filter( '.dataset' ).addClass( 'selected' );\n };\n $startTarget.parent().on( 'mousemove', moveListener );\n\n // on any mouseup, stop listening to the move and try to pair any selected\n $( document ).one( 'mouseup', function( ev ){\n $startTarget.parent().off( 'mousemove', moveListener );\n creator.pairAllSelected();\n });\n }\n },\n\n /** attempt to pair two datasets directly across from one another */\n _clickPairRow : function( ev ){\n //if( !ev.currentTarget ){ return true; }\n var rowIndex = $( ev.currentTarget ).index(),\n fwd = $( '.unpaired-columns .forward-column .dataset' ).eq( rowIndex ).data( 'dataset' ),\n rev = $( '.unpaired-columns .reverse-column .dataset' ).eq( rowIndex ).data( 'dataset' );\n //this.debug( 'row:', rowIndex, fwd, rev );\n this._pair( fwd, rev );\n },\n\n // ........................................................................ divider/partition\n /** start dragging the visible divider/partition between unpaired and paired panes */\n _startPartitionDrag : function( ev ){\n var creator = this,\n startingY = ev.pageY;\n //this.debug( 'partition drag START:', ev );\n $( 'body' ).css( 'cursor', 'ns-resize' );\n creator.$( '.flexible-partition-drag' ).css( 'color', 'black' );\n\n function endDrag( ev ){\n //creator.debug( 'partition drag STOP:', ev );\n // doing this by an added class didn't really work well - kept flashing still\n creator.$( '.flexible-partition-drag' ).css( 'color', '' );\n $( 'body' ).css( 'cursor', '' ).unbind( 'mousemove', trackMouse );\n }\n function trackMouse( ev ){\n var offset = ev.pageY - startingY;\n //creator.debug( 'partition:', startingY, offset );\n if( !creator.adjPartition( offset ) ){\n //creator.debug( 'mouseup triggered' );\n $( 'body' ).trigger( 'mouseup' );\n }\n creator._adjUnpairedOnScrollbar();\n startingY += offset;\n }\n $( 'body' ).mousemove( trackMouse );\n $( 'body' ).one( 'mouseup', endDrag );\n },\n\n /** adjust the parition up/down +/-adj pixels */\n adjPartition : function( adj ){\n var $unpaired = this.$( '.unpaired-columns' ),\n $paired = this.$( '.paired-columns' ),\n unpairedHi = parseInt( $unpaired.css( 'height' ), 10 ),\n pairedHi = parseInt( $paired.css( 'height' ), 10 );\n //this.debug( adj, 'hi\\'s:', unpairedHi, pairedHi, unpairedHi + adj, pairedHi - adj );\n\n unpairedHi = Math.max( 10, unpairedHi + adj );\n pairedHi = pairedHi - adj;\n\n var movingUpwards = adj < 0;\n // when the divider gets close to the top - lock into hiding the unpaired section\n if( movingUpwards ){\n if( this.unpairedPanelHidden ){\n return false;\n } else if( unpairedHi <= 10 ){\n this.hideUnpaired();\n return false;\n }\n } else {\n if( this.unpairedPanelHidden ){\n $unpaired.show();\n this.unpairedPanelHidden = false;\n }\n }\n\n // when the divider gets close to the bottom - lock into hiding the paired section\n if( !movingUpwards ){\n if( this.pairedPanelHidden ){\n return false;\n } else if( pairedHi <= 15 ){\n this.hidePaired();\n return false;\n }\n\n } else {\n if( this.pairedPanelHidden ){\n $paired.show();\n this.pairedPanelHidden = false;\n }\n }\n\n $unpaired.css({\n height : unpairedHi + 'px',\n flex : '0 0 auto'\n });\n return true;\n },\n\n // ........................................................................ paired\n /** select a pair when clicked */\n selectPair : function( ev ){\n ev.stopPropagation();\n $( ev.currentTarget ).toggleClass( 'selected' );\n },\n\n /** deselect all pairs */\n clearSelectedPaired : function( ev ){\n this.$( '.paired-columns .dataset.selected' ).removeClass( 'selected' );\n },\n\n /** rename a pair when the pair name is clicked */\n _clickPairName : function( ev ){\n ev.stopPropagation();\n var $name = $( ev.currentTarget ),\n $pair = $name.parent().parent(),\n index = $pair.index( '.dataset.paired' ),\n pair = this.paired[ index ],\n response = prompt( 'Enter a new name for the pair:', pair.name );\n if( response ){\n pair.name = response;\n // set a flag (which won't be passed in json creation) for manual naming so we don't overwrite these\n // when adding/removing extensions\n //hackish\n pair.customizedName = true;\n $name.text( pair.name );\n }\n },\n\n /** unpair this pair */\n _clickUnpair : function( ev ){\n //if( !ev.currentTarget ){ return true; }\n var pairIndex = Math.floor( $( ev.currentTarget ).index( '.unpair-btn' ) );\n //this.debug( 'pair:', pairIndex );\n this._unpair( this.paired[ pairIndex ] );\n },\n\n // ........................................................................ paired - drag and drop re-ordering\n //_dragenterPairedColumns : function( ev ){\n // this.debug( '_dragenterPairedColumns:', ev );\n //},\n //_dragleavePairedColumns : function( ev ){\n // //this.debug( '_dragleavePairedColumns:', ev );\n //},\n /** track the mouse drag over the paired list adding a placeholder to show where the drop would occur */\n _dragoverPairedColumns : function( ev ){\n //this.debug( '_dragoverPairedColumns:', ev );\n ev.preventDefault();\n\n var $list = this.$( '.paired-columns .column-datasets' );\n this._checkForAutoscroll( $list, ev.originalEvent.clientY );\n //this.debug( ev.originalEvent.clientX, ev.originalEvent.clientY );\n var $nearest = this._getNearestPairedDatasetLi( ev.originalEvent.clientY );\n\n $( '.element-drop-placeholder' ).remove();\n var $placeholder = $( '
                                                        ' );\n if( !$nearest.length ){\n $list.append( $placeholder );\n } else {\n $nearest.before( $placeholder );\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll : function( $element, y ){\n var AUTOSCROLL_SPEED = 2;\n var offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = ( offset.top + $element.outerHeight() ) - y;\n //this.debug( '_checkForAutoscroll:', scrollTop, upperDist, lowerDist );\n if( upperDist >= 0 && upperDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop - AUTOSCROLL_SPEED );\n } else if( lowerDist >= 0 && lowerDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop + AUTOSCROLL_SPEED );\n }\n },\n\n /** get the nearest *previous* paired dataset PairView based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestPairedDatasetLi : function( y ){\n var WIGGLE = 4,\n lis = this.$( '.paired-columns .column-datasets li' ).toArray();\n for( var i=0; i y && top - halfHeight < y ){\n //this.debug( y, top + halfHeight, top - halfHeight )\n return $li;\n }\n }\n return $();\n },\n /** drop (dragged/selected PairViews) onto the list, re-ordering both the DOM and the internal array of pairs */\n _dropPairedColumns : function( ev ){\n // both required for firefox\n ev.preventDefault();\n ev.dataTransfer.dropEffect = 'move';\n\n var $nearest = this._getNearestPairedDatasetLi( ev.originalEvent.clientY );\n if( $nearest.length ){\n this.$dragging.insertBefore( $nearest );\n\n } else {\n // no nearest before - insert after last element (unpair button)\n this.$dragging.insertAfter( this.$( '.paired-columns .unpair-btn' ).last() );\n }\n // resync the creator's list of paired based on the new DOM order\n this._syncPairsToDom();\n return false;\n },\n /** resync the creator's list of paired based on the DOM order of pairs */\n _syncPairsToDom : function(){\n var newPaired = [];\n //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n this.$( '.paired-columns .dataset.paired' ).each( function(){\n newPaired.push( $( this ).data( 'pair' ) );\n });\n //this.debug( newPaired );\n this.paired = newPaired;\n this._renderPaired();\n },\n /** drag communication with pair sub-views: dragstart */\n _pairDragstart : function( ev, pair ){\n //this.debug( '_pairDragstart', ev, pair )\n // auto select the pair causing the event and move all selected\n pair.$el.addClass( 'selected' );\n var $selected = this.$( '.paired-columns .dataset.selected' );\n this.$dragging = $selected;\n },\n /** drag communication with pair sub-views: dragend - remove the placeholder */\n _pairDragend : function( ev, pair ){\n //this.debug( '_pairDragend', ev, pair )\n $( '.element-drop-placeholder' ).remove();\n this.$dragging = null;\n },\n\n // ........................................................................ footer\n toggleExtensions : function( force ){\n var creator = this;\n creator.removeExtensions = ( force !== undefined )?( force ):( !creator.removeExtensions );\n\n _.each( creator.paired, function( pair ){\n // don't overwrite custom names\n if( pair.customizedName ){ return; }\n pair.name = creator._guessNameForPair( pair.forward, pair.reverse );\n });\n\n creator._renderPaired();\n creator._renderFooter();\n },\n\n // ------------------------------------------------------------------------ misc\n /** debug a dataset list */\n _printList : function( list ){\n var creator = this;\n _.each( list, function( e ){\n if( list === creator.paired ){\n creator._printPair( e );\n } else {\n //creator.debug( e );\n }\n });\n },\n\n /** print a pair Object */\n _printPair : function( pair ){\n this.debug( pair.forward.name, pair.reverse.name, ': ->', pair.name );\n },\n\n /** string rep */\n toString : function(){ return 'PairedCollectionCreator'; },\n\n templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\n /** the header (not including help text) */\n header : _.template([\n '
                                                        ',\n '', _l( 'More help' ), '',\n '
                                                        ',\n '', _l( 'Less' ), '',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '',\n '',\n '
                                                        ',\n\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '', _l( 'Unpaired forward' ), '',\n '',\n '
                                                        ',\n '
                                                        ',\n '',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '', _l( 'Unpaired reverse' ), '',\n '',\n '
                                                        ',\n '
                                                        ',\n '',\n '
                                                        ',\n '
                                                        ',\n '
                                                        ',\n '
                                                        '\n ].join('')),\n\n /** the middle: unpaired, divider, and paired */\n middle : _.template([\n // contains two flex rows (rows that fill available space) and a divider btwn\n '
                                                        ',\n '
                                                        ',\n '
                                                          ',\n '
                                                          ',\n '
                                                          ',\n '
                                                            ',\n '
                                                            ',\n '
                                                            ',\n '
                                                              ',\n '
                                                              ',\n '
                                                              ',\n '
                                                              ',\n '
                                                              ',\n '
                                                              ',\n '
                                                              ',\n '',\n '
                                                              ',\n '',\n _l( 'Unpair all' ),\n '',\n '
                                                              ',\n '
                                                              ',\n '
                                                              ',\n '
                                                                ',\n '
                                                                '\n ].join('')),\n\n /** creation and cancel controls */\n footer : _.template([\n '
                                                                ',\n '
                                                                ',\n '',\n '',\n '
                                                                ',\n '
                                                                ',\n '',\n '
                                                                ', _l( 'Name' ), ':
                                                                ',\n '
                                                                ',\n '
                                                                ',\n\n '
                                                                ',\n '
                                                                ',\n '',\n '
                                                                ',\n '',\n '',\n '
                                                                ',\n '
                                                                ',\n\n '
                                                                ',\n '',\n '
                                                                ',\n '
                                                                '\n ].join('')),\n\n /** help content */\n helpContent : _.template([\n '

                                                                ', _l([\n 'Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ',\n 'These collections can be passed to tools and workflows in order to have analyses done on each member of ',\n 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ',\n 'and re-order the final collection.'\n ].join( '' )), '

                                                                ',\n '

                                                                ', _l([\n 'Unpaired datasets are shown in the unpaired section ',\n '(hover over the underlined words to highlight below). ',\n 'Paired datasets are shown in the paired section.',\n '

                                                                  To pair datasets, you can:',\n '
                                                                • Click a dataset in the ',\n 'forward column ',\n 'to select it then click a dataset in the ',\n 'reverse column.',\n '
                                                                • ',\n '
                                                                • Click one of the \"Pair these datasets\" buttons in the ',\n 'middle column ',\n 'to pair the datasets in a particular row.',\n '
                                                                • ',\n '
                                                                • Click \"Auto-pair\" ',\n 'to have your datasets automatically paired based on name.',\n '
                                                                • ',\n '
                                                                '\n ].join( '' )), '

                                                                ',\n '

                                                                ', _l([\n '

                                                                  You can filter what is shown in the unpaired sections by:',\n '
                                                                • Entering partial dataset names in either the ',\n 'forward filter or ',\n 'reverse filter.',\n '
                                                                • ',\n '
                                                                • Choosing from a list of preset filters by clicking the ',\n '\"Choose filters\" link.',\n '
                                                                • ',\n '
                                                                • Entering regular expressions to match dataset names. See: ',\n 'MDN\\'s JavaScript Regular Expression Tutorial. ',\n 'Note: forward slashes (\\\\) are not needed.',\n '
                                                                • ',\n '
                                                                • Clearing the filters by clicking the ',\n '\"Clear filters\" link.',\n '
                                                                • ',\n '
                                                                '\n ].join( '' )), '

                                                                ',\n '

                                                                ', _l([\n 'To unpair individual dataset pairs, click the ',\n 'unpair buttons ( ). ',\n 'Click the \"Unpair all\" link to unpair all pairs.'\n ].join( '' )), '

                                                                ',\n '

                                                                ', _l([\n 'You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ',\n '\"Remove file extensions from pair names?\" control.'\n ].join( '' )), '

                                                                ',\n '

                                                                ', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\". ',\n '(Note: you do not have to pair all unpaired datasets to finish.)'\n ].join( '' )), '

                                                                '\n ].join(''))\n })\n});\n\n//=============================================================================\n/** a modal version of the paired collection creator */\nvar pairedCollectionCreatorModal = function _pairedCollectionCreatorModal( datasets, options ){\n\n var deferred = jQuery.Deferred(),\n creator;\n\n options = _.defaults( options || {}, {\n datasets : datasets,\n oncancel : function(){\n Galaxy.modal.hide();\n deferred.reject( 'cancelled' );\n },\n oncreate : function( creator, response ){\n Galaxy.modal.hide();\n deferred.resolve( response );\n }\n });\n\n if( !window.Galaxy || !Galaxy.modal ){\n throw new Error( 'Galaxy or Galaxy.modal not found' );\n }\n\n creator = new PairedCollectionCreator( options );\n Galaxy.modal.show({\n title : 'Create a collection of paired datasets',\n body : creator.$el,\n width : '80%',\n height : '800px',\n closing_events: true\n });\n creator.render();\n window.creator = creator;\n\n //TODO: remove modal header\n return deferred;\n};\n\n\n//=============================================================================\nfunction createListOfPairsCollection( collection, defaultHideSourceItems ){\n var elements = collection.toJSON();\n//TODO: validate elements\n return pairedCollectionCreatorModal( elements, {\n historyId : collection.historyId,\n defaultHideSourceItems: defaultHideSourceItems\n });\n}\n\n\n//=============================================================================\n return {\n PairedCollectionCreator : PairedCollectionCreator,\n pairedCollectionCreatorModal : pairedCollectionCreatorModal,\n createListOfPairsCollection : createListOfPairsCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js","define([\n \"mvc/collection/list-collection-creator\",\n \"mvc/history/hdca-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_CREATOR, HDCA, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/*==============================================================================\nTODO:\n the paired creator doesn't really mesh with the list creator as parent\n it may be better to make an abstract super class for both\n composites may inherit from this (or vis-versa)\n PairedDatasetCollectionElementView doesn't make a lot of sense\n\n==============================================================================*/\n/** */\nvar PairedDatasetCollectionElementView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n//TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName : 'li',\n className : 'collection-element',\n\n initialize : function( attributes ){\n this.element = attributes.element || {};\n this.identifier = attributes.identifier;\n },\n\n render : function(){\n this.$el\n .attr( 'data-element-id', this.element.id )\n .html( this.template({ identifier: this.identifier, element: this.element }) );\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template : _.template([\n '<%- identifier %>',\n '<%- element.name %>',\n ].join('')),\n\n /** remove the DOM and any listeners */\n destroy : function(){\n this.off();\n this.$el.remove();\n },\n\n /** string rep */\n toString : function(){\n return 'DatasetCollectionElementView()';\n }\n});\n\n\n// ============================================================================\nvar _super = LIST_CREATOR.ListCollectionCreator;\n\n/** An interface for building collections.\n */\nvar PairCollectionCreator = _super.extend({\n\n /** the class used to display individual elements */\n elementViewClass : PairedDatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass : HDCA.HistoryPairDatasetCollection,\n className : 'pair-collection-creator collection-creator flex-row-container',\n\n /** override to no-op */\n _mangleDuplicateNames : function(){},\n\n // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n // bad inital choices and\n // when the user has painted his/her self into a corner during creation/use-of-the-creator\n /** render the entire interface */\n render : function( speed, callback ){\n if( this.workingElements.length === 2 ){\n return _super.prototype.render.call( this, speed, callback );\n }\n return this._renderInvalid( speed, callback );\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** render forward/reverse */\n _renderList : function( speed, callback ){\n //this.debug( '-- _renderList' );\n //precondition: there are two valid elements in workingElements\n var creator = this,\n $tmp = jQuery( '
                                                                ' ),\n $list = creator.$list();\n\n // lose the original views, create the new, append all at once, then call their renders\n _.each( this.elementViews, function( view ){\n view.destroy();\n creator.removeElementView( view );\n });\n $tmp.append( creator._createForwardElementView().$el );\n $tmp.append( creator._createReverseElementView().$el );\n $list.empty().append( $tmp.children() );\n _.invoke( creator.elementViews, 'render' );\n },\n\n /** create the forward element view */\n _createForwardElementView : function(){\n return this._createElementView( this.workingElements[0], { identifier: 'forward' } );\n },\n\n /** create the forward element view */\n _createReverseElementView : function(){\n return this._createElementView( this.workingElements[1], { identifier: 'reverse' } );\n },\n\n /** create an element view, cache in elementViews, and return */\n _createElementView : function( element, options ){\n var elementView = new this.elementViewClass( _.extend( options, {\n element : element,\n }));\n this.elementViews.push( elementView );\n return elementView;\n },\n\n /** swap the forward, reverse elements and re-render */\n swap : function(){\n this.workingElements = [\n this.workingElements[1],\n this.workingElements[0],\n ];\n this._renderList();\n },\n\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .swap' : 'swap',\n }),\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates : _.extend( _.clone( _super.prototype.templates ), {\n /** the middle: element list */\n middle : _.template([\n '',\n '
                                                                ',\n '
                                                                '\n ].join('')),\n\n /** help content */\n helpContent : _.template([\n '

                                                                ', _l([\n 'Pair collections are permanent collections containing two datasets: one forward and one reverse. ',\n 'Often these are forward and reverse reads. The pair collections can be passed to tools and ',\n 'workflows in order to have analyses done on both datasets. This interface allows ',\n 'you to create a pair, name it, and swap which is forward and which reverse.'\n ].join( '' )), '

                                                                ',\n '
                                                                  ',\n '
                                                                • ', _l([\n 'Click the \"Swap\" link to make your forward dataset the reverse ',\n 'and the reverse dataset forward.'\n ].join( '' )), '
                                                                • ',\n '
                                                                • ', _l([\n 'Click the \"Cancel\" button to exit the interface.'\n ].join( '' )), '
                                                                • ',\n '

                                                                ',\n '

                                                                ', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '

                                                                '\n ].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial : _.template([\n '
                                                                ',\n '
                                                                ',\n '',\n '<% if( _.size( problems ) ){ %>',\n _l( 'The following selections could not be included due to problems' ),\n '
                                                                  <% _.each( problems, function( problem ){ %>',\n '
                                                                • <%- problem.element.name %>: <%- problem.text %>
                                                                • ',\n '<% }); %>
                                                                ',\n '<% } else if( _.size( elements ) === 0 ){ %>',\n _l( 'No datasets were selected' ), '.',\n '<% } else if( _.size( elements ) === 1 ){ %>',\n _l( 'Only one dataset was selected' ), ': <%- elements[0].name %>',\n '<% } else if( _.size( elements ) > 2 ){ %>',\n _l( 'Too many datasets were selected' ),\n ': <%- _.pluck( elements, \"name\" ).join( \", \") %>',\n '<% } %>',\n '
                                                                ',\n _l( 'Two (and only two) elements are needed for the pair' ), '. ',\n _l( 'You may need to ' ),\n '', _l( 'cancel' ), ' ',\n _l( 'and reselect new elements' ), '.',\n '
                                                                ',\n '
                                                                ',\n '
                                                                ',\n '
                                                                ',\n '
                                                                ',\n '
                                                                ',\n '',\n // _l( 'Create a different kind of collection' ),\n '
                                                                ',\n '
                                                                ',\n '
                                                                '\n ].join('')),\n }),\n\n // ------------------------------------------------------------------------ misc\n /** string rep */\n toString : function(){ return 'PairCollectionCreator'; }\n});\n\n\n//==============================================================================\n/** List collection flavor of collectionCreatorModal. */\nvar pairCollectionCreatorModal = function _pairCollectionCreatorModal( elements, options ){\n options = options || {};\n options.title = _l( 'Create a collection from a pair of datasets' );\n return LIST_CREATOR.collectionCreatorModal( elements, options, PairCollectionCreator );\n};\n\n\n//==============================================================================\n/** Use a modal to create a pair collection, then add it to the given history contents.\n * @returns {Deferred} resolved when the collection is added to the history.\n */\nfunction createPairCollection( contents, defaultHideSourceItems ){\n var elements = contents.toJSON(),\n promise = pairCollectionCreatorModal( elements, {\n defaultHideSourceItems: defaultHideSourceItems,\n creationFn : function( elements, name, hideSourceItems ){\n elements = [\n { name: \"forward\", src: \"hda\", id: elements[0].id },\n { name: \"reverse\", src: \"hda\", id: elements[1].id }\n ];\n return contents.createHDCA( elements, 'paired', name, hideSourceItems );\n }\n });\n return promise;\n}\n\n//==============================================================================\n return {\n PairCollectionCreator : PairCollectionCreator,\n pairCollectionCreatorModal : pairCollectionCreatorModal,\n createPairCollection : createPairCollection,\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/pair-collection-creator.js","\ndefine( [ 'utils/utils', 'mvc/ui/ui-tabs', 'mvc/ui/ui-misc', 'mvc/form/form-view' ], function( Utils, Tabs, Ui, Form ) {\n\n /** Dataset edit attributes view */\n var View = Backbone.View.extend({\n initialize: function() {\n this.setElement( '
                                                                ' );\n this.model = new Backbone.Model( { 'dataset_id': Galaxy.params.dataset_id } );\n this.render();\n },\n\n // Fetch data for the selected dataset and \n // build tabs for editing its attributes\n render: function() {\n var url = Galaxy.root + 'dataset/edit',\n self = this;\n Utils.get({\n url : url,\n data : { 'dataset_id' : self.model.get( 'dataset_id' ) },\n success : function( response ) {\n self.render_attribute_page( self, response );\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while loading the dataset.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n\n /** Render all the tabs view */\n render_attribute_page: function( self, response ) {\n var message = {\n 'message' : response.message,\n 'status' : response.status,\n 'persistent' : true,\n 'cls' : response.status + 'message'\n };\n self.$el.empty().append( self._templateHeader() );\n self.display_message( message, self.$( '.response-message' ) );\n // Create all tabs\n self.create_tabs( response, self.$( '.edit-attr' ) );\n },\n\n /** Perform AJAX post call */\n call_ajax: function( self, data, tab_name ) {\n var post_url = Galaxy.root + 'dataset/edit';\n $.ajax({\n type: \"PUT\",\n url: post_url,\n data: data,\n success: function( response ) {\n self.render_attribute_page( self, response );\n self.reload_history();\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n\n /** Display actions messages */\n display_message: function( response, $el ) {\n $el.empty().html( new Ui.Message( response ).$el );\n },\n\n /** Create tabs for different attributes of dataset*/\n create_tabs: function( response, $el_edit_attr ) {\n var self = this;\n self.tabs = new Tabs.View();\n self.tabs.add({\n id : 'attributes',\n title : 'Attributes',\n icon : 'fa fa-bars',\n tooltip : 'Edit dataset attributes',\n $el : self._getAttributesFormTemplate( response )\n });\n\n self.tabs.add({\n id : 'convert',\n title : 'Convert',\n icon : 'fa-gear',\n tooltip : 'Convert to new format',\n $el : self._getConvertFormTemplate( response )\n });\n\n self.tabs.add({\n id : 'datatype',\n title : 'Datatypes',\n icon : 'fa-database',\n tooltip : 'Change data type',\n $el : self._getChangeDataTypeFormTemplate( response )\n });\n\n self.tabs.add({\n id : 'permissions',\n title : 'Permissions',\n icon : 'fa-user',\n tooltip : 'Permissions',\n $el : self._getPermissionsFormTemplate( response )\n });\n $el_edit_attr.append( self.tabs.$el );\n self.tabs.showTab( 'attributes' );\n },\n\n /** Main template */\n _templateHeader: function() {\n return '
                                                                ' +\n '
                                                                ' +\n '

                                                                Edit Dataset Attributes

                                                                ' +\n '
                                                                ';\n },\n\n /** Attributes tab template */\n _getAttributesFormTemplate: function( response ) {\n var self = this;\n var form = new Form({\n title : 'Edit attributes',\n inputs : response.edit_attributes_inputs,\n operations: {\n 'submit_editattr' : new Ui.ButtonIcon({\n tooltip : 'Save attributes of the dataset.',\n icon : 'fa-floppy-o ',\n title : 'Save attributes',\n onclick : function() { self._submit( self, form, response, \"edit_attributes\" ) }\n }),\n 'submit_autocorrect' : new Ui.ButtonIcon({\n tooltip : 'This will inspect the dataset and attempt to correct the values of fields if they are not accurate.',\n icon : 'fa-undo ',\n title : 'Auto-detect',\n onclick : function() { self._submit( self, form, response, \"auto-detect\" ) }\n })\n }\n });\n return form.$el;\n },\n\n /** Convert tab template */\n _getConvertFormTemplate: function( response ) {\n var self = this;\n var form = new Form({\n title : 'Convert to new format',\n inputs : response.convert_inputs,\n operations: {\n 'submit' : new Ui.ButtonIcon({\n tooltip : 'Convert the datatype to a new format.',\n title : 'Convert datatype',\n icon : 'fa-exchange ',\n onclick : function() { self._submit( self, form, response, \"convert\" ) }\n })\n }\n });\n return form.$el;\n },\n\n /** Change datatype template */\n _getChangeDataTypeFormTemplate: function( response ) {\n var self = this;\n var form = new Form({\n title : 'Change datatype',\n inputs : response.convert_datatype_inputs,\n operations: {\n 'submit' : new Ui.ButtonIcon({\n tooltip : 'Change the datatype to a new type.',\n title : 'Change datatype',\n icon : 'fa-exchange ',\n onclick : function() { self._submit( self, form, response, \"change\" ) }\n })\n }\n });\n return form.$el;\n },\n\n /** Permissions template */\n _getPermissionsFormTemplate: function( response ) {\n var template = \"\",\n self = this;\n if( response.can_manage_dataset ) {\n var form = new Form({\n title : 'Manage dataset permissions on ' + response.display_name,\n inputs : response.permission_inputs,\n operations: {\n 'submit': new Ui.ButtonIcon({\n tooltip : 'Save permissions.',\n title : 'Save permissions',\n icon : 'fa-floppy-o ',\n onclick : function() { self._submit( self, form, response, \"permissions\" ) }\n })\n }\n });\n return form.$el;\n }\n else {\n var form = new Form({\n title : 'View permissions',\n inputs : response.permission_inputs\n });\n return form.$el;\n }\n },\n\n /** Submit action */\n _submit: function( self, form, response, type ) {\n var form_data = form.data.create();\n form_data.dataset_id = response.dataset_id;\n switch( type ) {\n case \"edit_attributes\":\n form_data.save = 'Save';\n break;\n\n case \"auto-detect\":\n form_data.detect = 'Auto-detect';\n break;\n \n case \"convert\":\n if ( form_data.target_type !== null && form_data.target_type ) {\n form_data.dataset_id = response.dataset_id;\n form_data.convert_data = 'Convert';\n }\n break;\n\n case \"change\":\n form_data.change = 'Save';\n break;\n\n case \"permissions\":\n var post_data = {};\n post_data.permissions = JSON.stringify( form_data );\n post_data.update_roles_button = \"Save\";\n post_data.dataset_id = response.dataset_id;\n form_data = post_data;\n break; \n }\n self.call_ajax( self, form_data );\n },\n\n /** Reload Galaxy's history after updating dataset's attributes */\n reload_history: function() {\n if ( window.Galaxy ) {\n window.Galaxy.currHistoryPanel.loadCurrentHistory();\n }\n }\n });\n\n return {\n View : View\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-edit-attributes.js","define( [ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/form/form-view' ], function( Utils, Ui, Form ) {\n\n /** Dataset edit attributes view */\n var View = Backbone.View.extend({\n initialize: function() {\n this.setElement( '
                                                                ' );\n this.model = new Backbone.Model( { 'dataset_id': Galaxy.params.dataset_id } );\n this.render();\n },\n\n // Fetch data for the selected dataset and\n render: function() {\n var data_url = Galaxy.root + 'api/datasets/' + this.model.get( 'dataset_id' ),\n self = this;\n\n Utils.get({\n url : data_url,\n success : function( dataset ) {\n var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n Utils.get({\n url : job_url,\n success : function( job ) {\n var job_url = Galaxy.root + 'api/jobs/' + dataset.creating_job + '?full=True';\n self.render_error_page( self, dataset, job );\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while loading the job.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while loading the dataset.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n },\n\n /** Render the view */\n render_error_page: function( self, dataset, job ) {\n self.$el.empty().append( self._templateHeader() );\n self.$el.append('

                                                                Dataset Error

                                                                ');\n self.$el.append('

                                                                An error occured while running the tool ' + job.tool_id + '.

                                                                ');\n self.$el.append('

                                                                Tool execution generated the following messages:

                                                                ');\n self.$el.append('
                                                                ' + job.stderr + '
                                                                ');\n self.$el.append('

                                                                Report This Error

                                                              1. ');\n self.$el.append('

                                                                Usually the local Galaxy administrators regularly review errors that occur on the server. However, if you would like to provide additional information (such as what you were trying to do when the error occurred) and a contact e-mail address, we will be better able to investigate your problem and get back to you.

                                                                ');\n self.$el.append(self._getBugFormTemplate(dataset, job));\n },\n\n /** Display actions messages */\n display_message: function( response, $el, doNotClear, safe ) {\n if(!safe){\n if(doNotClear) {\n $el.append( new Ui.Message( response ).$el );\n } else {\n $el.empty().html( new Ui.Message( response ).$el );\n }\n } else {\n if(doNotClear) {\n $el.append( new Ui.UnescapedMessage( response ).$el );\n } else {\n $el.empty().html( new Ui.UnescapedMessage( response ).$el );\n }\n }\n },\n\n /** Main template */\n _templateHeader: function() {\n return '
                                                                ' +\n '
                                                                ' +\n '
                                                                ';\n },\n\n /** Convert tab template */\n _getBugFormTemplate: function(dataset, job) {\n var self = this;\n var inputs = [\n {\n \"help\": \"Your email address\",\n \"options\": [],\n \"type\": \"text\",\n \"name\": \"email\",\n \"label\": \"Your email\",\n \"value\": Galaxy.user.get('email')\n },\n {\n \"help\": \"Any additional comments you can provide regarding what you were doing at the time of the bug.\",\n \"options\": [],\n \"type\": \"text\",\n \"area\": true,\n \"name\": \"message\",\n \"label\": \"Message\"\n }\n ];\n\n // TODO\n if(false && response.any_public){\n inputs.push({\n \"name\": \"public_consent\",\n \"label\": \"Public Disclosure Consent\",\n \"help\": \"This Galaxy is configured to report to one or more error reporting backends that public to the world. By selecting 'yes', you acknowledge that this bug report will be made public.\",\n \"value\": String( Boolean( false ) ),\n \"options\": [],\n \"type\": \"boolean\",\n })\n }\n\n var form = new Form({\n title : 'Error Report',\n inputs : inputs,\n buttons : {\n save : new Ui.Button({\n icon : 'fa-bug',\n title : 'Report',\n cls : 'ui-button btn btn-primary',\n floating : 'clear',\n onclick : function() {\n var form_data = form.data.create();\n var url = Galaxy.root + 'api/jobs/' + job.id + '/error'\n form_data.dataset_id = dataset.id;\n self.submit(form_data, url)\n }\n })\n },\n });\n return form.$el;\n },\n\n /** Make ajax request */\n submit : function(form_data, url){\n var self = this;\n // Some required metadata\n $.ajax({\n type: \"POST\",\n url: url,\n data: form_data,\n success: function( response ) {\n // Clear out the div\n self.$el.empty().append( self._templateHeader() );\n // And display the messages.\n response.messages.forEach(function(message){\n self.display_message( {\n 'status': message[1],\n 'message': message[0],\n 'persistent': true,\n }, self.$( '.response-message' ), true, true );\n });\n },\n error : function( response ) {\n var error_response = {\n 'status': 'error',\n 'message': 'Error occured while saving. Please fill all the required fields and try again.',\n 'persistent': true,\n 'cls': 'errormessage'\n };\n self.display_message( error_response, self.$( '.response-message' ) );\n }\n });\n }\n });\n\n return {\n View : View\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/dataset/dataset-error.js","/** This class renders the grid list with shared section. */\ndefine( [ 'mvc/grid/grid-view' ], function( GridView ) {\n var View = Backbone.View.extend({\n initialize: function( options ) {\n var self = this;\n this.setElement( $( '
                                                                ' ) );\n this.model = new Backbone.Model( options );\n this.item = this.model.get( 'item' );\n $.ajax({\n url : Galaxy.root + this.item + '/' + this.model.get( 'action_id' ),\n success : function( response ) {\n response[ 'dict_format' ] = true;\n self.model.set( response );\n self.render();\n }\n });\n },\n\n render: function() {\n var grid = new GridView( this.model.attributes );\n this.$el.empty().append( grid.$el );\n this.$el.append( this._templateShared() );\n },\n\n _templateShared: function() {\n var self = this;\n var $tmpl = $( '
                                                                ' +\n '

                                                                ' + this.model.get( 'plural' ) + ' shared with you by others

                                                                ' +\n '
                                                                ' );\n var options = this.model.attributes;\n if ( options.shared_by_others && options.shared_by_others.length > 0 ) {\n var $table = $( '' +\n '' +\n '' +\n '' +\n '' +\n '
                                                                TitleOwner
                                                                ' );\n _.each( options.shared_by_others, function( it, index ) {\n var display_url = Galaxy.root + self.item + '/display_by_username_and_slug?username=' + it.username + '&slug=' + it.slug;\n $table.append( '
                                                                ' +\n '' + _.escape( it.title ) + '' +\n '' + _.escape( it.username ) + '
                                                                ' +\n '
                                                                ' +\n '
                                                                ' +\n '
                                                                ' +\n '
                                                                ' +\n '
                                                                You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.
                                                                ' +\n '\";\n\t\t\tsupport.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;\n\t\n\t\t\t// #11217 - WebKit loses check when the name is after the checked attribute\n\t\t\tfragment.appendChild(div);\n\t\n\t\t\t// Support: Windows Web Apps (WWA)\n\t\t\t// `name` and `type` must use .setAttribute for WWA (#14901)\n\t\t\tinput = document.createElement(\"input\");\n\t\t\tinput.setAttribute(\"type\", \"radio\");\n\t\t\tinput.setAttribute(\"checked\", \"checked\");\n\t\t\tinput.setAttribute(\"name\", \"t\");\n\t\n\t\t\tdiv.appendChild(input);\n\t\n\t\t\t// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3\n\t\t\t// old WebKit doesn't clone checked state correctly in fragments\n\t\t\tsupport.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;\n\t\n\t\t\t// Support: IE<9\n\t\t\t// Cloned elements keep attachEvent handlers, we use addEventListener on IE9+\n\t\t\tsupport.noCloneEvent = !!div.addEventListener;\n\t\n\t\t\t// Support: IE<9\n\t\t\t// Since attributes and properties are the same in IE,\n\t\t\t// cleanData must set properties to undefined rather than use removeAttribute\n\t\t\tdiv[jQuery.expando] = 1;\n\t\t\tsupport.attributes = !div.getAttribute(jQuery.expando);\n\t\t})();\n\t\n\t\t// We have to close these tags to support XHTML (#13200)\n\t\tvar wrapMap = {\n\t\t\toption: [1, \"\"],\n\t\t\tlegend: [1, \"
                                                                \", \"
                                                                \"],\n\t\t\tarea: [1, \"\", \"\"],\n\t\n\t\t\t// Support: IE8\n\t\t\tparam: [1, \"\", \"\"],\n\t\t\tthead: [1, \"\", \"
                                                                \"],\n\t\t\ttr: [2, \"\", \"
                                                                \"],\n\t\t\tcol: [2, \"\", \"
                                                                \"],\n\t\t\ttd: [3, \"\", \"
                                                                \"],\n\t\n\t\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\t\t_default: support.htmlSerialize ? [0, \"\", \"\"] : [1, \"X
                                                                \", \"
                                                                \"]\n\t\t};\n\t\n\t\t// Support: IE8-IE9\n\t\twrapMap.optgroup = wrapMap.option;\n\t\n\t\twrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n\t\twrapMap.th = wrapMap.td;\n\t\n\t\tfunction getAll(context, tag) {\n\t\t\tvar elems,\n\t\t\t elem,\n\t\t\t i = 0,\n\t\t\t found = typeof context.getElementsByTagName !== \"undefined\" ? context.getElementsByTagName(tag || \"*\") : typeof context.querySelectorAll !== \"undefined\" ? context.querySelectorAll(tag || \"*\") : undefined;\n\t\n\t\t\tif (!found) {\n\t\t\t\tfor (found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++) {\n\t\t\t\t\tif (!tag || jQuery.nodeName(elem, tag)) {\n\t\t\t\t\t\tfound.push(elem);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery.merge(found, getAll(elem, tag));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn tag === undefined || tag && jQuery.nodeName(context, tag) ? jQuery.merge([context], found) : found;\n\t\t}\n\t\n\t\t// Mark scripts as having already been evaluated\n\t\tfunction setGlobalEval(elems, refElements) {\n\t\t\tvar elem,\n\t\t\t i = 0;\n\t\t\tfor (; (elem = elems[i]) != null; i++) {\n\t\t\t\tjQuery._data(elem, \"globalEval\", !refElements || jQuery._data(refElements[i], \"globalEval\"));\n\t\t\t}\n\t\t}\n\t\n\t\tvar rhtml = /<|&#?\\w+;/,\n\t\t rtbody = /
                                                                , *may* have spurious \n\t\t\t\t\t\t\telem = tag === \"table\" && !rtbody.test(elem) ? tmp.firstChild :\n\t\n\t\t\t\t\t\t\t// String was a bare or \n\t\t\t\t\t\t\twrap[1] === \"
                                                                \" && !rtbody.test(elem) ? tmp : 0;\n\t\n\t\t\t\t\t\t\tj = elem && elem.childNodes.length;\n\t\t\t\t\t\t\twhile (j--) {\n\t\t\t\t\t\t\t\tif (jQuery.nodeName(tbody = elem.childNodes[j], \"tbody\") && !tbody.childNodes.length) {\n\t\n\t\t\t\t\t\t\t\t\telem.removeChild(tbody);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tjQuery.merge(nodes, tmp.childNodes);\n\t\n\t\t\t\t\t\t// Fix #12392 for WebKit and IE > 9\n\t\t\t\t\t\ttmp.textContent = \"\";\n\t\n\t\t\t\t\t\t// Fix #12392 for oldIE\n\t\t\t\t\t\twhile (tmp.firstChild) {\n\t\t\t\t\t\t\ttmp.removeChild(tmp.firstChild);\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Remember the top-level container for proper cleanup\n\t\t\t\t\t\ttmp = safe.lastChild;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Fix #11356: Clear elements from fragment\n\t\t\tif (tmp) {\n\t\t\t\tsafe.removeChild(tmp);\n\t\t\t}\n\t\n\t\t\t// Reset defaultChecked for any radios and checkboxes\n\t\t\t// about to be appended to the DOM in IE 6/7 (#8060)\n\t\t\tif (!support.appendChecked) {\n\t\t\t\tjQuery.grep(getAll(nodes, \"input\"), fixDefaultChecked);\n\t\t\t}\n\t\n\t\t\ti = 0;\n\t\t\twhile (elem = nodes[i++]) {\n\t\n\t\t\t\t// Skip elements already in the context collection (trac-4087)\n\t\t\t\tif (selection && jQuery.inArray(elem, selection) > -1) {\n\t\t\t\t\tif (ignored) {\n\t\t\t\t\t\tignored.push(elem);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\n\t\t\t\tcontains = jQuery.contains(elem.ownerDocument, elem);\n\t\n\t\t\t\t// Append to fragment\n\t\t\t\ttmp = getAll(safe.appendChild(elem), \"script\");\n\t\n\t\t\t\t// Preserve script evaluation history\n\t\t\t\tif (contains) {\n\t\t\t\t\tsetGlobalEval(tmp);\n\t\t\t\t}\n\t\n\t\t\t\t// Capture executables\n\t\t\t\tif (scripts) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile (elem = tmp[j++]) {\n\t\t\t\t\t\tif (rscriptType.test(elem.type || \"\")) {\n\t\t\t\t\t\t\tscripts.push(elem);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\ttmp = null;\n\t\n\t\t\treturn safe;\n\t\t}\n\t\n\t\t(function () {\n\t\t\tvar i,\n\t\t\t eventName,\n\t\t\t div = document.createElement(\"div\");\n\t\n\t\t\t// Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events)\n\t\t\tfor (i in { submit: true, change: true, focusin: true }) {\n\t\t\t\teventName = \"on\" + i;\n\t\n\t\t\t\tif (!(support[i] = eventName in window)) {\n\t\n\t\t\t\t\t// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)\n\t\t\t\t\tdiv.setAttribute(eventName, \"t\");\n\t\t\t\t\tsupport[i] = div.attributes[eventName].expando === false;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Null elements to avoid leaks in IE.\n\t\t\tdiv = null;\n\t\t})();\n\t\n\t\tvar rformElems = /^(?:input|select|textarea)$/i,\n\t\t rkeyEvent = /^key/,\n\t\t rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,\n\t\t rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\n\t\t rtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n\t\n\t\tfunction returnTrue() {\n\t\t\treturn true;\n\t\t}\n\t\n\t\tfunction returnFalse() {\n\t\t\treturn false;\n\t\t}\n\t\n\t\t// Support: IE9\n\t\t// See #13393 for more info\n\t\tfunction safeActiveElement() {\n\t\t\ttry {\n\t\t\t\treturn document.activeElement;\n\t\t\t} catch (err) {}\n\t\t}\n\t\n\t\tfunction on(elem, types, selector, data, fn, one) {\n\t\t\tvar origFn, type;\n\t\n\t\t\t// Types can be a map of types/handlers\n\t\t\tif (typeof types === \"object\") {\n\t\n\t\t\t\t// ( types-Object, selector, data )\n\t\t\t\tif (typeof selector !== \"string\") {\n\t\n\t\t\t\t\t// ( types-Object, data )\n\t\t\t\t\tdata = data || selector;\n\t\t\t\t\tselector = undefined;\n\t\t\t\t}\n\t\t\t\tfor (type in types) {\n\t\t\t\t\ton(elem, type, selector, data, types[type], one);\n\t\t\t\t}\n\t\t\t\treturn elem;\n\t\t\t}\n\t\n\t\t\tif (data == null && fn == null) {\n\t\n\t\t\t\t// ( types, fn )\n\t\t\t\tfn = selector;\n\t\t\t\tdata = selector = undefined;\n\t\t\t} else if (fn == null) {\n\t\t\t\tif (typeof selector === \"string\") {\n\t\n\t\t\t\t\t// ( types, selector, fn )\n\t\t\t\t\tfn = data;\n\t\t\t\t\tdata = undefined;\n\t\t\t\t} else {\n\t\n\t\t\t\t\t// ( types, data, fn )\n\t\t\t\t\tfn = data;\n\t\t\t\t\tdata = selector;\n\t\t\t\t\tselector = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (fn === false) {\n\t\t\t\tfn = returnFalse;\n\t\t\t} else if (!fn) {\n\t\t\t\treturn elem;\n\t\t\t}\n\t\n\t\t\tif (one === 1) {\n\t\t\t\torigFn = fn;\n\t\t\t\tfn = function (event) {\n\t\n\t\t\t\t\t// Can use an empty set, since event contains the info\n\t\t\t\t\tjQuery().off(event);\n\t\t\t\t\treturn origFn.apply(this, arguments);\n\t\t\t\t};\n\t\n\t\t\t\t// Use same guid so caller can remove using origFn\n\t\t\t\tfn.guid = origFn.guid || (origFn.guid = jQuery.guid++);\n\t\t\t}\n\t\t\treturn elem.each(function () {\n\t\t\t\tjQuery.event.add(this, types, fn, data, selector);\n\t\t\t});\n\t\t}\n\t\n\t\t/*\n\t * Helper functions for managing events -- not part of the public interface.\n\t * Props to Dean Edwards' addEvent library for many of the ideas.\n\t */\n\t\tjQuery.event = {\n\t\n\t\t\tglobal: {},\n\t\n\t\t\tadd: function (elem, types, handler, data, selector) {\n\t\t\t\tvar tmp,\n\t\t\t\t events,\n\t\t\t\t t,\n\t\t\t\t handleObjIn,\n\t\t\t\t special,\n\t\t\t\t eventHandle,\n\t\t\t\t handleObj,\n\t\t\t\t handlers,\n\t\t\t\t type,\n\t\t\t\t namespaces,\n\t\t\t\t origType,\n\t\t\t\t elemData = jQuery._data(elem);\n\t\n\t\t\t\t// Don't attach events to noData or text/comment nodes (but allow plain objects)\n\t\t\t\tif (!elemData) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// Caller can pass in an object of custom data in lieu of the handler\n\t\t\t\tif (handler.handler) {\n\t\t\t\t\thandleObjIn = handler;\n\t\t\t\t\thandler = handleObjIn.handler;\n\t\t\t\t\tselector = handleObjIn.selector;\n\t\t\t\t}\n\t\n\t\t\t\t// Make sure that the handler has a unique ID, used to find/remove it later\n\t\t\t\tif (!handler.guid) {\n\t\t\t\t\thandler.guid = jQuery.guid++;\n\t\t\t\t}\n\t\n\t\t\t\t// Init the element's event structure and main handler, if this is the first\n\t\t\t\tif (!(events = elemData.events)) {\n\t\t\t\t\tevents = elemData.events = {};\n\t\t\t\t}\n\t\t\t\tif (!(eventHandle = elemData.handle)) {\n\t\t\t\t\teventHandle = elemData.handle = function (e) {\n\t\n\t\t\t\t\t\t// Discard the second event of a jQuery.event.trigger() and\n\t\t\t\t\t\t// when an event is called after a page has unloaded\n\t\t\t\t\t\treturn typeof jQuery !== \"undefined\" && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply(eventHandle.elem, arguments) : undefined;\n\t\t\t\t\t};\n\t\n\t\t\t\t\t// Add elem as a property of the handle fn to prevent a memory leak\n\t\t\t\t\t// with IE non-native events\n\t\t\t\t\teventHandle.elem = elem;\n\t\t\t\t}\n\t\n\t\t\t\t// Handle multiple events separated by a space\n\t\t\t\ttypes = (types || \"\").match(rnotwhite) || [\"\"];\n\t\t\t\tt = types.length;\n\t\t\t\twhile (t--) {\n\t\t\t\t\ttmp = rtypenamespace.exec(types[t]) || [];\n\t\t\t\t\ttype = origType = tmp[1];\n\t\t\t\t\tnamespaces = (tmp[2] || \"\").split(\".\").sort();\n\t\n\t\t\t\t\t// There *must* be a type, no attaching namespace-only handlers\n\t\t\t\t\tif (!type) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If event changes its type, use the special event handlers for the changed type\n\t\t\t\t\tspecial = jQuery.event.special[type] || {};\n\t\n\t\t\t\t\t// If selector defined, determine special event api type, otherwise given type\n\t\t\t\t\ttype = (selector ? special.delegateType : special.bindType) || type;\n\t\n\t\t\t\t\t// Update special based on newly reset type\n\t\t\t\t\tspecial = jQuery.event.special[type] || {};\n\t\n\t\t\t\t\t// handleObj is passed to all event handlers\n\t\t\t\t\thandleObj = jQuery.extend({\n\t\t\t\t\t\ttype: type,\n\t\t\t\t\t\torigType: origType,\n\t\t\t\t\t\tdata: data,\n\t\t\t\t\t\thandler: handler,\n\t\t\t\t\t\tguid: handler.guid,\n\t\t\t\t\t\tselector: selector,\n\t\t\t\t\t\tneedsContext: selector && jQuery.expr.match.needsContext.test(selector),\n\t\t\t\t\t\tnamespace: namespaces.join(\".\")\n\t\t\t\t\t}, handleObjIn);\n\t\n\t\t\t\t\t// Init the event handler queue if we're the first\n\t\t\t\t\tif (!(handlers = events[type])) {\n\t\t\t\t\t\thandlers = events[type] = [];\n\t\t\t\t\t\thandlers.delegateCount = 0;\n\t\n\t\t\t\t\t\t// Only use addEventListener/attachEvent if the special events handler returns false\n\t\t\t\t\t\tif (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {\n\t\n\t\t\t\t\t\t\t// Bind the global event handler to the element\n\t\t\t\t\t\t\tif (elem.addEventListener) {\n\t\t\t\t\t\t\t\telem.addEventListener(type, eventHandle, false);\n\t\t\t\t\t\t\t} else if (elem.attachEvent) {\n\t\t\t\t\t\t\t\telem.attachEvent(\"on\" + type, eventHandle);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (special.add) {\n\t\t\t\t\t\tspecial.add.call(elem, handleObj);\n\t\n\t\t\t\t\t\tif (!handleObj.handler.guid) {\n\t\t\t\t\t\t\thandleObj.handler.guid = handler.guid;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Add to the element's handler list, delegates in front\n\t\t\t\t\tif (selector) {\n\t\t\t\t\t\thandlers.splice(handlers.delegateCount++, 0, handleObj);\n\t\t\t\t\t} else {\n\t\t\t\t\t\thandlers.push(handleObj);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Keep track of which events have ever been used, for event optimization\n\t\t\t\t\tjQuery.event.global[type] = true;\n\t\t\t\t}\n\t\n\t\t\t\t// Nullify elem to prevent memory leaks in IE\n\t\t\t\telem = null;\n\t\t\t},\n\t\n\t\t\t// Detach an event or set of events from an element\n\t\t\tremove: function (elem, types, handler, selector, mappedTypes) {\n\t\t\t\tvar j,\n\t\t\t\t handleObj,\n\t\t\t\t tmp,\n\t\t\t\t origCount,\n\t\t\t\t t,\n\t\t\t\t events,\n\t\t\t\t special,\n\t\t\t\t handlers,\n\t\t\t\t type,\n\t\t\t\t namespaces,\n\t\t\t\t origType,\n\t\t\t\t elemData = jQuery.hasData(elem) && jQuery._data(elem);\n\t\n\t\t\t\tif (!elemData || !(events = elemData.events)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// Once for each type.namespace in types; type may be omitted\n\t\t\t\ttypes = (types || \"\").match(rnotwhite) || [\"\"];\n\t\t\t\tt = types.length;\n\t\t\t\twhile (t--) {\n\t\t\t\t\ttmp = rtypenamespace.exec(types[t]) || [];\n\t\t\t\t\ttype = origType = tmp[1];\n\t\t\t\t\tnamespaces = (tmp[2] || \"\").split(\".\").sort();\n\t\n\t\t\t\t\t// Unbind all events (on this namespace, if provided) for the element\n\t\t\t\t\tif (!type) {\n\t\t\t\t\t\tfor (type in events) {\n\t\t\t\t\t\t\tjQuery.event.remove(elem, type + types[t], handler, selector, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tspecial = jQuery.event.special[type] || {};\n\t\t\t\t\ttype = (selector ? special.delegateType : special.bindType) || type;\n\t\t\t\t\thandlers = events[type] || [];\n\t\t\t\t\ttmp = tmp[2] && new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\");\n\t\n\t\t\t\t\t// Remove matching events\n\t\t\t\t\torigCount = j = handlers.length;\n\t\t\t\t\twhile (j--) {\n\t\t\t\t\t\thandleObj = handlers[j];\n\t\n\t\t\t\t\t\tif ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === \"**\" && handleObj.selector)) {\n\t\t\t\t\t\t\thandlers.splice(j, 1);\n\t\n\t\t\t\t\t\t\tif (handleObj.selector) {\n\t\t\t\t\t\t\t\thandlers.delegateCount--;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (special.remove) {\n\t\t\t\t\t\t\t\tspecial.remove.call(elem, handleObj);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Remove generic event handler if we removed something and no more handlers exist\n\t\t\t\t\t// (avoids potential for endless recursion during removal of special event handlers)\n\t\t\t\t\tif (origCount && !handlers.length) {\n\t\t\t\t\t\tif (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {\n\t\n\t\t\t\t\t\t\tjQuery.removeEvent(elem, type, elemData.handle);\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tdelete events[type];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Remove the expando if it's no longer used\n\t\t\t\tif (jQuery.isEmptyObject(events)) {\n\t\t\t\t\tdelete elemData.handle;\n\t\n\t\t\t\t\t// removeData also checks for emptiness and clears the expando if empty\n\t\t\t\t\t// so use it instead of delete\n\t\t\t\t\tjQuery._removeData(elem, \"events\");\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\ttrigger: function (event, data, elem, onlyHandlers) {\n\t\t\t\tvar handle,\n\t\t\t\t ontype,\n\t\t\t\t cur,\n\t\t\t\t bubbleType,\n\t\t\t\t special,\n\t\t\t\t tmp,\n\t\t\t\t i,\n\t\t\t\t eventPath = [elem || document],\n\t\t\t\t type = hasOwn.call(event, \"type\") ? event.type : event,\n\t\t\t\t namespaces = hasOwn.call(event, \"namespace\") ? event.namespace.split(\".\") : [];\n\t\n\t\t\t\tcur = tmp = elem = elem || document;\n\t\n\t\t\t\t// Don't do events on text and comment nodes\n\t\t\t\tif (elem.nodeType === 3 || elem.nodeType === 8) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// focus/blur morphs to focusin/out; ensure we're not firing them right now\n\t\t\t\tif (rfocusMorph.test(type + jQuery.event.triggered)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tif (type.indexOf(\".\") > -1) {\n\t\n\t\t\t\t\t// Namespaced trigger; create a regexp to match event type in handle()\n\t\t\t\t\tnamespaces = type.split(\".\");\n\t\t\t\t\ttype = namespaces.shift();\n\t\t\t\t\tnamespaces.sort();\n\t\t\t\t}\n\t\t\t\tontype = type.indexOf(\":\") < 0 && \"on\" + type;\n\t\n\t\t\t\t// Caller can pass in a jQuery.Event object, Object, or just an event type string\n\t\t\t\tevent = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === \"object\" && event);\n\t\n\t\t\t\t// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n\t\t\t\tevent.isTrigger = onlyHandlers ? 2 : 3;\n\t\t\t\tevent.namespace = namespaces.join(\".\");\n\t\t\t\tevent.rnamespace = event.namespace ? new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\") : null;\n\t\n\t\t\t\t// Clean up the event in case it is being reused\n\t\t\t\tevent.result = undefined;\n\t\t\t\tif (!event.target) {\n\t\t\t\t\tevent.target = elem;\n\t\t\t\t}\n\t\n\t\t\t\t// Clone any incoming data and prepend the event, creating the handler arg list\n\t\t\t\tdata = data == null ? [event] : jQuery.makeArray(data, [event]);\n\t\n\t\t\t\t// Allow special events to draw outside the lines\n\t\t\t\tspecial = jQuery.event.special[type] || {};\n\t\t\t\tif (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// Determine event propagation path in advance, per W3C events spec (#9951)\n\t\t\t\t// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n\t\t\t\tif (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {\n\t\n\t\t\t\t\tbubbleType = special.delegateType || type;\n\t\t\t\t\tif (!rfocusMorph.test(bubbleType + type)) {\n\t\t\t\t\t\tcur = cur.parentNode;\n\t\t\t\t\t}\n\t\t\t\t\tfor (; cur; cur = cur.parentNode) {\n\t\t\t\t\t\teventPath.push(cur);\n\t\t\t\t\t\ttmp = cur;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Only add window if we got to document (e.g., not plain obj or detached DOM)\n\t\t\t\t\tif (tmp === (elem.ownerDocument || document)) {\n\t\t\t\t\t\teventPath.push(tmp.defaultView || tmp.parentWindow || window);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Fire handlers on the event path\n\t\t\t\ti = 0;\n\t\t\t\twhile ((cur = eventPath[i++]) && !event.isPropagationStopped()) {\n\t\n\t\t\t\t\tevent.type = i > 1 ? bubbleType : special.bindType || type;\n\t\n\t\t\t\t\t// jQuery handler\n\t\t\t\t\thandle = (jQuery._data(cur, \"events\") || {})[event.type] && jQuery._data(cur, \"handle\");\n\t\n\t\t\t\t\tif (handle) {\n\t\t\t\t\t\thandle.apply(cur, data);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Native handler\n\t\t\t\t\thandle = ontype && cur[ontype];\n\t\t\t\t\tif (handle && handle.apply && acceptData(cur)) {\n\t\t\t\t\t\tevent.result = handle.apply(cur, data);\n\t\t\t\t\t\tif (event.result === false) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tevent.type = type;\n\t\n\t\t\t\t// If nobody prevented the default action, do it now\n\t\t\t\tif (!onlyHandlers && !event.isDefaultPrevented()) {\n\t\n\t\t\t\t\tif ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {\n\t\n\t\t\t\t\t\t// Call a native DOM method on the target with the same name name as the event.\n\t\t\t\t\t\t// Can't use an .isFunction() check here because IE6/7 fails that test.\n\t\t\t\t\t\t// Don't do default actions on window, that's where global variables be (#6170)\n\t\t\t\t\t\tif (ontype && elem[type] && !jQuery.isWindow(elem)) {\n\t\n\t\t\t\t\t\t\t// Don't re-trigger an onFOO event when we call its FOO() method\n\t\t\t\t\t\t\ttmp = elem[ontype];\n\t\n\t\t\t\t\t\t\tif (tmp) {\n\t\t\t\t\t\t\t\telem[ontype] = null;\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t// Prevent re-triggering of the same event, since we already bubbled it above\n\t\t\t\t\t\t\tjQuery.event.triggered = type;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\telem[type]();\n\t\t\t\t\t\t\t} catch (e) {\n\t\n\t\t\t\t\t\t\t\t// IE<9 dies on focus/blur to hidden element (#1486,#12518)\n\t\t\t\t\t\t\t\t// only reproducible on winXP IE8 native, not IE9 in IE8 mode\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tjQuery.event.triggered = undefined;\n\t\n\t\t\t\t\t\t\tif (tmp) {\n\t\t\t\t\t\t\t\telem[ontype] = tmp;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\treturn event.result;\n\t\t\t},\n\t\n\t\t\tdispatch: function (event) {\n\t\n\t\t\t\t// Make a writable jQuery.Event from the native event object\n\t\t\t\tevent = jQuery.event.fix(event);\n\t\n\t\t\t\tvar i,\n\t\t\t\t j,\n\t\t\t\t ret,\n\t\t\t\t matched,\n\t\t\t\t handleObj,\n\t\t\t\t handlerQueue = [],\n\t\t\t\t args = slice.call(arguments),\n\t\t\t\t handlers = (jQuery._data(this, \"events\") || {})[event.type] || [],\n\t\t\t\t special = jQuery.event.special[event.type] || {};\n\t\n\t\t\t\t// Use the fix-ed jQuery.Event rather than the (read-only) native event\n\t\t\t\targs[0] = event;\n\t\t\t\tevent.delegateTarget = this;\n\t\n\t\t\t\t// Call the preDispatch hook for the mapped type, and let it bail if desired\n\t\t\t\tif (special.preDispatch && special.preDispatch.call(this, event) === false) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// Determine handlers\n\t\t\t\thandlerQueue = jQuery.event.handlers.call(this, event, handlers);\n\t\n\t\t\t\t// Run delegates first; they may want to stop propagation beneath us\n\t\t\t\ti = 0;\n\t\t\t\twhile ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {\n\t\t\t\t\tevent.currentTarget = matched.elem;\n\t\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {\n\t\n\t\t\t\t\t\t// Triggered event must either 1) have no namespace, or 2) have namespace(s)\n\t\t\t\t\t\t// a subset or equal to those in the bound event (both can have no namespace).\n\t\t\t\t\t\tif (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {\n\t\n\t\t\t\t\t\t\tevent.handleObj = handleObj;\n\t\t\t\t\t\t\tevent.data = handleObj.data;\n\t\n\t\t\t\t\t\t\tret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);\n\t\n\t\t\t\t\t\t\tif (ret !== undefined) {\n\t\t\t\t\t\t\t\tif ((event.result = ret) === false) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Call the postDispatch hook for the mapped type\n\t\t\t\tif (special.postDispatch) {\n\t\t\t\t\tspecial.postDispatch.call(this, event);\n\t\t\t\t}\n\t\n\t\t\t\treturn event.result;\n\t\t\t},\n\t\n\t\t\thandlers: function (event, handlers) {\n\t\t\t\tvar i,\n\t\t\t\t matches,\n\t\t\t\t sel,\n\t\t\t\t handleObj,\n\t\t\t\t handlerQueue = [],\n\t\t\t\t delegateCount = handlers.delegateCount,\n\t\t\t\t cur = event.target;\n\t\n\t\t\t\t// Support (at least): Chrome, IE9\n\t\t\t\t// Find delegate handlers\n\t\t\t\t// Black-hole SVG instance trees (#13180)\n\t\t\t\t//\n\t\t\t\t// Support: Firefox<=42+\n\t\t\t\t// Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)\n\t\t\t\tif (delegateCount && cur.nodeType && (event.type !== \"click\" || isNaN(event.button) || event.button < 1)) {\n\t\n\t\t\t\t\t/* jshint eqeqeq: false */\n\t\t\t\t\tfor (; cur != this; cur = cur.parentNode || this) {\n\t\t\t\t\t\t/* jshint eqeqeq: true */\n\t\n\t\t\t\t\t\t// Don't check non-elements (#13208)\n\t\t\t\t\t\t// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)\n\t\t\t\t\t\tif (cur.nodeType === 1 && (cur.disabled !== true || event.type !== \"click\")) {\n\t\t\t\t\t\t\tmatches = [];\n\t\t\t\t\t\t\tfor (i = 0; i < delegateCount; i++) {\n\t\t\t\t\t\t\t\thandleObj = handlers[i];\n\t\n\t\t\t\t\t\t\t\t// Don't conflict with Object.prototype properties (#13203)\n\t\t\t\t\t\t\t\tsel = handleObj.selector + \" \";\n\t\n\t\t\t\t\t\t\t\tif (matches[sel] === undefined) {\n\t\t\t\t\t\t\t\t\tmatches[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (matches[sel]) {\n\t\t\t\t\t\t\t\t\tmatches.push(handleObj);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (matches.length) {\n\t\t\t\t\t\t\t\thandlerQueue.push({ elem: cur, handlers: matches });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Add the remaining (directly-bound) handlers\n\t\t\t\tif (delegateCount < handlers.length) {\n\t\t\t\t\thandlerQueue.push({ elem: this, handlers: handlers.slice(delegateCount) });\n\t\t\t\t}\n\t\n\t\t\t\treturn handlerQueue;\n\t\t\t},\n\t\n\t\t\tfix: function (event) {\n\t\t\t\tif (event[jQuery.expando]) {\n\t\t\t\t\treturn event;\n\t\t\t\t}\n\t\n\t\t\t\t// Create a writable copy of the event object and normalize some properties\n\t\t\t\tvar i,\n\t\t\t\t prop,\n\t\t\t\t copy,\n\t\t\t\t type = event.type,\n\t\t\t\t originalEvent = event,\n\t\t\t\t fixHook = this.fixHooks[type];\n\t\n\t\t\t\tif (!fixHook) {\n\t\t\t\t\tthis.fixHooks[type] = fixHook = rmouseEvent.test(type) ? this.mouseHooks : rkeyEvent.test(type) ? this.keyHooks : {};\n\t\t\t\t}\n\t\t\t\tcopy = fixHook.props ? this.props.concat(fixHook.props) : this.props;\n\t\n\t\t\t\tevent = new jQuery.Event(originalEvent);\n\t\n\t\t\t\ti = copy.length;\n\t\t\t\twhile (i--) {\n\t\t\t\t\tprop = copy[i];\n\t\t\t\t\tevent[prop] = originalEvent[prop];\n\t\t\t\t}\n\t\n\t\t\t\t// Support: IE<9\n\t\t\t\t// Fix target property (#1925)\n\t\t\t\tif (!event.target) {\n\t\t\t\t\tevent.target = originalEvent.srcElement || document;\n\t\t\t\t}\n\t\n\t\t\t\t// Support: Safari 6-8+\n\t\t\t\t// Target should not be a text node (#504, #13143)\n\t\t\t\tif (event.target.nodeType === 3) {\n\t\t\t\t\tevent.target = event.target.parentNode;\n\t\t\t\t}\n\t\n\t\t\t\t// Support: IE<9\n\t\t\t\t// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)\n\t\t\t\tevent.metaKey = !!event.metaKey;\n\t\n\t\t\t\treturn fixHook.filter ? fixHook.filter(event, originalEvent) : event;\n\t\t\t},\n\t\n\t\t\t// Includes some event props shared by KeyEvent and MouseEvent\n\t\t\tprops: (\"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase \" + \"metaKey relatedTarget shiftKey target timeStamp view which\").split(\" \"),\n\t\n\t\t\tfixHooks: {},\n\t\n\t\t\tkeyHooks: {\n\t\t\t\tprops: \"char charCode key keyCode\".split(\" \"),\n\t\t\t\tfilter: function (event, original) {\n\t\n\t\t\t\t\t// Add which for key events\n\t\t\t\t\tif (event.which == null) {\n\t\t\t\t\t\tevent.which = original.charCode != null ? original.charCode : original.keyCode;\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn event;\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\tmouseHooks: {\n\t\t\t\tprops: (\"button buttons clientX clientY fromElement offsetX offsetY \" + \"pageX pageY screenX screenY toElement\").split(\" \"),\n\t\t\t\tfilter: function (event, original) {\n\t\t\t\t\tvar body,\n\t\t\t\t\t eventDoc,\n\t\t\t\t\t doc,\n\t\t\t\t\t button = original.button,\n\t\t\t\t\t fromElement = original.fromElement;\n\t\n\t\t\t\t\t// Calculate pageX/Y if missing and clientX/Y available\n\t\t\t\t\tif (event.pageX == null && original.clientX != null) {\n\t\t\t\t\t\teventDoc = event.target.ownerDocument || document;\n\t\t\t\t\t\tdoc = eventDoc.documentElement;\n\t\t\t\t\t\tbody = eventDoc.body;\n\t\n\t\t\t\t\t\tevent.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);\n\t\t\t\t\t\tevent.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Add relatedTarget, if necessary\n\t\t\t\t\tif (!event.relatedTarget && fromElement) {\n\t\t\t\t\t\tevent.relatedTarget = fromElement === event.target ? original.toElement : fromElement;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Add which for click: 1 === left; 2 === middle; 3 === right\n\t\t\t\t\t// Note: button is not normalized, so don't use it\n\t\t\t\t\tif (!event.which && button !== undefined) {\n\t\t\t\t\t\tevent.which = button & 1 ? 1 : button & 2 ? 3 : button & 4 ? 2 : 0;\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn event;\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\tspecial: {\n\t\t\t\tload: {\n\t\n\t\t\t\t\t// Prevent triggered image.load events from bubbling to window.load\n\t\t\t\t\tnoBubble: true\n\t\t\t\t},\n\t\t\t\tfocus: {\n\t\n\t\t\t\t\t// Fire native event if possible so blur/focus sequence is correct\n\t\t\t\t\ttrigger: function () {\n\t\t\t\t\t\tif (this !== safeActiveElement() && this.focus) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tthis.focus();\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t} catch (e) {\n\t\n\t\t\t\t\t\t\t\t// Support: IE<9\n\t\t\t\t\t\t\t\t// If we error on focus to hidden element (#1486, #12518),\n\t\t\t\t\t\t\t\t// let .trigger() run the handlers\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tdelegateType: \"focusin\"\n\t\t\t\t},\n\t\t\t\tblur: {\n\t\t\t\t\ttrigger: function () {\n\t\t\t\t\t\tif (this === safeActiveElement() && this.blur) {\n\t\t\t\t\t\t\tthis.blur();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tdelegateType: \"focusout\"\n\t\t\t\t},\n\t\t\t\tclick: {\n\t\n\t\t\t\t\t// For checkbox, fire native event so checked state will be right\n\t\t\t\t\ttrigger: function () {\n\t\t\t\t\t\tif (jQuery.nodeName(this, \"input\") && this.type === \"checkbox\" && this.click) {\n\t\t\t\t\t\t\tthis.click();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\n\t\t\t\t\t// For cross-browser consistency, don't fire native .click() on links\n\t\t\t\t\t_default: function (event) {\n\t\t\t\t\t\treturn jQuery.nodeName(event.target, \"a\");\n\t\t\t\t\t}\n\t\t\t\t},\n\t\n\t\t\t\tbeforeunload: {\n\t\t\t\t\tpostDispatch: function (event) {\n\t\n\t\t\t\t\t\t// Support: Firefox 20+\n\t\t\t\t\t\t// Firefox doesn't alert if the returnValue field is not set.\n\t\t\t\t\t\tif (event.result !== undefined && event.originalEvent) {\n\t\t\t\t\t\t\tevent.originalEvent.returnValue = event.result;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\t// Piggyback on a donor event to simulate a different one\n\t\t\tsimulate: function (type, elem, event) {\n\t\t\t\tvar e = jQuery.extend(new jQuery.Event(), event, {\n\t\t\t\t\ttype: type,\n\t\t\t\t\tisSimulated: true\n\t\n\t\t\t\t\t// Previously, `originalEvent: {}` was set here, so stopPropagation call\n\t\t\t\t\t// would not be triggered on donor event, since in our own\n\t\t\t\t\t// jQuery.event.stopPropagation function we had a check for existence of\n\t\t\t\t\t// originalEvent.stopPropagation method, so, consequently it would be a noop.\n\t\t\t\t\t//\n\t\t\t\t\t// Guard for simulated events was moved to jQuery.event.stopPropagation function\n\t\t\t\t\t// since `originalEvent` should point to the original event for the\n\t\t\t\t\t// constancy with other events and for more focused logic\n\t\t\t\t});\n\t\n\t\t\t\tjQuery.event.trigger(e, null, elem);\n\t\n\t\t\t\tif (e.isDefaultPrevented()) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\n\t\tjQuery.removeEvent = document.removeEventListener ? function (elem, type, handle) {\n\t\n\t\t\t// This \"if\" is needed for plain objects\n\t\t\tif (elem.removeEventListener) {\n\t\t\t\telem.removeEventListener(type, handle);\n\t\t\t}\n\t\t} : function (elem, type, handle) {\n\t\t\tvar name = \"on\" + type;\n\t\n\t\t\tif (elem.detachEvent) {\n\t\n\t\t\t\t// #8545, #7054, preventing memory leaks for custom events in IE6-8\n\t\t\t\t// detachEvent needed property on element, by name of that event,\n\t\t\t\t// to properly expose it to GC\n\t\t\t\tif (typeof elem[name] === \"undefined\") {\n\t\t\t\t\telem[name] = null;\n\t\t\t\t}\n\t\n\t\t\t\telem.detachEvent(name, handle);\n\t\t\t}\n\t\t};\n\t\n\t\tjQuery.Event = function (src, props) {\n\t\n\t\t\t// Allow instantiation without the 'new' keyword\n\t\t\tif (!(this instanceof jQuery.Event)) {\n\t\t\t\treturn new jQuery.Event(src, props);\n\t\t\t}\n\t\n\t\t\t// Event object\n\t\t\tif (src && src.type) {\n\t\t\t\tthis.originalEvent = src;\n\t\t\t\tthis.type = src.type;\n\t\n\t\t\t\t// Events bubbling up the document may have been marked as prevented\n\t\t\t\t// by a handler lower down the tree; reflect the correct value.\n\t\t\t\tthis.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&\n\t\n\t\t\t\t// Support: IE < 9, Android < 4.0\n\t\t\t\tsrc.returnValue === false ? returnTrue : returnFalse;\n\t\n\t\t\t\t// Event type\n\t\t\t} else {\n\t\t\t\tthis.type = src;\n\t\t\t}\n\t\n\t\t\t// Put explicitly provided properties onto the event object\n\t\t\tif (props) {\n\t\t\t\tjQuery.extend(this, props);\n\t\t\t}\n\t\n\t\t\t// Create a timestamp if incoming event doesn't have one\n\t\t\tthis.timeStamp = src && src.timeStamp || jQuery.now();\n\t\n\t\t\t// Mark it as fixed\n\t\t\tthis[jQuery.expando] = true;\n\t\t};\n\t\n\t\t// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n\t\t// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\n\t\tjQuery.Event.prototype = {\n\t\t\tconstructor: jQuery.Event,\n\t\t\tisDefaultPrevented: returnFalse,\n\t\t\tisPropagationStopped: returnFalse,\n\t\t\tisImmediatePropagationStopped: returnFalse,\n\t\n\t\t\tpreventDefault: function () {\n\t\t\t\tvar e = this.originalEvent;\n\t\n\t\t\t\tthis.isDefaultPrevented = returnTrue;\n\t\t\t\tif (!e) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// If preventDefault exists, run it on the original event\n\t\t\t\tif (e.preventDefault) {\n\t\t\t\t\te.preventDefault();\n\t\n\t\t\t\t\t// Support: IE\n\t\t\t\t\t// Otherwise set the returnValue property of the original event to false\n\t\t\t\t} else {\n\t\t\t\t\te.returnValue = false;\n\t\t\t\t}\n\t\t\t},\n\t\t\tstopPropagation: function () {\n\t\t\t\tvar e = this.originalEvent;\n\t\n\t\t\t\tthis.isPropagationStopped = returnTrue;\n\t\n\t\t\t\tif (!e || this.isSimulated) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// If stopPropagation exists, run it on the original event\n\t\t\t\tif (e.stopPropagation) {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\n\t\t\t\t// Support: IE\n\t\t\t\t// Set the cancelBubble property of the original event to true\n\t\t\t\te.cancelBubble = true;\n\t\t\t},\n\t\t\tstopImmediatePropagation: function () {\n\t\t\t\tvar e = this.originalEvent;\n\t\n\t\t\t\tthis.isImmediatePropagationStopped = returnTrue;\n\t\n\t\t\t\tif (e && e.stopImmediatePropagation) {\n\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t}\n\t\n\t\t\t\tthis.stopPropagation();\n\t\t\t}\n\t\t};\n\t\n\t\t// Create mouseenter/leave events using mouseover/out and event-time checks\n\t\t// so that event delegation works in jQuery.\n\t\t// Do the same for pointerenter/pointerleave and pointerover/pointerout\n\t\t//\n\t\t// Support: Safari 7 only\n\t\t// Safari sends mouseenter too often; see:\n\t\t// https://code.google.com/p/chromium/issues/detail?id=470258\n\t\t// for the description of the bug (it existed in older Chrome versions as well).\n\t\tjQuery.each({\n\t\t\tmouseenter: \"mouseover\",\n\t\t\tmouseleave: \"mouseout\",\n\t\t\tpointerenter: \"pointerover\",\n\t\t\tpointerleave: \"pointerout\"\n\t\t}, function (orig, fix) {\n\t\t\tjQuery.event.special[orig] = {\n\t\t\t\tdelegateType: fix,\n\t\t\t\tbindType: fix,\n\t\n\t\t\t\thandle: function (event) {\n\t\t\t\t\tvar ret,\n\t\t\t\t\t target = this,\n\t\t\t\t\t related = event.relatedTarget,\n\t\t\t\t\t handleObj = event.handleObj;\n\t\n\t\t\t\t\t// For mouseenter/leave call the handler if related is outside the target.\n\t\t\t\t\t// NB: No relatedTarget if the mouse left/entered the browser window\n\t\t\t\t\tif (!related || related !== target && !jQuery.contains(target, related)) {\n\t\t\t\t\t\tevent.type = handleObj.origType;\n\t\t\t\t\t\tret = handleObj.handler.apply(this, arguments);\n\t\t\t\t\t\tevent.type = fix;\n\t\t\t\t\t}\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t\n\t\t// IE submit delegation\n\t\tif (!support.submit) {\n\t\n\t\t\tjQuery.event.special.submit = {\n\t\t\t\tsetup: function () {\n\t\n\t\t\t\t\t// Only need this for delegated form submit events\n\t\t\t\t\tif (jQuery.nodeName(this, \"form\")) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Lazy-add a submit handler when a descendant form may potentially be submitted\n\t\t\t\t\tjQuery.event.add(this, \"click._submit keypress._submit\", function (e) {\n\t\n\t\t\t\t\t\t// Node name check avoids a VML-related crash in IE (#9807)\n\t\t\t\t\t\tvar elem = e.target,\n\t\t\t\t\t\t form = jQuery.nodeName(elem, \"input\") || jQuery.nodeName(elem, \"button\") ?\n\t\n\t\t\t\t\t\t// Support: IE <=8\n\t\t\t\t\t\t// We use jQuery.prop instead of elem.form\n\t\t\t\t\t\t// to allow fixing the IE8 delegated submit issue (gh-2332)\n\t\t\t\t\t\t// by 3rd party polyfills/workarounds.\n\t\t\t\t\t\tjQuery.prop(elem, \"form\") : undefined;\n\t\n\t\t\t\t\t\tif (form && !jQuery._data(form, \"submit\")) {\n\t\t\t\t\t\t\tjQuery.event.add(form, \"submit._submit\", function (event) {\n\t\t\t\t\t\t\t\tevent._submitBubble = true;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery._data(form, \"submit\", true);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\n\t\t\t\t\t// return undefined since we don't need an event listener\n\t\t\t\t},\n\t\n\t\t\t\tpostDispatch: function (event) {\n\t\n\t\t\t\t\t// If form was submitted by the user, bubble the event up the tree\n\t\t\t\t\tif (event._submitBubble) {\n\t\t\t\t\t\tdelete event._submitBubble;\n\t\t\t\t\t\tif (this.parentNode && !event.isTrigger) {\n\t\t\t\t\t\t\tjQuery.event.simulate(\"submit\", this.parentNode, event);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\n\t\t\t\tteardown: function () {\n\t\n\t\t\t\t\t// Only need this for delegated form submit events\n\t\t\t\t\tif (jQuery.nodeName(this, \"form\")) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Remove delegated handlers; cleanData eventually reaps submit handlers attached above\n\t\t\t\t\tjQuery.event.remove(this, \"._submit\");\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\n\t\t// IE change delegation and checkbox/radio fix\n\t\tif (!support.change) {\n\t\n\t\t\tjQuery.event.special.change = {\n\t\n\t\t\t\tsetup: function () {\n\t\n\t\t\t\t\tif (rformElems.test(this.nodeName)) {\n\t\n\t\t\t\t\t\t// IE doesn't fire change on a check/radio until blur; trigger it on click\n\t\t\t\t\t\t// after a propertychange. Eat the blur-change in special.change.handle.\n\t\t\t\t\t\t// This still fires onchange a second time for check/radio after blur.\n\t\t\t\t\t\tif (this.type === \"checkbox\" || this.type === \"radio\") {\n\t\t\t\t\t\t\tjQuery.event.add(this, \"propertychange._change\", function (event) {\n\t\t\t\t\t\t\t\tif (event.originalEvent.propertyName === \"checked\") {\n\t\t\t\t\t\t\t\t\tthis._justChanged = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery.event.add(this, \"click._change\", function (event) {\n\t\t\t\t\t\t\t\tif (this._justChanged && !event.isTrigger) {\n\t\t\t\t\t\t\t\t\tthis._justChanged = false;\n\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t// Allow triggered, simulated change events (#11500)\n\t\t\t\t\t\t\t\tjQuery.event.simulate(\"change\", this, event);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Delegated event; lazy-add a change handler on descendant inputs\n\t\t\t\t\tjQuery.event.add(this, \"beforeactivate._change\", function (e) {\n\t\t\t\t\t\tvar elem = e.target;\n\t\n\t\t\t\t\t\tif (rformElems.test(elem.nodeName) && !jQuery._data(elem, \"change\")) {\n\t\t\t\t\t\t\tjQuery.event.add(elem, \"change._change\", function (event) {\n\t\t\t\t\t\t\t\tif (this.parentNode && !event.isSimulated && !event.isTrigger) {\n\t\t\t\t\t\t\t\t\tjQuery.event.simulate(\"change\", this.parentNode, event);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery._data(elem, \"change\", true);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t},\n\t\n\t\t\t\thandle: function (event) {\n\t\t\t\t\tvar elem = event.target;\n\t\n\t\t\t\t\t// Swallow native change events from checkbox/radio, we already triggered them above\n\t\t\t\t\tif (this !== elem || event.isSimulated || event.isTrigger || elem.type !== \"radio\" && elem.type !== \"checkbox\") {\n\t\n\t\t\t\t\t\treturn event.handleObj.handler.apply(this, arguments);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\n\t\t\t\tteardown: function () {\n\t\t\t\t\tjQuery.event.remove(this, \"._change\");\n\t\n\t\t\t\t\treturn !rformElems.test(this.nodeName);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\n\t\t// Support: Firefox\n\t\t// Firefox doesn't have focus(in | out) events\n\t\t// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n\t\t//\n\t\t// Support: Chrome, Safari\n\t\t// focus(in | out) events fire after focus & blur events,\n\t\t// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n\t\t// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857\n\t\tif (!support.focusin) {\n\t\t\tjQuery.each({ focus: \"focusin\", blur: \"focusout\" }, function (orig, fix) {\n\t\n\t\t\t\t// Attach a single capturing handler on the document while someone wants focusin/focusout\n\t\t\t\tvar handler = function (event) {\n\t\t\t\t\tjQuery.event.simulate(fix, event.target, jQuery.event.fix(event));\n\t\t\t\t};\n\t\n\t\t\t\tjQuery.event.special[fix] = {\n\t\t\t\t\tsetup: function () {\n\t\t\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\t\t attaches = jQuery._data(doc, fix);\n\t\n\t\t\t\t\t\tif (!attaches) {\n\t\t\t\t\t\t\tdoc.addEventListener(orig, handler, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tjQuery._data(doc, fix, (attaches || 0) + 1);\n\t\t\t\t\t},\n\t\t\t\t\tteardown: function () {\n\t\t\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\t\t attaches = jQuery._data(doc, fix) - 1;\n\t\n\t\t\t\t\t\tif (!attaches) {\n\t\t\t\t\t\t\tdoc.removeEventListener(orig, handler, true);\n\t\t\t\t\t\t\tjQuery._removeData(doc, fix);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tjQuery._data(doc, fix, attaches);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t\n\t\tjQuery.fn.extend({\n\t\n\t\t\ton: function (types, selector, data, fn) {\n\t\t\t\treturn on(this, types, selector, data, fn);\n\t\t\t},\n\t\t\tone: function (types, selector, data, fn) {\n\t\t\t\treturn on(this, types, selector, data, fn, 1);\n\t\t\t},\n\t\t\toff: function (types, selector, fn) {\n\t\t\t\tvar handleObj, type;\n\t\t\t\tif (types && types.preventDefault && types.handleObj) {\n\t\n\t\t\t\t\t// ( event ) dispatched jQuery.Event\n\t\t\t\t\thandleObj = types.handleObj;\n\t\t\t\t\tjQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + \".\" + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t\tif (typeof types === \"object\") {\n\t\n\t\t\t\t\t// ( types-object [, selector] )\n\t\t\t\t\tfor (type in types) {\n\t\t\t\t\t\tthis.off(type, selector, types[type]);\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t\tif (selector === false || typeof selector === \"function\") {\n\t\n\t\t\t\t\t// ( types [, fn] )\n\t\t\t\t\tfn = selector;\n\t\t\t\t\tselector = undefined;\n\t\t\t\t}\n\t\t\t\tif (fn === false) {\n\t\t\t\t\tfn = returnFalse;\n\t\t\t\t}\n\t\t\t\treturn this.each(function () {\n\t\t\t\t\tjQuery.event.remove(this, types, fn, selector);\n\t\t\t\t});\n\t\t\t},\n\t\n\t\t\ttrigger: function (type, data) {\n\t\t\t\treturn this.each(function () {\n\t\t\t\t\tjQuery.event.trigger(type, data, this);\n\t\t\t\t});\n\t\t\t},\n\t\t\ttriggerHandler: function (type, data) {\n\t\t\t\tvar elem = this[0];\n\t\t\t\tif (elem) {\n\t\t\t\t\treturn jQuery.event.trigger(type, data, elem, true);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\n\t\tvar rinlinejQuery = / jQuery\\d+=\"(?:null|\\d+)\"/g,\n\t\t rnoshimcache = new RegExp(\"<(?:\" + nodeNames + \")[\\\\s/>]\", \"i\"),\n\t\t rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:-]+)[^>]*)\\/>/gi,\n\t\n\t\n\t\t// Support: IE 10-11, Edge 10240+\n\t\t// In IE/Edge using regex groups here causes severe slowdowns.\n\t\t// See https://connect.microsoft.com/IE/feedback/details/1736512/\n\t\trnoInnerhtml = /\\s*$/g,\n\t\t safeFragment = createSafeFragment(document),\n\t\t fragmentDiv = safeFragment.appendChild(document.createElement(\"div\"));\n\t\n\t\t// Support: IE<8\n\t\t// Manipulating tables requires a tbody\n\t\tfunction manipulationTarget(elem, content) {\n\t\t\treturn jQuery.nodeName(elem, \"table\") && jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, \"tr\") ? elem.getElementsByTagName(\"tbody\")[0] || elem.appendChild(elem.ownerDocument.createElement(\"tbody\")) : elem;\n\t\t}\n\t\n\t\t// Replace/restore the type attribute of script elements for safe DOM manipulation\n\t\tfunction disableScript(elem) {\n\t\t\telem.type = (jQuery.find.attr(elem, \"type\") !== null) + \"/\" + elem.type;\n\t\t\treturn elem;\n\t\t}\n\t\tfunction restoreScript(elem) {\n\t\t\tvar match = rscriptTypeMasked.exec(elem.type);\n\t\t\tif (match) {\n\t\t\t\telem.type = match[1];\n\t\t\t} else {\n\t\t\t\telem.removeAttribute(\"type\");\n\t\t\t}\n\t\t\treturn elem;\n\t\t}\n\t\n\t\tfunction cloneCopyEvent(src, dest) {\n\t\t\tif (dest.nodeType !== 1 || !jQuery.hasData(src)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tvar type,\n\t\t\t i,\n\t\t\t l,\n\t\t\t oldData = jQuery._data(src),\n\t\t\t curData = jQuery._data(dest, oldData),\n\t\t\t events = oldData.events;\n\t\n\t\t\tif (events) {\n\t\t\t\tdelete curData.handle;\n\t\t\t\tcurData.events = {};\n\t\n\t\t\t\tfor (type in events) {\n\t\t\t\t\tfor (i = 0, l = events[type].length; i < l; i++) {\n\t\t\t\t\t\tjQuery.event.add(dest, type, events[type][i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// make the cloned public data object a copy from the original\n\t\t\tif (curData.data) {\n\t\t\t\tcurData.data = jQuery.extend({}, curData.data);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction fixCloneNodeIssues(src, dest) {\n\t\t\tvar nodeName, e, data;\n\t\n\t\t\t// We do not need to do anything for non-Elements\n\t\t\tif (dest.nodeType !== 1) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tnodeName = dest.nodeName.toLowerCase();\n\t\n\t\t\t// IE6-8 copies events bound via attachEvent when using cloneNode.\n\t\t\tif (!support.noCloneEvent && dest[jQuery.expando]) {\n\t\t\t\tdata = jQuery._data(dest);\n\t\n\t\t\t\tfor (e in data.events) {\n\t\t\t\t\tjQuery.removeEvent(dest, e, data.handle);\n\t\t\t\t}\n\t\n\t\t\t\t// Event data gets referenced instead of copied if the expando gets copied too\n\t\t\t\tdest.removeAttribute(jQuery.expando);\n\t\t\t}\n\t\n\t\t\t// IE blanks contents when cloning scripts, and tries to evaluate newly-set text\n\t\t\tif (nodeName === \"script\" && dest.text !== src.text) {\n\t\t\t\tdisableScript(dest).text = src.text;\n\t\t\t\trestoreScript(dest);\n\t\n\t\t\t\t// IE6-10 improperly clones children of object elements using classid.\n\t\t\t\t// IE10 throws NoModificationAllowedError if parent is null, #12132.\n\t\t\t} else if (nodeName === \"object\") {\n\t\t\t\tif (dest.parentNode) {\n\t\t\t\t\tdest.outerHTML = src.outerHTML;\n\t\t\t\t}\n\t\n\t\t\t\t// This path appears unavoidable for IE9. When cloning an object\n\t\t\t\t// element in IE9, the outerHTML strategy above is not sufficient.\n\t\t\t\t// If the src has innerHTML and the destination does not,\n\t\t\t\t// copy the src.innerHTML into the dest.innerHTML. #10324\n\t\t\t\tif (support.html5Clone && src.innerHTML && !jQuery.trim(dest.innerHTML)) {\n\t\t\t\t\tdest.innerHTML = src.innerHTML;\n\t\t\t\t}\n\t\t\t} else if (nodeName === \"input\" && rcheckableType.test(src.type)) {\n\t\n\t\t\t\t// IE6-8 fails to persist the checked state of a cloned checkbox\n\t\t\t\t// or radio button. Worse, IE6-7 fail to give the cloned element\n\t\t\t\t// a checked appearance if the defaultChecked value isn't also set\n\t\n\t\t\t\tdest.defaultChecked = dest.checked = src.checked;\n\t\n\t\t\t\t// IE6-7 get confused and end up setting the value of a cloned\n\t\t\t\t// checkbox/radio button to an empty string instead of \"on\"\n\t\t\t\tif (dest.value !== src.value) {\n\t\t\t\t\tdest.value = src.value;\n\t\t\t\t}\n\t\n\t\t\t\t// IE6-8 fails to return the selected option to the default selected\n\t\t\t\t// state when cloning options\n\t\t\t} else if (nodeName === \"option\") {\n\t\t\t\tdest.defaultSelected = dest.selected = src.defaultSelected;\n\t\n\t\t\t\t// IE6-8 fails to set the defaultValue to the correct value when\n\t\t\t\t// cloning other types of input fields\n\t\t\t} else if (nodeName === \"input\" || nodeName === \"textarea\") {\n\t\t\t\tdest.defaultValue = src.defaultValue;\n\t\t\t}\n\t\t}\n\t\n\t\tfunction domManip(collection, args, callback, ignored) {\n\t\n\t\t\t// Flatten any nested arrays\n\t\t\targs = concat.apply([], args);\n\t\n\t\t\tvar first,\n\t\t\t node,\n\t\t\t hasScripts,\n\t\t\t scripts,\n\t\t\t doc,\n\t\t\t fragment,\n\t\t\t i = 0,\n\t\t\t l = collection.length,\n\t\t\t iNoClone = l - 1,\n\t\t\t value = args[0],\n\t\t\t isFunction = jQuery.isFunction(value);\n\t\n\t\t\t// We can't cloneNode fragments that contain checked, in WebKit\n\t\t\tif (isFunction || l > 1 && typeof value === \"string\" && !support.checkClone && rchecked.test(value)) {\n\t\t\t\treturn collection.each(function (index) {\n\t\t\t\t\tvar self = collection.eq(index);\n\t\t\t\t\tif (isFunction) {\n\t\t\t\t\t\targs[0] = value.call(this, index, self.html());\n\t\t\t\t\t}\n\t\t\t\t\tdomManip(self, args, callback, ignored);\n\t\t\t\t});\n\t\t\t}\n\t\n\t\t\tif (l) {\n\t\t\t\tfragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);\n\t\t\t\tfirst = fragment.firstChild;\n\t\n\t\t\t\tif (fragment.childNodes.length === 1) {\n\t\t\t\t\tfragment = first;\n\t\t\t\t}\n\t\n\t\t\t\t// Require either new content or an interest in ignored elements to invoke the callback\n\t\t\t\tif (first || ignored) {\n\t\t\t\t\tscripts = jQuery.map(getAll(fragment, \"script\"), disableScript);\n\t\t\t\t\thasScripts = scripts.length;\n\t\n\t\t\t\t\t// Use the original fragment for the last item\n\t\t\t\t\t// instead of the first because it can end up\n\t\t\t\t\t// being emptied incorrectly in certain situations (#8070).\n\t\t\t\t\tfor (; i < l; i++) {\n\t\t\t\t\t\tnode = fragment;\n\t\n\t\t\t\t\t\tif (i !== iNoClone) {\n\t\t\t\t\t\t\tnode = jQuery.clone(node, true, true);\n\t\n\t\t\t\t\t\t\t// Keep references to cloned scripts for later restoration\n\t\t\t\t\t\t\tif (hasScripts) {\n\t\n\t\t\t\t\t\t\t\t// Support: Android<4.1, PhantomJS<2\n\t\t\t\t\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\t\t\t\t\tjQuery.merge(scripts, getAll(node, \"script\"));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tcallback.call(collection[i], node, i);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (hasScripts) {\n\t\t\t\t\t\tdoc = scripts[scripts.length - 1].ownerDocument;\n\t\n\t\t\t\t\t\t// Reenable scripts\n\t\t\t\t\t\tjQuery.map(scripts, restoreScript);\n\t\n\t\t\t\t\t\t// Evaluate executable scripts on first document insertion\n\t\t\t\t\t\tfor (i = 0; i < hasScripts; i++) {\n\t\t\t\t\t\t\tnode = scripts[i];\n\t\t\t\t\t\t\tif (rscriptType.test(node.type || \"\") && !jQuery._data(node, \"globalEval\") && jQuery.contains(doc, node)) {\n\t\n\t\t\t\t\t\t\t\tif (node.src) {\n\t\n\t\t\t\t\t\t\t\t\t// Optional AJAX dependency, but won't run scripts if not present\n\t\t\t\t\t\t\t\t\tif (jQuery._evalUrl) {\n\t\t\t\t\t\t\t\t\t\tjQuery._evalUrl(node.src);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tjQuery.globalEval((node.text || node.textContent || node.innerHTML || \"\").replace(rcleanScript, \"\"));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Fix #11809: Avoid leaking memory\n\t\t\t\t\tfragment = first = null;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn collection;\n\t\t}\n\t\n\t\tfunction remove(elem, selector, keepData) {\n\t\t\tvar node,\n\t\t\t elems = selector ? jQuery.filter(selector, elem) : elem,\n\t\t\t i = 0;\n\t\n\t\t\tfor (; (node = elems[i]) != null; i++) {\n\t\n\t\t\t\tif (!keepData && node.nodeType === 1) {\n\t\t\t\t\tjQuery.cleanData(getAll(node));\n\t\t\t\t}\n\t\n\t\t\t\tif (node.parentNode) {\n\t\t\t\t\tif (keepData && jQuery.contains(node.ownerDocument, node)) {\n\t\t\t\t\t\tsetGlobalEval(getAll(node, \"script\"));\n\t\t\t\t\t}\n\t\t\t\t\tnode.parentNode.removeChild(node);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn elem;\n\t\t}\n\t\n\t\tjQuery.extend({\n\t\t\thtmlPrefilter: function (html) {\n\t\t\t\treturn html.replace(rxhtmlTag, \"<$1>\");\n\t\t\t},\n\t\n\t\t\tclone: function (elem, dataAndEvents, deepDataAndEvents) {\n\t\t\t\tvar destElements,\n\t\t\t\t node,\n\t\t\t\t clone,\n\t\t\t\t i,\n\t\t\t\t srcElements,\n\t\t\t\t inPage = jQuery.contains(elem.ownerDocument, elem);\n\t\n\t\t\t\tif (support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test(\"<\" + elem.nodeName + \">\")) {\n\t\n\t\t\t\t\tclone = elem.cloneNode(true);\n\t\n\t\t\t\t\t// IE<=8 does not properly clone detached, unknown element nodes\n\t\t\t\t} else {\n\t\t\t\t\tfragmentDiv.innerHTML = elem.outerHTML;\n\t\t\t\t\tfragmentDiv.removeChild(clone = fragmentDiv.firstChild);\n\t\t\t\t}\n\t\n\t\t\t\tif ((!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {\n\t\n\t\t\t\t\t// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2\n\t\t\t\t\tdestElements = getAll(clone);\n\t\t\t\t\tsrcElements = getAll(elem);\n\t\n\t\t\t\t\t// Fix all IE cloning issues\n\t\t\t\t\tfor (i = 0; (node = srcElements[i]) != null; ++i) {\n\t\n\t\t\t\t\t\t// Ensure that the destination node is not null; Fixes #9587\n\t\t\t\t\t\tif (destElements[i]) {\n\t\t\t\t\t\t\tfixCloneNodeIssues(node, destElements[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Copy the events from the original to the clone\n\t\t\t\tif (dataAndEvents) {\n\t\t\t\t\tif (deepDataAndEvents) {\n\t\t\t\t\t\tsrcElements = srcElements || getAll(elem);\n\t\t\t\t\t\tdestElements = destElements || getAll(clone);\n\t\n\t\t\t\t\t\tfor (i = 0; (node = srcElements[i]) != null; i++) {\n\t\t\t\t\t\t\tcloneCopyEvent(node, destElements[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcloneCopyEvent(elem, clone);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Preserve script evaluation history\n\t\t\t\tdestElements = getAll(clone, \"script\");\n\t\t\t\tif (destElements.length > 0) {\n\t\t\t\t\tsetGlobalEval(destElements, !inPage && getAll(elem, \"script\"));\n\t\t\t\t}\n\t\n\t\t\t\tdestElements = srcElements = node = null;\n\t\n\t\t\t\t// Return the cloned set\n\t\t\t\treturn clone;\n\t\t\t},\n\t\n\t\t\tcleanData: function (elems, /* internal */forceAcceptData) {\n\t\t\t\tvar elem,\n\t\t\t\t type,\n\t\t\t\t id,\n\t\t\t\t data,\n\t\t\t\t i = 0,\n\t\t\t\t internalKey = jQuery.expando,\n\t\t\t\t cache = jQuery.cache,\n\t\t\t\t attributes = support.attributes,\n\t\t\t\t special = jQuery.event.special;\n\t\n\t\t\t\tfor (; (elem = elems[i]) != null; i++) {\n\t\t\t\t\tif (forceAcceptData || acceptData(elem)) {\n\t\n\t\t\t\t\t\tid = elem[internalKey];\n\t\t\t\t\t\tdata = id && cache[id];\n\t\n\t\t\t\t\t\tif (data) {\n\t\t\t\t\t\t\tif (data.events) {\n\t\t\t\t\t\t\t\tfor (type in data.events) {\n\t\t\t\t\t\t\t\t\tif (special[type]) {\n\t\t\t\t\t\t\t\t\t\tjQuery.event.remove(elem, type);\n\t\n\t\t\t\t\t\t\t\t\t\t// This is a shortcut to avoid jQuery.event.remove's overhead\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tjQuery.removeEvent(elem, type, data.handle);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t// Remove cache only if it was not already removed by jQuery.event.remove\n\t\t\t\t\t\t\tif (cache[id]) {\n\t\n\t\t\t\t\t\t\t\tdelete cache[id];\n\t\n\t\t\t\t\t\t\t\t// Support: IE<9\n\t\t\t\t\t\t\t\t// IE does not allow us to delete expando properties from nodes\n\t\t\t\t\t\t\t\t// IE creates expando attributes along with the property\n\t\t\t\t\t\t\t\t// IE does not have a removeAttribute function on Document nodes\n\t\t\t\t\t\t\t\tif (!attributes && typeof elem.removeAttribute !== \"undefined\") {\n\t\t\t\t\t\t\t\t\telem.removeAttribute(internalKey);\n\t\n\t\t\t\t\t\t\t\t\t// Webkit & Blink performance suffers when deleting properties\n\t\t\t\t\t\t\t\t\t// from DOM nodes, so set to undefined instead\n\t\t\t\t\t\t\t\t\t// https://code.google.com/p/chromium/issues/detail?id=378607\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\telem[internalKey] = undefined;\n\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\tdeletedIds.push(id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\n\t\tjQuery.fn.extend({\n\t\n\t\t\t// Keep domManip exposed until 3.0 (gh-2225)\n\t\t\tdomManip: domManip,\n\t\n\t\t\tdetach: function (selector) {\n\t\t\t\treturn remove(this, selector, true);\n\t\t\t},\n\t\n\t\t\tremove: function (selector) {\n\t\t\t\treturn remove(this, selector);\n\t\t\t},\n\t\n\t\t\ttext: function (value) {\n\t\t\t\treturn access(this, function (value) {\n\t\t\t\t\treturn value === undefined ? jQuery.text(this) : this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value));\n\t\t\t\t}, null, value, arguments.length);\n\t\t\t},\n\t\n\t\t\tappend: function () {\n\t\t\t\treturn domManip(this, arguments, function (elem) {\n\t\t\t\t\tif (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n\t\t\t\t\t\tvar target = manipulationTarget(this, elem);\n\t\t\t\t\t\ttarget.appendChild(elem);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\n\t\t\tprepend: function () {\n\t\t\t\treturn domManip(this, arguments, function (elem) {\n\t\t\t\t\tif (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n\t\t\t\t\t\tvar target = manipulationTarget(this, elem);\n\t\t\t\t\t\ttarget.insertBefore(elem, target.firstChild);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\n\t\t\tbefore: function () {\n\t\t\t\treturn domManip(this, arguments, function (elem) {\n\t\t\t\t\tif (this.parentNode) {\n\t\t\t\t\t\tthis.parentNode.insertBefore(elem, this);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\n\t\t\tafter: function () {\n\t\t\t\treturn domManip(this, arguments, function (elem) {\n\t\t\t\t\tif (this.parentNode) {\n\t\t\t\t\t\tthis.parentNode.insertBefore(elem, this.nextSibling);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\n\t\t\tempty: function () {\n\t\t\t\tvar elem,\n\t\t\t\t i = 0;\n\t\n\t\t\t\tfor (; (elem = this[i]) != null; i++) {\n\t\n\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\tif (elem.nodeType === 1) {\n\t\t\t\t\t\tjQuery.cleanData(getAll(elem, false));\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Remove any remaining nodes\n\t\t\t\t\twhile (elem.firstChild) {\n\t\t\t\t\t\telem.removeChild(elem.firstChild);\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If this is a select, ensure that it displays empty (#12336)\n\t\t\t\t\t// Support: IE<9\n\t\t\t\t\tif (elem.options && jQuery.nodeName(elem, \"select\")) {\n\t\t\t\t\t\telem.options.length = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\treturn this;\n\t\t\t},\n\t\n\t\t\tclone: function (dataAndEvents, deepDataAndEvents) {\n\t\t\t\tdataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n\t\t\t\tdeepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\t\n\t\t\t\treturn this.map(function () {\n\t\t\t\t\treturn jQuery.clone(this, dataAndEvents, deepDataAndEvents);\n\t\t\t\t});\n\t\t\t},\n\t\n\t\t\thtml: function (value) {\n\t\t\t\treturn access(this, function (value) {\n\t\t\t\t\tvar elem = this[0] || {},\n\t\t\t\t\t i = 0,\n\t\t\t\t\t l = this.length;\n\t\n\t\t\t\t\tif (value === undefined) {\n\t\t\t\t\t\treturn elem.nodeType === 1 ? elem.innerHTML.replace(rinlinejQuery, \"\") : undefined;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// See if we can take a shortcut and just use innerHTML\n\t\t\t\t\tif (typeof value === \"string\" && !rnoInnerhtml.test(value) && (support.htmlSerialize || !rnoshimcache.test(value)) && (support.leadingWhitespace || !rleadingWhitespace.test(value)) && !wrapMap[(rtagName.exec(value) || [\"\", \"\"])[1].toLowerCase()]) {\n\t\n\t\t\t\t\t\tvalue = jQuery.htmlPrefilter(value);\n\t\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tfor (; i < l; i++) {\n\t\n\t\t\t\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\t\t\t\telem = this[i] || {};\n\t\t\t\t\t\t\t\tif (elem.nodeType === 1) {\n\t\t\t\t\t\t\t\t\tjQuery.cleanData(getAll(elem, false));\n\t\t\t\t\t\t\t\t\telem.innerHTML = value;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\telem = 0;\n\t\n\t\t\t\t\t\t\t// If using innerHTML throws an exception, use the fallback method\n\t\t\t\t\t\t} catch (e) {}\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (elem) {\n\t\t\t\t\t\tthis.empty().append(value);\n\t\t\t\t\t}\n\t\t\t\t}, null, value, arguments.length);\n\t\t\t},\n\t\n\t\t\treplaceWith: function () {\n\t\t\t\tvar ignored = [];\n\t\n\t\t\t\t// Make the changes, replacing each non-ignored context element with the new content\n\t\t\t\treturn domManip(this, arguments, function (elem) {\n\t\t\t\t\tvar parent = this.parentNode;\n\t\n\t\t\t\t\tif (jQuery.inArray(this, ignored) < 0) {\n\t\t\t\t\t\tjQuery.cleanData(getAll(this));\n\t\t\t\t\t\tif (parent) {\n\t\t\t\t\t\t\tparent.replaceChild(elem, this);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Force callback invocation\n\t\t\t\t}, ignored);\n\t\t\t}\n\t\t});\n\t\n\t\tjQuery.each({\n\t\t\tappendTo: \"append\",\n\t\t\tprependTo: \"prepend\",\n\t\t\tinsertBefore: \"before\",\n\t\t\tinsertAfter: \"after\",\n\t\t\treplaceAll: \"replaceWith\"\n\t\t}, function (name, original) {\n\t\t\tjQuery.fn[name] = function (selector) {\n\t\t\t\tvar elems,\n\t\t\t\t i = 0,\n\t\t\t\t ret = [],\n\t\t\t\t insert = jQuery(selector),\n\t\t\t\t last = insert.length - 1;\n\t\n\t\t\t\tfor (; i <= last; i++) {\n\t\t\t\t\telems = i === last ? this : this.clone(true);\n\t\t\t\t\tjQuery(insert[i])[original](elems);\n\t\n\t\t\t\t\t// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()\n\t\t\t\t\tpush.apply(ret, elems.get());\n\t\t\t\t}\n\t\n\t\t\t\treturn this.pushStack(ret);\n\t\t\t};\n\t\t});\n\t\n\t\tvar iframe,\n\t\t elemdisplay = {\n\t\n\t\t\t// Support: Firefox\n\t\t\t// We have to pre-define these values for FF (#10227)\n\t\t\tHTML: \"block\",\n\t\t\tBODY: \"block\"\n\t\t};\n\t\n\t\t/**\n\t * Retrieve the actual display of a element\n\t * @param {String} name nodeName of the element\n\t * @param {Object} doc Document object\n\t */\n\t\n\t\t// Called only from within defaultDisplay\n\t\tfunction actualDisplay(name, doc) {\n\t\t\tvar elem = jQuery(doc.createElement(name)).appendTo(doc.body),\n\t\t\t display = jQuery.css(elem[0], \"display\");\n\t\n\t\t\t// We don't have any data stored on the element,\n\t\t\t// so use \"detach\" method as fast way to get rid of the element\n\t\t\telem.detach();\n\t\n\t\t\treturn display;\n\t\t}\n\t\n\t\t/**\n\t * Try to determine the default display value of an element\n\t * @param {String} nodeName\n\t */\n\t\tfunction defaultDisplay(nodeName) {\n\t\t\tvar doc = document,\n\t\t\t display = elemdisplay[nodeName];\n\t\n\t\t\tif (!display) {\n\t\t\t\tdisplay = actualDisplay(nodeName, doc);\n\t\n\t\t\t\t// If the simple way fails, read from inside an iframe\n\t\t\t\tif (display === \"none\" || !display) {\n\t\n\t\t\t\t\t// Use the already-created iframe if possible\n\t\t\t\t\tiframe = (iframe || jQuery(\"\")\n\t });\n\t modal.show({ backdrop: true });\n\t }\n\t\n\t // ============================================================================\n\t return {\n\t Modal: Modal,\n\t hide_modal: hide_modal,\n\t show_modal: show_modal,\n\t show_message: show_message,\n\t show_in_overlay: show_in_overlay\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }),\n/* 74 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(jQuery) {/* ========================================================================\n\t * bootstrap-tour - v0.10.2\n\t * http://bootstraptour.com\n\t * ========================================================================\n\t * Copyright 2012-2015 Ulrich Sossou\n\t *\n\t * ========================================================================\n\t * Licensed under the MIT License (the \"License\");\n\t * you may not use this file except in compliance with the License.\n\t * You may obtain a copy of the License at\n\t *\n\t * https://opensource.org/licenses/MIT\n\t *\n\t * Unless required by applicable law or agreed to in writing, software\n\t * distributed under the License is distributed on an \"AS IS\" BASIS,\n\t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\t * See the License for the specific language governing permissions and\n\t * limitations under the License.\n\t * ========================================================================\n\t */\n\t\n\t(function ($, window) {\n\t var Tour, document;\n\t document = window.document;\n\t Tour = function () {\n\t function Tour(options) {\n\t var storage;\n\t try {\n\t storage = window.localStorage;\n\t } catch (_error) {\n\t storage = false;\n\t }\n\t this._options = $.extend({\n\t name: 'tour',\n\t steps: [],\n\t container: 'body',\n\t autoscroll: true,\n\t keyboard: true,\n\t storage: storage,\n\t debug: false,\n\t backdrop: false,\n\t backdropContainer: 'body',\n\t backdropPadding: 0,\n\t redirect: true,\n\t orphan: false,\n\t duration: false,\n\t delay: false,\n\t basePath: '',\n\t template: '

                                                                ',\n\t afterSetState: function (key, value) {},\n\t afterGetState: function (key, value) {},\n\t afterRemoveState: function (key) {},\n\t onStart: function (tour) {},\n\t onEnd: function (tour) {},\n\t onShow: function (tour) {},\n\t onShown: function (tour) {},\n\t onHide: function (tour) {},\n\t onHidden: function (tour) {},\n\t onNext: function (tour) {},\n\t onPrev: function (tour) {},\n\t onPause: function (tour, duration) {},\n\t onResume: function (tour, duration) {},\n\t onRedirectError: function (tour) {}\n\t }, options);\n\t this._force = false;\n\t this._inited = false;\n\t this._current = null;\n\t this.backdrop = {\n\t overlay: null,\n\t $element: null,\n\t $background: null,\n\t backgroundShown: false,\n\t overlayElementShown: false\n\t };\n\t this;\n\t }\n\t\n\t Tour.prototype.addSteps = function (steps) {\n\t var step, _i, _len;\n\t for (_i = 0, _len = steps.length; _i < _len; _i++) {\n\t step = steps[_i];\n\t this.addStep(step);\n\t }\n\t return this;\n\t };\n\t\n\t Tour.prototype.addStep = function (step) {\n\t this._options.steps.push(step);\n\t return this;\n\t };\n\t\n\t Tour.prototype.getStep = function (i) {\n\t if (this._options.steps[i] != null) {\n\t return $.extend({\n\t id: \"step-\" + i,\n\t path: '',\n\t host: '',\n\t placement: 'right',\n\t title: '',\n\t content: '

                                                                ',\n\t next: i === this._options.steps.length - 1 ? -1 : i + 1,\n\t prev: i - 1,\n\t animation: true,\n\t container: this._options.container,\n\t autoscroll: this._options.autoscroll,\n\t backdrop: this._options.backdrop,\n\t backdropContainer: this._options.backdropContainer,\n\t backdropPadding: this._options.backdropPadding,\n\t redirect: this._options.redirect,\n\t reflexElement: this._options.steps[i].element,\n\t orphan: this._options.orphan,\n\t duration: this._options.duration,\n\t delay: this._options.delay,\n\t template: this._options.template,\n\t onShow: this._options.onShow,\n\t onShown: this._options.onShown,\n\t onHide: this._options.onHide,\n\t onHidden: this._options.onHidden,\n\t onNext: this._options.onNext,\n\t onPrev: this._options.onPrev,\n\t onPause: this._options.onPause,\n\t onResume: this._options.onResume,\n\t onRedirectError: this._options.onRedirectError\n\t }, this._options.steps[i]);\n\t }\n\t };\n\t\n\t Tour.prototype.init = function (force) {\n\t this._force = force;\n\t if (this.ended()) {\n\t this._debug('Tour ended, init prevented.');\n\t return this;\n\t }\n\t this.setCurrentStep();\n\t this._initMouseNavigation();\n\t this._initKeyboardNavigation();\n\t this._onResize(function (_this) {\n\t return function () {\n\t return _this.showStep(_this._current);\n\t };\n\t }(this));\n\t if (this._current !== null) {\n\t this.showStep(this._current);\n\t }\n\t this._inited = true;\n\t return this;\n\t };\n\t\n\t Tour.prototype.start = function (force) {\n\t var promise;\n\t if (force == null) {\n\t force = false;\n\t }\n\t if (!this._inited) {\n\t this.init(force);\n\t }\n\t if (this._current === null) {\n\t promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0);\n\t this._callOnPromiseDone(promise, this.showStep, 0);\n\t }\n\t return this;\n\t };\n\t\n\t Tour.prototype.next = function () {\n\t var promise;\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, this._showNextStep);\n\t };\n\t\n\t Tour.prototype.prev = function () {\n\t var promise;\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, this._showPrevStep);\n\t };\n\t\n\t Tour.prototype.goTo = function (i) {\n\t var promise;\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, this.showStep, i);\n\t };\n\t\n\t Tour.prototype.end = function () {\n\t var endHelper, promise;\n\t endHelper = function (_this) {\n\t return function (e) {\n\t $(document).off(\"click.tour-\" + _this._options.name);\n\t $(document).off(\"keyup.tour-\" + _this._options.name);\n\t $(window).off(\"resize.tour-\" + _this._options.name);\n\t _this._setState('end', 'yes');\n\t _this._inited = false;\n\t _this._force = false;\n\t _this._clearTimer();\n\t if (_this._options.onEnd != null) {\n\t return _this._options.onEnd(_this);\n\t }\n\t };\n\t }(this);\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, endHelper);\n\t };\n\t\n\t Tour.prototype.ended = function () {\n\t return !this._force && !!this._getState('end');\n\t };\n\t\n\t Tour.prototype.restart = function () {\n\t this._removeState('current_step');\n\t this._removeState('end');\n\t this._removeState('redirect_to');\n\t return this.start();\n\t };\n\t\n\t Tour.prototype.pause = function () {\n\t var step;\n\t step = this.getStep(this._current);\n\t if (!(step && step.duration)) {\n\t return this;\n\t }\n\t this._paused = true;\n\t this._duration -= new Date().getTime() - this._start;\n\t window.clearTimeout(this._timer);\n\t this._debug(\"Paused/Stopped step \" + (this._current + 1) + \" timer (\" + this._duration + \" remaining).\");\n\t if (step.onPause != null) {\n\t return step.onPause(this, this._duration);\n\t }\n\t };\n\t\n\t Tour.prototype.resume = function () {\n\t var step;\n\t step = this.getStep(this._current);\n\t if (!(step && step.duration)) {\n\t return this;\n\t }\n\t this._paused = false;\n\t this._start = new Date().getTime();\n\t this._duration = this._duration || step.duration;\n\t this._timer = window.setTimeout(function (_this) {\n\t return function () {\n\t if (_this._isLast()) {\n\t return _this.next();\n\t } else {\n\t return _this.end();\n\t }\n\t };\n\t }(this), this._duration);\n\t this._debug(\"Started step \" + (this._current + 1) + \" timer with duration \" + this._duration);\n\t if (step.onResume != null && this._duration !== step.duration) {\n\t return step.onResume(this, this._duration);\n\t }\n\t };\n\t\n\t Tour.prototype.hideStep = function (i) {\n\t var hideStepHelper, promise, step;\n\t step = this.getStep(i);\n\t if (!step) {\n\t return;\n\t }\n\t this._clearTimer();\n\t promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0);\n\t hideStepHelper = function (_this) {\n\t return function (e) {\n\t var $element;\n\t $element = $(step.element);\n\t if (!($element.data('bs.popover') || $element.data('popover'))) {\n\t $element = $('body');\n\t }\n\t $element.popover('destroy').removeClass(\"tour-\" + _this._options.name + \"-element tour-\" + _this._options.name + \"-\" + i + \"-element\");\n\t $element.removeData('bs.popover');\n\t if (step.reflex) {\n\t $(step.reflexElement).removeClass('tour-step-element-reflex').off(\"\" + _this._reflexEvent(step.reflex) + \".tour-\" + _this._options.name);\n\t }\n\t if (step.backdrop) {\n\t _this._hideBackdrop();\n\t }\n\t if (step.onHidden != null) {\n\t return step.onHidden(_this);\n\t }\n\t };\n\t }(this);\n\t this._callOnPromiseDone(promise, hideStepHelper);\n\t return promise;\n\t };\n\t\n\t Tour.prototype.showStep = function (i) {\n\t var promise, showStepHelper, skipToPrevious, step;\n\t if (this.ended()) {\n\t this._debug('Tour ended, showStep prevented.');\n\t return this;\n\t }\n\t step = this.getStep(i);\n\t if (!step) {\n\t return;\n\t }\n\t skipToPrevious = i < this._current;\n\t promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);\n\t showStepHelper = function (_this) {\n\t return function (e) {\n\t var path, showPopoverAndOverlay;\n\t _this.setCurrentStep(i);\n\t path = function () {\n\t switch ({}.toString.call(step.path)) {\n\t case '[object Function]':\n\t return step.path();\n\t case '[object String]':\n\t return this._options.basePath + step.path;\n\t default:\n\t return step.path;\n\t }\n\t }.call(_this);\n\t if (_this._isRedirect(step.host, path, document.location)) {\n\t _this._redirect(step, i, path);\n\t if (!_this._isJustPathHashDifferent(step.host, path, document.location)) {\n\t return;\n\t }\n\t }\n\t if (_this._isOrphan(step)) {\n\t if (step.orphan === false) {\n\t _this._debug(\"Skip the orphan step \" + (_this._current + 1) + \".\\nOrphan option is false and the element does not exist or is hidden.\");\n\t if (skipToPrevious) {\n\t _this._showPrevStep();\n\t } else {\n\t _this._showNextStep();\n\t }\n\t return;\n\t }\n\t _this._debug(\"Show the orphan step \" + (_this._current + 1) + \". Orphans option is true.\");\n\t }\n\t if (step.backdrop) {\n\t _this._showBackdrop(step);\n\t }\n\t showPopoverAndOverlay = function () {\n\t if (_this.getCurrentStep() !== i || _this.ended()) {\n\t return;\n\t }\n\t if (step.element != null && step.backdrop) {\n\t _this._showOverlayElement(step);\n\t }\n\t _this._showPopover(step, i);\n\t if (step.onShown != null) {\n\t step.onShown(_this);\n\t }\n\t return _this._debug(\"Step \" + (_this._current + 1) + \" of \" + _this._options.steps.length);\n\t };\n\t if (step.autoscroll) {\n\t _this._scrollIntoView(step.element, showPopoverAndOverlay);\n\t } else {\n\t showPopoverAndOverlay();\n\t }\n\t if (step.duration) {\n\t return _this.resume();\n\t }\n\t };\n\t }(this);\n\t if (step.delay) {\n\t this._debug(\"Wait \" + step.delay + \" milliseconds to show the step \" + (this._current + 1));\n\t window.setTimeout(function (_this) {\n\t return function () {\n\t return _this._callOnPromiseDone(promise, showStepHelper);\n\t };\n\t }(this), step.delay);\n\t } else {\n\t this._callOnPromiseDone(promise, showStepHelper);\n\t }\n\t return promise;\n\t };\n\t\n\t Tour.prototype.getCurrentStep = function () {\n\t return this._current;\n\t };\n\t\n\t Tour.prototype.setCurrentStep = function (value) {\n\t if (value != null) {\n\t this._current = value;\n\t this._setState('current_step', value);\n\t } else {\n\t this._current = this._getState('current_step');\n\t this._current = this._current === null ? null : parseInt(this._current, 10);\n\t }\n\t return this;\n\t };\n\t\n\t Tour.prototype.redraw = function () {\n\t return this._showOverlayElement(this.getStep(this.getCurrentStep()).element, true);\n\t };\n\t\n\t Tour.prototype._setState = function (key, value) {\n\t var e, keyName;\n\t if (this._options.storage) {\n\t keyName = \"\" + this._options.name + \"_\" + key;\n\t try {\n\t this._options.storage.setItem(keyName, value);\n\t } catch (_error) {\n\t e = _error;\n\t if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {\n\t this._debug('LocalStorage quota exceeded. State storage failed.');\n\t }\n\t }\n\t return this._options.afterSetState(keyName, value);\n\t } else {\n\t if (this._state == null) {\n\t this._state = {};\n\t }\n\t return this._state[key] = value;\n\t }\n\t };\n\t\n\t Tour.prototype._removeState = function (key) {\n\t var keyName;\n\t if (this._options.storage) {\n\t keyName = \"\" + this._options.name + \"_\" + key;\n\t this._options.storage.removeItem(keyName);\n\t return this._options.afterRemoveState(keyName);\n\t } else {\n\t if (this._state != null) {\n\t return delete this._state[key];\n\t }\n\t }\n\t };\n\t\n\t Tour.prototype._getState = function (key) {\n\t var keyName, value;\n\t if (this._options.storage) {\n\t keyName = \"\" + this._options.name + \"_\" + key;\n\t value = this._options.storage.getItem(keyName);\n\t } else {\n\t if (this._state != null) {\n\t value = this._state[key];\n\t }\n\t }\n\t if (value === void 0 || value === 'null') {\n\t value = null;\n\t }\n\t this._options.afterGetState(key, value);\n\t return value;\n\t };\n\t\n\t Tour.prototype._showNextStep = function () {\n\t var promise, showNextStepHelper, step;\n\t step = this.getStep(this._current);\n\t showNextStepHelper = function (_this) {\n\t return function (e) {\n\t return _this.showStep(step.next);\n\t };\n\t }(this);\n\t promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0);\n\t return this._callOnPromiseDone(promise, showNextStepHelper);\n\t };\n\t\n\t Tour.prototype._showPrevStep = function () {\n\t var promise, showPrevStepHelper, step;\n\t step = this.getStep(this._current);\n\t showPrevStepHelper = function (_this) {\n\t return function (e) {\n\t return _this.showStep(step.prev);\n\t };\n\t }(this);\n\t promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0);\n\t return this._callOnPromiseDone(promise, showPrevStepHelper);\n\t };\n\t\n\t Tour.prototype._debug = function (text) {\n\t if (this._options.debug) {\n\t return window.console.log(\"Bootstrap Tour '\" + this._options.name + \"' | \" + text);\n\t }\n\t };\n\t\n\t Tour.prototype._isRedirect = function (host, path, location) {\n\t var currentPath;\n\t if (host !== '') {\n\t if (this._isHostDifferent(host, location.href)) {\n\t return true;\n\t }\n\t }\n\t currentPath = [location.pathname, location.search, location.hash].join('');\n\t return path != null && path !== '' && ({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath) || {}.toString.call(path) === '[object String]' && this._isPathDifferent(path, currentPath));\n\t };\n\t\n\t Tour.prototype._isHostDifferent = function (host, currentURL) {\n\t return this._getProtocol(host) !== this._getProtocol(currentURL) || this._getHost(host) !== this._getHost(currentURL);\n\t };\n\t\n\t Tour.prototype._isPathDifferent = function (path, currentPath) {\n\t return this._getPath(path) !== this._getPath(currentPath) || !this._equal(this._getQuery(path), this._getQuery(currentPath)) || !this._equal(this._getHash(path), this._getHash(currentPath));\n\t };\n\t\n\t Tour.prototype._isJustPathHashDifferent = function (host, path, location) {\n\t var currentPath;\n\t if (host !== '') {\n\t if (this._isHostDifferent(host, location.href)) {\n\t return false;\n\t }\n\t }\n\t currentPath = [location.pathname, location.search, location.hash].join('');\n\t if ({}.toString.call(path) === '[object String]') {\n\t return this._getPath(path) === this._getPath(currentPath) && this._equal(this._getQuery(path), this._getQuery(currentPath)) && !this._equal(this._getHash(path), this._getHash(currentPath));\n\t }\n\t return false;\n\t };\n\t\n\t Tour.prototype._redirect = function (step, i, path) {\n\t if ($.isFunction(step.redirect)) {\n\t return step.redirect.call(this, path);\n\t } else if (step.redirect === true) {\n\t this._debug(\"Redirect to \" + step.host + path);\n\t if (this._getState('redirect_to') === \"\" + i) {\n\t this._debug(\"Error redirection loop to \" + path);\n\t this._removeState('redirect_to');\n\t if (step.onRedirectError != null) {\n\t return step.onRedirectError(this);\n\t }\n\t } else {\n\t this._setState('redirect_to', \"\" + i);\n\t return document.location.href = \"\" + step.host + path;\n\t }\n\t }\n\t };\n\t\n\t Tour.prototype._isOrphan = function (step) {\n\t return step.element == null || !$(step.element).length || $(step.element).is(':hidden') && $(step.element)[0].namespaceURI !== 'http://www.w3.org/2000/svg';\n\t };\n\t\n\t Tour.prototype._isLast = function () {\n\t return this._current < this._options.steps.length - 1;\n\t };\n\t\n\t Tour.prototype._showPopover = function (step, i) {\n\t var $element, $tip, isOrphan, options, shouldAddSmart;\n\t $(\".tour-\" + this._options.name).remove();\n\t options = $.extend({}, this._options);\n\t isOrphan = this._isOrphan(step);\n\t step.template = this._template(step, i);\n\t if (isOrphan) {\n\t step.element = 'body';\n\t step.placement = 'top';\n\t }\n\t $element = $(step.element);\n\t $element.addClass(\"tour-\" + this._options.name + \"-element tour-\" + this._options.name + \"-\" + i + \"-element\");\n\t if (step.options) {\n\t $.extend(options, step.options);\n\t }\n\t if (step.reflex && !isOrphan) {\n\t $(step.reflexElement).addClass('tour-step-element-reflex').off(\"\" + this._reflexEvent(step.reflex) + \".tour-\" + this._options.name).on(\"\" + this._reflexEvent(step.reflex) + \".tour-\" + this._options.name, function (_this) {\n\t return function () {\n\t if (_this._isLast()) {\n\t return _this.next();\n\t } else {\n\t return _this.end();\n\t }\n\t };\n\t }(this));\n\t }\n\t shouldAddSmart = step.smartPlacement === true && step.placement.search(/auto/i) === -1;\n\t $element.popover({\n\t placement: shouldAddSmart ? \"auto \" + step.placement : step.placement,\n\t trigger: 'manual',\n\t title: step.title,\n\t content: step.content,\n\t html: true,\n\t animation: step.animation,\n\t container: step.container,\n\t template: step.template,\n\t selector: step.element\n\t }).popover('show');\n\t $tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();\n\t $tip.attr('id', step.id);\n\t this._reposition($tip, step);\n\t if (isOrphan) {\n\t return this._center($tip);\n\t }\n\t };\n\t\n\t Tour.prototype._template = function (step, i) {\n\t var $navigation, $next, $prev, $resume, $template, template;\n\t template = step.template;\n\t if (this._isOrphan(step) && {}.toString.call(step.orphan) !== '[object Boolean]') {\n\t template = step.orphan;\n\t }\n\t $template = $.isFunction(template) ? $(template(i, step)) : $(template);\n\t $navigation = $template.find('.popover-navigation');\n\t $prev = $navigation.find('[data-role=\"prev\"]');\n\t $next = $navigation.find('[data-role=\"next\"]');\n\t $resume = $navigation.find('[data-role=\"pause-resume\"]');\n\t if (this._isOrphan(step)) {\n\t $template.addClass('orphan');\n\t }\n\t $template.addClass(\"tour-\" + this._options.name + \" tour-\" + this._options.name + \"-\" + i);\n\t if (step.reflex) {\n\t $template.addClass(\"tour-\" + this._options.name + \"-reflex\");\n\t }\n\t if (step.prev < 0) {\n\t $prev.addClass('disabled');\n\t $prev.prop('disabled', true);\n\t }\n\t if (step.next < 0) {\n\t $next.addClass('disabled');\n\t $next.prop('disabled', true);\n\t }\n\t if (!step.duration) {\n\t $resume.remove();\n\t }\n\t return $template.clone().wrap('
                                                                ').parent().html();\n\t };\n\t\n\t Tour.prototype._reflexEvent = function (reflex) {\n\t if ({}.toString.call(reflex) === '[object Boolean]') {\n\t return 'click';\n\t } else {\n\t return reflex;\n\t }\n\t };\n\t\n\t Tour.prototype._reposition = function ($tip, step) {\n\t var offsetBottom, offsetHeight, offsetRight, offsetWidth, originalLeft, originalTop, tipOffset;\n\t offsetWidth = $tip[0].offsetWidth;\n\t offsetHeight = $tip[0].offsetHeight;\n\t tipOffset = $tip.offset();\n\t originalLeft = tipOffset.left;\n\t originalTop = tipOffset.top;\n\t offsetBottom = $(document).outerHeight() - tipOffset.top - $tip.outerHeight();\n\t if (offsetBottom < 0) {\n\t tipOffset.top = tipOffset.top + offsetBottom;\n\t }\n\t offsetRight = $('html').outerWidth() - tipOffset.left - $tip.outerWidth();\n\t if (offsetRight < 0) {\n\t tipOffset.left = tipOffset.left + offsetRight;\n\t }\n\t if (tipOffset.top < 0) {\n\t tipOffset.top = 0;\n\t }\n\t if (tipOffset.left < 0) {\n\t tipOffset.left = 0;\n\t }\n\t $tip.offset(tipOffset);\n\t if (step.placement === 'bottom' || step.placement === 'top') {\n\t if (originalLeft !== tipOffset.left) {\n\t return this._replaceArrow($tip, (tipOffset.left - originalLeft) * 2, offsetWidth, 'left');\n\t }\n\t } else {\n\t if (originalTop !== tipOffset.top) {\n\t return this._replaceArrow($tip, (tipOffset.top - originalTop) * 2, offsetHeight, 'top');\n\t }\n\t }\n\t };\n\t\n\t Tour.prototype._center = function ($tip) {\n\t return $tip.css('top', $(window).outerHeight() / 2 - $tip.outerHeight() / 2);\n\t };\n\t\n\t Tour.prototype._replaceArrow = function ($tip, delta, dimension, position) {\n\t return $tip.find('.arrow').css(position, delta ? 50 * (1 - delta / dimension) + '%' : '');\n\t };\n\t\n\t Tour.prototype._scrollIntoView = function (element, callback) {\n\t var $element, $window, counter, offsetTop, scrollTop, windowHeight;\n\t $element = $(element);\n\t if (!$element.length) {\n\t return callback();\n\t }\n\t $window = $(window);\n\t offsetTop = $element.offset().top;\n\t windowHeight = $window.height();\n\t scrollTop = Math.max(0, offsetTop - windowHeight / 2);\n\t this._debug(\"Scroll into view. ScrollTop: \" + scrollTop + \". Element offset: \" + offsetTop + \". Window height: \" + windowHeight + \".\");\n\t counter = 0;\n\t return $('body, html').stop(true, true).animate({\n\t scrollTop: Math.ceil(scrollTop)\n\t }, function (_this) {\n\t return function () {\n\t if (++counter === 2) {\n\t callback();\n\t return _this._debug(\"Scroll into view.\\nAnimation end element offset: \" + $element.offset().top + \".\\nWindow height: \" + $window.height() + \".\");\n\t }\n\t };\n\t }(this));\n\t };\n\t\n\t Tour.prototype._onResize = function (callback, timeout) {\n\t return $(window).on(\"resize.tour-\" + this._options.name, function () {\n\t clearTimeout(timeout);\n\t return timeout = setTimeout(callback, 100);\n\t });\n\t };\n\t\n\t Tour.prototype._initMouseNavigation = function () {\n\t var _this;\n\t _this = this;\n\t return $(document).off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\").on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\", function (_this) {\n\t return function (e) {\n\t e.preventDefault();\n\t return _this.next();\n\t };\n\t }(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\", function (_this) {\n\t return function (e) {\n\t e.preventDefault();\n\t return _this.prev();\n\t };\n\t }(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\", function (_this) {\n\t return function (e) {\n\t e.preventDefault();\n\t return _this.end();\n\t };\n\t }(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\", function (e) {\n\t var $this;\n\t e.preventDefault();\n\t $this = $(this);\n\t $this.text(_this._paused ? $this.data('pause-text') : $this.data('resume-text'));\n\t if (_this._paused) {\n\t return _this.resume();\n\t } else {\n\t return _this.pause();\n\t }\n\t });\n\t };\n\t\n\t Tour.prototype._initKeyboardNavigation = function () {\n\t if (!this._options.keyboard) {\n\t return;\n\t }\n\t return $(document).on(\"keyup.tour-\" + this._options.name, function (_this) {\n\t return function (e) {\n\t if (!e.which) {\n\t return;\n\t }\n\t switch (e.which) {\n\t case 39:\n\t e.preventDefault();\n\t if (_this._isLast()) {\n\t return _this.next();\n\t } else {\n\t return _this.end();\n\t }\n\t break;\n\t case 37:\n\t e.preventDefault();\n\t if (_this._current > 0) {\n\t return _this.prev();\n\t }\n\t break;\n\t case 27:\n\t e.preventDefault();\n\t return _this.end();\n\t }\n\t };\n\t }(this));\n\t };\n\t\n\t Tour.prototype._makePromise = function (result) {\n\t if (result && $.isFunction(result.then)) {\n\t return result;\n\t } else {\n\t return null;\n\t }\n\t };\n\t\n\t Tour.prototype._callOnPromiseDone = function (promise, cb, arg) {\n\t if (promise) {\n\t return promise.then(function (_this) {\n\t return function (e) {\n\t return cb.call(_this, arg);\n\t };\n\t }(this));\n\t } else {\n\t return cb.call(this, arg);\n\t }\n\t };\n\t\n\t Tour.prototype._showBackdrop = function (step) {\n\t if (this.backdrop.backgroundShown) {\n\t return;\n\t }\n\t this.backdrop = $('
                                                                ', {\n\t \"class\": 'tour-backdrop'\n\t });\n\t this.backdrop.backgroundShown = true;\n\t return $(step.backdropContainer).append(this.backdrop);\n\t };\n\t\n\t Tour.prototype._hideBackdrop = function () {\n\t this._hideOverlayElement();\n\t return this._hideBackground();\n\t };\n\t\n\t Tour.prototype._hideBackground = function () {\n\t if (this.backdrop) {\n\t this.backdrop.remove();\n\t this.backdrop.overlay = null;\n\t return this.backdrop.backgroundShown = false;\n\t }\n\t };\n\t\n\t Tour.prototype._showOverlayElement = function (step, force) {\n\t var $element, elementData;\n\t $element = $(step.element);\n\t if (!$element || $element.length === 0 || this.backdrop.overlayElementShown && !force) {\n\t return;\n\t }\n\t if (!this.backdrop.overlayElementShown) {\n\t this.backdrop.$element = $element.addClass('tour-step-backdrop');\n\t this.backdrop.$background = $('
                                                                ', {\n\t \"class\": 'tour-step-background'\n\t });\n\t this.backdrop.$background.appendTo(step.backdropContainer);\n\t this.backdrop.overlayElementShown = true;\n\t }\n\t elementData = {\n\t width: $element.innerWidth(),\n\t height: $element.innerHeight(),\n\t offset: $element.offset()\n\t };\n\t if (step.backdropPadding) {\n\t elementData = this._applyBackdropPadding(step.backdropPadding, elementData);\n\t }\n\t return this.backdrop.$background.width(elementData.width).height(elementData.height).offset(elementData.offset);\n\t };\n\t\n\t Tour.prototype._hideOverlayElement = function () {\n\t if (!this.backdrop.overlayElementShown) {\n\t return;\n\t }\n\t this.backdrop.$element.removeClass('tour-step-backdrop');\n\t this.backdrop.$background.remove();\n\t this.backdrop.$element = null;\n\t this.backdrop.$background = null;\n\t return this.backdrop.overlayElementShown = false;\n\t };\n\t\n\t Tour.prototype._applyBackdropPadding = function (padding, data) {\n\t if (typeof padding === 'object') {\n\t if (padding.top == null) {\n\t padding.top = 0;\n\t }\n\t if (padding.right == null) {\n\t padding.right = 0;\n\t }\n\t if (padding.bottom == null) {\n\t padding.bottom = 0;\n\t }\n\t if (padding.left == null) {\n\t padding.left = 0;\n\t }\n\t data.offset.top = data.offset.top - padding.top;\n\t data.offset.left = data.offset.left - padding.left;\n\t data.width = data.width + padding.left + padding.right;\n\t data.height = data.height + padding.top + padding.bottom;\n\t } else {\n\t data.offset.top = data.offset.top - padding;\n\t data.offset.left = data.offset.left - padding;\n\t data.width = data.width + padding * 2;\n\t data.height = data.height + padding * 2;\n\t }\n\t return data;\n\t };\n\t\n\t Tour.prototype._clearTimer = function () {\n\t window.clearTimeout(this._timer);\n\t this._timer = null;\n\t return this._duration = null;\n\t };\n\t\n\t Tour.prototype._getProtocol = function (url) {\n\t url = url.split('://');\n\t if (url.length > 1) {\n\t return url[0];\n\t } else {\n\t return 'http';\n\t }\n\t };\n\t\n\t Tour.prototype._getHost = function (url) {\n\t url = url.split('//');\n\t url = url.length > 1 ? url[1] : url[0];\n\t return url.split('/')[0];\n\t };\n\t\n\t Tour.prototype._getPath = function (path) {\n\t return path.replace(/\\/?$/, '').split('?')[0].split('#')[0];\n\t };\n\t\n\t Tour.prototype._getQuery = function (path) {\n\t return this._getParams(path, '?');\n\t };\n\t\n\t Tour.prototype._getHash = function (path) {\n\t return this._getParams(path, '#');\n\t };\n\t\n\t Tour.prototype._getParams = function (path, start) {\n\t var param, params, paramsObject, _i, _len;\n\t params = path.split(start);\n\t if (params.length === 1) {\n\t return {};\n\t }\n\t params = params[1].split('&');\n\t paramsObject = {};\n\t for (_i = 0, _len = params.length; _i < _len; _i++) {\n\t param = params[_i];\n\t param = param.split('=');\n\t paramsObject[param[0]] = param[1] || '';\n\t }\n\t return paramsObject;\n\t };\n\t\n\t Tour.prototype._equal = function (obj1, obj2) {\n\t var k, v;\n\t if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') {\n\t for (k in obj1) {\n\t v = obj1[k];\n\t if (obj2[k] !== v) {\n\t return false;\n\t }\n\t }\n\t for (k in obj2) {\n\t v = obj2[k];\n\t if (obj1[k] !== v) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t return obj1 === obj2;\n\t };\n\t\n\t return Tour;\n\t }();\n\t return window.Tour = Tour;\n\t})(jQuery, window);\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 75 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(jQuery) {/*! jQuery UI - v1.9.1 - 2012-10-29\n\t* http://jqueryui.com\n\t* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.menu.js, jquery.ui.slider.js\n\t* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */\n\t\n\t(function (e, t) {\n\t function i(t, n) {\n\t var r,\n\t i,\n\t o,\n\t u = t.nodeName.toLowerCase();return \"area\" === u ? (r = t.parentNode, i = r.name, !t.href || !i || r.nodeName.toLowerCase() !== \"map\" ? !1 : (o = e(\"img[usemap=#\" + i + \"]\")[0], !!o && s(o))) : (/input|select|textarea|button|object/.test(u) ? !t.disabled : \"a\" === u ? t.href || n : n) && s(t);\n\t }function s(t) {\n\t return e.expr.filters.visible(t) && !e(t).parents().andSelf().filter(function () {\n\t return e.css(this, \"visibility\") === \"hidden\";\n\t }).length;\n\t }var n = 0,\n\t r = /^ui-id-\\d+$/;e.ui = e.ui || {};if (e.ui.version) return;e.extend(e.ui, { version: \"1.9.1\", keyCode: { BACKSPACE: 8, COMMA: 188, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38 } }), e.fn.extend({ _focus: e.fn.focus, focus: function (t, n) {\n\t return typeof t == \"number\" ? this.each(function () {\n\t var r = this;setTimeout(function () {\n\t e(r).focus(), n && n.call(r);\n\t }, t);\n\t }) : this._focus.apply(this, arguments);\n\t }, scrollParent: function () {\n\t var t;return e.ui.ie && /(static|relative)/.test(this.css(\"position\")) || /absolute/.test(this.css(\"position\")) ? t = this.parents().filter(function () {\n\t return (/(relative|absolute|fixed)/.test(e.css(this, \"position\")) && /(auto|scroll)/.test(e.css(this, \"overflow\") + e.css(this, \"overflow-y\") + e.css(this, \"overflow-x\"))\n\t );\n\t }).eq(0) : t = this.parents().filter(function () {\n\t return (/(auto|scroll)/.test(e.css(this, \"overflow\") + e.css(this, \"overflow-y\") + e.css(this, \"overflow-x\"))\n\t );\n\t }).eq(0), /fixed/.test(this.css(\"position\")) || !t.length ? e(document) : t;\n\t }, zIndex: function (n) {\n\t if (n !== t) return this.css(\"zIndex\", n);if (this.length) {\n\t var r = e(this[0]),\n\t i,\n\t s;while (r.length && r[0] !== document) {\n\t i = r.css(\"position\");if (i === \"absolute\" || i === \"relative\" || i === \"fixed\") {\n\t s = parseInt(r.css(\"zIndex\"), 10);if (!isNaN(s) && s !== 0) return s;\n\t }r = r.parent();\n\t }\n\t }return 0;\n\t }, uniqueId: function () {\n\t return this.each(function () {\n\t this.id || (this.id = \"ui-id-\" + ++n);\n\t });\n\t }, removeUniqueId: function () {\n\t return this.each(function () {\n\t r.test(this.id) && e(this).removeAttr(\"id\");\n\t });\n\t } }), e(\"\").outerWidth(1).jquery || e.each([\"Width\", \"Height\"], function (n, r) {\n\t function u(t, n, r, s) {\n\t return e.each(i, function () {\n\t n -= parseFloat(e.css(t, \"padding\" + this)) || 0, r && (n -= parseFloat(e.css(t, \"border\" + this + \"Width\")) || 0), s && (n -= parseFloat(e.css(t, \"margin\" + this)) || 0);\n\t }), n;\n\t }var i = r === \"Width\" ? [\"Left\", \"Right\"] : [\"Top\", \"Bottom\"],\n\t s = r.toLowerCase(),\n\t o = { innerWidth: e.fn.innerWidth, innerHeight: e.fn.innerHeight, outerWidth: e.fn.outerWidth, outerHeight: e.fn.outerHeight };e.fn[\"inner\" + r] = function (n) {\n\t return n === t ? o[\"inner\" + r].call(this) : this.each(function () {\n\t e(this).css(s, u(this, n) + \"px\");\n\t });\n\t }, e.fn[\"outer\" + r] = function (t, n) {\n\t return typeof t != \"number\" ? o[\"outer\" + r].call(this, t) : this.each(function () {\n\t e(this).css(s, u(this, t, !0, n) + \"px\");\n\t });\n\t };\n\t }), e.extend(e.expr[\":\"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {\n\t return function (n) {\n\t return !!e.data(n, t);\n\t };\n\t }) : function (t, n, r) {\n\t return !!e.data(t, r[3]);\n\t }, focusable: function (t) {\n\t return i(t, !isNaN(e.attr(t, \"tabindex\")));\n\t }, tabbable: function (t) {\n\t var n = e.attr(t, \"tabindex\"),\n\t r = isNaN(n);return (r || n >= 0) && i(t, !r);\n\t } }), e(function () {\n\t var t = document.body,\n\t n = t.appendChild(n = document.createElement(\"div\"));n.offsetHeight, e.extend(n.style, { minHeight: \"100px\", height: \"auto\", padding: 0, borderWidth: 0 }), e.support.minHeight = n.offsetHeight === 100, e.support.selectstart = \"onselectstart\" in n, t.removeChild(n).style.display = \"none\";\n\t }), function () {\n\t var t = /msie ([\\w.]+)/.exec(navigator.userAgent.toLowerCase()) || [];e.ui.ie = t.length ? !0 : !1, e.ui.ie6 = parseFloat(t[1], 10) === 6;\n\t }(), e.fn.extend({ disableSelection: function () {\n\t return this.bind((e.support.selectstart ? \"selectstart\" : \"mousedown\") + \".ui-disableSelection\", function (e) {\n\t e.preventDefault();\n\t });\n\t }, enableSelection: function () {\n\t return this.unbind(\".ui-disableSelection\");\n\t } }), e.extend(e.ui, { plugin: { add: function (t, n, r) {\n\t var i,\n\t s = e.ui[t].prototype;for (i in r) s.plugins[i] = s.plugins[i] || [], s.plugins[i].push([n, r[i]]);\n\t }, call: function (e, t, n) {\n\t var r,\n\t i = e.plugins[t];if (!i || !e.element[0].parentNode || e.element[0].parentNode.nodeType === 11) return;for (r = 0; r < i.length; r++) e.options[i[r][0]] && i[r][1].apply(e.element, n);\n\t } }, contains: e.contains, hasScroll: function (t, n) {\n\t if (e(t).css(\"overflow\") === \"hidden\") return !1;var r = n && n === \"left\" ? \"scrollLeft\" : \"scrollTop\",\n\t i = !1;return t[r] > 0 ? !0 : (t[r] = 1, i = t[r] > 0, t[r] = 0, i);\n\t }, isOverAxis: function (e, t, n) {\n\t return e > t && e < t + n;\n\t }, isOver: function (t, n, r, i, s, o) {\n\t return e.ui.isOverAxis(t, r, s) && e.ui.isOverAxis(n, i, o);\n\t } });\n\t})(jQuery);(function (e, t) {\n\t var n = 0,\n\t r = Array.prototype.slice,\n\t i = e.cleanData;e.cleanData = function (t) {\n\t for (var n = 0, r; (r = t[n]) != null; n++) try {\n\t e(r).triggerHandler(\"remove\");\n\t } catch (s) {}i(t);\n\t }, e.widget = function (t, n, r) {\n\t var i,\n\t s,\n\t o,\n\t u,\n\t a = t.split(\".\")[0];t = t.split(\".\")[1], i = a + \"-\" + t, r || (r = n, n = e.Widget), e.expr[\":\"][i.toLowerCase()] = function (t) {\n\t return !!e.data(t, i);\n\t }, e[a] = e[a] || {}, s = e[a][t], o = e[a][t] = function (e, t) {\n\t if (!this._createWidget) return new o(e, t);arguments.length && this._createWidget(e, t);\n\t }, e.extend(o, s, { version: r.version, _proto: e.extend({}, r), _childConstructors: [] }), u = new n(), u.options = e.widget.extend({}, u.options), e.each(r, function (t, i) {\n\t e.isFunction(i) && (r[t] = function () {\n\t var e = function () {\n\t return n.prototype[t].apply(this, arguments);\n\t },\n\t r = function (e) {\n\t return n.prototype[t].apply(this, e);\n\t };return function () {\n\t var t = this._super,\n\t n = this._superApply,\n\t s;return this._super = e, this._superApply = r, s = i.apply(this, arguments), this._super = t, this._superApply = n, s;\n\t };\n\t }());\n\t }), o.prototype = e.widget.extend(u, { widgetEventPrefix: u.widgetEventPrefix || t }, r, { constructor: o, namespace: a, widgetName: t, widgetBaseClass: i, widgetFullName: i }), s ? (e.each(s._childConstructors, function (t, n) {\n\t var r = n.prototype;e.widget(r.namespace + \".\" + r.widgetName, o, n._proto);\n\t }), delete s._childConstructors) : n._childConstructors.push(o), e.widget.bridge(t, o);\n\t }, e.widget.extend = function (n) {\n\t var i = r.call(arguments, 1),\n\t s = 0,\n\t o = i.length,\n\t u,\n\t a;for (; s < o; s++) for (u in i[s]) a = i[s][u], i[s].hasOwnProperty(u) && a !== t && (e.isPlainObject(a) ? n[u] = e.isPlainObject(n[u]) ? e.widget.extend({}, n[u], a) : e.widget.extend({}, a) : n[u] = a);return n;\n\t }, e.widget.bridge = function (n, i) {\n\t var s = i.prototype.widgetFullName;e.fn[n] = function (o) {\n\t var u = typeof o == \"string\",\n\t a = r.call(arguments, 1),\n\t f = this;return o = !u && a.length ? e.widget.extend.apply(null, [o].concat(a)) : o, u ? this.each(function () {\n\t var r,\n\t i = e.data(this, s);if (!i) return e.error(\"cannot call methods on \" + n + \" prior to initialization; \" + \"attempted to call method '\" + o + \"'\");if (!e.isFunction(i[o]) || o.charAt(0) === \"_\") return e.error(\"no such method '\" + o + \"' for \" + n + \" widget instance\");r = i[o].apply(i, a);if (r !== i && r !== t) return f = r && r.jquery ? f.pushStack(r.get()) : r, !1;\n\t }) : this.each(function () {\n\t var t = e.data(this, s);t ? t.option(o || {})._init() : new i(o, this);\n\t }), f;\n\t };\n\t }, e.Widget = function () {}, e.Widget._childConstructors = [], e.Widget.prototype = { widgetName: \"widget\", widgetEventPrefix: \"\", defaultElement: \"
                                                                \", options: { disabled: !1, create: null }, _createWidget: function (t, r) {\n\t r = e(r || this.defaultElement || this)[0], this.element = e(r), this.uuid = n++, this.eventNamespace = \".\" + this.widgetName + this.uuid, this.options = e.widget.extend({}, this.options, this._getCreateOptions(), t), this.bindings = e(), this.hoverable = e(), this.focusable = e(), r !== this && (e.data(r, this.widgetName, this), e.data(r, this.widgetFullName, this), this._on(this.element, { remove: function (e) {\n\t e.target === r && this.destroy();\n\t } }), this.document = e(r.style ? r.ownerDocument : r.document || r), this.window = e(this.document[0].defaultView || this.document[0].parentWindow)), this._create(), this._trigger(\"create\", null, this._getCreateEventData()), this._init();\n\t }, _getCreateOptions: e.noop, _getCreateEventData: e.noop, _create: e.noop, _init: e.noop, destroy: function () {\n\t this._destroy(), this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)), this.widget().unbind(this.eventNamespace).removeAttr(\"aria-disabled\").removeClass(this.widgetFullName + \"-disabled \" + \"ui-state-disabled\"), this.bindings.unbind(this.eventNamespace), this.hoverable.removeClass(\"ui-state-hover\"), this.focusable.removeClass(\"ui-state-focus\");\n\t }, _destroy: e.noop, widget: function () {\n\t return this.element;\n\t }, option: function (n, r) {\n\t var i = n,\n\t s,\n\t o,\n\t u;if (arguments.length === 0) return e.widget.extend({}, this.options);if (typeof n == \"string\") {\n\t i = {}, s = n.split(\".\"), n = s.shift();if (s.length) {\n\t o = i[n] = e.widget.extend({}, this.options[n]);for (u = 0; u < s.length - 1; u++) o[s[u]] = o[s[u]] || {}, o = o[s[u]];n = s.pop();if (r === t) return o[n] === t ? null : o[n];o[n] = r;\n\t } else {\n\t if (r === t) return this.options[n] === t ? null : this.options[n];i[n] = r;\n\t }\n\t }return this._setOptions(i), this;\n\t }, _setOptions: function (e) {\n\t var t;for (t in e) this._setOption(t, e[t]);return this;\n\t }, _setOption: function (e, t) {\n\t return this.options[e] = t, e === \"disabled\" && (this.widget().toggleClass(this.widgetFullName + \"-disabled ui-state-disabled\", !!t).attr(\"aria-disabled\", t), this.hoverable.removeClass(\"ui-state-hover\"), this.focusable.removeClass(\"ui-state-focus\")), this;\n\t }, enable: function () {\n\t return this._setOption(\"disabled\", !1);\n\t }, disable: function () {\n\t return this._setOption(\"disabled\", !0);\n\t }, _on: function (t, n) {\n\t var r,\n\t i = this;n ? (t = r = e(t), this.bindings = this.bindings.add(t)) : (n = t, t = this.element, r = this.widget()), e.each(n, function (n, s) {\n\t function o() {\n\t if (i.options.disabled === !0 || e(this).hasClass(\"ui-state-disabled\")) return;return (typeof s == \"string\" ? i[s] : s).apply(i, arguments);\n\t }typeof s != \"string\" && (o.guid = s.guid = s.guid || o.guid || e.guid++);var u = n.match(/^(\\w+)\\s*(.*)$/),\n\t a = u[1] + i.eventNamespace,\n\t f = u[2];f ? r.delegate(f, a, o) : t.bind(a, o);\n\t });\n\t }, _off: function (e, t) {\n\t t = (t || \"\").split(\" \").join(this.eventNamespace + \" \") + this.eventNamespace, e.unbind(t).undelegate(t);\n\t }, _delay: function (e, t) {\n\t function n() {\n\t return (typeof e == \"string\" ? r[e] : e).apply(r, arguments);\n\t }var r = this;return setTimeout(n, t || 0);\n\t }, _hoverable: function (t) {\n\t this.hoverable = this.hoverable.add(t), this._on(t, { mouseenter: function (t) {\n\t e(t.currentTarget).addClass(\"ui-state-hover\");\n\t }, mouseleave: function (t) {\n\t e(t.currentTarget).removeClass(\"ui-state-hover\");\n\t } });\n\t }, _focusable: function (t) {\n\t this.focusable = this.focusable.add(t), this._on(t, { focusin: function (t) {\n\t e(t.currentTarget).addClass(\"ui-state-focus\");\n\t }, focusout: function (t) {\n\t e(t.currentTarget).removeClass(\"ui-state-focus\");\n\t } });\n\t }, _trigger: function (t, n, r) {\n\t var i,\n\t s,\n\t o = this.options[t];r = r || {}, n = e.Event(n), n.type = (t === this.widgetEventPrefix ? t : this.widgetEventPrefix + t).toLowerCase(), n.target = this.element[0], s = n.originalEvent;if (s) for (i in s) i in n || (n[i] = s[i]);return this.element.trigger(n, r), !(e.isFunction(o) && o.apply(this.element[0], [n].concat(r)) === !1 || n.isDefaultPrevented());\n\t } }, e.each({ show: \"fadeIn\", hide: \"fadeOut\" }, function (t, n) {\n\t e.Widget.prototype[\"_\" + t] = function (r, i, s) {\n\t typeof i == \"string\" && (i = { effect: i });var o,\n\t u = i ? i === !0 || typeof i == \"number\" ? n : i.effect || n : t;i = i || {}, typeof i == \"number\" && (i = { duration: i }), o = !e.isEmptyObject(i), i.complete = s, i.delay && r.delay(i.delay), o && e.effects && (e.effects.effect[u] || e.uiBackCompat !== !1 && e.effects[u]) ? r[t](i) : u !== t && r[u] ? r[u](i.duration, i.easing, s) : r.queue(function (n) {\n\t e(this)[t](), s && s.call(r[0]), n();\n\t });\n\t };\n\t }), e.uiBackCompat !== !1 && (e.Widget.prototype._getCreateOptions = function () {\n\t return e.metadata && e.metadata.get(this.element[0])[this.widgetName];\n\t });\n\t})(jQuery);(function (e, t) {\n\t var n = !1;e(document).mouseup(function (e) {\n\t n = !1;\n\t }), e.widget(\"ui.mouse\", { version: \"1.9.1\", options: { cancel: \"input,textarea,button,select,option\", distance: 1, delay: 0 }, _mouseInit: function () {\n\t var t = this;this.element.bind(\"mousedown.\" + this.widgetName, function (e) {\n\t return t._mouseDown(e);\n\t }).bind(\"click.\" + this.widgetName, function (n) {\n\t if (!0 === e.data(n.target, t.widgetName + \".preventClickEvent\")) return e.removeData(n.target, t.widgetName + \".preventClickEvent\"), n.stopImmediatePropagation(), !1;\n\t }), this.started = !1;\n\t }, _mouseDestroy: function () {\n\t this.element.unbind(\".\" + this.widgetName), this._mouseMoveDelegate && e(document).unbind(\"mousemove.\" + this.widgetName, this._mouseMoveDelegate).unbind(\"mouseup.\" + this.widgetName, this._mouseUpDelegate);\n\t }, _mouseDown: function (t) {\n\t if (n) return;this._mouseStarted && this._mouseUp(t), this._mouseDownEvent = t;var r = this,\n\t i = t.which === 1,\n\t s = typeof this.options.cancel == \"string\" && t.target.nodeName ? e(t.target).closest(this.options.cancel).length : !1;if (!i || s || !this._mouseCapture(t)) return !0;this.mouseDelayMet = !this.options.delay, this.mouseDelayMet || (this._mouseDelayTimer = setTimeout(function () {\n\t r.mouseDelayMet = !0;\n\t }, this.options.delay));if (this._mouseDistanceMet(t) && this._mouseDelayMet(t)) {\n\t this._mouseStarted = this._mouseStart(t) !== !1;if (!this._mouseStarted) return t.preventDefault(), !0;\n\t }return !0 === e.data(t.target, this.widgetName + \".preventClickEvent\") && e.removeData(t.target, this.widgetName + \".preventClickEvent\"), this._mouseMoveDelegate = function (e) {\n\t return r._mouseMove(e);\n\t }, this._mouseUpDelegate = function (e) {\n\t return r._mouseUp(e);\n\t }, e(document).bind(\"mousemove.\" + this.widgetName, this._mouseMoveDelegate).bind(\"mouseup.\" + this.widgetName, this._mouseUpDelegate), t.preventDefault(), n = !0, !0;\n\t }, _mouseMove: function (t) {\n\t return !e.ui.ie || document.documentMode >= 9 || !!t.button ? this._mouseStarted ? (this._mouseDrag(t), t.preventDefault()) : (this._mouseDistanceMet(t) && this._mouseDelayMet(t) && (this._mouseStarted = this._mouseStart(this._mouseDownEvent, t) !== !1, this._mouseStarted ? this._mouseDrag(t) : this._mouseUp(t)), !this._mouseStarted) : this._mouseUp(t);\n\t }, _mouseUp: function (t) {\n\t return e(document).unbind(\"mousemove.\" + this.widgetName, this._mouseMoveDelegate).unbind(\"mouseup.\" + this.widgetName, this._mouseUpDelegate), this._mouseStarted && (this._mouseStarted = !1, t.target === this._mouseDownEvent.target && e.data(t.target, this.widgetName + \".preventClickEvent\", !0), this._mouseStop(t)), !1;\n\t }, _mouseDistanceMet: function (e) {\n\t return Math.max(Math.abs(this._mouseDownEvent.pageX - e.pageX), Math.abs(this._mouseDownEvent.pageY - e.pageY)) >= this.options.distance;\n\t }, _mouseDelayMet: function (e) {\n\t return this.mouseDelayMet;\n\t }, _mouseStart: function (e) {}, _mouseDrag: function (e) {}, _mouseStop: function (e) {}, _mouseCapture: function (e) {\n\t return !0;\n\t } });\n\t})(jQuery);(function (e, t) {\n\t function h(e, t, n) {\n\t return [parseInt(e[0], 10) * (l.test(e[0]) ? t / 100 : 1), parseInt(e[1], 10) * (l.test(e[1]) ? n / 100 : 1)];\n\t }function p(t, n) {\n\t return parseInt(e.css(t, n), 10) || 0;\n\t }e.ui = e.ui || {};var n,\n\t r = Math.max,\n\t i = Math.abs,\n\t s = Math.round,\n\t o = /left|center|right/,\n\t u = /top|center|bottom/,\n\t a = /[\\+\\-]\\d+%?/,\n\t f = /^\\w+/,\n\t l = /%$/,\n\t c = e.fn.position;e.position = { scrollbarWidth: function () {\n\t if (n !== t) return n;var r,\n\t i,\n\t s = e(\"
                                                                \"),\n\t o = s.children()[0];return e(\"body\").append(s), r = o.offsetWidth, s.css(\"overflow\", \"scroll\"), i = o.offsetWidth, r === i && (i = s[0].clientWidth), s.remove(), n = r - i;\n\t }, getScrollInfo: function (t) {\n\t var n = t.isWindow ? \"\" : t.element.css(\"overflow-x\"),\n\t r = t.isWindow ? \"\" : t.element.css(\"overflow-y\"),\n\t i = n === \"scroll\" || n === \"auto\" && t.width < t.element[0].scrollWidth,\n\t s = r === \"scroll\" || r === \"auto\" && t.height < t.element[0].scrollHeight;return { width: i ? e.position.scrollbarWidth() : 0, height: s ? e.position.scrollbarWidth() : 0 };\n\t }, getWithinInfo: function (t) {\n\t var n = e(t || window),\n\t r = e.isWindow(n[0]);return { element: n, isWindow: r, offset: n.offset() || { left: 0, top: 0 }, scrollLeft: n.scrollLeft(), scrollTop: n.scrollTop(), width: r ? n.width() : n.outerWidth(), height: r ? n.height() : n.outerHeight() };\n\t } }, e.fn.position = function (t) {\n\t if (!t || !t.of) return c.apply(this, arguments);t = e.extend({}, t);var n,\n\t l,\n\t d,\n\t v,\n\t m,\n\t g = e(t.of),\n\t y = e.position.getWithinInfo(t.within),\n\t b = e.position.getScrollInfo(y),\n\t w = g[0],\n\t E = (t.collision || \"flip\").split(\" \"),\n\t S = {};return w.nodeType === 9 ? (l = g.width(), d = g.height(), v = { top: 0, left: 0 }) : e.isWindow(w) ? (l = g.width(), d = g.height(), v = { top: g.scrollTop(), left: g.scrollLeft() }) : w.preventDefault ? (t.at = \"left top\", l = d = 0, v = { top: w.pageY, left: w.pageX }) : (l = g.outerWidth(), d = g.outerHeight(), v = g.offset()), m = e.extend({}, v), e.each([\"my\", \"at\"], function () {\n\t var e = (t[this] || \"\").split(\" \"),\n\t n,\n\t r;e.length === 1 && (e = o.test(e[0]) ? e.concat([\"center\"]) : u.test(e[0]) ? [\"center\"].concat(e) : [\"center\", \"center\"]), e[0] = o.test(e[0]) ? e[0] : \"center\", e[1] = u.test(e[1]) ? e[1] : \"center\", n = a.exec(e[0]), r = a.exec(e[1]), S[this] = [n ? n[0] : 0, r ? r[0] : 0], t[this] = [f.exec(e[0])[0], f.exec(e[1])[0]];\n\t }), E.length === 1 && (E[1] = E[0]), t.at[0] === \"right\" ? m.left += l : t.at[0] === \"center\" && (m.left += l / 2), t.at[1] === \"bottom\" ? m.top += d : t.at[1] === \"center\" && (m.top += d / 2), n = h(S.at, l, d), m.left += n[0], m.top += n[1], this.each(function () {\n\t var o,\n\t u,\n\t a = e(this),\n\t f = a.outerWidth(),\n\t c = a.outerHeight(),\n\t w = p(this, \"marginLeft\"),\n\t x = p(this, \"marginTop\"),\n\t T = f + w + p(this, \"marginRight\") + b.width,\n\t N = c + x + p(this, \"marginBottom\") + b.height,\n\t C = e.extend({}, m),\n\t k = h(S.my, a.outerWidth(), a.outerHeight());t.my[0] === \"right\" ? C.left -= f : t.my[0] === \"center\" && (C.left -= f / 2), t.my[1] === \"bottom\" ? C.top -= c : t.my[1] === \"center\" && (C.top -= c / 2), C.left += k[0], C.top += k[1], e.support.offsetFractions || (C.left = s(C.left), C.top = s(C.top)), o = { marginLeft: w, marginTop: x }, e.each([\"left\", \"top\"], function (r, i) {\n\t e.ui.position[E[r]] && e.ui.position[E[r]][i](C, { targetWidth: l, targetHeight: d, elemWidth: f, elemHeight: c, collisionPosition: o, collisionWidth: T, collisionHeight: N, offset: [n[0] + k[0], n[1] + k[1]], my: t.my, at: t.at, within: y, elem: a });\n\t }), e.fn.bgiframe && a.bgiframe(), t.using && (u = function (e) {\n\t var n = v.left - C.left,\n\t s = n + l - f,\n\t o = v.top - C.top,\n\t u = o + d - c,\n\t h = { target: { element: g, left: v.left, top: v.top, width: l, height: d }, element: { element: a, left: C.left, top: C.top, width: f, height: c }, horizontal: s < 0 ? \"left\" : n > 0 ? \"right\" : \"center\", vertical: u < 0 ? \"top\" : o > 0 ? \"bottom\" : \"middle\" };l < f && i(n + s) < l && (h.horizontal = \"center\"), d < c && i(o + u) < d && (h.vertical = \"middle\"), r(i(n), i(s)) > r(i(o), i(u)) ? h.important = \"horizontal\" : h.important = \"vertical\", t.using.call(this, e, h);\n\t }), a.offset(e.extend(C, { using: u }));\n\t });\n\t }, e.ui.position = { fit: { left: function (e, t) {\n\t var n = t.within,\n\t i = n.isWindow ? n.scrollLeft : n.offset.left,\n\t s = n.width,\n\t o = e.left - t.collisionPosition.marginLeft,\n\t u = i - o,\n\t a = o + t.collisionWidth - s - i,\n\t f;t.collisionWidth > s ? u > 0 && a <= 0 ? (f = e.left + u + t.collisionWidth - s - i, e.left += u - f) : a > 0 && u <= 0 ? e.left = i : u > a ? e.left = i + s - t.collisionWidth : e.left = i : u > 0 ? e.left += u : a > 0 ? e.left -= a : e.left = r(e.left - o, e.left);\n\t }, top: function (e, t) {\n\t var n = t.within,\n\t i = n.isWindow ? n.scrollTop : n.offset.top,\n\t s = t.within.height,\n\t o = e.top - t.collisionPosition.marginTop,\n\t u = i - o,\n\t a = o + t.collisionHeight - s - i,\n\t f;t.collisionHeight > s ? u > 0 && a <= 0 ? (f = e.top + u + t.collisionHeight - s - i, e.top += u - f) : a > 0 && u <= 0 ? e.top = i : u > a ? e.top = i + s - t.collisionHeight : e.top = i : u > 0 ? e.top += u : a > 0 ? e.top -= a : e.top = r(e.top - o, e.top);\n\t } }, flip: { left: function (e, t) {\n\t var n = t.within,\n\t r = n.offset.left + n.scrollLeft,\n\t s = n.width,\n\t o = n.isWindow ? n.scrollLeft : n.offset.left,\n\t u = e.left - t.collisionPosition.marginLeft,\n\t a = u - o,\n\t f = u + t.collisionWidth - s - o,\n\t l = t.my[0] === \"left\" ? -t.elemWidth : t.my[0] === \"right\" ? t.elemWidth : 0,\n\t c = t.at[0] === \"left\" ? t.targetWidth : t.at[0] === \"right\" ? -t.targetWidth : 0,\n\t h = -2 * t.offset[0],\n\t p,\n\t d;if (a < 0) {\n\t p = e.left + l + c + h + t.collisionWidth - s - r;if (p < 0 || p < i(a)) e.left += l + c + h;\n\t } else if (f > 0) {\n\t d = e.left - t.collisionPosition.marginLeft + l + c + h - o;if (d > 0 || i(d) < f) e.left += l + c + h;\n\t }\n\t }, top: function (e, t) {\n\t var n = t.within,\n\t r = n.offset.top + n.scrollTop,\n\t s = n.height,\n\t o = n.isWindow ? n.scrollTop : n.offset.top,\n\t u = e.top - t.collisionPosition.marginTop,\n\t a = u - o,\n\t f = u + t.collisionHeight - s - o,\n\t l = t.my[1] === \"top\",\n\t c = l ? -t.elemHeight : t.my[1] === \"bottom\" ? t.elemHeight : 0,\n\t h = t.at[1] === \"top\" ? t.targetHeight : t.at[1] === \"bottom\" ? -t.targetHeight : 0,\n\t p = -2 * t.offset[1],\n\t d,\n\t v;a < 0 ? (v = e.top + c + h + p + t.collisionHeight - s - r, e.top + c + h + p > a && (v < 0 || v < i(a)) && (e.top += c + h + p)) : f > 0 && (d = e.top - t.collisionPosition.marginTop + c + h + p - o, e.top + c + h + p > f && (d > 0 || i(d) < f) && (e.top += c + h + p));\n\t } }, flipfit: { left: function () {\n\t e.ui.position.flip.left.apply(this, arguments), e.ui.position.fit.left.apply(this, arguments);\n\t }, top: function () {\n\t e.ui.position.flip.top.apply(this, arguments), e.ui.position.fit.top.apply(this, arguments);\n\t } } }, function () {\n\t var t,\n\t n,\n\t r,\n\t i,\n\t s,\n\t o = document.getElementsByTagName(\"body\")[0],\n\t u = document.createElement(\"div\");t = document.createElement(o ? \"div\" : \"body\"), r = { visibility: \"hidden\", width: 0, height: 0, border: 0, margin: 0, background: \"none\" }, o && e.extend(r, { position: \"absolute\", left: \"-1000px\", top: \"-1000px\" });for (s in r) t.style[s] = r[s];t.appendChild(u), n = o || document.documentElement, n.insertBefore(t, n.firstChild), u.style.cssText = \"position: absolute; left: 10.7432222px;\", i = e(u).offset().left, e.support.offsetFractions = i > 10 && i < 11, t.innerHTML = \"\", n.removeChild(t);\n\t }(), e.uiBackCompat !== !1 && function (e) {\n\t var n = e.fn.position;e.fn.position = function (r) {\n\t if (!r || !r.offset) return n.call(this, r);var i = r.offset.split(\" \"),\n\t s = r.at.split(\" \");return i.length === 1 && (i[1] = i[0]), /^\\d/.test(i[0]) && (i[0] = \"+\" + i[0]), /^\\d/.test(i[1]) && (i[1] = \"+\" + i[1]), s.length === 1 && (/left|center|right/.test(s[0]) ? s[1] = \"center\" : (s[1] = s[0], s[0] = \"center\")), n.call(this, e.extend(r, { at: s[0] + i[0] + \" \" + s[1] + i[1], offset: t }));\n\t };\n\t }(jQuery);\n\t})(jQuery);(function (e, t) {\n\t var n = 0;e.widget(\"ui.autocomplete\", { version: \"1.9.1\", defaultElement: \"\", options: { appendTo: \"body\", autoFocus: !1, delay: 300, minLength: 1, position: { my: \"left top\", at: \"left bottom\", collision: \"none\" }, source: null, change: null, close: null, focus: null, open: null, response: null, search: null, select: null }, pending: 0, _create: function () {\n\t var t, n, r;this.isMultiLine = this._isMultiLine(), this.valueMethod = this.element[this.element.is(\"input,textarea\") ? \"val\" : \"text\"], this.isNewMenu = !0, this.element.addClass(\"ui-autocomplete-input\").attr(\"autocomplete\", \"off\"), this._on(this.element, { keydown: function (i) {\n\t if (this.element.prop(\"readOnly\")) {\n\t t = !0, r = !0, n = !0;return;\n\t }t = !1, r = !1, n = !1;var s = e.ui.keyCode;switch (i.keyCode) {case s.PAGE_UP:\n\t t = !0, this._move(\"previousPage\", i);break;case s.PAGE_DOWN:\n\t t = !0, this._move(\"nextPage\", i);break;case s.UP:\n\t t = !0, this._keyEvent(\"previous\", i);break;case s.DOWN:\n\t t = !0, this._keyEvent(\"next\", i);break;case s.ENTER:case s.NUMPAD_ENTER:\n\t this.menu.active && (t = !0, i.preventDefault(), this.menu.select(i));break;case s.TAB:\n\t this.menu.active && this.menu.select(i);break;case s.ESCAPE:\n\t this.menu.element.is(\":visible\") && (this._value(this.term), this.close(i), i.preventDefault());break;default:\n\t n = !0, this._searchTimeout(i);}\n\t }, keypress: function (r) {\n\t if (t) {\n\t t = !1, r.preventDefault();return;\n\t }if (n) return;var i = e.ui.keyCode;switch (r.keyCode) {case i.PAGE_UP:\n\t this._move(\"previousPage\", r);break;case i.PAGE_DOWN:\n\t this._move(\"nextPage\", r);break;case i.UP:\n\t this._keyEvent(\"previous\", r);break;case i.DOWN:\n\t this._keyEvent(\"next\", r);}\n\t }, input: function (e) {\n\t if (r) {\n\t r = !1, e.preventDefault();return;\n\t }this._searchTimeout(e);\n\t }, focus: function () {\n\t this.selectedItem = null, this.previous = this._value();\n\t }, blur: function (e) {\n\t if (this.cancelBlur) {\n\t delete this.cancelBlur;return;\n\t }clearTimeout(this.searching), this.close(e), this._change(e);\n\t } }), this._initSource(), this.menu = e(\"
                                                                  \").addClass(\"ui-autocomplete\").appendTo(this.document.find(this.options.appendTo || \"body\")[0]).menu({ input: e(), role: null }).zIndex(this.element.zIndex() + 1).hide().data(\"menu\"), this._on(this.menu.element, { mousedown: function (t) {\n\t t.preventDefault(), this.cancelBlur = !0, this._delay(function () {\n\t delete this.cancelBlur;\n\t });var n = this.menu.element[0];e(t.target).closest(\".ui-menu-item\").length || this._delay(function () {\n\t var t = this;this.document.one(\"mousedown\", function (r) {\n\t r.target !== t.element[0] && r.target !== n && !e.contains(n, r.target) && t.close();\n\t });\n\t });\n\t }, menufocus: function (t, n) {\n\t if (this.isNewMenu) {\n\t this.isNewMenu = !1;if (t.originalEvent && /^mouse/.test(t.originalEvent.type)) {\n\t this.menu.blur(), this.document.one(\"mousemove\", function () {\n\t e(t.target).trigger(t.originalEvent);\n\t });return;\n\t }\n\t }var r = n.item.data(\"ui-autocomplete-item\") || n.item.data(\"item.autocomplete\");!1 !== this._trigger(\"focus\", t, { item: r }) ? t.originalEvent && /^key/.test(t.originalEvent.type) && this._value(r.value) : this.liveRegion.text(r.value);\n\t }, menuselect: function (e, t) {\n\t var n = t.item.data(\"ui-autocomplete-item\") || t.item.data(\"item.autocomplete\"),\n\t r = this.previous;this.element[0] !== this.document[0].activeElement && (this.element.focus(), this.previous = r, this._delay(function () {\n\t this.previous = r, this.selectedItem = n;\n\t })), !1 !== this._trigger(\"select\", e, { item: n }) && this._value(n.value), this.term = this._value(), this.close(e), this.selectedItem = n;\n\t } }), this.liveRegion = e(\"\", { role: \"status\", \"aria-live\": \"polite\" }).addClass(\"ui-helper-hidden-accessible\").insertAfter(this.element), e.fn.bgiframe && this.menu.element.bgiframe(), this._on(this.window, { beforeunload: function () {\n\t this.element.removeAttr(\"autocomplete\");\n\t } });\n\t }, _destroy: function () {\n\t clearTimeout(this.searching), this.element.removeClass(\"ui-autocomplete-input\").removeAttr(\"autocomplete\"), this.menu.element.remove(), this.liveRegion.remove();\n\t }, _setOption: function (e, t) {\n\t this._super(e, t), e === \"source\" && this._initSource(), e === \"appendTo\" && this.menu.element.appendTo(this.document.find(t || \"body\")[0]), e === \"disabled\" && t && this.xhr && this.xhr.abort();\n\t }, _isMultiLine: function () {\n\t return this.element.is(\"textarea\") ? !0 : this.element.is(\"input\") ? !1 : this.element.prop(\"isContentEditable\");\n\t }, _initSource: function () {\n\t var t,\n\t n,\n\t r = this;e.isArray(this.options.source) ? (t = this.options.source, this.source = function (n, r) {\n\t r(e.ui.autocomplete.filter(t, n.term));\n\t }) : typeof this.options.source == \"string\" ? (n = this.options.source, this.source = function (t, i) {\n\t r.xhr && r.xhr.abort(), r.xhr = e.ajax({ url: n, data: t, dataType: \"json\", success: function (e) {\n\t i(e);\n\t }, error: function () {\n\t i([]);\n\t } });\n\t }) : this.source = this.options.source;\n\t }, _searchTimeout: function (e) {\n\t clearTimeout(this.searching), this.searching = this._delay(function () {\n\t this.term !== this._value() && (this.selectedItem = null, this.search(null, e));\n\t }, this.options.delay);\n\t }, search: function (e, t) {\n\t e = e != null ? e : this._value(), this.term = this._value();if (e.length < this.options.minLength) return this.close(t);if (this._trigger(\"search\", t) === !1) return;return this._search(e);\n\t }, _search: function (e) {\n\t this.pending++, this.element.addClass(\"ui-autocomplete-loading\"), this.cancelSearch = !1, this.source({ term: e }, this._response());\n\t }, _response: function () {\n\t var e = this,\n\t t = ++n;return function (r) {\n\t t === n && e.__response(r), e.pending--, e.pending || e.element.removeClass(\"ui-autocomplete-loading\");\n\t };\n\t }, __response: function (e) {\n\t e && (e = this._normalize(e)), this._trigger(\"response\", null, { content: e }), !this.options.disabled && e && e.length && !this.cancelSearch ? (this._suggest(e), this._trigger(\"open\")) : this._close();\n\t }, close: function (e) {\n\t this.cancelSearch = !0, this._close(e);\n\t }, _close: function (e) {\n\t this.menu.element.is(\":visible\") && (this.menu.element.hide(), this.menu.blur(), this.isNewMenu = !0, this._trigger(\"close\", e));\n\t }, _change: function (e) {\n\t this.previous !== this._value() && this._trigger(\"change\", e, { item: this.selectedItem });\n\t }, _normalize: function (t) {\n\t return t.length && t[0].label && t[0].value ? t : e.map(t, function (t) {\n\t return typeof t == \"string\" ? { label: t, value: t } : e.extend({ label: t.label || t.value, value: t.value || t.label }, t);\n\t });\n\t }, _suggest: function (t) {\n\t var n = this.menu.element.empty().zIndex(this.element.zIndex() + 1);this._renderMenu(n, t), this.menu.refresh(), n.show(), this._resizeMenu(), n.position(e.extend({ of: this.element }, this.options.position)), this.options.autoFocus && this.menu.next();\n\t }, _resizeMenu: function () {\n\t var e = this.menu.element;e.outerWidth(Math.max(e.width(\"\").outerWidth() + 1, this.element.outerWidth()));\n\t }, _renderMenu: function (t, n) {\n\t var r = this;e.each(n, function (e, n) {\n\t r._renderItemData(t, n);\n\t });\n\t }, _renderItemData: function (e, t) {\n\t return this._renderItem(e, t).data(\"ui-autocomplete-item\", t);\n\t }, _renderItem: function (t, n) {\n\t return e(\"
                                                                • \").append(e(\"\").text(n.label)).appendTo(t);\n\t }, _move: function (e, t) {\n\t if (!this.menu.element.is(\":visible\")) {\n\t this.search(null, t);return;\n\t }if (this.menu.isFirstItem() && /^previous/.test(e) || this.menu.isLastItem() && /^next/.test(e)) {\n\t this._value(this.term), this.menu.blur();return;\n\t }this.menu[e](t);\n\t }, widget: function () {\n\t return this.menu.element;\n\t }, _value: function () {\n\t return this.valueMethod.apply(this.element, arguments);\n\t }, _keyEvent: function (e, t) {\n\t if (!this.isMultiLine || this.menu.element.is(\":visible\")) this._move(e, t), t.preventDefault();\n\t } }), e.extend(e.ui.autocomplete, { escapeRegex: function (e) {\n\t return e.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n\t }, filter: function (t, n) {\n\t var r = new RegExp(e.ui.autocomplete.escapeRegex(n), \"i\");return e.grep(t, function (e) {\n\t return r.test(e.label || e.value || e);\n\t });\n\t } }), e.widget(\"ui.autocomplete\", e.ui.autocomplete, { options: { messages: { noResults: \"No search results.\", results: function (e) {\n\t return e + (e > 1 ? \" results are\" : \" result is\") + \" available, use up and down arrow keys to navigate.\";\n\t } } }, __response: function (e) {\n\t var t;this._superApply(arguments);if (this.options.disabled || this.cancelSearch) return;e && e.length ? t = this.options.messages.results(e.length) : t = this.options.messages.noResults, this.liveRegion.text(t);\n\t } });\n\t})(jQuery);(function (e, t) {\n\t var n,\n\t r,\n\t i,\n\t s,\n\t o = \"ui-button ui-widget ui-state-default ui-corner-all\",\n\t u = \"ui-state-hover ui-state-active \",\n\t a = \"ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only\",\n\t f = function () {\n\t var t = e(this).find(\":ui-button\");setTimeout(function () {\n\t t.button(\"refresh\");\n\t }, 1);\n\t },\n\t l = function (t) {\n\t var n = t.name,\n\t r = t.form,\n\t i = e([]);return n && (r ? i = e(r).find(\"[name='\" + n + \"']\") : i = e(\"[name='\" + n + \"']\", t.ownerDocument).filter(function () {\n\t return !this.form;\n\t })), i;\n\t };e.widget(\"ui.button\", { version: \"1.9.1\", defaultElement: \"
                                                                \"\n )\n });\n modal.show( { backdrop: true } );\n}\n\n\n// ============================================================================\n return {\n Modal : Modal,\n hide_modal : hide_modal,\n show_modal : show_modal,\n show_message : show_message,\n show_in_overlay : show_in_overlay,\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/layout/modal.js","/* ========================================================================\n * bootstrap-tour - v0.10.2\n * http://bootstraptour.com\n * ========================================================================\n * Copyright 2012-2015 Ulrich Sossou\n *\n * ========================================================================\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://opensource.org/licenses/MIT\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ========================================================================\n */\n\n(function($, window) {\n var Tour, document;\n document = window.document;\n Tour = (function() {\n function Tour(options) {\n var storage;\n try {\n storage = window.localStorage;\n } catch (_error) {\n storage = false;\n }\n this._options = $.extend({\n name: 'tour',\n steps: [],\n container: 'body',\n autoscroll: true,\n keyboard: true,\n storage: storage,\n debug: false,\n backdrop: false,\n backdropContainer: 'body',\n backdropPadding: 0,\n redirect: true,\n orphan: false,\n duration: false,\n delay: false,\n basePath: '',\n template: '

                                                                ',\n afterSetState: function(key, value) {},\n afterGetState: function(key, value) {},\n afterRemoveState: function(key) {},\n onStart: function(tour) {},\n onEnd: function(tour) {},\n onShow: function(tour) {},\n onShown: function(tour) {},\n onHide: function(tour) {},\n onHidden: function(tour) {},\n onNext: function(tour) {},\n onPrev: function(tour) {},\n onPause: function(tour, duration) {},\n onResume: function(tour, duration) {},\n onRedirectError: function(tour) {}\n }, options);\n this._force = false;\n this._inited = false;\n this._current = null;\n this.backdrop = {\n overlay: null,\n $element: null,\n $background: null,\n backgroundShown: false,\n overlayElementShown: false\n };\n this;\n }\n\n Tour.prototype.addSteps = function(steps) {\n var step, _i, _len;\n for (_i = 0, _len = steps.length; _i < _len; _i++) {\n step = steps[_i];\n this.addStep(step);\n }\n return this;\n };\n\n Tour.prototype.addStep = function(step) {\n this._options.steps.push(step);\n return this;\n };\n\n Tour.prototype.getStep = function(i) {\n if (this._options.steps[i] != null) {\n return $.extend({\n id: \"step-\" + i,\n path: '',\n host: '',\n placement: 'right',\n title: '',\n content: '

                                                                ',\n next: i === this._options.steps.length - 1 ? -1 : i + 1,\n prev: i - 1,\n animation: true,\n container: this._options.container,\n autoscroll: this._options.autoscroll,\n backdrop: this._options.backdrop,\n backdropContainer: this._options.backdropContainer,\n backdropPadding: this._options.backdropPadding,\n redirect: this._options.redirect,\n reflexElement: this._options.steps[i].element,\n orphan: this._options.orphan,\n duration: this._options.duration,\n delay: this._options.delay,\n template: this._options.template,\n onShow: this._options.onShow,\n onShown: this._options.onShown,\n onHide: this._options.onHide,\n onHidden: this._options.onHidden,\n onNext: this._options.onNext,\n onPrev: this._options.onPrev,\n onPause: this._options.onPause,\n onResume: this._options.onResume,\n onRedirectError: this._options.onRedirectError\n }, this._options.steps[i]);\n }\n };\n\n Tour.prototype.init = function(force) {\n this._force = force;\n if (this.ended()) {\n this._debug('Tour ended, init prevented.');\n return this;\n }\n this.setCurrentStep();\n this._initMouseNavigation();\n this._initKeyboardNavigation();\n this._onResize((function(_this) {\n return function() {\n return _this.showStep(_this._current);\n };\n })(this));\n if (this._current !== null) {\n this.showStep(this._current);\n }\n this._inited = true;\n return this;\n };\n\n Tour.prototype.start = function(force) {\n var promise;\n if (force == null) {\n force = false;\n }\n if (!this._inited) {\n this.init(force);\n }\n if (this._current === null) {\n promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0);\n this._callOnPromiseDone(promise, this.showStep, 0);\n }\n return this;\n };\n\n Tour.prototype.next = function() {\n var promise;\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, this._showNextStep);\n };\n\n Tour.prototype.prev = function() {\n var promise;\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, this._showPrevStep);\n };\n\n Tour.prototype.goTo = function(i) {\n var promise;\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, this.showStep, i);\n };\n\n Tour.prototype.end = function() {\n var endHelper, promise;\n endHelper = (function(_this) {\n return function(e) {\n $(document).off(\"click.tour-\" + _this._options.name);\n $(document).off(\"keyup.tour-\" + _this._options.name);\n $(window).off(\"resize.tour-\" + _this._options.name);\n _this._setState('end', 'yes');\n _this._inited = false;\n _this._force = false;\n _this._clearTimer();\n if (_this._options.onEnd != null) {\n return _this._options.onEnd(_this);\n }\n };\n })(this);\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, endHelper);\n };\n\n Tour.prototype.ended = function() {\n return !this._force && !!this._getState('end');\n };\n\n Tour.prototype.restart = function() {\n this._removeState('current_step');\n this._removeState('end');\n this._removeState('redirect_to');\n return this.start();\n };\n\n Tour.prototype.pause = function() {\n var step;\n step = this.getStep(this._current);\n if (!(step && step.duration)) {\n return this;\n }\n this._paused = true;\n this._duration -= new Date().getTime() - this._start;\n window.clearTimeout(this._timer);\n this._debug(\"Paused/Stopped step \" + (this._current + 1) + \" timer (\" + this._duration + \" remaining).\");\n if (step.onPause != null) {\n return step.onPause(this, this._duration);\n }\n };\n\n Tour.prototype.resume = function() {\n var step;\n step = this.getStep(this._current);\n if (!(step && step.duration)) {\n return this;\n }\n this._paused = false;\n this._start = new Date().getTime();\n this._duration = this._duration || step.duration;\n this._timer = window.setTimeout((function(_this) {\n return function() {\n if (_this._isLast()) {\n return _this.next();\n } else {\n return _this.end();\n }\n };\n })(this), this._duration);\n this._debug(\"Started step \" + (this._current + 1) + \" timer with duration \" + this._duration);\n if ((step.onResume != null) && this._duration !== step.duration) {\n return step.onResume(this, this._duration);\n }\n };\n\n Tour.prototype.hideStep = function(i) {\n var hideStepHelper, promise, step;\n step = this.getStep(i);\n if (!step) {\n return;\n }\n this._clearTimer();\n promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0);\n hideStepHelper = (function(_this) {\n return function(e) {\n var $element;\n $element = $(step.element);\n if (!($element.data('bs.popover') || $element.data('popover'))) {\n $element = $('body');\n }\n $element.popover('destroy').removeClass(\"tour-\" + _this._options.name + \"-element tour-\" + _this._options.name + \"-\" + i + \"-element\");\n $element.removeData('bs.popover');\n if (step.reflex) {\n $(step.reflexElement).removeClass('tour-step-element-reflex').off(\"\" + (_this._reflexEvent(step.reflex)) + \".tour-\" + _this._options.name);\n }\n if (step.backdrop) {\n _this._hideBackdrop();\n }\n if (step.onHidden != null) {\n return step.onHidden(_this);\n }\n };\n })(this);\n this._callOnPromiseDone(promise, hideStepHelper);\n return promise;\n };\n\n Tour.prototype.showStep = function(i) {\n var promise, showStepHelper, skipToPrevious, step;\n if (this.ended()) {\n this._debug('Tour ended, showStep prevented.');\n return this;\n }\n step = this.getStep(i);\n if (!step) {\n return;\n }\n skipToPrevious = i < this._current;\n promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);\n showStepHelper = (function(_this) {\n return function(e) {\n var path, showPopoverAndOverlay;\n _this.setCurrentStep(i);\n path = (function() {\n switch ({}.toString.call(step.path)) {\n case '[object Function]':\n return step.path();\n case '[object String]':\n return this._options.basePath + step.path;\n default:\n return step.path;\n }\n }).call(_this);\n if (_this._isRedirect(step.host, path, document.location)) {\n _this._redirect(step, i, path);\n if (!_this._isJustPathHashDifferent(step.host, path, document.location)) {\n return;\n }\n }\n if (_this._isOrphan(step)) {\n if (step.orphan === false) {\n _this._debug(\"Skip the orphan step \" + (_this._current + 1) + \".\\nOrphan option is false and the element does not exist or is hidden.\");\n if (skipToPrevious) {\n _this._showPrevStep();\n } else {\n _this._showNextStep();\n }\n return;\n }\n _this._debug(\"Show the orphan step \" + (_this._current + 1) + \". Orphans option is true.\");\n }\n if (step.backdrop) {\n _this._showBackdrop(step);\n }\n showPopoverAndOverlay = function() {\n if (_this.getCurrentStep() !== i || _this.ended()) {\n return;\n }\n if ((step.element != null) && step.backdrop) {\n _this._showOverlayElement(step);\n }\n _this._showPopover(step, i);\n if (step.onShown != null) {\n step.onShown(_this);\n }\n return _this._debug(\"Step \" + (_this._current + 1) + \" of \" + _this._options.steps.length);\n };\n if (step.autoscroll) {\n _this._scrollIntoView(step.element, showPopoverAndOverlay);\n } else {\n showPopoverAndOverlay();\n }\n if (step.duration) {\n return _this.resume();\n }\n };\n })(this);\n if (step.delay) {\n this._debug(\"Wait \" + step.delay + \" milliseconds to show the step \" + (this._current + 1));\n window.setTimeout((function(_this) {\n return function() {\n return _this._callOnPromiseDone(promise, showStepHelper);\n };\n })(this), step.delay);\n } else {\n this._callOnPromiseDone(promise, showStepHelper);\n }\n return promise;\n };\n\n Tour.prototype.getCurrentStep = function() {\n return this._current;\n };\n\n Tour.prototype.setCurrentStep = function(value) {\n if (value != null) {\n this._current = value;\n this._setState('current_step', value);\n } else {\n this._current = this._getState('current_step');\n this._current = this._current === null ? null : parseInt(this._current, 10);\n }\n return this;\n };\n\n Tour.prototype.redraw = function() {\n return this._showOverlayElement(this.getStep(this.getCurrentStep()).element, true);\n };\n\n Tour.prototype._setState = function(key, value) {\n var e, keyName;\n if (this._options.storage) {\n keyName = \"\" + this._options.name + \"_\" + key;\n try {\n this._options.storage.setItem(keyName, value);\n } catch (_error) {\n e = _error;\n if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {\n this._debug('LocalStorage quota exceeded. State storage failed.');\n }\n }\n return this._options.afterSetState(keyName, value);\n } else {\n if (this._state == null) {\n this._state = {};\n }\n return this._state[key] = value;\n }\n };\n\n Tour.prototype._removeState = function(key) {\n var keyName;\n if (this._options.storage) {\n keyName = \"\" + this._options.name + \"_\" + key;\n this._options.storage.removeItem(keyName);\n return this._options.afterRemoveState(keyName);\n } else {\n if (this._state != null) {\n return delete this._state[key];\n }\n }\n };\n\n Tour.prototype._getState = function(key) {\n var keyName, value;\n if (this._options.storage) {\n keyName = \"\" + this._options.name + \"_\" + key;\n value = this._options.storage.getItem(keyName);\n } else {\n if (this._state != null) {\n value = this._state[key];\n }\n }\n if (value === void 0 || value === 'null') {\n value = null;\n }\n this._options.afterGetState(key, value);\n return value;\n };\n\n Tour.prototype._showNextStep = function() {\n var promise, showNextStepHelper, step;\n step = this.getStep(this._current);\n showNextStepHelper = (function(_this) {\n return function(e) {\n return _this.showStep(step.next);\n };\n })(this);\n promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0);\n return this._callOnPromiseDone(promise, showNextStepHelper);\n };\n\n Tour.prototype._showPrevStep = function() {\n var promise, showPrevStepHelper, step;\n step = this.getStep(this._current);\n showPrevStepHelper = (function(_this) {\n return function(e) {\n return _this.showStep(step.prev);\n };\n })(this);\n promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0);\n return this._callOnPromiseDone(promise, showPrevStepHelper);\n };\n\n Tour.prototype._debug = function(text) {\n if (this._options.debug) {\n return window.console.log(\"Bootstrap Tour '\" + this._options.name + \"' | \" + text);\n }\n };\n\n Tour.prototype._isRedirect = function(host, path, location) {\n var currentPath;\n if (host !== '') {\n if (this._isHostDifferent(host, location.href)) {\n return true;\n }\n }\n currentPath = [location.pathname, location.search, location.hash].join('');\n return (path != null) && path !== '' && (({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath)) || ({}.toString.call(path) === '[object String]' && this._isPathDifferent(path, currentPath)));\n };\n\n Tour.prototype._isHostDifferent = function(host, currentURL) {\n return this._getProtocol(host) !== this._getProtocol(currentURL) || this._getHost(host) !== this._getHost(currentURL);\n };\n\n Tour.prototype._isPathDifferent = function(path, currentPath) {\n return this._getPath(path) !== this._getPath(currentPath) || !this._equal(this._getQuery(path), this._getQuery(currentPath)) || !this._equal(this._getHash(path), this._getHash(currentPath));\n };\n\n Tour.prototype._isJustPathHashDifferent = function(host, path, location) {\n var currentPath;\n if (host !== '') {\n if (this._isHostDifferent(host, location.href)) {\n return false;\n }\n }\n currentPath = [location.pathname, location.search, location.hash].join('');\n if ({}.toString.call(path) === '[object String]') {\n return this._getPath(path) === this._getPath(currentPath) && this._equal(this._getQuery(path), this._getQuery(currentPath)) && !this._equal(this._getHash(path), this._getHash(currentPath));\n }\n return false;\n };\n\n Tour.prototype._redirect = function(step, i, path) {\n if ($.isFunction(step.redirect)) {\n return step.redirect.call(this, path);\n } else if (step.redirect === true) {\n this._debug(\"Redirect to \" + step.host + path);\n if (this._getState('redirect_to') === (\"\" + i)) {\n this._debug(\"Error redirection loop to \" + path);\n this._removeState('redirect_to');\n if (step.onRedirectError != null) {\n return step.onRedirectError(this);\n }\n } else {\n this._setState('redirect_to', \"\" + i);\n return document.location.href = \"\" + step.host + path;\n }\n }\n };\n\n Tour.prototype._isOrphan = function(step) {\n return (step.element == null) || !$(step.element).length || $(step.element).is(':hidden') && ($(step.element)[0].namespaceURI !== 'http://www.w3.org/2000/svg');\n };\n\n Tour.prototype._isLast = function() {\n return this._current < this._options.steps.length - 1;\n };\n\n Tour.prototype._showPopover = function(step, i) {\n var $element, $tip, isOrphan, options, shouldAddSmart;\n $(\".tour-\" + this._options.name).remove();\n options = $.extend({}, this._options);\n isOrphan = this._isOrphan(step);\n step.template = this._template(step, i);\n if (isOrphan) {\n step.element = 'body';\n step.placement = 'top';\n }\n $element = $(step.element);\n $element.addClass(\"tour-\" + this._options.name + \"-element tour-\" + this._options.name + \"-\" + i + \"-element\");\n if (step.options) {\n $.extend(options, step.options);\n }\n if (step.reflex && !isOrphan) {\n $(step.reflexElement).addClass('tour-step-element-reflex').off(\"\" + (this._reflexEvent(step.reflex)) + \".tour-\" + this._options.name).on(\"\" + (this._reflexEvent(step.reflex)) + \".tour-\" + this._options.name, (function(_this) {\n return function() {\n if (_this._isLast()) {\n return _this.next();\n } else {\n return _this.end();\n }\n };\n })(this));\n }\n shouldAddSmart = step.smartPlacement === true && step.placement.search(/auto/i) === -1;\n $element.popover({\n placement: shouldAddSmart ? \"auto \" + step.placement : step.placement,\n trigger: 'manual',\n title: step.title,\n content: step.content,\n html: true,\n animation: step.animation,\n container: step.container,\n template: step.template,\n selector: step.element\n }).popover('show');\n $tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();\n $tip.attr('id', step.id);\n this._reposition($tip, step);\n if (isOrphan) {\n return this._center($tip);\n }\n };\n\n Tour.prototype._template = function(step, i) {\n var $navigation, $next, $prev, $resume, $template, template;\n template = step.template;\n if (this._isOrphan(step) && {}.toString.call(step.orphan) !== '[object Boolean]') {\n template = step.orphan;\n }\n $template = $.isFunction(template) ? $(template(i, step)) : $(template);\n $navigation = $template.find('.popover-navigation');\n $prev = $navigation.find('[data-role=\"prev\"]');\n $next = $navigation.find('[data-role=\"next\"]');\n $resume = $navigation.find('[data-role=\"pause-resume\"]');\n if (this._isOrphan(step)) {\n $template.addClass('orphan');\n }\n $template.addClass(\"tour-\" + this._options.name + \" tour-\" + this._options.name + \"-\" + i);\n if (step.reflex) {\n $template.addClass(\"tour-\" + this._options.name + \"-reflex\");\n }\n if (step.prev < 0) {\n $prev.addClass('disabled');\n $prev.prop('disabled', true);\n }\n if (step.next < 0) {\n $next.addClass('disabled');\n $next.prop('disabled', true);\n }\n if (!step.duration) {\n $resume.remove();\n }\n return $template.clone().wrap('
                                                                ').parent().html();\n };\n\n Tour.prototype._reflexEvent = function(reflex) {\n if ({}.toString.call(reflex) === '[object Boolean]') {\n return 'click';\n } else {\n return reflex;\n }\n };\n\n Tour.prototype._reposition = function($tip, step) {\n var offsetBottom, offsetHeight, offsetRight, offsetWidth, originalLeft, originalTop, tipOffset;\n offsetWidth = $tip[0].offsetWidth;\n offsetHeight = $tip[0].offsetHeight;\n tipOffset = $tip.offset();\n originalLeft = tipOffset.left;\n originalTop = tipOffset.top;\n offsetBottom = $(document).outerHeight() - tipOffset.top - $tip.outerHeight();\n if (offsetBottom < 0) {\n tipOffset.top = tipOffset.top + offsetBottom;\n }\n offsetRight = $('html').outerWidth() - tipOffset.left - $tip.outerWidth();\n if (offsetRight < 0) {\n tipOffset.left = tipOffset.left + offsetRight;\n }\n if (tipOffset.top < 0) {\n tipOffset.top = 0;\n }\n if (tipOffset.left < 0) {\n tipOffset.left = 0;\n }\n $tip.offset(tipOffset);\n if (step.placement === 'bottom' || step.placement === 'top') {\n if (originalLeft !== tipOffset.left) {\n return this._replaceArrow($tip, (tipOffset.left - originalLeft) * 2, offsetWidth, 'left');\n }\n } else {\n if (originalTop !== tipOffset.top) {\n return this._replaceArrow($tip, (tipOffset.top - originalTop) * 2, offsetHeight, 'top');\n }\n }\n };\n\n Tour.prototype._center = function($tip) {\n return $tip.css('top', $(window).outerHeight() / 2 - $tip.outerHeight() / 2);\n };\n\n Tour.prototype._replaceArrow = function($tip, delta, dimension, position) {\n return $tip.find('.arrow').css(position, delta ? 50 * (1 - delta / dimension) + '%' : '');\n };\n\n Tour.prototype._scrollIntoView = function(element, callback) {\n var $element, $window, counter, offsetTop, scrollTop, windowHeight;\n $element = $(element);\n if (!$element.length) {\n return callback();\n }\n $window = $(window);\n offsetTop = $element.offset().top;\n windowHeight = $window.height();\n scrollTop = Math.max(0, offsetTop - (windowHeight / 2));\n this._debug(\"Scroll into view. ScrollTop: \" + scrollTop + \". Element offset: \" + offsetTop + \". Window height: \" + windowHeight + \".\");\n counter = 0;\n return $('body, html').stop(true, true).animate({\n scrollTop: Math.ceil(scrollTop)\n }, (function(_this) {\n return function() {\n if (++counter === 2) {\n callback();\n return _this._debug(\"Scroll into view.\\nAnimation end element offset: \" + ($element.offset().top) + \".\\nWindow height: \" + ($window.height()) + \".\");\n }\n };\n })(this));\n };\n\n Tour.prototype._onResize = function(callback, timeout) {\n return $(window).on(\"resize.tour-\" + this._options.name, function() {\n clearTimeout(timeout);\n return timeout = setTimeout(callback, 100);\n });\n };\n\n Tour.prototype._initMouseNavigation = function() {\n var _this;\n _this = this;\n return $(document).off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\").on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\", (function(_this) {\n return function(e) {\n e.preventDefault();\n return _this.next();\n };\n })(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\", (function(_this) {\n return function(e) {\n e.preventDefault();\n return _this.prev();\n };\n })(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\", (function(_this) {\n return function(e) {\n e.preventDefault();\n return _this.end();\n };\n })(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\", function(e) {\n var $this;\n e.preventDefault();\n $this = $(this);\n $this.text(_this._paused ? $this.data('pause-text') : $this.data('resume-text'));\n if (_this._paused) {\n return _this.resume();\n } else {\n return _this.pause();\n }\n });\n };\n\n Tour.prototype._initKeyboardNavigation = function() {\n if (!this._options.keyboard) {\n return;\n }\n return $(document).on(\"keyup.tour-\" + this._options.name, (function(_this) {\n return function(e) {\n if (!e.which) {\n return;\n }\n switch (e.which) {\n case 39:\n e.preventDefault();\n if (_this._isLast()) {\n return _this.next();\n } else {\n return _this.end();\n }\n break;\n case 37:\n e.preventDefault();\n if (_this._current > 0) {\n return _this.prev();\n }\n break;\n case 27:\n e.preventDefault();\n return _this.end();\n }\n };\n })(this));\n };\n\n Tour.prototype._makePromise = function(result) {\n if (result && $.isFunction(result.then)) {\n return result;\n } else {\n return null;\n }\n };\n\n Tour.prototype._callOnPromiseDone = function(promise, cb, arg) {\n if (promise) {\n return promise.then((function(_this) {\n return function(e) {\n return cb.call(_this, arg);\n };\n })(this));\n } else {\n return cb.call(this, arg);\n }\n };\n\n Tour.prototype._showBackdrop = function(step) {\n if (this.backdrop.backgroundShown) {\n return;\n }\n this.backdrop = $('
                                                                ', {\n \"class\": 'tour-backdrop'\n });\n this.backdrop.backgroundShown = true;\n return $(step.backdropContainer).append(this.backdrop);\n };\n\n Tour.prototype._hideBackdrop = function() {\n this._hideOverlayElement();\n return this._hideBackground();\n };\n\n Tour.prototype._hideBackground = function() {\n if (this.backdrop) {\n this.backdrop.remove();\n this.backdrop.overlay = null;\n return this.backdrop.backgroundShown = false;\n }\n };\n\n Tour.prototype._showOverlayElement = function(step, force) {\n var $element, elementData;\n $element = $(step.element);\n if (!$element || $element.length === 0 || this.backdrop.overlayElementShown && !force) {\n return;\n }\n if (!this.backdrop.overlayElementShown) {\n this.backdrop.$element = $element.addClass('tour-step-backdrop');\n this.backdrop.$background = $('
                                                                ', {\n \"class\": 'tour-step-background'\n });\n this.backdrop.$background.appendTo(step.backdropContainer);\n this.backdrop.overlayElementShown = true;\n }\n elementData = {\n width: $element.innerWidth(),\n height: $element.innerHeight(),\n offset: $element.offset()\n };\n if (step.backdropPadding) {\n elementData = this._applyBackdropPadding(step.backdropPadding, elementData);\n }\n return this.backdrop.$background.width(elementData.width).height(elementData.height).offset(elementData.offset);\n };\n\n Tour.prototype._hideOverlayElement = function() {\n if (!this.backdrop.overlayElementShown) {\n return;\n }\n this.backdrop.$element.removeClass('tour-step-backdrop');\n this.backdrop.$background.remove();\n this.backdrop.$element = null;\n this.backdrop.$background = null;\n return this.backdrop.overlayElementShown = false;\n };\n\n Tour.prototype._applyBackdropPadding = function(padding, data) {\n if (typeof padding === 'object') {\n if (padding.top == null) {\n padding.top = 0;\n }\n if (padding.right == null) {\n padding.right = 0;\n }\n if (padding.bottom == null) {\n padding.bottom = 0;\n }\n if (padding.left == null) {\n padding.left = 0;\n }\n data.offset.top = data.offset.top - padding.top;\n data.offset.left = data.offset.left - padding.left;\n data.width = data.width + padding.left + padding.right;\n data.height = data.height + padding.top + padding.bottom;\n } else {\n data.offset.top = data.offset.top - padding;\n data.offset.left = data.offset.left - padding;\n data.width = data.width + (padding * 2);\n data.height = data.height + (padding * 2);\n }\n return data;\n };\n\n Tour.prototype._clearTimer = function() {\n window.clearTimeout(this._timer);\n this._timer = null;\n return this._duration = null;\n };\n\n Tour.prototype._getProtocol = function(url) {\n url = url.split('://');\n if (url.length > 1) {\n return url[0];\n } else {\n return 'http';\n }\n };\n\n Tour.prototype._getHost = function(url) {\n url = url.split('//');\n url = url.length > 1 ? url[1] : url[0];\n return url.split('/')[0];\n };\n\n Tour.prototype._getPath = function(path) {\n return path.replace(/\\/?$/, '').split('?')[0].split('#')[0];\n };\n\n Tour.prototype._getQuery = function(path) {\n return this._getParams(path, '?');\n };\n\n Tour.prototype._getHash = function(path) {\n return this._getParams(path, '#');\n };\n\n Tour.prototype._getParams = function(path, start) {\n var param, params, paramsObject, _i, _len;\n params = path.split(start);\n if (params.length === 1) {\n return {};\n }\n params = params[1].split('&');\n paramsObject = {};\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n param = params[_i];\n param = param.split('=');\n paramsObject[param[0]] = param[1] || '';\n }\n return paramsObject;\n };\n\n Tour.prototype._equal = function(obj1, obj2) {\n var k, v;\n if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') {\n for (k in obj1) {\n v = obj1[k];\n if (obj2[k] !== v) {\n return false;\n }\n }\n for (k in obj2) {\n v = obj2[k];\n if (obj1[k] !== v) {\n return false;\n }\n }\n return true;\n }\n return obj1 === obj2;\n };\n\n return Tour;\n\n })();\n return window.Tour = Tour;\n})(jQuery, window);\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/libs/bootstrap-tour.js","/*! jQuery UI - v1.9.1 - 2012-10-29\n* http://jqueryui.com\n* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.menu.js, jquery.ui.slider.js\n* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */\n\n(function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return\"area\"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!==\"map\"?!1:(o=e(\"img[usemap=#\"+i+\"]\")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:\"a\"===u?t.href||n:n)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().andSelf().filter(function(){return e.css(this,\"visibility\")===\"hidden\"}).length}var n=0,r=/^ui-id-\\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:\"1.9.1\",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t==\"number\"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.ui.ie&&/(static|relative)/.test(this.css(\"position\"))||/absolute/.test(this.css(\"position\"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,\"position\"))&&/(auto|scroll)/.test(e.css(this,\"overflow\")+e.css(this,\"overflow-y\")+e.css(this,\"overflow-x\"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,\"overflow\")+e.css(this,\"overflow-y\")+e.css(this,\"overflow-x\"))}).eq(0),/fixed/.test(this.css(\"position\"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css(\"zIndex\",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css(\"position\");if(i===\"absolute\"||i===\"relative\"||i===\"fixed\"){s=parseInt(r.css(\"zIndex\"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id=\"ui-id-\"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr(\"id\")})}}),e(\"\").outerWidth(1).jquery||e.each([\"Width\",\"Height\"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,\"padding\"+this))||0,r&&(n-=parseFloat(e.css(t,\"border\"+this+\"Width\"))||0),s&&(n-=parseFloat(e.css(t,\"margin\"+this))||0)}),n}var i=r===\"Width\"?[\"Left\",\"Right\"]:[\"Top\",\"Bottom\"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn[\"inner\"+r]=function(n){return n===t?o[\"inner\"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+\"px\")})},e.fn[\"outer\"+r]=function(t,n){return typeof t!=\"number\"?o[\"outer\"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+\"px\")})}}),e.extend(e.expr[\":\"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,\"tabindex\")))},tabbable:function(t){var n=e.attr(t,\"tabindex\"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement(\"div\"));n.offsetHeight,e.extend(n.style,{minHeight:\"100px\",height:\"auto\",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart=\"onselectstart\"in n,t.removeChild(n).style.display=\"none\"}),function(){var t=/msie ([\\w.]+)/.exec(navigator.userAgent.toLowerCase())||[];e.ui.ie=t.length?!0:!1,e.ui.ie6=parseFloat(t[1],10)===6}(),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?\"selectstart\":\"mousedown\")+\".ui-disableSelection\",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(\".ui-disableSelection\")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e\",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace=\".\"+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetName,this),e.data(r,this.widgetFullName,this),this._on(this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger(\"create\",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr(\"aria-disabled\").removeClass(this.widgetFullName+\"-disabled \"+\"ui-state-disabled\"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass(\"ui-state-hover\"),this.focusable.removeClass(\"ui-state-focus\")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof n==\"string\"){i={},s=n.split(\".\"),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind(\"mousemove.\"+this.widgetName,this._mouseMoveDelegate).unbind(\"mouseup.\"+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+\".preventClickEvent\",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})})(jQuery);(function(e,t){function h(e,t,n){return[parseInt(e[0],10)*(l.test(e[0])?t/100:1),parseInt(e[1],10)*(l.test(e[1])?n/100:1)]}function p(t,n){return parseInt(e.css(t,n),10)||0}e.ui=e.ui||{};var n,r=Math.max,i=Math.abs,s=Math.round,o=/left|center|right/,u=/top|center|bottom/,a=/[\\+\\-]\\d+%?/,f=/^\\w+/,l=/%$/,c=e.fn.position;e.position={scrollbarWidth:function(){if(n!==t)return n;var r,i,s=e(\"
                                                                \"),o=s.children()[0];return e(\"body\").append(s),r=o.offsetWidth,s.css(\"overflow\",\"scroll\"),i=o.offsetWidth,r===i&&(i=s[0].clientWidth),s.remove(),n=r-i},getScrollInfo:function(t){var n=t.isWindow?\"\":t.element.css(\"overflow-x\"),r=t.isWindow?\"\":t.element.css(\"overflow-y\"),i=n===\"scroll\"||n===\"auto\"&&t.width0?\"right\":\"center\",vertical:u<0?\"top\":o>0?\"bottom\":\"middle\"};lr(i(o),i(u))?h.important=\"horizontal\":h.important=\"vertical\",t.using.call(this,e,h)}),a.offset(e.extend(C,{using:u}))})},e.ui.position={fit:{left:function(e,t){var n=t.within,i=n.isWindow?n.scrollLeft:n.offset.left,s=n.width,o=e.left-t.collisionPosition.marginLeft,u=i-o,a=o+t.collisionWidth-s-i,f;t.collisionWidth>s?u>0&&a<=0?(f=e.left+u+t.collisionWidth-s-i,e.left+=u-f):a>0&&u<=0?e.left=i:u>a?e.left=i+s-t.collisionWidth:e.left=i:u>0?e.left+=u:a>0?e.left-=a:e.left=r(e.left-o,e.left)},top:function(e,t){var n=t.within,i=n.isWindow?n.scrollTop:n.offset.top,s=t.within.height,o=e.top-t.collisionPosition.marginTop,u=i-o,a=o+t.collisionHeight-s-i,f;t.collisionHeight>s?u>0&&a<=0?(f=e.top+u+t.collisionHeight-s-i,e.top+=u-f):a>0&&u<=0?e.top=i:u>a?e.top=i+s-t.collisionHeight:e.top=i:u>0?e.top+=u:a>0?e.top-=a:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var n=t.within,r=n.offset.left+n.scrollLeft,s=n.width,o=n.isWindow?n.scrollLeft:n.offset.left,u=e.left-t.collisionPosition.marginLeft,a=u-o,f=u+t.collisionWidth-s-o,l=t.my[0]===\"left\"?-t.elemWidth:t.my[0]===\"right\"?t.elemWidth:0,c=t.at[0]===\"left\"?t.targetWidth:t.at[0]===\"right\"?-t.targetWidth:0,h=-2*t.offset[0],p,d;if(a<0){p=e.left+l+c+h+t.collisionWidth-s-r;if(p<0||p0){d=e.left-t.collisionPosition.marginLeft+l+c+h-o;if(d>0||i(d)a&&(v<0||v0&&(d=e.top-t.collisionPosition.marginTop+c+h+p-o,e.top+c+h+p>f&&(d>0||i(d)10&&i<11,t.innerHTML=\"\",n.removeChild(t)}(),e.uiBackCompat!==!1&&function(e){var n=e.fn.position;e.fn.position=function(r){if(!r||!r.offset)return n.call(this,r);var i=r.offset.split(\" \"),s=r.at.split(\" \");return i.length===1&&(i[1]=i[0]),/^\\d/.test(i[0])&&(i[0]=\"+\"+i[0]),/^\\d/.test(i[1])&&(i[1]=\"+\"+i[1]),s.length===1&&(/left|center|right/.test(s[0])?s[1]=\"center\":(s[1]=s[0],s[0]=\"center\")),n.call(this,e.extend(r,{at:s[0]+i[0]+\" \"+s[1]+i[1],offset:t}))}}(jQuery)})(jQuery);(function(e,t){var n=0;e.widget(\"ui.autocomplete\",{version:\"1.9.1\",defaultElement:\"\",options:{appendTo:\"body\",autoFocus:!1,delay:300,minLength:1,position:{my:\"left top\",at:\"left bottom\",collision:\"none\"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,n,r;this.isMultiLine=this._isMultiLine(),this.valueMethod=this.element[this.element.is(\"input,textarea\")?\"val\":\"text\"],this.isNewMenu=!0,this.element.addClass(\"ui-autocomplete-input\").attr(\"autocomplete\",\"off\"),this._on(this.element,{keydown:function(i){if(this.element.prop(\"readOnly\")){t=!0,r=!0,n=!0;return}t=!1,r=!1,n=!1;var s=e.ui.keyCode;switch(i.keyCode){case s.PAGE_UP:t=!0,this._move(\"previousPage\",i);break;case s.PAGE_DOWN:t=!0,this._move(\"nextPage\",i);break;case s.UP:t=!0,this._keyEvent(\"previous\",i);break;case s.DOWN:t=!0,this._keyEvent(\"next\",i);break;case s.ENTER:case s.NUMPAD_ENTER:this.menu.active&&(t=!0,i.preventDefault(),this.menu.select(i));break;case s.TAB:this.menu.active&&this.menu.select(i);break;case s.ESCAPE:this.menu.element.is(\":visible\")&&(this._value(this.term),this.close(i),i.preventDefault());break;default:n=!0,this._searchTimeout(i)}},keypress:function(r){if(t){t=!1,r.preventDefault();return}if(n)return;var i=e.ui.keyCode;switch(r.keyCode){case i.PAGE_UP:this._move(\"previousPage\",r);break;case i.PAGE_DOWN:this._move(\"nextPage\",r);break;case i.UP:this._keyEvent(\"previous\",r);break;case i.DOWN:this._keyEvent(\"next\",r)}},input:function(e){if(r){r=!1,e.preventDefault();return}this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){if(this.cancelBlur){delete this.cancelBlur;return}clearTimeout(this.searching),this.close(e),this._change(e)}}),this._initSource(),this.menu=e(\"
                                                                  \").addClass(\"ui-autocomplete\").appendTo(this.document.find(this.options.appendTo||\"body\")[0]).menu({input:e(),role:null}).zIndex(this.element.zIndex()+1).hide().data(\"menu\"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var n=this.menu.element[0];e(t.target).closest(\".ui-menu-item\").length||this._delay(function(){var t=this;this.document.one(\"mousedown\",function(r){r.target!==t.element[0]&&r.target!==n&&!e.contains(n,r.target)&&t.close()})})},menufocus:function(t,n){if(this.isNewMenu){this.isNewMenu=!1;if(t.originalEvent&&/^mouse/.test(t.originalEvent.type)){this.menu.blur(),this.document.one(\"mousemove\",function(){e(t.target).trigger(t.originalEvent)});return}}var r=n.item.data(\"ui-autocomplete-item\")||n.item.data(\"item.autocomplete\");!1!==this._trigger(\"focus\",t,{item:r})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(r.value):this.liveRegion.text(r.value)},menuselect:function(e,t){var n=t.item.data(\"ui-autocomplete-item\")||t.item.data(\"item.autocomplete\"),r=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r,this.selectedItem=n})),!1!==this._trigger(\"select\",e,{item:n})&&this._value(n.value),this.term=this._value(),this.close(e),this.selectedItem=n}}),this.liveRegion=e(\"\",{role:\"status\",\"aria-live\":\"polite\"}).addClass(\"ui-helper-hidden-accessible\").insertAfter(this.element),e.fn.bgiframe&&this.menu.element.bgiframe(),this._on(this.window,{beforeunload:function(){this.element.removeAttr(\"autocomplete\")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass(\"ui-autocomplete-input\").removeAttr(\"autocomplete\"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),e===\"source\"&&this._initSource(),e===\"appendTo\"&&this.menu.element.appendTo(this.document.find(t||\"body\")[0]),e===\"disabled\"&&t&&this.xhr&&this.xhr.abort()},_isMultiLine:function(){return this.element.is(\"textarea\")?!0:this.element.is(\"input\")?!1:this.element.prop(\"isContentEditable\")},_initSource:function(){var t,n,r=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(n,r){r(e.ui.autocomplete.filter(t,n.term))}):typeof this.options.source==\"string\"?(n=this.options.source,this.source=function(t,i){r.xhr&&r.xhr.abort(),r.xhr=e.ajax({url:n,data:t,dataType:\"json\",success:function(e){i(e)},error:function(){i([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){e=e!=null?e:this._value(),this.term=this._value();if(e.length\").append(e(\"\").text(n.label)).appendTo(t)},_move:function(e,t){if(!this.menu.element.is(\":visible\")){this.search(null,t);return}if(this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)){this._value(this.term),this.menu.blur();return}this.menu[e](t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){if(!this.isMultiLine||this.menu.element.is(\":visible\"))this._move(e,t),t.preventDefault()}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g,\"\\\\$&\")},filter:function(t,n){var r=new RegExp(e.ui.autocomplete.escapeRegex(n),\"i\");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}}),e.widget(\"ui.autocomplete\",e.ui.autocomplete,{options:{messages:{noResults:\"No search results.\",results:function(e){return e+(e>1?\" results are\":\" result is\")+\" available, use up and down arrow keys to navigate.\"}}},__response:function(e){var t;this._superApply(arguments);if(this.options.disabled||this.cancelSearch)return;e&&e.length?t=this.options.messages.results(e.length):t=this.options.messages.noResults,this.liveRegion.text(t)}})})(jQuery);(function(e,t){var n,r,i,s,o=\"ui-button ui-widget ui-state-default ui-corner-all\",u=\"ui-state-hover ui-state-active \",a=\"ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only\",f=function(){var t=e(this).find(\":ui-button\");setTimeout(function(){t.button(\"refresh\")},1)},l=function(t){var n=t.name,r=t.form,i=e([]);return n&&(r?i=e(r).find(\"[name='\"+n+\"']\"):i=e(\"[name='\"+n+\"']\",t.ownerDocument).filter(function(){return!this.form})),i};e.widget(\"ui.button\",{version:\"1.9.1\",defaultElement:\"
                                                                \")\n\t });\n\t modal.show({ backdrop: true });\n\t }\n\t\n\t // ============================================================================\n\t return {\n\t Modal: Modal,\n\t hide_modal: hide_modal,\n\t show_modal: show_modal,\n\t show_message: show_message,\n\t show_in_overlay: show_in_overlay\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ },\n/* 74 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(jQuery) {/* ========================================================================\n\t * bootstrap-tour - v0.10.2\n\t * http://bootstraptour.com\n\t * ========================================================================\n\t * Copyright 2012-2015 Ulrich Sossou\n\t *\n\t * ========================================================================\n\t * Licensed under the MIT License (the \"License\");\n\t * you may not use this file except in compliance with the License.\n\t * You may obtain a copy of the License at\n\t *\n\t * https://opensource.org/licenses/MIT\n\t *\n\t * Unless required by applicable law or agreed to in writing, software\n\t * distributed under the License is distributed on an \"AS IS\" BASIS,\n\t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\t * See the License for the specific language governing permissions and\n\t * limitations under the License.\n\t * ========================================================================\n\t */\n\t\n\t(function ($, window) {\n\t var Tour, document;\n\t document = window.document;\n\t Tour = function () {\n\t function Tour(options) {\n\t var storage;\n\t try {\n\t storage = window.localStorage;\n\t } catch (_error) {\n\t storage = false;\n\t }\n\t this._options = $.extend({\n\t name: 'tour',\n\t steps: [],\n\t container: 'body',\n\t autoscroll: true,\n\t keyboard: true,\n\t storage: storage,\n\t debug: false,\n\t backdrop: false,\n\t backdropContainer: 'body',\n\t backdropPadding: 0,\n\t redirect: true,\n\t orphan: false,\n\t duration: false,\n\t delay: false,\n\t basePath: '',\n\t template: '

                                                                ',\n\t afterSetState: function (key, value) {},\n\t afterGetState: function (key, value) {},\n\t afterRemoveState: function (key) {},\n\t onStart: function (tour) {},\n\t onEnd: function (tour) {},\n\t onShow: function (tour) {},\n\t onShown: function (tour) {},\n\t onHide: function (tour) {},\n\t onHidden: function (tour) {},\n\t onNext: function (tour) {},\n\t onPrev: function (tour) {},\n\t onPause: function (tour, duration) {},\n\t onResume: function (tour, duration) {},\n\t onRedirectError: function (tour) {}\n\t }, options);\n\t this._force = false;\n\t this._inited = false;\n\t this._current = null;\n\t this.backdrop = {\n\t overlay: null,\n\t $element: null,\n\t $background: null,\n\t backgroundShown: false,\n\t overlayElementShown: false\n\t };\n\t this;\n\t }\n\t\n\t Tour.prototype.addSteps = function (steps) {\n\t var step, _i, _len;\n\t for (_i = 0, _len = steps.length; _i < _len; _i++) {\n\t step = steps[_i];\n\t this.addStep(step);\n\t }\n\t return this;\n\t };\n\t\n\t Tour.prototype.addStep = function (step) {\n\t this._options.steps.push(step);\n\t return this;\n\t };\n\t\n\t Tour.prototype.getStep = function (i) {\n\t if (this._options.steps[i] != null) {\n\t return $.extend({\n\t id: \"step-\" + i,\n\t path: '',\n\t host: '',\n\t placement: 'right',\n\t title: '',\n\t content: '

                                                                ',\n\t next: i === this._options.steps.length - 1 ? -1 : i + 1,\n\t prev: i - 1,\n\t animation: true,\n\t container: this._options.container,\n\t autoscroll: this._options.autoscroll,\n\t backdrop: this._options.backdrop,\n\t backdropContainer: this._options.backdropContainer,\n\t backdropPadding: this._options.backdropPadding,\n\t redirect: this._options.redirect,\n\t reflexElement: this._options.steps[i].element,\n\t orphan: this._options.orphan,\n\t duration: this._options.duration,\n\t delay: this._options.delay,\n\t template: this._options.template,\n\t onShow: this._options.onShow,\n\t onShown: this._options.onShown,\n\t onHide: this._options.onHide,\n\t onHidden: this._options.onHidden,\n\t onNext: this._options.onNext,\n\t onPrev: this._options.onPrev,\n\t onPause: this._options.onPause,\n\t onResume: this._options.onResume,\n\t onRedirectError: this._options.onRedirectError\n\t }, this._options.steps[i]);\n\t }\n\t };\n\t\n\t Tour.prototype.init = function (force) {\n\t this._force = force;\n\t if (this.ended()) {\n\t this._debug('Tour ended, init prevented.');\n\t return this;\n\t }\n\t this.setCurrentStep();\n\t this._initMouseNavigation();\n\t this._initKeyboardNavigation();\n\t this._onResize(function (_this) {\n\t return function () {\n\t return _this.showStep(_this._current);\n\t };\n\t }(this));\n\t if (this._current !== null) {\n\t this.showStep(this._current);\n\t }\n\t this._inited = true;\n\t return this;\n\t };\n\t\n\t Tour.prototype.start = function (force) {\n\t var promise;\n\t if (force == null) {\n\t force = false;\n\t }\n\t if (!this._inited) {\n\t this.init(force);\n\t }\n\t if (this._current === null) {\n\t promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0);\n\t this._callOnPromiseDone(promise, this.showStep, 0);\n\t }\n\t return this;\n\t };\n\t\n\t Tour.prototype.next = function () {\n\t var promise;\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, this._showNextStep);\n\t };\n\t\n\t Tour.prototype.prev = function () {\n\t var promise;\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, this._showPrevStep);\n\t };\n\t\n\t Tour.prototype.goTo = function (i) {\n\t var promise;\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, this.showStep, i);\n\t };\n\t\n\t Tour.prototype.end = function () {\n\t var endHelper, promise;\n\t endHelper = function (_this) {\n\t return function (e) {\n\t $(document).off(\"click.tour-\" + _this._options.name);\n\t $(document).off(\"keyup.tour-\" + _this._options.name);\n\t $(window).off(\"resize.tour-\" + _this._options.name);\n\t _this._setState('end', 'yes');\n\t _this._inited = false;\n\t _this._force = false;\n\t _this._clearTimer();\n\t if (_this._options.onEnd != null) {\n\t return _this._options.onEnd(_this);\n\t }\n\t };\n\t }(this);\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, endHelper);\n\t };\n\t\n\t Tour.prototype.ended = function () {\n\t return !this._force && !!this._getState('end');\n\t };\n\t\n\t Tour.prototype.restart = function () {\n\t this._removeState('current_step');\n\t this._removeState('end');\n\t this._removeState('redirect_to');\n\t return this.start();\n\t };\n\t\n\t Tour.prototype.pause = function () {\n\t var step;\n\t step = this.getStep(this._current);\n\t if (!(step && step.duration)) {\n\t return this;\n\t }\n\t this._paused = true;\n\t this._duration -= new Date().getTime() - this._start;\n\t window.clearTimeout(this._timer);\n\t this._debug(\"Paused/Stopped step \" + (this._current + 1) + \" timer (\" + this._duration + \" remaining).\");\n\t if (step.onPause != null) {\n\t return step.onPause(this, this._duration);\n\t }\n\t };\n\t\n\t Tour.prototype.resume = function () {\n\t var step;\n\t step = this.getStep(this._current);\n\t if (!(step && step.duration)) {\n\t return this;\n\t }\n\t this._paused = false;\n\t this._start = new Date().getTime();\n\t this._duration = this._duration || step.duration;\n\t this._timer = window.setTimeout(function (_this) {\n\t return function () {\n\t if (_this._isLast()) {\n\t return _this.next();\n\t } else {\n\t return _this.end();\n\t }\n\t };\n\t }(this), this._duration);\n\t this._debug(\"Started step \" + (this._current + 1) + \" timer with duration \" + this._duration);\n\t if (step.onResume != null && this._duration !== step.duration) {\n\t return step.onResume(this, this._duration);\n\t }\n\t };\n\t\n\t Tour.prototype.hideStep = function (i) {\n\t var hideStepHelper, promise, step;\n\t step = this.getStep(i);\n\t if (!step) {\n\t return;\n\t }\n\t this._clearTimer();\n\t promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0);\n\t hideStepHelper = function (_this) {\n\t return function (e) {\n\t var $element;\n\t $element = $(step.element);\n\t if (!($element.data('bs.popover') || $element.data('popover'))) {\n\t $element = $('body');\n\t }\n\t $element.popover('destroy').removeClass(\"tour-\" + _this._options.name + \"-element tour-\" + _this._options.name + \"-\" + i + \"-element\");\n\t $element.removeData('bs.popover');\n\t if (step.reflex) {\n\t $(step.reflexElement).removeClass('tour-step-element-reflex').off(\"\" + _this._reflexEvent(step.reflex) + \".tour-\" + _this._options.name);\n\t }\n\t if (step.backdrop) {\n\t _this._hideBackdrop();\n\t }\n\t if (step.onHidden != null) {\n\t return step.onHidden(_this);\n\t }\n\t };\n\t }(this);\n\t this._callOnPromiseDone(promise, hideStepHelper);\n\t return promise;\n\t };\n\t\n\t Tour.prototype.showStep = function (i) {\n\t var promise, showStepHelper, skipToPrevious, step;\n\t if (this.ended()) {\n\t this._debug('Tour ended, showStep prevented.');\n\t return this;\n\t }\n\t step = this.getStep(i);\n\t if (!step) {\n\t return;\n\t }\n\t skipToPrevious = i < this._current;\n\t promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);\n\t showStepHelper = function (_this) {\n\t return function (e) {\n\t var path, showPopoverAndOverlay;\n\t _this.setCurrentStep(i);\n\t path = function () {\n\t switch ({}.toString.call(step.path)) {\n\t case '[object Function]':\n\t return step.path();\n\t case '[object String]':\n\t return this._options.basePath + step.path;\n\t default:\n\t return step.path;\n\t }\n\t }.call(_this);\n\t if (_this._isRedirect(step.host, path, document.location)) {\n\t _this._redirect(step, i, path);\n\t if (!_this._isJustPathHashDifferent(step.host, path, document.location)) {\n\t return;\n\t }\n\t }\n\t if (_this._isOrphan(step)) {\n\t if (step.orphan === false) {\n\t _this._debug(\"Skip the orphan step \" + (_this._current + 1) + \".\\nOrphan option is false and the element does not exist or is hidden.\");\n\t if (skipToPrevious) {\n\t _this._showPrevStep();\n\t } else {\n\t _this._showNextStep();\n\t }\n\t return;\n\t }\n\t _this._debug(\"Show the orphan step \" + (_this._current + 1) + \". Orphans option is true.\");\n\t }\n\t if (step.backdrop) {\n\t _this._showBackdrop(step);\n\t }\n\t showPopoverAndOverlay = function () {\n\t if (_this.getCurrentStep() !== i || _this.ended()) {\n\t return;\n\t }\n\t if (step.element != null && step.backdrop) {\n\t _this._showOverlayElement(step);\n\t }\n\t _this._showPopover(step, i);\n\t if (step.onShown != null) {\n\t step.onShown(_this);\n\t }\n\t return _this._debug(\"Step \" + (_this._current + 1) + \" of \" + _this._options.steps.length);\n\t };\n\t if (step.autoscroll) {\n\t _this._scrollIntoView(step.element, showPopoverAndOverlay);\n\t } else {\n\t showPopoverAndOverlay();\n\t }\n\t if (step.duration) {\n\t return _this.resume();\n\t }\n\t };\n\t }(this);\n\t if (step.delay) {\n\t this._debug(\"Wait \" + step.delay + \" milliseconds to show the step \" + (this._current + 1));\n\t window.setTimeout(function (_this) {\n\t return function () {\n\t return _this._callOnPromiseDone(promise, showStepHelper);\n\t };\n\t }(this), step.delay);\n\t } else {\n\t this._callOnPromiseDone(promise, showStepHelper);\n\t }\n\t return promise;\n\t };\n\t\n\t Tour.prototype.getCurrentStep = function () {\n\t return this._current;\n\t };\n\t\n\t Tour.prototype.setCurrentStep = function (value) {\n\t if (value != null) {\n\t this._current = value;\n\t this._setState('current_step', value);\n\t } else {\n\t this._current = this._getState('current_step');\n\t this._current = this._current === null ? null : parseInt(this._current, 10);\n\t }\n\t return this;\n\t };\n\t\n\t Tour.prototype.redraw = function () {\n\t return this._showOverlayElement(this.getStep(this.getCurrentStep()).element, true);\n\t };\n\t\n\t Tour.prototype._setState = function (key, value) {\n\t var e, keyName;\n\t if (this._options.storage) {\n\t keyName = \"\" + this._options.name + \"_\" + key;\n\t try {\n\t this._options.storage.setItem(keyName, value);\n\t } catch (_error) {\n\t e = _error;\n\t if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {\n\t this._debug('LocalStorage quota exceeded. State storage failed.');\n\t }\n\t }\n\t return this._options.afterSetState(keyName, value);\n\t } else {\n\t if (this._state == null) {\n\t this._state = {};\n\t }\n\t return this._state[key] = value;\n\t }\n\t };\n\t\n\t Tour.prototype._removeState = function (key) {\n\t var keyName;\n\t if (this._options.storage) {\n\t keyName = \"\" + this._options.name + \"_\" + key;\n\t this._options.storage.removeItem(keyName);\n\t return this._options.afterRemoveState(keyName);\n\t } else {\n\t if (this._state != null) {\n\t return delete this._state[key];\n\t }\n\t }\n\t };\n\t\n\t Tour.prototype._getState = function (key) {\n\t var keyName, value;\n\t if (this._options.storage) {\n\t keyName = \"\" + this._options.name + \"_\" + key;\n\t value = this._options.storage.getItem(keyName);\n\t } else {\n\t if (this._state != null) {\n\t value = this._state[key];\n\t }\n\t }\n\t if (value === void 0 || value === 'null') {\n\t value = null;\n\t }\n\t this._options.afterGetState(key, value);\n\t return value;\n\t };\n\t\n\t Tour.prototype._showNextStep = function () {\n\t var promise, showNextStepHelper, step;\n\t step = this.getStep(this._current);\n\t showNextStepHelper = function (_this) {\n\t return function (e) {\n\t return _this.showStep(step.next);\n\t };\n\t }(this);\n\t promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0);\n\t return this._callOnPromiseDone(promise, showNextStepHelper);\n\t };\n\t\n\t Tour.prototype._showPrevStep = function () {\n\t var promise, showPrevStepHelper, step;\n\t step = this.getStep(this._current);\n\t showPrevStepHelper = function (_this) {\n\t return function (e) {\n\t return _this.showStep(step.prev);\n\t };\n\t }(this);\n\t promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0);\n\t return this._callOnPromiseDone(promise, showPrevStepHelper);\n\t };\n\t\n\t Tour.prototype._debug = function (text) {\n\t if (this._options.debug) {\n\t return window.console.log(\"Bootstrap Tour '\" + this._options.name + \"' | \" + text);\n\t }\n\t };\n\t\n\t Tour.prototype._isRedirect = function (host, path, location) {\n\t var currentPath;\n\t if (host !== '') {\n\t if (this._isHostDifferent(host, location.href)) {\n\t return true;\n\t }\n\t }\n\t currentPath = [location.pathname, location.search, location.hash].join('');\n\t return path != null && path !== '' && ({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath) || {}.toString.call(path) === '[object String]' && this._isPathDifferent(path, currentPath));\n\t };\n\t\n\t Tour.prototype._isHostDifferent = function (host, currentURL) {\n\t return this._getProtocol(host) !== this._getProtocol(currentURL) || this._getHost(host) !== this._getHost(currentURL);\n\t };\n\t\n\t Tour.prototype._isPathDifferent = function (path, currentPath) {\n\t return this._getPath(path) !== this._getPath(currentPath) || !this._equal(this._getQuery(path), this._getQuery(currentPath)) || !this._equal(this._getHash(path), this._getHash(currentPath));\n\t };\n\t\n\t Tour.prototype._isJustPathHashDifferent = function (host, path, location) {\n\t var currentPath;\n\t if (host !== '') {\n\t if (this._isHostDifferent(host, location.href)) {\n\t return false;\n\t }\n\t }\n\t currentPath = [location.pathname, location.search, location.hash].join('');\n\t if ({}.toString.call(path) === '[object String]') {\n\t return this._getPath(path) === this._getPath(currentPath) && this._equal(this._getQuery(path), this._getQuery(currentPath)) && !this._equal(this._getHash(path), this._getHash(currentPath));\n\t }\n\t return false;\n\t };\n\t\n\t Tour.prototype._redirect = function (step, i, path) {\n\t if ($.isFunction(step.redirect)) {\n\t return step.redirect.call(this, path);\n\t } else if (step.redirect === true) {\n\t this._debug(\"Redirect to \" + step.host + path);\n\t if (this._getState('redirect_to') === \"\" + i) {\n\t this._debug(\"Error redirection loop to \" + path);\n\t this._removeState('redirect_to');\n\t if (step.onRedirectError != null) {\n\t return step.onRedirectError(this);\n\t }\n\t } else {\n\t this._setState('redirect_to', \"\" + i);\n\t return document.location.href = \"\" + step.host + path;\n\t }\n\t }\n\t };\n\t\n\t Tour.prototype._isOrphan = function (step) {\n\t return step.element == null || !$(step.element).length || $(step.element).is(':hidden') && $(step.element)[0].namespaceURI !== 'http://www.w3.org/2000/svg';\n\t };\n\t\n\t Tour.prototype._isLast = function () {\n\t return this._current < this._options.steps.length - 1;\n\t };\n\t\n\t Tour.prototype._showPopover = function (step, i) {\n\t var $element, $tip, isOrphan, options, shouldAddSmart;\n\t $(\".tour-\" + this._options.name).remove();\n\t options = $.extend({}, this._options);\n\t isOrphan = this._isOrphan(step);\n\t step.template = this._template(step, i);\n\t if (isOrphan) {\n\t step.element = 'body';\n\t step.placement = 'top';\n\t }\n\t $element = $(step.element);\n\t $element.addClass(\"tour-\" + this._options.name + \"-element tour-\" + this._options.name + \"-\" + i + \"-element\");\n\t if (step.options) {\n\t $.extend(options, step.options);\n\t }\n\t if (step.reflex && !isOrphan) {\n\t $(step.reflexElement).addClass('tour-step-element-reflex').off(\"\" + this._reflexEvent(step.reflex) + \".tour-\" + this._options.name).on(\"\" + this._reflexEvent(step.reflex) + \".tour-\" + this._options.name, function (_this) {\n\t return function () {\n\t if (_this._isLast()) {\n\t return _this.next();\n\t } else {\n\t return _this.end();\n\t }\n\t };\n\t }(this));\n\t }\n\t shouldAddSmart = step.smartPlacement === true && step.placement.search(/auto/i) === -1;\n\t $element.popover({\n\t placement: shouldAddSmart ? \"auto \" + step.placement : step.placement,\n\t trigger: 'manual',\n\t title: step.title,\n\t content: step.content,\n\t html: true,\n\t animation: step.animation,\n\t container: step.container,\n\t template: step.template,\n\t selector: step.element\n\t }).popover('show');\n\t $tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();\n\t $tip.attr('id', step.id);\n\t this._reposition($tip, step);\n\t if (isOrphan) {\n\t return this._center($tip);\n\t }\n\t };\n\t\n\t Tour.prototype._template = function (step, i) {\n\t var $navigation, $next, $prev, $resume, $template, template;\n\t template = step.template;\n\t if (this._isOrphan(step) && {}.toString.call(step.orphan) !== '[object Boolean]') {\n\t template = step.orphan;\n\t }\n\t $template = $.isFunction(template) ? $(template(i, step)) : $(template);\n\t $navigation = $template.find('.popover-navigation');\n\t $prev = $navigation.find('[data-role=\"prev\"]');\n\t $next = $navigation.find('[data-role=\"next\"]');\n\t $resume = $navigation.find('[data-role=\"pause-resume\"]');\n\t if (this._isOrphan(step)) {\n\t $template.addClass('orphan');\n\t }\n\t $template.addClass(\"tour-\" + this._options.name + \" tour-\" + this._options.name + \"-\" + i);\n\t if (step.reflex) {\n\t $template.addClass(\"tour-\" + this._options.name + \"-reflex\");\n\t }\n\t if (step.prev < 0) {\n\t $prev.addClass('disabled');\n\t $prev.prop('disabled', true);\n\t }\n\t if (step.next < 0) {\n\t $next.addClass('disabled');\n\t $next.prop('disabled', true);\n\t }\n\t if (!step.duration) {\n\t $resume.remove();\n\t }\n\t return $template.clone().wrap('
                                                                ').parent().html();\n\t };\n\t\n\t Tour.prototype._reflexEvent = function (reflex) {\n\t if ({}.toString.call(reflex) === '[object Boolean]') {\n\t return 'click';\n\t } else {\n\t return reflex;\n\t }\n\t };\n\t\n\t Tour.prototype._reposition = function ($tip, step) {\n\t var offsetBottom, offsetHeight, offsetRight, offsetWidth, originalLeft, originalTop, tipOffset;\n\t offsetWidth = $tip[0].offsetWidth;\n\t offsetHeight = $tip[0].offsetHeight;\n\t tipOffset = $tip.offset();\n\t originalLeft = tipOffset.left;\n\t originalTop = tipOffset.top;\n\t offsetBottom = $(document).outerHeight() - tipOffset.top - $tip.outerHeight();\n\t if (offsetBottom < 0) {\n\t tipOffset.top = tipOffset.top + offsetBottom;\n\t }\n\t offsetRight = $('html').outerWidth() - tipOffset.left - $tip.outerWidth();\n\t if (offsetRight < 0) {\n\t tipOffset.left = tipOffset.left + offsetRight;\n\t }\n\t if (tipOffset.top < 0) {\n\t tipOffset.top = 0;\n\t }\n\t if (tipOffset.left < 0) {\n\t tipOffset.left = 0;\n\t }\n\t $tip.offset(tipOffset);\n\t if (step.placement === 'bottom' || step.placement === 'top') {\n\t if (originalLeft !== tipOffset.left) {\n\t return this._replaceArrow($tip, (tipOffset.left - originalLeft) * 2, offsetWidth, 'left');\n\t }\n\t } else {\n\t if (originalTop !== tipOffset.top) {\n\t return this._replaceArrow($tip, (tipOffset.top - originalTop) * 2, offsetHeight, 'top');\n\t }\n\t }\n\t };\n\t\n\t Tour.prototype._center = function ($tip) {\n\t return $tip.css('top', $(window).outerHeight() / 2 - $tip.outerHeight() / 2);\n\t };\n\t\n\t Tour.prototype._replaceArrow = function ($tip, delta, dimension, position) {\n\t return $tip.find('.arrow').css(position, delta ? 50 * (1 - delta / dimension) + '%' : '');\n\t };\n\t\n\t Tour.prototype._scrollIntoView = function (element, callback) {\n\t var $element, $window, counter, offsetTop, scrollTop, windowHeight;\n\t $element = $(element);\n\t if (!$element.length) {\n\t return callback();\n\t }\n\t $window = $(window);\n\t offsetTop = $element.offset().top;\n\t windowHeight = $window.height();\n\t scrollTop = Math.max(0, offsetTop - windowHeight / 2);\n\t this._debug(\"Scroll into view. ScrollTop: \" + scrollTop + \". Element offset: \" + offsetTop + \". Window height: \" + windowHeight + \".\");\n\t counter = 0;\n\t return $('body, html').stop(true, true).animate({\n\t scrollTop: Math.ceil(scrollTop)\n\t }, function (_this) {\n\t return function () {\n\t if (++counter === 2) {\n\t callback();\n\t return _this._debug(\"Scroll into view.\\nAnimation end element offset: \" + $element.offset().top + \".\\nWindow height: \" + $window.height() + \".\");\n\t }\n\t };\n\t }(this));\n\t };\n\t\n\t Tour.prototype._onResize = function (callback, timeout) {\n\t return $(window).on(\"resize.tour-\" + this._options.name, function () {\n\t clearTimeout(timeout);\n\t return timeout = setTimeout(callback, 100);\n\t });\n\t };\n\t\n\t Tour.prototype._initMouseNavigation = function () {\n\t var _this;\n\t _this = this;\n\t return $(document).off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\").on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\", function (_this) {\n\t return function (e) {\n\t e.preventDefault();\n\t return _this.next();\n\t };\n\t }(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\", function (_this) {\n\t return function (e) {\n\t e.preventDefault();\n\t return _this.prev();\n\t };\n\t }(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\", function (_this) {\n\t return function (e) {\n\t e.preventDefault();\n\t return _this.end();\n\t };\n\t }(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\", function (e) {\n\t var $this;\n\t e.preventDefault();\n\t $this = $(this);\n\t $this.text(_this._paused ? $this.data('pause-text') : $this.data('resume-text'));\n\t if (_this._paused) {\n\t return _this.resume();\n\t } else {\n\t return _this.pause();\n\t }\n\t });\n\t };\n\t\n\t Tour.prototype._initKeyboardNavigation = function () {\n\t if (!this._options.keyboard) {\n\t return;\n\t }\n\t return $(document).on(\"keyup.tour-\" + this._options.name, function (_this) {\n\t return function (e) {\n\t if (!e.which) {\n\t return;\n\t }\n\t switch (e.which) {\n\t case 39:\n\t e.preventDefault();\n\t if (_this._isLast()) {\n\t return _this.next();\n\t } else {\n\t return _this.end();\n\t }\n\t break;\n\t case 37:\n\t e.preventDefault();\n\t if (_this._current > 0) {\n\t return _this.prev();\n\t }\n\t break;\n\t case 27:\n\t e.preventDefault();\n\t return _this.end();\n\t }\n\t };\n\t }(this));\n\t };\n\t\n\t Tour.prototype._makePromise = function (result) {\n\t if (result && $.isFunction(result.then)) {\n\t return result;\n\t } else {\n\t return null;\n\t }\n\t };\n\t\n\t Tour.prototype._callOnPromiseDone = function (promise, cb, arg) {\n\t if (promise) {\n\t return promise.then(function (_this) {\n\t return function (e) {\n\t return cb.call(_this, arg);\n\t };\n\t }(this));\n\t } else {\n\t return cb.call(this, arg);\n\t }\n\t };\n\t\n\t Tour.prototype._showBackdrop = function (step) {\n\t if (this.backdrop.backgroundShown) {\n\t return;\n\t }\n\t this.backdrop = $('
                                                                ', {\n\t \"class\": 'tour-backdrop'\n\t });\n\t this.backdrop.backgroundShown = true;\n\t return $(step.backdropContainer).append(this.backdrop);\n\t };\n\t\n\t Tour.prototype._hideBackdrop = function () {\n\t this._hideOverlayElement();\n\t return this._hideBackground();\n\t };\n\t\n\t Tour.prototype._hideBackground = function () {\n\t if (this.backdrop) {\n\t this.backdrop.remove();\n\t this.backdrop.overlay = null;\n\t return this.backdrop.backgroundShown = false;\n\t }\n\t };\n\t\n\t Tour.prototype._showOverlayElement = function (step, force) {\n\t var $element, elementData;\n\t $element = $(step.element);\n\t if (!$element || $element.length === 0 || this.backdrop.overlayElementShown && !force) {\n\t return;\n\t }\n\t if (!this.backdrop.overlayElementShown) {\n\t this.backdrop.$element = $element.addClass('tour-step-backdrop');\n\t this.backdrop.$background = $('
                                                                ', {\n\t \"class\": 'tour-step-background'\n\t });\n\t this.backdrop.$background.appendTo(step.backdropContainer);\n\t this.backdrop.overlayElementShown = true;\n\t }\n\t elementData = {\n\t width: $element.innerWidth(),\n\t height: $element.innerHeight(),\n\t offset: $element.offset()\n\t };\n\t if (step.backdropPadding) {\n\t elementData = this._applyBackdropPadding(step.backdropPadding, elementData);\n\t }\n\t return this.backdrop.$background.width(elementData.width).height(elementData.height).offset(elementData.offset);\n\t };\n\t\n\t Tour.prototype._hideOverlayElement = function () {\n\t if (!this.backdrop.overlayElementShown) {\n\t return;\n\t }\n\t this.backdrop.$element.removeClass('tour-step-backdrop');\n\t this.backdrop.$background.remove();\n\t this.backdrop.$element = null;\n\t this.backdrop.$background = null;\n\t return this.backdrop.overlayElementShown = false;\n\t };\n\t\n\t Tour.prototype._applyBackdropPadding = function (padding, data) {\n\t if (typeof padding === 'object') {\n\t if (padding.top == null) {\n\t padding.top = 0;\n\t }\n\t if (padding.right == null) {\n\t padding.right = 0;\n\t }\n\t if (padding.bottom == null) {\n\t padding.bottom = 0;\n\t }\n\t if (padding.left == null) {\n\t padding.left = 0;\n\t }\n\t data.offset.top = data.offset.top - padding.top;\n\t data.offset.left = data.offset.left - padding.left;\n\t data.width = data.width + padding.left + padding.right;\n\t data.height = data.height + padding.top + padding.bottom;\n\t } else {\n\t data.offset.top = data.offset.top - padding;\n\t data.offset.left = data.offset.left - padding;\n\t data.width = data.width + padding * 2;\n\t data.height = data.height + padding * 2;\n\t }\n\t return data;\n\t };\n\t\n\t Tour.prototype._clearTimer = function () {\n\t window.clearTimeout(this._timer);\n\t this._timer = null;\n\t return this._duration = null;\n\t };\n\t\n\t Tour.prototype._getProtocol = function (url) {\n\t url = url.split('://');\n\t if (url.length > 1) {\n\t return url[0];\n\t } else {\n\t return 'http';\n\t }\n\t };\n\t\n\t Tour.prototype._getHost = function (url) {\n\t url = url.split('//');\n\t url = url.length > 1 ? url[1] : url[0];\n\t return url.split('/')[0];\n\t };\n\t\n\t Tour.prototype._getPath = function (path) {\n\t return path.replace(/\\/?$/, '').split('?')[0].split('#')[0];\n\t };\n\t\n\t Tour.prototype._getQuery = function (path) {\n\t return this._getParams(path, '?');\n\t };\n\t\n\t Tour.prototype._getHash = function (path) {\n\t return this._getParams(path, '#');\n\t };\n\t\n\t Tour.prototype._getParams = function (path, start) {\n\t var param, params, paramsObject, _i, _len;\n\t params = path.split(start);\n\t if (params.length === 1) {\n\t return {};\n\t }\n\t params = params[1].split('&');\n\t paramsObject = {};\n\t for (_i = 0, _len = params.length; _i < _len; _i++) {\n\t param = params[_i];\n\t param = param.split('=');\n\t paramsObject[param[0]] = param[1] || '';\n\t }\n\t return paramsObject;\n\t };\n\t\n\t Tour.prototype._equal = function (obj1, obj2) {\n\t var k, v;\n\t if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') {\n\t for (k in obj1) {\n\t v = obj1[k];\n\t if (obj2[k] !== v) {\n\t return false;\n\t }\n\t }\n\t for (k in obj2) {\n\t v = obj2[k];\n\t if (obj1[k] !== v) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t return obj1 === obj2;\n\t };\n\t\n\t return Tour;\n\t }();\n\t return window.Tour = Tour;\n\t})(jQuery, window);\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 75 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(jQuery) {/*! jQuery UI - v1.9.1 - 2012-10-29\n\t* http://jqueryui.com\n\t* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.menu.js, jquery.ui.slider.js\n\t* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */\n\t\n\t(function (e, t) {\n\t function i(t, n) {\n\t var r,\n\t i,\n\t o,\n\t u = t.nodeName.toLowerCase();return \"area\" === u ? (r = t.parentNode, i = r.name, !t.href || !i || r.nodeName.toLowerCase() !== \"map\" ? !1 : (o = e(\"img[usemap=#\" + i + \"]\")[0], !!o && s(o))) : (/input|select|textarea|button|object/.test(u) ? !t.disabled : \"a\" === u ? t.href || n : n) && s(t);\n\t }function s(t) {\n\t return e.expr.filters.visible(t) && !e(t).parents().andSelf().filter(function () {\n\t return e.css(this, \"visibility\") === \"hidden\";\n\t }).length;\n\t }var n = 0,\n\t r = /^ui-id-\\d+$/;e.ui = e.ui || {};if (e.ui.version) return;e.extend(e.ui, { version: \"1.9.1\", keyCode: { BACKSPACE: 8, COMMA: 188, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38 } }), e.fn.extend({ _focus: e.fn.focus, focus: function (t, n) {\n\t return typeof t == \"number\" ? this.each(function () {\n\t var r = this;setTimeout(function () {\n\t e(r).focus(), n && n.call(r);\n\t }, t);\n\t }) : this._focus.apply(this, arguments);\n\t }, scrollParent: function () {\n\t var t;return e.ui.ie && /(static|relative)/.test(this.css(\"position\")) || /absolute/.test(this.css(\"position\")) ? t = this.parents().filter(function () {\n\t return (/(relative|absolute|fixed)/.test(e.css(this, \"position\")) && /(auto|scroll)/.test(e.css(this, \"overflow\") + e.css(this, \"overflow-y\") + e.css(this, \"overflow-x\"))\n\t );\n\t }).eq(0) : t = this.parents().filter(function () {\n\t return (/(auto|scroll)/.test(e.css(this, \"overflow\") + e.css(this, \"overflow-y\") + e.css(this, \"overflow-x\"))\n\t );\n\t }).eq(0), /fixed/.test(this.css(\"position\")) || !t.length ? e(document) : t;\n\t }, zIndex: function (n) {\n\t if (n !== t) return this.css(\"zIndex\", n);if (this.length) {\n\t var r = e(this[0]),\n\t i,\n\t s;while (r.length && r[0] !== document) {\n\t i = r.css(\"position\");if (i === \"absolute\" || i === \"relative\" || i === \"fixed\") {\n\t s = parseInt(r.css(\"zIndex\"), 10);if (!isNaN(s) && s !== 0) return s;\n\t }r = r.parent();\n\t }\n\t }return 0;\n\t }, uniqueId: function () {\n\t return this.each(function () {\n\t this.id || (this.id = \"ui-id-\" + ++n);\n\t });\n\t }, removeUniqueId: function () {\n\t return this.each(function () {\n\t r.test(this.id) && e(this).removeAttr(\"id\");\n\t });\n\t } }), e(\"\").outerWidth(1).jquery || e.each([\"Width\", \"Height\"], function (n, r) {\n\t function u(t, n, r, s) {\n\t return e.each(i, function () {\n\t n -= parseFloat(e.css(t, \"padding\" + this)) || 0, r && (n -= parseFloat(e.css(t, \"border\" + this + \"Width\")) || 0), s && (n -= parseFloat(e.css(t, \"margin\" + this)) || 0);\n\t }), n;\n\t }var i = r === \"Width\" ? [\"Left\", \"Right\"] : [\"Top\", \"Bottom\"],\n\t s = r.toLowerCase(),\n\t o = { innerWidth: e.fn.innerWidth, innerHeight: e.fn.innerHeight, outerWidth: e.fn.outerWidth, outerHeight: e.fn.outerHeight };e.fn[\"inner\" + r] = function (n) {\n\t return n === t ? o[\"inner\" + r].call(this) : this.each(function () {\n\t e(this).css(s, u(this, n) + \"px\");\n\t });\n\t }, e.fn[\"outer\" + r] = function (t, n) {\n\t return typeof t != \"number\" ? o[\"outer\" + r].call(this, t) : this.each(function () {\n\t e(this).css(s, u(this, t, !0, n) + \"px\");\n\t });\n\t };\n\t }), e.extend(e.expr[\":\"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {\n\t return function (n) {\n\t return !!e.data(n, t);\n\t };\n\t }) : function (t, n, r) {\n\t return !!e.data(t, r[3]);\n\t }, focusable: function (t) {\n\t return i(t, !isNaN(e.attr(t, \"tabindex\")));\n\t }, tabbable: function (t) {\n\t var n = e.attr(t, \"tabindex\"),\n\t r = isNaN(n);return (r || n >= 0) && i(t, !r);\n\t } }), e(function () {\n\t var t = document.body,\n\t n = t.appendChild(n = document.createElement(\"div\"));n.offsetHeight, e.extend(n.style, { minHeight: \"100px\", height: \"auto\", padding: 0, borderWidth: 0 }), e.support.minHeight = n.offsetHeight === 100, e.support.selectstart = \"onselectstart\" in n, t.removeChild(n).style.display = \"none\";\n\t }), function () {\n\t var t = /msie ([\\w.]+)/.exec(navigator.userAgent.toLowerCase()) || [];e.ui.ie = t.length ? !0 : !1, e.ui.ie6 = parseFloat(t[1], 10) === 6;\n\t }(), e.fn.extend({ disableSelection: function () {\n\t return this.bind((e.support.selectstart ? \"selectstart\" : \"mousedown\") + \".ui-disableSelection\", function (e) {\n\t e.preventDefault();\n\t });\n\t }, enableSelection: function () {\n\t return this.unbind(\".ui-disableSelection\");\n\t } }), e.extend(e.ui, { plugin: { add: function (t, n, r) {\n\t var i,\n\t s = e.ui[t].prototype;for (i in r) s.plugins[i] = s.plugins[i] || [], s.plugins[i].push([n, r[i]]);\n\t }, call: function (e, t, n) {\n\t var r,\n\t i = e.plugins[t];if (!i || !e.element[0].parentNode || e.element[0].parentNode.nodeType === 11) return;for (r = 0; r < i.length; r++) e.options[i[r][0]] && i[r][1].apply(e.element, n);\n\t } }, contains: e.contains, hasScroll: function (t, n) {\n\t if (e(t).css(\"overflow\") === \"hidden\") return !1;var r = n && n === \"left\" ? \"scrollLeft\" : \"scrollTop\",\n\t i = !1;return t[r] > 0 ? !0 : (t[r] = 1, i = t[r] > 0, t[r] = 0, i);\n\t }, isOverAxis: function (e, t, n) {\n\t return e > t && e < t + n;\n\t }, isOver: function (t, n, r, i, s, o) {\n\t return e.ui.isOverAxis(t, r, s) && e.ui.isOverAxis(n, i, o);\n\t } });\n\t})(jQuery);(function (e, t) {\n\t var n = 0,\n\t r = Array.prototype.slice,\n\t i = e.cleanData;e.cleanData = function (t) {\n\t for (var n = 0, r; (r = t[n]) != null; n++) try {\n\t e(r).triggerHandler(\"remove\");\n\t } catch (s) {}i(t);\n\t }, e.widget = function (t, n, r) {\n\t var i,\n\t s,\n\t o,\n\t u,\n\t a = t.split(\".\")[0];t = t.split(\".\")[1], i = a + \"-\" + t, r || (r = n, n = e.Widget), e.expr[\":\"][i.toLowerCase()] = function (t) {\n\t return !!e.data(t, i);\n\t }, e[a] = e[a] || {}, s = e[a][t], o = e[a][t] = function (e, t) {\n\t if (!this._createWidget) return new o(e, t);arguments.length && this._createWidget(e, t);\n\t }, e.extend(o, s, { version: r.version, _proto: e.extend({}, r), _childConstructors: [] }), u = new n(), u.options = e.widget.extend({}, u.options), e.each(r, function (t, i) {\n\t e.isFunction(i) && (r[t] = function () {\n\t var e = function () {\n\t return n.prototype[t].apply(this, arguments);\n\t },\n\t r = function (e) {\n\t return n.prototype[t].apply(this, e);\n\t };return function () {\n\t var t = this._super,\n\t n = this._superApply,\n\t s;return this._super = e, this._superApply = r, s = i.apply(this, arguments), this._super = t, this._superApply = n, s;\n\t };\n\t }());\n\t }), o.prototype = e.widget.extend(u, { widgetEventPrefix: u.widgetEventPrefix || t }, r, { constructor: o, namespace: a, widgetName: t, widgetBaseClass: i, widgetFullName: i }), s ? (e.each(s._childConstructors, function (t, n) {\n\t var r = n.prototype;e.widget(r.namespace + \".\" + r.widgetName, o, n._proto);\n\t }), delete s._childConstructors) : n._childConstructors.push(o), e.widget.bridge(t, o);\n\t }, e.widget.extend = function (n) {\n\t var i = r.call(arguments, 1),\n\t s = 0,\n\t o = i.length,\n\t u,\n\t a;for (; s < o; s++) for (u in i[s]) a = i[s][u], i[s].hasOwnProperty(u) && a !== t && (e.isPlainObject(a) ? n[u] = e.isPlainObject(n[u]) ? e.widget.extend({}, n[u], a) : e.widget.extend({}, a) : n[u] = a);return n;\n\t }, e.widget.bridge = function (n, i) {\n\t var s = i.prototype.widgetFullName;e.fn[n] = function (o) {\n\t var u = typeof o == \"string\",\n\t a = r.call(arguments, 1),\n\t f = this;return o = !u && a.length ? e.widget.extend.apply(null, [o].concat(a)) : o, u ? this.each(function () {\n\t var r,\n\t i = e.data(this, s);if (!i) return e.error(\"cannot call methods on \" + n + \" prior to initialization; \" + \"attempted to call method '\" + o + \"'\");if (!e.isFunction(i[o]) || o.charAt(0) === \"_\") return e.error(\"no such method '\" + o + \"' for \" + n + \" widget instance\");r = i[o].apply(i, a);if (r !== i && r !== t) return f = r && r.jquery ? f.pushStack(r.get()) : r, !1;\n\t }) : this.each(function () {\n\t var t = e.data(this, s);t ? t.option(o || {})._init() : new i(o, this);\n\t }), f;\n\t };\n\t }, e.Widget = function () {}, e.Widget._childConstructors = [], e.Widget.prototype = { widgetName: \"widget\", widgetEventPrefix: \"\", defaultElement: \"
                                                                \", options: { disabled: !1, create: null }, _createWidget: function (t, r) {\n\t r = e(r || this.defaultElement || this)[0], this.element = e(r), this.uuid = n++, this.eventNamespace = \".\" + this.widgetName + this.uuid, this.options = e.widget.extend({}, this.options, this._getCreateOptions(), t), this.bindings = e(), this.hoverable = e(), this.focusable = e(), r !== this && (e.data(r, this.widgetName, this), e.data(r, this.widgetFullName, this), this._on(this.element, { remove: function (e) {\n\t e.target === r && this.destroy();\n\t } }), this.document = e(r.style ? r.ownerDocument : r.document || r), this.window = e(this.document[0].defaultView || this.document[0].parentWindow)), this._create(), this._trigger(\"create\", null, this._getCreateEventData()), this._init();\n\t }, _getCreateOptions: e.noop, _getCreateEventData: e.noop, _create: e.noop, _init: e.noop, destroy: function () {\n\t this._destroy(), this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)), this.widget().unbind(this.eventNamespace).removeAttr(\"aria-disabled\").removeClass(this.widgetFullName + \"-disabled \" + \"ui-state-disabled\"), this.bindings.unbind(this.eventNamespace), this.hoverable.removeClass(\"ui-state-hover\"), this.focusable.removeClass(\"ui-state-focus\");\n\t }, _destroy: e.noop, widget: function () {\n\t return this.element;\n\t }, option: function (n, r) {\n\t var i = n,\n\t s,\n\t o,\n\t u;if (arguments.length === 0) return e.widget.extend({}, this.options);if (typeof n == \"string\") {\n\t i = {}, s = n.split(\".\"), n = s.shift();if (s.length) {\n\t o = i[n] = e.widget.extend({}, this.options[n]);for (u = 0; u < s.length - 1; u++) o[s[u]] = o[s[u]] || {}, o = o[s[u]];n = s.pop();if (r === t) return o[n] === t ? null : o[n];o[n] = r;\n\t } else {\n\t if (r === t) return this.options[n] === t ? null : this.options[n];i[n] = r;\n\t }\n\t }return this._setOptions(i), this;\n\t }, _setOptions: function (e) {\n\t var t;for (t in e) this._setOption(t, e[t]);return this;\n\t }, _setOption: function (e, t) {\n\t return this.options[e] = t, e === \"disabled\" && (this.widget().toggleClass(this.widgetFullName + \"-disabled ui-state-disabled\", !!t).attr(\"aria-disabled\", t), this.hoverable.removeClass(\"ui-state-hover\"), this.focusable.removeClass(\"ui-state-focus\")), this;\n\t }, enable: function () {\n\t return this._setOption(\"disabled\", !1);\n\t }, disable: function () {\n\t return this._setOption(\"disabled\", !0);\n\t }, _on: function (t, n) {\n\t var r,\n\t i = this;n ? (t = r = e(t), this.bindings = this.bindings.add(t)) : (n = t, t = this.element, r = this.widget()), e.each(n, function (n, s) {\n\t function o() {\n\t if (i.options.disabled === !0 || e(this).hasClass(\"ui-state-disabled\")) return;return (typeof s == \"string\" ? i[s] : s).apply(i, arguments);\n\t }typeof s != \"string\" && (o.guid = s.guid = s.guid || o.guid || e.guid++);var u = n.match(/^(\\w+)\\s*(.*)$/),\n\t a = u[1] + i.eventNamespace,\n\t f = u[2];f ? r.delegate(f, a, o) : t.bind(a, o);\n\t });\n\t }, _off: function (e, t) {\n\t t = (t || \"\").split(\" \").join(this.eventNamespace + \" \") + this.eventNamespace, e.unbind(t).undelegate(t);\n\t }, _delay: function (e, t) {\n\t function n() {\n\t return (typeof e == \"string\" ? r[e] : e).apply(r, arguments);\n\t }var r = this;return setTimeout(n, t || 0);\n\t }, _hoverable: function (t) {\n\t this.hoverable = this.hoverable.add(t), this._on(t, { mouseenter: function (t) {\n\t e(t.currentTarget).addClass(\"ui-state-hover\");\n\t }, mouseleave: function (t) {\n\t e(t.currentTarget).removeClass(\"ui-state-hover\");\n\t } });\n\t }, _focusable: function (t) {\n\t this.focusable = this.focusable.add(t), this._on(t, { focusin: function (t) {\n\t e(t.currentTarget).addClass(\"ui-state-focus\");\n\t }, focusout: function (t) {\n\t e(t.currentTarget).removeClass(\"ui-state-focus\");\n\t } });\n\t }, _trigger: function (t, n, r) {\n\t var i,\n\t s,\n\t o = this.options[t];r = r || {}, n = e.Event(n), n.type = (t === this.widgetEventPrefix ? t : this.widgetEventPrefix + t).toLowerCase(), n.target = this.element[0], s = n.originalEvent;if (s) for (i in s) i in n || (n[i] = s[i]);return this.element.trigger(n, r), !(e.isFunction(o) && o.apply(this.element[0], [n].concat(r)) === !1 || n.isDefaultPrevented());\n\t } }, e.each({ show: \"fadeIn\", hide: \"fadeOut\" }, function (t, n) {\n\t e.Widget.prototype[\"_\" + t] = function (r, i, s) {\n\t typeof i == \"string\" && (i = { effect: i });var o,\n\t u = i ? i === !0 || typeof i == \"number\" ? n : i.effect || n : t;i = i || {}, typeof i == \"number\" && (i = { duration: i }), o = !e.isEmptyObject(i), i.complete = s, i.delay && r.delay(i.delay), o && e.effects && (e.effects.effect[u] || e.uiBackCompat !== !1 && e.effects[u]) ? r[t](i) : u !== t && r[u] ? r[u](i.duration, i.easing, s) : r.queue(function (n) {\n\t e(this)[t](), s && s.call(r[0]), n();\n\t });\n\t };\n\t }), e.uiBackCompat !== !1 && (e.Widget.prototype._getCreateOptions = function () {\n\t return e.metadata && e.metadata.get(this.element[0])[this.widgetName];\n\t });\n\t})(jQuery);(function (e, t) {\n\t var n = !1;e(document).mouseup(function (e) {\n\t n = !1;\n\t }), e.widget(\"ui.mouse\", { version: \"1.9.1\", options: { cancel: \"input,textarea,button,select,option\", distance: 1, delay: 0 }, _mouseInit: function () {\n\t var t = this;this.element.bind(\"mousedown.\" + this.widgetName, function (e) {\n\t return t._mouseDown(e);\n\t }).bind(\"click.\" + this.widgetName, function (n) {\n\t if (!0 === e.data(n.target, t.widgetName + \".preventClickEvent\")) return e.removeData(n.target, t.widgetName + \".preventClickEvent\"), n.stopImmediatePropagation(), !1;\n\t }), this.started = !1;\n\t }, _mouseDestroy: function () {\n\t this.element.unbind(\".\" + this.widgetName), this._mouseMoveDelegate && e(document).unbind(\"mousemove.\" + this.widgetName, this._mouseMoveDelegate).unbind(\"mouseup.\" + this.widgetName, this._mouseUpDelegate);\n\t }, _mouseDown: function (t) {\n\t if (n) return;this._mouseStarted && this._mouseUp(t), this._mouseDownEvent = t;var r = this,\n\t i = t.which === 1,\n\t s = typeof this.options.cancel == \"string\" && t.target.nodeName ? e(t.target).closest(this.options.cancel).length : !1;if (!i || s || !this._mouseCapture(t)) return !0;this.mouseDelayMet = !this.options.delay, this.mouseDelayMet || (this._mouseDelayTimer = setTimeout(function () {\n\t r.mouseDelayMet = !0;\n\t }, this.options.delay));if (this._mouseDistanceMet(t) && this._mouseDelayMet(t)) {\n\t this._mouseStarted = this._mouseStart(t) !== !1;if (!this._mouseStarted) return t.preventDefault(), !0;\n\t }return !0 === e.data(t.target, this.widgetName + \".preventClickEvent\") && e.removeData(t.target, this.widgetName + \".preventClickEvent\"), this._mouseMoveDelegate = function (e) {\n\t return r._mouseMove(e);\n\t }, this._mouseUpDelegate = function (e) {\n\t return r._mouseUp(e);\n\t }, e(document).bind(\"mousemove.\" + this.widgetName, this._mouseMoveDelegate).bind(\"mouseup.\" + this.widgetName, this._mouseUpDelegate), t.preventDefault(), n = !0, !0;\n\t }, _mouseMove: function (t) {\n\t return !e.ui.ie || document.documentMode >= 9 || !!t.button ? this._mouseStarted ? (this._mouseDrag(t), t.preventDefault()) : (this._mouseDistanceMet(t) && this._mouseDelayMet(t) && (this._mouseStarted = this._mouseStart(this._mouseDownEvent, t) !== !1, this._mouseStarted ? this._mouseDrag(t) : this._mouseUp(t)), !this._mouseStarted) : this._mouseUp(t);\n\t }, _mouseUp: function (t) {\n\t return e(document).unbind(\"mousemove.\" + this.widgetName, this._mouseMoveDelegate).unbind(\"mouseup.\" + this.widgetName, this._mouseUpDelegate), this._mouseStarted && (this._mouseStarted = !1, t.target === this._mouseDownEvent.target && e.data(t.target, this.widgetName + \".preventClickEvent\", !0), this._mouseStop(t)), !1;\n\t }, _mouseDistanceMet: function (e) {\n\t return Math.max(Math.abs(this._mouseDownEvent.pageX - e.pageX), Math.abs(this._mouseDownEvent.pageY - e.pageY)) >= this.options.distance;\n\t }, _mouseDelayMet: function (e) {\n\t return this.mouseDelayMet;\n\t }, _mouseStart: function (e) {}, _mouseDrag: function (e) {}, _mouseStop: function (e) {}, _mouseCapture: function (e) {\n\t return !0;\n\t } });\n\t})(jQuery);(function (e, t) {\n\t function h(e, t, n) {\n\t return [parseInt(e[0], 10) * (l.test(e[0]) ? t / 100 : 1), parseInt(e[1], 10) * (l.test(e[1]) ? n / 100 : 1)];\n\t }function p(t, n) {\n\t return parseInt(e.css(t, n), 10) || 0;\n\t }e.ui = e.ui || {};var n,\n\t r = Math.max,\n\t i = Math.abs,\n\t s = Math.round,\n\t o = /left|center|right/,\n\t u = /top|center|bottom/,\n\t a = /[\\+\\-]\\d+%?/,\n\t f = /^\\w+/,\n\t l = /%$/,\n\t c = e.fn.position;e.position = { scrollbarWidth: function () {\n\t if (n !== t) return n;var r,\n\t i,\n\t s = e(\"
                                                                \"),\n\t o = s.children()[0];return e(\"body\").append(s), r = o.offsetWidth, s.css(\"overflow\", \"scroll\"), i = o.offsetWidth, r === i && (i = s[0].clientWidth), s.remove(), n = r - i;\n\t }, getScrollInfo: function (t) {\n\t var n = t.isWindow ? \"\" : t.element.css(\"overflow-x\"),\n\t r = t.isWindow ? \"\" : t.element.css(\"overflow-y\"),\n\t i = n === \"scroll\" || n === \"auto\" && t.width < t.element[0].scrollWidth,\n\t s = r === \"scroll\" || r === \"auto\" && t.height < t.element[0].scrollHeight;return { width: i ? e.position.scrollbarWidth() : 0, height: s ? e.position.scrollbarWidth() : 0 };\n\t }, getWithinInfo: function (t) {\n\t var n = e(t || window),\n\t r = e.isWindow(n[0]);return { element: n, isWindow: r, offset: n.offset() || { left: 0, top: 0 }, scrollLeft: n.scrollLeft(), scrollTop: n.scrollTop(), width: r ? n.width() : n.outerWidth(), height: r ? n.height() : n.outerHeight() };\n\t } }, e.fn.position = function (t) {\n\t if (!t || !t.of) return c.apply(this, arguments);t = e.extend({}, t);var n,\n\t l,\n\t d,\n\t v,\n\t m,\n\t g = e(t.of),\n\t y = e.position.getWithinInfo(t.within),\n\t b = e.position.getScrollInfo(y),\n\t w = g[0],\n\t E = (t.collision || \"flip\").split(\" \"),\n\t S = {};return w.nodeType === 9 ? (l = g.width(), d = g.height(), v = { top: 0, left: 0 }) : e.isWindow(w) ? (l = g.width(), d = g.height(), v = { top: g.scrollTop(), left: g.scrollLeft() }) : w.preventDefault ? (t.at = \"left top\", l = d = 0, v = { top: w.pageY, left: w.pageX }) : (l = g.outerWidth(), d = g.outerHeight(), v = g.offset()), m = e.extend({}, v), e.each([\"my\", \"at\"], function () {\n\t var e = (t[this] || \"\").split(\" \"),\n\t n,\n\t r;e.length === 1 && (e = o.test(e[0]) ? e.concat([\"center\"]) : u.test(e[0]) ? [\"center\"].concat(e) : [\"center\", \"center\"]), e[0] = o.test(e[0]) ? e[0] : \"center\", e[1] = u.test(e[1]) ? e[1] : \"center\", n = a.exec(e[0]), r = a.exec(e[1]), S[this] = [n ? n[0] : 0, r ? r[0] : 0], t[this] = [f.exec(e[0])[0], f.exec(e[1])[0]];\n\t }), E.length === 1 && (E[1] = E[0]), t.at[0] === \"right\" ? m.left += l : t.at[0] === \"center\" && (m.left += l / 2), t.at[1] === \"bottom\" ? m.top += d : t.at[1] === \"center\" && (m.top += d / 2), n = h(S.at, l, d), m.left += n[0], m.top += n[1], this.each(function () {\n\t var o,\n\t u,\n\t a = e(this),\n\t f = a.outerWidth(),\n\t c = a.outerHeight(),\n\t w = p(this, \"marginLeft\"),\n\t x = p(this, \"marginTop\"),\n\t T = f + w + p(this, \"marginRight\") + b.width,\n\t N = c + x + p(this, \"marginBottom\") + b.height,\n\t C = e.extend({}, m),\n\t k = h(S.my, a.outerWidth(), a.outerHeight());t.my[0] === \"right\" ? C.left -= f : t.my[0] === \"center\" && (C.left -= f / 2), t.my[1] === \"bottom\" ? C.top -= c : t.my[1] === \"center\" && (C.top -= c / 2), C.left += k[0], C.top += k[1], e.support.offsetFractions || (C.left = s(C.left), C.top = s(C.top)), o = { marginLeft: w, marginTop: x }, e.each([\"left\", \"top\"], function (r, i) {\n\t e.ui.position[E[r]] && e.ui.position[E[r]][i](C, { targetWidth: l, targetHeight: d, elemWidth: f, elemHeight: c, collisionPosition: o, collisionWidth: T, collisionHeight: N, offset: [n[0] + k[0], n[1] + k[1]], my: t.my, at: t.at, within: y, elem: a });\n\t }), e.fn.bgiframe && a.bgiframe(), t.using && (u = function (e) {\n\t var n = v.left - C.left,\n\t s = n + l - f,\n\t o = v.top - C.top,\n\t u = o + d - c,\n\t h = { target: { element: g, left: v.left, top: v.top, width: l, height: d }, element: { element: a, left: C.left, top: C.top, width: f, height: c }, horizontal: s < 0 ? \"left\" : n > 0 ? \"right\" : \"center\", vertical: u < 0 ? \"top\" : o > 0 ? \"bottom\" : \"middle\" };l < f && i(n + s) < l && (h.horizontal = \"center\"), d < c && i(o + u) < d && (h.vertical = \"middle\"), r(i(n), i(s)) > r(i(o), i(u)) ? h.important = \"horizontal\" : h.important = \"vertical\", t.using.call(this, e, h);\n\t }), a.offset(e.extend(C, { using: u }));\n\t });\n\t }, e.ui.position = { fit: { left: function (e, t) {\n\t var n = t.within,\n\t i = n.isWindow ? n.scrollLeft : n.offset.left,\n\t s = n.width,\n\t o = e.left - t.collisionPosition.marginLeft,\n\t u = i - o,\n\t a = o + t.collisionWidth - s - i,\n\t f;t.collisionWidth > s ? u > 0 && a <= 0 ? (f = e.left + u + t.collisionWidth - s - i, e.left += u - f) : a > 0 && u <= 0 ? e.left = i : u > a ? e.left = i + s - t.collisionWidth : e.left = i : u > 0 ? e.left += u : a > 0 ? e.left -= a : e.left = r(e.left - o, e.left);\n\t }, top: function (e, t) {\n\t var n = t.within,\n\t i = n.isWindow ? n.scrollTop : n.offset.top,\n\t s = t.within.height,\n\t o = e.top - t.collisionPosition.marginTop,\n\t u = i - o,\n\t a = o + t.collisionHeight - s - i,\n\t f;t.collisionHeight > s ? u > 0 && a <= 0 ? (f = e.top + u + t.collisionHeight - s - i, e.top += u - f) : a > 0 && u <= 0 ? e.top = i : u > a ? e.top = i + s - t.collisionHeight : e.top = i : u > 0 ? e.top += u : a > 0 ? e.top -= a : e.top = r(e.top - o, e.top);\n\t } }, flip: { left: function (e, t) {\n\t var n = t.within,\n\t r = n.offset.left + n.scrollLeft,\n\t s = n.width,\n\t o = n.isWindow ? n.scrollLeft : n.offset.left,\n\t u = e.left - t.collisionPosition.marginLeft,\n\t a = u - o,\n\t f = u + t.collisionWidth - s - o,\n\t l = t.my[0] === \"left\" ? -t.elemWidth : t.my[0] === \"right\" ? t.elemWidth : 0,\n\t c = t.at[0] === \"left\" ? t.targetWidth : t.at[0] === \"right\" ? -t.targetWidth : 0,\n\t h = -2 * t.offset[0],\n\t p,\n\t d;if (a < 0) {\n\t p = e.left + l + c + h + t.collisionWidth - s - r;if (p < 0 || p < i(a)) e.left += l + c + h;\n\t } else if (f > 0) {\n\t d = e.left - t.collisionPosition.marginLeft + l + c + h - o;if (d > 0 || i(d) < f) e.left += l + c + h;\n\t }\n\t }, top: function (e, t) {\n\t var n = t.within,\n\t r = n.offset.top + n.scrollTop,\n\t s = n.height,\n\t o = n.isWindow ? n.scrollTop : n.offset.top,\n\t u = e.top - t.collisionPosition.marginTop,\n\t a = u - o,\n\t f = u + t.collisionHeight - s - o,\n\t l = t.my[1] === \"top\",\n\t c = l ? -t.elemHeight : t.my[1] === \"bottom\" ? t.elemHeight : 0,\n\t h = t.at[1] === \"top\" ? t.targetHeight : t.at[1] === \"bottom\" ? -t.targetHeight : 0,\n\t p = -2 * t.offset[1],\n\t d,\n\t v;a < 0 ? (v = e.top + c + h + p + t.collisionHeight - s - r, e.top + c + h + p > a && (v < 0 || v < i(a)) && (e.top += c + h + p)) : f > 0 && (d = e.top - t.collisionPosition.marginTop + c + h + p - o, e.top + c + h + p > f && (d > 0 || i(d) < f) && (e.top += c + h + p));\n\t } }, flipfit: { left: function () {\n\t e.ui.position.flip.left.apply(this, arguments), e.ui.position.fit.left.apply(this, arguments);\n\t }, top: function () {\n\t e.ui.position.flip.top.apply(this, arguments), e.ui.position.fit.top.apply(this, arguments);\n\t } } }, function () {\n\t var t,\n\t n,\n\t r,\n\t i,\n\t s,\n\t o = document.getElementsByTagName(\"body\")[0],\n\t u = document.createElement(\"div\");t = document.createElement(o ? \"div\" : \"body\"), r = { visibility: \"hidden\", width: 0, height: 0, border: 0, margin: 0, background: \"none\" }, o && e.extend(r, { position: \"absolute\", left: \"-1000px\", top: \"-1000px\" });for (s in r) t.style[s] = r[s];t.appendChild(u), n = o || document.documentElement, n.insertBefore(t, n.firstChild), u.style.cssText = \"position: absolute; left: 10.7432222px;\", i = e(u).offset().left, e.support.offsetFractions = i > 10 && i < 11, t.innerHTML = \"\", n.removeChild(t);\n\t }(), e.uiBackCompat !== !1 && function (e) {\n\t var n = e.fn.position;e.fn.position = function (r) {\n\t if (!r || !r.offset) return n.call(this, r);var i = r.offset.split(\" \"),\n\t s = r.at.split(\" \");return i.length === 1 && (i[1] = i[0]), /^\\d/.test(i[0]) && (i[0] = \"+\" + i[0]), /^\\d/.test(i[1]) && (i[1] = \"+\" + i[1]), s.length === 1 && (/left|center|right/.test(s[0]) ? s[1] = \"center\" : (s[1] = s[0], s[0] = \"center\")), n.call(this, e.extend(r, { at: s[0] + i[0] + \" \" + s[1] + i[1], offset: t }));\n\t };\n\t }(jQuery);\n\t})(jQuery);(function (e, t) {\n\t var n = 0;e.widget(\"ui.autocomplete\", { version: \"1.9.1\", defaultElement: \"\", options: { appendTo: \"body\", autoFocus: !1, delay: 300, minLength: 1, position: { my: \"left top\", at: \"left bottom\", collision: \"none\" }, source: null, change: null, close: null, focus: null, open: null, response: null, search: null, select: null }, pending: 0, _create: function () {\n\t var t, n, r;this.isMultiLine = this._isMultiLine(), this.valueMethod = this.element[this.element.is(\"input,textarea\") ? \"val\" : \"text\"], this.isNewMenu = !0, this.element.addClass(\"ui-autocomplete-input\").attr(\"autocomplete\", \"off\"), this._on(this.element, { keydown: function (i) {\n\t if (this.element.prop(\"readOnly\")) {\n\t t = !0, r = !0, n = !0;return;\n\t }t = !1, r = !1, n = !1;var s = e.ui.keyCode;switch (i.keyCode) {case s.PAGE_UP:\n\t t = !0, this._move(\"previousPage\", i);break;case s.PAGE_DOWN:\n\t t = !0, this._move(\"nextPage\", i);break;case s.UP:\n\t t = !0, this._keyEvent(\"previous\", i);break;case s.DOWN:\n\t t = !0, this._keyEvent(\"next\", i);break;case s.ENTER:case s.NUMPAD_ENTER:\n\t this.menu.active && (t = !0, i.preventDefault(), this.menu.select(i));break;case s.TAB:\n\t this.menu.active && this.menu.select(i);break;case s.ESCAPE:\n\t this.menu.element.is(\":visible\") && (this._value(this.term), this.close(i), i.preventDefault());break;default:\n\t n = !0, this._searchTimeout(i);}\n\t }, keypress: function (r) {\n\t if (t) {\n\t t = !1, r.preventDefault();return;\n\t }if (n) return;var i = e.ui.keyCode;switch (r.keyCode) {case i.PAGE_UP:\n\t this._move(\"previousPage\", r);break;case i.PAGE_DOWN:\n\t this._move(\"nextPage\", r);break;case i.UP:\n\t this._keyEvent(\"previous\", r);break;case i.DOWN:\n\t this._keyEvent(\"next\", r);}\n\t }, input: function (e) {\n\t if (r) {\n\t r = !1, e.preventDefault();return;\n\t }this._searchTimeout(e);\n\t }, focus: function () {\n\t this.selectedItem = null, this.previous = this._value();\n\t }, blur: function (e) {\n\t if (this.cancelBlur) {\n\t delete this.cancelBlur;return;\n\t }clearTimeout(this.searching), this.close(e), this._change(e);\n\t } }), this._initSource(), this.menu = e(\"
                                                                  \").addClass(\"ui-autocomplete\").appendTo(this.document.find(this.options.appendTo || \"body\")[0]).menu({ input: e(), role: null }).zIndex(this.element.zIndex() + 1).hide().data(\"menu\"), this._on(this.menu.element, { mousedown: function (t) {\n\t t.preventDefault(), this.cancelBlur = !0, this._delay(function () {\n\t delete this.cancelBlur;\n\t });var n = this.menu.element[0];e(t.target).closest(\".ui-menu-item\").length || this._delay(function () {\n\t var t = this;this.document.one(\"mousedown\", function (r) {\n\t r.target !== t.element[0] && r.target !== n && !e.contains(n, r.target) && t.close();\n\t });\n\t });\n\t }, menufocus: function (t, n) {\n\t if (this.isNewMenu) {\n\t this.isNewMenu = !1;if (t.originalEvent && /^mouse/.test(t.originalEvent.type)) {\n\t this.menu.blur(), this.document.one(\"mousemove\", function () {\n\t e(t.target).trigger(t.originalEvent);\n\t });return;\n\t }\n\t }var r = n.item.data(\"ui-autocomplete-item\") || n.item.data(\"item.autocomplete\");!1 !== this._trigger(\"focus\", t, { item: r }) ? t.originalEvent && /^key/.test(t.originalEvent.type) && this._value(r.value) : this.liveRegion.text(r.value);\n\t }, menuselect: function (e, t) {\n\t var n = t.item.data(\"ui-autocomplete-item\") || t.item.data(\"item.autocomplete\"),\n\t r = this.previous;this.element[0] !== this.document[0].activeElement && (this.element.focus(), this.previous = r, this._delay(function () {\n\t this.previous = r, this.selectedItem = n;\n\t })), !1 !== this._trigger(\"select\", e, { item: n }) && this._value(n.value), this.term = this._value(), this.close(e), this.selectedItem = n;\n\t } }), this.liveRegion = e(\"\", { role: \"status\", \"aria-live\": \"polite\" }).addClass(\"ui-helper-hidden-accessible\").insertAfter(this.element), e.fn.bgiframe && this.menu.element.bgiframe(), this._on(this.window, { beforeunload: function () {\n\t this.element.removeAttr(\"autocomplete\");\n\t } });\n\t }, _destroy: function () {\n\t clearTimeout(this.searching), this.element.removeClass(\"ui-autocomplete-input\").removeAttr(\"autocomplete\"), this.menu.element.remove(), this.liveRegion.remove();\n\t }, _setOption: function (e, t) {\n\t this._super(e, t), e === \"source\" && this._initSource(), e === \"appendTo\" && this.menu.element.appendTo(this.document.find(t || \"body\")[0]), e === \"disabled\" && t && this.xhr && this.xhr.abort();\n\t }, _isMultiLine: function () {\n\t return this.element.is(\"textarea\") ? !0 : this.element.is(\"input\") ? !1 : this.element.prop(\"isContentEditable\");\n\t }, _initSource: function () {\n\t var t,\n\t n,\n\t r = this;e.isArray(this.options.source) ? (t = this.options.source, this.source = function (n, r) {\n\t r(e.ui.autocomplete.filter(t, n.term));\n\t }) : typeof this.options.source == \"string\" ? (n = this.options.source, this.source = function (t, i) {\n\t r.xhr && r.xhr.abort(), r.xhr = e.ajax({ url: n, data: t, dataType: \"json\", success: function (e) {\n\t i(e);\n\t }, error: function () {\n\t i([]);\n\t } });\n\t }) : this.source = this.options.source;\n\t }, _searchTimeout: function (e) {\n\t clearTimeout(this.searching), this.searching = this._delay(function () {\n\t this.term !== this._value() && (this.selectedItem = null, this.search(null, e));\n\t }, this.options.delay);\n\t }, search: function (e, t) {\n\t e = e != null ? e : this._value(), this.term = this._value();if (e.length < this.options.minLength) return this.close(t);if (this._trigger(\"search\", t) === !1) return;return this._search(e);\n\t }, _search: function (e) {\n\t this.pending++, this.element.addClass(\"ui-autocomplete-loading\"), this.cancelSearch = !1, this.source({ term: e }, this._response());\n\t }, _response: function () {\n\t var e = this,\n\t t = ++n;return function (r) {\n\t t === n && e.__response(r), e.pending--, e.pending || e.element.removeClass(\"ui-autocomplete-loading\");\n\t };\n\t }, __response: function (e) {\n\t e && (e = this._normalize(e)), this._trigger(\"response\", null, { content: e }), !this.options.disabled && e && e.length && !this.cancelSearch ? (this._suggest(e), this._trigger(\"open\")) : this._close();\n\t }, close: function (e) {\n\t this.cancelSearch = !0, this._close(e);\n\t }, _close: function (e) {\n\t this.menu.element.is(\":visible\") && (this.menu.element.hide(), this.menu.blur(), this.isNewMenu = !0, this._trigger(\"close\", e));\n\t }, _change: function (e) {\n\t this.previous !== this._value() && this._trigger(\"change\", e, { item: this.selectedItem });\n\t }, _normalize: function (t) {\n\t return t.length && t[0].label && t[0].value ? t : e.map(t, function (t) {\n\t return typeof t == \"string\" ? { label: t, value: t } : e.extend({ label: t.label || t.value, value: t.value || t.label }, t);\n\t });\n\t }, _suggest: function (t) {\n\t var n = this.menu.element.empty().zIndex(this.element.zIndex() + 1);this._renderMenu(n, t), this.menu.refresh(), n.show(), this._resizeMenu(), n.position(e.extend({ of: this.element }, this.options.position)), this.options.autoFocus && this.menu.next();\n\t }, _resizeMenu: function () {\n\t var e = this.menu.element;e.outerWidth(Math.max(e.width(\"\").outerWidth() + 1, this.element.outerWidth()));\n\t }, _renderMenu: function (t, n) {\n\t var r = this;e.each(n, function (e, n) {\n\t r._renderItemData(t, n);\n\t });\n\t }, _renderItemData: function (e, t) {\n\t return this._renderItem(e, t).data(\"ui-autocomplete-item\", t);\n\t }, _renderItem: function (t, n) {\n\t return e(\"
                                                                • \").append(e(\"\").text(n.label)).appendTo(t);\n\t }, _move: function (e, t) {\n\t if (!this.menu.element.is(\":visible\")) {\n\t this.search(null, t);return;\n\t }if (this.menu.isFirstItem() && /^previous/.test(e) || this.menu.isLastItem() && /^next/.test(e)) {\n\t this._value(this.term), this.menu.blur();return;\n\t }this.menu[e](t);\n\t }, widget: function () {\n\t return this.menu.element;\n\t }, _value: function () {\n\t return this.valueMethod.apply(this.element, arguments);\n\t }, _keyEvent: function (e, t) {\n\t if (!this.isMultiLine || this.menu.element.is(\":visible\")) this._move(e, t), t.preventDefault();\n\t } }), e.extend(e.ui.autocomplete, { escapeRegex: function (e) {\n\t return e.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n\t }, filter: function (t, n) {\n\t var r = new RegExp(e.ui.autocomplete.escapeRegex(n), \"i\");return e.grep(t, function (e) {\n\t return r.test(e.label || e.value || e);\n\t });\n\t } }), e.widget(\"ui.autocomplete\", e.ui.autocomplete, { options: { messages: { noResults: \"No search results.\", results: function (e) {\n\t return e + (e > 1 ? \" results are\" : \" result is\") + \" available, use up and down arrow keys to navigate.\";\n\t } } }, __response: function (e) {\n\t var t;this._superApply(arguments);if (this.options.disabled || this.cancelSearch) return;e && e.length ? t = this.options.messages.results(e.length) : t = this.options.messages.noResults, this.liveRegion.text(t);\n\t } });\n\t})(jQuery);(function (e, t) {\n\t var n,\n\t r,\n\t i,\n\t s,\n\t o = \"ui-button ui-widget ui-state-default ui-corner-all\",\n\t u = \"ui-state-hover ui-state-active \",\n\t a = \"ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only\",\n\t f = function () {\n\t var t = e(this).find(\":ui-button\");setTimeout(function () {\n\t t.button(\"refresh\");\n\t }, 1);\n\t },\n\t l = function (t) {\n\t var n = t.name,\n\t r = t.form,\n\t i = e([]);return n && (r ? i = e(r).find(\"[name='\" + n + \"']\") : i = e(\"[name='\" + n + \"']\", t.ownerDocument).filter(function () {\n\t return !this.form;\n\t })), i;\n\t };e.widget(\"ui.button\", { version: \"1.9.1\", defaultElement: \"
                                                                \"\n )\n });\n modal.show( { backdrop: true } );\n}\n\n\n// ============================================================================\n return {\n Modal : Modal,\n hide_modal : hide_modal,\n show_modal : show_modal,\n show_message : show_message,\n show_in_overlay : show_in_overlay,\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/layout/modal.js","/* ========================================================================\n * bootstrap-tour - v0.10.2\n * http://bootstraptour.com\n * ========================================================================\n * Copyright 2012-2015 Ulrich Sossou\n *\n * ========================================================================\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://opensource.org/licenses/MIT\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ========================================================================\n */\n\n(function($, window) {\n var Tour, document;\n document = window.document;\n Tour = (function() {\n function Tour(options) {\n var storage;\n try {\n storage = window.localStorage;\n } catch (_error) {\n storage = false;\n }\n this._options = $.extend({\n name: 'tour',\n steps: [],\n container: 'body',\n autoscroll: true,\n keyboard: true,\n storage: storage,\n debug: false,\n backdrop: false,\n backdropContainer: 'body',\n backdropPadding: 0,\n redirect: true,\n orphan: false,\n duration: false,\n delay: false,\n basePath: '',\n template: '

                                                                ',\n afterSetState: function(key, value) {},\n afterGetState: function(key, value) {},\n afterRemoveState: function(key) {},\n onStart: function(tour) {},\n onEnd: function(tour) {},\n onShow: function(tour) {},\n onShown: function(tour) {},\n onHide: function(tour) {},\n onHidden: function(tour) {},\n onNext: function(tour) {},\n onPrev: function(tour) {},\n onPause: function(tour, duration) {},\n onResume: function(tour, duration) {},\n onRedirectError: function(tour) {}\n }, options);\n this._force = false;\n this._inited = false;\n this._current = null;\n this.backdrop = {\n overlay: null,\n $element: null,\n $background: null,\n backgroundShown: false,\n overlayElementShown: false\n };\n this;\n }\n\n Tour.prototype.addSteps = function(steps) {\n var step, _i, _len;\n for (_i = 0, _len = steps.length; _i < _len; _i++) {\n step = steps[_i];\n this.addStep(step);\n }\n return this;\n };\n\n Tour.prototype.addStep = function(step) {\n this._options.steps.push(step);\n return this;\n };\n\n Tour.prototype.getStep = function(i) {\n if (this._options.steps[i] != null) {\n return $.extend({\n id: \"step-\" + i,\n path: '',\n host: '',\n placement: 'right',\n title: '',\n content: '

                                                                ',\n next: i === this._options.steps.length - 1 ? -1 : i + 1,\n prev: i - 1,\n animation: true,\n container: this._options.container,\n autoscroll: this._options.autoscroll,\n backdrop: this._options.backdrop,\n backdropContainer: this._options.backdropContainer,\n backdropPadding: this._options.backdropPadding,\n redirect: this._options.redirect,\n reflexElement: this._options.steps[i].element,\n orphan: this._options.orphan,\n duration: this._options.duration,\n delay: this._options.delay,\n template: this._options.template,\n onShow: this._options.onShow,\n onShown: this._options.onShown,\n onHide: this._options.onHide,\n onHidden: this._options.onHidden,\n onNext: this._options.onNext,\n onPrev: this._options.onPrev,\n onPause: this._options.onPause,\n onResume: this._options.onResume,\n onRedirectError: this._options.onRedirectError\n }, this._options.steps[i]);\n }\n };\n\n Tour.prototype.init = function(force) {\n this._force = force;\n if (this.ended()) {\n this._debug('Tour ended, init prevented.');\n return this;\n }\n this.setCurrentStep();\n this._initMouseNavigation();\n this._initKeyboardNavigation();\n this._onResize((function(_this) {\n return function() {\n return _this.showStep(_this._current);\n };\n })(this));\n if (this._current !== null) {\n this.showStep(this._current);\n }\n this._inited = true;\n return this;\n };\n\n Tour.prototype.start = function(force) {\n var promise;\n if (force == null) {\n force = false;\n }\n if (!this._inited) {\n this.init(force);\n }\n if (this._current === null) {\n promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0);\n this._callOnPromiseDone(promise, this.showStep, 0);\n }\n return this;\n };\n\n Tour.prototype.next = function() {\n var promise;\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, this._showNextStep);\n };\n\n Tour.prototype.prev = function() {\n var promise;\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, this._showPrevStep);\n };\n\n Tour.prototype.goTo = function(i) {\n var promise;\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, this.showStep, i);\n };\n\n Tour.prototype.end = function() {\n var endHelper, promise;\n endHelper = (function(_this) {\n return function(e) {\n $(document).off(\"click.tour-\" + _this._options.name);\n $(document).off(\"keyup.tour-\" + _this._options.name);\n $(window).off(\"resize.tour-\" + _this._options.name);\n _this._setState('end', 'yes');\n _this._inited = false;\n _this._force = false;\n _this._clearTimer();\n if (_this._options.onEnd != null) {\n return _this._options.onEnd(_this);\n }\n };\n })(this);\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, endHelper);\n };\n\n Tour.prototype.ended = function() {\n return !this._force && !!this._getState('end');\n };\n\n Tour.prototype.restart = function() {\n this._removeState('current_step');\n this._removeState('end');\n this._removeState('redirect_to');\n return this.start();\n };\n\n Tour.prototype.pause = function() {\n var step;\n step = this.getStep(this._current);\n if (!(step && step.duration)) {\n return this;\n }\n this._paused = true;\n this._duration -= new Date().getTime() - this._start;\n window.clearTimeout(this._timer);\n this._debug(\"Paused/Stopped step \" + (this._current + 1) + \" timer (\" + this._duration + \" remaining).\");\n if (step.onPause != null) {\n return step.onPause(this, this._duration);\n }\n };\n\n Tour.prototype.resume = function() {\n var step;\n step = this.getStep(this._current);\n if (!(step && step.duration)) {\n return this;\n }\n this._paused = false;\n this._start = new Date().getTime();\n this._duration = this._duration || step.duration;\n this._timer = window.setTimeout((function(_this) {\n return function() {\n if (_this._isLast()) {\n return _this.next();\n } else {\n return _this.end();\n }\n };\n })(this), this._duration);\n this._debug(\"Started step \" + (this._current + 1) + \" timer with duration \" + this._duration);\n if ((step.onResume != null) && this._duration !== step.duration) {\n return step.onResume(this, this._duration);\n }\n };\n\n Tour.prototype.hideStep = function(i) {\n var hideStepHelper, promise, step;\n step = this.getStep(i);\n if (!step) {\n return;\n }\n this._clearTimer();\n promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0);\n hideStepHelper = (function(_this) {\n return function(e) {\n var $element;\n $element = $(step.element);\n if (!($element.data('bs.popover') || $element.data('popover'))) {\n $element = $('body');\n }\n $element.popover('destroy').removeClass(\"tour-\" + _this._options.name + \"-element tour-\" + _this._options.name + \"-\" + i + \"-element\");\n $element.removeData('bs.popover');\n if (step.reflex) {\n $(step.reflexElement).removeClass('tour-step-element-reflex').off(\"\" + (_this._reflexEvent(step.reflex)) + \".tour-\" + _this._options.name);\n }\n if (step.backdrop) {\n _this._hideBackdrop();\n }\n if (step.onHidden != null) {\n return step.onHidden(_this);\n }\n };\n })(this);\n this._callOnPromiseDone(promise, hideStepHelper);\n return promise;\n };\n\n Tour.prototype.showStep = function(i) {\n var promise, showStepHelper, skipToPrevious, step;\n if (this.ended()) {\n this._debug('Tour ended, showStep prevented.');\n return this;\n }\n step = this.getStep(i);\n if (!step) {\n return;\n }\n skipToPrevious = i < this._current;\n promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);\n showStepHelper = (function(_this) {\n return function(e) {\n var path, showPopoverAndOverlay;\n _this.setCurrentStep(i);\n path = (function() {\n switch ({}.toString.call(step.path)) {\n case '[object Function]':\n return step.path();\n case '[object String]':\n return this._options.basePath + step.path;\n default:\n return step.path;\n }\n }).call(_this);\n if (_this._isRedirect(step.host, path, document.location)) {\n _this._redirect(step, i, path);\n if (!_this._isJustPathHashDifferent(step.host, path, document.location)) {\n return;\n }\n }\n if (_this._isOrphan(step)) {\n if (step.orphan === false) {\n _this._debug(\"Skip the orphan step \" + (_this._current + 1) + \".\\nOrphan option is false and the element does not exist or is hidden.\");\n if (skipToPrevious) {\n _this._showPrevStep();\n } else {\n _this._showNextStep();\n }\n return;\n }\n _this._debug(\"Show the orphan step \" + (_this._current + 1) + \". Orphans option is true.\");\n }\n if (step.backdrop) {\n _this._showBackdrop(step);\n }\n showPopoverAndOverlay = function() {\n if (_this.getCurrentStep() !== i || _this.ended()) {\n return;\n }\n if ((step.element != null) && step.backdrop) {\n _this._showOverlayElement(step);\n }\n _this._showPopover(step, i);\n if (step.onShown != null) {\n step.onShown(_this);\n }\n return _this._debug(\"Step \" + (_this._current + 1) + \" of \" + _this._options.steps.length);\n };\n if (step.autoscroll) {\n _this._scrollIntoView(step.element, showPopoverAndOverlay);\n } else {\n showPopoverAndOverlay();\n }\n if (step.duration) {\n return _this.resume();\n }\n };\n })(this);\n if (step.delay) {\n this._debug(\"Wait \" + step.delay + \" milliseconds to show the step \" + (this._current + 1));\n window.setTimeout((function(_this) {\n return function() {\n return _this._callOnPromiseDone(promise, showStepHelper);\n };\n })(this), step.delay);\n } else {\n this._callOnPromiseDone(promise, showStepHelper);\n }\n return promise;\n };\n\n Tour.prototype.getCurrentStep = function() {\n return this._current;\n };\n\n Tour.prototype.setCurrentStep = function(value) {\n if (value != null) {\n this._current = value;\n this._setState('current_step', value);\n } else {\n this._current = this._getState('current_step');\n this._current = this._current === null ? null : parseInt(this._current, 10);\n }\n return this;\n };\n\n Tour.prototype.redraw = function() {\n return this._showOverlayElement(this.getStep(this.getCurrentStep()).element, true);\n };\n\n Tour.prototype._setState = function(key, value) {\n var e, keyName;\n if (this._options.storage) {\n keyName = \"\" + this._options.name + \"_\" + key;\n try {\n this._options.storage.setItem(keyName, value);\n } catch (_error) {\n e = _error;\n if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {\n this._debug('LocalStorage quota exceeded. State storage failed.');\n }\n }\n return this._options.afterSetState(keyName, value);\n } else {\n if (this._state == null) {\n this._state = {};\n }\n return this._state[key] = value;\n }\n };\n\n Tour.prototype._removeState = function(key) {\n var keyName;\n if (this._options.storage) {\n keyName = \"\" + this._options.name + \"_\" + key;\n this._options.storage.removeItem(keyName);\n return this._options.afterRemoveState(keyName);\n } else {\n if (this._state != null) {\n return delete this._state[key];\n }\n }\n };\n\n Tour.prototype._getState = function(key) {\n var keyName, value;\n if (this._options.storage) {\n keyName = \"\" + this._options.name + \"_\" + key;\n value = this._options.storage.getItem(keyName);\n } else {\n if (this._state != null) {\n value = this._state[key];\n }\n }\n if (value === void 0 || value === 'null') {\n value = null;\n }\n this._options.afterGetState(key, value);\n return value;\n };\n\n Tour.prototype._showNextStep = function() {\n var promise, showNextStepHelper, step;\n step = this.getStep(this._current);\n showNextStepHelper = (function(_this) {\n return function(e) {\n return _this.showStep(step.next);\n };\n })(this);\n promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0);\n return this._callOnPromiseDone(promise, showNextStepHelper);\n };\n\n Tour.prototype._showPrevStep = function() {\n var promise, showPrevStepHelper, step;\n step = this.getStep(this._current);\n showPrevStepHelper = (function(_this) {\n return function(e) {\n return _this.showStep(step.prev);\n };\n })(this);\n promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0);\n return this._callOnPromiseDone(promise, showPrevStepHelper);\n };\n\n Tour.prototype._debug = function(text) {\n if (this._options.debug) {\n return window.console.log(\"Bootstrap Tour '\" + this._options.name + \"' | \" + text);\n }\n };\n\n Tour.prototype._isRedirect = function(host, path, location) {\n var currentPath;\n if (host !== '') {\n if (this._isHostDifferent(host, location.href)) {\n return true;\n }\n }\n currentPath = [location.pathname, location.search, location.hash].join('');\n return (path != null) && path !== '' && (({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath)) || ({}.toString.call(path) === '[object String]' && this._isPathDifferent(path, currentPath)));\n };\n\n Tour.prototype._isHostDifferent = function(host, currentURL) {\n return this._getProtocol(host) !== this._getProtocol(currentURL) || this._getHost(host) !== this._getHost(currentURL);\n };\n\n Tour.prototype._isPathDifferent = function(path, currentPath) {\n return this._getPath(path) !== this._getPath(currentPath) || !this._equal(this._getQuery(path), this._getQuery(currentPath)) || !this._equal(this._getHash(path), this._getHash(currentPath));\n };\n\n Tour.prototype._isJustPathHashDifferent = function(host, path, location) {\n var currentPath;\n if (host !== '') {\n if (this._isHostDifferent(host, location.href)) {\n return false;\n }\n }\n currentPath = [location.pathname, location.search, location.hash].join('');\n if ({}.toString.call(path) === '[object String]') {\n return this._getPath(path) === this._getPath(currentPath) && this._equal(this._getQuery(path), this._getQuery(currentPath)) && !this._equal(this._getHash(path), this._getHash(currentPath));\n }\n return false;\n };\n\n Tour.prototype._redirect = function(step, i, path) {\n if ($.isFunction(step.redirect)) {\n return step.redirect.call(this, path);\n } else if (step.redirect === true) {\n this._debug(\"Redirect to \" + step.host + path);\n if (this._getState('redirect_to') === (\"\" + i)) {\n this._debug(\"Error redirection loop to \" + path);\n this._removeState('redirect_to');\n if (step.onRedirectError != null) {\n return step.onRedirectError(this);\n }\n } else {\n this._setState('redirect_to', \"\" + i);\n return document.location.href = \"\" + step.host + path;\n }\n }\n };\n\n Tour.prototype._isOrphan = function(step) {\n return (step.element == null) || !$(step.element).length || $(step.element).is(':hidden') && ($(step.element)[0].namespaceURI !== 'http://www.w3.org/2000/svg');\n };\n\n Tour.prototype._isLast = function() {\n return this._current < this._options.steps.length - 1;\n };\n\n Tour.prototype._showPopover = function(step, i) {\n var $element, $tip, isOrphan, options, shouldAddSmart;\n $(\".tour-\" + this._options.name).remove();\n options = $.extend({}, this._options);\n isOrphan = this._isOrphan(step);\n step.template = this._template(step, i);\n if (isOrphan) {\n step.element = 'body';\n step.placement = 'top';\n }\n $element = $(step.element);\n $element.addClass(\"tour-\" + this._options.name + \"-element tour-\" + this._options.name + \"-\" + i + \"-element\");\n if (step.options) {\n $.extend(options, step.options);\n }\n if (step.reflex && !isOrphan) {\n $(step.reflexElement).addClass('tour-step-element-reflex').off(\"\" + (this._reflexEvent(step.reflex)) + \".tour-\" + this._options.name).on(\"\" + (this._reflexEvent(step.reflex)) + \".tour-\" + this._options.name, (function(_this) {\n return function() {\n if (_this._isLast()) {\n return _this.next();\n } else {\n return _this.end();\n }\n };\n })(this));\n }\n shouldAddSmart = step.smartPlacement === true && step.placement.search(/auto/i) === -1;\n $element.popover({\n placement: shouldAddSmart ? \"auto \" + step.placement : step.placement,\n trigger: 'manual',\n title: step.title,\n content: step.content,\n html: true,\n animation: step.animation,\n container: step.container,\n template: step.template,\n selector: step.element\n }).popover('show');\n $tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();\n $tip.attr('id', step.id);\n this._reposition($tip, step);\n if (isOrphan) {\n return this._center($tip);\n }\n };\n\n Tour.prototype._template = function(step, i) {\n var $navigation, $next, $prev, $resume, $template, template;\n template = step.template;\n if (this._isOrphan(step) && {}.toString.call(step.orphan) !== '[object Boolean]') {\n template = step.orphan;\n }\n $template = $.isFunction(template) ? $(template(i, step)) : $(template);\n $navigation = $template.find('.popover-navigation');\n $prev = $navigation.find('[data-role=\"prev\"]');\n $next = $navigation.find('[data-role=\"next\"]');\n $resume = $navigation.find('[data-role=\"pause-resume\"]');\n if (this._isOrphan(step)) {\n $template.addClass('orphan');\n }\n $template.addClass(\"tour-\" + this._options.name + \" tour-\" + this._options.name + \"-\" + i);\n if (step.reflex) {\n $template.addClass(\"tour-\" + this._options.name + \"-reflex\");\n }\n if (step.prev < 0) {\n $prev.addClass('disabled');\n $prev.prop('disabled', true);\n }\n if (step.next < 0) {\n $next.addClass('disabled');\n $next.prop('disabled', true);\n }\n if (!step.duration) {\n $resume.remove();\n }\n return $template.clone().wrap('
                                                                ').parent().html();\n };\n\n Tour.prototype._reflexEvent = function(reflex) {\n if ({}.toString.call(reflex) === '[object Boolean]') {\n return 'click';\n } else {\n return reflex;\n }\n };\n\n Tour.prototype._reposition = function($tip, step) {\n var offsetBottom, offsetHeight, offsetRight, offsetWidth, originalLeft, originalTop, tipOffset;\n offsetWidth = $tip[0].offsetWidth;\n offsetHeight = $tip[0].offsetHeight;\n tipOffset = $tip.offset();\n originalLeft = tipOffset.left;\n originalTop = tipOffset.top;\n offsetBottom = $(document).outerHeight() - tipOffset.top - $tip.outerHeight();\n if (offsetBottom < 0) {\n tipOffset.top = tipOffset.top + offsetBottom;\n }\n offsetRight = $('html').outerWidth() - tipOffset.left - $tip.outerWidth();\n if (offsetRight < 0) {\n tipOffset.left = tipOffset.left + offsetRight;\n }\n if (tipOffset.top < 0) {\n tipOffset.top = 0;\n }\n if (tipOffset.left < 0) {\n tipOffset.left = 0;\n }\n $tip.offset(tipOffset);\n if (step.placement === 'bottom' || step.placement === 'top') {\n if (originalLeft !== tipOffset.left) {\n return this._replaceArrow($tip, (tipOffset.left - originalLeft) * 2, offsetWidth, 'left');\n }\n } else {\n if (originalTop !== tipOffset.top) {\n return this._replaceArrow($tip, (tipOffset.top - originalTop) * 2, offsetHeight, 'top');\n }\n }\n };\n\n Tour.prototype._center = function($tip) {\n return $tip.css('top', $(window).outerHeight() / 2 - $tip.outerHeight() / 2);\n };\n\n Tour.prototype._replaceArrow = function($tip, delta, dimension, position) {\n return $tip.find('.arrow').css(position, delta ? 50 * (1 - delta / dimension) + '%' : '');\n };\n\n Tour.prototype._scrollIntoView = function(element, callback) {\n var $element, $window, counter, offsetTop, scrollTop, windowHeight;\n $element = $(element);\n if (!$element.length) {\n return callback();\n }\n $window = $(window);\n offsetTop = $element.offset().top;\n windowHeight = $window.height();\n scrollTop = Math.max(0, offsetTop - (windowHeight / 2));\n this._debug(\"Scroll into view. ScrollTop: \" + scrollTop + \". Element offset: \" + offsetTop + \". Window height: \" + windowHeight + \".\");\n counter = 0;\n return $('body, html').stop(true, true).animate({\n scrollTop: Math.ceil(scrollTop)\n }, (function(_this) {\n return function() {\n if (++counter === 2) {\n callback();\n return _this._debug(\"Scroll into view.\\nAnimation end element offset: \" + ($element.offset().top) + \".\\nWindow height: \" + ($window.height()) + \".\");\n }\n };\n })(this));\n };\n\n Tour.prototype._onResize = function(callback, timeout) {\n return $(window).on(\"resize.tour-\" + this._options.name, function() {\n clearTimeout(timeout);\n return timeout = setTimeout(callback, 100);\n });\n };\n\n Tour.prototype._initMouseNavigation = function() {\n var _this;\n _this = this;\n return $(document).off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\").on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\", (function(_this) {\n return function(e) {\n e.preventDefault();\n return _this.next();\n };\n })(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\", (function(_this) {\n return function(e) {\n e.preventDefault();\n return _this.prev();\n };\n })(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\", (function(_this) {\n return function(e) {\n e.preventDefault();\n return _this.end();\n };\n })(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\", function(e) {\n var $this;\n e.preventDefault();\n $this = $(this);\n $this.text(_this._paused ? $this.data('pause-text') : $this.data('resume-text'));\n if (_this._paused) {\n return _this.resume();\n } else {\n return _this.pause();\n }\n });\n };\n\n Tour.prototype._initKeyboardNavigation = function() {\n if (!this._options.keyboard) {\n return;\n }\n return $(document).on(\"keyup.tour-\" + this._options.name, (function(_this) {\n return function(e) {\n if (!e.which) {\n return;\n }\n switch (e.which) {\n case 39:\n e.preventDefault();\n if (_this._isLast()) {\n return _this.next();\n } else {\n return _this.end();\n }\n break;\n case 37:\n e.preventDefault();\n if (_this._current > 0) {\n return _this.prev();\n }\n break;\n case 27:\n e.preventDefault();\n return _this.end();\n }\n };\n })(this));\n };\n\n Tour.prototype._makePromise = function(result) {\n if (result && $.isFunction(result.then)) {\n return result;\n } else {\n return null;\n }\n };\n\n Tour.prototype._callOnPromiseDone = function(promise, cb, arg) {\n if (promise) {\n return promise.then((function(_this) {\n return function(e) {\n return cb.call(_this, arg);\n };\n })(this));\n } else {\n return cb.call(this, arg);\n }\n };\n\n Tour.prototype._showBackdrop = function(step) {\n if (this.backdrop.backgroundShown) {\n return;\n }\n this.backdrop = $('
                                                                ', {\n \"class\": 'tour-backdrop'\n });\n this.backdrop.backgroundShown = true;\n return $(step.backdropContainer).append(this.backdrop);\n };\n\n Tour.prototype._hideBackdrop = function() {\n this._hideOverlayElement();\n return this._hideBackground();\n };\n\n Tour.prototype._hideBackground = function() {\n if (this.backdrop) {\n this.backdrop.remove();\n this.backdrop.overlay = null;\n return this.backdrop.backgroundShown = false;\n }\n };\n\n Tour.prototype._showOverlayElement = function(step, force) {\n var $element, elementData;\n $element = $(step.element);\n if (!$element || $element.length === 0 || this.backdrop.overlayElementShown && !force) {\n return;\n }\n if (!this.backdrop.overlayElementShown) {\n this.backdrop.$element = $element.addClass('tour-step-backdrop');\n this.backdrop.$background = $('
                                                                ', {\n \"class\": 'tour-step-background'\n });\n this.backdrop.$background.appendTo(step.backdropContainer);\n this.backdrop.overlayElementShown = true;\n }\n elementData = {\n width: $element.innerWidth(),\n height: $element.innerHeight(),\n offset: $element.offset()\n };\n if (step.backdropPadding) {\n elementData = this._applyBackdropPadding(step.backdropPadding, elementData);\n }\n return this.backdrop.$background.width(elementData.width).height(elementData.height).offset(elementData.offset);\n };\n\n Tour.prototype._hideOverlayElement = function() {\n if (!this.backdrop.overlayElementShown) {\n return;\n }\n this.backdrop.$element.removeClass('tour-step-backdrop');\n this.backdrop.$background.remove();\n this.backdrop.$element = null;\n this.backdrop.$background = null;\n return this.backdrop.overlayElementShown = false;\n };\n\n Tour.prototype._applyBackdropPadding = function(padding, data) {\n if (typeof padding === 'object') {\n if (padding.top == null) {\n padding.top = 0;\n }\n if (padding.right == null) {\n padding.right = 0;\n }\n if (padding.bottom == null) {\n padding.bottom = 0;\n }\n if (padding.left == null) {\n padding.left = 0;\n }\n data.offset.top = data.offset.top - padding.top;\n data.offset.left = data.offset.left - padding.left;\n data.width = data.width + padding.left + padding.right;\n data.height = data.height + padding.top + padding.bottom;\n } else {\n data.offset.top = data.offset.top - padding;\n data.offset.left = data.offset.left - padding;\n data.width = data.width + (padding * 2);\n data.height = data.height + (padding * 2);\n }\n return data;\n };\n\n Tour.prototype._clearTimer = function() {\n window.clearTimeout(this._timer);\n this._timer = null;\n return this._duration = null;\n };\n\n Tour.prototype._getProtocol = function(url) {\n url = url.split('://');\n if (url.length > 1) {\n return url[0];\n } else {\n return 'http';\n }\n };\n\n Tour.prototype._getHost = function(url) {\n url = url.split('//');\n url = url.length > 1 ? url[1] : url[0];\n return url.split('/')[0];\n };\n\n Tour.prototype._getPath = function(path) {\n return path.replace(/\\/?$/, '').split('?')[0].split('#')[0];\n };\n\n Tour.prototype._getQuery = function(path) {\n return this._getParams(path, '?');\n };\n\n Tour.prototype._getHash = function(path) {\n return this._getParams(path, '#');\n };\n\n Tour.prototype._getParams = function(path, start) {\n var param, params, paramsObject, _i, _len;\n params = path.split(start);\n if (params.length === 1) {\n return {};\n }\n params = params[1].split('&');\n paramsObject = {};\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n param = params[_i];\n param = param.split('=');\n paramsObject[param[0]] = param[1] || '';\n }\n return paramsObject;\n };\n\n Tour.prototype._equal = function(obj1, obj2) {\n var k, v;\n if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') {\n for (k in obj1) {\n v = obj1[k];\n if (obj2[k] !== v) {\n return false;\n }\n }\n for (k in obj2) {\n v = obj2[k];\n if (obj1[k] !== v) {\n return false;\n }\n }\n return true;\n }\n return obj1 === obj2;\n };\n\n return Tour;\n\n })();\n return window.Tour = Tour;\n})(jQuery, window);\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/libs/bootstrap-tour.js","/*! jQuery UI - v1.9.1 - 2012-10-29\n* http://jqueryui.com\n* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.menu.js, jquery.ui.slider.js\n* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */\n\n(function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return\"area\"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!==\"map\"?!1:(o=e(\"img[usemap=#\"+i+\"]\")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:\"a\"===u?t.href||n:n)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().andSelf().filter(function(){return e.css(this,\"visibility\")===\"hidden\"}).length}var n=0,r=/^ui-id-\\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:\"1.9.1\",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t==\"number\"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.ui.ie&&/(static|relative)/.test(this.css(\"position\"))||/absolute/.test(this.css(\"position\"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,\"position\"))&&/(auto|scroll)/.test(e.css(this,\"overflow\")+e.css(this,\"overflow-y\")+e.css(this,\"overflow-x\"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,\"overflow\")+e.css(this,\"overflow-y\")+e.css(this,\"overflow-x\"))}).eq(0),/fixed/.test(this.css(\"position\"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css(\"zIndex\",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css(\"position\");if(i===\"absolute\"||i===\"relative\"||i===\"fixed\"){s=parseInt(r.css(\"zIndex\"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id=\"ui-id-\"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr(\"id\")})}}),e(\"\").outerWidth(1).jquery||e.each([\"Width\",\"Height\"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,\"padding\"+this))||0,r&&(n-=parseFloat(e.css(t,\"border\"+this+\"Width\"))||0),s&&(n-=parseFloat(e.css(t,\"margin\"+this))||0)}),n}var i=r===\"Width\"?[\"Left\",\"Right\"]:[\"Top\",\"Bottom\"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn[\"inner\"+r]=function(n){return n===t?o[\"inner\"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+\"px\")})},e.fn[\"outer\"+r]=function(t,n){return typeof t!=\"number\"?o[\"outer\"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+\"px\")})}}),e.extend(e.expr[\":\"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,\"tabindex\")))},tabbable:function(t){var n=e.attr(t,\"tabindex\"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement(\"div\"));n.offsetHeight,e.extend(n.style,{minHeight:\"100px\",height:\"auto\",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart=\"onselectstart\"in n,t.removeChild(n).style.display=\"none\"}),function(){var t=/msie ([\\w.]+)/.exec(navigator.userAgent.toLowerCase())||[];e.ui.ie=t.length?!0:!1,e.ui.ie6=parseFloat(t[1],10)===6}(),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?\"selectstart\":\"mousedown\")+\".ui-disableSelection\",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(\".ui-disableSelection\")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e\",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace=\".\"+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetName,this),e.data(r,this.widgetFullName,this),this._on(this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger(\"create\",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr(\"aria-disabled\").removeClass(this.widgetFullName+\"-disabled \"+\"ui-state-disabled\"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass(\"ui-state-hover\"),this.focusable.removeClass(\"ui-state-focus\")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof n==\"string\"){i={},s=n.split(\".\"),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind(\"mousemove.\"+this.widgetName,this._mouseMoveDelegate).unbind(\"mouseup.\"+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+\".preventClickEvent\",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})})(jQuery);(function(e,t){function h(e,t,n){return[parseInt(e[0],10)*(l.test(e[0])?t/100:1),parseInt(e[1],10)*(l.test(e[1])?n/100:1)]}function p(t,n){return parseInt(e.css(t,n),10)||0}e.ui=e.ui||{};var n,r=Math.max,i=Math.abs,s=Math.round,o=/left|center|right/,u=/top|center|bottom/,a=/[\\+\\-]\\d+%?/,f=/^\\w+/,l=/%$/,c=e.fn.position;e.position={scrollbarWidth:function(){if(n!==t)return n;var r,i,s=e(\"
                                                                \"),o=s.children()[0];return e(\"body\").append(s),r=o.offsetWidth,s.css(\"overflow\",\"scroll\"),i=o.offsetWidth,r===i&&(i=s[0].clientWidth),s.remove(),n=r-i},getScrollInfo:function(t){var n=t.isWindow?\"\":t.element.css(\"overflow-x\"),r=t.isWindow?\"\":t.element.css(\"overflow-y\"),i=n===\"scroll\"||n===\"auto\"&&t.width0?\"right\":\"center\",vertical:u<0?\"top\":o>0?\"bottom\":\"middle\"};lr(i(o),i(u))?h.important=\"horizontal\":h.important=\"vertical\",t.using.call(this,e,h)}),a.offset(e.extend(C,{using:u}))})},e.ui.position={fit:{left:function(e,t){var n=t.within,i=n.isWindow?n.scrollLeft:n.offset.left,s=n.width,o=e.left-t.collisionPosition.marginLeft,u=i-o,a=o+t.collisionWidth-s-i,f;t.collisionWidth>s?u>0&&a<=0?(f=e.left+u+t.collisionWidth-s-i,e.left+=u-f):a>0&&u<=0?e.left=i:u>a?e.left=i+s-t.collisionWidth:e.left=i:u>0?e.left+=u:a>0?e.left-=a:e.left=r(e.left-o,e.left)},top:function(e,t){var n=t.within,i=n.isWindow?n.scrollTop:n.offset.top,s=t.within.height,o=e.top-t.collisionPosition.marginTop,u=i-o,a=o+t.collisionHeight-s-i,f;t.collisionHeight>s?u>0&&a<=0?(f=e.top+u+t.collisionHeight-s-i,e.top+=u-f):a>0&&u<=0?e.top=i:u>a?e.top=i+s-t.collisionHeight:e.top=i:u>0?e.top+=u:a>0?e.top-=a:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var n=t.within,r=n.offset.left+n.scrollLeft,s=n.width,o=n.isWindow?n.scrollLeft:n.offset.left,u=e.left-t.collisionPosition.marginLeft,a=u-o,f=u+t.collisionWidth-s-o,l=t.my[0]===\"left\"?-t.elemWidth:t.my[0]===\"right\"?t.elemWidth:0,c=t.at[0]===\"left\"?t.targetWidth:t.at[0]===\"right\"?-t.targetWidth:0,h=-2*t.offset[0],p,d;if(a<0){p=e.left+l+c+h+t.collisionWidth-s-r;if(p<0||p0){d=e.left-t.collisionPosition.marginLeft+l+c+h-o;if(d>0||i(d)a&&(v<0||v0&&(d=e.top-t.collisionPosition.marginTop+c+h+p-o,e.top+c+h+p>f&&(d>0||i(d)10&&i<11,t.innerHTML=\"\",n.removeChild(t)}(),e.uiBackCompat!==!1&&function(e){var n=e.fn.position;e.fn.position=function(r){if(!r||!r.offset)return n.call(this,r);var i=r.offset.split(\" \"),s=r.at.split(\" \");return i.length===1&&(i[1]=i[0]),/^\\d/.test(i[0])&&(i[0]=\"+\"+i[0]),/^\\d/.test(i[1])&&(i[1]=\"+\"+i[1]),s.length===1&&(/left|center|right/.test(s[0])?s[1]=\"center\":(s[1]=s[0],s[0]=\"center\")),n.call(this,e.extend(r,{at:s[0]+i[0]+\" \"+s[1]+i[1],offset:t}))}}(jQuery)})(jQuery);(function(e,t){var n=0;e.widget(\"ui.autocomplete\",{version:\"1.9.1\",defaultElement:\"\",options:{appendTo:\"body\",autoFocus:!1,delay:300,minLength:1,position:{my:\"left top\",at:\"left bottom\",collision:\"none\"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,n,r;this.isMultiLine=this._isMultiLine(),this.valueMethod=this.element[this.element.is(\"input,textarea\")?\"val\":\"text\"],this.isNewMenu=!0,this.element.addClass(\"ui-autocomplete-input\").attr(\"autocomplete\",\"off\"),this._on(this.element,{keydown:function(i){if(this.element.prop(\"readOnly\")){t=!0,r=!0,n=!0;return}t=!1,r=!1,n=!1;var s=e.ui.keyCode;switch(i.keyCode){case s.PAGE_UP:t=!0,this._move(\"previousPage\",i);break;case s.PAGE_DOWN:t=!0,this._move(\"nextPage\",i);break;case s.UP:t=!0,this._keyEvent(\"previous\",i);break;case s.DOWN:t=!0,this._keyEvent(\"next\",i);break;case s.ENTER:case s.NUMPAD_ENTER:this.menu.active&&(t=!0,i.preventDefault(),this.menu.select(i));break;case s.TAB:this.menu.active&&this.menu.select(i);break;case s.ESCAPE:this.menu.element.is(\":visible\")&&(this._value(this.term),this.close(i),i.preventDefault());break;default:n=!0,this._searchTimeout(i)}},keypress:function(r){if(t){t=!1,r.preventDefault();return}if(n)return;var i=e.ui.keyCode;switch(r.keyCode){case i.PAGE_UP:this._move(\"previousPage\",r);break;case i.PAGE_DOWN:this._move(\"nextPage\",r);break;case i.UP:this._keyEvent(\"previous\",r);break;case i.DOWN:this._keyEvent(\"next\",r)}},input:function(e){if(r){r=!1,e.preventDefault();return}this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){if(this.cancelBlur){delete this.cancelBlur;return}clearTimeout(this.searching),this.close(e),this._change(e)}}),this._initSource(),this.menu=e(\"
                                                                  \").addClass(\"ui-autocomplete\").appendTo(this.document.find(this.options.appendTo||\"body\")[0]).menu({input:e(),role:null}).zIndex(this.element.zIndex()+1).hide().data(\"menu\"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var n=this.menu.element[0];e(t.target).closest(\".ui-menu-item\").length||this._delay(function(){var t=this;this.document.one(\"mousedown\",function(r){r.target!==t.element[0]&&r.target!==n&&!e.contains(n,r.target)&&t.close()})})},menufocus:function(t,n){if(this.isNewMenu){this.isNewMenu=!1;if(t.originalEvent&&/^mouse/.test(t.originalEvent.type)){this.menu.blur(),this.document.one(\"mousemove\",function(){e(t.target).trigger(t.originalEvent)});return}}var r=n.item.data(\"ui-autocomplete-item\")||n.item.data(\"item.autocomplete\");!1!==this._trigger(\"focus\",t,{item:r})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(r.value):this.liveRegion.text(r.value)},menuselect:function(e,t){var n=t.item.data(\"ui-autocomplete-item\")||t.item.data(\"item.autocomplete\"),r=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r,this.selectedItem=n})),!1!==this._trigger(\"select\",e,{item:n})&&this._value(n.value),this.term=this._value(),this.close(e),this.selectedItem=n}}),this.liveRegion=e(\"\",{role:\"status\",\"aria-live\":\"polite\"}).addClass(\"ui-helper-hidden-accessible\").insertAfter(this.element),e.fn.bgiframe&&this.menu.element.bgiframe(),this._on(this.window,{beforeunload:function(){this.element.removeAttr(\"autocomplete\")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass(\"ui-autocomplete-input\").removeAttr(\"autocomplete\"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),e===\"source\"&&this._initSource(),e===\"appendTo\"&&this.menu.element.appendTo(this.document.find(t||\"body\")[0]),e===\"disabled\"&&t&&this.xhr&&this.xhr.abort()},_isMultiLine:function(){return this.element.is(\"textarea\")?!0:this.element.is(\"input\")?!1:this.element.prop(\"isContentEditable\")},_initSource:function(){var t,n,r=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(n,r){r(e.ui.autocomplete.filter(t,n.term))}):typeof this.options.source==\"string\"?(n=this.options.source,this.source=function(t,i){r.xhr&&r.xhr.abort(),r.xhr=e.ajax({url:n,data:t,dataType:\"json\",success:function(e){i(e)},error:function(){i([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){e=e!=null?e:this._value(),this.term=this._value();if(e.length\").append(e(\"\").text(n.label)).appendTo(t)},_move:function(e,t){if(!this.menu.element.is(\":visible\")){this.search(null,t);return}if(this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)){this._value(this.term),this.menu.blur();return}this.menu[e](t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){if(!this.isMultiLine||this.menu.element.is(\":visible\"))this._move(e,t),t.preventDefault()}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g,\"\\\\$&\")},filter:function(t,n){var r=new RegExp(e.ui.autocomplete.escapeRegex(n),\"i\");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}}),e.widget(\"ui.autocomplete\",e.ui.autocomplete,{options:{messages:{noResults:\"No search results.\",results:function(e){return e+(e>1?\" results are\":\" result is\")+\" available, use up and down arrow keys to navigate.\"}}},__response:function(e){var t;this._superApply(arguments);if(this.options.disabled||this.cancelSearch)return;e&&e.length?t=this.options.messages.results(e.length):t=this.options.messages.noResults,this.liveRegion.text(t)}})})(jQuery);(function(e,t){var n,r,i,s,o=\"ui-button ui-widget ui-state-default ui-corner-all\",u=\"ui-state-hover ui-state-active \",a=\"ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only\",f=function(){var t=e(this).find(\":ui-button\");setTimeout(function(){t.button(\"refresh\")},1)},l=function(t){var n=t.name,r=t.form,i=e([]);return n&&(r?i=e(r).find(\"[name='\"+n+\"']\"):i=e(\"[name='\"+n+\"']\",t.ownerDocument).filter(function(){return!this.form})),i};e.widget(\"ui.button\",{version:\"1.9.1\",defaultElement:\"
                                                                \")\n\t });\n\t modal.show({ backdrop: true });\n\t }\n\t\n\t // ============================================================================\n\t return {\n\t Modal: Modal,\n\t hide_modal: hide_modal,\n\t show_modal: show_modal,\n\t show_message: show_message,\n\t show_in_overlay: show_in_overlay\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ },\n/* 74 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(jQuery) {/* ========================================================================\n\t * bootstrap-tour - v0.10.2\n\t * http://bootstraptour.com\n\t * ========================================================================\n\t * Copyright 2012-2015 Ulrich Sossou\n\t *\n\t * ========================================================================\n\t * Licensed under the MIT License (the \"License\");\n\t * you may not use this file except in compliance with the License.\n\t * You may obtain a copy of the License at\n\t *\n\t * https://opensource.org/licenses/MIT\n\t *\n\t * Unless required by applicable law or agreed to in writing, software\n\t * distributed under the License is distributed on an \"AS IS\" BASIS,\n\t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\t * See the License for the specific language governing permissions and\n\t * limitations under the License.\n\t * ========================================================================\n\t */\n\t\n\t(function ($, window) {\n\t var Tour, document;\n\t document = window.document;\n\t Tour = function () {\n\t function Tour(options) {\n\t var storage;\n\t try {\n\t storage = window.localStorage;\n\t } catch (_error) {\n\t storage = false;\n\t }\n\t this._options = $.extend({\n\t name: 'tour',\n\t steps: [],\n\t container: 'body',\n\t autoscroll: true,\n\t keyboard: true,\n\t storage: storage,\n\t debug: false,\n\t backdrop: false,\n\t backdropContainer: 'body',\n\t backdropPadding: 0,\n\t redirect: true,\n\t orphan: false,\n\t duration: false,\n\t delay: false,\n\t basePath: '',\n\t template: '

                                                                ',\n\t afterSetState: function (key, value) {},\n\t afterGetState: function (key, value) {},\n\t afterRemoveState: function (key) {},\n\t onStart: function (tour) {},\n\t onEnd: function (tour) {},\n\t onShow: function (tour) {},\n\t onShown: function (tour) {},\n\t onHide: function (tour) {},\n\t onHidden: function (tour) {},\n\t onNext: function (tour) {},\n\t onPrev: function (tour) {},\n\t onPause: function (tour, duration) {},\n\t onResume: function (tour, duration) {},\n\t onRedirectError: function (tour) {}\n\t }, options);\n\t this._force = false;\n\t this._inited = false;\n\t this._current = null;\n\t this.backdrop = {\n\t overlay: null,\n\t $element: null,\n\t $background: null,\n\t backgroundShown: false,\n\t overlayElementShown: false\n\t };\n\t this;\n\t }\n\t\n\t Tour.prototype.addSteps = function (steps) {\n\t var step, _i, _len;\n\t for (_i = 0, _len = steps.length; _i < _len; _i++) {\n\t step = steps[_i];\n\t this.addStep(step);\n\t }\n\t return this;\n\t };\n\t\n\t Tour.prototype.addStep = function (step) {\n\t this._options.steps.push(step);\n\t return this;\n\t };\n\t\n\t Tour.prototype.getStep = function (i) {\n\t if (this._options.steps[i] != null) {\n\t return $.extend({\n\t id: \"step-\" + i,\n\t path: '',\n\t host: '',\n\t placement: 'right',\n\t title: '',\n\t content: '

                                                                ',\n\t next: i === this._options.steps.length - 1 ? -1 : i + 1,\n\t prev: i - 1,\n\t animation: true,\n\t container: this._options.container,\n\t autoscroll: this._options.autoscroll,\n\t backdrop: this._options.backdrop,\n\t backdropContainer: this._options.backdropContainer,\n\t backdropPadding: this._options.backdropPadding,\n\t redirect: this._options.redirect,\n\t reflexElement: this._options.steps[i].element,\n\t orphan: this._options.orphan,\n\t duration: this._options.duration,\n\t delay: this._options.delay,\n\t template: this._options.template,\n\t onShow: this._options.onShow,\n\t onShown: this._options.onShown,\n\t onHide: this._options.onHide,\n\t onHidden: this._options.onHidden,\n\t onNext: this._options.onNext,\n\t onPrev: this._options.onPrev,\n\t onPause: this._options.onPause,\n\t onResume: this._options.onResume,\n\t onRedirectError: this._options.onRedirectError\n\t }, this._options.steps[i]);\n\t }\n\t };\n\t\n\t Tour.prototype.init = function (force) {\n\t this._force = force;\n\t if (this.ended()) {\n\t this._debug('Tour ended, init prevented.');\n\t return this;\n\t }\n\t this.setCurrentStep();\n\t this._initMouseNavigation();\n\t this._initKeyboardNavigation();\n\t this._onResize(function (_this) {\n\t return function () {\n\t return _this.showStep(_this._current);\n\t };\n\t }(this));\n\t if (this._current !== null) {\n\t this.showStep(this._current);\n\t }\n\t this._inited = true;\n\t return this;\n\t };\n\t\n\t Tour.prototype.start = function (force) {\n\t var promise;\n\t if (force == null) {\n\t force = false;\n\t }\n\t if (!this._inited) {\n\t this.init(force);\n\t }\n\t if (this._current === null) {\n\t promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0);\n\t this._callOnPromiseDone(promise, this.showStep, 0);\n\t }\n\t return this;\n\t };\n\t\n\t Tour.prototype.next = function () {\n\t var promise;\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, this._showNextStep);\n\t };\n\t\n\t Tour.prototype.prev = function () {\n\t var promise;\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, this._showPrevStep);\n\t };\n\t\n\t Tour.prototype.goTo = function (i) {\n\t var promise;\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, this.showStep, i);\n\t };\n\t\n\t Tour.prototype.end = function () {\n\t var endHelper, promise;\n\t endHelper = function (_this) {\n\t return function (e) {\n\t $(document).off(\"click.tour-\" + _this._options.name);\n\t $(document).off(\"keyup.tour-\" + _this._options.name);\n\t $(window).off(\"resize.tour-\" + _this._options.name);\n\t _this._setState('end', 'yes');\n\t _this._inited = false;\n\t _this._force = false;\n\t _this._clearTimer();\n\t if (_this._options.onEnd != null) {\n\t return _this._options.onEnd(_this);\n\t }\n\t };\n\t }(this);\n\t promise = this.hideStep(this._current);\n\t return this._callOnPromiseDone(promise, endHelper);\n\t };\n\t\n\t Tour.prototype.ended = function () {\n\t return !this._force && !!this._getState('end');\n\t };\n\t\n\t Tour.prototype.restart = function () {\n\t this._removeState('current_step');\n\t this._removeState('end');\n\t this._removeState('redirect_to');\n\t return this.start();\n\t };\n\t\n\t Tour.prototype.pause = function () {\n\t var step;\n\t step = this.getStep(this._current);\n\t if (!(step && step.duration)) {\n\t return this;\n\t }\n\t this._paused = true;\n\t this._duration -= new Date().getTime() - this._start;\n\t window.clearTimeout(this._timer);\n\t this._debug(\"Paused/Stopped step \" + (this._current + 1) + \" timer (\" + this._duration + \" remaining).\");\n\t if (step.onPause != null) {\n\t return step.onPause(this, this._duration);\n\t }\n\t };\n\t\n\t Tour.prototype.resume = function () {\n\t var step;\n\t step = this.getStep(this._current);\n\t if (!(step && step.duration)) {\n\t return this;\n\t }\n\t this._paused = false;\n\t this._start = new Date().getTime();\n\t this._duration = this._duration || step.duration;\n\t this._timer = window.setTimeout(function (_this) {\n\t return function () {\n\t if (_this._isLast()) {\n\t return _this.next();\n\t } else {\n\t return _this.end();\n\t }\n\t };\n\t }(this), this._duration);\n\t this._debug(\"Started step \" + (this._current + 1) + \" timer with duration \" + this._duration);\n\t if (step.onResume != null && this._duration !== step.duration) {\n\t return step.onResume(this, this._duration);\n\t }\n\t };\n\t\n\t Tour.prototype.hideStep = function (i) {\n\t var hideStepHelper, promise, step;\n\t step = this.getStep(i);\n\t if (!step) {\n\t return;\n\t }\n\t this._clearTimer();\n\t promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0);\n\t hideStepHelper = function (_this) {\n\t return function (e) {\n\t var $element;\n\t $element = $(step.element);\n\t if (!($element.data('bs.popover') || $element.data('popover'))) {\n\t $element = $('body');\n\t }\n\t $element.popover('destroy').removeClass(\"tour-\" + _this._options.name + \"-element tour-\" + _this._options.name + \"-\" + i + \"-element\");\n\t $element.removeData('bs.popover');\n\t if (step.reflex) {\n\t $(step.reflexElement).removeClass('tour-step-element-reflex').off(\"\" + _this._reflexEvent(step.reflex) + \".tour-\" + _this._options.name);\n\t }\n\t if (step.backdrop) {\n\t _this._hideBackdrop();\n\t }\n\t if (step.onHidden != null) {\n\t return step.onHidden(_this);\n\t }\n\t };\n\t }(this);\n\t this._callOnPromiseDone(promise, hideStepHelper);\n\t return promise;\n\t };\n\t\n\t Tour.prototype.showStep = function (i) {\n\t var promise, showStepHelper, skipToPrevious, step;\n\t if (this.ended()) {\n\t this._debug('Tour ended, showStep prevented.');\n\t return this;\n\t }\n\t step = this.getStep(i);\n\t if (!step) {\n\t return;\n\t }\n\t skipToPrevious = i < this._current;\n\t promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);\n\t showStepHelper = function (_this) {\n\t return function (e) {\n\t var path, showPopoverAndOverlay;\n\t _this.setCurrentStep(i);\n\t path = function () {\n\t switch ({}.toString.call(step.path)) {\n\t case '[object Function]':\n\t return step.path();\n\t case '[object String]':\n\t return this._options.basePath + step.path;\n\t default:\n\t return step.path;\n\t }\n\t }.call(_this);\n\t if (_this._isRedirect(step.host, path, document.location)) {\n\t _this._redirect(step, i, path);\n\t if (!_this._isJustPathHashDifferent(step.host, path, document.location)) {\n\t return;\n\t }\n\t }\n\t if (_this._isOrphan(step)) {\n\t if (step.orphan === false) {\n\t _this._debug(\"Skip the orphan step \" + (_this._current + 1) + \".\\nOrphan option is false and the element does not exist or is hidden.\");\n\t if (skipToPrevious) {\n\t _this._showPrevStep();\n\t } else {\n\t _this._showNextStep();\n\t }\n\t return;\n\t }\n\t _this._debug(\"Show the orphan step \" + (_this._current + 1) + \". Orphans option is true.\");\n\t }\n\t if (step.backdrop) {\n\t _this._showBackdrop(step);\n\t }\n\t showPopoverAndOverlay = function () {\n\t if (_this.getCurrentStep() !== i || _this.ended()) {\n\t return;\n\t }\n\t if (step.element != null && step.backdrop) {\n\t _this._showOverlayElement(step);\n\t }\n\t _this._showPopover(step, i);\n\t if (step.onShown != null) {\n\t step.onShown(_this);\n\t }\n\t return _this._debug(\"Step \" + (_this._current + 1) + \" of \" + _this._options.steps.length);\n\t };\n\t if (step.autoscroll) {\n\t _this._scrollIntoView(step.element, showPopoverAndOverlay);\n\t } else {\n\t showPopoverAndOverlay();\n\t }\n\t if (step.duration) {\n\t return _this.resume();\n\t }\n\t };\n\t }(this);\n\t if (step.delay) {\n\t this._debug(\"Wait \" + step.delay + \" milliseconds to show the step \" + (this._current + 1));\n\t window.setTimeout(function (_this) {\n\t return function () {\n\t return _this._callOnPromiseDone(promise, showStepHelper);\n\t };\n\t }(this), step.delay);\n\t } else {\n\t this._callOnPromiseDone(promise, showStepHelper);\n\t }\n\t return promise;\n\t };\n\t\n\t Tour.prototype.getCurrentStep = function () {\n\t return this._current;\n\t };\n\t\n\t Tour.prototype.setCurrentStep = function (value) {\n\t if (value != null) {\n\t this._current = value;\n\t this._setState('current_step', value);\n\t } else {\n\t this._current = this._getState('current_step');\n\t this._current = this._current === null ? null : parseInt(this._current, 10);\n\t }\n\t return this;\n\t };\n\t\n\t Tour.prototype.redraw = function () {\n\t return this._showOverlayElement(this.getStep(this.getCurrentStep()).element, true);\n\t };\n\t\n\t Tour.prototype._setState = function (key, value) {\n\t var e, keyName;\n\t if (this._options.storage) {\n\t keyName = \"\" + this._options.name + \"_\" + key;\n\t try {\n\t this._options.storage.setItem(keyName, value);\n\t } catch (_error) {\n\t e = _error;\n\t if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {\n\t this._debug('LocalStorage quota exceeded. State storage failed.');\n\t }\n\t }\n\t return this._options.afterSetState(keyName, value);\n\t } else {\n\t if (this._state == null) {\n\t this._state = {};\n\t }\n\t return this._state[key] = value;\n\t }\n\t };\n\t\n\t Tour.prototype._removeState = function (key) {\n\t var keyName;\n\t if (this._options.storage) {\n\t keyName = \"\" + this._options.name + \"_\" + key;\n\t this._options.storage.removeItem(keyName);\n\t return this._options.afterRemoveState(keyName);\n\t } else {\n\t if (this._state != null) {\n\t return delete this._state[key];\n\t }\n\t }\n\t };\n\t\n\t Tour.prototype._getState = function (key) {\n\t var keyName, value;\n\t if (this._options.storage) {\n\t keyName = \"\" + this._options.name + \"_\" + key;\n\t value = this._options.storage.getItem(keyName);\n\t } else {\n\t if (this._state != null) {\n\t value = this._state[key];\n\t }\n\t }\n\t if (value === void 0 || value === 'null') {\n\t value = null;\n\t }\n\t this._options.afterGetState(key, value);\n\t return value;\n\t };\n\t\n\t Tour.prototype._showNextStep = function () {\n\t var promise, showNextStepHelper, step;\n\t step = this.getStep(this._current);\n\t showNextStepHelper = function (_this) {\n\t return function (e) {\n\t return _this.showStep(step.next);\n\t };\n\t }(this);\n\t promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0);\n\t return this._callOnPromiseDone(promise, showNextStepHelper);\n\t };\n\t\n\t Tour.prototype._showPrevStep = function () {\n\t var promise, showPrevStepHelper, step;\n\t step = this.getStep(this._current);\n\t showPrevStepHelper = function (_this) {\n\t return function (e) {\n\t return _this.showStep(step.prev);\n\t };\n\t }(this);\n\t promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0);\n\t return this._callOnPromiseDone(promise, showPrevStepHelper);\n\t };\n\t\n\t Tour.prototype._debug = function (text) {\n\t if (this._options.debug) {\n\t return window.console.log(\"Bootstrap Tour '\" + this._options.name + \"' | \" + text);\n\t }\n\t };\n\t\n\t Tour.prototype._isRedirect = function (host, path, location) {\n\t var currentPath;\n\t if (host !== '') {\n\t if (this._isHostDifferent(host, location.href)) {\n\t return true;\n\t }\n\t }\n\t currentPath = [location.pathname, location.search, location.hash].join('');\n\t return path != null && path !== '' && ({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath) || {}.toString.call(path) === '[object String]' && this._isPathDifferent(path, currentPath));\n\t };\n\t\n\t Tour.prototype._isHostDifferent = function (host, currentURL) {\n\t return this._getProtocol(host) !== this._getProtocol(currentURL) || this._getHost(host) !== this._getHost(currentURL);\n\t };\n\t\n\t Tour.prototype._isPathDifferent = function (path, currentPath) {\n\t return this._getPath(path) !== this._getPath(currentPath) || !this._equal(this._getQuery(path), this._getQuery(currentPath)) || !this._equal(this._getHash(path), this._getHash(currentPath));\n\t };\n\t\n\t Tour.prototype._isJustPathHashDifferent = function (host, path, location) {\n\t var currentPath;\n\t if (host !== '') {\n\t if (this._isHostDifferent(host, location.href)) {\n\t return false;\n\t }\n\t }\n\t currentPath = [location.pathname, location.search, location.hash].join('');\n\t if ({}.toString.call(path) === '[object String]') {\n\t return this._getPath(path) === this._getPath(currentPath) && this._equal(this._getQuery(path), this._getQuery(currentPath)) && !this._equal(this._getHash(path), this._getHash(currentPath));\n\t }\n\t return false;\n\t };\n\t\n\t Tour.prototype._redirect = function (step, i, path) {\n\t if ($.isFunction(step.redirect)) {\n\t return step.redirect.call(this, path);\n\t } else if (step.redirect === true) {\n\t this._debug(\"Redirect to \" + step.host + path);\n\t if (this._getState('redirect_to') === \"\" + i) {\n\t this._debug(\"Error redirection loop to \" + path);\n\t this._removeState('redirect_to');\n\t if (step.onRedirectError != null) {\n\t return step.onRedirectError(this);\n\t }\n\t } else {\n\t this._setState('redirect_to', \"\" + i);\n\t return document.location.href = \"\" + step.host + path;\n\t }\n\t }\n\t };\n\t\n\t Tour.prototype._isOrphan = function (step) {\n\t return step.element == null || !$(step.element).length || $(step.element).is(':hidden') && $(step.element)[0].namespaceURI !== 'http://www.w3.org/2000/svg';\n\t };\n\t\n\t Tour.prototype._isLast = function () {\n\t return this._current < this._options.steps.length - 1;\n\t };\n\t\n\t Tour.prototype._showPopover = function (step, i) {\n\t var $element, $tip, isOrphan, options, shouldAddSmart;\n\t $(\".tour-\" + this._options.name).remove();\n\t options = $.extend({}, this._options);\n\t isOrphan = this._isOrphan(step);\n\t step.template = this._template(step, i);\n\t if (isOrphan) {\n\t step.element = 'body';\n\t step.placement = 'top';\n\t }\n\t $element = $(step.element);\n\t $element.addClass(\"tour-\" + this._options.name + \"-element tour-\" + this._options.name + \"-\" + i + \"-element\");\n\t if (step.options) {\n\t $.extend(options, step.options);\n\t }\n\t if (step.reflex && !isOrphan) {\n\t $(step.reflexElement).addClass('tour-step-element-reflex').off(\"\" + this._reflexEvent(step.reflex) + \".tour-\" + this._options.name).on(\"\" + this._reflexEvent(step.reflex) + \".tour-\" + this._options.name, function (_this) {\n\t return function () {\n\t if (_this._isLast()) {\n\t return _this.next();\n\t } else {\n\t return _this.end();\n\t }\n\t };\n\t }(this));\n\t }\n\t shouldAddSmart = step.smartPlacement === true && step.placement.search(/auto/i) === -1;\n\t $element.popover({\n\t placement: shouldAddSmart ? \"auto \" + step.placement : step.placement,\n\t trigger: 'manual',\n\t title: step.title,\n\t content: step.content,\n\t html: true,\n\t animation: step.animation,\n\t container: step.container,\n\t template: step.template,\n\t selector: step.element\n\t }).popover('show');\n\t $tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();\n\t $tip.attr('id', step.id);\n\t this._reposition($tip, step);\n\t if (isOrphan) {\n\t return this._center($tip);\n\t }\n\t };\n\t\n\t Tour.prototype._template = function (step, i) {\n\t var $navigation, $next, $prev, $resume, $template, template;\n\t template = step.template;\n\t if (this._isOrphan(step) && {}.toString.call(step.orphan) !== '[object Boolean]') {\n\t template = step.orphan;\n\t }\n\t $template = $.isFunction(template) ? $(template(i, step)) : $(template);\n\t $navigation = $template.find('.popover-navigation');\n\t $prev = $navigation.find('[data-role=\"prev\"]');\n\t $next = $navigation.find('[data-role=\"next\"]');\n\t $resume = $navigation.find('[data-role=\"pause-resume\"]');\n\t if (this._isOrphan(step)) {\n\t $template.addClass('orphan');\n\t }\n\t $template.addClass(\"tour-\" + this._options.name + \" tour-\" + this._options.name + \"-\" + i);\n\t if (step.reflex) {\n\t $template.addClass(\"tour-\" + this._options.name + \"-reflex\");\n\t }\n\t if (step.prev < 0) {\n\t $prev.addClass('disabled');\n\t $prev.prop('disabled', true);\n\t }\n\t if (step.next < 0) {\n\t $next.addClass('disabled');\n\t $next.prop('disabled', true);\n\t }\n\t if (!step.duration) {\n\t $resume.remove();\n\t }\n\t return $template.clone().wrap('
                                                                ').parent().html();\n\t };\n\t\n\t Tour.prototype._reflexEvent = function (reflex) {\n\t if ({}.toString.call(reflex) === '[object Boolean]') {\n\t return 'click';\n\t } else {\n\t return reflex;\n\t }\n\t };\n\t\n\t Tour.prototype._reposition = function ($tip, step) {\n\t var offsetBottom, offsetHeight, offsetRight, offsetWidth, originalLeft, originalTop, tipOffset;\n\t offsetWidth = $tip[0].offsetWidth;\n\t offsetHeight = $tip[0].offsetHeight;\n\t tipOffset = $tip.offset();\n\t originalLeft = tipOffset.left;\n\t originalTop = tipOffset.top;\n\t offsetBottom = $(document).outerHeight() - tipOffset.top - $tip.outerHeight();\n\t if (offsetBottom < 0) {\n\t tipOffset.top = tipOffset.top + offsetBottom;\n\t }\n\t offsetRight = $('html').outerWidth() - tipOffset.left - $tip.outerWidth();\n\t if (offsetRight < 0) {\n\t tipOffset.left = tipOffset.left + offsetRight;\n\t }\n\t if (tipOffset.top < 0) {\n\t tipOffset.top = 0;\n\t }\n\t if (tipOffset.left < 0) {\n\t tipOffset.left = 0;\n\t }\n\t $tip.offset(tipOffset);\n\t if (step.placement === 'bottom' || step.placement === 'top') {\n\t if (originalLeft !== tipOffset.left) {\n\t return this._replaceArrow($tip, (tipOffset.left - originalLeft) * 2, offsetWidth, 'left');\n\t }\n\t } else {\n\t if (originalTop !== tipOffset.top) {\n\t return this._replaceArrow($tip, (tipOffset.top - originalTop) * 2, offsetHeight, 'top');\n\t }\n\t }\n\t };\n\t\n\t Tour.prototype._center = function ($tip) {\n\t return $tip.css('top', $(window).outerHeight() / 2 - $tip.outerHeight() / 2);\n\t };\n\t\n\t Tour.prototype._replaceArrow = function ($tip, delta, dimension, position) {\n\t return $tip.find('.arrow').css(position, delta ? 50 * (1 - delta / dimension) + '%' : '');\n\t };\n\t\n\t Tour.prototype._scrollIntoView = function (element, callback) {\n\t var $element, $window, counter, offsetTop, scrollTop, windowHeight;\n\t $element = $(element);\n\t if (!$element.length) {\n\t return callback();\n\t }\n\t $window = $(window);\n\t offsetTop = $element.offset().top;\n\t windowHeight = $window.height();\n\t scrollTop = Math.max(0, offsetTop - windowHeight / 2);\n\t this._debug(\"Scroll into view. ScrollTop: \" + scrollTop + \". Element offset: \" + offsetTop + \". Window height: \" + windowHeight + \".\");\n\t counter = 0;\n\t return $('body, html').stop(true, true).animate({\n\t scrollTop: Math.ceil(scrollTop)\n\t }, function (_this) {\n\t return function () {\n\t if (++counter === 2) {\n\t callback();\n\t return _this._debug(\"Scroll into view.\\nAnimation end element offset: \" + $element.offset().top + \".\\nWindow height: \" + $window.height() + \".\");\n\t }\n\t };\n\t }(this));\n\t };\n\t\n\t Tour.prototype._onResize = function (callback, timeout) {\n\t return $(window).on(\"resize.tour-\" + this._options.name, function () {\n\t clearTimeout(timeout);\n\t return timeout = setTimeout(callback, 100);\n\t });\n\t };\n\t\n\t Tour.prototype._initMouseNavigation = function () {\n\t var _this;\n\t _this = this;\n\t return $(document).off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\").on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\", function (_this) {\n\t return function (e) {\n\t e.preventDefault();\n\t return _this.next();\n\t };\n\t }(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\", function (_this) {\n\t return function (e) {\n\t e.preventDefault();\n\t return _this.prev();\n\t };\n\t }(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\", function (_this) {\n\t return function (e) {\n\t e.preventDefault();\n\t return _this.end();\n\t };\n\t }(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\", function (e) {\n\t var $this;\n\t e.preventDefault();\n\t $this = $(this);\n\t $this.text(_this._paused ? $this.data('pause-text') : $this.data('resume-text'));\n\t if (_this._paused) {\n\t return _this.resume();\n\t } else {\n\t return _this.pause();\n\t }\n\t });\n\t };\n\t\n\t Tour.prototype._initKeyboardNavigation = function () {\n\t if (!this._options.keyboard) {\n\t return;\n\t }\n\t return $(document).on(\"keyup.tour-\" + this._options.name, function (_this) {\n\t return function (e) {\n\t if (!e.which) {\n\t return;\n\t }\n\t switch (e.which) {\n\t case 39:\n\t e.preventDefault();\n\t if (_this._isLast()) {\n\t return _this.next();\n\t } else {\n\t return _this.end();\n\t }\n\t break;\n\t case 37:\n\t e.preventDefault();\n\t if (_this._current > 0) {\n\t return _this.prev();\n\t }\n\t break;\n\t case 27:\n\t e.preventDefault();\n\t return _this.end();\n\t }\n\t };\n\t }(this));\n\t };\n\t\n\t Tour.prototype._makePromise = function (result) {\n\t if (result && $.isFunction(result.then)) {\n\t return result;\n\t } else {\n\t return null;\n\t }\n\t };\n\t\n\t Tour.prototype._callOnPromiseDone = function (promise, cb, arg) {\n\t if (promise) {\n\t return promise.then(function (_this) {\n\t return function (e) {\n\t return cb.call(_this, arg);\n\t };\n\t }(this));\n\t } else {\n\t return cb.call(this, arg);\n\t }\n\t };\n\t\n\t Tour.prototype._showBackdrop = function (step) {\n\t if (this.backdrop.backgroundShown) {\n\t return;\n\t }\n\t this.backdrop = $('
                                                                ', {\n\t \"class\": 'tour-backdrop'\n\t });\n\t this.backdrop.backgroundShown = true;\n\t return $(step.backdropContainer).append(this.backdrop);\n\t };\n\t\n\t Tour.prototype._hideBackdrop = function () {\n\t this._hideOverlayElement();\n\t return this._hideBackground();\n\t };\n\t\n\t Tour.prototype._hideBackground = function () {\n\t if (this.backdrop) {\n\t this.backdrop.remove();\n\t this.backdrop.overlay = null;\n\t return this.backdrop.backgroundShown = false;\n\t }\n\t };\n\t\n\t Tour.prototype._showOverlayElement = function (step, force) {\n\t var $element, elementData;\n\t $element = $(step.element);\n\t if (!$element || $element.length === 0 || this.backdrop.overlayElementShown && !force) {\n\t return;\n\t }\n\t if (!this.backdrop.overlayElementShown) {\n\t this.backdrop.$element = $element.addClass('tour-step-backdrop');\n\t this.backdrop.$background = $('
                                                                ', {\n\t \"class\": 'tour-step-background'\n\t });\n\t this.backdrop.$background.appendTo(step.backdropContainer);\n\t this.backdrop.overlayElementShown = true;\n\t }\n\t elementData = {\n\t width: $element.innerWidth(),\n\t height: $element.innerHeight(),\n\t offset: $element.offset()\n\t };\n\t if (step.backdropPadding) {\n\t elementData = this._applyBackdropPadding(step.backdropPadding, elementData);\n\t }\n\t return this.backdrop.$background.width(elementData.width).height(elementData.height).offset(elementData.offset);\n\t };\n\t\n\t Tour.prototype._hideOverlayElement = function () {\n\t if (!this.backdrop.overlayElementShown) {\n\t return;\n\t }\n\t this.backdrop.$element.removeClass('tour-step-backdrop');\n\t this.backdrop.$background.remove();\n\t this.backdrop.$element = null;\n\t this.backdrop.$background = null;\n\t return this.backdrop.overlayElementShown = false;\n\t };\n\t\n\t Tour.prototype._applyBackdropPadding = function (padding, data) {\n\t if (typeof padding === 'object') {\n\t if (padding.top == null) {\n\t padding.top = 0;\n\t }\n\t if (padding.right == null) {\n\t padding.right = 0;\n\t }\n\t if (padding.bottom == null) {\n\t padding.bottom = 0;\n\t }\n\t if (padding.left == null) {\n\t padding.left = 0;\n\t }\n\t data.offset.top = data.offset.top - padding.top;\n\t data.offset.left = data.offset.left - padding.left;\n\t data.width = data.width + padding.left + padding.right;\n\t data.height = data.height + padding.top + padding.bottom;\n\t } else {\n\t data.offset.top = data.offset.top - padding;\n\t data.offset.left = data.offset.left - padding;\n\t data.width = data.width + padding * 2;\n\t data.height = data.height + padding * 2;\n\t }\n\t return data;\n\t };\n\t\n\t Tour.prototype._clearTimer = function () {\n\t window.clearTimeout(this._timer);\n\t this._timer = null;\n\t return this._duration = null;\n\t };\n\t\n\t Tour.prototype._getProtocol = function (url) {\n\t url = url.split('://');\n\t if (url.length > 1) {\n\t return url[0];\n\t } else {\n\t return 'http';\n\t }\n\t };\n\t\n\t Tour.prototype._getHost = function (url) {\n\t url = url.split('//');\n\t url = url.length > 1 ? url[1] : url[0];\n\t return url.split('/')[0];\n\t };\n\t\n\t Tour.prototype._getPath = function (path) {\n\t return path.replace(/\\/?$/, '').split('?')[0].split('#')[0];\n\t };\n\t\n\t Tour.prototype._getQuery = function (path) {\n\t return this._getParams(path, '?');\n\t };\n\t\n\t Tour.prototype._getHash = function (path) {\n\t return this._getParams(path, '#');\n\t };\n\t\n\t Tour.prototype._getParams = function (path, start) {\n\t var param, params, paramsObject, _i, _len;\n\t params = path.split(start);\n\t if (params.length === 1) {\n\t return {};\n\t }\n\t params = params[1].split('&');\n\t paramsObject = {};\n\t for (_i = 0, _len = params.length; _i < _len; _i++) {\n\t param = params[_i];\n\t param = param.split('=');\n\t paramsObject[param[0]] = param[1] || '';\n\t }\n\t return paramsObject;\n\t };\n\t\n\t Tour.prototype._equal = function (obj1, obj2) {\n\t var k, v;\n\t if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') {\n\t for (k in obj1) {\n\t v = obj1[k];\n\t if (obj2[k] !== v) {\n\t return false;\n\t }\n\t }\n\t for (k in obj2) {\n\t v = obj2[k];\n\t if (obj1[k] !== v) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t return obj1 === obj2;\n\t };\n\t\n\t return Tour;\n\t }();\n\t return window.Tour = Tour;\n\t})(jQuery, window);\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 75 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(jQuery) {/*! jQuery UI - v1.9.1 - 2012-10-29\n\t* http://jqueryui.com\n\t* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.menu.js, jquery.ui.slider.js\n\t* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */\n\t\n\t(function (e, t) {\n\t function i(t, n) {\n\t var r,\n\t i,\n\t o,\n\t u = t.nodeName.toLowerCase();return \"area\" === u ? (r = t.parentNode, i = r.name, !t.href || !i || r.nodeName.toLowerCase() !== \"map\" ? !1 : (o = e(\"img[usemap=#\" + i + \"]\")[0], !!o && s(o))) : (/input|select|textarea|button|object/.test(u) ? !t.disabled : \"a\" === u ? t.href || n : n) && s(t);\n\t }function s(t) {\n\t return e.expr.filters.visible(t) && !e(t).parents().andSelf().filter(function () {\n\t return e.css(this, \"visibility\") === \"hidden\";\n\t }).length;\n\t }var n = 0,\n\t r = /^ui-id-\\d+$/;e.ui = e.ui || {};if (e.ui.version) return;e.extend(e.ui, { version: \"1.9.1\", keyCode: { BACKSPACE: 8, COMMA: 188, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38 } }), e.fn.extend({ _focus: e.fn.focus, focus: function (t, n) {\n\t return typeof t == \"number\" ? this.each(function () {\n\t var r = this;setTimeout(function () {\n\t e(r).focus(), n && n.call(r);\n\t }, t);\n\t }) : this._focus.apply(this, arguments);\n\t }, scrollParent: function () {\n\t var t;return e.ui.ie && /(static|relative)/.test(this.css(\"position\")) || /absolute/.test(this.css(\"position\")) ? t = this.parents().filter(function () {\n\t return (/(relative|absolute|fixed)/.test(e.css(this, \"position\")) && /(auto|scroll)/.test(e.css(this, \"overflow\") + e.css(this, \"overflow-y\") + e.css(this, \"overflow-x\"))\n\t );\n\t }).eq(0) : t = this.parents().filter(function () {\n\t return (/(auto|scroll)/.test(e.css(this, \"overflow\") + e.css(this, \"overflow-y\") + e.css(this, \"overflow-x\"))\n\t );\n\t }).eq(0), /fixed/.test(this.css(\"position\")) || !t.length ? e(document) : t;\n\t }, zIndex: function (n) {\n\t if (n !== t) return this.css(\"zIndex\", n);if (this.length) {\n\t var r = e(this[0]),\n\t i,\n\t s;while (r.length && r[0] !== document) {\n\t i = r.css(\"position\");if (i === \"absolute\" || i === \"relative\" || i === \"fixed\") {\n\t s = parseInt(r.css(\"zIndex\"), 10);if (!isNaN(s) && s !== 0) return s;\n\t }r = r.parent();\n\t }\n\t }return 0;\n\t }, uniqueId: function () {\n\t return this.each(function () {\n\t this.id || (this.id = \"ui-id-\" + ++n);\n\t });\n\t }, removeUniqueId: function () {\n\t return this.each(function () {\n\t r.test(this.id) && e(this).removeAttr(\"id\");\n\t });\n\t } }), e(\"\").outerWidth(1).jquery || e.each([\"Width\", \"Height\"], function (n, r) {\n\t function u(t, n, r, s) {\n\t return e.each(i, function () {\n\t n -= parseFloat(e.css(t, \"padding\" + this)) || 0, r && (n -= parseFloat(e.css(t, \"border\" + this + \"Width\")) || 0), s && (n -= parseFloat(e.css(t, \"margin\" + this)) || 0);\n\t }), n;\n\t }var i = r === \"Width\" ? [\"Left\", \"Right\"] : [\"Top\", \"Bottom\"],\n\t s = r.toLowerCase(),\n\t o = { innerWidth: e.fn.innerWidth, innerHeight: e.fn.innerHeight, outerWidth: e.fn.outerWidth, outerHeight: e.fn.outerHeight };e.fn[\"inner\" + r] = function (n) {\n\t return n === t ? o[\"inner\" + r].call(this) : this.each(function () {\n\t e(this).css(s, u(this, n) + \"px\");\n\t });\n\t }, e.fn[\"outer\" + r] = function (t, n) {\n\t return typeof t != \"number\" ? o[\"outer\" + r].call(this, t) : this.each(function () {\n\t e(this).css(s, u(this, t, !0, n) + \"px\");\n\t });\n\t };\n\t }), e.extend(e.expr[\":\"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {\n\t return function (n) {\n\t return !!e.data(n, t);\n\t };\n\t }) : function (t, n, r) {\n\t return !!e.data(t, r[3]);\n\t }, focusable: function (t) {\n\t return i(t, !isNaN(e.attr(t, \"tabindex\")));\n\t }, tabbable: function (t) {\n\t var n = e.attr(t, \"tabindex\"),\n\t r = isNaN(n);return (r || n >= 0) && i(t, !r);\n\t } }), e(function () {\n\t var t = document.body,\n\t n = t.appendChild(n = document.createElement(\"div\"));n.offsetHeight, e.extend(n.style, { minHeight: \"100px\", height: \"auto\", padding: 0, borderWidth: 0 }), e.support.minHeight = n.offsetHeight === 100, e.support.selectstart = \"onselectstart\" in n, t.removeChild(n).style.display = \"none\";\n\t }), function () {\n\t var t = /msie ([\\w.]+)/.exec(navigator.userAgent.toLowerCase()) || [];e.ui.ie = t.length ? !0 : !1, e.ui.ie6 = parseFloat(t[1], 10) === 6;\n\t }(), e.fn.extend({ disableSelection: function () {\n\t return this.bind((e.support.selectstart ? \"selectstart\" : \"mousedown\") + \".ui-disableSelection\", function (e) {\n\t e.preventDefault();\n\t });\n\t }, enableSelection: function () {\n\t return this.unbind(\".ui-disableSelection\");\n\t } }), e.extend(e.ui, { plugin: { add: function (t, n, r) {\n\t var i,\n\t s = e.ui[t].prototype;for (i in r) s.plugins[i] = s.plugins[i] || [], s.plugins[i].push([n, r[i]]);\n\t }, call: function (e, t, n) {\n\t var r,\n\t i = e.plugins[t];if (!i || !e.element[0].parentNode || e.element[0].parentNode.nodeType === 11) return;for (r = 0; r < i.length; r++) e.options[i[r][0]] && i[r][1].apply(e.element, n);\n\t } }, contains: e.contains, hasScroll: function (t, n) {\n\t if (e(t).css(\"overflow\") === \"hidden\") return !1;var r = n && n === \"left\" ? \"scrollLeft\" : \"scrollTop\",\n\t i = !1;return t[r] > 0 ? !0 : (t[r] = 1, i = t[r] > 0, t[r] = 0, i);\n\t }, isOverAxis: function (e, t, n) {\n\t return e > t && e < t + n;\n\t }, isOver: function (t, n, r, i, s, o) {\n\t return e.ui.isOverAxis(t, r, s) && e.ui.isOverAxis(n, i, o);\n\t } });\n\t})(jQuery);(function (e, t) {\n\t var n = 0,\n\t r = Array.prototype.slice,\n\t i = e.cleanData;e.cleanData = function (t) {\n\t for (var n = 0, r; (r = t[n]) != null; n++) try {\n\t e(r).triggerHandler(\"remove\");\n\t } catch (s) {}i(t);\n\t }, e.widget = function (t, n, r) {\n\t var i,\n\t s,\n\t o,\n\t u,\n\t a = t.split(\".\")[0];t = t.split(\".\")[1], i = a + \"-\" + t, r || (r = n, n = e.Widget), e.expr[\":\"][i.toLowerCase()] = function (t) {\n\t return !!e.data(t, i);\n\t }, e[a] = e[a] || {}, s = e[a][t], o = e[a][t] = function (e, t) {\n\t if (!this._createWidget) return new o(e, t);arguments.length && this._createWidget(e, t);\n\t }, e.extend(o, s, { version: r.version, _proto: e.extend({}, r), _childConstructors: [] }), u = new n(), u.options = e.widget.extend({}, u.options), e.each(r, function (t, i) {\n\t e.isFunction(i) && (r[t] = function () {\n\t var e = function () {\n\t return n.prototype[t].apply(this, arguments);\n\t },\n\t r = function (e) {\n\t return n.prototype[t].apply(this, e);\n\t };return function () {\n\t var t = this._super,\n\t n = this._superApply,\n\t s;return this._super = e, this._superApply = r, s = i.apply(this, arguments), this._super = t, this._superApply = n, s;\n\t };\n\t }());\n\t }), o.prototype = e.widget.extend(u, { widgetEventPrefix: u.widgetEventPrefix || t }, r, { constructor: o, namespace: a, widgetName: t, widgetBaseClass: i, widgetFullName: i }), s ? (e.each(s._childConstructors, function (t, n) {\n\t var r = n.prototype;e.widget(r.namespace + \".\" + r.widgetName, o, n._proto);\n\t }), delete s._childConstructors) : n._childConstructors.push(o), e.widget.bridge(t, o);\n\t }, e.widget.extend = function (n) {\n\t var i = r.call(arguments, 1),\n\t s = 0,\n\t o = i.length,\n\t u,\n\t a;for (; s < o; s++) for (u in i[s]) a = i[s][u], i[s].hasOwnProperty(u) && a !== t && (e.isPlainObject(a) ? n[u] = e.isPlainObject(n[u]) ? e.widget.extend({}, n[u], a) : e.widget.extend({}, a) : n[u] = a);return n;\n\t }, e.widget.bridge = function (n, i) {\n\t var s = i.prototype.widgetFullName;e.fn[n] = function (o) {\n\t var u = typeof o == \"string\",\n\t a = r.call(arguments, 1),\n\t f = this;return o = !u && a.length ? e.widget.extend.apply(null, [o].concat(a)) : o, u ? this.each(function () {\n\t var r,\n\t i = e.data(this, s);if (!i) return e.error(\"cannot call methods on \" + n + \" prior to initialization; \" + \"attempted to call method '\" + o + \"'\");if (!e.isFunction(i[o]) || o.charAt(0) === \"_\") return e.error(\"no such method '\" + o + \"' for \" + n + \" widget instance\");r = i[o].apply(i, a);if (r !== i && r !== t) return f = r && r.jquery ? f.pushStack(r.get()) : r, !1;\n\t }) : this.each(function () {\n\t var t = e.data(this, s);t ? t.option(o || {})._init() : new i(o, this);\n\t }), f;\n\t };\n\t }, e.Widget = function () {}, e.Widget._childConstructors = [], e.Widget.prototype = { widgetName: \"widget\", widgetEventPrefix: \"\", defaultElement: \"
                                                                \", options: { disabled: !1, create: null }, _createWidget: function (t, r) {\n\t r = e(r || this.defaultElement || this)[0], this.element = e(r), this.uuid = n++, this.eventNamespace = \".\" + this.widgetName + this.uuid, this.options = e.widget.extend({}, this.options, this._getCreateOptions(), t), this.bindings = e(), this.hoverable = e(), this.focusable = e(), r !== this && (e.data(r, this.widgetName, this), e.data(r, this.widgetFullName, this), this._on(this.element, { remove: function (e) {\n\t e.target === r && this.destroy();\n\t } }), this.document = e(r.style ? r.ownerDocument : r.document || r), this.window = e(this.document[0].defaultView || this.document[0].parentWindow)), this._create(), this._trigger(\"create\", null, this._getCreateEventData()), this._init();\n\t }, _getCreateOptions: e.noop, _getCreateEventData: e.noop, _create: e.noop, _init: e.noop, destroy: function () {\n\t this._destroy(), this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)), this.widget().unbind(this.eventNamespace).removeAttr(\"aria-disabled\").removeClass(this.widgetFullName + \"-disabled \" + \"ui-state-disabled\"), this.bindings.unbind(this.eventNamespace), this.hoverable.removeClass(\"ui-state-hover\"), this.focusable.removeClass(\"ui-state-focus\");\n\t }, _destroy: e.noop, widget: function () {\n\t return this.element;\n\t }, option: function (n, r) {\n\t var i = n,\n\t s,\n\t o,\n\t u;if (arguments.length === 0) return e.widget.extend({}, this.options);if (typeof n == \"string\") {\n\t i = {}, s = n.split(\".\"), n = s.shift();if (s.length) {\n\t o = i[n] = e.widget.extend({}, this.options[n]);for (u = 0; u < s.length - 1; u++) o[s[u]] = o[s[u]] || {}, o = o[s[u]];n = s.pop();if (r === t) return o[n] === t ? null : o[n];o[n] = r;\n\t } else {\n\t if (r === t) return this.options[n] === t ? null : this.options[n];i[n] = r;\n\t }\n\t }return this._setOptions(i), this;\n\t }, _setOptions: function (e) {\n\t var t;for (t in e) this._setOption(t, e[t]);return this;\n\t }, _setOption: function (e, t) {\n\t return this.options[e] = t, e === \"disabled\" && (this.widget().toggleClass(this.widgetFullName + \"-disabled ui-state-disabled\", !!t).attr(\"aria-disabled\", t), this.hoverable.removeClass(\"ui-state-hover\"), this.focusable.removeClass(\"ui-state-focus\")), this;\n\t }, enable: function () {\n\t return this._setOption(\"disabled\", !1);\n\t }, disable: function () {\n\t return this._setOption(\"disabled\", !0);\n\t }, _on: function (t, n) {\n\t var r,\n\t i = this;n ? (t = r = e(t), this.bindings = this.bindings.add(t)) : (n = t, t = this.element, r = this.widget()), e.each(n, function (n, s) {\n\t function o() {\n\t if (i.options.disabled === !0 || e(this).hasClass(\"ui-state-disabled\")) return;return (typeof s == \"string\" ? i[s] : s).apply(i, arguments);\n\t }typeof s != \"string\" && (o.guid = s.guid = s.guid || o.guid || e.guid++);var u = n.match(/^(\\w+)\\s*(.*)$/),\n\t a = u[1] + i.eventNamespace,\n\t f = u[2];f ? r.delegate(f, a, o) : t.bind(a, o);\n\t });\n\t }, _off: function (e, t) {\n\t t = (t || \"\").split(\" \").join(this.eventNamespace + \" \") + this.eventNamespace, e.unbind(t).undelegate(t);\n\t }, _delay: function (e, t) {\n\t function n() {\n\t return (typeof e == \"string\" ? r[e] : e).apply(r, arguments);\n\t }var r = this;return setTimeout(n, t || 0);\n\t }, _hoverable: function (t) {\n\t this.hoverable = this.hoverable.add(t), this._on(t, { mouseenter: function (t) {\n\t e(t.currentTarget).addClass(\"ui-state-hover\");\n\t }, mouseleave: function (t) {\n\t e(t.currentTarget).removeClass(\"ui-state-hover\");\n\t } });\n\t }, _focusable: function (t) {\n\t this.focusable = this.focusable.add(t), this._on(t, { focusin: function (t) {\n\t e(t.currentTarget).addClass(\"ui-state-focus\");\n\t }, focusout: function (t) {\n\t e(t.currentTarget).removeClass(\"ui-state-focus\");\n\t } });\n\t }, _trigger: function (t, n, r) {\n\t var i,\n\t s,\n\t o = this.options[t];r = r || {}, n = e.Event(n), n.type = (t === this.widgetEventPrefix ? t : this.widgetEventPrefix + t).toLowerCase(), n.target = this.element[0], s = n.originalEvent;if (s) for (i in s) i in n || (n[i] = s[i]);return this.element.trigger(n, r), !(e.isFunction(o) && o.apply(this.element[0], [n].concat(r)) === !1 || n.isDefaultPrevented());\n\t } }, e.each({ show: \"fadeIn\", hide: \"fadeOut\" }, function (t, n) {\n\t e.Widget.prototype[\"_\" + t] = function (r, i, s) {\n\t typeof i == \"string\" && (i = { effect: i });var o,\n\t u = i ? i === !0 || typeof i == \"number\" ? n : i.effect || n : t;i = i || {}, typeof i == \"number\" && (i = { duration: i }), o = !e.isEmptyObject(i), i.complete = s, i.delay && r.delay(i.delay), o && e.effects && (e.effects.effect[u] || e.uiBackCompat !== !1 && e.effects[u]) ? r[t](i) : u !== t && r[u] ? r[u](i.duration, i.easing, s) : r.queue(function (n) {\n\t e(this)[t](), s && s.call(r[0]), n();\n\t });\n\t };\n\t }), e.uiBackCompat !== !1 && (e.Widget.prototype._getCreateOptions = function () {\n\t return e.metadata && e.metadata.get(this.element[0])[this.widgetName];\n\t });\n\t})(jQuery);(function (e, t) {\n\t var n = !1;e(document).mouseup(function (e) {\n\t n = !1;\n\t }), e.widget(\"ui.mouse\", { version: \"1.9.1\", options: { cancel: \"input,textarea,button,select,option\", distance: 1, delay: 0 }, _mouseInit: function () {\n\t var t = this;this.element.bind(\"mousedown.\" + this.widgetName, function (e) {\n\t return t._mouseDown(e);\n\t }).bind(\"click.\" + this.widgetName, function (n) {\n\t if (!0 === e.data(n.target, t.widgetName + \".preventClickEvent\")) return e.removeData(n.target, t.widgetName + \".preventClickEvent\"), n.stopImmediatePropagation(), !1;\n\t }), this.started = !1;\n\t }, _mouseDestroy: function () {\n\t this.element.unbind(\".\" + this.widgetName), this._mouseMoveDelegate && e(document).unbind(\"mousemove.\" + this.widgetName, this._mouseMoveDelegate).unbind(\"mouseup.\" + this.widgetName, this._mouseUpDelegate);\n\t }, _mouseDown: function (t) {\n\t if (n) return;this._mouseStarted && this._mouseUp(t), this._mouseDownEvent = t;var r = this,\n\t i = t.which === 1,\n\t s = typeof this.options.cancel == \"string\" && t.target.nodeName ? e(t.target).closest(this.options.cancel).length : !1;if (!i || s || !this._mouseCapture(t)) return !0;this.mouseDelayMet = !this.options.delay, this.mouseDelayMet || (this._mouseDelayTimer = setTimeout(function () {\n\t r.mouseDelayMet = !0;\n\t }, this.options.delay));if (this._mouseDistanceMet(t) && this._mouseDelayMet(t)) {\n\t this._mouseStarted = this._mouseStart(t) !== !1;if (!this._mouseStarted) return t.preventDefault(), !0;\n\t }return !0 === e.data(t.target, this.widgetName + \".preventClickEvent\") && e.removeData(t.target, this.widgetName + \".preventClickEvent\"), this._mouseMoveDelegate = function (e) {\n\t return r._mouseMove(e);\n\t }, this._mouseUpDelegate = function (e) {\n\t return r._mouseUp(e);\n\t }, e(document).bind(\"mousemove.\" + this.widgetName, this._mouseMoveDelegate).bind(\"mouseup.\" + this.widgetName, this._mouseUpDelegate), t.preventDefault(), n = !0, !0;\n\t }, _mouseMove: function (t) {\n\t return !e.ui.ie || document.documentMode >= 9 || !!t.button ? this._mouseStarted ? (this._mouseDrag(t), t.preventDefault()) : (this._mouseDistanceMet(t) && this._mouseDelayMet(t) && (this._mouseStarted = this._mouseStart(this._mouseDownEvent, t) !== !1, this._mouseStarted ? this._mouseDrag(t) : this._mouseUp(t)), !this._mouseStarted) : this._mouseUp(t);\n\t }, _mouseUp: function (t) {\n\t return e(document).unbind(\"mousemove.\" + this.widgetName, this._mouseMoveDelegate).unbind(\"mouseup.\" + this.widgetName, this._mouseUpDelegate), this._mouseStarted && (this._mouseStarted = !1, t.target === this._mouseDownEvent.target && e.data(t.target, this.widgetName + \".preventClickEvent\", !0), this._mouseStop(t)), !1;\n\t }, _mouseDistanceMet: function (e) {\n\t return Math.max(Math.abs(this._mouseDownEvent.pageX - e.pageX), Math.abs(this._mouseDownEvent.pageY - e.pageY)) >= this.options.distance;\n\t }, _mouseDelayMet: function (e) {\n\t return this.mouseDelayMet;\n\t }, _mouseStart: function (e) {}, _mouseDrag: function (e) {}, _mouseStop: function (e) {}, _mouseCapture: function (e) {\n\t return !0;\n\t } });\n\t})(jQuery);(function (e, t) {\n\t function h(e, t, n) {\n\t return [parseInt(e[0], 10) * (l.test(e[0]) ? t / 100 : 1), parseInt(e[1], 10) * (l.test(e[1]) ? n / 100 : 1)];\n\t }function p(t, n) {\n\t return parseInt(e.css(t, n), 10) || 0;\n\t }e.ui = e.ui || {};var n,\n\t r = Math.max,\n\t i = Math.abs,\n\t s = Math.round,\n\t o = /left|center|right/,\n\t u = /top|center|bottom/,\n\t a = /[\\+\\-]\\d+%?/,\n\t f = /^\\w+/,\n\t l = /%$/,\n\t c = e.fn.position;e.position = { scrollbarWidth: function () {\n\t if (n !== t) return n;var r,\n\t i,\n\t s = e(\"
                                                                \"),\n\t o = s.children()[0];return e(\"body\").append(s), r = o.offsetWidth, s.css(\"overflow\", \"scroll\"), i = o.offsetWidth, r === i && (i = s[0].clientWidth), s.remove(), n = r - i;\n\t }, getScrollInfo: function (t) {\n\t var n = t.isWindow ? \"\" : t.element.css(\"overflow-x\"),\n\t r = t.isWindow ? \"\" : t.element.css(\"overflow-y\"),\n\t i = n === \"scroll\" || n === \"auto\" && t.width < t.element[0].scrollWidth,\n\t s = r === \"scroll\" || r === \"auto\" && t.height < t.element[0].scrollHeight;return { width: i ? e.position.scrollbarWidth() : 0, height: s ? e.position.scrollbarWidth() : 0 };\n\t }, getWithinInfo: function (t) {\n\t var n = e(t || window),\n\t r = e.isWindow(n[0]);return { element: n, isWindow: r, offset: n.offset() || { left: 0, top: 0 }, scrollLeft: n.scrollLeft(), scrollTop: n.scrollTop(), width: r ? n.width() : n.outerWidth(), height: r ? n.height() : n.outerHeight() };\n\t } }, e.fn.position = function (t) {\n\t if (!t || !t.of) return c.apply(this, arguments);t = e.extend({}, t);var n,\n\t l,\n\t d,\n\t v,\n\t m,\n\t g = e(t.of),\n\t y = e.position.getWithinInfo(t.within),\n\t b = e.position.getScrollInfo(y),\n\t w = g[0],\n\t E = (t.collision || \"flip\").split(\" \"),\n\t S = {};return w.nodeType === 9 ? (l = g.width(), d = g.height(), v = { top: 0, left: 0 }) : e.isWindow(w) ? (l = g.width(), d = g.height(), v = { top: g.scrollTop(), left: g.scrollLeft() }) : w.preventDefault ? (t.at = \"left top\", l = d = 0, v = { top: w.pageY, left: w.pageX }) : (l = g.outerWidth(), d = g.outerHeight(), v = g.offset()), m = e.extend({}, v), e.each([\"my\", \"at\"], function () {\n\t var e = (t[this] || \"\").split(\" \"),\n\t n,\n\t r;e.length === 1 && (e = o.test(e[0]) ? e.concat([\"center\"]) : u.test(e[0]) ? [\"center\"].concat(e) : [\"center\", \"center\"]), e[0] = o.test(e[0]) ? e[0] : \"center\", e[1] = u.test(e[1]) ? e[1] : \"center\", n = a.exec(e[0]), r = a.exec(e[1]), S[this] = [n ? n[0] : 0, r ? r[0] : 0], t[this] = [f.exec(e[0])[0], f.exec(e[1])[0]];\n\t }), E.length === 1 && (E[1] = E[0]), t.at[0] === \"right\" ? m.left += l : t.at[0] === \"center\" && (m.left += l / 2), t.at[1] === \"bottom\" ? m.top += d : t.at[1] === \"center\" && (m.top += d / 2), n = h(S.at, l, d), m.left += n[0], m.top += n[1], this.each(function () {\n\t var o,\n\t u,\n\t a = e(this),\n\t f = a.outerWidth(),\n\t c = a.outerHeight(),\n\t w = p(this, \"marginLeft\"),\n\t x = p(this, \"marginTop\"),\n\t T = f + w + p(this, \"marginRight\") + b.width,\n\t N = c + x + p(this, \"marginBottom\") + b.height,\n\t C = e.extend({}, m),\n\t k = h(S.my, a.outerWidth(), a.outerHeight());t.my[0] === \"right\" ? C.left -= f : t.my[0] === \"center\" && (C.left -= f / 2), t.my[1] === \"bottom\" ? C.top -= c : t.my[1] === \"center\" && (C.top -= c / 2), C.left += k[0], C.top += k[1], e.support.offsetFractions || (C.left = s(C.left), C.top = s(C.top)), o = { marginLeft: w, marginTop: x }, e.each([\"left\", \"top\"], function (r, i) {\n\t e.ui.position[E[r]] && e.ui.position[E[r]][i](C, { targetWidth: l, targetHeight: d, elemWidth: f, elemHeight: c, collisionPosition: o, collisionWidth: T, collisionHeight: N, offset: [n[0] + k[0], n[1] + k[1]], my: t.my, at: t.at, within: y, elem: a });\n\t }), e.fn.bgiframe && a.bgiframe(), t.using && (u = function (e) {\n\t var n = v.left - C.left,\n\t s = n + l - f,\n\t o = v.top - C.top,\n\t u = o + d - c,\n\t h = { target: { element: g, left: v.left, top: v.top, width: l, height: d }, element: { element: a, left: C.left, top: C.top, width: f, height: c }, horizontal: s < 0 ? \"left\" : n > 0 ? \"right\" : \"center\", vertical: u < 0 ? \"top\" : o > 0 ? \"bottom\" : \"middle\" };l < f && i(n + s) < l && (h.horizontal = \"center\"), d < c && i(o + u) < d && (h.vertical = \"middle\"), r(i(n), i(s)) > r(i(o), i(u)) ? h.important = \"horizontal\" : h.important = \"vertical\", t.using.call(this, e, h);\n\t }), a.offset(e.extend(C, { using: u }));\n\t });\n\t }, e.ui.position = { fit: { left: function (e, t) {\n\t var n = t.within,\n\t i = n.isWindow ? n.scrollLeft : n.offset.left,\n\t s = n.width,\n\t o = e.left - t.collisionPosition.marginLeft,\n\t u = i - o,\n\t a = o + t.collisionWidth - s - i,\n\t f;t.collisionWidth > s ? u > 0 && a <= 0 ? (f = e.left + u + t.collisionWidth - s - i, e.left += u - f) : a > 0 && u <= 0 ? e.left = i : u > a ? e.left = i + s - t.collisionWidth : e.left = i : u > 0 ? e.left += u : a > 0 ? e.left -= a : e.left = r(e.left - o, e.left);\n\t }, top: function (e, t) {\n\t var n = t.within,\n\t i = n.isWindow ? n.scrollTop : n.offset.top,\n\t s = t.within.height,\n\t o = e.top - t.collisionPosition.marginTop,\n\t u = i - o,\n\t a = o + t.collisionHeight - s - i,\n\t f;t.collisionHeight > s ? u > 0 && a <= 0 ? (f = e.top + u + t.collisionHeight - s - i, e.top += u - f) : a > 0 && u <= 0 ? e.top = i : u > a ? e.top = i + s - t.collisionHeight : e.top = i : u > 0 ? e.top += u : a > 0 ? e.top -= a : e.top = r(e.top - o, e.top);\n\t } }, flip: { left: function (e, t) {\n\t var n = t.within,\n\t r = n.offset.left + n.scrollLeft,\n\t s = n.width,\n\t o = n.isWindow ? n.scrollLeft : n.offset.left,\n\t u = e.left - t.collisionPosition.marginLeft,\n\t a = u - o,\n\t f = u + t.collisionWidth - s - o,\n\t l = t.my[0] === \"left\" ? -t.elemWidth : t.my[0] === \"right\" ? t.elemWidth : 0,\n\t c = t.at[0] === \"left\" ? t.targetWidth : t.at[0] === \"right\" ? -t.targetWidth : 0,\n\t h = -2 * t.offset[0],\n\t p,\n\t d;if (a < 0) {\n\t p = e.left + l + c + h + t.collisionWidth - s - r;if (p < 0 || p < i(a)) e.left += l + c + h;\n\t } else if (f > 0) {\n\t d = e.left - t.collisionPosition.marginLeft + l + c + h - o;if (d > 0 || i(d) < f) e.left += l + c + h;\n\t }\n\t }, top: function (e, t) {\n\t var n = t.within,\n\t r = n.offset.top + n.scrollTop,\n\t s = n.height,\n\t o = n.isWindow ? n.scrollTop : n.offset.top,\n\t u = e.top - t.collisionPosition.marginTop,\n\t a = u - o,\n\t f = u + t.collisionHeight - s - o,\n\t l = t.my[1] === \"top\",\n\t c = l ? -t.elemHeight : t.my[1] === \"bottom\" ? t.elemHeight : 0,\n\t h = t.at[1] === \"top\" ? t.targetHeight : t.at[1] === \"bottom\" ? -t.targetHeight : 0,\n\t p = -2 * t.offset[1],\n\t d,\n\t v;a < 0 ? (v = e.top + c + h + p + t.collisionHeight - s - r, e.top + c + h + p > a && (v < 0 || v < i(a)) && (e.top += c + h + p)) : f > 0 && (d = e.top - t.collisionPosition.marginTop + c + h + p - o, e.top + c + h + p > f && (d > 0 || i(d) < f) && (e.top += c + h + p));\n\t } }, flipfit: { left: function () {\n\t e.ui.position.flip.left.apply(this, arguments), e.ui.position.fit.left.apply(this, arguments);\n\t }, top: function () {\n\t e.ui.position.flip.top.apply(this, arguments), e.ui.position.fit.top.apply(this, arguments);\n\t } } }, function () {\n\t var t,\n\t n,\n\t r,\n\t i,\n\t s,\n\t o = document.getElementsByTagName(\"body\")[0],\n\t u = document.createElement(\"div\");t = document.createElement(o ? \"div\" : \"body\"), r = { visibility: \"hidden\", width: 0, height: 0, border: 0, margin: 0, background: \"none\" }, o && e.extend(r, { position: \"absolute\", left: \"-1000px\", top: \"-1000px\" });for (s in r) t.style[s] = r[s];t.appendChild(u), n = o || document.documentElement, n.insertBefore(t, n.firstChild), u.style.cssText = \"position: absolute; left: 10.7432222px;\", i = e(u).offset().left, e.support.offsetFractions = i > 10 && i < 11, t.innerHTML = \"\", n.removeChild(t);\n\t }(), e.uiBackCompat !== !1 && function (e) {\n\t var n = e.fn.position;e.fn.position = function (r) {\n\t if (!r || !r.offset) return n.call(this, r);var i = r.offset.split(\" \"),\n\t s = r.at.split(\" \");return i.length === 1 && (i[1] = i[0]), /^\\d/.test(i[0]) && (i[0] = \"+\" + i[0]), /^\\d/.test(i[1]) && (i[1] = \"+\" + i[1]), s.length === 1 && (/left|center|right/.test(s[0]) ? s[1] = \"center\" : (s[1] = s[0], s[0] = \"center\")), n.call(this, e.extend(r, { at: s[0] + i[0] + \" \" + s[1] + i[1], offset: t }));\n\t };\n\t }(jQuery);\n\t})(jQuery);(function (e, t) {\n\t var n = 0;e.widget(\"ui.autocomplete\", { version: \"1.9.1\", defaultElement: \"\", options: { appendTo: \"body\", autoFocus: !1, delay: 300, minLength: 1, position: { my: \"left top\", at: \"left bottom\", collision: \"none\" }, source: null, change: null, close: null, focus: null, open: null, response: null, search: null, select: null }, pending: 0, _create: function () {\n\t var t, n, r;this.isMultiLine = this._isMultiLine(), this.valueMethod = this.element[this.element.is(\"input,textarea\") ? \"val\" : \"text\"], this.isNewMenu = !0, this.element.addClass(\"ui-autocomplete-input\").attr(\"autocomplete\", \"off\"), this._on(this.element, { keydown: function (i) {\n\t if (this.element.prop(\"readOnly\")) {\n\t t = !0, r = !0, n = !0;return;\n\t }t = !1, r = !1, n = !1;var s = e.ui.keyCode;switch (i.keyCode) {case s.PAGE_UP:\n\t t = !0, this._move(\"previousPage\", i);break;case s.PAGE_DOWN:\n\t t = !0, this._move(\"nextPage\", i);break;case s.UP:\n\t t = !0, this._keyEvent(\"previous\", i);break;case s.DOWN:\n\t t = !0, this._keyEvent(\"next\", i);break;case s.ENTER:case s.NUMPAD_ENTER:\n\t this.menu.active && (t = !0, i.preventDefault(), this.menu.select(i));break;case s.TAB:\n\t this.menu.active && this.menu.select(i);break;case s.ESCAPE:\n\t this.menu.element.is(\":visible\") && (this._value(this.term), this.close(i), i.preventDefault());break;default:\n\t n = !0, this._searchTimeout(i);}\n\t }, keypress: function (r) {\n\t if (t) {\n\t t = !1, r.preventDefault();return;\n\t }if (n) return;var i = e.ui.keyCode;switch (r.keyCode) {case i.PAGE_UP:\n\t this._move(\"previousPage\", r);break;case i.PAGE_DOWN:\n\t this._move(\"nextPage\", r);break;case i.UP:\n\t this._keyEvent(\"previous\", r);break;case i.DOWN:\n\t this._keyEvent(\"next\", r);}\n\t }, input: function (e) {\n\t if (r) {\n\t r = !1, e.preventDefault();return;\n\t }this._searchTimeout(e);\n\t }, focus: function () {\n\t this.selectedItem = null, this.previous = this._value();\n\t }, blur: function (e) {\n\t if (this.cancelBlur) {\n\t delete this.cancelBlur;return;\n\t }clearTimeout(this.searching), this.close(e), this._change(e);\n\t } }), this._initSource(), this.menu = e(\"
                                                                  \").addClass(\"ui-autocomplete\").appendTo(this.document.find(this.options.appendTo || \"body\")[0]).menu({ input: e(), role: null }).zIndex(this.element.zIndex() + 1).hide().data(\"menu\"), this._on(this.menu.element, { mousedown: function (t) {\n\t t.preventDefault(), this.cancelBlur = !0, this._delay(function () {\n\t delete this.cancelBlur;\n\t });var n = this.menu.element[0];e(t.target).closest(\".ui-menu-item\").length || this._delay(function () {\n\t var t = this;this.document.one(\"mousedown\", function (r) {\n\t r.target !== t.element[0] && r.target !== n && !e.contains(n, r.target) && t.close();\n\t });\n\t });\n\t }, menufocus: function (t, n) {\n\t if (this.isNewMenu) {\n\t this.isNewMenu = !1;if (t.originalEvent && /^mouse/.test(t.originalEvent.type)) {\n\t this.menu.blur(), this.document.one(\"mousemove\", function () {\n\t e(t.target).trigger(t.originalEvent);\n\t });return;\n\t }\n\t }var r = n.item.data(\"ui-autocomplete-item\") || n.item.data(\"item.autocomplete\");!1 !== this._trigger(\"focus\", t, { item: r }) ? t.originalEvent && /^key/.test(t.originalEvent.type) && this._value(r.value) : this.liveRegion.text(r.value);\n\t }, menuselect: function (e, t) {\n\t var n = t.item.data(\"ui-autocomplete-item\") || t.item.data(\"item.autocomplete\"),\n\t r = this.previous;this.element[0] !== this.document[0].activeElement && (this.element.focus(), this.previous = r, this._delay(function () {\n\t this.previous = r, this.selectedItem = n;\n\t })), !1 !== this._trigger(\"select\", e, { item: n }) && this._value(n.value), this.term = this._value(), this.close(e), this.selectedItem = n;\n\t } }), this.liveRegion = e(\"\", { role: \"status\", \"aria-live\": \"polite\" }).addClass(\"ui-helper-hidden-accessible\").insertAfter(this.element), e.fn.bgiframe && this.menu.element.bgiframe(), this._on(this.window, { beforeunload: function () {\n\t this.element.removeAttr(\"autocomplete\");\n\t } });\n\t }, _destroy: function () {\n\t clearTimeout(this.searching), this.element.removeClass(\"ui-autocomplete-input\").removeAttr(\"autocomplete\"), this.menu.element.remove(), this.liveRegion.remove();\n\t }, _setOption: function (e, t) {\n\t this._super(e, t), e === \"source\" && this._initSource(), e === \"appendTo\" && this.menu.element.appendTo(this.document.find(t || \"body\")[0]), e === \"disabled\" && t && this.xhr && this.xhr.abort();\n\t }, _isMultiLine: function () {\n\t return this.element.is(\"textarea\") ? !0 : this.element.is(\"input\") ? !1 : this.element.prop(\"isContentEditable\");\n\t }, _initSource: function () {\n\t var t,\n\t n,\n\t r = this;e.isArray(this.options.source) ? (t = this.options.source, this.source = function (n, r) {\n\t r(e.ui.autocomplete.filter(t, n.term));\n\t }) : typeof this.options.source == \"string\" ? (n = this.options.source, this.source = function (t, i) {\n\t r.xhr && r.xhr.abort(), r.xhr = e.ajax({ url: n, data: t, dataType: \"json\", success: function (e) {\n\t i(e);\n\t }, error: function () {\n\t i([]);\n\t } });\n\t }) : this.source = this.options.source;\n\t }, _searchTimeout: function (e) {\n\t clearTimeout(this.searching), this.searching = this._delay(function () {\n\t this.term !== this._value() && (this.selectedItem = null, this.search(null, e));\n\t }, this.options.delay);\n\t }, search: function (e, t) {\n\t e = e != null ? e : this._value(), this.term = this._value();if (e.length < this.options.minLength) return this.close(t);if (this._trigger(\"search\", t) === !1) return;return this._search(e);\n\t }, _search: function (e) {\n\t this.pending++, this.element.addClass(\"ui-autocomplete-loading\"), this.cancelSearch = !1, this.source({ term: e }, this._response());\n\t }, _response: function () {\n\t var e = this,\n\t t = ++n;return function (r) {\n\t t === n && e.__response(r), e.pending--, e.pending || e.element.removeClass(\"ui-autocomplete-loading\");\n\t };\n\t }, __response: function (e) {\n\t e && (e = this._normalize(e)), this._trigger(\"response\", null, { content: e }), !this.options.disabled && e && e.length && !this.cancelSearch ? (this._suggest(e), this._trigger(\"open\")) : this._close();\n\t }, close: function (e) {\n\t this.cancelSearch = !0, this._close(e);\n\t }, _close: function (e) {\n\t this.menu.element.is(\":visible\") && (this.menu.element.hide(), this.menu.blur(), this.isNewMenu = !0, this._trigger(\"close\", e));\n\t }, _change: function (e) {\n\t this.previous !== this._value() && this._trigger(\"change\", e, { item: this.selectedItem });\n\t }, _normalize: function (t) {\n\t return t.length && t[0].label && t[0].value ? t : e.map(t, function (t) {\n\t return typeof t == \"string\" ? { label: t, value: t } : e.extend({ label: t.label || t.value, value: t.value || t.label }, t);\n\t });\n\t }, _suggest: function (t) {\n\t var n = this.menu.element.empty().zIndex(this.element.zIndex() + 1);this._renderMenu(n, t), this.menu.refresh(), n.show(), this._resizeMenu(), n.position(e.extend({ of: this.element }, this.options.position)), this.options.autoFocus && this.menu.next();\n\t }, _resizeMenu: function () {\n\t var e = this.menu.element;e.outerWidth(Math.max(e.width(\"\").outerWidth() + 1, this.element.outerWidth()));\n\t }, _renderMenu: function (t, n) {\n\t var r = this;e.each(n, function (e, n) {\n\t r._renderItemData(t, n);\n\t });\n\t }, _renderItemData: function (e, t) {\n\t return this._renderItem(e, t).data(\"ui-autocomplete-item\", t);\n\t }, _renderItem: function (t, n) {\n\t return e(\"
                                                                • \").append(e(\"\").text(n.label)).appendTo(t);\n\t }, _move: function (e, t) {\n\t if (!this.menu.element.is(\":visible\")) {\n\t this.search(null, t);return;\n\t }if (this.menu.isFirstItem() && /^previous/.test(e) || this.menu.isLastItem() && /^next/.test(e)) {\n\t this._value(this.term), this.menu.blur();return;\n\t }this.menu[e](t);\n\t }, widget: function () {\n\t return this.menu.element;\n\t }, _value: function () {\n\t return this.valueMethod.apply(this.element, arguments);\n\t }, _keyEvent: function (e, t) {\n\t if (!this.isMultiLine || this.menu.element.is(\":visible\")) this._move(e, t), t.preventDefault();\n\t } }), e.extend(e.ui.autocomplete, { escapeRegex: function (e) {\n\t return e.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n\t }, filter: function (t, n) {\n\t var r = new RegExp(e.ui.autocomplete.escapeRegex(n), \"i\");return e.grep(t, function (e) {\n\t return r.test(e.label || e.value || e);\n\t });\n\t } }), e.widget(\"ui.autocomplete\", e.ui.autocomplete, { options: { messages: { noResults: \"No search results.\", results: function (e) {\n\t return e + (e > 1 ? \" results are\" : \" result is\") + \" available, use up and down arrow keys to navigate.\";\n\t } } }, __response: function (e) {\n\t var t;this._superApply(arguments);if (this.options.disabled || this.cancelSearch) return;e && e.length ? t = this.options.messages.results(e.length) : t = this.options.messages.noResults, this.liveRegion.text(t);\n\t } });\n\t})(jQuery);(function (e, t) {\n\t var n,\n\t r,\n\t i,\n\t s,\n\t o = \"ui-button ui-widget ui-state-default ui-corner-all\",\n\t u = \"ui-state-hover ui-state-active \",\n\t a = \"ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only\",\n\t f = function () {\n\t var t = e(this).find(\":ui-button\");setTimeout(function () {\n\t t.button(\"refresh\");\n\t }, 1);\n\t },\n\t l = function (t) {\n\t var n = t.name,\n\t r = t.form,\n\t i = e([]);return n && (r ? i = e(r).find(\"[name='\" + n + \"']\") : i = e(\"[name='\" + n + \"']\", t.ownerDocument).filter(function () {\n\t return !this.form;\n\t })), i;\n\t };e.widget(\"ui.button\", { version: \"1.9.1\", defaultElement: \"
                                                                \"\n )\n });\n modal.show( { backdrop: true } );\n}\n\n\n// ============================================================================\n return {\n Modal : Modal,\n hide_modal : hide_modal,\n show_modal : show_modal,\n show_message : show_message,\n show_in_overlay : show_in_overlay,\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/layout/modal.js","/* ========================================================================\n * bootstrap-tour - v0.10.2\n * http://bootstraptour.com\n * ========================================================================\n * Copyright 2012-2015 Ulrich Sossou\n *\n * ========================================================================\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://opensource.org/licenses/MIT\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ========================================================================\n */\n\n(function($, window) {\n var Tour, document;\n document = window.document;\n Tour = (function() {\n function Tour(options) {\n var storage;\n try {\n storage = window.localStorage;\n } catch (_error) {\n storage = false;\n }\n this._options = $.extend({\n name: 'tour',\n steps: [],\n container: 'body',\n autoscroll: true,\n keyboard: true,\n storage: storage,\n debug: false,\n backdrop: false,\n backdropContainer: 'body',\n backdropPadding: 0,\n redirect: true,\n orphan: false,\n duration: false,\n delay: false,\n basePath: '',\n template: '

                                                                ',\n afterSetState: function(key, value) {},\n afterGetState: function(key, value) {},\n afterRemoveState: function(key) {},\n onStart: function(tour) {},\n onEnd: function(tour) {},\n onShow: function(tour) {},\n onShown: function(tour) {},\n onHide: function(tour) {},\n onHidden: function(tour) {},\n onNext: function(tour) {},\n onPrev: function(tour) {},\n onPause: function(tour, duration) {},\n onResume: function(tour, duration) {},\n onRedirectError: function(tour) {}\n }, options);\n this._force = false;\n this._inited = false;\n this._current = null;\n this.backdrop = {\n overlay: null,\n $element: null,\n $background: null,\n backgroundShown: false,\n overlayElementShown: false\n };\n this;\n }\n\n Tour.prototype.addSteps = function(steps) {\n var step, _i, _len;\n for (_i = 0, _len = steps.length; _i < _len; _i++) {\n step = steps[_i];\n this.addStep(step);\n }\n return this;\n };\n\n Tour.prototype.addStep = function(step) {\n this._options.steps.push(step);\n return this;\n };\n\n Tour.prototype.getStep = function(i) {\n if (this._options.steps[i] != null) {\n return $.extend({\n id: \"step-\" + i,\n path: '',\n host: '',\n placement: 'right',\n title: '',\n content: '

                                                                ',\n next: i === this._options.steps.length - 1 ? -1 : i + 1,\n prev: i - 1,\n animation: true,\n container: this._options.container,\n autoscroll: this._options.autoscroll,\n backdrop: this._options.backdrop,\n backdropContainer: this._options.backdropContainer,\n backdropPadding: this._options.backdropPadding,\n redirect: this._options.redirect,\n reflexElement: this._options.steps[i].element,\n orphan: this._options.orphan,\n duration: this._options.duration,\n delay: this._options.delay,\n template: this._options.template,\n onShow: this._options.onShow,\n onShown: this._options.onShown,\n onHide: this._options.onHide,\n onHidden: this._options.onHidden,\n onNext: this._options.onNext,\n onPrev: this._options.onPrev,\n onPause: this._options.onPause,\n onResume: this._options.onResume,\n onRedirectError: this._options.onRedirectError\n }, this._options.steps[i]);\n }\n };\n\n Tour.prototype.init = function(force) {\n this._force = force;\n if (this.ended()) {\n this._debug('Tour ended, init prevented.');\n return this;\n }\n this.setCurrentStep();\n this._initMouseNavigation();\n this._initKeyboardNavigation();\n this._onResize((function(_this) {\n return function() {\n return _this.showStep(_this._current);\n };\n })(this));\n if (this._current !== null) {\n this.showStep(this._current);\n }\n this._inited = true;\n return this;\n };\n\n Tour.prototype.start = function(force) {\n var promise;\n if (force == null) {\n force = false;\n }\n if (!this._inited) {\n this.init(force);\n }\n if (this._current === null) {\n promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0);\n this._callOnPromiseDone(promise, this.showStep, 0);\n }\n return this;\n };\n\n Tour.prototype.next = function() {\n var promise;\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, this._showNextStep);\n };\n\n Tour.prototype.prev = function() {\n var promise;\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, this._showPrevStep);\n };\n\n Tour.prototype.goTo = function(i) {\n var promise;\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, this.showStep, i);\n };\n\n Tour.prototype.end = function() {\n var endHelper, promise;\n endHelper = (function(_this) {\n return function(e) {\n $(document).off(\"click.tour-\" + _this._options.name);\n $(document).off(\"keyup.tour-\" + _this._options.name);\n $(window).off(\"resize.tour-\" + _this._options.name);\n _this._setState('end', 'yes');\n _this._inited = false;\n _this._force = false;\n _this._clearTimer();\n if (_this._options.onEnd != null) {\n return _this._options.onEnd(_this);\n }\n };\n })(this);\n promise = this.hideStep(this._current);\n return this._callOnPromiseDone(promise, endHelper);\n };\n\n Tour.prototype.ended = function() {\n return !this._force && !!this._getState('end');\n };\n\n Tour.prototype.restart = function() {\n this._removeState('current_step');\n this._removeState('end');\n this._removeState('redirect_to');\n return this.start();\n };\n\n Tour.prototype.pause = function() {\n var step;\n step = this.getStep(this._current);\n if (!(step && step.duration)) {\n return this;\n }\n this._paused = true;\n this._duration -= new Date().getTime() - this._start;\n window.clearTimeout(this._timer);\n this._debug(\"Paused/Stopped step \" + (this._current + 1) + \" timer (\" + this._duration + \" remaining).\");\n if (step.onPause != null) {\n return step.onPause(this, this._duration);\n }\n };\n\n Tour.prototype.resume = function() {\n var step;\n step = this.getStep(this._current);\n if (!(step && step.duration)) {\n return this;\n }\n this._paused = false;\n this._start = new Date().getTime();\n this._duration = this._duration || step.duration;\n this._timer = window.setTimeout((function(_this) {\n return function() {\n if (_this._isLast()) {\n return _this.next();\n } else {\n return _this.end();\n }\n };\n })(this), this._duration);\n this._debug(\"Started step \" + (this._current + 1) + \" timer with duration \" + this._duration);\n if ((step.onResume != null) && this._duration !== step.duration) {\n return step.onResume(this, this._duration);\n }\n };\n\n Tour.prototype.hideStep = function(i) {\n var hideStepHelper, promise, step;\n step = this.getStep(i);\n if (!step) {\n return;\n }\n this._clearTimer();\n promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0);\n hideStepHelper = (function(_this) {\n return function(e) {\n var $element;\n $element = $(step.element);\n if (!($element.data('bs.popover') || $element.data('popover'))) {\n $element = $('body');\n }\n $element.popover('destroy').removeClass(\"tour-\" + _this._options.name + \"-element tour-\" + _this._options.name + \"-\" + i + \"-element\");\n $element.removeData('bs.popover');\n if (step.reflex) {\n $(step.reflexElement).removeClass('tour-step-element-reflex').off(\"\" + (_this._reflexEvent(step.reflex)) + \".tour-\" + _this._options.name);\n }\n if (step.backdrop) {\n _this._hideBackdrop();\n }\n if (step.onHidden != null) {\n return step.onHidden(_this);\n }\n };\n })(this);\n this._callOnPromiseDone(promise, hideStepHelper);\n return promise;\n };\n\n Tour.prototype.showStep = function(i) {\n var promise, showStepHelper, skipToPrevious, step;\n if (this.ended()) {\n this._debug('Tour ended, showStep prevented.');\n return this;\n }\n step = this.getStep(i);\n if (!step) {\n return;\n }\n skipToPrevious = i < this._current;\n promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);\n showStepHelper = (function(_this) {\n return function(e) {\n var path, showPopoverAndOverlay;\n _this.setCurrentStep(i);\n path = (function() {\n switch ({}.toString.call(step.path)) {\n case '[object Function]':\n return step.path();\n case '[object String]':\n return this._options.basePath + step.path;\n default:\n return step.path;\n }\n }).call(_this);\n if (_this._isRedirect(step.host, path, document.location)) {\n _this._redirect(step, i, path);\n if (!_this._isJustPathHashDifferent(step.host, path, document.location)) {\n return;\n }\n }\n if (_this._isOrphan(step)) {\n if (step.orphan === false) {\n _this._debug(\"Skip the orphan step \" + (_this._current + 1) + \".\\nOrphan option is false and the element does not exist or is hidden.\");\n if (skipToPrevious) {\n _this._showPrevStep();\n } else {\n _this._showNextStep();\n }\n return;\n }\n _this._debug(\"Show the orphan step \" + (_this._current + 1) + \". Orphans option is true.\");\n }\n if (step.backdrop) {\n _this._showBackdrop(step);\n }\n showPopoverAndOverlay = function() {\n if (_this.getCurrentStep() !== i || _this.ended()) {\n return;\n }\n if ((step.element != null) && step.backdrop) {\n _this._showOverlayElement(step);\n }\n _this._showPopover(step, i);\n if (step.onShown != null) {\n step.onShown(_this);\n }\n return _this._debug(\"Step \" + (_this._current + 1) + \" of \" + _this._options.steps.length);\n };\n if (step.autoscroll) {\n _this._scrollIntoView(step.element, showPopoverAndOverlay);\n } else {\n showPopoverAndOverlay();\n }\n if (step.duration) {\n return _this.resume();\n }\n };\n })(this);\n if (step.delay) {\n this._debug(\"Wait \" + step.delay + \" milliseconds to show the step \" + (this._current + 1));\n window.setTimeout((function(_this) {\n return function() {\n return _this._callOnPromiseDone(promise, showStepHelper);\n };\n })(this), step.delay);\n } else {\n this._callOnPromiseDone(promise, showStepHelper);\n }\n return promise;\n };\n\n Tour.prototype.getCurrentStep = function() {\n return this._current;\n };\n\n Tour.prototype.setCurrentStep = function(value) {\n if (value != null) {\n this._current = value;\n this._setState('current_step', value);\n } else {\n this._current = this._getState('current_step');\n this._current = this._current === null ? null : parseInt(this._current, 10);\n }\n return this;\n };\n\n Tour.prototype.redraw = function() {\n return this._showOverlayElement(this.getStep(this.getCurrentStep()).element, true);\n };\n\n Tour.prototype._setState = function(key, value) {\n var e, keyName;\n if (this._options.storage) {\n keyName = \"\" + this._options.name + \"_\" + key;\n try {\n this._options.storage.setItem(keyName, value);\n } catch (_error) {\n e = _error;\n if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {\n this._debug('LocalStorage quota exceeded. State storage failed.');\n }\n }\n return this._options.afterSetState(keyName, value);\n } else {\n if (this._state == null) {\n this._state = {};\n }\n return this._state[key] = value;\n }\n };\n\n Tour.prototype._removeState = function(key) {\n var keyName;\n if (this._options.storage) {\n keyName = \"\" + this._options.name + \"_\" + key;\n this._options.storage.removeItem(keyName);\n return this._options.afterRemoveState(keyName);\n } else {\n if (this._state != null) {\n return delete this._state[key];\n }\n }\n };\n\n Tour.prototype._getState = function(key) {\n var keyName, value;\n if (this._options.storage) {\n keyName = \"\" + this._options.name + \"_\" + key;\n value = this._options.storage.getItem(keyName);\n } else {\n if (this._state != null) {\n value = this._state[key];\n }\n }\n if (value === void 0 || value === 'null') {\n value = null;\n }\n this._options.afterGetState(key, value);\n return value;\n };\n\n Tour.prototype._showNextStep = function() {\n var promise, showNextStepHelper, step;\n step = this.getStep(this._current);\n showNextStepHelper = (function(_this) {\n return function(e) {\n return _this.showStep(step.next);\n };\n })(this);\n promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0);\n return this._callOnPromiseDone(promise, showNextStepHelper);\n };\n\n Tour.prototype._showPrevStep = function() {\n var promise, showPrevStepHelper, step;\n step = this.getStep(this._current);\n showPrevStepHelper = (function(_this) {\n return function(e) {\n return _this.showStep(step.prev);\n };\n })(this);\n promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0);\n return this._callOnPromiseDone(promise, showPrevStepHelper);\n };\n\n Tour.prototype._debug = function(text) {\n if (this._options.debug) {\n return window.console.log(\"Bootstrap Tour '\" + this._options.name + \"' | \" + text);\n }\n };\n\n Tour.prototype._isRedirect = function(host, path, location) {\n var currentPath;\n if (host !== '') {\n if (this._isHostDifferent(host, location.href)) {\n return true;\n }\n }\n currentPath = [location.pathname, location.search, location.hash].join('');\n return (path != null) && path !== '' && (({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath)) || ({}.toString.call(path) === '[object String]' && this._isPathDifferent(path, currentPath)));\n };\n\n Tour.prototype._isHostDifferent = function(host, currentURL) {\n return this._getProtocol(host) !== this._getProtocol(currentURL) || this._getHost(host) !== this._getHost(currentURL);\n };\n\n Tour.prototype._isPathDifferent = function(path, currentPath) {\n return this._getPath(path) !== this._getPath(currentPath) || !this._equal(this._getQuery(path), this._getQuery(currentPath)) || !this._equal(this._getHash(path), this._getHash(currentPath));\n };\n\n Tour.prototype._isJustPathHashDifferent = function(host, path, location) {\n var currentPath;\n if (host !== '') {\n if (this._isHostDifferent(host, location.href)) {\n return false;\n }\n }\n currentPath = [location.pathname, location.search, location.hash].join('');\n if ({}.toString.call(path) === '[object String]') {\n return this._getPath(path) === this._getPath(currentPath) && this._equal(this._getQuery(path), this._getQuery(currentPath)) && !this._equal(this._getHash(path), this._getHash(currentPath));\n }\n return false;\n };\n\n Tour.prototype._redirect = function(step, i, path) {\n if ($.isFunction(step.redirect)) {\n return step.redirect.call(this, path);\n } else if (step.redirect === true) {\n this._debug(\"Redirect to \" + step.host + path);\n if (this._getState('redirect_to') === (\"\" + i)) {\n this._debug(\"Error redirection loop to \" + path);\n this._removeState('redirect_to');\n if (step.onRedirectError != null) {\n return step.onRedirectError(this);\n }\n } else {\n this._setState('redirect_to', \"\" + i);\n return document.location.href = \"\" + step.host + path;\n }\n }\n };\n\n Tour.prototype._isOrphan = function(step) {\n return (step.element == null) || !$(step.element).length || $(step.element).is(':hidden') && ($(step.element)[0].namespaceURI !== 'http://www.w3.org/2000/svg');\n };\n\n Tour.prototype._isLast = function() {\n return this._current < this._options.steps.length - 1;\n };\n\n Tour.prototype._showPopover = function(step, i) {\n var $element, $tip, isOrphan, options, shouldAddSmart;\n $(\".tour-\" + this._options.name).remove();\n options = $.extend({}, this._options);\n isOrphan = this._isOrphan(step);\n step.template = this._template(step, i);\n if (isOrphan) {\n step.element = 'body';\n step.placement = 'top';\n }\n $element = $(step.element);\n $element.addClass(\"tour-\" + this._options.name + \"-element tour-\" + this._options.name + \"-\" + i + \"-element\");\n if (step.options) {\n $.extend(options, step.options);\n }\n if (step.reflex && !isOrphan) {\n $(step.reflexElement).addClass('tour-step-element-reflex').off(\"\" + (this._reflexEvent(step.reflex)) + \".tour-\" + this._options.name).on(\"\" + (this._reflexEvent(step.reflex)) + \".tour-\" + this._options.name, (function(_this) {\n return function() {\n if (_this._isLast()) {\n return _this.next();\n } else {\n return _this.end();\n }\n };\n })(this));\n }\n shouldAddSmart = step.smartPlacement === true && step.placement.search(/auto/i) === -1;\n $element.popover({\n placement: shouldAddSmart ? \"auto \" + step.placement : step.placement,\n trigger: 'manual',\n title: step.title,\n content: step.content,\n html: true,\n animation: step.animation,\n container: step.container,\n template: step.template,\n selector: step.element\n }).popover('show');\n $tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();\n $tip.attr('id', step.id);\n this._reposition($tip, step);\n if (isOrphan) {\n return this._center($tip);\n }\n };\n\n Tour.prototype._template = function(step, i) {\n var $navigation, $next, $prev, $resume, $template, template;\n template = step.template;\n if (this._isOrphan(step) && {}.toString.call(step.orphan) !== '[object Boolean]') {\n template = step.orphan;\n }\n $template = $.isFunction(template) ? $(template(i, step)) : $(template);\n $navigation = $template.find('.popover-navigation');\n $prev = $navigation.find('[data-role=\"prev\"]');\n $next = $navigation.find('[data-role=\"next\"]');\n $resume = $navigation.find('[data-role=\"pause-resume\"]');\n if (this._isOrphan(step)) {\n $template.addClass('orphan');\n }\n $template.addClass(\"tour-\" + this._options.name + \" tour-\" + this._options.name + \"-\" + i);\n if (step.reflex) {\n $template.addClass(\"tour-\" + this._options.name + \"-reflex\");\n }\n if (step.prev < 0) {\n $prev.addClass('disabled');\n $prev.prop('disabled', true);\n }\n if (step.next < 0) {\n $next.addClass('disabled');\n $next.prop('disabled', true);\n }\n if (!step.duration) {\n $resume.remove();\n }\n return $template.clone().wrap('
                                                                ').parent().html();\n };\n\n Tour.prototype._reflexEvent = function(reflex) {\n if ({}.toString.call(reflex) === '[object Boolean]') {\n return 'click';\n } else {\n return reflex;\n }\n };\n\n Tour.prototype._reposition = function($tip, step) {\n var offsetBottom, offsetHeight, offsetRight, offsetWidth, originalLeft, originalTop, tipOffset;\n offsetWidth = $tip[0].offsetWidth;\n offsetHeight = $tip[0].offsetHeight;\n tipOffset = $tip.offset();\n originalLeft = tipOffset.left;\n originalTop = tipOffset.top;\n offsetBottom = $(document).outerHeight() - tipOffset.top - $tip.outerHeight();\n if (offsetBottom < 0) {\n tipOffset.top = tipOffset.top + offsetBottom;\n }\n offsetRight = $('html').outerWidth() - tipOffset.left - $tip.outerWidth();\n if (offsetRight < 0) {\n tipOffset.left = tipOffset.left + offsetRight;\n }\n if (tipOffset.top < 0) {\n tipOffset.top = 0;\n }\n if (tipOffset.left < 0) {\n tipOffset.left = 0;\n }\n $tip.offset(tipOffset);\n if (step.placement === 'bottom' || step.placement === 'top') {\n if (originalLeft !== tipOffset.left) {\n return this._replaceArrow($tip, (tipOffset.left - originalLeft) * 2, offsetWidth, 'left');\n }\n } else {\n if (originalTop !== tipOffset.top) {\n return this._replaceArrow($tip, (tipOffset.top - originalTop) * 2, offsetHeight, 'top');\n }\n }\n };\n\n Tour.prototype._center = function($tip) {\n return $tip.css('top', $(window).outerHeight() / 2 - $tip.outerHeight() / 2);\n };\n\n Tour.prototype._replaceArrow = function($tip, delta, dimension, position) {\n return $tip.find('.arrow').css(position, delta ? 50 * (1 - delta / dimension) + '%' : '');\n };\n\n Tour.prototype._scrollIntoView = function(element, callback) {\n var $element, $window, counter, offsetTop, scrollTop, windowHeight;\n $element = $(element);\n if (!$element.length) {\n return callback();\n }\n $window = $(window);\n offsetTop = $element.offset().top;\n windowHeight = $window.height();\n scrollTop = Math.max(0, offsetTop - (windowHeight / 2));\n this._debug(\"Scroll into view. ScrollTop: \" + scrollTop + \". Element offset: \" + offsetTop + \". Window height: \" + windowHeight + \".\");\n counter = 0;\n return $('body, html').stop(true, true).animate({\n scrollTop: Math.ceil(scrollTop)\n }, (function(_this) {\n return function() {\n if (++counter === 2) {\n callback();\n return _this._debug(\"Scroll into view.\\nAnimation end element offset: \" + ($element.offset().top) + \".\\nWindow height: \" + ($window.height()) + \".\");\n }\n };\n })(this));\n };\n\n Tour.prototype._onResize = function(callback, timeout) {\n return $(window).on(\"resize.tour-\" + this._options.name, function() {\n clearTimeout(timeout);\n return timeout = setTimeout(callback, 100);\n });\n };\n\n Tour.prototype._initMouseNavigation = function() {\n var _this;\n _this = this;\n return $(document).off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\").off(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\").on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='next']\", (function(_this) {\n return function(e) {\n e.preventDefault();\n return _this.next();\n };\n })(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='prev']\", (function(_this) {\n return function(e) {\n e.preventDefault();\n return _this.prev();\n };\n })(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='end']\", (function(_this) {\n return function(e) {\n e.preventDefault();\n return _this.end();\n };\n })(this)).on(\"click.tour-\" + this._options.name, \".popover.tour-\" + this._options.name + \" *[data-role='pause-resume']\", function(e) {\n var $this;\n e.preventDefault();\n $this = $(this);\n $this.text(_this._paused ? $this.data('pause-text') : $this.data('resume-text'));\n if (_this._paused) {\n return _this.resume();\n } else {\n return _this.pause();\n }\n });\n };\n\n Tour.prototype._initKeyboardNavigation = function() {\n if (!this._options.keyboard) {\n return;\n }\n return $(document).on(\"keyup.tour-\" + this._options.name, (function(_this) {\n return function(e) {\n if (!e.which) {\n return;\n }\n switch (e.which) {\n case 39:\n e.preventDefault();\n if (_this._isLast()) {\n return _this.next();\n } else {\n return _this.end();\n }\n break;\n case 37:\n e.preventDefault();\n if (_this._current > 0) {\n return _this.prev();\n }\n break;\n case 27:\n e.preventDefault();\n return _this.end();\n }\n };\n })(this));\n };\n\n Tour.prototype._makePromise = function(result) {\n if (result && $.isFunction(result.then)) {\n return result;\n } else {\n return null;\n }\n };\n\n Tour.prototype._callOnPromiseDone = function(promise, cb, arg) {\n if (promise) {\n return promise.then((function(_this) {\n return function(e) {\n return cb.call(_this, arg);\n };\n })(this));\n } else {\n return cb.call(this, arg);\n }\n };\n\n Tour.prototype._showBackdrop = function(step) {\n if (this.backdrop.backgroundShown) {\n return;\n }\n this.backdrop = $('
                                                                ', {\n \"class\": 'tour-backdrop'\n });\n this.backdrop.backgroundShown = true;\n return $(step.backdropContainer).append(this.backdrop);\n };\n\n Tour.prototype._hideBackdrop = function() {\n this._hideOverlayElement();\n return this._hideBackground();\n };\n\n Tour.prototype._hideBackground = function() {\n if (this.backdrop) {\n this.backdrop.remove();\n this.backdrop.overlay = null;\n return this.backdrop.backgroundShown = false;\n }\n };\n\n Tour.prototype._showOverlayElement = function(step, force) {\n var $element, elementData;\n $element = $(step.element);\n if (!$element || $element.length === 0 || this.backdrop.overlayElementShown && !force) {\n return;\n }\n if (!this.backdrop.overlayElementShown) {\n this.backdrop.$element = $element.addClass('tour-step-backdrop');\n this.backdrop.$background = $('
                                                                ', {\n \"class\": 'tour-step-background'\n });\n this.backdrop.$background.appendTo(step.backdropContainer);\n this.backdrop.overlayElementShown = true;\n }\n elementData = {\n width: $element.innerWidth(),\n height: $element.innerHeight(),\n offset: $element.offset()\n };\n if (step.backdropPadding) {\n elementData = this._applyBackdropPadding(step.backdropPadding, elementData);\n }\n return this.backdrop.$background.width(elementData.width).height(elementData.height).offset(elementData.offset);\n };\n\n Tour.prototype._hideOverlayElement = function() {\n if (!this.backdrop.overlayElementShown) {\n return;\n }\n this.backdrop.$element.removeClass('tour-step-backdrop');\n this.backdrop.$background.remove();\n this.backdrop.$element = null;\n this.backdrop.$background = null;\n return this.backdrop.overlayElementShown = false;\n };\n\n Tour.prototype._applyBackdropPadding = function(padding, data) {\n if (typeof padding === 'object') {\n if (padding.top == null) {\n padding.top = 0;\n }\n if (padding.right == null) {\n padding.right = 0;\n }\n if (padding.bottom == null) {\n padding.bottom = 0;\n }\n if (padding.left == null) {\n padding.left = 0;\n }\n data.offset.top = data.offset.top - padding.top;\n data.offset.left = data.offset.left - padding.left;\n data.width = data.width + padding.left + padding.right;\n data.height = data.height + padding.top + padding.bottom;\n } else {\n data.offset.top = data.offset.top - padding;\n data.offset.left = data.offset.left - padding;\n data.width = data.width + (padding * 2);\n data.height = data.height + (padding * 2);\n }\n return data;\n };\n\n Tour.prototype._clearTimer = function() {\n window.clearTimeout(this._timer);\n this._timer = null;\n return this._duration = null;\n };\n\n Tour.prototype._getProtocol = function(url) {\n url = url.split('://');\n if (url.length > 1) {\n return url[0];\n } else {\n return 'http';\n }\n };\n\n Tour.prototype._getHost = function(url) {\n url = url.split('//');\n url = url.length > 1 ? url[1] : url[0];\n return url.split('/')[0];\n };\n\n Tour.prototype._getPath = function(path) {\n return path.replace(/\\/?$/, '').split('?')[0].split('#')[0];\n };\n\n Tour.prototype._getQuery = function(path) {\n return this._getParams(path, '?');\n };\n\n Tour.prototype._getHash = function(path) {\n return this._getParams(path, '#');\n };\n\n Tour.prototype._getParams = function(path, start) {\n var param, params, paramsObject, _i, _len;\n params = path.split(start);\n if (params.length === 1) {\n return {};\n }\n params = params[1].split('&');\n paramsObject = {};\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n param = params[_i];\n param = param.split('=');\n paramsObject[param[0]] = param[1] || '';\n }\n return paramsObject;\n };\n\n Tour.prototype._equal = function(obj1, obj2) {\n var k, v;\n if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') {\n for (k in obj1) {\n v = obj1[k];\n if (obj2[k] !== v) {\n return false;\n }\n }\n for (k in obj2) {\n v = obj2[k];\n if (obj1[k] !== v) {\n return false;\n }\n }\n return true;\n }\n return obj1 === obj2;\n };\n\n return Tour;\n\n })();\n return window.Tour = Tour;\n})(jQuery, window);\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/libs/bootstrap-tour.js","/*! jQuery UI - v1.9.1 - 2012-10-29\n* http://jqueryui.com\n* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.menu.js, jquery.ui.slider.js\n* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */\n\n(function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return\"area\"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!==\"map\"?!1:(o=e(\"img[usemap=#\"+i+\"]\")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:\"a\"===u?t.href||n:n)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().andSelf().filter(function(){return e.css(this,\"visibility\")===\"hidden\"}).length}var n=0,r=/^ui-id-\\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:\"1.9.1\",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t==\"number\"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.ui.ie&&/(static|relative)/.test(this.css(\"position\"))||/absolute/.test(this.css(\"position\"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,\"position\"))&&/(auto|scroll)/.test(e.css(this,\"overflow\")+e.css(this,\"overflow-y\")+e.css(this,\"overflow-x\"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,\"overflow\")+e.css(this,\"overflow-y\")+e.css(this,\"overflow-x\"))}).eq(0),/fixed/.test(this.css(\"position\"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css(\"zIndex\",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css(\"position\");if(i===\"absolute\"||i===\"relative\"||i===\"fixed\"){s=parseInt(r.css(\"zIndex\"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id=\"ui-id-\"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr(\"id\")})}}),e(\"\").outerWidth(1).jquery||e.each([\"Width\",\"Height\"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,\"padding\"+this))||0,r&&(n-=parseFloat(e.css(t,\"border\"+this+\"Width\"))||0),s&&(n-=parseFloat(e.css(t,\"margin\"+this))||0)}),n}var i=r===\"Width\"?[\"Left\",\"Right\"]:[\"Top\",\"Bottom\"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn[\"inner\"+r]=function(n){return n===t?o[\"inner\"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+\"px\")})},e.fn[\"outer\"+r]=function(t,n){return typeof t!=\"number\"?o[\"outer\"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+\"px\")})}}),e.extend(e.expr[\":\"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,\"tabindex\")))},tabbable:function(t){var n=e.attr(t,\"tabindex\"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement(\"div\"));n.offsetHeight,e.extend(n.style,{minHeight:\"100px\",height:\"auto\",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart=\"onselectstart\"in n,t.removeChild(n).style.display=\"none\"}),function(){var t=/msie ([\\w.]+)/.exec(navigator.userAgent.toLowerCase())||[];e.ui.ie=t.length?!0:!1,e.ui.ie6=parseFloat(t[1],10)===6}(),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?\"selectstart\":\"mousedown\")+\".ui-disableSelection\",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(\".ui-disableSelection\")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e\",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace=\".\"+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetName,this),e.data(r,this.widgetFullName,this),this._on(this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger(\"create\",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr(\"aria-disabled\").removeClass(this.widgetFullName+\"-disabled \"+\"ui-state-disabled\"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass(\"ui-state-hover\"),this.focusable.removeClass(\"ui-state-focus\")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof n==\"string\"){i={},s=n.split(\".\"),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind(\"mousemove.\"+this.widgetName,this._mouseMoveDelegate).unbind(\"mouseup.\"+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+\".preventClickEvent\",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})})(jQuery);(function(e,t){function h(e,t,n){return[parseInt(e[0],10)*(l.test(e[0])?t/100:1),parseInt(e[1],10)*(l.test(e[1])?n/100:1)]}function p(t,n){return parseInt(e.css(t,n),10)||0}e.ui=e.ui||{};var n,r=Math.max,i=Math.abs,s=Math.round,o=/left|center|right/,u=/top|center|bottom/,a=/[\\+\\-]\\d+%?/,f=/^\\w+/,l=/%$/,c=e.fn.position;e.position={scrollbarWidth:function(){if(n!==t)return n;var r,i,s=e(\"
                                                                \"),o=s.children()[0];return e(\"body\").append(s),r=o.offsetWidth,s.css(\"overflow\",\"scroll\"),i=o.offsetWidth,r===i&&(i=s[0].clientWidth),s.remove(),n=r-i},getScrollInfo:function(t){var n=t.isWindow?\"\":t.element.css(\"overflow-x\"),r=t.isWindow?\"\":t.element.css(\"overflow-y\"),i=n===\"scroll\"||n===\"auto\"&&t.width0?\"right\":\"center\",vertical:u<0?\"top\":o>0?\"bottom\":\"middle\"};lr(i(o),i(u))?h.important=\"horizontal\":h.important=\"vertical\",t.using.call(this,e,h)}),a.offset(e.extend(C,{using:u}))})},e.ui.position={fit:{left:function(e,t){var n=t.within,i=n.isWindow?n.scrollLeft:n.offset.left,s=n.width,o=e.left-t.collisionPosition.marginLeft,u=i-o,a=o+t.collisionWidth-s-i,f;t.collisionWidth>s?u>0&&a<=0?(f=e.left+u+t.collisionWidth-s-i,e.left+=u-f):a>0&&u<=0?e.left=i:u>a?e.left=i+s-t.collisionWidth:e.left=i:u>0?e.left+=u:a>0?e.left-=a:e.left=r(e.left-o,e.left)},top:function(e,t){var n=t.within,i=n.isWindow?n.scrollTop:n.offset.top,s=t.within.height,o=e.top-t.collisionPosition.marginTop,u=i-o,a=o+t.collisionHeight-s-i,f;t.collisionHeight>s?u>0&&a<=0?(f=e.top+u+t.collisionHeight-s-i,e.top+=u-f):a>0&&u<=0?e.top=i:u>a?e.top=i+s-t.collisionHeight:e.top=i:u>0?e.top+=u:a>0?e.top-=a:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var n=t.within,r=n.offset.left+n.scrollLeft,s=n.width,o=n.isWindow?n.scrollLeft:n.offset.left,u=e.left-t.collisionPosition.marginLeft,a=u-o,f=u+t.collisionWidth-s-o,l=t.my[0]===\"left\"?-t.elemWidth:t.my[0]===\"right\"?t.elemWidth:0,c=t.at[0]===\"left\"?t.targetWidth:t.at[0]===\"right\"?-t.targetWidth:0,h=-2*t.offset[0],p,d;if(a<0){p=e.left+l+c+h+t.collisionWidth-s-r;if(p<0||p0){d=e.left-t.collisionPosition.marginLeft+l+c+h-o;if(d>0||i(d)a&&(v<0||v0&&(d=e.top-t.collisionPosition.marginTop+c+h+p-o,e.top+c+h+p>f&&(d>0||i(d)10&&i<11,t.innerHTML=\"\",n.removeChild(t)}(),e.uiBackCompat!==!1&&function(e){var n=e.fn.position;e.fn.position=function(r){if(!r||!r.offset)return n.call(this,r);var i=r.offset.split(\" \"),s=r.at.split(\" \");return i.length===1&&(i[1]=i[0]),/^\\d/.test(i[0])&&(i[0]=\"+\"+i[0]),/^\\d/.test(i[1])&&(i[1]=\"+\"+i[1]),s.length===1&&(/left|center|right/.test(s[0])?s[1]=\"center\":(s[1]=s[0],s[0]=\"center\")),n.call(this,e.extend(r,{at:s[0]+i[0]+\" \"+s[1]+i[1],offset:t}))}}(jQuery)})(jQuery);(function(e,t){var n=0;e.widget(\"ui.autocomplete\",{version:\"1.9.1\",defaultElement:\"\",options:{appendTo:\"body\",autoFocus:!1,delay:300,minLength:1,position:{my:\"left top\",at:\"left bottom\",collision:\"none\"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,n,r;this.isMultiLine=this._isMultiLine(),this.valueMethod=this.element[this.element.is(\"input,textarea\")?\"val\":\"text\"],this.isNewMenu=!0,this.element.addClass(\"ui-autocomplete-input\").attr(\"autocomplete\",\"off\"),this._on(this.element,{keydown:function(i){if(this.element.prop(\"readOnly\")){t=!0,r=!0,n=!0;return}t=!1,r=!1,n=!1;var s=e.ui.keyCode;switch(i.keyCode){case s.PAGE_UP:t=!0,this._move(\"previousPage\",i);break;case s.PAGE_DOWN:t=!0,this._move(\"nextPage\",i);break;case s.UP:t=!0,this._keyEvent(\"previous\",i);break;case s.DOWN:t=!0,this._keyEvent(\"next\",i);break;case s.ENTER:case s.NUMPAD_ENTER:this.menu.active&&(t=!0,i.preventDefault(),this.menu.select(i));break;case s.TAB:this.menu.active&&this.menu.select(i);break;case s.ESCAPE:this.menu.element.is(\":visible\")&&(this._value(this.term),this.close(i),i.preventDefault());break;default:n=!0,this._searchTimeout(i)}},keypress:function(r){if(t){t=!1,r.preventDefault();return}if(n)return;var i=e.ui.keyCode;switch(r.keyCode){case i.PAGE_UP:this._move(\"previousPage\",r);break;case i.PAGE_DOWN:this._move(\"nextPage\",r);break;case i.UP:this._keyEvent(\"previous\",r);break;case i.DOWN:this._keyEvent(\"next\",r)}},input:function(e){if(r){r=!1,e.preventDefault();return}this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){if(this.cancelBlur){delete this.cancelBlur;return}clearTimeout(this.searching),this.close(e),this._change(e)}}),this._initSource(),this.menu=e(\"
                                                                  \").addClass(\"ui-autocomplete\").appendTo(this.document.find(this.options.appendTo||\"body\")[0]).menu({input:e(),role:null}).zIndex(this.element.zIndex()+1).hide().data(\"menu\"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var n=this.menu.element[0];e(t.target).closest(\".ui-menu-item\").length||this._delay(function(){var t=this;this.document.one(\"mousedown\",function(r){r.target!==t.element[0]&&r.target!==n&&!e.contains(n,r.target)&&t.close()})})},menufocus:function(t,n){if(this.isNewMenu){this.isNewMenu=!1;if(t.originalEvent&&/^mouse/.test(t.originalEvent.type)){this.menu.blur(),this.document.one(\"mousemove\",function(){e(t.target).trigger(t.originalEvent)});return}}var r=n.item.data(\"ui-autocomplete-item\")||n.item.data(\"item.autocomplete\");!1!==this._trigger(\"focus\",t,{item:r})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(r.value):this.liveRegion.text(r.value)},menuselect:function(e,t){var n=t.item.data(\"ui-autocomplete-item\")||t.item.data(\"item.autocomplete\"),r=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r,this.selectedItem=n})),!1!==this._trigger(\"select\",e,{item:n})&&this._value(n.value),this.term=this._value(),this.close(e),this.selectedItem=n}}),this.liveRegion=e(\"\",{role:\"status\",\"aria-live\":\"polite\"}).addClass(\"ui-helper-hidden-accessible\").insertAfter(this.element),e.fn.bgiframe&&this.menu.element.bgiframe(),this._on(this.window,{beforeunload:function(){this.element.removeAttr(\"autocomplete\")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass(\"ui-autocomplete-input\").removeAttr(\"autocomplete\"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),e===\"source\"&&this._initSource(),e===\"appendTo\"&&this.menu.element.appendTo(this.document.find(t||\"body\")[0]),e===\"disabled\"&&t&&this.xhr&&this.xhr.abort()},_isMultiLine:function(){return this.element.is(\"textarea\")?!0:this.element.is(\"input\")?!1:this.element.prop(\"isContentEditable\")},_initSource:function(){var t,n,r=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(n,r){r(e.ui.autocomplete.filter(t,n.term))}):typeof this.options.source==\"string\"?(n=this.options.source,this.source=function(t,i){r.xhr&&r.xhr.abort(),r.xhr=e.ajax({url:n,data:t,dataType:\"json\",success:function(e){i(e)},error:function(){i([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){e=e!=null?e:this._value(),this.term=this._value();if(e.length\").append(e(\"\").text(n.label)).appendTo(t)},_move:function(e,t){if(!this.menu.element.is(\":visible\")){this.search(null,t);return}if(this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)){this._value(this.term),this.menu.blur();return}this.menu[e](t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){if(!this.isMultiLine||this.menu.element.is(\":visible\"))this._move(e,t),t.preventDefault()}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g,\"\\\\$&\")},filter:function(t,n){var r=new RegExp(e.ui.autocomplete.escapeRegex(n),\"i\");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}}),e.widget(\"ui.autocomplete\",e.ui.autocomplete,{options:{messages:{noResults:\"No search results.\",results:function(e){return e+(e>1?\" results are\":\" result is\")+\" available, use up and down arrow keys to navigate.\"}}},__response:function(e){var t;this._superApply(arguments);if(this.options.disabled||this.cancelSearch)return;e&&e.length?t=this.options.messages.results(e.length):t=this.options.messages.noResults,this.liveRegion.text(t)}})})(jQuery);(function(e,t){var n,r,i,s,o=\"ui-button ui-widget ui-state-default ui-corner-all\",u=\"ui-state-hover ui-state-active \",a=\"ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only\",f=function(){var t=e(this).find(\":ui-button\");setTimeout(function(){t.button(\"refresh\")},1)},l=function(t){var n=t.name,r=t.form,i=e([]);return n&&(r?i=e(r).find(\"[name='\"+n+\"']\"):i=e(\"[name='\"+n+\"']\",t.ownerDocument).filter(function(){return!this.form})),i};e.widget(\"ui.button\",{version:\"1.9.1\",defaultElement:\"