diff --git a/client/galaxy/scripts/mvc/tool/tool-form-base.js b/client/galaxy/scripts/mvc/tool/tool-form-base.js index 6b577b0a7a65..3b5746c83855 100644 --- a/client/galaxy/scripts/mvc/tool/tool-form-base.js +++ b/client/galaxy/scripts/mvc/tool/tool-form-base.js @@ -16,12 +16,14 @@ define(['utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view', self._buildModel(process, options, true); }); } - // Listen to history panel + // listen to history panel if ( options.listen_to_history && parent.Galaxy && parent.Galaxy.currHistoryPanel ) { this.listenTo( parent.Galaxy.currHistoryPanel.collection, 'change', function() { this.refresh(); }); } + // destroy dom elements + this.$el.on( 'remove', function() { self.remove() } ); }, /** Listen to history panel changes and update the tool form */ diff --git a/client/galaxy/scripts/mvc/tool/tool-form.js b/client/galaxy/scripts/mvc/tool/tool-form.js index 0204b1573363..693f06174527 100644 --- a/client/galaxy/scripts/mvc/tool/tool-form.js +++ b/client/galaxy/scripts/mvc/tool/tool-form.js @@ -47,10 +47,6 @@ define([ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/ui/ui-modal', 'mvc/tool/tool-form this.$el.append( this.form.$el ); }, - remove: function() { - this.form.remove(); - }, - /** Submit a regular job. * @param{dict} options - Specifies tool id and version * @param{function} callback - Called when request has completed diff --git a/static/maps/mvc/tool/tool-form-base.js.map b/static/maps/mvc/tool/tool-form-base.js.map index fd7dca90b76e..a26a4e303c69 100644 --- a/static/maps/mvc/tool/tool-form-base.js.map +++ b/static/maps/mvc/tool/tool-form-base.js.map @@ -1 +1 @@ -{"version":3,"file":"tool-form-base.js","sources":["../../../src/mvc/tool/tool-form-base.js"],"names":["define","Utils","Deferred","Ui","FormBase","CitationModel","CitationView","extend","initialize","options","self","this","prototype","call","deferred","inputs","_buildForm","execute","process","_buildModel","listen_to_history","parent","Galaxy","currHistoryPanel","listenTo","collection","refresh","reset","_updateModel","remove","$el","hide","emit","debug","merge","icon","title","name","description","version","operations","hide_operations","_operations","onchange","customize","render","collapsible","append","$","addClass","_footer","hide_message","id","build_url","build_data","job_id","root","params","tool_id","get","url","data","success","new_model","tool_model","display","message","update","status","persistent","resolve","window","location","error","response","xhr","error_message","err_msg","param","redirect","is","prepend","Message","large","modal","show","body","buttons","Close","reject","model_url","update_url","current_state","tool_version","create","wait","request","type","versions_button","ButtonMenu","narrow","tooltip","sustain_version","versions","length","i","addMenu","onclick","replace","menu_button","biostar_url","open","prompt","origin","user","href","requirements","visible","portlet","collapsed","expand","_templateRequirements","sharable_url","menu","_templateHelp","citations","$citations","ToolCitationCollection","citation_list_view","CitationListView","el","fetch","$tmpl","help","find","attr","nreq","requirements_message","_","each","req","requirements_link","text"],"mappings":"AAGAA,QAAQ,cAAe,iBAAkB,iBAAkB,qBACnD,8BAA+B,8BACnC,SAASC,EAAOC,EAAUC,EAAIC,EAAUC,EAAeC,GACvD,MAAOF,GAASG,QACZC,WAAY,SAASC,GACjB,GAAIC,GAAOC,IACXP,GAASQ,UAAUJ,WAAWK,KAAKF,KAAMF,GACzCE,KAAKG,SAAW,GAAIZ,GAChBO,EAAQM,OACRJ,KAAKK,WAAWP,GAEhBE,KAAKG,SAASG,QAAQ,SAASC,GAC3BR,EAAKS,YAAYD,EAAST,GAAS,KAItCA,EAAQW,mBAAqBC,OAAOC,QAAUD,OAAOC,OAAOC,kBAC7DZ,KAAKa,SAAUH,OAAOC,OAAOC,iBAAiBE,WAAY,SAAU,WAChEd,KAAKe,aAMjBA,QAAS,WACL,GAAIhB,GAAOC,IACXD,GAAKI,SAASa,QACdhB,KAAKG,SAASG,QAAS,SAAUC,GAC7BR,EAAKkB,aAAcV,MAK3BW,OAAQ,WACJ,GAAInB,GAAOC,IACXA,MAAKmB,IAAIC,OACTpB,KAAKG,SAASG,QAAQ,WAClBb,EAASQ,UAAUiB,OAAOhB,KAAKH,GAC/BY,OAAOU,KAAKC,MAAM,2BAA4B,oBAKtDjB,WAAY,SAASP,GACjB,GAAIC,GAAOC,IACXA,MAAKF,QAAUR,EAAMiC,MAAMzB,EAASE,KAAKF,SACzCE,KAAKF,QAAUR,EAAMiC,OACjBC,KAAkB1B,EAAQ0B,KAC1BC,MAAkB,MAAQ3B,EAAQ4B,KAAO,QAAU5B,EAAQ6B,YAAc,oBAAsB7B,EAAQ8B,QAAU,IACjHC,YAAmB7B,KAAKF,QAAQgC,iBAAmB9B,KAAK+B,cACxDC,SAAkB,WACdjC,EAAKgB,YAEVf,KAAKF,SACRE,KAAKF,QAAQmC,WAAajC,KAAKF,QAAQmC,UAAWjC,KAAKF,SACvDE,KAAKkC,SACClC,KAAKF,QAAQqC,aACfnC,KAAKmB,IAAIiB,OAAQC,EAAG,UAAWC,SAAU,uBAAwBF,OAAQpC,KAAKuC,aAMtF/B,YAAa,SAASD,EAAST,EAAS0C,GACpC,GAAIzC,GAAOC,IACXA,MAAKF,QAAQ2C,GAAK3C,EAAQ2C,GAC1BzC,KAAKF,QAAQ8B,QAAU9B,EAAQ8B,OAG/B,IAAIc,GAAY,GACZC,IACC7C,GAAQ8C,OACTF,EAAY/B,OAAOkC,KAAO,YAAc/C,EAAQ8C,OAAS,oBAEzDF,EAAY/B,OAAOkC,KAAO,aAAe/C,EAAQ2C,GAAK,SACjD9B,OAAOmC,QAAUnC,OAAOmC,OAAOC,SAAWjD,EAAQ2C,KACnDE,EAAaN,EAAEzC,UAAYe,OAAOmC,QAClChD,EAAQ8B,UAAae,EAA2B,aAAI7C,EAAQ8B,WAKpEtC,EAAM0D,KACFC,IAAUP,EACVQ,KAAUP,EACVQ,QAAU,SAASC,GAEf,MADAA,GAAYA,EAAUC,YAAcD,EAC/BA,EAAUE,SAIfvD,EAAKM,WAAW+C,IACfZ,GAAgBzC,EAAKwD,QAAQC,QAC1BC,OAAc,UACdF,QAAc,sBAAyBxD,EAAKD,QAAQ4B,KAAO,aAAgB3B,EAAKD,QAAQ8B,QAAU,SAAY7B,EAAKD,QAAQ2C,GAAK,KAChIiB,YAAc,IAElB/C,OAAOU,KAAKC,MAAM,+BAAgC,4BAA6B8B,OAC/E7C,GAAQoD,gBAVJC,OAAOC,SAAWlD,OAAOkC,OAYjCiB,MAAU,SAASC,EAAUC,GACzB,GAAIC,GAAkBF,GAAYA,EAASG,SAAa,iBACrC,MAAdF,EAAIP,OACLG,OAAOC,SAAWlD,OAAOkC,KAAO,cAAgBR,EAAE8B,OAAQC,SAAWzD,OAAOkC,KAAO,YAAc9C,EAAKD,QAAQ2C,KACtG1C,EAAKoB,IAAIkD,GAAG,UACpBtE,EAAKoB,IAAImD,QAAQ,GAAK9E,GAAG+E,SACrBhB,QAAcU,EACdR,OAAc,SACdC,YAAc,EACdc,OAAc,IACdrD,KAEJR,OAAO8D,OAAS9D,OAAO8D,MAAMC,MACzBjD,MAAU,sBACVkD,KAAUV,EACVW,SACIC,MAAU,WACNlE,OAAO8D,MAAMrD,WAK7BT,OAAOU,KAAKC,MAAM,0BAA2B,qCAAsCyC,GACnFxD,EAAQuE,aAOpB7D,aAAc,SAASV,GAEnB,GAAIR,GAAOC,KACP+E,EAAY/E,KAAKF,QAAQkF,YAAcrE,OAAOkC,KAAO,aAAe7C,KAAKF,QAAQ2C,GAAK,SACtFwC,GACAlC,QAAkB/C,KAAKF,QAAQ2C,GAC/ByC,aAAkBlF,KAAKF,QAAQ8B,QAC/BxB,OAAkBiC,EAAEzC,QAAO,KAAUG,EAAKmD,KAAKiC,UAEnDnF,MAAKoF,MAAK,GAGVzE,OAAOU,KAAKC,MAAM,iCAAkC,yBAA0B2D,GAG9E3F,EAAM+F,SACFC,KAAU,OACVrC,IAAU8B,EACV7B,KAAU+B,EACV9B,QAAU,SAASC,GACfrD,EAAKyD,OAAOJ,EAAsB,YAAKA,GACvCrD,EAAKD,QAAQ0D,QAAUzD,EAAKD,QAAQ0D,OAAOJ,GAC3CrD,EAAKqF,MAAK,GACVzE,OAAOU,KAAKC,MAAM,iCAAkC,sBAAuB8B,GAC3E7C,EAAQoD,WAEZG,MAAU,SAASC,GACfpD,OAAOU,KAAKC,MAAM,iCAAkC,0BAA2ByC,GAC/ExD,EAAQuE,aAOpB/C,YAAa,WACT,GAAIhC,GAAOC,KACPF,EAAUE,KAAKF,QAGfyF,EAAkB,GAAI/F,GAAGgG,YACzBhE,KAAU,WACVC,OAAY3B,EAAQ2F,QAAU,YAAe,KAC7CC,QAAU,+BAEd,KAAK5F,EAAQ6F,iBAAmB7F,EAAQ8F,UAAY9F,EAAQ8F,SAASC,OAAS,EAC1E,IAAK,GAAIC,KAAKhG,GAAQ8F,SAAU,CAC5B,GAAIhE,GAAU9B,EAAQ8F,SAASE,EAC3BlE,IAAW9B,EAAQ8B,SACnB2D,EAAgBQ,SACZtE,MAAU,aAAeG,EACzBA,QAAUA,EACVJ,KAAU,UACVwE,QAAU,WAEN,GAAIvD,GAAK3C,EAAQ2C,GAAGwD,QAAQnG,EAAQ8B,QAAS5B,KAAK4B,SAC9CA,EAAU5B,KAAK4B,OAEnB7B,GAAKI,SAASa,QACdjB,EAAKI,SAASG,QAAQ,SAASC,GAC3BR,EAAKS,YAAYD,GAAUkC,GAAIA,EAAIb,QAASA,aAOhE2D,GAAgBpE,IAAIC,MAIxB,IAAI8E,GAAc,GAAI1G,GAAGgG,YACrBhE,KAAU,gBACVC,OAAY3B,EAAQ2F,QAAU,WAAc,KAC5CC,QAAU,0BA8Ed,OA5EG5F,GAAQqG,cACPD,EAAYH,SACRvE,KAAU,qBACVC,MAAU,YACViE,QAAU,2CACVM,QAAU,WACNpC,OAAOwC,KAAKtG,EAAQqG,YAAc,mBAG1CD,EAAYH,SACRvE,KAAU,YACVC,MAAU,SACViE,QAAU,sCACVM,QAAU,WACNpC,OAAOwC,KAAKtG,EAAQqG,YAAc,yBAA2BrG,EAAQ4B,UAIjFwE,EAAYH,SACRvE,KAAU,WACVC,MAAU,QACViE,QAAU,kBACVM,QAAU,WACNK,OAAO,mCAAoCzC,OAAOC,SAASyC,OAAS3F,OAAOkC,KAAO,gBAAkB/C,EAAQ2C,OAKhH9B,OAAO4F,MAAQ5F,OAAO4F,KAAKvD,IAAI,aAC/BkD,EAAYH,SACRvE,KAAU,cACVC,MAAU,WACViE,QAAU,qBACVM,QAAU,WACNpC,OAAOC,SAAS2C,KAAO7F,OAAOkC,KAAO,aAAe/C,EAAQ2C,GAAK,eAMzE3C,EAAQ2G,cAAgB3G,EAAQ2G,aAAaZ,OAAS,GACtDK,EAAYH,SACRvE,KAAU,iBACVC,MAAU,eACViE,QAAU,4BACVM,QAAU,YACDhG,KAAK0G,SAAW3G,EAAK4G,QAAQC,WAC9B5G,KAAK0G,SAAU,EACf3G,EAAK4G,QAAQE,SACb9G,EAAKwD,QAAQC,QACTE,YAAc,EACdH,QAAcxD,EAAK+G,sBAAsBhH,GACzC2D,OAAc,WAGlBzD,KAAK0G,SAAU,EACf3G,EAAKwD,QAAQC,QACTD,QAAc,SAQ9BzD,EAAQiH,cACRb,EAAYH,SACRvE,KAAU,mBACVC,MAAU,mBACViE,QAAU,wBACVM,QAAU,WACNpC,OAAOwC,KAAKtG,EAAQiH,kBAM5BC,KAAcd,EACdN,SAAcL,IAMtBhD,QAAS,WACL,GAAIzC,GAAUE,KAAKF,QACfqB,EAAMkB,EAAG,UAAWD,OAAQpC,KAAKiH,cAAenH,GACpD,IAAKA,EAAQoH,UAAY,CACrB,GAAIC,GAAa9E,EAAG,UAChB6E,EAAY,GAAIxH,GAAc0H,sBAClCF,GAAUnE,QAAUjD,EAAQ2C,EAC5B,IAAI4E,GAAqB,GAAI1H,GAAa2H,kBAAmBC,GAAIJ,EAAYrG,WAAYoG,GACzFG,GAAmBnF,SACnBgF,EAAUM,QACVrG,EAAIiB,OAAQ+E,GAEhB,MAAOhG,IAKX8F,cAAe,SAAUnH,GACrB,GAAI2H,GAAQpF,EAAG,UAAWC,SAAU,gBAAiBF,OAAQtC,EAAQ4H,KAErE,OADAD,GAAME,KAAM,KAAMC,KAAM,SAAU,UAC3BH,GAGXX,sBAAuB,SAAUhH,GAC7B,GAAI+H,GAAO/H,EAAQ2G,aAAaZ,MAChC,IAAKgC,EAAO,EAAI,CACZ,GAAIC,GAAuB,qBAC3BC,GAAEC,KAAMlI,EAAQ2G,aAAc,SAAUwB,EAAKnC,GACzCgC,GAAwBG,EAAIvG,MAASuG,EAAIrG,QAAU,aAAeqG,EAAIrG,QAAU,IAAM,KAAaiG,EAAO,EAAX/B,EAAe,KAASA,GAAK+B,EAAO,EAAI,QAAU,KAErJ,IAAIK,GAAoB7F,EAAG,QAASuF,KAAM,SAAU,UAAWA,KAAM,OAAQ,qDAAsDO,KAAM,OACzI,OAAO9F,GAAG,WAAYD,OAAQ0F,EAAuB,YAAa1F,OAAQ8F,GAAoB9F,OAAQ,0BAE1G,MAAO"} \ No newline at end of file +{"version":3,"file":"tool-form-base.js","sources":["../../../src/mvc/tool/tool-form-base.js"],"names":["define","Utils","Deferred","Ui","FormBase","CitationModel","CitationView","extend","initialize","options","self","this","prototype","call","deferred","inputs","_buildForm","execute","process","_buildModel","listen_to_history","parent","Galaxy","currHistoryPanel","listenTo","collection","refresh","$el","on","remove","reset","_updateModel","hide","emit","debug","merge","icon","title","name","description","version","operations","hide_operations","_operations","onchange","customize","render","collapsible","append","$","addClass","_footer","hide_message","id","build_url","build_data","job_id","root","params","tool_id","get","url","data","success","new_model","tool_model","display","message","update","status","persistent","resolve","window","location","error","response","xhr","error_message","err_msg","param","redirect","is","prepend","Message","large","modal","show","body","buttons","Close","reject","model_url","update_url","current_state","tool_version","create","wait","request","type","versions_button","ButtonMenu","narrow","tooltip","sustain_version","versions","length","i","addMenu","onclick","replace","menu_button","biostar_url","open","prompt","origin","user","href","requirements","visible","portlet","collapsed","expand","_templateRequirements","sharable_url","menu","_templateHelp","citations","$citations","ToolCitationCollection","citation_list_view","CitationListView","el","fetch","$tmpl","help","find","attr","nreq","requirements_message","_","each","req","requirements_link","text"],"mappings":"AAGAA,QAAQ,cAAe,iBAAkB,iBAAkB,qBACnD,8BAA+B,8BACnC,SAASC,EAAOC,EAAUC,EAAIC,EAAUC,EAAeC,GACvD,MAAOF,GAASG,QACZC,WAAY,SAASC,GACjB,GAAIC,GAAOC,IACXP,GAASQ,UAAUJ,WAAWK,KAAKF,KAAMF,GACzCE,KAAKG,SAAW,GAAIZ,GAChBO,EAAQM,OACRJ,KAAKK,WAAWP,GAEhBE,KAAKG,SAASG,QAAQ,SAASC,GAC3BR,EAAKS,YAAYD,EAAST,GAAS,KAItCA,EAAQW,mBAAqBC,OAAOC,QAAUD,OAAOC,OAAOC,kBAC7DZ,KAAKa,SAAUH,OAAOC,OAAOC,iBAAiBE,WAAY,SAAU,WAChEd,KAAKe,YAIbf,KAAKgB,IAAIC,GAAI,SAAU,WAAalB,EAAKmB,YAI7CH,QAAS,WACL,GAAIhB,GAAOC,IACXD,GAAKI,SAASgB,QACdnB,KAAKG,SAASG,QAAS,SAAUC,GAC7BR,EAAKqB,aAAcb,MAK3BW,OAAQ,WACJ,GAAInB,GAAOC,IACXA,MAAKgB,IAAIK,OACTrB,KAAKG,SAASG,QAAQ,WAClBb,EAASQ,UAAUiB,OAAOhB,KAAKH,GAC/BY,OAAOW,KAAKC,MAAM,2BAA4B,oBAKtDlB,WAAY,SAASP,GACjB,GAAIC,GAAOC,IACXA,MAAKF,QAAUR,EAAMkC,MAAM1B,EAASE,KAAKF,SACzCE,KAAKF,QAAUR,EAAMkC,OACjBC,KAAkB3B,EAAQ2B,KAC1BC,MAAkB,MAAQ5B,EAAQ6B,KAAO,QAAU7B,EAAQ8B,YAAc,oBAAsB9B,EAAQ+B,QAAU,IACjHC,YAAmB9B,KAAKF,QAAQiC,iBAAmB/B,KAAKgC,cACxDC,SAAkB,WACdlC,EAAKgB,YAEVf,KAAKF,SACRE,KAAKF,QAAQoC,WAAalC,KAAKF,QAAQoC,UAAWlC,KAAKF,SACvDE,KAAKmC,SACCnC,KAAKF,QAAQsC,aACfpC,KAAKgB,IAAIqB,OAAQC,EAAG,UAAWC,SAAU,uBAAwBF,OAAQrC,KAAKwC,aAMtFhC,YAAa,SAASD,EAAST,EAAS2C,GACpC,GAAI1C,GAAOC,IACXA,MAAKF,QAAQ4C,GAAK5C,EAAQ4C,GAC1B1C,KAAKF,QAAQ+B,QAAU/B,EAAQ+B,OAG/B,IAAIc,GAAY,GACZC,IACC9C,GAAQ+C,OACTF,EAAYhC,OAAOmC,KAAO,YAAchD,EAAQ+C,OAAS,oBAEzDF,EAAYhC,OAAOmC,KAAO,aAAehD,EAAQ4C,GAAK,SACjD/B,OAAOoC,QAAUpC,OAAOoC,OAAOC,SAAWlD,EAAQ4C,KACnDE,EAAaN,EAAE1C,UAAYe,OAAOoC,QAClCjD,EAAQ+B,UAAae,EAA2B,aAAI9C,EAAQ+B,WAKpEvC,EAAM2D,KACFC,IAAUP,EACVQ,KAAUP,EACVQ,QAAU,SAASC,GAEf,MADAA,GAAYA,EAAUC,YAAcD,EAC/BA,EAAUE,SAIfxD,EAAKM,WAAWgD,IACfZ,GAAgB1C,EAAKyD,QAAQC,QAC1BC,OAAc,UACdF,QAAc,sBAAyBzD,EAAKD,QAAQ6B,KAAO,aAAgB5B,EAAKD,QAAQ+B,QAAU,SAAY9B,EAAKD,QAAQ4C,GAAK,KAChIiB,YAAc,IAElBhD,OAAOW,KAAKC,MAAM,+BAAgC,4BAA6B8B,OAC/E9C,GAAQqD,gBAVJC,OAAOC,SAAWnD,OAAOmC,OAYjCiB,MAAU,SAASC,EAAUC,GACzB,GAAIC,GAAkBF,GAAYA,EAASG,SAAa,iBACrC,MAAdF,EAAIP,OACLG,OAAOC,SAAWnD,OAAOmC,KAAO,cAAgBR,EAAE8B,OAAQC,SAAW1D,OAAOmC,KAAO,YAAc/C,EAAKD,QAAQ4C,KACtG3C,EAAKiB,IAAIsD,GAAG,UACpBvE,EAAKiB,IAAIuD,QAAQ,GAAK/E,GAAGgF,SACrBhB,QAAcU,EACdR,OAAc,SACdC,YAAc,EACdc,OAAc,IACdzD,KAEJL,OAAO+D,OAAS/D,OAAO+D,MAAMC,MACzBjD,MAAU,sBACVkD,KAAUV,EACVW,SACIC,MAAU,WACNnE,OAAO+D,MAAMrD,WAK7BV,OAAOW,KAAKC,MAAM,0BAA2B,qCAAsCyC,GACnFzD,EAAQwE,aAOpB3D,aAAc,SAASb,GAEnB,GAAIR,GAAOC,KACPgF,EAAYhF,KAAKF,QAAQmF,YAActE,OAAOmC,KAAO,aAAe9C,KAAKF,QAAQ4C,GAAK,SACtFwC,GACAlC,QAAkBhD,KAAKF,QAAQ4C,GAC/ByC,aAAkBnF,KAAKF,QAAQ+B,QAC/BzB,OAAkBkC,EAAE1C,QAAO,KAAUG,EAAKoD,KAAKiC,UAEnDpF,MAAKqF,MAAK,GAGV1E,OAAOW,KAAKC,MAAM,iCAAkC,yBAA0B2D,GAG9E5F,EAAMgG,SACFC,KAAU,OACVrC,IAAU8B,EACV7B,KAAU+B,EACV9B,QAAU,SAASC,GACftD,EAAK0D,OAAOJ,EAAsB,YAAKA,GACvCtD,EAAKD,QAAQ2D,QAAU1D,EAAKD,QAAQ2D,OAAOJ,GAC3CtD,EAAKsF,MAAK,GACV1E,OAAOW,KAAKC,MAAM,iCAAkC,sBAAuB8B,GAC3E9C,EAAQqD,WAEZG,MAAU,SAASC,GACfrD,OAAOW,KAAKC,MAAM,iCAAkC,0BAA2ByC,GAC/EzD,EAAQwE,aAOpB/C,YAAa,WACT,GAAIjC,GAAOC,KACPF,EAAUE,KAAKF,QAGf0F,EAAkB,GAAIhG,GAAGiG,YACzBhE,KAAU,WACVC,OAAY5B,EAAQ4F,QAAU,YAAe,KAC7CC,QAAU,+BAEd,KAAK7F,EAAQ8F,iBAAmB9F,EAAQ+F,UAAY/F,EAAQ+F,SAASC,OAAS,EAC1E,IAAK,GAAIC,KAAKjG,GAAQ+F,SAAU,CAC5B,GAAIhE,GAAU/B,EAAQ+F,SAASE,EAC3BlE,IAAW/B,EAAQ+B,SACnB2D,EAAgBQ,SACZtE,MAAU,aAAeG,EACzBA,QAAUA,EACVJ,KAAU,UACVwE,QAAU,WAEN,GAAIvD,GAAK5C,EAAQ4C,GAAGwD,QAAQpG,EAAQ+B,QAAS7B,KAAK6B,SAC9CA,EAAU7B,KAAK6B,OAEnB9B,GAAKI,SAASgB,QACdpB,EAAKI,SAASG,QAAQ,SAASC,GAC3BR,EAAKS,YAAYD,GAAUmC,GAAIA,EAAIb,QAASA,aAOhE2D,GAAgBxE,IAAIK,MAIxB,IAAI8E,GAAc,GAAI3G,GAAGiG,YACrBhE,KAAU,gBACVC,OAAY5B,EAAQ4F,QAAU,WAAc,KAC5CC,QAAU,0BA8Ed,OA5EG7F,GAAQsG,cACPD,EAAYH,SACRvE,KAAU,qBACVC,MAAU,YACViE,QAAU,2CACVM,QAAU,WACNpC,OAAOwC,KAAKvG,EAAQsG,YAAc,mBAG1CD,EAAYH,SACRvE,KAAU,YACVC,MAAU,SACViE,QAAU,sCACVM,QAAU,WACNpC,OAAOwC,KAAKvG,EAAQsG,YAAc,yBAA2BtG,EAAQ6B,UAIjFwE,EAAYH,SACRvE,KAAU,WACVC,MAAU,QACViE,QAAU,kBACVM,QAAU,WACNK,OAAO,mCAAoCzC,OAAOC,SAASyC,OAAS5F,OAAOmC,KAAO,gBAAkBhD,EAAQ4C,OAKhH/B,OAAO6F,MAAQ7F,OAAO6F,KAAKvD,IAAI,aAC/BkD,EAAYH,SACRvE,KAAU,cACVC,MAAU,WACViE,QAAU,qBACVM,QAAU,WACNpC,OAAOC,SAAS2C,KAAO9F,OAAOmC,KAAO,aAAehD,EAAQ4C,GAAK,eAMzE5C,EAAQ4G,cAAgB5G,EAAQ4G,aAAaZ,OAAS,GACtDK,EAAYH,SACRvE,KAAU,iBACVC,MAAU,eACViE,QAAU,4BACVM,QAAU,YACDjG,KAAK2G,SAAW5G,EAAK6G,QAAQC,WAC9B7G,KAAK2G,SAAU,EACf5G,EAAK6G,QAAQE,SACb/G,EAAKyD,QAAQC,QACTE,YAAc,EACdH,QAAczD,EAAKgH,sBAAsBjH,GACzC4D,OAAc,WAGlB1D,KAAK2G,SAAU,EACf5G,EAAKyD,QAAQC,QACTD,QAAc,SAQ9B1D,EAAQkH,cACRb,EAAYH,SACRvE,KAAU,mBACVC,MAAU,mBACViE,QAAU,wBACVM,QAAU,WACNpC,OAAOwC,KAAKvG,EAAQkH,kBAM5BC,KAAcd,EACdN,SAAcL,IAMtBhD,QAAS,WACL,GAAI1C,GAAUE,KAAKF,QACfkB,EAAMsB,EAAG,UAAWD,OAAQrC,KAAKkH,cAAepH,GACpD,IAAKA,EAAQqH,UAAY,CACrB,GAAIC,GAAa9E,EAAG,UAChB6E,EAAY,GAAIzH,GAAc2H,sBAClCF,GAAUnE,QAAUlD,EAAQ4C,EAC5B,IAAI4E,GAAqB,GAAI3H,GAAa4H,kBAAmBC,GAAIJ,EAAYtG,WAAYqG,GACzFG,GAAmBnF,SACnBgF,EAAUM,QACVzG,EAAIqB,OAAQ+E,GAEhB,MAAOpG,IAKXkG,cAAe,SAAUpH,GACrB,GAAI4H,GAAQpF,EAAG,UAAWC,SAAU,gBAAiBF,OAAQvC,EAAQ6H,KAErE,OADAD,GAAME,KAAM,KAAMC,KAAM,SAAU,UAC3BH,GAGXX,sBAAuB,SAAUjH,GAC7B,GAAIgI,GAAOhI,EAAQ4G,aAAaZ,MAChC,IAAKgC,EAAO,EAAI,CACZ,GAAIC,GAAuB,qBAC3BC,GAAEC,KAAMnI,EAAQ4G,aAAc,SAAUwB,EAAKnC,GACzCgC,GAAwBG,EAAIvG,MAASuG,EAAIrG,QAAU,aAAeqG,EAAIrG,QAAU,IAAM,KAAaiG,EAAO,EAAX/B,EAAe,KAASA,GAAK+B,EAAO,EAAI,QAAU,KAErJ,IAAIK,GAAoB7F,EAAG,QAASuF,KAAM,SAAU,UAAWA,KAAM,OAAQ,qDAAsDO,KAAM,OACzI,OAAO9F,GAAG,WAAYD,OAAQ0F,EAAuB,YAAa1F,OAAQ8F,GAAoB9F,OAAQ,0BAE1G,MAAO"} \ No newline at end of file diff --git a/static/maps/mvc/tool/tool-form.js.map b/static/maps/mvc/tool/tool-form.js.map index ba3a2bac1efc..05dffe298657 100644 --- a/static/maps/mvc/tool/tool-form.js.map +++ b/static/maps/mvc/tool/tool-form.js.map @@ -1 +1 @@ -{"version":3,"file":"tool-form.js","sources":["../../../src/mvc/tool/tool-form.js"],"names":["define","Utils","Ui","Modal","ToolFormBase","View","Backbone","extend","initialize","options","self","this","modal","parent","Galaxy","form","merge","listen_to_history","always_refresh","customize","buttons","execute","execute_btn","Button","icon","tooltip","name","version","title","cls","floating","onclick","wait","portlet","disable","submit","unwait","enable","job_id","job_remap","inputs","label","type","display","ignore","value","help","deferred","setElement","$el","append","remove","callback","job_def","tool_id","id","tool_version","data","create","trigger","validate","emit","debug","action","root","$f","$","attr","method","enctype","_","each","key","hide","appendTo","request","url","success","response","children","_templateSuccess","currHistoryPanel","refreshContents","error","input_found","err_data","error_messages","matchResponse","input_id","highlight","show","body","err_msg","_templateError","Close","job_inputs","batch_n","batch_src","job_input_id","input_value","match","input_field","field_list","input_def","input_list","optional","batch","n","values","length","src","jobs","njobs","njobs_text","$message","addClass","text","outputs","output","hid","JSON","stringify"],"mappings":"AACAA,QAAS,cAAe,iBAAkB,kBAAmB,2BACzD,SAAUC,EAAOC,EAAIC,EAAOC,GAC5B,GAAIC,GAAOC,SAASD,KAAKE,QACrBC,WAAY,SAAUC,GAClB,GAAIC,GAAOC,IACXA,MAAKC,MAAQC,OAAOC,OAAOF,OAAS,GAAIT,GAAME,KAC9CM,KAAKI,KAAO,GAAIX,GAAcH,EAAMe,OAChCC,mBAAoB,EACpBC,gBAAoB,EACpBC,UAAoB,SAAUV,GAE1BA,EAAQW,SACJC,QAASC,YAAc,GAAIpB,GAAGqB,QAC1BC,KAAW,WACXC,QAAW,YAAchB,EAAQiB,KAAO,KAAOjB,EAAQkB,QAAU,IACjEC,MAAW,UACXC,IAAW,4BACXC,SAAW,QACXC,QAAW,WACPT,YAAYU,OACZtB,EAAKK,KAAKkB,QAAQC,UAClBxB,EAAKyB,OAAQ1B,EAAS,WAClBa,YAAYc,SACZ1B,EAAKK,KAAKkB,QAAQI,eAM7B5B,EAAQ6B,QAAU7B,EAAQ8B,YAC3B9B,EAAQ+B,OAA6B,oBACjCC,MAAc,oCACdf,KAAc,qBACdgB,KAAc,SACdC,QAAc,QACdC,OAAc,aACdC,MAAc,aACdpC,UAAkB,MAAOA,EAAQ6B,SAAY,KAAM,eACnDQ,KAAc,uLAI3BrC,IACHE,KAAKoC,SAAWpC,KAAKI,KAAKgC,SAC1BpC,KAAKqC,WAAY,UACjBrC,KAAKsC,IAAIC,OAAQvC,KAAKI,KAAKkC,MAG/BE,OAAQ,WACJxC,KAAKI,KAAKoC,UAOdhB,OAAQ,SAAU1B,EAAS2C,GACvB,GAAI1C,GAAOC,KACP0C,GACAC,QAAkB7C,EAAQ8C,GAC1BC,aAAkB/C,EAAQkB,QAC1Ba,OAAkB7B,KAAKI,KAAK0C,KAAKC,SAGrC,IADA/C,KAAKI,KAAK4C,QAAS,UACbjD,EAAKkD,SAAUP,GAGjB,MAFAvC,QAAO+C,KAAKC,MAAO,sBAAuB,gDAC1CV,GAAYA,IAGhB,IAAK3C,EAAQsD,SAAWjD,OAAOkD,KAAO,oBAAsB,CACxD,GAAIC,GAAKC,EAAG,WAAYC,MAAQJ,OAAQtD,EAAQsD,OAAQK,OAAQ3D,EAAQ2D,OAAQC,QAAS5D,EAAQ4D,SAIjG,OAHAC,GAAEC,KAAMlB,EAAQb,OAAQ,SAAUK,EAAO2B,GAAQP,EAAGf,OAAQgB,EAAG,YAAaC,MAAQzC,KAAQ8C,EAAK3B,MAASA,OAC1GoB,EAAGQ,OAAOC,SAAU,QAASvC,SAASgB,cACtCC,GAAYA,KAGhBtC,OAAO+C,KAAKC,MAAO,sBAAuB,uBAAwBT,GAClEpD,EAAM0E,SACFjC,KAAU,OACVkC,IAAU9D,OAAOkD,KAAO,YACxBP,KAAUJ,EACVwB,QAAU,SAAUC,GAChB1B,GAAYA,IACZ1C,EAAKuC,IAAI8B,WAAWN,OACpB/D,EAAKuC,IAAIC,OAAQxC,EAAKsE,iBAAkBF,IACxCjE,OAAOC,QAAUD,OAAOC,OAAOmE,kBAAoBpE,OAAOC,OAAOmE,iBAAiBC,mBAEtFC,MAAU,SAAUL,GAChB1B,GAAYA,IACZtC,OAAO+C,KAAKC,MAAO,oBAAqB,qBAAsBgB,EAC9D,IAAIM,IAAc,CAClB,IAAKN,GAAYA,EAASO,SAAW,CACjC,GAAIC,GAAiB5E,EAAKK,KAAK0C,KAAK8B,cAAeT,EAASO,SAC5D,KAAK,GAAIG,KAAYF,GAAgB,CACjC5E,EAAKK,KAAK0E,UAAWD,EAAUF,EAAgBE,IAC/CJ,GAAc,CACd,QAGFA,GACF1E,EAAKE,MAAM8E,MACP9D,MAAU,wBACV+D,KAAYb,GAAYA,EAASc,SAAalF,EAAKmF,eAAgBxC,GACnEjC,SAAY0E,MAAU,WAAapF,EAAKE,MAAM6D,eAUlEb,SAAU,SAAUP,GAChB,GAAI0C,GAAc1C,EAAQb,OACtBwD,EAAc,GACdC,EAAc,IAClB,KAAM,GAAIC,KAAgBH,GAAa,CACnC,GAAII,GAAcJ,EAAYG,GAC1BV,EAAc7E,KAAKI,KAAK0C,KAAK2C,MAAOF,GACpCG,EAAc1F,KAAKI,KAAKuF,WAAYd,GACpCe,EAAc5F,KAAKI,KAAKyF,WAAYhB,EACxC,IAAMA,GAAae,GAAcF,EAAjC,CAIA,IAAME,EAAUE,UAA2B,MAAfN,EAExB,MADAxF,MAAKI,KAAK0E,UAAWD,IACd,CAEX,IAAKW,GAAeA,EAAYO,MAAQ,CACpC,GAAIC,GAAIR,EAAYS,OAAOC,OACvBC,EAAMH,EAAI,GAAKR,EAAYS,OAAQ,IAAOT,EAAYS,OAAQ,GAAIE,GACtE,IAAKA,EACD,GAAmB,OAAdb,EACDA,EAAYa,MACT,IAAKb,IAAca,EAEtB,MADAnG,MAAKI,KAAK0E,UAAWD,EAAU,mFACxB,CAGf,IAAiB,KAAZQ,EACDA,EAAUW,MACP,IAAKX,IAAYW,EAEpB,MADAhG,MAAKI,KAAK0E,UAAWD,EAAU,gHAAkHmB,EAAI,wDAA0DX,EAAU,UAClN,OAtBXlF,QAAO+C,KAAKC,MAAM,wBAAyB,oCA0BnD,OAAO,GAGXkB,iBAAkB,SAAUF,GACxB,GAAKA,EAASiC,MAAQjC,EAASiC,KAAKF,OAAS,EAAI,CAC7C,GAAIG,GAAQlC,EAASiC,KAAKF,OACtBI,EAAsB,GAATD,EAAa,YAAcA,EAAQ,aAChDE,EAAWhD,EAAG,UAAWiD,SAAU,oBACVjE,OAAQgB,EAAG,QAASkD,KAAMH,EAAa,gFAKpE,OAJA3C,GAAEC,KAAMO,EAASuC,QAAS,SAAUC,GAChCJ,EAAShE,OAAQgB,EAAG,QAASiD,SAAU,cAAejE,OAAQgB,EAAG,QAASkD,KAAME,EAAOC,IAAM,KAAOD,EAAO5F,UAE/GwF,EAAShE,OAAQgB,EAAG,QAAShB,OAAQ,QAASkE,KAAM,yPAC7CF,EAEP,MAAOvG,MAAKkF,eAAgBf,IAIpCe,eAAgB,SAAUf,GACtB,MAAQZ,GAAG,UAAWiD,SAAU,qBACVjE,OAAQgB,EAAG,QAASkD,KAAM,sGAC1BlE,OAAQgB,EAAG,UAAWkD,KAAMI,KAAKC,UAAW3C,EAAU,KAAM,OAI1F,QACIzE,KAAMA"} \ No newline at end of file +{"version":3,"file":"tool-form.js","sources":["../../../src/mvc/tool/tool-form.js"],"names":["define","Utils","Ui","Modal","ToolFormBase","View","Backbone","extend","initialize","options","self","this","modal","parent","Galaxy","form","merge","listen_to_history","always_refresh","customize","buttons","execute","execute_btn","Button","icon","tooltip","name","version","title","cls","floating","onclick","wait","portlet","disable","submit","unwait","enable","job_id","job_remap","inputs","label","type","display","ignore","value","help","deferred","setElement","$el","append","callback","job_def","tool_id","id","tool_version","data","create","trigger","validate","emit","debug","action","root","$f","$","attr","method","enctype","_","each","key","hide","appendTo","remove","request","url","success","response","children","_templateSuccess","currHistoryPanel","refreshContents","error","input_found","err_data","error_messages","matchResponse","input_id","highlight","show","body","err_msg","_templateError","Close","job_inputs","batch_n","batch_src","job_input_id","input_value","match","input_field","field_list","input_def","input_list","optional","batch","n","values","length","src","jobs","njobs","njobs_text","$message","addClass","text","outputs","output","hid","JSON","stringify"],"mappings":"AACAA,QAAS,cAAe,iBAAkB,kBAAmB,2BACzD,SAAUC,EAAOC,EAAIC,EAAOC,GAC5B,GAAIC,GAAOC,SAASD,KAAKE,QACrBC,WAAY,SAAUC,GAClB,GAAIC,GAAOC,IACXA,MAAKC,MAAQC,OAAOC,OAAOF,OAAS,GAAIT,GAAME,KAC9CM,KAAKI,KAAO,GAAIX,GAAcH,EAAMe,OAChCC,mBAAoB,EACpBC,gBAAoB,EACpBC,UAAoB,SAAUV,GAE1BA,EAAQW,SACJC,QAASC,YAAc,GAAIpB,GAAGqB,QAC1BC,KAAW,WACXC,QAAW,YAAchB,EAAQiB,KAAO,KAAOjB,EAAQkB,QAAU,IACjEC,MAAW,UACXC,IAAW,4BACXC,SAAW,QACXC,QAAW,WACPT,YAAYU,OACZtB,EAAKK,KAAKkB,QAAQC,UAClBxB,EAAKyB,OAAQ1B,EAAS,WAClBa,YAAYc,SACZ1B,EAAKK,KAAKkB,QAAQI,eAM7B5B,EAAQ6B,QAAU7B,EAAQ8B,YAC3B9B,EAAQ+B,OAA6B,oBACjCC,MAAc,oCACdf,KAAc,qBACdgB,KAAc,SACdC,QAAc,QACdC,OAAc,aACdC,MAAc,aACdpC,UAAkB,MAAOA,EAAQ6B,SAAY,KAAM,eACnDQ,KAAc,uLAI3BrC,IACHE,KAAKoC,SAAWpC,KAAKI,KAAKgC,SAC1BpC,KAAKqC,WAAY,UACjBrC,KAAKsC,IAAIC,OAAQvC,KAAKI,KAAKkC,MAO/Bd,OAAQ,SAAU1B,EAAS0C,GACvB,GAAIzC,GAAOC,KACPyC,GACAC,QAAkB5C,EAAQ6C,GAC1BC,aAAkB9C,EAAQkB,QAC1Ba,OAAkB7B,KAAKI,KAAKyC,KAAKC,SAGrC,IADA9C,KAAKI,KAAK2C,QAAS,UACbhD,EAAKiD,SAAUP,GAGjB,MAFAtC,QAAO8C,KAAKC,MAAO,sBAAuB,gDAC1CV,GAAYA,IAGhB,IAAK1C,EAAQqD,SAAWhD,OAAOiD,KAAO,oBAAsB,CACxD,GAAIC,GAAKC,EAAG,WAAYC,MAAQJ,OAAQrD,EAAQqD,OAAQK,OAAQ1D,EAAQ0D,OAAQC,QAAS3D,EAAQ2D,SAIjG,OAHAC,GAAEC,KAAMlB,EAAQZ,OAAQ,SAAUK,EAAO0B,GAAQP,EAAGd,OAAQe,EAAG,YAAaC,MAAQxC,KAAQ6C,EAAK1B,MAASA,OAC1GmB,EAAGQ,OAAOC,SAAU,QAAStC,SAASuC,cACtCvB,GAAYA,KAGhBrC,OAAO8C,KAAKC,MAAO,sBAAuB,uBAAwBT,GAClEnD,EAAM0E,SACFjC,KAAU,OACVkC,IAAU9D,OAAOiD,KAAO,YACxBP,KAAUJ,EACVyB,QAAU,SAAUC,GAChB3B,GAAYA,IACZzC,EAAKuC,IAAI8B,WAAWP,OACpB9D,EAAKuC,IAAIC,OAAQxC,EAAKsE,iBAAkBF,IACxCjE,OAAOC,QAAUD,OAAOC,OAAOmE,kBAAoBpE,OAAOC,OAAOmE,iBAAiBC,mBAEtFC,MAAU,SAAUL,GAChB3B,GAAYA,IACZrC,OAAO8C,KAAKC,MAAO,oBAAqB,qBAAsBiB,EAC9D,IAAIM,IAAc,CAClB,IAAKN,GAAYA,EAASO,SAAW,CACjC,GAAIC,GAAiB5E,EAAKK,KAAKyC,KAAK+B,cAAeT,EAASO,SAC5D,KAAK,GAAIG,KAAYF,GAAgB,CACjC5E,EAAKK,KAAK0E,UAAWD,EAAUF,EAAgBE,IAC/CJ,GAAc,CACd,QAGFA,GACF1E,EAAKE,MAAM8E,MACP9D,MAAU,wBACV+D,KAAYb,GAAYA,EAASc,SAAalF,EAAKmF,eAAgBzC,GACnEhC,SAAY0E,MAAU,WAAapF,EAAKE,MAAM4D,eAUlEb,SAAU,SAAUP,GAChB,GAAI2C,GAAc3C,EAAQZ,OACtBwD,EAAc,GACdC,EAAc,IAClB,KAAM,GAAIC,KAAgBH,GAAa,CACnC,GAAII,GAAcJ,EAAYG,GAC1BV,EAAc7E,KAAKI,KAAKyC,KAAK4C,MAAOF,GACpCG,EAAc1F,KAAKI,KAAKuF,WAAYd,GACpCe,EAAc5F,KAAKI,KAAKyF,WAAYhB,EACxC,IAAMA,GAAae,GAAcF,EAAjC,CAIA,IAAME,EAAUE,UAA2B,MAAfN,EAExB,MADAxF,MAAKI,KAAK0E,UAAWD,IACd,CAEX,IAAKW,GAAeA,EAAYO,MAAQ,CACpC,GAAIC,GAAIR,EAAYS,OAAOC,OACvBC,EAAMH,EAAI,GAAKR,EAAYS,OAAQ,IAAOT,EAAYS,OAAQ,GAAIE,GACtE,IAAKA,EACD,GAAmB,OAAdb,EACDA,EAAYa,MACT,IAAKb,IAAca,EAEtB,MADAnG,MAAKI,KAAK0E,UAAWD,EAAU,mFACxB,CAGf,IAAiB,KAAZQ,EACDA,EAAUW,MACP,IAAKX,IAAYW,EAEpB,MADAhG,MAAKI,KAAK0E,UAAWD,EAAU,gHAAkHmB,EAAI,wDAA0DX,EAAU,UAClN,OAtBXlF,QAAO8C,KAAKC,MAAM,wBAAyB,oCA0BnD,OAAO,GAGXmB,iBAAkB,SAAUF,GACxB,GAAKA,EAASiC,MAAQjC,EAASiC,KAAKF,OAAS,EAAI,CAC7C,GAAIG,GAAQlC,EAASiC,KAAKF,OACtBI,EAAsB,GAATD,EAAa,YAAcA,EAAQ,aAChDE,EAAWjD,EAAG,UAAWkD,SAAU,oBACVjE,OAAQe,EAAG,QAASmD,KAAMH,EAAa,gFAKpE,OAJA5C,GAAEC,KAAMQ,EAASuC,QAAS,SAAUC,GAChCJ,EAAShE,OAAQe,EAAG,QAASkD,SAAU,cAAejE,OAAQe,EAAG,QAASmD,KAAME,EAAOC,IAAM,KAAOD,EAAO5F,UAE/GwF,EAAShE,OAAQe,EAAG,QAASf,OAAQ,QAASkE,KAAM,yPAC7CF,EAEP,MAAOvG,MAAKkF,eAAgBf,IAIpCe,eAAgB,SAAUf,GACtB,MAAQb,GAAG,UAAWkD,SAAU,qBACVjE,OAAQe,EAAG,QAASmD,KAAM,sGAC1BlE,OAAQe,EAAG,UAAWmD,KAAMI,KAAKC,UAAW3C,EAAU,KAAM,OAI1F,QACIzE,KAAMA"} \ No newline at end of file diff --git a/static/scripts/bundled/analysis.bundled.js b/static/scripts/bundled/analysis.bundled.js index b09b502c07a3..09a193ce164d 100644 --- a/static/scripts/bundled/analysis.bundled.js +++ b/static/scripts/bundled/analysis.bundled.js @@ -1,14 +1,14 @@ -webpackJsonp([3,1],[function(e,t,i){(function(e,t){var n=i(1),s=n,o=i(57).GalaxyApp,a=i(56),r=i(10),l=i(90),c=i(89),d=i(59),h=i(18),u=i(45);window.app=function(i,n){window.Galaxy=new o(i,n),Galaxy.debug("analysis app");var p=i.config,f=new l({el:"#left",userIsAnonymous:Galaxy.user.isAnonymous(),search_url:p.search_url,toolbox:p.toolbox,toolbox_in_panel:p.toolbox_in_panel,stored_workflow_menu_entries:p.stored_workflow_menu_entries,nginx_upload_path:p.nginx_upload_path,ftp_upload_site:p.ftp_upload_site,default_genome:p.default_genome,default_extension:p.default_extension}),g=new r.CenterPanel({el:"#center"}),m=new c({el:"#right",galaxyRoot:Galaxy.root,userIsAnonymous:Galaxy.user.isAnonymous(),allow_user_dataset_purge:p.allow_user_dataset_purge}),v=new d.PageLayoutView(e.extend(i,{el:"body",left:f,center:g,right:m}));Galaxy.page=v,Galaxy.params=Galaxy.config.params,Galaxy.toolPanel=f.tool_panel,Galaxy.upload=f.uploadButton,Galaxy.currHistoryPanel=m.historyView,Galaxy.currHistoryPanel.listenToGalaxy(Galaxy),Galaxy.app={display:function(e,t){s(".select2-hidden-accessible").remove(),g.display(e)}};new(t.Router.extend({initialize:function(e){this.options=e},execute:function(e,t,i){Galaxy.debug("router execute:",e,t,i);var n=a.parse(t.pop());t.push(n),e&&e.apply(this,t)},routes:{"(/)":"home","(/)root*":"home","(/)tours(/)(:tour_id)":"show_tours"},show_tours:function(e){e?u.giveTour(e):g.display(new u.ToursView)},home:function(e){e.tool_id||e.job_id?"upload1"===e.tool_id?(Galaxy.upload.show(),this._loadCenterIframe("welcome")):this._loadToolForm(e):e.workflow_id?this._loadCenterIframe("workflow/run?id="+e.workflow_id):e.m_c?this._loadCenterIframe(e.m_c+"/"+e.m_a):this._loadCenterIframe("welcome")},_loadToolForm:function(e){e.id=e.tool_id,g.display(new h.View(e))},_loadCenterIframe:function(e,t){t=t||Galaxy.root,e=t+e,g.$("#galaxy_main").prop("src",e)}}))(i);s(function(){v.render(),v.right.historyView.loadCurrentHistory(),Galaxy.listenTo(v.right.historyView,"history-size-change",function(){Galaxy.user.fetch({url:Galaxy.user.urlRoot()+"/"+(Galaxy.user.id||"current")})}),v.right.historyView.connectToQuotaMeter(v.masthead.quotaMeter),t.history.start({root:Galaxy.root,pushState:!0})})}}).call(t,i(2),i(3))},,,,,,,function(e,t,i){var n,s;(function(o,a){n=[i(4),i(21),i(51),i(20),i(47),i(13),i(8)],s=function(e,t,i,n,s,r,l){var c=o.View.extend({tagName:"label",initialize:function(e){this.model=e&&e.model||new o.Model(e),this.tagName=e.tagName||this.tagName,this.setElement(a("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},title:function(e){this.model.set("title",e)},value:function(){return this.model.get("title")},render:function(){return this.$el.removeClass().addClass("ui-label").addClass(this.model.get("cls")).html(this.model.get("title")),this}}),d=o.View.extend({initialize:function(e){this.model=e&&e.model||new o.Model({message:null,status:"info",cls:"",persistent:!1,fade:!0}).set(e),this.listenTo(this.model,"change",this.render,this),this.render()},update:function(e){this.model.set(e)},render:function(){this.$el.removeClass().addClass("ui-message").addClass(this.model.get("cls"));var e=this.model.get("status");if(this.model.get("large")?this.$el.addClass(("success"==e&&"done"||"danger"==e&&"error"||e)+"messagelarge"):this.$el.addClass("alert").addClass("alert-"+e),this.model.get("message")){if(this.$el.html(this.model.get("message")),this.$el[this.model.get("fade")?"fadeIn":"show"](),this.timeout&&window.clearTimeout(this.timeout),!this.model.get("persistent")){var t=this;this.timeout=window.setTimeout(function(){t.model.set("message","")},3e3)}}else this.$el.fadeOut();return this}}),h=o.View.extend({initialize:function(e){this.model=e&&e.model||new o.Model({type:"text",placeholder:"",disabled:!1,visible:!0,cls:"",area:!1,color:null,style:null}).set(e),this.tagName=this.model.get("area")?"textarea":"input",this.setElement(a("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},events:{input:"_onchange"},value:function(e){return void 0!==e&&this.model.set("value","string"==typeof e?e:""),this.model.get("value")},render:function(){return 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")||""),this.model.get("value")!==this.$el.val()&&this.$el.val(this.model.get("value")),this.model.get("disabled")?this.$el.attr("disabled",!0):this.$el.removeAttr("disabled"),this.$el[this.model.get("visible")?"show":"hide"](),this},_onchange:function(){this.value(this.$el.val()),this.model.get("onchange")&&this.model.get("onchange")(this.model.get("value"))}}),u=o.View.extend({initialize:function(e){this.model=e&&e.model||new o.Model(e),this.setElement(a("
").append(this.$info=a("
")).append(this.$hidden=a("
"))),this.listenTo(this.model,"change",this.render,this),this.render()},value:function(e){return void 0!==e&&this.model.set("value",e),this.model.get("value")},render:function(){return this.$el.attr("id",this.model.id),this.$hidden.val(this.model.get("value")),this.model.get("info")?this.$info.show().html(this.model.get("info")):this.$info.hide(),this}});return{Button:r.ButtonDefault,ButtonIcon:r.ButtonIcon,ButtonCheck:r.ButtonCheck,ButtonMenu:r.ButtonMenu,ButtonLink:r.ButtonLink,Input:h,Label:c,Message:d,Modal:l,RadioButton:n.RadioButton,Checkbox:n.Checkbox,Radio:n.Radio,Select:t,Hidden:u,Slider:i,Drilldown:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1))},,function(e,t,i){var n,s;(function(o,a,r){n=[i(4),i(7)],s=function(e,t){var i=o.View.extend({visible:!1,initialize:function(i){var n=this;this.model=i&&i.model||new o.Model({id:e.uid(),cls:"ui-portlet",title:"",icon:"",buttons:null,body:null,scrollable:!0,nopadding:!1,operations:null,collapsible:!1,collapsible_button:!1,collapsed:!1}).set(i),this.setElement(this._template()),this.$body=this.$(".portlet-body"),this.$title_text=this.$(".portlet-title-text"),this.$title_icon=this.$(".portlet-title-icon"),this.$header=this.$(".portlet-header"),this.$content=this.$(".portlet-content"),this.$backdrop=this.$(".portlet-backdrop"),this.$buttons=this.$(".portlet-buttons"),this.$operations=this.$(".portlet-operations"),this.model.get("body")&&this.append(this.model.get("body")),this.collapsible_button=new t.ButtonIcon({icon:"fa-eye",tooltip:"Collapse/Expand",cls:"ui-button-icon-plain",onclick:function(){n[n.collapsed?"expand":"collapse"]()}}),this.render()},render:function(){var e=this,t=this.model.attributes;return this.$el.removeClass().addClass(t.cls).attr("id",t.id),this.$header[t.title?"show":"hide"](),this.$title_text.html(t.title),a.each([this.$content,this.$body],function(e){e[t.nopadding?"addClass":"removeClass"]("no-padding")}),t.icon?this.$title_icon.removeClass().addClass("portlet-title-icon fa").addClass(t.icon).show():this.$title_icon.hide(),this.$title_text[t.collapsible?"addClass":"removeClass"]("no-highlight collapsible").off(),t.collapsible&&(this.$title_text.on("click",function(){e[e.collapsed?"expand":"collapse"]()}),t.collapsed?this.collapse():this.expand()),t.buttons?(this.$buttons.empty().show(),r.each(this.model.get("buttons"),function(t,i){i.$el.prop("id",t),e.$buttons.append(i.$el)})):this.$buttons.hide(),this.$operations.empty,t.collapsible_button&&this.$operations.append(this.collapsible_button.$el),t.operations&&r.each(t.operations,function(t,i){i.$el.prop("id",t),e.$operations.append(i.$el)}),this},append:function(e){this.$body.append(e)},empty:function(){this.$body.empty()},header:function(){return this.$header},body:function(){return this.$body},show:function(){this.visible=!0,this.$el.fadeIn("fast")},hide:function(){this.visible=!1,this.$el.hide()},enableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!1)},disableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!0)},hideOperation:function(e){this.$operations.find("#"+e).hide()},showOperation:function(e){this.$operations.find("#"+e).show()},setOperation:function(e,t){this.$operations.find("#"+e).off("click").on("click",t)},title:function(e){return e&&this.$title_text.html(e),this.$title_text.html()},collapse:function(){this.collapsed=!0,this.$content.height("0%"),this.$body.hide(),this.collapsible_button.setIcon("fa-eye-slash")},expand:function(){this.collapsed=!1,this.$content.height("100%"),this.$body.fadeIn("fast"),this.collapsible_button.setIcon("fa-eye")},disable:function(){this.$backdrop.show()},enable:function(){this.$backdrop.hide()},_template:function(){return r("
").append(r("
").addClass("portlet-header").append(r("
").addClass("portlet-operations")).append(r("
").addClass("portlet-title").append(r("").addClass("portlet-title-icon")).append(r("").addClass("portlet-title-text")))).append(r("
").addClass("portlet-content").append(r("
").addClass("portlet-body")).append(r("
").addClass("portlet-buttons"))).append(r("
").addClass("portlet-backdrop"))}});return{View:i}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1))},,function(e,t,i){var n,s;(function(o,a,r){n=[i(8),i(23),i(14)],s=function(e,t,i){var n=o.Model.extend({}),s=o.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this.get("metadata")||this._set_metadata(),this.on("change",this._set_metadata,this)},_set_metadata:function(){var e=new n;a.each(a.keys(this.attributes),function(t){if(0===t.indexOf("metadata_")){var i=t.split("metadata_")[1];e.set(i,this.attributes[t]),delete this.attributes[t]}},this),this.set("metadata",e,{silent:!0})},get_metadata:function(e){return this.attributes.metadata.get(e)},urlRoot:Galaxy.root+"api/datasets"}),l=s.extend({defaults:a.extend({},s.prototype.defaults,{chunk_url:null,first_data_chunk:null,offset:0,at_eof:!1}),initialize:function(e){s.prototype.initialize.call(this),this.attributes.first_data_chunk&&(this.attributes.offset=this.attributes.first_data_chunk.offset),this.attributes.chunk_url=Galaxy.root+"dataset/display?dataset_id="+this.id,this.attributes.url_viz=Galaxy.root+"visualization"},get_next_chunk:function(){if(this.attributes.at_eof)return null;var e=this,t=r.Deferred();return r.getJSON(this.attributes.chunk_url,{offset:e.attributes.offset}).success(function(i){var n;""!==i.ck_data?(n=i,e.attributes.offset=i.offset):(e.attributes.at_eof=!0,n=null),t.resolve(n)}),t}}),c=o.Collection.extend({model:s}),d=o.View.extend({initialize:function(e){this.row_count=0,this.loading_chunk=!1,new p({model:e.model,$el:this.$el})},expand_to_container:function(){this.$el.height()").attr("id","loading_indicator"),this.$el.append(this.loading_indicator);var e=r("").attr({id:"content_table",cellpadding:0});this.$el.append(e);var t=this.model.get_metadata("column_names"),i=r("").appendTo(e),n=r("").appendTo(i);if(t)n.append("");else for(var s=1;s<=this.model.get_metadata("columns");s++)n.append("");var o=this,a=this.model.get("first_data_chunk");a?this._renderChunk(a):r.when(o.model.get_next_chunk()).then(function(e){o._renderChunk(e)}),this.scroll_elt.scroll(function(){o.attempt_to_fetch()})},scrolled_to_bottom:function(){return!1},_renderCell:function(e,t,i){var n=r("");t.append(e),this.row.append(t)},appendHeader:function(){this.$thead.append(this.row),this.row=a("")},add:function(e,t,i){var n=a("");t&&n.css("width",t),i&&n.css("text-align",i),n.append(e),this.row.append(n)},append:function(e,t){this._commit(e,t,!1)},prepend:function(e,t){this._commit(e,t,!0)},get:function(e){return this.$el.find("#"+e)},del:function(e){var t=this.$tbody.find("#"+e);t.length>0&&(t.remove(),this.row_count--,this._refresh())},delAll:function(){this.$tbody.empty(),this.row_count=0,this._refresh()},value:function(e){this.before=this.$tbody.find(".current").attr("id"),void 0!==e&&(this.$tbody.find("tr").removeClass("current"),e&&this.$tbody.find("#"+e).addClass("current"));var t=this.$tbody.find(".current").attr("id");return void 0===t?null:(t!=this.before&&this.options.onchange&&this.options.onchange(e),t)},size:function(){return this.$tbody.find("tr").length},_commit:function(e,t,i){this.del(e),this.row.attr("id",e),i?this.$tbody.prepend(this.row):this.$tbody.append(this.row),t&&(this.row.hide(),this.row.fadeIn()),this.row=this._row(),this.row_count++,this._refresh()},_row:function(){return a('')},_onclick:function(e){var t=this.value(),i=a(e.target).closest("tr").attr("id");""!=i&&i&&t!=i&&(this.options.onconfirm?this.options.onconfirm(i):this.value(i))},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_refresh:function(){0==this.row_count?this.$tmessage.show():this.$tmessage.hide()},_template:function(e){return'
"+t.join("")+""+s+"").text(e),s=this.model.get_metadata("column_types");return void 0!==i?n.attr("colspan",i).addClass("stringalign"):s&&t"),n=this.model.get_metadata("columns");return this.row_count%2!==0&&i.addClass("dark_row"),t.length===n?a.each(t,function(e,t){i.append(this._renderCell(e,t))},this):t.length>n?(a.each(t.slice(0,n-1),function(e,t){i.append(this._renderCell(e,t))},this),i.append(this._renderCell(t.slice(n-1).join("\t"),n-1))):1===t.length?i.append(this._renderCell(e,0,n)):(a.each(t,function(e,t){i.append(this._renderCell(e,t))},this),a.each(a.range(n-t.length),function(){i.append(r(""))})),this.row_count++,i},_renderChunk:function(e){var t=this.$el.find("table");a.each(e.ck_data.split("\n"),function(e,i){""!==e&&t.append(this._renderRow(e))},this)}}),h=d.extend({initialize:function(e){d.prototype.initialize.call(this,e),scroll_elt=a.find(this.$el.parents(),function(e){return"auto"===r(e).css("overflow")}),scroll_elt||(scroll_elt=window),this.scroll_elt=r(scroll_elt)},scrolled_to_bottom:function(){return this.$el.height()-this.scroll_elt.scrollTop()-this.scroll_elt.height()<=0}}),u=d.extend({initialize:function(e){d.prototype.initialize.call(this,e),this.scroll_elt=this.$el.css({position:"relative",overflow:"scroll",height:e.height||"500px"})},scrolled_to_bottom:function(){return this.$el.scrollTop()+this.$el.innerHeight()>=this.el.scrollHeight}}),p=o.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,file_ext:null,initialize:function(e){function t(e,t){for(var i=0;i").attr("type","button").append(this.$icon=a("")).append(this.$title=a("")).append(this.$progress=a("
").append(this.$progress_bar=a("
")))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(){var e=this,t=this.model.attributes;this.$el.removeClass().addClass("ui-button-default").addClass(t.disabled&&"disabled").attr("id",t.id).attr("disabled",t.disabled).css("float",t.floating).off("click").on("click",function(){a(".tooltip").hide(),t.onclick&&!e.disabled&&t.onclick()}).tooltip({title:t.tooltip,placement:"bottom"}),this.$progress.addClass("progress").css("display",t.percentage!==-1?"block":"none"),this.$progress_bar.addClass("progress-bar").css({width:t.percentage+"%"}),this.$icon.removeClass().addClass("icon fa"),this.$title.removeClass().addClass("title"),t.wait?(this.$el.addClass(t.wait_cls).prop("disabled",!0),this.$icon.addClass("fa-spinner fa-spin ui-margin-right"),this.$title.html(t.wait_text)):(this.$el.addClass(t.cls),this.$icon.addClass(t.icon),this.$title.html(t.title),t.icon&&t.title&&this.$icon.addClass("ui-margin-right"))},show:function(){this.$el.show()},hide:function(){this.$el.hide()},disable:function(){this.model.set("disabled",!0)},enable:function(){this.model.set("disabled",!1)},wait:function(){this.model.set("wait",!0)},unwait:function(){this.model.set("wait",!1)},setIcon:function(e){this.model.set("icon",e)}}),i=t.extend({initialize:function(t){this.model=t&&t.model||new o.Model({id:e.uid(),title:"",icon:"",cls:""}).set(t),this.setElement(a("").append(this.$icon=a(""))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(){var e=this.model.attributes;this.$el.removeClass().addClass(e.cls).attr({id:e.id,href:e.href||"javascript:void(0)",title:e.title,target:e.target||"_top",disabled:e.disabled}).off("click").on("click",function(){e.onclick&&!e.disabled&&e.onclick()}),this.$icon.removeClass().addClass(e.icon)}}),n=o.View.extend({initialize:function(t){this.model=t&&t.model||new o.Model({id:e.uid(),title:"Select/Unselect all",icons:["fa-square-o","fa-minus-square-o","fa-check-square-o"],value:0,onchange:function(){}}).set(t),this.setElement(a("
").append(this.$icon=a("")).append(this.$title=a(""))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(e){var t=this,e=this.model.attributes;this.$el.addClass("ui-button-check").off("click").on("click",function(){t.model.set("value",0===t.model.get("value")&&2||0),e.onclick&&e.onclick()}),this.$title.html(e.title),this.$icon.removeClass().addClass("icon fa ui-margin-right").addClass(e.icons[e.value])},value:function(e,t){return void 0!==e&&(t&&0!==e&&(e=e!==t&&1||2),this.model.set("value",e),this.model.get("onchange")(this.model.get("value"))),this.model.get("value")}}),s=t.extend({initialize:function(t){this.model=t&&t.model||new o.Model({id:e.uid(),title:"",floating:"right",icon:"",cls:"ui-button-icon",disabled:!1}).set(t),this.setElement(a("
").append(this.$button=a("
").append(this.$icon=a("")).append(this.$title=a("")))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(e){var e=this.model.attributes;this.$el.removeClass().addClass(e.cls).addClass(e.disabled&&"disabled").attr("disabled",e.disabled).attr("id",e.id).css("float",e.floating).off("click").on("click",function(){a(".tooltip").hide(),!e.disabled&&e.onclick&&e.onclick()}),this.$button.addClass("button").tooltip({title:e.tooltip,placement:"bottom"}),this.$icon.removeClass().addClass("icon fa").addClass(e.icon),this.$title.addClass("title").html(e.title),e.icon&&e.title&&this.$icon.addClass("ui-margin-right")}}),r=t.extend({$menu:null,initialize:function(e){this.model=e&&e.model||new o.Model({id:"",title:"",floating:"right",pull:"right",icon:null,onclick:null,cls:"ui-button-icon ui-button-menu",tooltip:"",target:"",href:"",onunload:null,visible:!0,tag:""}).set(e),this.setElement(a("
").append(this.$root=a("
").append(this.$icon=a("")).append(this.$title=a("")))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(){var e=this.model.attributes;this.$el.removeClass().addClass("dropdown").addClass(e.cls).attr("id",e.id).css({"float":e.floating,display:e.visible?"block":"none"}),this.$root.addClass("root button dropdown-toggle").attr("data-toggle","dropdown").tooltip({title:e.tooltip,placement:"bottom"}).off("click").on("click",function(t){a(".tooltip").hide(),t.preventDefault(),e.onclick&&e.onclick()}),this.$icon.removeClass().addClass("icon fa").addClass(e.icon),this.$title.removeClass().addClass("title").html(e.title),e.icon&&e.title&&this.$icon.addClass("ui-margin-right")},addMenu:function(t){var t=e.merge(t,{title:"",target:"",href:"",onclick:null,divider:!1,icon:null,cls:"button-menu btn-group"});this.$menu||(this.$menu=a("
","
"].join("")}});return{CitationView:n,CitationListView:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3))},function(e,t,i){var n,s;(function(o,a,r){n=[i(42),i(32),i(6),i(5)],s=function(e,t,i,n){"use strict";var s=e.FoldoutListItemView,l=e.ListItemView,c=s.extend({className:s.prototype.className+" dataset-collection",id:function(){return["dataset_collection",this.model.get("id")].join("-")},initialize:function(e){this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,s.prototype.initialize.call(this,e)},_setUpListeners:function(){s.prototype._setUpListeners.call(this),this.listenTo(this.model,"change",function(e,t){o.has(e.changed,"deleted")?this.render():o.has(e.changed,"element_count")&&this.$("> .title-bar .subtitle").replaceWith(this._renderSubtitle())})},_renderSubtitle:function(){return a(this.templates.subtitle(this.model.toJSON(),this))},_getFoldoutPanelOptions:function(){var e=s.prototype._getFoldoutPanelOptions.call(this);return o.extend(e,{linkTarget:this.linkTarget,hasUser:this.hasUser})},$selector:function(){return this.$("> .selector")},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCListItemView("+e+")"}});c.prototype.templates=function(){var e=o.extend({},s.prototype.templates.warnings,{error:i.wrapTemplate(["<% if( model.error ){ %>",'
',n("There was an error getting the data for this collection"),": <%- model.error %>","
","<% } %>"]),purged:i.wrapTemplate(["<% if( model.purged ){ %>",'
',n("This collection has been deleted and removed from disk"),"
","<% } %>"]),deleted:i.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
',n("This collection has been deleted"),"
","<% } %>"])}),t=i.wrapTemplate(['
','
','<%- collection.element_identifier || collection.name %>',"
",'
',"
"],"collection"),a=i.wrapTemplate(['
','<% var countText = collection.element_count? ( collection.element_count + " " ) : ""; %>','<% if( collection.collection_type === "list" ){ %>',n("a list of <%- countText %>datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',n("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',n("a list of <%- countText %>dataset pairs"),'<% } else if( collection.collection_type === "list:list" ){ %>',n("a list of <%- countText %>dataset lists"),"<% } %>","
"],"collection");return o.extend({},s.prototype.templates,{warnings:e,titleBar:t,subtitle:a})}();var d=l.extend({className:l.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DCEListItemView.initialize:",e),l.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCEListItemView("+e+")"}});d.prototype.templates=function(){var e=i.wrapTemplate(['
','
','<%- element.element_identifier %>',"
",'
',"
"],"element");return o.extend({},l.prototype.templates,{titleBar:e})}();var h=t.DatasetListItemView.extend({className:t.DatasetListItemView.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DatasetDCEListItemView.initialize:",e),t.DatasetListItemView.prototype.initialize.call(this,e)},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):r.when()},toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetDCEListItemView("+e+")"}});h.prototype.templates=function(){var e=i.wrapTemplate(['
','','
','<%- element.element_identifier %>',"
","
"],"element");return o.extend({},t.DatasetListItemView.prototype.templates,{titleBar:e})}();var u=c.extend({className:c.prototype.className+" dataset-collection-element",_swapNewRender:function(e){c.prototype._swapNewRender.call(this,e);var t=this.model.get("state")||"ok";return this.$el.addClass("state-"+t),this.$el},toString:function(){var e=this.model?this.model+"":"(no model)";return"NestedDCDCEListItemView("+e+")"}});return{DCListItemView:c,DCEListItemView:d,DatasetDCEListItemView:h,NestedDCDCEListItemView:u}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(1),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(70),i(6),i(5)],s=function(e,t,i){"use strict";var n={defaults:{model_class:"DatasetCollectionElement",element_identifier:null,element_index:null,element_type:null},_mergeObject:function(e){return o.extend(e,e.object,{element_id:e.id}),delete e.object,e},constructor:function(e,t){e=this._mergeObject(e),this.idAttribute="element_id",a.Model.apply(this,arguments)},parse:function(e,t){var i=e;return i=this._mergeObject(i)}},s=a.Model.extend(t.LoggableMixin).extend(n).extend({_logNamespace:"collections"}),l=a.Collection.extend(t.LoggableMixin).extend({_logNamespace:"collections",model:s,toString:function(){return["DatasetCollectionElementCollection(",this.length,")"].join("")}}),c=e.DatasetAssociation.extend(t.mixin(n,{url:function(){return this.has("history_id")?Galaxy.root+"api/histories/"+this.get("history_id")+"/contents/"+this.get("id"):(console.warn("no endpoint for non-hdas within a collection yet"),Galaxy.root+"api/datasets")},defaults:o.extend({},e.DatasetAssociation.prototype.defaults,n.defaults),constructor:function(e,t){this.debug("\t DatasetDCE.constructor:",e,t),n.constructor.call(this,e,t)},hasDetails:function(){return this.elements&&this.elements.length},toString:function(){var e=this.get("element_identifier");return["DatasetDCE(",e,")"].join("")}})),d=l.extend({model:c,toString:function(){return["DatasetDCECollection(",this.length,")"].join("")}}),h=a.Model.extend(t.LoggableMixin).extend(t.SearchableModelMixin).extend({_logNamespace:"collections",defaults:{collection_type:null,deleted:!1},collectionClass:l,initialize:function(e,t){this.debug(this+"(DatasetCollection).initialize:",e,t,this),this.elements=this._createElementsModel(),this.on("change:elements",function(){this.log("change:elements"),this.elements=this._createElementsModel()})},_createElementsModel:function(){this.debug(this+"._createElementsModel",this.collectionClass,this.get("elements"),this.elements);var e=this.get("elements")||[];return this.unset("elements",{silent:!0}),this.elements=new this.collectionClass(e),this.elements},toJSON:function(){var e=a.Model.prototype.toJSON.call(this);return this.elements&&(e.elements=this.elements.toJSON()),e},inReadyState:function(){var e=this.get("populated");return this.isDeletedOrPurged()||e},hasDetails:function(){return 0!==this.elements.length},getVisibleContents:function(e){return this.elements},parse:function(e,t){var i=a.Model.prototype.parse.call(this,e,t);return i.create_time&&(i.create_time=new Date(i.create_time)),i.update_time&&(i.update_time=new Date(i.update_time)),i},"delete":function(e){return this.get("deleted")?r.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?r.when():this.save({deleted:!1},e)},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},searchAttributes:["name"],toString:function(){var e=[this.get("id"),this.get("name")||this.get("element_identifier")];return"DatasetCollection("+e.join(",")+")"}}),u=h.extend({collectionClass:d,toString:function(){return"List"+h.prototype.toString.call(this)}}),p=u.extend({toString:function(){return"Pair"+h.prototype.toString.call(this)}}),f=h.extend(t.mixin(n,{constructor:function(e,t){this.debug("\t NestedDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedDCDCE(",e,")"].join("")}})),g=l.extend({model:f,toString:function(){return["NestedDCDCECollection(",this.length,")"].join("")}}),m=p.extend(t.mixin(n,{constructor:function(e,t){this.debug("\t NestedPairDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedPairDCDCE(",e,")"].join("")}})),v=g.extend({model:m,toString:function(){return["NestedPairDCDCECollection(",this.length,")"].join("")}}),_=h.extend({collectionClass:v,toString:function(){return["ListPairedDatasetCollection(",this.get("name"),")"].join("")}}),y=u.extend(t.mixin(n,{constructor:function(e,t){this.debug("\t NestedListDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedListDCDCE(",e,")"].join("")}})),w=g.extend({model:y,toString:function(){return["NestedListDCDCECollection(",this.length,")"].join("")}}),b=h.extend({collectionClass:w,toString:function(){return["ListOfListsDatasetCollection(",this.get("name"),")"].join("")}});return{ListDatasetCollection:u,PairDatasetCollection:p,ListPairedDatasetCollection:_,ListOfListsDatasetCollection:b}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(3),i(1))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(39),i(12),i(6),i(8),i(87),i(5),i(84)],s=function(e,t,i,n,s,c){"use strict";function d(e){var t=e.toJSON(),i=g(t,{creationFn:function(t,i){return t=t.map(function(e){return{id:e.id,name:e.name,src:"dataset"===e.history_content_type?"hda":"hdca"}}),e.createHDCA(t,"list",i)}});return i}var h="collections",u=o.View.extend(i.LoggableMixin).extend({_logNamespace:h,tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.selected=e.selected||!1},render:function(){return this.$el.attr("data-element-id",this.element.id).attr("draggable",!0).html(this.template({element:this.element})),this.selected&&this.$el.addClass("selected"),this},template:a.template(['
',"<%- element.name %>","",'"].join("")),select:function(e){this.$el.toggleClass("selected",e),this.trigger("select",{source:this,selected:this.$el.hasClass("selected")})},discard:function(){var e=this,t=this.$el.parent().width();this.$el.animate({"margin-right":t},"fast",function(){e.trigger("discard",{source:e}),e.destroy()})},destroy:function(){this.off(),this.$el.remove()},events:{click:"_click","click .name":"_clickName","click .discard":"_clickDiscard",dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_click:function(e){e.stopPropagation(),this.select(e)},_clickName:function(e){e.stopPropagation(),e.preventDefault();var t=([c("Enter a new name for the element"),":\n(",c("Note that changing the name here will not rename the dataset"),")"].join(""),prompt(c("Enter a new name for the element")+":",this.element.name));t&&(this.element.name=t,this.render())},_clickDiscard:function(e){e.stopPropagation(),this.discard()},_dragstart:function(e){e.originalEvent&&(e=e.originalEvent),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",JSON.stringify(this.element)),this.$el.addClass("dragging"),this.$el.parent().trigger("collection-element.dragstart",[this])},_dragend:function(e){this.$el.removeClass("dragging"),this.$el.parent().trigger("collection-element.dragend",[this])},_sendToParent:function(e){this.$el.parent().trigger(e)},toString:function(){return"DatasetCollectionElementView()"}}),p=o.View.extend(i.LoggableMixin).extend({_logNamespace:h,elementViewClass:u,collectionClass:e.HistoryListDatasetCollection,className:"list-collection-creator collection-creator flex-row-container",minElements:1,defaultAttributes:{creationFn:function(){throw new TypeError("no creation fn for creator")},oncreate:function(){},oncancel:function(){},autoscrollDist:24,highlightClr:"rgba( 64, 255, 255, 1.0 )"},initialize:function(e){this.metric("ListCollectionCreator.initialize",e);var t=this;a.each(this.defaultAttributes,function(i,n){i=e[n]||i,t[n]=i}),t.initialElements=e.elements||[],this._instanceSetUp(),this._elementsSetUp(),this._setUpBehaviors()},_instanceSetUp:function(){this.selectedIds={},this.$dragging=null,this.blocking=!1},_elementsSetUp:function(){this.invalidElements=[],this.workingElements=[],this.elementViews=[],this.workingElements=this.initialElements.slice(0),this._ensureElementIds(),this._validateElements(),this._mangleDuplicateNames(),this._sortElements()},_ensureElementIds:function(){return this.workingElements.forEach(function(e){e.hasOwnProperty("id")||(e.id=a.uniqueId())}),this.workingElements},_validateElements:function(){var e=this;return e.invalidElements=[],this.workingElements=this.workingElements.filter(function(t){var i=e._isElementInvalid(t);return i&&e.invalidElements.push({element:t,text:i}),!i}),this.workingElements},_isElementInvalid:function(e){return"dataset"!==e.history_content_type?c("is not a dataset"):e.state!==t.OK?c(a.contains(t.NOT_READY_STATES,e.state)?"hasn't finished running yet":"has errored, is paused, or is not accessible"):e.deleted||e.purged?c("has been deleted or purged"):null},_mangleDuplicateNames:function(){var e=900,t=1,i={};this.workingElements.forEach(function(n){for(var s=n.name;i.hasOwnProperty(s);)if(s=n.name+" ("+t+")",t+=1,t>=e)throw new Error("Safety hit in while loop - thats impressive");n.name=s,i[n.name]=!0})},_sortElements:function(e){},render:function(e,t){return this.workingElements.length .clear-selected").show():this.$(".collection-elements-controls > .clear-selected").hide()},_renderList:function(e,t){var i=this,n=l("
"),s=i.$list();a.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),i.workingElements.forEach(function(e){var t=i._createElementView(e);n.append(t.$el)}),i._renderClearSelected(),s.empty().append(n.children()),a.invoke(i.elementViews,"render"),s.height()>s.css("max-height")?s.css("border-width","1px 0px 1px 0px"):s.css("border-width","0px")},_createElementView:function(e){var t=new this.elementViewClass({element:e,selected:a.has(this.selectedIds,e.id)});return this.elementViews.push(t),this._listenToElementView(t),t},_listenToElementView:function(e){var t=this;t.listenTo(e,{select:function(e){var i=e.source.element;e.selected?t.selectedIds[i.id]=!0:delete t.selectedIds[i.id],t.trigger("elements:select",e)},discard:function(e){t.trigger("elements:discard",e)}})},addElementView:function(e){},removeElementView:function(e){delete this.selectedIds[e.element.id],this._renderClearSelected(),this.elementViews=a.without(this.elementViews,e),this.stopListening(e)},_renderNoElementsLeft:function(){this._disableNameAndCreate(!0),this.$(".collection-elements").append(this.templates.noElementsLeft())},_elementToJSON:function(e){return e},createList:function(e){if(!this.workingElements.length){var t=c("No valid elements for final list")+". ";return t+=''+c("Cancel")+" ",t+=c("or"),t+=' '+c("start over")+".",void this._showAlert(t)}var i=this,n=this.workingElements.map(function(e){return i._elementToJSON(e)});return i.blocking=!0,i.creationFn(n,e).always(function(){i.blocking=!1}).fail(function(e,t,n){i.trigger("error",{xhr:e,status:t,message:c("An error occurred while creating this collection")})}).done(function(e,t,n){i.trigger("collection:created",e,t,n),i.metric("collection:created",e),"function"==typeof i.oncreate&&i.oncreate.call(this,e,t,n)})},_setUpBehaviors:function(){return this.on("error",this._errorHandler),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("elements:select",function(e){this._renderClearSelected()}),this.on("elements:discard",function(e){var t=e.source.element;this.removeElementView(e.source),this.workingElements=a.without(this.workingElements,t),this.workingElements.length||this._renderNoElementsLeft()}),this},_errorHandler:function(e){this.error(e);var t=this;if(content=e.message||c("An error occurred"),e.xhr){var i=e.xhr,n=e.message;0===i.readyState&&0===i.status?content+=": "+c("Galaxy could not be reached and may be updating.")+c(" Try again in a few minutes."):i.responseJSON?content+=":
"+JSON.stringify(i.responseJSON)+"
":content+=": "+n}t._showAlert(content,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(e){"function"==typeof this.oncancel&&this.oncancel.call(this)},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(e){e.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(e){e.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(e){e.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(e,t){t=t||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(t).show().find(".alert-message").html(e)},_hideAlert:function(e){this.$(".main-help").show(),this.$(".header .alert").hide()},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(e){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(e){e.preventDefault();var t=this.$list();this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestElement(e.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=r('
');i.length?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=2,n=e.offset(),s=e.scrollTop(),o=t-n.top,a=n.top+e.outerHeight()-t;o>=0&&o=0&&ae&&o-a
','
',''].join("")),header:a.template(['",'
','','',"
"].join("")),middle:a.template(['",'
',"
"].join("")),footer:a.template(['
','
','','
',c("Name"),":
","
","
",'
','
','",'
','",'","
","
",'
','","
","
"].join("")),helpContent:a.template(["

",c(["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("")),"

","
    ","
  • ",c(["Rename elements in the list by clicking on ",'the existing name.'].join("")),"
  • ","
  • ",c(["Discard elements from the final created list by clicking on the ",'"Discard" button.'].join("")),"
  • ","
  • ",c(["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("")),"
  • ","
  • ",c(['Click the "Start over" link to begin again as if you had just opened ',"the interface."].join("")),"
  • ","
  • ",c(['Click the "Cancel" button to exit the interface.'].join("")),"
  • ","

","

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

"].join("")),invalidElements:a.template([c("The following selections could not be included due to problems:"),"
    <% _.each( problems, function( problem ){ %>","
  • <%- problem.element.name %>: <%- problem.text %>
  • ","<% }); %>
"].join("")),noElementsLeft:a.template(['
  • ',c("No elements left! "),c("Would you like to "),'',c("start over"),"?","
  • "].join("")),invalidInitial:a.template(['
    ','
    ','',"<% if( _.size( problems ) ){ %>",c("The following selections could not be included due to problems"),":","
      <% _.each( problems, function( problem ){ %>","
    • <%- problem.element.name %>: <%- problem.text %>
    • ","<% }); %>
    ","<% } else if( _.size( elements ) < 1 ){ %>",c("No datasets were selected"),".","<% } %>","
    ",c("At least one element is needed for the collection"),". ",c("You may need to "),'',c("cancel")," ",c("and reselect new elements"),".","
    ","
    ","
    ",'"].join(""))},toString:function(){return"ListCollectionCreator"}}),f=function(e,t,i){var s,o=l.Deferred(),r=Galaxy.modal||new n.View;return t=a.defaults(t||{},{elements:e,oncancel:function(){r.hide(),o.reject("cancelled")},oncreate:function(e,t){r.hide(),o.resolve(t)}}),s=new i(t),r.show({title:t.title||c("Create a collection"),body:s.$el,width:"80%",height:"100%",closing_events:!0}),s.render(),window._collectionCreator=s,o},g=function(e,t){return t=t||{},t.title=c("Create a collection from a list of datasets"),f(e,t,p)};return{DatasetCollectionElementView:u,ListCollectionCreator:p,collectionCreatorModal:f,listCollectionCreatorModal:g,createListCollection:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1),i(1))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(42),i(12),i(22),i(6),i(5)],s=function(e,t,i,n,s){"use strict";var c="dataset",d=e.ListItemView,h=d.extend({_logNamespace:c,className:d.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger), -this.log(this+".initialize:",e),d.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank"},_setUpListeners:function(){d.prototype._setUpListeners.call(this);var e=this;return e.listenTo(e.model,{change:function(t,i){e.model.changedAttributes().state&&e.model.inReadyState()&&e.expanded&&!e.model.hasDetails()?e.model.fetch({silent:!0}).done(function(){e.render()}):e.render()}})},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):o.when()},remove:function(e,t){var i=this;e=e||this.fxSpeed,this.$el.fadeOut(e,function(){a.View.prototype.remove.call(i),t&&t.call(i)})},_swapNewRender:function(e){return d.prototype._swapNewRender.call(this,e),this.model.has("state")&&this.$el.addClass("state-"+this.model.get("state")),this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var e=this.model.get("state");if(e===t.NOT_VIEWABLE||e===t.DISCARDED||!this.model.get("accessible"))return null;var n={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged"))n.disabled=!0,n.title=s("Cannot display datasets removed from disk");else if(e===t.UPLOAD)n.disabled=!0,n.title=s("This dataset must finish uploading before it can be viewed");else if(e===t.NEW)n.disabled=!0,n.title=s("This dataset is not yet viewable");else{n.title=s("View data"),n.href=this.model.urls.display;var o=this;n.onclick=function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.addDataset(o.model.get("id")),e.preventDefault())}}return n.faIcon="fa-eye",i(n)},_renderDetails:function(){if(this.model.get("state")===t.NOT_VIEWABLE)return r(this.templates.noAccess(this.model.toJSON(),this));var e=d.prototype._renderDetails.call(this);return e.find(".actions .left").empty().append(this._renderSecondaryActions()),e.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages()),e.find(".display-applications").html(this._renderDisplayApplications()),this._setUpBehaviors(e),e},_renderSummary:function(){var e=this.model.toJSON(),t=this.templates.summaries[e.state];return(t=t||this.templates.summaries.unknown)(e,this)},_renderDetailMessages:function(){var e=this,t=r('
    '),i=e.model.toJSON();return l.each(e.templates.detailMessages,function(n){t.append(r(n(i,e)))}),t},_renderDisplayApplications:function(){return this.model.isDeletedOrPurged()?"":[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){switch(this.debug("_renderSecondaryActions"),this.model.get("state")){case t.NOT_VIEWABLE:return[];case t.OK:case t.FAILED_METADATA:case t.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return i({title:s("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle",onclick:function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Dataset details",url:this.href}),e.preventDefault(),e.stopPropagation())}})},_renderDownloadButton:function(){return this.model.get("purged")||!this.model.hasData()?null:l.isEmpty(this.model.get("meta_files"))?r(['','',""].join("")):this._renderMetaFileDownloadButton()},_renderMetaFileDownloadButton:function(){var e=this.model.urls;return r(['"].join("\n"))},events:l.extend(l.clone(d.prototype.events),{"click .display-btn":function(e){this.trigger("display",this,e)},"click .params-btn":function(e){this.trigger("params",this,e)},"click .download-btn":function(e){this.trigger("download",this,e)}}),toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetListItemView("+e+")"}});return h.prototype.templates=function(){var e=l.extend({},d.prototype.templates.warnings,{failed_metadata:n.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
    ',s("An error occurred setting the metadata for this dataset"),"
    ","<% } %>"]),error:n.wrapTemplate(["<% if( model.error ){ %>",'
    ',s("There was an error getting the data for this dataset"),": <%- model.error %>","
    ","<% } %>"]),purged:n.wrapTemplate(["<% if( model.purged ){ %>",'
    ',s("This dataset has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:n.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',s("This dataset has been deleted"),"
    ","<% } %>"])}),i=n.wrapTemplate(['
    ','
    ','
    ','
    ','
    ',"
    ","<% if( !dataset.deleted && !dataset.purged ){ %>",'
    ','
    ','
    ',"<% if( dataset.peek ){ %>",'
    <%= dataset.peek %>
    ',"<% } %>","<% } %>","
    "],"dataset"),o=n.wrapTemplate(['
    ','
    ',s("You do not have permission to view this dataset"),"
    ","
    "],"dataset"),a={};a[t.OK]=a[t.FAILED_METADATA]=n.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"),a[t.NEW]=n.wrapTemplate(["
    ",s("This is a new dataset and not all of its data are available yet"),"
    "],"dataset"),a[t.NOT_VIEWABLE]=n.wrapTemplate(["
    ",s("You do not have permission to view this dataset"),"
    "],"dataset"),a[t.DISCARDED]=n.wrapTemplate(["
    ",s("The job creating this dataset was cancelled before completion"),"
    "],"dataset"),a[t.QUEUED]=n.wrapTemplate(["
    ",s("This job is waiting to run"),"
    "],"dataset"),a[t.RUNNING]=n.wrapTemplate(["
    ",s("This job is currently running"),"
    "],"dataset"),a[t.UPLOAD]=n.wrapTemplate(["
    ",s("This dataset is currently uploading"),"
    "],"dataset"),a[t.SETTING_METADATA]=n.wrapTemplate(["
    ",s("Metadata is being auto-detected"),"
    "],"dataset"),a[t.PAUSED]=n.wrapTemplate(["
    ",s('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
    "],"dataset"),a[t.ERROR]=n.wrapTemplate(["<% if( !dataset.purged ){ %>","
    <%- dataset.misc_blurb %>
    ","<% } %>",'',s("An error occurred with this dataset"),":",'
    <%- dataset.misc_info %>
    '],"dataset"),a[t.EMPTY]=n.wrapTemplate(["
    ",s("No data"),": <%- dataset.misc_blurb %>
    "],"dataset"),a.unknown=n.wrapTemplate(['
    Error: unknown dataset state: "<%- dataset.state %>"
    '],"dataset");var r={resubmitted:n.wrapTemplate(["<% if( model.resubmitted ){ %>",'
    ',s("The job creating this dataset has been resubmitted"),"
    ","<% } %>"])},c=n.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
    ','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
    ","<% }); %>"],"apps");return l.extend({},d.prototype.templates,{warnings:e,details:i,noAccess:o,summaries:a,detailMessages:r,displayApplications:c})}(),{DatasetListItemView:h}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(1),i(3),i(1),i(2))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4)],s=function(e){var t=o.Model.extend({initialize:function(e){this.app=e},checksum:function(){var e="",t=this;return this.app.section.$el.find(".section-row").each(function(){var i=a(this).attr("id"),n=t.app.field_list[i];n&&(e+=i+":"+JSON.stringify(n.value&&n.value())+":"+n.collapsed+";")}),e},create:function(){function e(e,t,i){n.flat_dict[e]=t,o[e]=i,n.app.element_list[t]&&n.app.element_list[t].$el.attr("tour_id",e)}function t(s,o){for(var a in o){var r=o[a];if(r.input){var l=r.input,c=s;switch(""!=s&&(c+="|"),c+=l.name,l.type){case"repeat":var d="section-",h=[],u=null;for(var p in r){var f=p.indexOf(d);f!=-1&&(f+=d.length,h.push(parseInt(p.substr(f))),u||(u=p.substr(0,f)))}h.sort(function(e,t){return e-t});var a=0;for(var g in h)t(c+"_"+a++,r[u+h[g]]);break;case"conditional":var m=n.app.field_list[l.id].value();e(c+"|"+l.test_param.name,l.id,m);var v=i(l,m);v!=-1&&t(c,o[l.id+"-section-"+v]);break;case"section":t(!l.flat&&c||"",r);break;default:var _=n.app.field_list[l.id];if(_&&_.value){var m=_.value();if((void 0===l.ignore||l.ignore!=m)&&(_.collapsed&&l.collapsible_value&&(m=l.collapsible_value),e(c,l.id,m),l.payload))for(var y in l.payload)e(y,l.id,l.payload[y])}}}}}var n=this,s={};this._iterate(this.app.section.$el,s);var o={};return this.flat_dict={},t("",s),o},match:function(e){return this.flat_dict&&this.flat_dict[e]},matchCase:function(e,t){return i(e,t)},matchModel:function(e,t){var i=this;n(e.inputs,function(e,n){i.flat_dict[n]&&t(e,i.flat_dict[n])})},matchResponse:function(e){function t(e,s){if("string"==typeof s){var o=n.flat_dict[e];o&&(i[o]=s)}else for(var a in s){var r=a;if(""!==e){var l="|";s instanceof Array&&(l="_"),r=e+l+r}t(r,s[a])}}var i={},n=this;return t("",e),i},_iterate:function(e,t){var i=this,n=a(e).children();n.each(function(){var e=this,n=a(e).attr("id");if(a(e).hasClass("section-row")){var s=i.app.input_list[n];t[n]=s&&{input:s}||{},i._iterate(e,t[n])}else i._iterate(e,t)})}}),i=function(e,t){"boolean"==e.test_param.type&&(t="true"==t?e.test_param.truevalue||"true":e.test_param.falsevalue||"false");for(var i in e.cases)if(e.cases[i].value==t)return i;return-1},n=function(e,t,s,o){o=a.extend(!0,{},o),r.each(e,function(e){e&&e.type&&e.name&&(o[e.name]=e)});for(var l in e){var c=e[l];c.name=c.name||l;var d=s?s+"|"+c.name:c.name;switch(c.type){case"repeat":r.each(c.cache,function(e,i){n(e,t,d+"_"+i,o)});break;case"conditional":if(c.test_param){t(c.test_param,d+"|"+c.test_param.name,o);var h=i(c,c.test_param.value);h!=-1?n(c.cases[h].inputs,t,d,o):Galaxy.emit.debug("form-data::visitInputs() - Invalid case for "+d+".")}else Galaxy.emit.debug("form-data::visitInputs() - Conditional test parameter missing for "+d+".");break;case"section":n(c.inputs,t,d,o);break;default:t(c,d,o)}}};return{Manager:t,visitInputs:n}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},function(e,t,i){var n,s;(function(i,o,a){n=[],s=function(){return i.View.extend({initialize:function(e,t){this.app=e,this.app_options=e.options||{},this.field=t&&t.field||new i.View,this.model=t&&t.model||new i.Model({text_enable:this.app_options.text_enable||"Enable",text_disable:this.app_options.text_disable||"Disable",cls_enable:this.app_options.cls_enable||"fa fa-caret-square-o-down",cls_disable:this.app_options.cls_disable||"fa fa-caret-square-o-up"}).set(t),this.setElement(this._template()),this.$field=this.$(".ui-form-field"),this.$info=this.$(".ui-form-info"),this.$preview=this.$(".ui-form-preview"),this.$collapsible=this.$(".ui-form-collapsible"),this.$collapsible_text=this.$(".ui-form-collapsible-text"),this.$collapsible_icon=this.$(".ui-form-collapsible-icon"),this.$title=this.$(".ui-form-title"),this.$title_text=this.$(".ui-form-title-text"),this.$error_text=this.$(".ui-form-error-text"),this.$error=this.$(".ui-form-error"),this.$backdrop=this.$(".ui-form-backdrop"),this.$field.prepend(this.field.$el);var n=this.model.get("collapsible_value");this.field.collapsed=void 0!==n&&JSON.stringify(this.model.get("value"))==JSON.stringify(n),this.listenTo(this.model,"change",this.render,this),this.render();var s=this;this.$collapsible.on("click",function(){s.field.collapsed=!s.field.collapsed,e.trigger&&e.trigger("change"),s.render()})},backdrop:function(){this.model.set("backdrop",!0)},error:function(e){this.model.set("error_text",e)},reset:function(){this.model.set("error_text",null)},render:function(){o(".tooltip").hide();var e=this.model.get("help",""),t=this.model.get("argument");t&&e.indexOf("("+t+")")==-1&&(e+=" ("+t+")"),this.$info.html(e),this.$el[this.model.get("hidden")?"hide":"show"](),this.$preview[this.field.collapsed&&this.model.get("collapsible_preview")||this.model.get("disabled")?"show":"hide"]().html(a.escape(this.model.get("text_value")));var i=this.model.get("error_text");if(this.$error[i?"show":"hide"](),this.$el[i?"addClass":"removeClass"]("ui-error"),this.$error_text.html(i),this.$backdrop[this.model.get("backdrop")?"show":"hide"](),this.field.collapsed||this.model.get("disabled")?this.$field.hide():this.$field.show(),this.field.model&&this.field.model.set({color:this.model.get("color"),style:this.model.get("style")}),this.model.get("disabled")||void 0===this.model.get("collapsible_value"))this.$title_text.show().text(this.model.get("label")),this.$collapsible.hide();else{var n=this.field.collapsed?"enable":"disable";this.$title_text.hide(),this.$collapsible.show(),this.$collapsible_text.text(this.model.get("label")),this.$collapsible_icon.removeClass().addClass("icon").addClass(this.model.get("cls_"+n)).attr("data-original-title",this.model.get("text_"+n)).tooltip({placement:"bottom"})}},_template:function(){return o("
    ").addClass("ui-form-element").append(o("
    ").addClass("ui-form-error ui-error").append(o("").addClass("fa fa-arrow-down")).append(o("").addClass("ui-form-error-text"))).append(o("
    ").addClass("ui-form-title").append(o("
    ").addClass("ui-form-collapsible").append(o("").addClass("ui-form-collapsible-icon")).append(o("").addClass("ui-form-collapsible-text"))).append(o("").addClass("ui-form-title-text"))).append(o("
    ").addClass("ui-form-field").append(o("").addClass("ui-form-info")).append(o("
    ").addClass("ui-form-backdrop"))).append(o("
    ").addClass("ui-form-preview"))}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4),i(7),i(48),i(50),i(49),i(46)],s=function(e,t,i,n,s,l){return o.Model.extend({types:{text:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider","float":"_fieldSlider","boolean":"_fieldBoolean",drill_down:"_fieldDrilldown",color:"_fieldColor",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden",library_data:"_fieldLibrary",ftpfile:"_fieldFtp"},create:function(e){var t=this.types[e.type],i="function"==typeof this[t]?this[t].call(this,e):null;return i||(i=e.options?this._fieldSelect(e):this._fieldText(e),Galaxy.emit.debug("form-parameters::_addRow()","Auto matched field type ("+e.type+").")),void 0===e.value&&(e.value=null),i.value(e.value),i},_fieldData:function(e){return new i.View({id:"field-"+e.id,extensions:e.extensions,optional:e.optional,multiple:e.multiple,type:e.type,flavor:e.flavor,data:e.options,onchange:e.onchange})},_fieldSelect:function(e){if(e.is_workflow)return this._fieldText(e);"data_column"==e.type&&(e.error_text="Missing columns in referenced dataset.");var i=e.data;i||(i=[],a.each(e.options,function(e){i.push({label:e[0],value:e[1]})}));var n=t.Select;switch(e.display){case"checkboxes":n=t.Checkbox;break;case"radio":n=t.Radio;break;case"radiobutton":n=t.RadioButton}return new n.View({id:"field-"+e.id,data:i,error_text:e.error_text||"No options available",multiple:e.multiple,optional:e.optional,onchange:e.onchange,searchable:"workflow"!==e.flavor})},_fieldDrilldown:function(e){return e.is_workflow?this._fieldText(e):new t.Drilldown.View({id:"field-"+e.id,data:e.options,display:e.display,optional:e.optional,onchange:e.onchange})},_fieldText:function(i){if(i.options&&i.data)if(i.area=i.multiple,e.isEmpty(i.value))i.value=null;else if(r.isArray(i.value)){var n="";for(var s in i.value){if(n+=String(i.value[s]),!i.multiple)break;n+="\n"}i.value=n}return new t.Input({id:"field-"+i.id,area:i.area,placeholder:i.placeholder,onchange:i.onchange})},_fieldSlider:function(e){return new t.Slider.View({id:"field-"+e.id,precise:"float"==e.type,is_workflow:e.is_workflow,min:e.min,max:e.max,onchange:e.onchange})},_fieldHidden:function(e){return new t.Hidden({id:"field-"+e.id,info:e.info})},_fieldBoolean:function(e){return new t.RadioButton.View({id:"field-"+e.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:e.onchange})},_fieldColor:function(e){return new l({id:"field-"+e.id,onchange:e.onchange})},_fieldLibrary:function(e){return new n.View({id:"field-"+e.id,optional:e.optional,multiple:e.multiple,onchange:e.onchange})},_fieldFtp:function(e){return new s.View({id:"field-"+e.id,optional:e.optional,multiple:e.multiple,onchange:e.onchange})}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4),i(9),i(7)],s=function(e,t,i){var n=o.View.extend({initialize:function(t){this.list={},this.options=e.merge(t,{title:"Repeat",empty_text:"Not available.",max:null,min:null}),this.button_new=new i.ButtonIcon({icon:"fa-plus",title:"Insert "+this.options.title,tooltip:"Add new "+this.options.title+" block",floating:"clear",cls:"ui-button-icon form-repeat-add",onclick:function(){t.onnew&&t.onnew()}}),this.setElement(a("
    ").append(this.$list=a("
    ")).append(a("
    ").append(this.button_new.$el)))},size:function(){return r.size(this.list)},add:function(e){if(!e.id||this.list[e.id])return void Galaxy.emit.debug("form-repeat::add()","Duplicate or invalid repeat block id.");var n=new i.ButtonIcon({icon:"fa-trash-o",tooltip:"Delete this repeat block",cls:"ui-button-icon-plain form-repeat-delete",onclick:function(){e.ondel&&e.ondel()}}),s=new t.View({id:e.id,title:"placeholder",cls:e.cls||"ui-portlet-repeat",operations:{button_delete:n}});s.append(e.$el),s.$el.addClass("section-row").hide(),this.list[e.id]=s,this.$list.append(s.$el.fadeIn("fast")),this.options.max>0&&this.size()>=this.options.max&&this.button_new.disable(),this._refresh()},del:function(e){return this.list[e]?(this.$list.find("#"+e).remove(),delete this.list[e],this.button_new.enable(),void this._refresh()):void Galaxy.emit.debug("form-repeat::del()","Invalid repeat block id.")},delAll:function(){for(var e in this.list)this.del(e)},hideOptions:function(){this.button_new.$el.hide(),r.each(this.list,function(e){e.hideOperation("button_delete")}),r.isEmpty(this.list)&&this.$el.append(a("
    ").addClass("ui-form-info").html(this.options.empty_text))},_refresh:function(){var e=0;for(var t in this.list){var i=this.list[t];i.title(++e+": "+this.options.title),i[this.size()>this.options.min?"showOperation":"hideOperation"]("button_delete")}}});return{View:n}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(4),i(7),i(9),i(36),i(34),i(35)],s=function(e,t,i,n,s,c){var d=o.View.extend({initialize:function(e,t){this.app=e,this.inputs=t.inputs,this.parameters=new c,this.setElement(a("
    ")),this.render()},render:function(){var e=this;this.$el.empty(),r.each(this.inputs,function(t){e.add(t)})},add:function(t){var i=l.extend(!0,{},t);switch(i.id=t.id=e.uid(),this.app.input_list[i.id]=i,i.type){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(e){var t=this;e.test_param.id=e.id,this.app.options.sustain_conditionals&&(e.test_param.disabled=!0);var i=this._addRow(e.test_param);i.model&&i.model.set("onchange",function(i){var n=t.app.data.matchCase(e,i);for(var s in e.cases){var o=e.cases[s],a=t.$("#"+e.id+"-section-"+s),r=!1;for(var l in o.inputs)if(!o.inputs[l].hidden){r=!0;break}s==n&&r?a.fadeIn("fast"):a.hide()}t.app.trigger("change")});for(var n in e.cases){var s=new d(this.app,{inputs:e.cases[n].inputs});this._append(s.$el.addClass("ui-form-section"),e.id+"-section-"+n)}i.trigger("change")},_addRepeat:function(e){function t(t){var n=e.id+"-section-"+o++,s=new d(i.app,{inputs:t});a.add({id:n,$el:s.$el,ondel:function(){a.del(n),i.app.trigger("change")}})}for(var i=this,o=0,a=new n.View({title:e.title||"Repeat",min:e.min,max:e.max,onnew:function(){t(e.inputs),i.app.trigger("change")}}),l=r.size(e.cache),c=0;c").addClass("ui-form-info").html(e.help)),this.app.on("expand",function(e){t.$("#"+e).length>0&&t.expand()}),this._append(t.$el,e.id)},_addRow:function(e){var t=this,i=e.id;e.onchange=function(){t.app.trigger("change",i)};var n=this.parameters.create(e);this.app.field_list[i]=n;var o=new s(this.app,{name:e.name,label:e.label||e.name,value:e.value,text_value:e.text_value,collapsible_value:e.collapsible_value,collapsible_preview:e.collapsible_preview,help:e.help,argument:e.argument,disabled:e.disabled,color:e.color,style:e.style,backdrop:e.backdrop,hidden:e.hidden,field:n});return this.app.element_list[i]=o,this._append(o.$el,e.id),n},_append:function(e,t){this.$el.append(e.addClass("section-row").attr("id",t))}});return{View:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4),i(9),i(7),i(37),i(33)],s=function(e,t,i,n,s){return o.View.extend({initialize:function(t){this.options=e.merge(t,{initial_errors:!1,cls:"ui-portlet-limited",icon:null,always_refresh:!0}),this.setElement("
    "),this.render()},update:function(e){var t=this;this.data.matchModel(e,function(e,i){var n=t.input_list[i];if(n&&n.options&&!a.isEqual(n.options,e.options)){n.options=e.options;var s=t.field_list[i];if(s.update){var o=[];if(["data","data_collection","drill_down"].indexOf(n.type)!=-1)o=n.options;else for(var r in e.options){var l=e.options[r];l.length>2&&o.push({label:l[0],value:l[1]})}s.update(o),s.trigger("change"),Galaxy.emit.debug("form-view::update()","Updating options for "+i)}}})},wait:function(e){for(var t in this.input_list){var i=this.field_list[t],n=this.input_list[t];n.is_dynamic&&i.wait&&i.unwait&&i[e?"wait":"unwait"]()}},highlight:function(e,t,i){var n=this.element_list[e];if(n&&(n.error(t||"Please verify this parameter."),this.portlet.expand(),this.trigger("expand",e),!i)){var s=this.$el.parents().filter(function(){return["auto","scroll"].indexOf(r(this).css("overflow"))!=-1}).first();s.animate({scrollTop:s.scrollTop()+n.$el.offset().top-120},500)}},errors:function(e){if(this.trigger("reset"),e&&e.errors){var t=this.data.matchResponse(e.errors);for(var i in this.element_list){this.element_list[i];t[i]&&this.highlight(i,t[i],!0)}}},render:function(){var e=this;this.off("change"),this.off("reset"),this.field_list={},this.input_list={},this.element_list={},this.data=new s.Manager(this),this._renderForm(),this.data.create(),this.options.initial_errors&&this.errors(this.options);var t=this.data.checksum();return this.on("change",function(i){var n=e.input_list[i];if(!n||n.refresh_on_change||e.options.always_refresh){var s=e.data.checksum();s!=t&&(t=s,e.options.onchange&&e.options.onchange())}}),this.on("reset",function(){a.each(e.element_list,function(e){e.reset()})}),this},_renderForm:function(){r(".tooltip").remove(),this.message=new i.Message,this.section=new n.View(this,{inputs:this.options.inputs}),this.portlet=new t.View({icon:this.options.icon,title:this.options.title,cls:this.options.cls,operations:this.options.operations,buttons:this.options.buttons,collapsible:this.options.collapsible,collapsed:this.options.collapsed}),this.portlet.append(this.message.$el),this.portlet.append(this.section.$el),this.$el.empty(),this.options.inputs&&this.$el.append(this.portlet.$el),this.options.message&&this.message.update({persistent:!0,status:"warning",message:this.options.message}),Galaxy.emit.debug("form-view::initialize()","Completed")}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1))},function(e,t,i){var n,s;(function(o){n=[i(30),i(74),i(5)],s=function(e,t,i){"use strict";function n(e){return function(t,i){return this.isNew()&&(i=i||{},i.url=this.urlRoot+this.get("history_id")+"/contents",t=t||{},t.type="dataset_collection"),e.call(this,t,i)}}var s=t.HistoryContentMixin,a=e.ListDatasetCollection,r=e.PairDatasetCollection,l=e.ListPairedDatasetCollection,c=e.ListOfListsDatasetCollection,d=a.extend(s).extend({defaults:o.extend(o.clone(a.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list",model_class:"HistoryDatasetCollectionAssociation"}),save:n(a.prototype.save),toString:function(){return"History"+a.prototype.toString.call(this)}}),h=r.extend(s).extend({defaults:o.extend(o.clone(r.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"paired",model_class:"HistoryDatasetCollectionAssociation"}),save:n(r.prototype.save),toString:function(){return"History"+r.prototype.toString.call(this)}}),u=l.extend(s).extend({defaults:o.extend(o.clone(l.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:paired",model_class:"HistoryDatasetCollectionAssociation"}),save:n(l.prototype.save),toString:function(){return"History"+l.prototype.toString.call(this)}}),p=c.extend(s).extend({defaults:o.extend(o.clone(c.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:list",model_class:"HistoryDatasetCollectionAssociation"}),save:n(c.prototype.save),toString:function(){return["HistoryListOfListsDatasetCollection(",this.get("name"),")"].join("")}});return{HistoryListDatasetCollection:d,HistoryPairDatasetCollection:h,HistoryListPairedDatasetCollection:u,HistoryListOfListsDatasetCollection:p}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o,a,r){n=[i(67),i(72),i(39),i(41),i(6),i(129)],s=function(e,t,i,n,s,l){"use strict";var c=e.PaginatedCollection,d=c.extend(s.LoggableMixin).extend({_logNamespace:"history",model:function(e,n){if("dataset"===e.history_content_type)return new t.HistoryDatasetAssociation(e,n);if("dataset_collection"===e.history_content_type){switch(e.collection_type){case"list":return new i.HistoryListDatasetCollection(e,n);case"paired":return new i.HistoryPairDatasetCollection(e,n);case"list:paired":return new i.HistoryListPairedDatasetCollection(e,n);case"list:list":return new i.HistoryListOfListsDatasetCollection(e,n)}var s="Unknown collection_type: "+e.collection_type;return console.warn(s,e),{validationError:s}}return{validationError:"Unknown history_content_type: "+e.history_content_type}},limitPerPage:500,limitPerProgressiveFetch:500,order:"hid",urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(e,t){t=t||{},c.prototype.initialize.call(this,e,t),this.history=t.history||null,this.setHistoryId(t.historyId||null),this.includeDeleted=t.includeDeleted||this.includeDeleted,this.includeHidden=t.includeHidden||this.includeHidden,this.model.prototype.idAttribute="type_id"},setHistoryId:function(e){this.historyId=e,this._setUpWebStorage()},_setUpWebStorage:function(e){if(this.historyId)return this.storage=new n.HistoryPrefs({id:n.HistoryPrefs.historyStorageKey(this.historyId)}),this.trigger("new-storage",this.storage,this),this.on({"include-deleted":function(e){this.storage.includeDeleted(e)},"include-hidden":function(e){this.storage.includeHidden(e)}}),this.includeDeleted=this.storage.includeDeleted()||!1,this.includeHidden=this.storage.includeHidden()||!1,this},comparators:o.extend(o.clone(c.prototype.comparators),{name:s.buildComparator("name",{ascending:!0}),"name-dsc":s.buildComparator("name",{ascending:!1}),hid:s.buildComparator("hid",{ascending:!1}),"hid-asc":s.buildComparator("hid",{ascending:!0})}),running:function(){return this.filter(function(e){return!e.inReadyState()})},runningAndActive:function(){return this.filter(function(e){return!e.inReadyState()&&e.get("visible")&&!e.get("deleted")})},getByHid:function(e){return this.findWhere({hid:e})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},hidden:function(){return this.filter(function(e){return e.hidden()})},deleted:function(){return this.filter(function(e){return e.get("deleted")})},visibleAndUndeleted:function(){return this.filter(function(e){return e.get("visible")&&!e.get("deleted")})},setIncludeDeleted:function(e,t){if(o.isBoolean(e)&&e!==this.includeDeleted){if(this.includeDeleted=e,o.result(t,"silent"))return;this.trigger("include-deleted",e,this)}},setIncludeHidden:function(e,t){if(o.isBoolean(e)&&e!==this.includeHidden){if(this.includeHidden=e,t=t||{},o.result(t,"silent"))return;this.trigger("include-hidden",e,this)}},fetch:function(e){if(e=e||{},this.historyId&&!e.details){var t=n.HistoryPrefs.get(this.historyId).toJSON();o.isEmpty(t.expandedIds)||(e.details=o.values(t.expandedIds).join(","))}return c.prototype.fetch.call(this,e)},_buildFetchData:function(e){return o.extend(c.prototype._buildFetchData.call(this,e),{v:"dev"})},_fetchParams:c.prototype._fetchParams.concat(["v","details"]),_buildFetchFilters:function(e){var t=c.prototype._buildFetchFilters.call(this,e)||{},i={};return this.includeDeleted||(i.deleted=!1,i.purged=!1),this.includeHidden||(i.visible=!0),o.defaults(t,i)},getTotalItemCount:function(){return this.history.contentsShown()},fetchUpdated:function(e,t){return e&&(t=t||{filters:{}},t.remove=!1,t.filters={"update_time-ge":e.toISOString(),visible:""}),this.fetch(t)},fetchDeleted:function(e){e=e||{};var t=this;return e.filters=o.extend(e.filters,{deleted:!0,purged:void 0}),e.remove=!1,t.trigger("fetching-deleted",t),t.fetch(e).always(function(){t.trigger("fetching-deleted-done",t)})},fetchHidden:function(e){e=e||{};var t=this;return e.filters=o.extend(e.filters,{visible:!1}),e.remove=!1,t.trigger("fetching-hidden",t),t.fetch(e).always(function(){t.trigger("fetching-hidden-done",t)})},fetchAllDetails:function(e){e=e||{};var t={details:"all"};return e.data=o.extend(e.data||{},t),this.fetch(e)},fetchCollectionCounts:function(e){return e=e||{},e.keys=["type_id","element_count"].join(","),e.filters=o.extend(e.filters||{},{history_content_type:"dataset_collection"}),e.remove=!1,this.fetch(e)},_filterAndUpdate:function(e,t){var i=this,n=i.model.prototype.idAttribute,s=[t];return i.fetch({filters:e,remove:!1}).then(function(e){return e=e.reduce(function(e,t,s){var o=i.get(t[n]);return o?e.concat(o):e},[]),i.ajaxQueue("save",s,e)})},ajaxQueue:function(e,t,i){ -return i=i||this.models,new l.AjaxQueue(i.slice().reverse().map(function(i,n){var s=o.isString(e)?i[e]:e;return function(){return s.apply(i,t)}})).deferred},progressivelyFetchDetails:function(e){function i(t){t=t||0;var a=o.extend(o.clone(e),{view:"summary",keys:c,limit:r,offset:t,reset:0===t,remove:!1});o.defer(function(){s.fetch.call(s,a).fail(n.reject).done(function(e){n.notify(e,r,t),e.length!==r?(s.allFetched=!0,n.resolve(e,r,t)):i(t+r)})})}e=e||{};var n=a.Deferred(),s=this,r=e.limitPerCall||s.limitPerProgressiveFetch,l=t.HistoryDatasetAssociation.prototype.searchAttributes,c=l.join(",");return i(),n},isCopyable:function(e){var t=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return o.isObject(e)&&e.id&&o.contains(t,e.model_class)},copy:function(e){var t,i,n;o.isString(e)?(t=e,n="hda",i="dataset"):(t=e.id,n={HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"}[e.model_class]||"hda",i="hdca"===n?"dataset_collection":"dataset");var s=this,r=a.ajax(this.url(),{method:"POST",contentType:"application/json",data:JSON.stringify({content:t,source:n,type:i})}).done(function(e){s.add([e],{parse:!0})}).fail(function(e,o,a){s.trigger("error",s,r,{},"Error copying contents",{type:i,id:t,source:n})});return r},createHDCA:function(e,t,i,n){var s=this.model({history_content_type:"dataset_collection",collection_type:t,history_id:this.historyId,name:i,element_identifiers:e});return s.save(n)},haveSearchDetails:function(){return this.allFetched&&this.all(function(e){return o.has(e.attributes,"annotation")})},matches:function(e){return this.filter(function(t){return t.matches(e)})},clone:function(){var e=r.Collection.prototype.clone.call(this);return e.historyId=this.historyId,e},toString:function(){return["HistoryContents(",[this.historyId,this.length].join(),")"].join("")}});return{HistoryContents:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(1),i(3))},function(e,t,i){var n,s;(function(o){n=[i(6)],s=function(e){"use strict";var t=e.SessionStorageModel.extend({defaults:{expandedIds:{},show_deleted:!1,show_hidden:!1},addExpanded:function(e){var t=this.get("expandedIds");t[e.id]=e.get("id"),this.save("expandedIds",t)},removeExpanded:function(e){var t=this.get("expandedIds");delete t[e.id],this.save("expandedIds",t)},isExpanded:function(e){return o.result(this.get("expandedIds"),e,!1)},allExpanded:function(){return o.values(this.get("expandedIds"))},clearExpanded:function(){this.set("expandedIds",{})},includeDeleted:function(e){return o.isUndefined(e)||this.set("show_deleted",e),this.get("show_deleted")},includeHidden:function(e){return o.isUndefined(e)||this.set("show_hidden",e),this.get("show_hidden")},toString:function(){return"HistoryPrefs("+this.id+")"}},{storageKeyPrefix:"history:",historyStorageKey:function(e){if(!e)throw new Error("HistoryPrefs.historyStorageKey needs valid id: "+e);return t.storageKeyPrefix+e},get:function(e){return new t({id:t.historyStorageKey(e)})},clearAll:function(e){for(var i in sessionStorage)0===i.indexOf(t.storageKeyPrefix)&&sessionStorage.removeItem(i)}});return{HistoryPrefs:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(6),i(5)],s=function(e,t){"use strict";var i="list",n=o.View.extend(e.LoggableMixin).extend({_logNamespace:i,initialize:function(e){this.expanded=e.expanded||!1,this.log("\t expanded:",this.expanded),this.fxSpeed=void 0!==e.fxSpeed?e.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(e){var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){var e=a(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(e).replaceWith(this._renderDetails().show()),e},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;0===t?(i._swapNewRender(e),i.trigger("rendered",i)):a(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",r.isFunction(this.className)?this.className():this.className).append(e.children())},_setUpBehaviors:function(e){e=e||this.$el,e.find("[title]").tooltip({placement:"bottom"})},$details:function(e){return e=e||this.$el,e.find("> .details")},_renderDetails:function(){var e=a(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(e),e},toggleExpanded:function(e){return e=void 0===e?!this.expanded:e,e?this.expand():this.collapse(),this},expand:function(){var e=this;return e._fetchModelDetails().always(function(){e._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?l.when():this.model.fetch()},_expand:function(){var e=this,t=e._renderDetails();e.$details().replaceWith(t),e.expanded=!0,e.$details().slideDown(e.fxSpeed,function(){e.trigger("expanded",e)})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var e=this;e.expanded=!1,this.$details().slideUp(e.fxSpeed,function(){e.trigger("collapsed",e)})}}),s=n.extend(e.mixin(e.SelectableViewMixin,e.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(t){n.prototype.initialize.call(this,t),e.SelectableViewMixin.initialize.call(this,t),e.DraggableViewMixin.initialize.call(this,t),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(e){e?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var e=n.prototype._buildNewRender.call(this);return e.children(".warnings").replaceWith(this._renderWarnings()),e.children(".title-bar").replaceWith(this._renderTitleBar()),e.children(".primary-actions").append(this._renderPrimaryActions()),e.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),e},_swapNewRender:function(e){return n.prototype._swapNewRender.call(this,e),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var e=this,t=a('
    '),i=e.model.toJSON();return r.each(e.templates.warnings,function(n){t.append(a(n(i,e)))}),t},_renderTitleBar:function(){return a(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return a(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(e){e.stopPropagation(),e.altKey?(this.toggleSelect(e),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(e){var t=32,i=13;return!e||"keydown"!==e.type||e.keyCode!==t&&e.keyCode!==i||(this.toggleExpanded(),e.stopPropagation(),!1)},toString:function(){var e=this.model?this.model+"":"(no model)";return"ListItemView("+e+")"}}));s.prototype.templates=function(){var t=e.wrapTemplate(['
    ','
    ','
    ','',"
    ",'
    ','
    ','
    ',"
    "]),i={},n=e.wrapTemplate(['
    ','','
    ','<%- element.name %>',"
    ",'
    ',"
    "],"element"),s=e.wrapTemplate(['
    ']),o=e.wrapTemplate(['
    ']);return{el:t,warnings:i,titleBar:n,subtitle:s,details:o}}();var c=s.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(e){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=e.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=e.foldoutPanelClass||this.foldoutPanelClass,s.prototype.initialize.call(this,e),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return a();var e=s.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,e)},_createFoldoutPanel:function(){var e=this.model,t=this._getFoldoutPanelClass(e),i=this._getFoldoutPanelOptions(e),n=new t(r.extend(i,{model:e}));return n},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(e,t){return t=t||this.$("> .details"),this.foldout=e.render(0),e.$("> .controls").hide(),t.append(e.$el)},expand:function(){var e=this;return e._fetchModelDetails().always(function(){"foldout"===e.foldoutStyle?e._expand():"drilldown"===e.foldoutStyle&&e._expandByDrilldown()})},_expandByDrilldown:function(){var e=this;e.listenTo(e.foldout,"close",function(){e.trigger("collapsed:drilldown",e,e.foldout)}),e.trigger("expanded:drilldown",e,e.foldout)}});return c.prototype.templates=function(){var t=e.wrapTemplate(['
    ',"
    "],"collection");return r.extend({},s.prototype.templates,{details:t})}(),{ExpandableView:n,ListItemView:s,FoldoutListItemView:c}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2),i(1))},function(e,t,i){var n,s;(function(o,a){n=[i(4),i(55),i(7),i(38),i(17),i(28)],s=function(e,t,i,n,s,r){return n.extend({initialize:function(e){var i=this;n.prototype.initialize.call(this,e),this.deferred=new t,e.inputs?this._buildForm(e):this.deferred.execute(function(t){i._buildModel(t,e,!0)}),e.listen_to_history&&parent.Galaxy&&parent.Galaxy.currHistoryPanel&&this.listenTo(parent.Galaxy.currHistoryPanel.collection,"change",function(){this.refresh()})},refresh:function(){var e=this;e.deferred.reset(),this.deferred.execute(function(t){e._updateModel(t)})},remove:function(){var e=this;this.$el.hide(),this.deferred.execute(function(){n.prototype.remove.call(e),Galaxy.emit.debug("tool-form-base::remove()","Destroy view.")})},_buildForm:function(t){var i=this;this.options=e.merge(t,this.options),this.options=e.merge({icon:t.icon,title:""+t.name+" "+t.description+" (Galaxy Version "+t.version+")",operations:!this.options.hide_operations&&this._operations(),onchange:function(){i.refresh()}},this.options),this.options.customize&&this.options.customize(this.options),this.render(),this.options.collapsible||this.$el.append(o("
    ").addClass("ui-margin-top-large").append(this._footer()))},_buildModel:function(t,n,s){var a=this;this.options.id=n.id,this.options.version=n.version;var r="",l={};n.job_id?r=Galaxy.root+"api/jobs/"+n.job_id+"/build_for_rerun":(r=Galaxy.root+"api/tools/"+n.id+"/build",Galaxy.params&&Galaxy.params.tool_id==n.id&&(l=o.extend({},Galaxy.params),n.version&&(l.tool_version=n.version))),e.get({url:r,data:l,success:function(e){return e=e.tool_model||e,e.display?(a._buildForm(e),!s&&a.message.update({status:"success",message:"Now you are using '"+a.options.name+"' version "+a.options.version+", id '"+a.options.id+"'.",persistent:!1}),Galaxy.emit.debug("tool-form-base::initialize()","Initial tool model ready.",e),void t.resolve()):void(window.location=Galaxy.root)},error:function(e,n){var s=e&&e.err_msg||"Uncaught error.";401==n.status?window.location=Galaxy.root+"user/login?"+o.param({redirect:Galaxy.root+"?tool_id="+a.options.id}):a.$el.is(":empty")?a.$el.prepend(new i.Message({message:s,status:"danger",persistent:!0,large:!0}).$el):Galaxy.modal&&Galaxy.modal.show({title:"Tool request failed",body:s,buttons:{Close:function(){Galaxy.modal.hide()}}}),Galaxy.emit.debug("tool-form::initialize()","Initial tool model request failed.",e),t.reject()}})},_updateModel:function(t){var i=this,n=this.options.update_url||Galaxy.root+"api/tools/"+this.options.id+"/build",s={tool_id:this.options.id,tool_version:this.options.version,inputs:o.extend(!0,{},i.data.create())};this.wait(!0),Galaxy.emit.debug("tool-form-base::_updateModel()","Sending current state.",s),e.request({type:"POST",url:n,data:s,success:function(e){i.update(e.tool_model||e),i.options.update&&i.options.update(e),i.wait(!1),Galaxy.emit.debug("tool-form-base::_updateModel()","Received new model.",e),t.resolve()},error:function(e){Galaxy.emit.debug("tool-form-base::_updateModel()","Refresh request failed.",e),t.reject()}})},_operations:function(){var e=this,t=this.options,n=new i.ButtonMenu({icon:"fa-cubes",title:!t.narrow&&"Versions"||null,tooltip:"Select another tool version"});if(!t.sustain_version&&t.versions&&t.versions.length>1)for(var s in t.versions){var o=t.versions[s];o!=t.version&&n.addMenu({title:"Switch to "+o,version:o,icon:"fa-cube",onclick:function(){var i=t.id.replace(t.version,this.version),n=this.version;e.deferred.reset(),e.deferred.execute(function(t){e._buildModel(t,{id:i,version:n})})}})}else n.$el.hide();var a=new i.ButtonMenu({icon:"fa-caret-down",title:!t.narrow&&"Options"||null,tooltip:"View available options"});return t.biostar_url&&(a.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(t.biostar_url+"/p/new/post/")}}),a.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(t.biostar_url+"/local/search/page/?q="+t.name)}})),a.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+Galaxy.root+"root?tool_id="+t.id)}}),Galaxy.user&&Galaxy.user.get("is_admin")&&a.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=Galaxy.root+"api/tools/"+t.id+"/download"}}),t.requirements&&t.requirements.length>0&&a.addMenu({icon:"fa-info-circle",title:"Requirements",tooltip:"Display tool requirements",onclick:function(){!this.visible||e.portlet.collapsed?(this.visible=!0,e.portlet.expand(),e.message.update({persistent:!0,message:e._templateRequirements(t),status:"info"})):(this.visible=!1,e.message.update({message:""}))}}),t.sharable_url&&a.addMenu({icon:"fa-external-link",title:"See in Tool Shed",tooltip:"Access the repository",onclick:function(){window.open(t.sharable_url)}}),{menu:a,versions:n}},_footer:function(){var e=this.options,t=o("
    ").append(this._templateHelp(e));if(e.citations){var i=o("
    "),n=new s.ToolCitationCollection;n.tool_id=e.id;var a=new r.CitationListView({el:i,collection:n});a.render(),n.fetch(),t.append(i)}return t},_templateHelp:function(e){var t=o("
    ").addClass("ui-form-help").append(e.help);return t.find("a").attr("target","_blank"),t},_templateRequirements:function(e){var t=e.requirements.length;if(t>0){var i="This tool requires ";a.each(e.requirements,function(e,n){i+=e.name+(e.version?" (Version "+e.version+")":"")+(n").attr("target","_blank").attr("href","https://wiki.galaxyproject.org/Tools/Requirements").text("here");return o("").append(i+". Click ").append(n).append(" for more information.")}return"No requirements found."}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(1),i(2))},function(e,t,i){var n,s;(function(o,a){n=[i(2),i(16),i(11),i(18)],s=function(e,t,i,n){"use strict";var s={hidden:!1,show:function(){this.set("hidden",!1)},hide:function(){this.set("hidden",!0)},toggle:function(){this.set("hidden",!this.get("hidden"))},is_visible:function(){return!this.attributes.hidden}},r=o.Model.extend({defaults:{name:null,label:null,type:null,value:null,html:null,num_samples:5},initialize:function(e){this.attributes.html=unescape(this.attributes.html)},copy:function(){return new r(this.toJSON())},set_value:function(e){this.set("value",e||"")}}),l=o.Collection.extend({model:r}),c=r.extend({}),d=r.extend({set_value:function(e){this.set("value",parseInt(e,10))},get_samples:function(){return d3.scale.linear().domain([this.get("min"),this.get("max")]).ticks(this.get("num_samples"))}}),h=d.extend({set_value:function(e){this.set("value",parseFloat(e))}}),u=r.extend({get_samples:function(){return e.map(this.get("options"),function(e){return e[0]})}});r.subModelTypes={integer:d,"float":h,data:c,select:u};var p=o.Model.extend({defaults:{id:null,name:null,description:null,target:null,inputs:[],outputs:[]},urlRoot:Galaxy.root+"api/tools",initialize:function(t){this.set("inputs",new l(e.map(t.inputs,function(e){var t=r.subModelTypes[e.type]||r;return new t(e)})))},toJSON:function(){var e=o.Model.prototype.toJSON.call(this);return e.inputs=this.get("inputs").map(function(e){return e.toJSON()}),e},remove_inputs:function(e){var t=this,i=t.get("inputs").filter(function(t){return e.indexOf(t.get("type"))!==-1});t.get("inputs").remove(i)},copy:function(e){var t=new p(this.toJSON());if(e){var i=new o.Collection;t.get("inputs").each(function(e){e.get_samples()&&i.push(e)}),t.set("inputs",i)}return t},apply_search_results:function(t){return e.indexOf(t,this.attributes.id)!==-1?this.show():this.hide(),this.is_visible()},set_input_value:function(e,t){this.get("inputs").find(function(t){return t.get("name")===e}).set("value",t)},set_input_values:function(t){var i=this;e.each(e.keys(t),function(e){i.set_input_value(e,t[e])})},run:function(){return this._run()},rerun:function(e,t){return this._run({action:"rerun",target_dataset_id:e.id,regions:t})},get_inputs_dict:function(){var e={};return this.get("inputs").each(function(t){e[t.get("name")]=t.get("value")}),e},_run:function(n){var s=e.extend({tool_id:this.id,inputs:this.get_inputs_dict()},n),o=a.Deferred(),r=new t.ServerStateDeferred({ajax_settings:{url:this.urlRoot,data:JSON.stringify(s),dataType:"json",contentType:"application/json",type:"POST"},interval:2e3,success_fn:function(e){return"pending"!==e}});return a.when(r.go()).then(function(e){o.resolve(new i.DatasetCollection(e))}),o}});e.extend(p.prototype,s);var f=(o.View.extend({}),o.Collection.extend({model:p})),g=o.Model.extend(s),m=o.Model.extend({defaults:{elems:[],open:!1},clear_search_results:function(){e.each(this.attributes.elems,function(e){e.show()}),this.show(),this.set("open",!1)},apply_search_results:function(t){var i,n=!0;e.each(this.attributes.elems,function(e){e instanceof g?(i=e,i.hide()):e instanceof p&&e.apply_search_results(t)&&(n=!1,i&&i.show())}),n?this.hide():(this.show(),this.set("open",!0))}});e.extend(m.prototype,s);var v=o.Model.extend({defaults:{search_hint_string:"search tools",min_chars_for_search:3,clear_btn_url:"",search_url:"",visible:!0,query:"",results:null,clear_key:27},urlRoot:Galaxy.root+"api/tools",initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var e=this.attributes.query;if(e.length");e.append(S.tool_link(this.model.toJSON()));var t=this.model.get("form_style",null);if("upload1"===this.model.id)e.find("a").on("click",function(e){e.preventDefault(),Galaxy.upload.show()});else if("regular"===t){var i=this;e.find("a").on("click",function(e){e.preventDefault();var t=new n.View({id:i.model.id,version:i.model.get("version")});t.deferred.execute(function(){Galaxy.app.display(t)})})}return this.$el.append(e),this}}),b=y.extend({tagName:"div",className:"toolPanelLabel",render:function(){return this.$el.append(a("").text(this.model.attributes.text)),this}}),x=y.extend({tagName:"div",className:"toolSectionWrapper",initialize:function(){y.prototype.initialize.call(this),this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(S.panel_section(this.model.toJSON()));var t=this.$el.find(".toolSectionBody");return e.each(this.model.attributes.elems,function(e){if(e instanceof p){var i=new w({model:e,className:"toolTitle"});i.render(),t.append(i.$el)}else if(e instanceof g){var n=new b({model:e});n.render(),t.append(n.$el)}}),this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast")}}),C=o.View.extend({tagName:"div",id:"tool-search",className:"bar",events:{click:"focus_and_select","keyup :input":"query_changed","click #search-clear-btn":"clear"},render:function(){return this.$el.append(S.tool_search(this.model.toJSON())),this.model.is_visible()||this.$el.hide(),this.$el.find("[title]").tooltip(),this},focus_and_select:function(){this.$el.find(":input").focus().select()},clear:function(){return this.model.clear_search(),this.$el.find(":input").val(""),this.focus_and_select(),!1},query_changed:function(e){return this.model.attributes.clear_key&&this.model.attributes.clear_key===e.which?(this.clear(),!1):void this.model.set("query",this.$el.find(":input").val())}}),$=o.View.extend({tagName:"div",className:"toolMenu",initialize:function(){this.model.get("tool_search").on("change:results",this.handle_search_results,this)},render:function(){var e=this,t=new C({model:this.model.get("tool_search")});return t.render(),e.$el.append(t.$el),this.model.get("layout").each(function(t){if(t instanceof m){var i=new x({model:t});i.render(),e.$el.append(i.$el)}else if(t instanceof p){var n=new w({model:t,className:"toolTitleNoSection"});n.render(),e.$el.append(n.$el)}else if(t instanceof g){var s=new b({model:t});s.render(),e.$el.append(s.$el)}}),e.$el.find("a.tool-link").click(function(t){var i=a(this).attr("class").split(/\s+/)[0],n=e.model.get("tools").get(i);e.trigger("tool_link_click",t,n)}),this},handle_search_results:function(){var e=this.model.get("tool_search").get("results");e&&0===e.length?a("#search-no-results").show():a("#search-no-results").hide()}}),E=o.View.extend({className:"toolForm",render:function(){this.$el.children().remove(),this.$el.append(S.tool_form(this.model.toJSON()))}}),S=(o.View.extend({className:"toolMenuAndView",initialize:function(){this.tool_panel_view=new $({collection:this.collection}),this.tool_form_view=new E},render:function(){this.tool_panel_view.render(),this.tool_panel_view.$el.css("float","left"),this.$el.append(this.tool_panel_view.$el),this.tool_form_view.$el.hide(),this.$el.append(this.tool_form_view.$el);var e=this;this.tool_panel_view.on("tool_link_click",function(t,i){t.preventDefault(),e.show_tool(i)})},show_tool:function(e){var t=this;e.fetch().done(function(){t.tool_form_view.model=e,t.tool_form_view.render(),t.tool_form_view.$el.show(),a("#left").width("650px")})}}),{tool_search:e.template(['',' ',''].join("")),panel_section:e.template(['",'
    '+e.content+"
    "}});return{View:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1))},function(e,t,i){var n,s;(function(i){n=[],s=function(){var e=i.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_name:"",file_mode:"",file_size:0,file_type:null,file_path:"",file_data:null,percentage:0,space_to_tab:!1,to_posix_lines:!0,enabled:!0},reset:function(e){this.clear().set(this.defaults).set(e)}}),t=i.Collection.extend({model:e});return{Model:e,Collection:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3))},,function(e,t,i){var n,s;(function(o,a){n=[i(4)],s=function(e){return o.Model.extend({initialize:function(){this.active={},this.last=null},execute:function(t){var i=this,n=e.uid(),s=t.length>0;this.active[n]=!0;var o=a.Deferred();o.promise().always(function(){delete i.active[n],s&&Galaxy.emit.debug("deferred::execute()",this.state().charAt(0).toUpperCase()+this.state().slice(1)+" "+n)}),a.when(this.last).always(function(){i.active[n]?(s&&Galaxy.emit.debug("deferred::execute()","Running "+n),t(o),!s&&o.resolve()):o.reject()}),this.last=o.promise()},reset:function(){Galaxy.emit.debug("deferred::execute()","Reset");for(var e in this.active)this.active[e]=!1},ready:function(){return a.isEmptyObject(this.active)}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1))},,,,,,,,,,,function(e,t,i){var n,s;(function(o,a){n=[i(6),i(5),i(15)],s=function(e,t){var i=o.View.extend(e.LoggableMixin).extend(e.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"annotation-display",initialize:function(e){e=e||{},this.tooltipConfig=e.tooltipConfig||{placement:"bottom"},this.listenTo(this.model,"change:annotation",function(){this.render()}),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.$el.html(this._template()),this.$annotation().make_text_editable({use_textarea:!0,on_finish:function(t){e.$annotation().text(t),e.model.save({annotation:t},{silent:!0}).fail(function(){e.$annotation().text(e.model.previous("annotation"))})}}),this},_template:function(){var e=this.model.get("annotation");return['",'
    ',a.escape(e),"
    "].join("")},$annotation:function(){return this.$el.find(".annotation")},remove:function(){this.$annotation.off(),this.stopListening(this.model),o.View.prototype.remove.call(this)},toString:function(){return["AnnotationEditor(",this.model+"",")"].join("")}});return{AnnotationEditor:i}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2))},function(e,t,i){var n,s;(function(o){n=[i(2),i(3),i(6)],s=function(e,t,i){"use strict";var n=t.Collection.extend({initialize:function(e,i){t.Collection.prototype.initialize.call(this,e,i),this.setOrder(i.order||this.order,{silent:!0})},_setUpListeners:function(){return this.on({"changed-order":this.sort})},fetch:function(e){return e=this._buildFetchOptions(e),t.Collection.prototype.fetch.call(this,e)},_buildFetchOptions:function(t){t=e.clone(t)||{};var i=this;t.traditional=!0,t.data=t.data||i._buildFetchData(t);var n=this._buildFetchFilters(t);return e.isEmpty(n)||e.extend(t.data,this._fetchFiltersToAjaxData(n)),t},_buildFetchData:function(t){var i={};return this.order&&(i.order=this.order),e.defaults(e.pick(t,this._fetchParams),i)},_fetchParams:["order","limit","offset","view","keys"],_buildFetchFilters:function(t){return e.clone(t.filters||{})},_fetchFiltersToAjaxData:function(t){var i={q:[],qv:[]};return e.each(t,function(e,t){void 0!==e&&""!==e&&(e===!0&&(e="True"),e===!1&&(e="False"),null===e&&(e="None"),i.q.push(t),i.qv.push(e))}),i},reset:function(e,i){return this.allFetched=!1,t.Collection.prototype.reset.call(this,e,i)},order:null,comparators:{update_time:i.buildComparator("update_time",{ascending:!1}),"update_time-asc":i.buildComparator("update_time",{ascending:!0}),create_time:i.buildComparator("create_time",{ascending:!1}),"create_time-asc":i.buildComparator("create_time",{ascending:!0})},setOrder:function(t,i){i=i||{};var n=this,s=n.comparators[t];if(e.isUndefined(s))throw new Error("unknown order: "+t);if(s!==n.comparator){n.order;return n.order=t,n.comparator=s,i.silent||n.trigger("changed-order",i),n}}}),s=n.extend({limitPerPage:500,initialize:function(e,t){n.prototype.initialize.call(this,e,t),this.currentPage=t.currentPage||0},getTotalItemCount:function(){return this.length},shouldPaginate:function(){return this.getTotalItemCount()>=this.limitPerPage},getLastPage:function(){return Math.floor(this.getTotalItemCount()/this.limitPerPage)},getPageCount:function(){return this.getLastPage()+1},getPageLimitOffset:function(e){return e=this.constrainPageNum(e),{limit:this.limitPerPage,offset:e*this.limitPerPage}},constrainPageNum:function(e){return Math.max(0,Math.min(e,this.getLastPage()))},fetchPage:function(t,i){var n=this;return t=n.constrainPageNum(t),n.currentPage=t,i=e.defaults(i||{},n.getPageLimitOffset(t)),n.trigger("fetching-more"),n.fetch(i).always(function(){n.trigger("fetching-more-done")})},fetchCurrentPage:function(e){return this.fetchPage(this.currentPage,e)},fetchPrevPage:function(e){return this.fetchPage(this.currentPage-1,e)},fetchNextPage:function(e){return this.fetchPage(this.currentPage+1,e)}}),a=n.extend({limitOnFirstFetch:null,limitPerFetch:100,initialize:function(e,t){n.prototype.initialize.call(this,e,t),this.limitOnFirstFetch=t.limitOnFirstFetch||this.limitOnFirstFetch,this.limitPerFetch=t.limitPerFetch||this.limitPerFetch,this.allFetched=!1,this.lastFetched=t.lastFetched||0},_buildFetchOptions:function(e){return e.remove=e.remove||!1,n.prototype._buildFetchOptions.call(this,e)},fetchFirst:function(t){return t=t?e.clone(t):{},this.allFetched=!1,this.lastFetched=0,this.fetchMore(e.defaults(t,{reset:!0,limit:this.limitOnFirstFetch}))},fetchMore:function(t){t=e.clone(t||{});var i=this;if(!t.reset&&i.allFetched)return o.when();t.offset=t.reset?0:t.offset||i.lastFetched;var n=t.limit=t.limit||i.limitPerFetch||null;return i.trigger("fetching-more"),i.fetch(t).always(function(){i.trigger("fetching-more-done")}).done(function(t){var s=e.isArray(t)?t.length:0;i.lastFetched+=s,(!n||s .controls").add(this.$list()).hide(),e.parentName=this.model.get("name"),this.$el.append(e.render().$el)},_collapseDrilldownPanel:function(e){this.panelStack.pop(),this.render()},events:{"click .navigation .back":"close"},close:function(e){this.remove(),this.trigger("close")},toString:function(){return"CollectionView("+(this.model?this.model.get("name"):"")+")"}});l.prototype.templates=function(){var e=n.wrapTemplate(['
    ','",'
    ','
    <%- collection.name || collection.element_identifier %>
    ','
    ','<% if( collection.collection_type === "list" ){ %>',s("a list of datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',s("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',s("a list of paired datasets"),'<% } else if( collection.collection_type === "list:list" ){ %>',s("a list of dataset lists"),"<% } %>","
    ","
    ","
    "],"collection");return o.extend(o.clone(r.prototype.templates),{controls:e})}();var c=l.extend({DatasetDCEViewClass:i.DatasetDCEListItemView,toString:function(){return"ListCollectionView("+(this.model?this.model.get("name"):"")+")"}}),d=c.extend({toString:function(){return"PairCollectionView("+(this.model?this.model.get("name"):"")+")"}}),h=l.extend({NestedDCDCEViewClass:i.NestedDCDCEListItemView.extend({foldoutPanelClass:d}),toString:function(){return"ListOfPairsCollectionView("+(this.model?this.model.get("name"):"")+")"}}),u=l.extend({NestedDCDCEViewClass:i.NestedDCDCEListItemView.extend({foldoutPanelClass:d}),toString:function(){return"ListOfListsCollectionView("+(this.model?this.model.get("name"):"")+")"}});return{CollectionView:l,ListCollectionView:c,PairCollectionView:d,ListOfPairsCollectionView:h,ListOfListsCollectionView:u}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o,a){n=[i(12),i(32),i(77),i(66),i(22),i(6),i(5)],s=function(e,t,n,s,r,l,c){"use strict";var d=t.DatasetListItemView,h=d.extend({initialize:function(e){d.prototype.initialize.call(this,e),this.hasUser=e.hasUser,this.purgeAllowed=e.purgeAllowed||!1,this.tagsEditorShown=e.tagsEditorShown||!1,this.annotationEditorShown=e.annotationEditorShown||!1},_renderPrimaryActions:function(){var t=d.prototype._renderPrimaryActions.call(this);return this.model.get("state")===e.NOT_VIEWABLE?t:d.prototype._renderPrimaryActions.call(this).concat([this._renderEditButton(),this._renderDeleteButton()])},_renderEditButton:function(){if(this.model.get("state")===e.DISCARDED||!this.model.get("accessible"))return null;var t=this.model.get("purged"),i=this.model.get("deleted"),n={title:c("Edit attributes"),href:this.model.urls.edit,target:this.linkTarget,faIcon:"fa-pencil",classes:"edit-btn"};return i||t?(n.disabled=!0,t?n.title=c("Cannot edit attributes of datasets removed from disk"):i&&(n.title=c("Undelete dataset to edit attributes"))):o.contains([e.UPLOAD,e.NEW],this.model.get("state"))&&(n.disabled=!0,n.title=c("This dataset is not yet editable")),r(n)},_renderDeleteButton:function(){if(!this.model.get("accessible"))return null;var e=this,t=this.model.isDeletedOrPurged();return r({title:c(t?"Dataset is already deleted":"Delete"),disabled:t,faIcon:"fa-times",classes:"delete-btn",onclick:function(){e.$el.find(".icon-btn.delete-btn").trigger("mouseout"),e.model["delete"]()}})},_renderDetails:function(){var t=d.prototype._renderDetails.call(this),i=this.model.get("state");return!this.model.isDeletedOrPurged()&&o.contains([e.OK,e.FAILED_METADATA],i)&&(this._renderTags(t),this._renderAnnotation(t),this._makeDbkeyEditLink(t)),this._setUpBehaviors(t),t},_renderSecondaryActions:function(){var t=d.prototype._renderSecondaryActions.call(this);switch(this.model.get("state")){case e.UPLOAD:case e.NOT_VIEWABLE:return t;case e.ERROR:return t.unshift(this._renderErrButton()),t.concat([this._renderRerunButton()]);case e.OK:case e.FAILED_METADATA:return t.concat([this._renderRerunButton(),this._renderVisualizationsButton()])}return t.concat([this._renderRerunButton()])},_renderErrButton:function(){return r({title:c("View or report this error"),href:this.model.urls.report_error,classes:"report-error-btn",target:this.linkTarget,faIcon:"fa-bug"})},_renderRerunButton:function(){var e=this.model.get("creating_job");if(this.model.get("rerunnable"))return r({title:c("Run this job again"),href:this.model.urls.rerun,classes:"rerun-btn",target:this.linkTarget,faIcon:"fa-refresh",onclick:function(t){t.preventDefault(),!function(){var t=[i(18)];(function(t){var i=new t.View({job_id:e});i.deferred.execute(function(){Galaxy.app.display(i)})}).apply(null,t)}()}})},_renderVisualizationsButton:function(){var e=this.model.get("visualizations");if(this.model.isDeletedOrPurged()||!this.hasUser||!this.model.hasData()||o.isEmpty(e))return null;if(!o.isObject(e[0]))return this.warn("Visualizations have been switched off"),null;var t=a(this.templates.visualizations(e,this));return t.find('[target="galaxy_main"]').attr("target",this.linkTarget),this._addScratchBookFn(t.find(".visualization-link").addBack(".visualization-link")),t},_addScratchBookFn:function(e){e.click(function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Visualization",url:a(this).attr("href")}),e.preventDefault(),e.stopPropagation())})},_renderTags:function(e){if(this.hasUser){var t=this;this.tagsEditor=new n.TagsEditor({model:this.model,el:e.find(".tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.tagsEditorShown=!0},onhide:function(){t.tagsEditorShown=!1},$activator:r({title:c("Edit dataset tags"),classes:"tag-btn",faIcon:"fa-tags"}).appendTo(e.find(".actions .right"))}),this.tagsEditorShown&&this.tagsEditor.toggle(!0)}},_renderAnnotation:function(e){if(this.hasUser){var t=this;this.annotationEditor=new s.AnnotationEditor({model:this.model,el:e.find(".annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.annotationEditorShown=!0},onhide:function(){t.annotationEditorShown=!1},$activator:r({title:c("Edit dataset annotation"),classes:"annotate-btn",faIcon:"fa-comment"}).appendTo(e.find(".actions .right"))}),this.annotationEditorShown&&this.annotationEditor.toggle(!0)}},_makeDbkeyEditLink:function(e){if("?"===this.model.get("metadata_dbkey")&&!this.model.isDeletedOrPurged()){var t=a('?').attr("href",this.model.urls.edit).attr("target",this.linkTarget);e.find(".dbkey .value").replaceWith(t)}},events:o.extend(o.clone(d.prototype.events),{"click .undelete-link":"_clickUndeleteLink","click .purge-link":"_clickPurgeLink","click .edit-btn":function(e){this.trigger("edit",this,e)},"click .delete-btn":function(e){this.trigger("delete",this,e)},"click .rerun-btn":function(e){this.trigger("rerun",this,e)},"click .report-err-btn":function(e){this.trigger("report-err",this,e)},"click .visualization-btn":function(e){this.trigger("visualize",this,e)},"click .dbkey a":function(e){this.trigger("edit",this,e)}}),_clickUndeleteLink:function(e){return this.model.undelete(),!1},_clickPurgeLink:function(e){return confirm(c("This will permanently remove the data in your dataset. Are you sure?"))&&this.model.purge(),!1},toString:function(){var e=this.model?this.model+"":"(no model)";return"HDAEditView("+e+")"}});return h.prototype.templates=function(){var e=o.extend({},d.prototype.templates.warnings,{failed_metadata:l.wrapTemplate(['<% if( dataset.state === "failed_metadata" ){ %>','","<% } %>"],"dataset"),deleted:l.wrapTemplate(["<% if( dataset.deleted && !dataset.purged ){ %>",'
    ',c("This dataset has been deleted"),'
    ',c("Undelete it"),"","<% if( view.purgeAllowed ){ %>",'
    ',c("Permanently remove it from disk"),"","<% } %>","
    ","<% } %>"],"dataset")}),t=l.wrapTemplate(["<% if( visualizations.length === 1 ){ %>",'">','',"","<% } else { %>",'","<% } %>"],"visualizations");return o.extend({},d.prototype.templates,{warnings:e,visualizations:t})}(),{DatasetListItemEdit:h}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(12),i(6),i(5)],s=function(e,t,i){"use strict";var n="dataset",s=t.SearchableModelMixin,l=o.Model.extend(t.LoggableMixin).extend(t.mixin(s,{_logNamespace:n,defaults:{state:e.NEW,deleted:!1,purged:!1,name:"(unnamed dataset)",accessible:!0,data_type:"",file_ext:"",file_size:0,meta_files:[],misc_blurb:"",misc_info:"",tags:[]},initialize:function(t,i){this.debug(this+"(Dataset).initialize",t,i), +webpackJsonp([3,1],[function(e,t,i){(function(e,t){var n=i(1),s=n,o=i(57).GalaxyApp,a=i(56),r=i(10),l=i(90),c=i(89),d=i(59),h=i(18),u=i(45);window.app=function(i,n){window.Galaxy=new o(i,n),Galaxy.debug("analysis app");var p=i.config,g=new l({el:"#left",userIsAnonymous:Galaxy.user.isAnonymous(),search_url:p.search_url,toolbox:p.toolbox,toolbox_in_panel:p.toolbox_in_panel,stored_workflow_menu_entries:p.stored_workflow_menu_entries,nginx_upload_path:p.nginx_upload_path,ftp_upload_site:p.ftp_upload_site,default_genome:p.default_genome,default_extension:p.default_extension}),f=new r.CenterPanel({el:"#center"}),m=new c({el:"#right",galaxyRoot:Galaxy.root,userIsAnonymous:Galaxy.user.isAnonymous(),allow_user_dataset_purge:p.allow_user_dataset_purge}),v=new d.PageLayoutView(e.extend(i,{el:"body",left:g,center:f,right:m}));Galaxy.page=v,Galaxy.params=Galaxy.config.params,Galaxy.toolPanel=g.tool_panel,Galaxy.upload=g.uploadButton,Galaxy.currHistoryPanel=m.historyView,Galaxy.currHistoryPanel.listenToGalaxy(Galaxy),Galaxy.app={display:function(e,t){s(".select2-hidden-accessible").remove(),f.display(e)}};new(t.Router.extend({initialize:function(e){this.options=e},execute:function(e,t,i){Galaxy.debug("router execute:",e,t,i);var n=a.parse(t.pop());t.push(n),e&&e.apply(this,t)},routes:{"(/)":"home","(/)root*":"home","(/)tours(/)(:tour_id)":"show_tours"},show_tours:function(e){e?u.giveTour(e):f.display(new u.ToursView)},home:function(e){e.tool_id||e.job_id?"upload1"===e.tool_id?(Galaxy.upload.show(),this._loadCenterIframe("welcome")):this._loadToolForm(e):e.workflow_id?this._loadCenterIframe("workflow/run?id="+e.workflow_id):e.m_c?this._loadCenterIframe(e.m_c+"/"+e.m_a):this._loadCenterIframe("welcome")},_loadToolForm:function(e){e.id=e.tool_id,f.display(new h.View(e))},_loadCenterIframe:function(e,t){t=t||Galaxy.root,e=t+e,f.$("#galaxy_main").prop("src",e)}}))(i);s(function(){v.render(),v.right.historyView.loadCurrentHistory(),Galaxy.listenTo(v.right.historyView,"history-size-change",function(){Galaxy.user.fetch({url:Galaxy.user.urlRoot()+"/"+(Galaxy.user.id||"current")})}),v.right.historyView.connectToQuotaMeter(v.masthead.quotaMeter),t.history.start({root:Galaxy.root,pushState:!0})})}}).call(t,i(2),i(3))},,,,,,,function(e,t,i){var n,s;(function(o,a){n=[i(4),i(21),i(51),i(20),i(47),i(13),i(8)],s=function(e,t,i,n,s,r,l){var c=o.View.extend({tagName:"label",initialize:function(e){this.model=e&&e.model||new o.Model(e),this.tagName=e.tagName||this.tagName,this.setElement(a("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},title:function(e){this.model.set("title",e)},value:function(){return this.model.get("title")},render:function(){return this.$el.removeClass().addClass("ui-label").addClass(this.model.get("cls")).html(this.model.get("title")),this}}),d=o.View.extend({initialize:function(e){this.model=e&&e.model||new o.Model({message:null,status:"info",cls:"",persistent:!1,fade:!0}).set(e),this.listenTo(this.model,"change",this.render,this),this.render()},update:function(e){this.model.set(e)},render:function(){this.$el.removeClass().addClass("ui-message").addClass(this.model.get("cls"));var e=this.model.get("status");if(this.model.get("large")?this.$el.addClass(("success"==e&&"done"||"danger"==e&&"error"||e)+"messagelarge"):this.$el.addClass("alert").addClass("alert-"+e),this.model.get("message")){if(this.$el.html(this.model.get("message")),this.$el[this.model.get("fade")?"fadeIn":"show"](),this.timeout&&window.clearTimeout(this.timeout),!this.model.get("persistent")){var t=this;this.timeout=window.setTimeout(function(){t.model.set("message","")},3e3)}}else this.$el.fadeOut();return this}}),h=o.View.extend({initialize:function(e){this.model=e&&e.model||new o.Model({type:"text",placeholder:"",disabled:!1,visible:!0,cls:"",area:!1,color:null,style:null}).set(e),this.tagName=this.model.get("area")?"textarea":"input",this.setElement(a("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},events:{input:"_onchange"},value:function(e){return void 0!==e&&this.model.set("value","string"==typeof e?e:""),this.model.get("value")},render:function(){return 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")||""),this.model.get("value")!==this.$el.val()&&this.$el.val(this.model.get("value")),this.model.get("disabled")?this.$el.attr("disabled",!0):this.$el.removeAttr("disabled"),this.$el[this.model.get("visible")?"show":"hide"](),this},_onchange:function(){this.value(this.$el.val()),this.model.get("onchange")&&this.model.get("onchange")(this.model.get("value"))}}),u=o.View.extend({initialize:function(e){this.model=e&&e.model||new o.Model(e),this.setElement(a("
    ").append(this.$info=a("
    ")).append(this.$hidden=a("
    "))),this.listenTo(this.model,"change",this.render,this),this.render()},value:function(e){return void 0!==e&&this.model.set("value",e),this.model.get("value")},render:function(){return this.$el.attr("id",this.model.id),this.$hidden.val(this.model.get("value")),this.model.get("info")?this.$info.show().html(this.model.get("info")):this.$info.hide(),this}});return{Button:r.ButtonDefault,ButtonIcon:r.ButtonIcon,ButtonCheck:r.ButtonCheck,ButtonMenu:r.ButtonMenu,ButtonLink:r.ButtonLink,Input:h,Label:c,Message:d,Modal:l,RadioButton:n.RadioButton,Checkbox:n.Checkbox,Radio:n.Radio,Select:t,Hidden:u,Slider:i,Drilldown:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1))},,function(e,t,i){var n,s;(function(o,a,r){n=[i(4),i(7)],s=function(e,t){var i=o.View.extend({visible:!1,initialize:function(i){var n=this;this.model=i&&i.model||new o.Model({id:e.uid(),cls:"ui-portlet",title:"",icon:"",buttons:null,body:null,scrollable:!0,nopadding:!1,operations:null,collapsible:!1,collapsible_button:!1,collapsed:!1}).set(i),this.setElement(this._template()),this.$body=this.$(".portlet-body"),this.$title_text=this.$(".portlet-title-text"),this.$title_icon=this.$(".portlet-title-icon"),this.$header=this.$(".portlet-header"),this.$content=this.$(".portlet-content"),this.$backdrop=this.$(".portlet-backdrop"),this.$buttons=this.$(".portlet-buttons"),this.$operations=this.$(".portlet-operations"),this.model.get("body")&&this.append(this.model.get("body")),this.collapsible_button=new t.ButtonIcon({icon:"fa-eye",tooltip:"Collapse/Expand",cls:"ui-button-icon-plain",onclick:function(){n[n.collapsed?"expand":"collapse"]()}}),this.render()},render:function(){var e=this,t=this.model.attributes;return this.$el.removeClass().addClass(t.cls).attr("id",t.id),this.$header[t.title?"show":"hide"](),this.$title_text.html(t.title),a.each([this.$content,this.$body],function(e){e[t.nopadding?"addClass":"removeClass"]("no-padding")}),t.icon?this.$title_icon.removeClass().addClass("portlet-title-icon fa").addClass(t.icon).show():this.$title_icon.hide(),this.$title_text[t.collapsible?"addClass":"removeClass"]("no-highlight collapsible").off(),t.collapsible&&(this.$title_text.on("click",function(){e[e.collapsed?"expand":"collapse"]()}),t.collapsed?this.collapse():this.expand()),t.buttons?(this.$buttons.empty().show(),r.each(this.model.get("buttons"),function(t,i){i.$el.prop("id",t),e.$buttons.append(i.$el)})):this.$buttons.hide(),this.$operations.empty,t.collapsible_button&&this.$operations.append(this.collapsible_button.$el),t.operations&&r.each(t.operations,function(t,i){i.$el.prop("id",t),e.$operations.append(i.$el)}),this},append:function(e){this.$body.append(e)},empty:function(){this.$body.empty()},header:function(){return this.$header},body:function(){return this.$body},show:function(){this.visible=!0,this.$el.fadeIn("fast")},hide:function(){this.visible=!1,this.$el.hide()},enableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!1)},disableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!0)},hideOperation:function(e){this.$operations.find("#"+e).hide()},showOperation:function(e){this.$operations.find("#"+e).show()},setOperation:function(e,t){this.$operations.find("#"+e).off("click").on("click",t)},title:function(e){return e&&this.$title_text.html(e),this.$title_text.html()},collapse:function(){this.collapsed=!0,this.$content.height("0%"),this.$body.hide(),this.collapsible_button.setIcon("fa-eye-slash")},expand:function(){this.collapsed=!1,this.$content.height("100%"),this.$body.fadeIn("fast"),this.collapsible_button.setIcon("fa-eye")},disable:function(){this.$backdrop.show()},enable:function(){this.$backdrop.hide()},_template:function(){return r("
    ").append(r("
    ").addClass("portlet-header").append(r("
    ").addClass("portlet-operations")).append(r("
    ").addClass("portlet-title").append(r("").addClass("portlet-title-icon")).append(r("").addClass("portlet-title-text")))).append(r("
    ").addClass("portlet-content").append(r("
    ").addClass("portlet-body")).append(r("
    ").addClass("portlet-buttons"))).append(r("
    ").addClass("portlet-backdrop"))}});return{View:i}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1))},,function(e,t,i){var n,s;(function(o,a,r){n=[i(8),i(23),i(14)],s=function(e,t,i){var n=o.Model.extend({}),s=o.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this.get("metadata")||this._set_metadata(),this.on("change",this._set_metadata,this)},_set_metadata:function(){var e=new n;a.each(a.keys(this.attributes),function(t){if(0===t.indexOf("metadata_")){var i=t.split("metadata_")[1];e.set(i,this.attributes[t]),delete this.attributes[t]}},this),this.set("metadata",e,{silent:!0})},get_metadata:function(e){return this.attributes.metadata.get(e)},urlRoot:Galaxy.root+"api/datasets"}),l=s.extend({defaults:a.extend({},s.prototype.defaults,{chunk_url:null,first_data_chunk:null,offset:0,at_eof:!1}),initialize:function(e){s.prototype.initialize.call(this),this.attributes.first_data_chunk&&(this.attributes.offset=this.attributes.first_data_chunk.offset),this.attributes.chunk_url=Galaxy.root+"dataset/display?dataset_id="+this.id,this.attributes.url_viz=Galaxy.root+"visualization"},get_next_chunk:function(){if(this.attributes.at_eof)return null;var e=this,t=r.Deferred();return r.getJSON(this.attributes.chunk_url,{offset:e.attributes.offset}).success(function(i){var n;""!==i.ck_data?(n=i,e.attributes.offset=i.offset):(e.attributes.at_eof=!0,n=null),t.resolve(n)}),t}}),c=o.Collection.extend({model:s}),d=o.View.extend({initialize:function(e){this.row_count=0,this.loading_chunk=!1,new p({model:e.model,$el:this.$el})},expand_to_container:function(){this.$el.height()").attr("id","loading_indicator"),this.$el.append(this.loading_indicator);var e=r("").attr({id:"content_table",cellpadding:0});this.$el.append(e);var t=this.model.get_metadata("column_names"),i=r("").appendTo(e),n=r("").appendTo(i);if(t)n.append("");else for(var s=1;s<=this.model.get_metadata("columns");s++)n.append("");var o=this,a=this.model.get("first_data_chunk");a?this._renderChunk(a):r.when(o.model.get_next_chunk()).then(function(e){o._renderChunk(e)}),this.scroll_elt.scroll(function(){o.attempt_to_fetch()})},scrolled_to_bottom:function(){return!1},_renderCell:function(e,t,i){var n=r("");t.append(e),this.row.append(t)},appendHeader:function(){this.$thead.append(this.row),this.row=a("")},add:function(e,t,i){var n=a("");t&&n.css("width",t),i&&n.css("text-align",i),n.append(e),this.row.append(n)},append:function(e,t){this._commit(e,t,!1)},prepend:function(e,t){this._commit(e,t,!0)},get:function(e){return this.$el.find("#"+e)},del:function(e){var t=this.$tbody.find("#"+e);t.length>0&&(t.remove(),this.row_count--,this._refresh())},delAll:function(){this.$tbody.empty(),this.row_count=0,this._refresh()},value:function(e){this.before=this.$tbody.find(".current").attr("id"),void 0!==e&&(this.$tbody.find("tr").removeClass("current"),e&&this.$tbody.find("#"+e).addClass("current"));var t=this.$tbody.find(".current").attr("id");return void 0===t?null:(t!=this.before&&this.options.onchange&&this.options.onchange(e),t)},size:function(){return this.$tbody.find("tr").length},_commit:function(e,t,i){this.del(e),this.row.attr("id",e),i?this.$tbody.prepend(this.row):this.$tbody.append(this.row),t&&(this.row.hide(),this.row.fadeIn()),this.row=this._row(),this.row_count++,this._refresh()},_row:function(){return a('')},_onclick:function(e){var t=this.value(),i=a(e.target).closest("tr").attr("id");""!=i&&i&&t!=i&&(this.options.onconfirm?this.options.onconfirm(i):this.value(i))},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_refresh:function(){0==this.row_count?this.$tmessage.show():this.$tmessage.hide()},_template:function(e){return'
    "+t.join("")+""+s+"").text(e),s=this.model.get_metadata("column_types");return void 0!==i?n.attr("colspan",i).addClass("stringalign"):s&&t"),n=this.model.get_metadata("columns");return this.row_count%2!==0&&i.addClass("dark_row"),t.length===n?a.each(t,function(e,t){i.append(this._renderCell(e,t))},this):t.length>n?(a.each(t.slice(0,n-1),function(e,t){i.append(this._renderCell(e,t))},this),i.append(this._renderCell(t.slice(n-1).join("\t"),n-1))):1===t.length?i.append(this._renderCell(e,0,n)):(a.each(t,function(e,t){i.append(this._renderCell(e,t))},this),a.each(a.range(n-t.length),function(){i.append(r(""))})),this.row_count++,i},_renderChunk:function(e){var t=this.$el.find("table");a.each(e.ck_data.split("\n"),function(e,i){""!==e&&t.append(this._renderRow(e))},this)}}),h=d.extend({initialize:function(e){d.prototype.initialize.call(this,e),scroll_elt=a.find(this.$el.parents(),function(e){return"auto"===r(e).css("overflow")}),scroll_elt||(scroll_elt=window),this.scroll_elt=r(scroll_elt)},scrolled_to_bottom:function(){return this.$el.height()-this.scroll_elt.scrollTop()-this.scroll_elt.height()<=0}}),u=d.extend({initialize:function(e){d.prototype.initialize.call(this,e),this.scroll_elt=this.$el.css({position:"relative",overflow:"scroll",height:e.height||"500px"})},scrolled_to_bottom:function(){return this.$el.scrollTop()+this.$el.innerHeight()>=this.el.scrollHeight}}),p=o.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,file_ext:null,initialize:function(e){function t(e,t){for(var i=0;i").attr("type","button").append(this.$icon=a("")).append(this.$title=a("")).append(this.$progress=a("
    ").append(this.$progress_bar=a("
    ")))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(){var e=this,t=this.model.attributes;this.$el.removeClass().addClass("ui-button-default").addClass(t.disabled&&"disabled").attr("id",t.id).attr("disabled",t.disabled).css("float",t.floating).off("click").on("click",function(){a(".tooltip").hide(),t.onclick&&!e.disabled&&t.onclick()}).tooltip({title:t.tooltip,placement:"bottom"}),this.$progress.addClass("progress").css("display",t.percentage!==-1?"block":"none"),this.$progress_bar.addClass("progress-bar").css({width:t.percentage+"%"}),this.$icon.removeClass().addClass("icon fa"),this.$title.removeClass().addClass("title"),t.wait?(this.$el.addClass(t.wait_cls).prop("disabled",!0),this.$icon.addClass("fa-spinner fa-spin ui-margin-right"),this.$title.html(t.wait_text)):(this.$el.addClass(t.cls),this.$icon.addClass(t.icon),this.$title.html(t.title),t.icon&&t.title&&this.$icon.addClass("ui-margin-right"))},show:function(){this.$el.show()},hide:function(){this.$el.hide()},disable:function(){this.model.set("disabled",!0)},enable:function(){this.model.set("disabled",!1)},wait:function(){this.model.set("wait",!0)},unwait:function(){this.model.set("wait",!1)},setIcon:function(e){this.model.set("icon",e)}}),i=t.extend({initialize:function(t){this.model=t&&t.model||new o.Model({id:e.uid(),title:"",icon:"",cls:""}).set(t),this.setElement(a("").append(this.$icon=a(""))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(){var e=this.model.attributes;this.$el.removeClass().addClass(e.cls).attr({id:e.id,href:e.href||"javascript:void(0)",title:e.title,target:e.target||"_top",disabled:e.disabled}).off("click").on("click",function(){e.onclick&&!e.disabled&&e.onclick()}),this.$icon.removeClass().addClass(e.icon)}}),n=o.View.extend({initialize:function(t){this.model=t&&t.model||new o.Model({id:e.uid(),title:"Select/Unselect all",icons:["fa-square-o","fa-minus-square-o","fa-check-square-o"],value:0,onchange:function(){}}).set(t),this.setElement(a("
    ").append(this.$icon=a("")).append(this.$title=a(""))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(e){var t=this,e=this.model.attributes;this.$el.addClass("ui-button-check").off("click").on("click",function(){t.model.set("value",0===t.model.get("value")&&2||0),e.onclick&&e.onclick()}),this.$title.html(e.title),this.$icon.removeClass().addClass("icon fa ui-margin-right").addClass(e.icons[e.value])},value:function(e,t){return void 0!==e&&(t&&0!==e&&(e=e!==t&&1||2),this.model.set("value",e),this.model.get("onchange")(this.model.get("value"))),this.model.get("value")}}),s=t.extend({initialize:function(t){this.model=t&&t.model||new o.Model({id:e.uid(),title:"",floating:"right",icon:"",cls:"ui-button-icon",disabled:!1}).set(t),this.setElement(a("
    ").append(this.$button=a("
    ").append(this.$icon=a("")).append(this.$title=a("")))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(e){var e=this.model.attributes;this.$el.removeClass().addClass(e.cls).addClass(e.disabled&&"disabled").attr("disabled",e.disabled).attr("id",e.id).css("float",e.floating).off("click").on("click",function(){a(".tooltip").hide(),!e.disabled&&e.onclick&&e.onclick()}),this.$button.addClass("button").tooltip({title:e.tooltip,placement:"bottom"}),this.$icon.removeClass().addClass("icon fa").addClass(e.icon),this.$title.addClass("title").html(e.title),e.icon&&e.title&&this.$icon.addClass("ui-margin-right")}}),r=t.extend({$menu:null,initialize:function(e){this.model=e&&e.model||new o.Model({id:"",title:"",floating:"right",pull:"right",icon:null,onclick:null,cls:"ui-button-icon ui-button-menu",tooltip:"",target:"",href:"",onunload:null,visible:!0,tag:""}).set(e),this.setElement(a("
    ").append(this.$root=a("
    ").append(this.$icon=a("")).append(this.$title=a("")))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(){var e=this.model.attributes;this.$el.removeClass().addClass("dropdown").addClass(e.cls).attr("id",e.id).css({"float":e.floating,display:e.visible?"block":"none"}),this.$root.addClass("root button dropdown-toggle").attr("data-toggle","dropdown").tooltip({title:e.tooltip,placement:"bottom"}).off("click").on("click",function(t){a(".tooltip").hide(),t.preventDefault(),e.onclick&&e.onclick()}),this.$icon.removeClass().addClass("icon fa").addClass(e.icon),this.$title.removeClass().addClass("title").html(e.title),e.icon&&e.title&&this.$icon.addClass("ui-margin-right")},addMenu:function(t){var t=e.merge(t,{title:"",target:"",href:"",onclick:null,divider:!1,icon:null,cls:"button-menu btn-group"});this.$menu||(this.$menu=a("
    ","
    "].join("")}});return{CitationView:n,CitationListView:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3))},function(e,t,i){var n,s;(function(o,a,r){n=[i(42),i(32),i(6),i(5)],s=function(e,t,i,n){"use strict";var s=e.FoldoutListItemView,l=e.ListItemView,c=s.extend({className:s.prototype.className+" dataset-collection",id:function(){return["dataset_collection",this.model.get("id")].join("-")},initialize:function(e){this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,s.prototype.initialize.call(this,e)},_setUpListeners:function(){s.prototype._setUpListeners.call(this),this.listenTo(this.model,"change",function(e,t){o.has(e.changed,"deleted")?this.render():o.has(e.changed,"element_count")&&this.$("> .title-bar .subtitle").replaceWith(this._renderSubtitle())})},_renderSubtitle:function(){return a(this.templates.subtitle(this.model.toJSON(),this))},_getFoldoutPanelOptions:function(){var e=s.prototype._getFoldoutPanelOptions.call(this);return o.extend(e,{linkTarget:this.linkTarget,hasUser:this.hasUser})},$selector:function(){return this.$("> .selector")},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCListItemView("+e+")"}});c.prototype.templates=function(){var e=o.extend({},s.prototype.templates.warnings,{error:i.wrapTemplate(["<% if( model.error ){ %>",'
    ',n("There was an error getting the data for this collection"),": <%- model.error %>","
    ","<% } %>"]),purged:i.wrapTemplate(["<% if( model.purged ){ %>",'
    ',n("This collection has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:i.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',n("This collection has been deleted"),"
    ","<% } %>"])}),t=i.wrapTemplate(['
    ','
    ','<%- collection.element_identifier || collection.name %>',"
    ",'
    ',"
    "],"collection"),a=i.wrapTemplate(['
    ','<% var countText = collection.element_count? ( collection.element_count + " " ) : ""; %>','<% if( collection.collection_type === "list" ){ %>',n("a list of <%- countText %>datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',n("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',n("a list of <%- countText %>dataset pairs"),'<% } else if( collection.collection_type === "list:list" ){ %>',n("a list of <%- countText %>dataset lists"),"<% } %>","
    "],"collection");return o.extend({},s.prototype.templates,{warnings:e,titleBar:t,subtitle:a})}();var d=l.extend({className:l.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DCEListItemView.initialize:",e),l.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCEListItemView("+e+")"}});d.prototype.templates=function(){var e=i.wrapTemplate(['
    ','
    ','<%- element.element_identifier %>',"
    ",'
    ',"
    "],"element");return o.extend({},l.prototype.templates,{titleBar:e})}();var h=t.DatasetListItemView.extend({className:t.DatasetListItemView.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DatasetDCEListItemView.initialize:",e),t.DatasetListItemView.prototype.initialize.call(this,e)},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):r.when()},toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetDCEListItemView("+e+")"}});h.prototype.templates=function(){var e=i.wrapTemplate(['
    ','','
    ','<%- element.element_identifier %>',"
    ","
    "],"element");return o.extend({},t.DatasetListItemView.prototype.templates,{titleBar:e})}();var u=c.extend({className:c.prototype.className+" dataset-collection-element",_swapNewRender:function(e){c.prototype._swapNewRender.call(this,e);var t=this.model.get("state")||"ok";return this.$el.addClass("state-"+t),this.$el},toString:function(){var e=this.model?this.model+"":"(no model)";return"NestedDCDCEListItemView("+e+")"}});return{DCListItemView:c,DCEListItemView:d,DatasetDCEListItemView:h,NestedDCDCEListItemView:u}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(1),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(70),i(6),i(5)],s=function(e,t,i){"use strict";var n={defaults:{model_class:"DatasetCollectionElement",element_identifier:null,element_index:null,element_type:null},_mergeObject:function(e){return o.extend(e,e.object,{element_id:e.id}),delete e.object,e},constructor:function(e,t){e=this._mergeObject(e),this.idAttribute="element_id",a.Model.apply(this,arguments)},parse:function(e,t){var i=e;return i=this._mergeObject(i)}},s=a.Model.extend(t.LoggableMixin).extend(n).extend({_logNamespace:"collections"}),l=a.Collection.extend(t.LoggableMixin).extend({_logNamespace:"collections",model:s,toString:function(){return["DatasetCollectionElementCollection(",this.length,")"].join("")}}),c=e.DatasetAssociation.extend(t.mixin(n,{url:function(){return this.has("history_id")?Galaxy.root+"api/histories/"+this.get("history_id")+"/contents/"+this.get("id"):(console.warn("no endpoint for non-hdas within a collection yet"),Galaxy.root+"api/datasets")},defaults:o.extend({},e.DatasetAssociation.prototype.defaults,n.defaults),constructor:function(e,t){this.debug("\t DatasetDCE.constructor:",e,t),n.constructor.call(this,e,t)},hasDetails:function(){return this.elements&&this.elements.length},toString:function(){var e=this.get("element_identifier");return["DatasetDCE(",e,")"].join("")}})),d=l.extend({model:c,toString:function(){return["DatasetDCECollection(",this.length,")"].join("")}}),h=a.Model.extend(t.LoggableMixin).extend(t.SearchableModelMixin).extend({_logNamespace:"collections",defaults:{collection_type:null,deleted:!1},collectionClass:l,initialize:function(e,t){this.debug(this+"(DatasetCollection).initialize:",e,t,this),this.elements=this._createElementsModel(),this.on("change:elements",function(){this.log("change:elements"),this.elements=this._createElementsModel()})},_createElementsModel:function(){this.debug(this+"._createElementsModel",this.collectionClass,this.get("elements"),this.elements);var e=this.get("elements")||[];return this.unset("elements",{silent:!0}),this.elements=new this.collectionClass(e),this.elements},toJSON:function(){var e=a.Model.prototype.toJSON.call(this);return this.elements&&(e.elements=this.elements.toJSON()),e},inReadyState:function(){var e=this.get("populated");return this.isDeletedOrPurged()||e},hasDetails:function(){return 0!==this.elements.length},getVisibleContents:function(e){return this.elements},parse:function(e,t){var i=a.Model.prototype.parse.call(this,e,t);return i.create_time&&(i.create_time=new Date(i.create_time)),i.update_time&&(i.update_time=new Date(i.update_time)),i},"delete":function(e){return this.get("deleted")?r.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?r.when():this.save({deleted:!1},e)},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},searchAttributes:["name"],toString:function(){var e=[this.get("id"),this.get("name")||this.get("element_identifier")];return"DatasetCollection("+e.join(",")+")"}}),u=h.extend({collectionClass:d,toString:function(){return"List"+h.prototype.toString.call(this)}}),p=u.extend({toString:function(){return"Pair"+h.prototype.toString.call(this)}}),g=h.extend(t.mixin(n,{constructor:function(e,t){this.debug("\t NestedDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedDCDCE(",e,")"].join("")}})),f=l.extend({model:g,toString:function(){return["NestedDCDCECollection(",this.length,")"].join("")}}),m=p.extend(t.mixin(n,{constructor:function(e,t){this.debug("\t NestedPairDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedPairDCDCE(",e,")"].join("")}})),v=f.extend({model:m,toString:function(){return["NestedPairDCDCECollection(",this.length,")"].join("")}}),_=h.extend({collectionClass:v,toString:function(){return["ListPairedDatasetCollection(",this.get("name"),")"].join("")}}),y=u.extend(t.mixin(n,{constructor:function(e,t){this.debug("\t NestedListDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedListDCDCE(",e,")"].join("")}})),w=f.extend({model:y,toString:function(){return["NestedListDCDCECollection(",this.length,")"].join("")}}),b=h.extend({collectionClass:w,toString:function(){return["ListOfListsDatasetCollection(",this.get("name"),")"].join("")}});return{ListDatasetCollection:u,PairDatasetCollection:p,ListPairedDatasetCollection:_,ListOfListsDatasetCollection:b}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(3),i(1))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(39),i(12),i(6),i(8),i(87),i(5),i(84)],s=function(e,t,i,n,s,c){"use strict";function d(e){var t=e.toJSON(),i=f(t,{creationFn:function(t,i){return t=t.map(function(e){return{id:e.id,name:e.name,src:"dataset"===e.history_content_type?"hda":"hdca"}}),e.createHDCA(t,"list",i)}});return i}var h="collections",u=o.View.extend(i.LoggableMixin).extend({_logNamespace:h,tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.selected=e.selected||!1},render:function(){return this.$el.attr("data-element-id",this.element.id).attr("draggable",!0).html(this.template({element:this.element})),this.selected&&this.$el.addClass("selected"),this},template:a.template(['
    ',"<%- element.name %>","",'"].join("")),select:function(e){this.$el.toggleClass("selected",e),this.trigger("select",{source:this,selected:this.$el.hasClass("selected")})},discard:function(){var e=this,t=this.$el.parent().width();this.$el.animate({"margin-right":t},"fast",function(){e.trigger("discard",{source:e}),e.destroy()})},destroy:function(){this.off(),this.$el.remove()},events:{click:"_click","click .name":"_clickName","click .discard":"_clickDiscard",dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_click:function(e){e.stopPropagation(),this.select(e)},_clickName:function(e){e.stopPropagation(),e.preventDefault();var t=([c("Enter a new name for the element"),":\n(",c("Note that changing the name here will not rename the dataset"),")"].join(""),prompt(c("Enter a new name for the element")+":",this.element.name));t&&(this.element.name=t,this.render())},_clickDiscard:function(e){e.stopPropagation(),this.discard()},_dragstart:function(e){e.originalEvent&&(e=e.originalEvent),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",JSON.stringify(this.element)),this.$el.addClass("dragging"),this.$el.parent().trigger("collection-element.dragstart",[this])},_dragend:function(e){this.$el.removeClass("dragging"),this.$el.parent().trigger("collection-element.dragend",[this])},_sendToParent:function(e){this.$el.parent().trigger(e)},toString:function(){return"DatasetCollectionElementView()"}}),p=o.View.extend(i.LoggableMixin).extend({_logNamespace:h,elementViewClass:u,collectionClass:e.HistoryListDatasetCollection,className:"list-collection-creator collection-creator flex-row-container",minElements:1,defaultAttributes:{creationFn:function(){throw new TypeError("no creation fn for creator")},oncreate:function(){},oncancel:function(){},autoscrollDist:24,highlightClr:"rgba( 64, 255, 255, 1.0 )"},initialize:function(e){this.metric("ListCollectionCreator.initialize",e);var t=this;a.each(this.defaultAttributes,function(i,n){i=e[n]||i,t[n]=i}),t.initialElements=e.elements||[],this._instanceSetUp(),this._elementsSetUp(),this._setUpBehaviors()},_instanceSetUp:function(){this.selectedIds={},this.$dragging=null,this.blocking=!1},_elementsSetUp:function(){this.invalidElements=[],this.workingElements=[],this.elementViews=[],this.workingElements=this.initialElements.slice(0),this._ensureElementIds(),this._validateElements(),this._mangleDuplicateNames(),this._sortElements()},_ensureElementIds:function(){return this.workingElements.forEach(function(e){e.hasOwnProperty("id")||(e.id=a.uniqueId())}),this.workingElements},_validateElements:function(){var e=this;return e.invalidElements=[],this.workingElements=this.workingElements.filter(function(t){var i=e._isElementInvalid(t);return i&&e.invalidElements.push({element:t,text:i}),!i}),this.workingElements},_isElementInvalid:function(e){return"dataset"!==e.history_content_type?c("is not a dataset"):e.state!==t.OK?c(a.contains(t.NOT_READY_STATES,e.state)?"hasn't finished running yet":"has errored, is paused, or is not accessible"):e.deleted||e.purged?c("has been deleted or purged"):null},_mangleDuplicateNames:function(){var e=900,t=1,i={};this.workingElements.forEach(function(n){for(var s=n.name;i.hasOwnProperty(s);)if(s=n.name+" ("+t+")",t+=1,t>=e)throw new Error("Safety hit in while loop - thats impressive");n.name=s,i[n.name]=!0})},_sortElements:function(e){},render:function(e,t){return this.workingElements.length .clear-selected").show():this.$(".collection-elements-controls > .clear-selected").hide()},_renderList:function(e,t){var i=this,n=l("
    "),s=i.$list();a.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),i.workingElements.forEach(function(e){var t=i._createElementView(e);n.append(t.$el)}),i._renderClearSelected(),s.empty().append(n.children()),a.invoke(i.elementViews,"render"),s.height()>s.css("max-height")?s.css("border-width","1px 0px 1px 0px"):s.css("border-width","0px")},_createElementView:function(e){var t=new this.elementViewClass({element:e,selected:a.has(this.selectedIds,e.id)});return this.elementViews.push(t),this._listenToElementView(t),t},_listenToElementView:function(e){var t=this;t.listenTo(e,{select:function(e){var i=e.source.element;e.selected?t.selectedIds[i.id]=!0:delete t.selectedIds[i.id],t.trigger("elements:select",e)},discard:function(e){t.trigger("elements:discard",e)}})},addElementView:function(e){},removeElementView:function(e){delete this.selectedIds[e.element.id],this._renderClearSelected(),this.elementViews=a.without(this.elementViews,e),this.stopListening(e)},_renderNoElementsLeft:function(){this._disableNameAndCreate(!0),this.$(".collection-elements").append(this.templates.noElementsLeft())},_elementToJSON:function(e){return e},createList:function(e){if(!this.workingElements.length){var t=c("No valid elements for final list")+". ";return t+=''+c("Cancel")+" ",t+=c("or"),t+=' '+c("start over")+".",void this._showAlert(t)}var i=this,n=this.workingElements.map(function(e){return i._elementToJSON(e)});return i.blocking=!0,i.creationFn(n,e).always(function(){i.blocking=!1}).fail(function(e,t,n){i.trigger("error",{xhr:e,status:t,message:c("An error occurred while creating this collection")})}).done(function(e,t,n){i.trigger("collection:created",e,t,n),i.metric("collection:created",e),"function"==typeof i.oncreate&&i.oncreate.call(this,e,t,n)})},_setUpBehaviors:function(){return this.on("error",this._errorHandler),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("elements:select",function(e){this._renderClearSelected()}),this.on("elements:discard",function(e){var t=e.source.element;this.removeElementView(e.source),this.workingElements=a.without(this.workingElements,t),this.workingElements.length||this._renderNoElementsLeft()}),this},_errorHandler:function(e){this.error(e);var t=this;if(content=e.message||c("An error occurred"),e.xhr){var i=e.xhr,n=e.message;0===i.readyState&&0===i.status?content+=": "+c("Galaxy could not be reached and may be updating.")+c(" Try again in a few minutes."):i.responseJSON?content+=":
    "+JSON.stringify(i.responseJSON)+"
    ":content+=": "+n}t._showAlert(content,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(e){"function"==typeof this.oncancel&&this.oncancel.call(this)},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(e){e.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(e){e.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(e){e.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(e,t){t=t||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(t).show().find(".alert-message").html(e)},_hideAlert:function(e){this.$(".main-help").show(),this.$(".header .alert").hide()},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(e){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(e){e.preventDefault();var t=this.$list();this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestElement(e.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=r('
    ');i.length?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=2,n=e.offset(),s=e.scrollTop(),o=t-n.top,a=n.top+e.outerHeight()-t;o>=0&&o=0&&ae&&o-a
    ','
    ',''].join("")),header:a.template(['",'
    ','','',"
    "].join("")),middle:a.template(['",'
    ',"
    "].join("")),footer:a.template(['
    ','
    ','','
    ',c("Name"),":
    ","
    ","
    ",'
    ','
    ','",'
    ','",'","
    ","
    ",'
    ','","
    ","
    "].join("")),helpContent:a.template(["

    ",c(["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("")),"

    ","
      ","
    • ",c(["Rename elements in the list by clicking on ",'the existing name.'].join("")),"
    • ","
    • ",c(["Discard elements from the final created list by clicking on the ",'"Discard" button.'].join("")),"
    • ","
    • ",c(["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("")),"
    • ","
    • ",c(['Click the "Start over" link to begin again as if you had just opened ',"the interface."].join("")),"
    • ","
    • ",c(['Click the "Cancel" button to exit the interface.'].join("")),"
    • ","

    ","

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

    "].join("")),invalidElements:a.template([c("The following selections could not be included due to problems:"),"
      <% _.each( problems, function( problem ){ %>","
    • <%- problem.element.name %>: <%- problem.text %>
    • ","<% }); %>
    "].join("")),noElementsLeft:a.template(['
  • ',c("No elements left! "),c("Would you like to "),'',c("start over"),"?","
  • "].join("")),invalidInitial:a.template(['
    ','
    ','',"<% if( _.size( problems ) ){ %>",c("The following selections could not be included due to problems"),":","
      <% _.each( problems, function( problem ){ %>","
    • <%- problem.element.name %>: <%- problem.text %>
    • ","<% }); %>
    ","<% } else if( _.size( elements ) < 1 ){ %>",c("No datasets were selected"),".","<% } %>","
    ",c("At least one element is needed for the collection"),". ",c("You may need to "),'',c("cancel")," ",c("and reselect new elements"),".","
    ","
    ","
    ",'"].join(""))},toString:function(){return"ListCollectionCreator"}}),g=function(e,t,i){var s,o=l.Deferred(),r=Galaxy.modal||new n.View;return t=a.defaults(t||{},{elements:e,oncancel:function(){r.hide(),o.reject("cancelled")},oncreate:function(e,t){r.hide(),o.resolve(t)}}),s=new i(t),r.show({title:t.title||c("Create a collection"),body:s.$el,width:"80%",height:"100%",closing_events:!0}),s.render(),window._collectionCreator=s,o},f=function(e,t){return t=t||{},t.title=c("Create a collection from a list of datasets"),g(e,t,p)};return{DatasetCollectionElementView:u,ListCollectionCreator:p,collectionCreatorModal:g,listCollectionCreatorModal:f,createListCollection:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1),i(1))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(42),i(12),i(22),i(6),i(5)],s=function(e,t,i,n,s){"use strict";var c="dataset",d=e.ListItemView,h=d.extend({_logNamespace:c,className:d.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger), +this.log(this+".initialize:",e),d.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank"},_setUpListeners:function(){d.prototype._setUpListeners.call(this);var e=this;return e.listenTo(e.model,{change:function(t,i){e.model.changedAttributes().state&&e.model.inReadyState()&&e.expanded&&!e.model.hasDetails()?e.model.fetch({silent:!0}).done(function(){e.render()}):e.render()}})},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):o.when()},remove:function(e,t){var i=this;e=e||this.fxSpeed,this.$el.fadeOut(e,function(){a.View.prototype.remove.call(i),t&&t.call(i)})},_swapNewRender:function(e){return d.prototype._swapNewRender.call(this,e),this.model.has("state")&&this.$el.addClass("state-"+this.model.get("state")),this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var e=this.model.get("state");if(e===t.NOT_VIEWABLE||e===t.DISCARDED||!this.model.get("accessible"))return null;var n={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged"))n.disabled=!0,n.title=s("Cannot display datasets removed from disk");else if(e===t.UPLOAD)n.disabled=!0,n.title=s("This dataset must finish uploading before it can be viewed");else if(e===t.NEW)n.disabled=!0,n.title=s("This dataset is not yet viewable");else{n.title=s("View data"),n.href=this.model.urls.display;var o=this;n.onclick=function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.addDataset(o.model.get("id")),e.preventDefault())}}return n.faIcon="fa-eye",i(n)},_renderDetails:function(){if(this.model.get("state")===t.NOT_VIEWABLE)return r(this.templates.noAccess(this.model.toJSON(),this));var e=d.prototype._renderDetails.call(this);return e.find(".actions .left").empty().append(this._renderSecondaryActions()),e.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages()),e.find(".display-applications").html(this._renderDisplayApplications()),this._setUpBehaviors(e),e},_renderSummary:function(){var e=this.model.toJSON(),t=this.templates.summaries[e.state];return(t=t||this.templates.summaries.unknown)(e,this)},_renderDetailMessages:function(){var e=this,t=r('
    '),i=e.model.toJSON();return l.each(e.templates.detailMessages,function(n){t.append(r(n(i,e)))}),t},_renderDisplayApplications:function(){return this.model.isDeletedOrPurged()?"":[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){switch(this.debug("_renderSecondaryActions"),this.model.get("state")){case t.NOT_VIEWABLE:return[];case t.OK:case t.FAILED_METADATA:case t.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return i({title:s("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle",onclick:function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Dataset details",url:this.href}),e.preventDefault(),e.stopPropagation())}})},_renderDownloadButton:function(){return this.model.get("purged")||!this.model.hasData()?null:l.isEmpty(this.model.get("meta_files"))?r(['','',""].join("")):this._renderMetaFileDownloadButton()},_renderMetaFileDownloadButton:function(){var e=this.model.urls;return r(['"].join("\n"))},events:l.extend(l.clone(d.prototype.events),{"click .display-btn":function(e){this.trigger("display",this,e)},"click .params-btn":function(e){this.trigger("params",this,e)},"click .download-btn":function(e){this.trigger("download",this,e)}}),toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetListItemView("+e+")"}});return h.prototype.templates=function(){var e=l.extend({},d.prototype.templates.warnings,{failed_metadata:n.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
    ',s("An error occurred setting the metadata for this dataset"),"
    ","<% } %>"]),error:n.wrapTemplate(["<% if( model.error ){ %>",'
    ',s("There was an error getting the data for this dataset"),": <%- model.error %>","
    ","<% } %>"]),purged:n.wrapTemplate(["<% if( model.purged ){ %>",'
    ',s("This dataset has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:n.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',s("This dataset has been deleted"),"
    ","<% } %>"])}),i=n.wrapTemplate(['
    ','
    ','
    ','
    ','
    ',"
    ","<% if( !dataset.deleted && !dataset.purged ){ %>",'
    ','
    ','
    ',"<% if( dataset.peek ){ %>",'
    <%= dataset.peek %>
    ',"<% } %>","<% } %>","
    "],"dataset"),o=n.wrapTemplate(['
    ','
    ',s("You do not have permission to view this dataset"),"
    ","
    "],"dataset"),a={};a[t.OK]=a[t.FAILED_METADATA]=n.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"),a[t.NEW]=n.wrapTemplate(["
    ",s("This is a new dataset and not all of its data are available yet"),"
    "],"dataset"),a[t.NOT_VIEWABLE]=n.wrapTemplate(["
    ",s("You do not have permission to view this dataset"),"
    "],"dataset"),a[t.DISCARDED]=n.wrapTemplate(["
    ",s("The job creating this dataset was cancelled before completion"),"
    "],"dataset"),a[t.QUEUED]=n.wrapTemplate(["
    ",s("This job is waiting to run"),"
    "],"dataset"),a[t.RUNNING]=n.wrapTemplate(["
    ",s("This job is currently running"),"
    "],"dataset"),a[t.UPLOAD]=n.wrapTemplate(["
    ",s("This dataset is currently uploading"),"
    "],"dataset"),a[t.SETTING_METADATA]=n.wrapTemplate(["
    ",s("Metadata is being auto-detected"),"
    "],"dataset"),a[t.PAUSED]=n.wrapTemplate(["
    ",s('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
    "],"dataset"),a[t.ERROR]=n.wrapTemplate(["<% if( !dataset.purged ){ %>","
    <%- dataset.misc_blurb %>
    ","<% } %>",'',s("An error occurred with this dataset"),":",'
    <%- dataset.misc_info %>
    '],"dataset"),a[t.EMPTY]=n.wrapTemplate(["
    ",s("No data"),": <%- dataset.misc_blurb %>
    "],"dataset"),a.unknown=n.wrapTemplate(['
    Error: unknown dataset state: "<%- dataset.state %>"
    '],"dataset");var r={resubmitted:n.wrapTemplate(["<% if( model.resubmitted ){ %>",'
    ',s("The job creating this dataset has been resubmitted"),"
    ","<% } %>"])},c=n.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
    ','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
    ","<% }); %>"],"apps");return l.extend({},d.prototype.templates,{warnings:e,details:i,noAccess:o,summaries:a,detailMessages:r,displayApplications:c})}(),{DatasetListItemView:h}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(1),i(3),i(1),i(2))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4)],s=function(e){var t=o.Model.extend({initialize:function(e){this.app=e},checksum:function(){var e="",t=this;return this.app.section.$el.find(".section-row").each(function(){var i=a(this).attr("id"),n=t.app.field_list[i];n&&(e+=i+":"+JSON.stringify(n.value&&n.value())+":"+n.collapsed+";")}),e},create:function(){function e(e,t,i){n.flat_dict[e]=t,o[e]=i,n.app.element_list[t]&&n.app.element_list[t].$el.attr("tour_id",e)}function t(s,o){for(var a in o){var r=o[a];if(r.input){var l=r.input,c=s;switch(""!=s&&(c+="|"),c+=l.name,l.type){case"repeat":var d="section-",h=[],u=null;for(var p in r){var g=p.indexOf(d);g!=-1&&(g+=d.length,h.push(parseInt(p.substr(g))),u||(u=p.substr(0,g)))}h.sort(function(e,t){return e-t});var a=0;for(var f in h)t(c+"_"+a++,r[u+h[f]]);break;case"conditional":var m=n.app.field_list[l.id].value();e(c+"|"+l.test_param.name,l.id,m);var v=i(l,m);v!=-1&&t(c,o[l.id+"-section-"+v]);break;case"section":t(!l.flat&&c||"",r);break;default:var _=n.app.field_list[l.id];if(_&&_.value){var m=_.value();if((void 0===l.ignore||l.ignore!=m)&&(_.collapsed&&l.collapsible_value&&(m=l.collapsible_value),e(c,l.id,m),l.payload))for(var y in l.payload)e(y,l.id,l.payload[y])}}}}}var n=this,s={};this._iterate(this.app.section.$el,s);var o={};return this.flat_dict={},t("",s),o},match:function(e){return this.flat_dict&&this.flat_dict[e]},matchCase:function(e,t){return i(e,t)},matchModel:function(e,t){var i=this;n(e.inputs,function(e,n){i.flat_dict[n]&&t(e,i.flat_dict[n])})},matchResponse:function(e){function t(e,s){if("string"==typeof s){var o=n.flat_dict[e];o&&(i[o]=s)}else for(var a in s){var r=a;if(""!==e){var l="|";s instanceof Array&&(l="_"),r=e+l+r}t(r,s[a])}}var i={},n=this;return t("",e),i},_iterate:function(e,t){var i=this,n=a(e).children();n.each(function(){var e=this,n=a(e).attr("id");if(a(e).hasClass("section-row")){var s=i.app.input_list[n];t[n]=s&&{input:s}||{},i._iterate(e,t[n])}else i._iterate(e,t)})}}),i=function(e,t){"boolean"==e.test_param.type&&(t="true"==t?e.test_param.truevalue||"true":e.test_param.falsevalue||"false");for(var i in e.cases)if(e.cases[i].value==t)return i;return-1},n=function(e,t,s,o){o=a.extend(!0,{},o),r.each(e,function(e){e&&e.type&&e.name&&(o[e.name]=e)});for(var l in e){var c=e[l];c.name=c.name||l;var d=s?s+"|"+c.name:c.name;switch(c.type){case"repeat":r.each(c.cache,function(e,i){n(e,t,d+"_"+i,o)});break;case"conditional":if(c.test_param){t(c.test_param,d+"|"+c.test_param.name,o);var h=i(c,c.test_param.value);h!=-1?n(c.cases[h].inputs,t,d,o):Galaxy.emit.debug("form-data::visitInputs() - Invalid case for "+d+".")}else Galaxy.emit.debug("form-data::visitInputs() - Conditional test parameter missing for "+d+".");break;case"section":n(c.inputs,t,d,o);break;default:t(c,d,o)}}};return{Manager:t,visitInputs:n}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},function(e,t,i){var n,s;(function(i,o,a){n=[],s=function(){return i.View.extend({initialize:function(e,t){this.app=e,this.app_options=e.options||{},this.field=t&&t.field||new i.View,this.model=t&&t.model||new i.Model({text_enable:this.app_options.text_enable||"Enable",text_disable:this.app_options.text_disable||"Disable",cls_enable:this.app_options.cls_enable||"fa fa-caret-square-o-down",cls_disable:this.app_options.cls_disable||"fa fa-caret-square-o-up"}).set(t),this.setElement(this._template()),this.$field=this.$(".ui-form-field"),this.$info=this.$(".ui-form-info"),this.$preview=this.$(".ui-form-preview"),this.$collapsible=this.$(".ui-form-collapsible"),this.$collapsible_text=this.$(".ui-form-collapsible-text"),this.$collapsible_icon=this.$(".ui-form-collapsible-icon"),this.$title=this.$(".ui-form-title"),this.$title_text=this.$(".ui-form-title-text"),this.$error_text=this.$(".ui-form-error-text"),this.$error=this.$(".ui-form-error"),this.$backdrop=this.$(".ui-form-backdrop"),this.$field.prepend(this.field.$el);var n=this.model.get("collapsible_value");this.field.collapsed=void 0!==n&&JSON.stringify(this.model.get("value"))==JSON.stringify(n),this.listenTo(this.model,"change",this.render,this),this.render();var s=this;this.$collapsible.on("click",function(){s.field.collapsed=!s.field.collapsed,e.trigger&&e.trigger("change"),s.render()})},backdrop:function(){this.model.set("backdrop",!0)},error:function(e){this.model.set("error_text",e)},reset:function(){this.model.set("error_text",null)},render:function(){o(".tooltip").hide();var e=this.model.get("help",""),t=this.model.get("argument");t&&e.indexOf("("+t+")")==-1&&(e+=" ("+t+")"),this.$info.html(e),this.$el[this.model.get("hidden")?"hide":"show"](),this.$preview[this.field.collapsed&&this.model.get("collapsible_preview")||this.model.get("disabled")?"show":"hide"]().html(a.escape(this.model.get("text_value")));var i=this.model.get("error_text");if(this.$error[i?"show":"hide"](),this.$el[i?"addClass":"removeClass"]("ui-error"),this.$error_text.html(i),this.$backdrop[this.model.get("backdrop")?"show":"hide"](),this.field.collapsed||this.model.get("disabled")?this.$field.hide():this.$field.show(),this.field.model&&this.field.model.set({color:this.model.get("color"),style:this.model.get("style")}),this.model.get("disabled")||void 0===this.model.get("collapsible_value"))this.$title_text.show().text(this.model.get("label")),this.$collapsible.hide();else{var n=this.field.collapsed?"enable":"disable";this.$title_text.hide(),this.$collapsible.show(),this.$collapsible_text.text(this.model.get("label")),this.$collapsible_icon.removeClass().addClass("icon").addClass(this.model.get("cls_"+n)).attr("data-original-title",this.model.get("text_"+n)).tooltip({placement:"bottom"})}},_template:function(){return o("
    ").addClass("ui-form-element").append(o("
    ").addClass("ui-form-error ui-error").append(o("").addClass("fa fa-arrow-down")).append(o("").addClass("ui-form-error-text"))).append(o("
    ").addClass("ui-form-title").append(o("
    ").addClass("ui-form-collapsible").append(o("").addClass("ui-form-collapsible-icon")).append(o("").addClass("ui-form-collapsible-text"))).append(o("").addClass("ui-form-title-text"))).append(o("
    ").addClass("ui-form-field").append(o("").addClass("ui-form-info")).append(o("
    ").addClass("ui-form-backdrop"))).append(o("
    ").addClass("ui-form-preview"))}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4),i(7),i(48),i(50),i(49),i(46)],s=function(e,t,i,n,s,l){return o.Model.extend({types:{text:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider","float":"_fieldSlider","boolean":"_fieldBoolean",drill_down:"_fieldDrilldown",color:"_fieldColor",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden",library_data:"_fieldLibrary",ftpfile:"_fieldFtp"},create:function(e){var t=this.types[e.type],i="function"==typeof this[t]?this[t].call(this,e):null;return i||(i=e.options?this._fieldSelect(e):this._fieldText(e),Galaxy.emit.debug("form-parameters::_addRow()","Auto matched field type ("+e.type+").")),void 0===e.value&&(e.value=null),i.value(e.value),i},_fieldData:function(e){return new i.View({id:"field-"+e.id,extensions:e.extensions,optional:e.optional,multiple:e.multiple,type:e.type,flavor:e.flavor,data:e.options,onchange:e.onchange})},_fieldSelect:function(e){if(e.is_workflow)return this._fieldText(e);"data_column"==e.type&&(e.error_text="Missing columns in referenced dataset.");var i=e.data;i||(i=[],a.each(e.options,function(e){i.push({label:e[0],value:e[1]})}));var n=t.Select;switch(e.display){case"checkboxes":n=t.Checkbox;break;case"radio":n=t.Radio;break;case"radiobutton":n=t.RadioButton}return new n.View({id:"field-"+e.id,data:i,error_text:e.error_text||"No options available",multiple:e.multiple,optional:e.optional,onchange:e.onchange,searchable:"workflow"!==e.flavor})},_fieldDrilldown:function(e){return e.is_workflow?this._fieldText(e):new t.Drilldown.View({id:"field-"+e.id,data:e.options,display:e.display,optional:e.optional,onchange:e.onchange})},_fieldText:function(i){if(i.options&&i.data)if(i.area=i.multiple,e.isEmpty(i.value))i.value=null;else if(r.isArray(i.value)){var n="";for(var s in i.value){if(n+=String(i.value[s]),!i.multiple)break;n+="\n"}i.value=n}return new t.Input({id:"field-"+i.id,area:i.area,placeholder:i.placeholder,onchange:i.onchange})},_fieldSlider:function(e){return new t.Slider.View({id:"field-"+e.id,precise:"float"==e.type,is_workflow:e.is_workflow,min:e.min,max:e.max,onchange:e.onchange})},_fieldHidden:function(e){return new t.Hidden({id:"field-"+e.id,info:e.info})},_fieldBoolean:function(e){return new t.RadioButton.View({id:"field-"+e.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:e.onchange})},_fieldColor:function(e){return new l({id:"field-"+e.id,onchange:e.onchange})},_fieldLibrary:function(e){return new n.View({id:"field-"+e.id,optional:e.optional,multiple:e.multiple,onchange:e.onchange})},_fieldFtp:function(e){return new s.View({id:"field-"+e.id,optional:e.optional,multiple:e.multiple,onchange:e.onchange})}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4),i(9),i(7)],s=function(e,t,i){var n=o.View.extend({initialize:function(t){this.list={},this.options=e.merge(t,{title:"Repeat",empty_text:"Not available.",max:null,min:null}),this.button_new=new i.ButtonIcon({icon:"fa-plus",title:"Insert "+this.options.title,tooltip:"Add new "+this.options.title+" block",floating:"clear",cls:"ui-button-icon form-repeat-add",onclick:function(){t.onnew&&t.onnew()}}),this.setElement(a("
    ").append(this.$list=a("
    ")).append(a("
    ").append(this.button_new.$el)))},size:function(){return r.size(this.list)},add:function(e){if(!e.id||this.list[e.id])return void Galaxy.emit.debug("form-repeat::add()","Duplicate or invalid repeat block id.");var n=new i.ButtonIcon({icon:"fa-trash-o",tooltip:"Delete this repeat block",cls:"ui-button-icon-plain form-repeat-delete",onclick:function(){e.ondel&&e.ondel()}}),s=new t.View({id:e.id,title:"placeholder",cls:e.cls||"ui-portlet-repeat",operations:{button_delete:n}});s.append(e.$el),s.$el.addClass("section-row").hide(),this.list[e.id]=s,this.$list.append(s.$el.fadeIn("fast")),this.options.max>0&&this.size()>=this.options.max&&this.button_new.disable(),this._refresh()},del:function(e){return this.list[e]?(this.$list.find("#"+e).remove(),delete this.list[e],this.button_new.enable(),void this._refresh()):void Galaxy.emit.debug("form-repeat::del()","Invalid repeat block id.")},delAll:function(){for(var e in this.list)this.del(e)},hideOptions:function(){this.button_new.$el.hide(),r.each(this.list,function(e){e.hideOperation("button_delete")}),r.isEmpty(this.list)&&this.$el.append(a("
    ").addClass("ui-form-info").html(this.options.empty_text))},_refresh:function(){var e=0;for(var t in this.list){var i=this.list[t];i.title(++e+": "+this.options.title),i[this.size()>this.options.min?"showOperation":"hideOperation"]("button_delete")}}});return{View:n}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(4),i(7),i(9),i(36),i(34),i(35)],s=function(e,t,i,n,s,c){var d=o.View.extend({initialize:function(e,t){this.app=e,this.inputs=t.inputs,this.parameters=new c,this.setElement(a("
    ")),this.render()},render:function(){var e=this;this.$el.empty(),r.each(this.inputs,function(t){e.add(t)})},add:function(t){var i=l.extend(!0,{},t);switch(i.id=t.id=e.uid(),this.app.input_list[i.id]=i,i.type){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(e){var t=this;e.test_param.id=e.id,this.app.options.sustain_conditionals&&(e.test_param.disabled=!0);var i=this._addRow(e.test_param);i.model&&i.model.set("onchange",function(i){var n=t.app.data.matchCase(e,i);for(var s in e.cases){var o=e.cases[s],a=t.$("#"+e.id+"-section-"+s),r=!1;for(var l in o.inputs)if(!o.inputs[l].hidden){r=!0;break}s==n&&r?a.fadeIn("fast"):a.hide()}t.app.trigger("change")});for(var n in e.cases){var s=new d(this.app,{inputs:e.cases[n].inputs});this._append(s.$el.addClass("ui-form-section"),e.id+"-section-"+n)}i.trigger("change")},_addRepeat:function(e){function t(t){var n=e.id+"-section-"+o++,s=new d(i.app,{inputs:t});a.add({id:n,$el:s.$el,ondel:function(){a.del(n),i.app.trigger("change")}})}for(var i=this,o=0,a=new n.View({title:e.title||"Repeat",min:e.min,max:e.max,onnew:function(){t(e.inputs),i.app.trigger("change")}}),l=r.size(e.cache),c=0;c").addClass("ui-form-info").html(e.help)),this.app.on("expand",function(e){t.$("#"+e).length>0&&t.expand()}),this._append(t.$el,e.id)},_addRow:function(e){var t=this,i=e.id;e.onchange=function(){t.app.trigger("change",i)};var n=this.parameters.create(e);this.app.field_list[i]=n;var o=new s(this.app,{name:e.name,label:e.label||e.name,value:e.value,text_value:e.text_value,collapsible_value:e.collapsible_value,collapsible_preview:e.collapsible_preview,help:e.help,argument:e.argument,disabled:e.disabled,color:e.color,style:e.style,backdrop:e.backdrop,hidden:e.hidden,field:n});return this.app.element_list[i]=o,this._append(o.$el,e.id),n},_append:function(e,t){this.$el.append(e.addClass("section-row").attr("id",t))}});return{View:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4),i(9),i(7),i(37),i(33)],s=function(e,t,i,n,s){return o.View.extend({initialize:function(t){this.options=e.merge(t,{initial_errors:!1,cls:"ui-portlet-limited",icon:null,always_refresh:!0}),this.setElement("
    "),this.render()},update:function(e){var t=this;this.data.matchModel(e,function(e,i){var n=t.input_list[i];if(n&&n.options&&!a.isEqual(n.options,e.options)){n.options=e.options;var s=t.field_list[i];if(s.update){var o=[];if(["data","data_collection","drill_down"].indexOf(n.type)!=-1)o=n.options;else for(var r in e.options){var l=e.options[r];l.length>2&&o.push({label:l[0],value:l[1]})}s.update(o),s.trigger("change"),Galaxy.emit.debug("form-view::update()","Updating options for "+i)}}})},wait:function(e){for(var t in this.input_list){var i=this.field_list[t],n=this.input_list[t];n.is_dynamic&&i.wait&&i.unwait&&i[e?"wait":"unwait"]()}},highlight:function(e,t,i){var n=this.element_list[e];if(n&&(n.error(t||"Please verify this parameter."),this.portlet.expand(),this.trigger("expand",e),!i)){var s=this.$el.parents().filter(function(){return["auto","scroll"].indexOf(r(this).css("overflow"))!=-1}).first();s.animate({scrollTop:s.scrollTop()+n.$el.offset().top-120},500)}},errors:function(e){if(this.trigger("reset"),e&&e.errors){var t=this.data.matchResponse(e.errors);for(var i in this.element_list){this.element_list[i];t[i]&&this.highlight(i,t[i],!0)}}},render:function(){var e=this;this.off("change"),this.off("reset"),this.field_list={},this.input_list={},this.element_list={},this.data=new s.Manager(this),this._renderForm(),this.data.create(),this.options.initial_errors&&this.errors(this.options);var t=this.data.checksum();return this.on("change",function(i){var n=e.input_list[i];if(!n||n.refresh_on_change||e.options.always_refresh){var s=e.data.checksum();s!=t&&(t=s,e.options.onchange&&e.options.onchange())}}),this.on("reset",function(){a.each(e.element_list,function(e){e.reset()})}),this},_renderForm:function(){r(".tooltip").remove(),this.message=new i.Message,this.section=new n.View(this,{inputs:this.options.inputs}),this.portlet=new t.View({icon:this.options.icon,title:this.options.title,cls:this.options.cls,operations:this.options.operations,buttons:this.options.buttons,collapsible:this.options.collapsible,collapsed:this.options.collapsed}),this.portlet.append(this.message.$el),this.portlet.append(this.section.$el),this.$el.empty(),this.options.inputs&&this.$el.append(this.portlet.$el),this.options.message&&this.message.update({persistent:!0,status:"warning",message:this.options.message}),Galaxy.emit.debug("form-view::initialize()","Completed")}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1))},function(e,t,i){var n,s;(function(o){n=[i(30),i(74),i(5)],s=function(e,t,i){"use strict";function n(e){return function(t,i){return this.isNew()&&(i=i||{},i.url=this.urlRoot+this.get("history_id")+"/contents",t=t||{},t.type="dataset_collection"),e.call(this,t,i)}}var s=t.HistoryContentMixin,a=e.ListDatasetCollection,r=e.PairDatasetCollection,l=e.ListPairedDatasetCollection,c=e.ListOfListsDatasetCollection,d=a.extend(s).extend({defaults:o.extend(o.clone(a.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list",model_class:"HistoryDatasetCollectionAssociation"}),save:n(a.prototype.save),toString:function(){return"History"+a.prototype.toString.call(this)}}),h=r.extend(s).extend({defaults:o.extend(o.clone(r.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"paired",model_class:"HistoryDatasetCollectionAssociation"}),save:n(r.prototype.save),toString:function(){return"History"+r.prototype.toString.call(this)}}),u=l.extend(s).extend({defaults:o.extend(o.clone(l.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:paired",model_class:"HistoryDatasetCollectionAssociation"}),save:n(l.prototype.save),toString:function(){return"History"+l.prototype.toString.call(this)}}),p=c.extend(s).extend({defaults:o.extend(o.clone(c.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:list",model_class:"HistoryDatasetCollectionAssociation"}),save:n(c.prototype.save),toString:function(){return["HistoryListOfListsDatasetCollection(",this.get("name"),")"].join("")}});return{HistoryListDatasetCollection:d,HistoryPairDatasetCollection:h,HistoryListPairedDatasetCollection:u,HistoryListOfListsDatasetCollection:p}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o,a,r){n=[i(67),i(72),i(39),i(41),i(6),i(129)],s=function(e,t,i,n,s,l){"use strict";var c=e.PaginatedCollection,d=c.extend(s.LoggableMixin).extend({_logNamespace:"history",model:function(e,n){if("dataset"===e.history_content_type)return new t.HistoryDatasetAssociation(e,n);if("dataset_collection"===e.history_content_type){switch(e.collection_type){case"list":return new i.HistoryListDatasetCollection(e,n);case"paired":return new i.HistoryPairDatasetCollection(e,n);case"list:paired":return new i.HistoryListPairedDatasetCollection(e,n);case"list:list":return new i.HistoryListOfListsDatasetCollection(e,n)}var s="Unknown collection_type: "+e.collection_type;return console.warn(s,e),{validationError:s}}return{validationError:"Unknown history_content_type: "+e.history_content_type}},limitPerPage:500,limitPerProgressiveFetch:500,order:"hid",urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(e,t){t=t||{},c.prototype.initialize.call(this,e,t),this.history=t.history||null,this.setHistoryId(t.historyId||null),this.includeDeleted=t.includeDeleted||this.includeDeleted,this.includeHidden=t.includeHidden||this.includeHidden,this.model.prototype.idAttribute="type_id"},setHistoryId:function(e){this.historyId=e,this._setUpWebStorage()},_setUpWebStorage:function(e){if(this.historyId)return this.storage=new n.HistoryPrefs({id:n.HistoryPrefs.historyStorageKey(this.historyId)}),this.trigger("new-storage",this.storage,this),this.on({"include-deleted":function(e){this.storage.includeDeleted(e)},"include-hidden":function(e){this.storage.includeHidden(e)}}),this.includeDeleted=this.storage.includeDeleted()||!1,this.includeHidden=this.storage.includeHidden()||!1,this},comparators:o.extend(o.clone(c.prototype.comparators),{name:s.buildComparator("name",{ascending:!0}),"name-dsc":s.buildComparator("name",{ascending:!1}),hid:s.buildComparator("hid",{ascending:!1}),"hid-asc":s.buildComparator("hid",{ascending:!0})}),running:function(){return this.filter(function(e){return!e.inReadyState()})},runningAndActive:function(){return this.filter(function(e){return!e.inReadyState()&&e.get("visible")&&!e.get("deleted")})},getByHid:function(e){return this.findWhere({hid:e})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},hidden:function(){return this.filter(function(e){return e.hidden()})},deleted:function(){return this.filter(function(e){return e.get("deleted")})},visibleAndUndeleted:function(){return this.filter(function(e){return e.get("visible")&&!e.get("deleted")})},setIncludeDeleted:function(e,t){if(o.isBoolean(e)&&e!==this.includeDeleted){if(this.includeDeleted=e,o.result(t,"silent"))return;this.trigger("include-deleted",e,this)}},setIncludeHidden:function(e,t){if(o.isBoolean(e)&&e!==this.includeHidden){if(this.includeHidden=e,t=t||{},o.result(t,"silent"))return;this.trigger("include-hidden",e,this)}},fetch:function(e){if(e=e||{},this.historyId&&!e.details){var t=n.HistoryPrefs.get(this.historyId).toJSON();o.isEmpty(t.expandedIds)||(e.details=o.values(t.expandedIds).join(","))}return c.prototype.fetch.call(this,e)},_buildFetchData:function(e){return o.extend(c.prototype._buildFetchData.call(this,e),{v:"dev"})},_fetchParams:c.prototype._fetchParams.concat(["v","details"]),_buildFetchFilters:function(e){var t=c.prototype._buildFetchFilters.call(this,e)||{},i={};return this.includeDeleted||(i.deleted=!1,i.purged=!1),this.includeHidden||(i.visible=!0),o.defaults(t,i)},getTotalItemCount:function(){return this.history.contentsShown()},fetchUpdated:function(e,t){return e&&(t=t||{filters:{}},t.remove=!1,t.filters={"update_time-ge":e.toISOString(),visible:""}),this.fetch(t)},fetchDeleted:function(e){e=e||{};var t=this;return e.filters=o.extend(e.filters,{deleted:!0,purged:void 0}),e.remove=!1,t.trigger("fetching-deleted",t),t.fetch(e).always(function(){t.trigger("fetching-deleted-done",t)})},fetchHidden:function(e){e=e||{};var t=this;return e.filters=o.extend(e.filters,{visible:!1}),e.remove=!1,t.trigger("fetching-hidden",t),t.fetch(e).always(function(){t.trigger("fetching-hidden-done",t)})},fetchAllDetails:function(e){e=e||{};var t={details:"all"};return e.data=o.extend(e.data||{},t),this.fetch(e)},fetchCollectionCounts:function(e){return e=e||{},e.keys=["type_id","element_count"].join(","),e.filters=o.extend(e.filters||{},{history_content_type:"dataset_collection"}),e.remove=!1,this.fetch(e)},_filterAndUpdate:function(e,t){var i=this,n=i.model.prototype.idAttribute,s=[t];return i.fetch({filters:e,remove:!1}).then(function(e){return e=e.reduce(function(e,t,s){var o=i.get(t[n]);return o?e.concat(o):e},[]),i.ajaxQueue("save",s,e)})},ajaxQueue:function(e,t,i){ +return i=i||this.models,new l.AjaxQueue(i.slice().reverse().map(function(i,n){var s=o.isString(e)?i[e]:e;return function(){return s.apply(i,t)}})).deferred},progressivelyFetchDetails:function(e){function i(t){t=t||0;var a=o.extend(o.clone(e),{view:"summary",keys:c,limit:r,offset:t,reset:0===t,remove:!1});o.defer(function(){s.fetch.call(s,a).fail(n.reject).done(function(e){n.notify(e,r,t),e.length!==r?(s.allFetched=!0,n.resolve(e,r,t)):i(t+r)})})}e=e||{};var n=a.Deferred(),s=this,r=e.limitPerCall||s.limitPerProgressiveFetch,l=t.HistoryDatasetAssociation.prototype.searchAttributes,c=l.join(",");return i(),n},isCopyable:function(e){var t=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return o.isObject(e)&&e.id&&o.contains(t,e.model_class)},copy:function(e){var t,i,n;o.isString(e)?(t=e,n="hda",i="dataset"):(t=e.id,n={HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"}[e.model_class]||"hda",i="hdca"===n?"dataset_collection":"dataset");var s=this,r=a.ajax(this.url(),{method:"POST",contentType:"application/json",data:JSON.stringify({content:t,source:n,type:i})}).done(function(e){s.add([e],{parse:!0})}).fail(function(e,o,a){s.trigger("error",s,r,{},"Error copying contents",{type:i,id:t,source:n})});return r},createHDCA:function(e,t,i,n){var s=this.model({history_content_type:"dataset_collection",collection_type:t,history_id:this.historyId,name:i,element_identifiers:e});return s.save(n)},haveSearchDetails:function(){return this.allFetched&&this.all(function(e){return o.has(e.attributes,"annotation")})},matches:function(e){return this.filter(function(t){return t.matches(e)})},clone:function(){var e=r.Collection.prototype.clone.call(this);return e.historyId=this.historyId,e},toString:function(){return["HistoryContents(",[this.historyId,this.length].join(),")"].join("")}});return{HistoryContents:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(1),i(3))},function(e,t,i){var n,s;(function(o){n=[i(6)],s=function(e){"use strict";var t=e.SessionStorageModel.extend({defaults:{expandedIds:{},show_deleted:!1,show_hidden:!1},addExpanded:function(e){var t=this.get("expandedIds");t[e.id]=e.get("id"),this.save("expandedIds",t)},removeExpanded:function(e){var t=this.get("expandedIds");delete t[e.id],this.save("expandedIds",t)},isExpanded:function(e){return o.result(this.get("expandedIds"),e,!1)},allExpanded:function(){return o.values(this.get("expandedIds"))},clearExpanded:function(){this.set("expandedIds",{})},includeDeleted:function(e){return o.isUndefined(e)||this.set("show_deleted",e),this.get("show_deleted")},includeHidden:function(e){return o.isUndefined(e)||this.set("show_hidden",e),this.get("show_hidden")},toString:function(){return"HistoryPrefs("+this.id+")"}},{storageKeyPrefix:"history:",historyStorageKey:function(e){if(!e)throw new Error("HistoryPrefs.historyStorageKey needs valid id: "+e);return t.storageKeyPrefix+e},get:function(e){return new t({id:t.historyStorageKey(e)})},clearAll:function(e){for(var i in sessionStorage)0===i.indexOf(t.storageKeyPrefix)&&sessionStorage.removeItem(i)}});return{HistoryPrefs:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(6),i(5)],s=function(e,t){"use strict";var i="list",n=o.View.extend(e.LoggableMixin).extend({_logNamespace:i,initialize:function(e){this.expanded=e.expanded||!1,this.log("\t expanded:",this.expanded),this.fxSpeed=void 0!==e.fxSpeed?e.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(e){var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){var e=a(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(e).replaceWith(this._renderDetails().show()),e},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;0===t?(i._swapNewRender(e),i.trigger("rendered",i)):a(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",r.isFunction(this.className)?this.className():this.className).append(e.children())},_setUpBehaviors:function(e){e=e||this.$el,e.find("[title]").tooltip({placement:"bottom"})},$details:function(e){return e=e||this.$el,e.find("> .details")},_renderDetails:function(){var e=a(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(e),e},toggleExpanded:function(e){return e=void 0===e?!this.expanded:e,e?this.expand():this.collapse(),this},expand:function(){var e=this;return e._fetchModelDetails().always(function(){e._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?l.when():this.model.fetch()},_expand:function(){var e=this,t=e._renderDetails();e.$details().replaceWith(t),e.expanded=!0,e.$details().slideDown(e.fxSpeed,function(){e.trigger("expanded",e)})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var e=this;e.expanded=!1,this.$details().slideUp(e.fxSpeed,function(){e.trigger("collapsed",e)})}}),s=n.extend(e.mixin(e.SelectableViewMixin,e.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(t){n.prototype.initialize.call(this,t),e.SelectableViewMixin.initialize.call(this,t),e.DraggableViewMixin.initialize.call(this,t),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(e){e?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var e=n.prototype._buildNewRender.call(this);return e.children(".warnings").replaceWith(this._renderWarnings()),e.children(".title-bar").replaceWith(this._renderTitleBar()),e.children(".primary-actions").append(this._renderPrimaryActions()),e.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),e},_swapNewRender:function(e){return n.prototype._swapNewRender.call(this,e),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var e=this,t=a('
    '),i=e.model.toJSON();return r.each(e.templates.warnings,function(n){t.append(a(n(i,e)))}),t},_renderTitleBar:function(){return a(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return a(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(e){e.stopPropagation(),e.altKey?(this.toggleSelect(e),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(e){var t=32,i=13;return!e||"keydown"!==e.type||e.keyCode!==t&&e.keyCode!==i||(this.toggleExpanded(),e.stopPropagation(),!1)},toString:function(){var e=this.model?this.model+"":"(no model)";return"ListItemView("+e+")"}}));s.prototype.templates=function(){var t=e.wrapTemplate(['
    ','
    ','
    ','',"
    ",'
    ','
    ','
    ',"
    "]),i={},n=e.wrapTemplate(['
    ','','
    ','<%- element.name %>',"
    ",'
    ',"
    "],"element"),s=e.wrapTemplate(['
    ']),o=e.wrapTemplate(['
    ']);return{el:t,warnings:i,titleBar:n,subtitle:s,details:o}}();var c=s.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(e){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=e.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=e.foldoutPanelClass||this.foldoutPanelClass,s.prototype.initialize.call(this,e),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return a();var e=s.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,e)},_createFoldoutPanel:function(){var e=this.model,t=this._getFoldoutPanelClass(e),i=this._getFoldoutPanelOptions(e),n=new t(r.extend(i,{model:e}));return n},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(e,t){return t=t||this.$("> .details"),this.foldout=e.render(0),e.$("> .controls").hide(),t.append(e.$el)},expand:function(){var e=this;return e._fetchModelDetails().always(function(){"foldout"===e.foldoutStyle?e._expand():"drilldown"===e.foldoutStyle&&e._expandByDrilldown()})},_expandByDrilldown:function(){var e=this;e.listenTo(e.foldout,"close",function(){e.trigger("collapsed:drilldown",e,e.foldout)}),e.trigger("expanded:drilldown",e,e.foldout)}});return c.prototype.templates=function(){var t=e.wrapTemplate(['
    ',"
    "],"collection");return r.extend({},s.prototype.templates,{details:t})}(),{ExpandableView:n,ListItemView:s,FoldoutListItemView:c}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2),i(1))},function(e,t,i){var n,s;(function(o,a){n=[i(4),i(55),i(7),i(38),i(17),i(28)],s=function(e,t,i,n,s,r){return n.extend({initialize:function(e){var i=this;n.prototype.initialize.call(this,e),this.deferred=new t,e.inputs?this._buildForm(e):this.deferred.execute(function(t){i._buildModel(t,e,!0)}),e.listen_to_history&&parent.Galaxy&&parent.Galaxy.currHistoryPanel&&this.listenTo(parent.Galaxy.currHistoryPanel.collection,"change",function(){this.refresh()}),this.$el.on("remove",function(){i.remove()})},refresh:function(){var e=this;e.deferred.reset(),this.deferred.execute(function(t){e._updateModel(t)})},remove:function(){var e=this;this.$el.hide(),this.deferred.execute(function(){n.prototype.remove.call(e),Galaxy.emit.debug("tool-form-base::remove()","Destroy view.")})},_buildForm:function(t){var i=this;this.options=e.merge(t,this.options),this.options=e.merge({icon:t.icon,title:""+t.name+" "+t.description+" (Galaxy Version "+t.version+")",operations:!this.options.hide_operations&&this._operations(),onchange:function(){i.refresh()}},this.options),this.options.customize&&this.options.customize(this.options),this.render(),this.options.collapsible||this.$el.append(o("
    ").addClass("ui-margin-top-large").append(this._footer()))},_buildModel:function(t,n,s){var a=this;this.options.id=n.id,this.options.version=n.version;var r="",l={};n.job_id?r=Galaxy.root+"api/jobs/"+n.job_id+"/build_for_rerun":(r=Galaxy.root+"api/tools/"+n.id+"/build",Galaxy.params&&Galaxy.params.tool_id==n.id&&(l=o.extend({},Galaxy.params),n.version&&(l.tool_version=n.version))),e.get({url:r,data:l,success:function(e){return e=e.tool_model||e,e.display?(a._buildForm(e),!s&&a.message.update({status:"success",message:"Now you are using '"+a.options.name+"' version "+a.options.version+", id '"+a.options.id+"'.",persistent:!1}),Galaxy.emit.debug("tool-form-base::initialize()","Initial tool model ready.",e),void t.resolve()):void(window.location=Galaxy.root)},error:function(e,n){var s=e&&e.err_msg||"Uncaught error.";401==n.status?window.location=Galaxy.root+"user/login?"+o.param({redirect:Galaxy.root+"?tool_id="+a.options.id}):a.$el.is(":empty")?a.$el.prepend(new i.Message({message:s,status:"danger",persistent:!0,large:!0}).$el):Galaxy.modal&&Galaxy.modal.show({title:"Tool request failed",body:s,buttons:{Close:function(){Galaxy.modal.hide()}}}),Galaxy.emit.debug("tool-form::initialize()","Initial tool model request failed.",e),t.reject()}})},_updateModel:function(t){var i=this,n=this.options.update_url||Galaxy.root+"api/tools/"+this.options.id+"/build",s={tool_id:this.options.id,tool_version:this.options.version,inputs:o.extend(!0,{},i.data.create())};this.wait(!0),Galaxy.emit.debug("tool-form-base::_updateModel()","Sending current state.",s),e.request({type:"POST",url:n,data:s,success:function(e){i.update(e.tool_model||e),i.options.update&&i.options.update(e),i.wait(!1),Galaxy.emit.debug("tool-form-base::_updateModel()","Received new model.",e),t.resolve()},error:function(e){Galaxy.emit.debug("tool-form-base::_updateModel()","Refresh request failed.",e),t.reject()}})},_operations:function(){var e=this,t=this.options,n=new i.ButtonMenu({icon:"fa-cubes",title:!t.narrow&&"Versions"||null,tooltip:"Select another tool version"});if(!t.sustain_version&&t.versions&&t.versions.length>1)for(var s in t.versions){var o=t.versions[s];o!=t.version&&n.addMenu({title:"Switch to "+o,version:o,icon:"fa-cube",onclick:function(){var i=t.id.replace(t.version,this.version),n=this.version;e.deferred.reset(),e.deferred.execute(function(t){e._buildModel(t,{id:i,version:n})})}})}else n.$el.hide();var a=new i.ButtonMenu({icon:"fa-caret-down",title:!t.narrow&&"Options"||null,tooltip:"View available options"});return t.biostar_url&&(a.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(t.biostar_url+"/p/new/post/")}}),a.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(t.biostar_url+"/local/search/page/?q="+t.name)}})),a.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+Galaxy.root+"root?tool_id="+t.id)}}),Galaxy.user&&Galaxy.user.get("is_admin")&&a.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=Galaxy.root+"api/tools/"+t.id+"/download"}}),t.requirements&&t.requirements.length>0&&a.addMenu({icon:"fa-info-circle",title:"Requirements",tooltip:"Display tool requirements",onclick:function(){!this.visible||e.portlet.collapsed?(this.visible=!0,e.portlet.expand(),e.message.update({persistent:!0,message:e._templateRequirements(t),status:"info"})):(this.visible=!1,e.message.update({message:""}))}}),t.sharable_url&&a.addMenu({icon:"fa-external-link",title:"See in Tool Shed",tooltip:"Access the repository",onclick:function(){window.open(t.sharable_url)}}),{menu:a,versions:n}},_footer:function(){var e=this.options,t=o("
    ").append(this._templateHelp(e));if(e.citations){var i=o("
    "),n=new s.ToolCitationCollection;n.tool_id=e.id;var a=new r.CitationListView({el:i,collection:n});a.render(),n.fetch(),t.append(i)}return t},_templateHelp:function(e){var t=o("
    ").addClass("ui-form-help").append(e.help);return t.find("a").attr("target","_blank"),t},_templateRequirements:function(e){var t=e.requirements.length;if(t>0){var i="This tool requires ";a.each(e.requirements,function(e,n){i+=e.name+(e.version?" (Version "+e.version+")":"")+(n").attr("target","_blank").attr("href","https://wiki.galaxyproject.org/Tools/Requirements").text("here");return o("").append(i+". Click ").append(n).append(" for more information.")}return"No requirements found."}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(1),i(2))},function(e,t,i){var n,s;(function(o,a){n=[i(2),i(16),i(11),i(18)],s=function(e,t,i,n){"use strict";var s={hidden:!1,show:function(){this.set("hidden",!1)},hide:function(){this.set("hidden",!0)},toggle:function(){this.set("hidden",!this.get("hidden"))},is_visible:function(){return!this.attributes.hidden}},r=o.Model.extend({defaults:{name:null,label:null,type:null,value:null,html:null,num_samples:5},initialize:function(e){this.attributes.html=unescape(this.attributes.html)},copy:function(){return new r(this.toJSON())},set_value:function(e){this.set("value",e||"")}}),l=o.Collection.extend({model:r}),c=r.extend({}),d=r.extend({set_value:function(e){this.set("value",parseInt(e,10))},get_samples:function(){return d3.scale.linear().domain([this.get("min"),this.get("max")]).ticks(this.get("num_samples"))}}),h=d.extend({set_value:function(e){this.set("value",parseFloat(e))}}),u=r.extend({get_samples:function(){return e.map(this.get("options"),function(e){return e[0]})}});r.subModelTypes={integer:d,"float":h,data:c,select:u};var p=o.Model.extend({defaults:{id:null,name:null,description:null,target:null,inputs:[],outputs:[]},urlRoot:Galaxy.root+"api/tools",initialize:function(t){this.set("inputs",new l(e.map(t.inputs,function(e){var t=r.subModelTypes[e.type]||r;return new t(e)})))},toJSON:function(){var e=o.Model.prototype.toJSON.call(this);return e.inputs=this.get("inputs").map(function(e){return e.toJSON()}),e},remove_inputs:function(e){var t=this,i=t.get("inputs").filter(function(t){return e.indexOf(t.get("type"))!==-1});t.get("inputs").remove(i)},copy:function(e){var t=new p(this.toJSON());if(e){var i=new o.Collection;t.get("inputs").each(function(e){e.get_samples()&&i.push(e)}),t.set("inputs",i)}return t},apply_search_results:function(t){return e.indexOf(t,this.attributes.id)!==-1?this.show():this.hide(),this.is_visible()},set_input_value:function(e,t){this.get("inputs").find(function(t){return t.get("name")===e}).set("value",t)},set_input_values:function(t){var i=this;e.each(e.keys(t),function(e){i.set_input_value(e,t[e])})},run:function(){return this._run()},rerun:function(e,t){return this._run({action:"rerun",target_dataset_id:e.id,regions:t})},get_inputs_dict:function(){var e={};return this.get("inputs").each(function(t){e[t.get("name")]=t.get("value")}),e},_run:function(n){var s=e.extend({tool_id:this.id,inputs:this.get_inputs_dict()},n),o=a.Deferred(),r=new t.ServerStateDeferred({ajax_settings:{url:this.urlRoot,data:JSON.stringify(s),dataType:"json",contentType:"application/json",type:"POST"},interval:2e3,success_fn:function(e){return"pending"!==e}});return a.when(r.go()).then(function(e){o.resolve(new i.DatasetCollection(e))}),o}});e.extend(p.prototype,s);var g=(o.View.extend({}),o.Collection.extend({model:p})),f=o.Model.extend(s),m=o.Model.extend({defaults:{elems:[],open:!1},clear_search_results:function(){e.each(this.attributes.elems,function(e){e.show()}),this.show(),this.set("open",!1)},apply_search_results:function(t){var i,n=!0;e.each(this.attributes.elems,function(e){e instanceof f?(i=e,i.hide()):e instanceof p&&e.apply_search_results(t)&&(n=!1,i&&i.show())}),n?this.hide():(this.show(),this.set("open",!0))}});e.extend(m.prototype,s);var v=o.Model.extend({defaults:{search_hint_string:"search tools",min_chars_for_search:3,clear_btn_url:"",search_url:"",visible:!0,query:"",results:null,clear_key:27},urlRoot:Galaxy.root+"api/tools",initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var e=this.attributes.query;if(e.length");e.append(S.tool_link(this.model.toJSON()));var t=this.model.get("form_style",null);if("upload1"===this.model.id)e.find("a").on("click",function(e){e.preventDefault(),Galaxy.upload.show()});else if("regular"===t){var i=this;e.find("a").on("click",function(e){e.preventDefault();var t=new n.View({id:i.model.id,version:i.model.get("version")});t.deferred.execute(function(){Galaxy.app.display(t)})})}return this.$el.append(e),this}}),b=y.extend({tagName:"div",className:"toolPanelLabel",render:function(){return this.$el.append(a("").text(this.model.attributes.text)),this}}),x=y.extend({tagName:"div",className:"toolSectionWrapper",initialize:function(){y.prototype.initialize.call(this),this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(S.panel_section(this.model.toJSON()));var t=this.$el.find(".toolSectionBody");return e.each(this.model.attributes.elems,function(e){if(e instanceof p){var i=new w({model:e,className:"toolTitle"});i.render(),t.append(i.$el)}else if(e instanceof f){var n=new b({model:e});n.render(),t.append(n.$el)}}),this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast")}}),C=o.View.extend({tagName:"div",id:"tool-search",className:"bar",events:{click:"focus_and_select","keyup :input":"query_changed","click #search-clear-btn":"clear"},render:function(){return this.$el.append(S.tool_search(this.model.toJSON())),this.model.is_visible()||this.$el.hide(),this.$el.find("[title]").tooltip(),this},focus_and_select:function(){this.$el.find(":input").focus().select()},clear:function(){return this.model.clear_search(),this.$el.find(":input").val(""),this.focus_and_select(),!1},query_changed:function(e){return this.model.attributes.clear_key&&this.model.attributes.clear_key===e.which?(this.clear(),!1):void this.model.set("query",this.$el.find(":input").val())}}),$=o.View.extend({tagName:"div",className:"toolMenu",initialize:function(){this.model.get("tool_search").on("change:results",this.handle_search_results,this)},render:function(){var e=this,t=new C({model:this.model.get("tool_search")});return t.render(),e.$el.append(t.$el),this.model.get("layout").each(function(t){if(t instanceof m){var i=new x({model:t});i.render(),e.$el.append(i.$el)}else if(t instanceof p){var n=new w({model:t,className:"toolTitleNoSection"});n.render(),e.$el.append(n.$el)}else if(t instanceof f){var s=new b({model:t});s.render(),e.$el.append(s.$el)}}),e.$el.find("a.tool-link").click(function(t){var i=a(this).attr("class").split(/\s+/)[0],n=e.model.get("tools").get(i);e.trigger("tool_link_click",t,n)}),this},handle_search_results:function(){var e=this.model.get("tool_search").get("results");e&&0===e.length?a("#search-no-results").show():a("#search-no-results").hide()}}),E=o.View.extend({className:"toolForm",render:function(){this.$el.children().remove(),this.$el.append(S.tool_form(this.model.toJSON()))}}),S=(o.View.extend({className:"toolMenuAndView",initialize:function(){this.tool_panel_view=new $({collection:this.collection}),this.tool_form_view=new E},render:function(){this.tool_panel_view.render(),this.tool_panel_view.$el.css("float","left"),this.$el.append(this.tool_panel_view.$el),this.tool_form_view.$el.hide(),this.$el.append(this.tool_form_view.$el);var e=this;this.tool_panel_view.on("tool_link_click",function(t,i){t.preventDefault(),e.show_tool(i)})},show_tool:function(e){var t=this;e.fetch().done(function(){t.tool_form_view.model=e,t.tool_form_view.render(),t.tool_form_view.$el.show(),a("#left").width("650px")})}}),{tool_search:e.template(['',' ',''].join("")),panel_section:e.template(['",'
    '+e.content+"
    "}});return{View:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1))},function(e,t,i){var n,s;(function(i){n=[],s=function(){var e=i.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_name:"",file_mode:"",file_size:0,file_type:null,file_path:"",file_data:null,percentage:0,space_to_tab:!1,to_posix_lines:!0,enabled:!0},reset:function(e){this.clear().set(this.defaults).set(e)}}),t=i.Collection.extend({model:e});return{Model:e,Collection:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3))},,function(e,t,i){var n,s;(function(o,a){n=[i(4)],s=function(e){return o.Model.extend({initialize:function(){this.active={},this.last=null},execute:function(t){var i=this,n=e.uid(),s=t.length>0;this.active[n]=!0;var o=a.Deferred();o.promise().always(function(){delete i.active[n],s&&Galaxy.emit.debug("deferred::execute()",this.state().charAt(0).toUpperCase()+this.state().slice(1)+" "+n)}),a.when(this.last).always(function(){i.active[n]?(s&&Galaxy.emit.debug("deferred::execute()","Running "+n),t(o),!s&&o.resolve()):o.reject()}),this.last=o.promise()},reset:function(){Galaxy.emit.debug("deferred::execute()","Reset");for(var e in this.active)this.active[e]=!1},ready:function(){return a.isEmptyObject(this.active)}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1))},,,,,,,,,,,function(e,t,i){var n,s;(function(o,a){n=[i(6),i(5),i(15)],s=function(e,t){var i=o.View.extend(e.LoggableMixin).extend(e.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"annotation-display",initialize:function(e){e=e||{},this.tooltipConfig=e.tooltipConfig||{placement:"bottom"},this.listenTo(this.model,"change:annotation",function(){this.render()}),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.$el.html(this._template()),this.$annotation().make_text_editable({use_textarea:!0,on_finish:function(t){e.$annotation().text(t),e.model.save({annotation:t},{silent:!0}).fail(function(){e.$annotation().text(e.model.previous("annotation"))})}}),this},_template:function(){var e=this.model.get("annotation");return['",'
    ',a.escape(e),"
    "].join("")},$annotation:function(){return this.$el.find(".annotation")},remove:function(){this.$annotation.off(),this.stopListening(this.model),o.View.prototype.remove.call(this)},toString:function(){return["AnnotationEditor(",this.model+"",")"].join("")}});return{AnnotationEditor:i}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2))},function(e,t,i){var n,s;(function(o){n=[i(2),i(3),i(6)],s=function(e,t,i){"use strict";var n=t.Collection.extend({initialize:function(e,i){t.Collection.prototype.initialize.call(this,e,i),this.setOrder(i.order||this.order,{silent:!0})},_setUpListeners:function(){return this.on({"changed-order":this.sort})},fetch:function(e){return e=this._buildFetchOptions(e),t.Collection.prototype.fetch.call(this,e)},_buildFetchOptions:function(t){t=e.clone(t)||{};var i=this;t.traditional=!0,t.data=t.data||i._buildFetchData(t);var n=this._buildFetchFilters(t);return e.isEmpty(n)||e.extend(t.data,this._fetchFiltersToAjaxData(n)),t},_buildFetchData:function(t){var i={};return this.order&&(i.order=this.order),e.defaults(e.pick(t,this._fetchParams),i)},_fetchParams:["order","limit","offset","view","keys"],_buildFetchFilters:function(t){return e.clone(t.filters||{})},_fetchFiltersToAjaxData:function(t){var i={q:[],qv:[]};return e.each(t,function(e,t){void 0!==e&&""!==e&&(e===!0&&(e="True"),e===!1&&(e="False"),null===e&&(e="None"),i.q.push(t),i.qv.push(e))}),i},reset:function(e,i){return this.allFetched=!1,t.Collection.prototype.reset.call(this,e,i)},order:null,comparators:{update_time:i.buildComparator("update_time",{ascending:!1}),"update_time-asc":i.buildComparator("update_time",{ascending:!0}),create_time:i.buildComparator("create_time",{ascending:!1}),"create_time-asc":i.buildComparator("create_time",{ascending:!0})},setOrder:function(t,i){i=i||{};var n=this,s=n.comparators[t];if(e.isUndefined(s))throw new Error("unknown order: "+t);if(s!==n.comparator){n.order;return n.order=t,n.comparator=s,i.silent||n.trigger("changed-order",i),n}}}),s=n.extend({limitPerPage:500,initialize:function(e,t){n.prototype.initialize.call(this,e,t),this.currentPage=t.currentPage||0},getTotalItemCount:function(){return this.length},shouldPaginate:function(){return this.getTotalItemCount()>=this.limitPerPage},getLastPage:function(){return Math.floor(this.getTotalItemCount()/this.limitPerPage)},getPageCount:function(){return this.getLastPage()+1},getPageLimitOffset:function(e){return e=this.constrainPageNum(e),{limit:this.limitPerPage,offset:e*this.limitPerPage}},constrainPageNum:function(e){return Math.max(0,Math.min(e,this.getLastPage()))},fetchPage:function(t,i){var n=this;return t=n.constrainPageNum(t),n.currentPage=t,i=e.defaults(i||{},n.getPageLimitOffset(t)),n.trigger("fetching-more"),n.fetch(i).always(function(){n.trigger("fetching-more-done")})},fetchCurrentPage:function(e){return this.fetchPage(this.currentPage,e)},fetchPrevPage:function(e){return this.fetchPage(this.currentPage-1,e)},fetchNextPage:function(e){return this.fetchPage(this.currentPage+1,e)}}),a=n.extend({limitOnFirstFetch:null,limitPerFetch:100,initialize:function(e,t){n.prototype.initialize.call(this,e,t),this.limitOnFirstFetch=t.limitOnFirstFetch||this.limitOnFirstFetch,this.limitPerFetch=t.limitPerFetch||this.limitPerFetch,this.allFetched=!1,this.lastFetched=t.lastFetched||0},_buildFetchOptions:function(e){return e.remove=e.remove||!1,n.prototype._buildFetchOptions.call(this,e)},fetchFirst:function(t){return t=t?e.clone(t):{},this.allFetched=!1,this.lastFetched=0,this.fetchMore(e.defaults(t,{reset:!0,limit:this.limitOnFirstFetch}))},fetchMore:function(t){t=e.clone(t||{});var i=this;if(!t.reset&&i.allFetched)return o.when();t.offset=t.reset?0:t.offset||i.lastFetched;var n=t.limit=t.limit||i.limitPerFetch||null;return i.trigger("fetching-more"),i.fetch(t).always(function(){i.trigger("fetching-more-done")}).done(function(t){var s=e.isArray(t)?t.length:0;i.lastFetched+=s,(!n||s .controls").add(this.$list()).hide(),e.parentName=this.model.get("name"),this.$el.append(e.render().$el)},_collapseDrilldownPanel:function(e){this.panelStack.pop(),this.render()},events:{"click .navigation .back":"close"},close:function(e){this.remove(),this.trigger("close")},toString:function(){return"CollectionView("+(this.model?this.model.get("name"):"")+")"}});l.prototype.templates=function(){var e=n.wrapTemplate(['
    ','",'
    ','
    <%- collection.name || collection.element_identifier %>
    ','
    ','<% if( collection.collection_type === "list" ){ %>',s("a list of datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',s("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',s("a list of paired datasets"),'<% } else if( collection.collection_type === "list:list" ){ %>',s("a list of dataset lists"),"<% } %>","
    ","
    ","
    "],"collection");return o.extend(o.clone(r.prototype.templates),{controls:e})}();var c=l.extend({DatasetDCEViewClass:i.DatasetDCEListItemView,toString:function(){return"ListCollectionView("+(this.model?this.model.get("name"):"")+")"}}),d=c.extend({toString:function(){return"PairCollectionView("+(this.model?this.model.get("name"):"")+")"}}),h=l.extend({NestedDCDCEViewClass:i.NestedDCDCEListItemView.extend({foldoutPanelClass:d}),toString:function(){return"ListOfPairsCollectionView("+(this.model?this.model.get("name"):"")+")"}}),u=l.extend({NestedDCDCEViewClass:i.NestedDCDCEListItemView.extend({foldoutPanelClass:d}),toString:function(){return"ListOfListsCollectionView("+(this.model?this.model.get("name"):"")+")"}});return{CollectionView:l,ListCollectionView:c,PairCollectionView:d,ListOfPairsCollectionView:h,ListOfListsCollectionView:u}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o,a){n=[i(12),i(32),i(77),i(66),i(22),i(6),i(5)],s=function(e,t,n,s,r,l,c){"use strict";var d=t.DatasetListItemView,h=d.extend({initialize:function(e){d.prototype.initialize.call(this,e),this.hasUser=e.hasUser,this.purgeAllowed=e.purgeAllowed||!1,this.tagsEditorShown=e.tagsEditorShown||!1,this.annotationEditorShown=e.annotationEditorShown||!1},_renderPrimaryActions:function(){var t=d.prototype._renderPrimaryActions.call(this);return this.model.get("state")===e.NOT_VIEWABLE?t:d.prototype._renderPrimaryActions.call(this).concat([this._renderEditButton(),this._renderDeleteButton()])},_renderEditButton:function(){if(this.model.get("state")===e.DISCARDED||!this.model.get("accessible"))return null;var t=this.model.get("purged"),i=this.model.get("deleted"),n={title:c("Edit attributes"),href:this.model.urls.edit,target:this.linkTarget,faIcon:"fa-pencil",classes:"edit-btn"};return i||t?(n.disabled=!0,t?n.title=c("Cannot edit attributes of datasets removed from disk"):i&&(n.title=c("Undelete dataset to edit attributes"))):o.contains([e.UPLOAD,e.NEW],this.model.get("state"))&&(n.disabled=!0,n.title=c("This dataset is not yet editable")),r(n)},_renderDeleteButton:function(){if(!this.model.get("accessible"))return null;var e=this,t=this.model.isDeletedOrPurged();return r({title:c(t?"Dataset is already deleted":"Delete"),disabled:t,faIcon:"fa-times",classes:"delete-btn",onclick:function(){e.$el.find(".icon-btn.delete-btn").trigger("mouseout"),e.model["delete"]()}})},_renderDetails:function(){var t=d.prototype._renderDetails.call(this),i=this.model.get("state");return!this.model.isDeletedOrPurged()&&o.contains([e.OK,e.FAILED_METADATA],i)&&(this._renderTags(t),this._renderAnnotation(t),this._makeDbkeyEditLink(t)),this._setUpBehaviors(t),t},_renderSecondaryActions:function(){var t=d.prototype._renderSecondaryActions.call(this);switch(this.model.get("state")){case e.UPLOAD:case e.NOT_VIEWABLE:return t;case e.ERROR:return t.unshift(this._renderErrButton()),t.concat([this._renderRerunButton()]);case e.OK:case e.FAILED_METADATA:return t.concat([this._renderRerunButton(),this._renderVisualizationsButton()])}return t.concat([this._renderRerunButton()])},_renderErrButton:function(){return r({title:c("View or report this error"),href:this.model.urls.report_error,classes:"report-error-btn",target:this.linkTarget,faIcon:"fa-bug"})},_renderRerunButton:function(){var e=this.model.get("creating_job");if(this.model.get("rerunnable"))return r({title:c("Run this job again"),href:this.model.urls.rerun,classes:"rerun-btn",target:this.linkTarget,faIcon:"fa-refresh",onclick:function(t){t.preventDefault(),!function(){var t=[i(18)];(function(t){var i=new t.View({job_id:e});i.deferred.execute(function(){Galaxy.app.display(i)})}).apply(null,t)}()}})},_renderVisualizationsButton:function(){var e=this.model.get("visualizations");if(this.model.isDeletedOrPurged()||!this.hasUser||!this.model.hasData()||o.isEmpty(e))return null;if(!o.isObject(e[0]))return this.warn("Visualizations have been switched off"),null;var t=a(this.templates.visualizations(e,this));return t.find('[target="galaxy_main"]').attr("target",this.linkTarget),this._addScratchBookFn(t.find(".visualization-link").addBack(".visualization-link")),t},_addScratchBookFn:function(e){e.click(function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Visualization",url:a(this).attr("href")}),e.preventDefault(),e.stopPropagation())})},_renderTags:function(e){if(this.hasUser){var t=this;this.tagsEditor=new n.TagsEditor({model:this.model,el:e.find(".tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.tagsEditorShown=!0},onhide:function(){t.tagsEditorShown=!1},$activator:r({title:c("Edit dataset tags"),classes:"tag-btn",faIcon:"fa-tags"}).appendTo(e.find(".actions .right"))}),this.tagsEditorShown&&this.tagsEditor.toggle(!0)}},_renderAnnotation:function(e){if(this.hasUser){var t=this;this.annotationEditor=new s.AnnotationEditor({model:this.model,el:e.find(".annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.annotationEditorShown=!0},onhide:function(){t.annotationEditorShown=!1},$activator:r({title:c("Edit dataset annotation"),classes:"annotate-btn",faIcon:"fa-comment"}).appendTo(e.find(".actions .right"))}),this.annotationEditorShown&&this.annotationEditor.toggle(!0)}},_makeDbkeyEditLink:function(e){if("?"===this.model.get("metadata_dbkey")&&!this.model.isDeletedOrPurged()){var t=a('?').attr("href",this.model.urls.edit).attr("target",this.linkTarget);e.find(".dbkey .value").replaceWith(t)}},events:o.extend(o.clone(d.prototype.events),{"click .undelete-link":"_clickUndeleteLink","click .purge-link":"_clickPurgeLink","click .edit-btn":function(e){this.trigger("edit",this,e)},"click .delete-btn":function(e){this.trigger("delete",this,e)},"click .rerun-btn":function(e){this.trigger("rerun",this,e)},"click .report-err-btn":function(e){this.trigger("report-err",this,e)},"click .visualization-btn":function(e){this.trigger("visualize",this,e)},"click .dbkey a":function(e){this.trigger("edit",this,e)}}),_clickUndeleteLink:function(e){return this.model.undelete(),!1},_clickPurgeLink:function(e){return confirm(c("This will permanently remove the data in your dataset. Are you sure?"))&&this.model.purge(),!1},toString:function(){var e=this.model?this.model+"":"(no model)";return"HDAEditView("+e+")"}});return h.prototype.templates=function(){var e=o.extend({},d.prototype.templates.warnings,{failed_metadata:l.wrapTemplate(['<% if( dataset.state === "failed_metadata" ){ %>','","<% } %>"],"dataset"),deleted:l.wrapTemplate(["<% if( dataset.deleted && !dataset.purged ){ %>",'
    ',c("This dataset has been deleted"),'
    ',c("Undelete it"),"","<% if( view.purgeAllowed ){ %>",'
    ',c("Permanently remove it from disk"),"","<% } %>","
    ","<% } %>"],"dataset")}),t=l.wrapTemplate(["<% if( visualizations.length === 1 ){ %>",'">','',"","<% } else { %>",'","<% } %>"],"visualizations");return o.extend({},d.prototype.templates,{warnings:e,visualizations:t})}(),{DatasetListItemEdit:h}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(12),i(6),i(5)],s=function(e,t,i){"use strict";var n="dataset",s=t.SearchableModelMixin,l=o.Model.extend(t.LoggableMixin).extend(t.mixin(s,{_logNamespace:n,defaults:{state:e.NEW,deleted:!1,purged:!1,name:"(unnamed dataset)",accessible:!0,data_type:"",file_ext:"",file_size:0,meta_files:[],misc_blurb:"",misc_info:"",tags:[]},initialize:function(t,i){this.debug(this+"(Dataset).initialize",t,i), //!! this state is not in trans.app.model.Dataset.states - set it here - this.get("accessible")||this.set("state",e.NOT_VIEWABLE),this.urls=this._generateUrls(),this._setUpListeners()},_generateUrls:function(){var e=this.get("id");if(!e)return{};var t={purge:"datasets/"+e+"/purge_async",display:"datasets/"+e+"/display/?preview=True",edit:"datasets/"+e+"/edit",download:"datasets/"+e+"/display?to_ext="+this.get("file_ext"),report_error:"dataset/errors?id="+e,rerun:"tool_runner/rerun?id="+e,show_params:"datasets/"+e+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+e+"&metadata_name="};return a.each(t,function(e,i){t[i]=Galaxy.root+e}),this.urls=t,t},_setUpListeners:function(){this.on("change:state",function(e,t){this.log(this+" has changed state:",e,t),this.inReadyState()&&this.trigger("state:ready",e,t,this.previous("state"))}),this.on("change:id change:file_ext",function(e){this._generateUrls()})},toJSON:function(){var e=o.Model.prototype.toJSON.call(this);return a.extend(e,{urls:this.urls})},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},inReadyState:function(){var t=a.contains(e.READY_STATES,this.get("state"));return this.isDeletedOrPurged()||t},hasDetails:function(){return!this.get("accessible")||this.has("annotation")},hasData:function(){return this.get("file_size")>0},fetch:function(e){var t=this;return o.Model.prototype.fetch.call(this,e).always(function(){t._generateUrls()})},parse:function(e,t){var i=o.Model.prototype.parse.call(this,e,t);return i.create_time&&(i.create_time=new Date(i.create_time)),i.update_time&&(i.update_time=new Date(i.update_time)),i},save:function(e,t){return t=t||{},t.wait=!!a.isUndefined(t.wait)||t.wait,o.Model.prototype.save.call(this,e,t)},"delete":function(e){return this.get("deleted")?r.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?r.when():this.save({deleted:!1},e)},purge:function(e){if(this.get("purged"))return r.when();e=e||{},e.url=this.urls.purge;var t=this,n=r.ajax(e);return n.done(function(e,i,n){t.set({deleted:!0,purged:!0})}),n.fail(function(n,s,o){var a=i("Unable to purge dataset"),r="Removal of datasets by users is not allowed in this Galaxy instance";n.responseJSON&&n.responseJSON.error?a=n.responseJSON.error:n.responseText.indexOf(r)!==-1&&(a=r),n.responseText=a,t.trigger("error",t,n,e,i(a),{error:a})}),n},searchAttributes:["name","file_ext","genome_build","misc_blurb","misc_info","annotation","tags"],searchAliases:{title:"name",format:"file_ext",database:"genome_build",blurb:"misc_blurb",description:"misc_blurb",info:"misc_info",tag:"tags"},toString:function(){var e=this.get("id")||"";return this.get("name")&&(e='"'+this.get("name")+'",'+e),"Dataset("+e+")"}})),c=o.Collection.extend(t.LoggableMixin).extend({_logNamespace:n,model:l,urlRoot:Galaxy.root+"api/datasets",url:function(){return this.urlRoot},ids:function(){return this.map(function(e){return e.get("id")})},notReady:function(){return this.filter(function(e){return!e.inReadyState()})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},ajaxQueue:function(e,t){var i=r.Deferred(),n=this.length,s=[];if(!n)return i.resolve([]),i;var o=this.chain().reverse().map(function(a,r){return function(){var l=e.call(a,t);l.done(function(e){i.notify({curr:r,total:n,response:e,model:a})}),l.always(function(e){s.push(e),o.length?o.shift()():i.resolve(s)})}}).value();return o.shift()(),i},matches:function(e){return this.filter(function(t){return t.matches(e)})},toString:function(){return["DatasetAssociationCollection(",this.length,")"].join("")}});return{DatasetAssociation:l,DatasetAssociationCollection:c}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1))},function(e,t,i){var n,s;(function(o){n=[i(32),i(6),i(5)],s=function(e,t,i){"use strict";var n=e.DatasetListItemView,s=n.extend({className:n.prototype.className+" history-content",initialize:function(e,t){n.prototype.initialize.call(this,e,t)},toString:function(){var e=this.model?this.model+"":"(no model)";return"HDAListItemView("+e+")"}});return s.prototype.templates=function(){var e=t.wrapTemplate(['
    ','','
    ','<%- dataset.hid %> ','<%- dataset.name %>',"
    ","
    "],"dataset"),s=o.extend({},n.prototype.templates.warnings,{hidden:t.wrapTemplate(["<% if( !dataset.visible ){ %>",'
    ',i("This dataset has been hidden"),"
    ","<% } %>"],"dataset")});return o.extend({},n.prototype.templates,{titleBar:e,warnings:s})}(),{HDAListItemView:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o){n=[i(70),i(74),i(6),i(5)],s=function(e,t,i,n){"use strict";var s=e.DatasetAssociation,a=t.HistoryContentMixin,r=s.extend(i.mixin(a,{defaults:o.extend({},s.prototype.defaults,a.defaults,{history_content_type:"dataset",model_class:"HistoryDatasetAssociation"})}));return{HistoryDatasetAssociation:r}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o){n=[i(12),i(29),i(68),i(6),i(5)],s=function(e,t,i,n,s){"use strict";var a=t.DCListItemView,r=a.extend({className:a.prototype.className+" history-content",_setUpListeners:function(){a.prototype._setUpListeners.call(this),this.listenTo(this.model,{"change:populated change:visible":function(e,t){this.render()}})},_getFoldoutPanelClass:function(){switch(this.model.get("collection_type")){case"list":return i.ListCollectionView;case"paired":return i.PairCollectionView;case"list:paired":return i.ListOfPairsCollectionView;case"list:list":return i.ListOfListsCollectionView}throw new TypeError("Uknown collection_type: "+this.model.get("collection_type"))},_swapNewRender:function(t){a.prototype._swapNewRender.call(this,t);var i=this.model.get("populated")?e.OK:e.RUNNING;return this.$el.addClass("state-"+i),this.$el},toString:function(){var e=this.model?this.model+"":"(no model)";return"HDCAListItemView("+e+")"}});return r.prototype.templates=function(){var e=o.extend({},a.prototype.templates.warnings,{hidden:n.wrapTemplate(["<% if( !collection.visible ){ %>",'
    ',s("This collection has been hidden"),"
    ","<% } %>"],"collection")}),t=n.wrapTemplate(['
    ','','
    ','<%- collection.hid %> ','<%- collection.name %>',"
    ",'
    ',"
    "],"collection");return o.extend({},a.prototype.templates,{warnings:e,titleBar:t})}(),{HDCAListItemView:r}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o){n=[i(12),i(6),i(5)],s=function(e,t,i){"use strict";var n={defaults:{history_id:null,history_content_type:null,hid:null,visible:!0},idAttribute:"type_id",hidden:function(){return!this.get("visible")},isVisible:function(e,t){var i=!0;return e||!this.get("deleted")&&!this.get("purged")||(i=!1),t||this.get("visible")||(i=!1),i},urlRoot:Galaxy.root+"api/histories/",url:function(){var e=this.urlRoot+this.get("history_id")+"/contents/"+this.get("history_content_type")+"s/"+this.get("id");return e},hide:function(e){return this.get("visible")?this.save({visible:!1},e):o.when()},unhide:function(e){return this.get("visible")?o.when():this.save({visible:!0},e)},toString:function(){return[this.get("type_id"),this.get("hid"),this.get("name")].join(":")}};return{HistoryContentMixin:n}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(1))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(40),i(41),i(67),i(4),i(6),i(5)],s=function(e,t,i,n,s,c){"use strict";var d=o.Model.extend(s.LoggableMixin).extend(s.mixin(s.SearchableModelMixin,{_logNamespace:"history",UPDATE_DELAY:4e3,defaults:{model_class:"History",id:null,name:"Unnamed History",state:"new",deleted:!1,contents_active:{},contents_states:{}},urlRoot:Galaxy.root+"api/histories",contentsClass:e.HistoryContents,searchAttributes:["name","annotation","tags"],searchAliases:{title:"name",tag:"tags"},initialize:function(e,t){t=t||{},this.logger=t.logger||null,this.log(this+".initialize:",e,t),this.contents=new this.contentsClass([],{history:this,historyId:this.get("id"),order:t.order}),this._setUpListeners(),this._setUpCollectionListeners(),this.updateTimeoutId=null},_setUpListeners:function(){return this.on({error:function(e,t,i,n,s){this.clearUpdateTimeout()},"change:id":function(e,t){this.contents&&(this.contents.historyId=t)}})},_setUpCollectionListeners:function(){return this.contents?this.listenTo(this.contents,{error:function(){this.trigger.apply(this,a.makeArray(arguments))}}):this},contentsShown:function(){var e=this.get("contents_active"),t=e.active||0;return t+=this.contents.includeDeleted?e.deleted:0,t+=this.contents.includeHidden?e.hidden:0},nice_size:function(){var e=this.get("size");return e?n.bytesToString(e,!0,2):c("(empty)")},toJSON:function(){return r.extend(o.Model.prototype.toJSON.call(this),{nice_size:this.nice_size()})},get:function(e){return"nice_size"===e?this.nice_size():o.Model.prototype.get.apply(this,arguments)},ownedByCurrUser:function(){return!(!Galaxy||!Galaxy.user)&&(!Galaxy.user.isAnonymous()&&Galaxy.user.id===this.get("user_id"))},numOfUnfinishedJobs:function(){var e=this.get("non_ready_jobs");return e?e.length:0},numOfUnfinishedShownContents:function(){return this.contents.runningAndActive().length||0},_fetchContentRelatedAttributes:function(){var e=["size","non_ready_jobs","contents_active","hid_counter"];return this.fetch({data:l.param({keys:e.join(",")})})},refresh:function(e){e=e||{};var t=this,i=t.lastUpdateTime;this.contents.allFetched=!1;var n=0!==t.contents.currentPage?function(){return t.contents.fetchPage(0)}:function(){return t.contents.fetchUpdated(i)};return n().done(function(i,n,s){var o;try{o=new Date(s.getResponseHeader("Date"))}catch(a){}t.lastUpdateTime=o||new Date,t.checkForUpdates(e)})},checkForUpdates:function(e){function t(){n.clearUpdateTimeout(),n.updateTimeoutId=setTimeout(function(){n.refresh(e)},i)}e=e||{};var i=this.UPDATE_DELAY,n=this;if(n.id){var s=this.numOfUnfinishedShownContents();s>0?t():n._fetchContentRelatedAttributes().done(function(e){n.numOfUnfinishedJobs()>0?t():n.trigger("ready")})}},clearUpdateTimeout:function(){this.updateTimeoutId&&(clearTimeout(this.updateTimeoutId),this.updateTimeoutId=null)},parse:function(e,t){var i=o.Model.prototype.parse.call(this,e,t);return i.create_time&&(i.create_time=new Date(i.create_time)),i.update_time&&(i.update_time=new Date(i.update_time)),i},fetchWithContents:function(e,t){e=e||{};var i=this;return e.view="dev-detailed",this.fetch(e).then(function(e){return i.contents.history=i,i.contents.setHistoryId(e.id),i.fetchContents(t)})},fetchContents:function(e){e=e||{};var t=this;return t.lastUpdateTime=new Date,t.contents.fetchCurrentPage(e)},_delete:function(e){return this.get("deleted")?a.when():this.save({deleted:!0},e)},purge:function(e){return this.get("purged")?a.when():this.save({deleted:!0,purged:!0},e)},undelete:function(e){return this.get("deleted")?this.save({deleted:!1},e):a.when()},copy:function(e,t,i){if(e=void 0===e||e,!this.id)throw new Error("You must set the history ID before copying it.");var n={history_id:this.id};e&&(n.current=!0),t&&(n.name=t),i||(n.all_datasets=!1),n.view="dev-detailed";var s=this,o=a.post(this.urlRoot,n);return e?o.then(function(e){var t=new d(e);return t.setAsCurrent().done(function(){s.trigger("copied",s,e)})}):o.done(function(e){s.trigger("copied",s,e)})},setAsCurrent:function(){var e=this,t=a.getJSON(Galaxy.root+"history/set_as_current?id="+this.id);return t.done(function(){e.trigger("set-as-current",e)}),t},toString:function(){return"History("+this.get("id")+","+this.get("name")+")"}})),h=i.InfinitelyScrollingCollection,u=h.extend(s.LoggableMixin).extend({_logNamespace:"history",model:d,order:"update_time",limitOnFirstFetch:10,limitPerFetch:10,initialize:function(e,t){t=t||{},this.log("HistoryCollection.initialize",e,t),h.prototype.initialize.call(this,e,t),this.includeDeleted=t.includeDeleted||!1,this.currentHistoryId=t.currentHistoryId,this.setUpListeners()},urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot},setUpListeners:function(){return this.on({"change:deleted":function(e){this.debug("change:deleted",this.includeDeleted,e.get("deleted")),!this.includeDeleted&&e.get("deleted")&&this.remove(e)},copied:function(e,t){this.setCurrent(new d(t,[]))},"set-as-current":function(e){var t=this.currentHistoryId;this.trigger("no-longer-current",t),this.currentHistoryId=e.id}})},_buildFetchData:function(e){return r.extend(h.prototype._buildFetchData.call(this,e),{view:"dev-detailed"})},_buildFetchFilters:function(e){var t=h.prototype._buildFetchFilters.call(this,e)||{},i={};return this.includeDeleted?i.deleted=null:(i.deleted=!1,i.purged=!1),r.defaults(t,i)},fetchFirst:function(e){var t=this,i=l.when();return this.currentHistoryId&&(i=h.prototype.fetchFirst.call(t,{silent:!0,limit:1,filters:{purged:"",deleted:"","encoded_id-in":this.currentHistoryId}})),i.then(function(){return e=e||{},e.offset=0,t.fetchMore(e)})},comparators:r.extend(r.clone(h.prototype.comparators),{name:s.buildComparator("name",{ascending:!0}),"name-dsc":s.buildComparator("name",{ascending:!1}),size:s.buildComparator("size",{ascending:!1}),"size-asc":s.buildComparator("size",{ascending:!0})}),sort:function(e){e=e||{};var t=e.silent,i=this.remove(this.get(this.currentHistoryId));return h.prototype.sort.call(this,r.defaults({silent:!0},e)),this.unshift(i,{silent:!0}),t||this.trigger("sort",this,e),this},create:function(e,t,i,n){var s=this,o=a.getJSON(Galaxy.root+"history/create_new_current");return o.done(function(e){s.setCurrent(new d(e,[],i||{}))})},setCurrent:function(e,t){return t=t||{},this.unshift(e,t),this.currentHistoryId=e.get("id"),t.silent||this.trigger("new-current",e,this),this},toString:function(){return"HistoryCollection("+this.length+",current:"+this.currentHistoryId+")"}});return{History:d,HistoryCollection:u}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(42),i(127),i(6),i(5),i(85)],s=function(e,t,i,n){"use strict";var s="list",l=o.View.extend(i.LoggableMixin).extend({_logNamespace:s,viewClass:e.ListItemView,collectionClass:o.Collection,tagName:"div",className:"list-panel",fxSpeed:"fast",emptyMsg:n("This list is empty"),noneFoundMsg:n("No matching items found"),searchPlaceholder:n("search"),initialize:function(e,t){e=e||{},e.logger&&(this.logger=e.logger),this.log(this+".initialize:",e),this.fxSpeed=a.has(e,"fxSpeed")?e.fxSpeed:this.fxSpeed,this.filters=[],this.searchFor=e.searchFor||"",this.selecting=void 0===e.selecting||e.selecting,this.selected=e.selected||[],this.lastSelected=null,this.dragItems=e.dragItems||!1,this.viewClass=e.viewClass||this.viewClass,this.views=[],this.collection=e.collection||this._createDefaultCollection(),this.filters=e.filters||[],this.$scrollContainer=e.$scrollContainer||this.$scrollContainer,this.title=e.title||"",this.subtitle=e.subtitle||"",this._setUpListeners()},_setUpListeners:function(){return this.off(),this.on({error:function(e,t,i,n,s){console.error(e,t,i,n,s)},loading:function(){this._showLoadingIndicator("loading...",40)},"loading-done":function(){this._hideLoadingIndicator(40)}}),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this._setUpCollectionListeners(),this._setUpViewListeners(),this},_createDefaultCollection:function(){return new this.collectionClass([])},_setUpCollectionListeners:function(){return this.log(this+"._setUpCollectionListeners",this.collection),this.stopListening(this.collection),this.listenTo(this.collection,{error:function(e,t,i,n,s){this.trigger("error",e,t,i,n,s)},update:function(e,t){var i=t.changes;return t.renderAll||i.added.length+i.removed.length>1?this.renderItems():1===i.added.length?this.addItemView(a.first(i.added),e,t):1===i.removed.length?this.removeItemView(a.first(i.removed),e,t):void 0}}),this},_setUpViewListeners:function(){this.log(this+"._setUpViewListeners"),this.on({"view:selected":function(e,t){if(t&&t.shiftKey&&this.lastSelected){var i=this.viewFromModelId(this.lastSelected);i&&this.selectRange(e,i)}else t&&t.altKey&&!this.selecting&&this.showSelectors();this.selected.push(e.model.id),this.lastSelected=e.model.id},"view:de-selected":function(e,t){this.selected=a.without(this.selected,e.model.id)}})},render:function(e){this.log(this+".render",e);var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){this.debug(this+"(ListPanel)._buildNewRender");var e=r(this.templates.el({},this));return this._renderControls(e),this._renderTitle(e),this._renderSubtitle(e),this._renderSearch(e),this.renderItems(e),e},_renderControls:function(e){this.debug(this+"(ListPanel)._renderControls");var t=r(this.templates.controls({},this));return e.find(".controls").replaceWith(t),t},_renderTitle:function(e){},_renderSubtitle:function(e){},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;i.log("_queueNewRender:",e,t),r(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",this.className).append(e.children()),this.selecting&&this.showSelectors(0),this},_setUpBehaviors:function(e){return e=e||this.$el,this.$controls(e).find("[title]").tooltip(),this._renderMultiselectActionMenu(e),this},_renderMultiselectActionMenu:function(e){e=e||this.$el;var t=e.find(".list-action-menu"),i=this.multiselectActions();if(!i.length)return t.empty();var s=r(['
    ','",'","
    "].join("")),o=i.map(function(e){var t=['
  • ',e.html,"
  • "].join("");return r(t).click(function(t){return t.preventDefault(),e.func(t)})});return s.find("ul").append(o),t.replaceWith(s),s},multiselectActions:function(){return[]},$scrollContainer:function(e){return(e||this.$el).parent().parent()},$controls:function(e){return(e||this.$el).find("> .controls")},$list:function(e){return(e||this.$el).find("> .list-items")},$messages:function(e){return(e||this.$el).find("> .controls .messages")},$emptyMessage:function(e){return(e||this.$el).find("> .empty-message")},renderItems:function(e){e=e||this.$el;var t=this;t.log(this+".renderItems",e);var i=t.$list(e);t.freeViews();var n=t._filterCollection();return t.views=n.map(function(e){var i=t._createItemView(e);return i}),i.empty(),t.views.length&&t._attachItems(e),t._renderEmptyMessage(e).toggle(!t.views.length),t.trigger("views:ready",t.views),t.views},_filterCollection:function(){var e=this;return e.collection.filter(a.bind(e._filterItem,e))},_filterItem:function(e){var t=this;return a.every(t.filters.map(function(t){return t.call(e)}))&&(!t.searchFor||e.matchesAll(t.searchFor))},_createItemView:function(e){var t=this._getItemViewClass(e),i=a.extend(this._getItemViewOptions(e),{model:e}),n=new t(i);return this._setUpItemViewListeners(n),n},_destroyItemView:function(e){this.stopListening(e),this.views=a.without(this.views,e)},_destroyItemViews:function(e){var t=this;return t.views.forEach(function(e){t.stopListening(e)}),t.views=[],t},freeViews:function(){return this._destroyItemViews()},_getItemViewClass:function(e){return this.viewClass},_getItemViewOptions:function(e){return{fxSpeed:this.fxSpeed,expanded:!1,selectable:this.selecting,selected:a.contains(this.selected,e.id),draggable:this.dragItems}},_setUpItemViewListeners:function(e){var t=this;return this.listenTo(e,"all",function(){var e=Array.prototype.slice.call(arguments,0);e[0]="view:"+e[0],t.trigger.apply(t,e)}),this.listenTo(e,"draggable:dragstart",function(e,t){var i={},n=this.getSelectedModels();i=n.length?n.toJSON():[t.model.toJSON()],e.dataTransfer.setData("text",JSON.stringify(i))},this),t},_attachItems:function(e){var t=this;return this.$list(e).append(this.views.map(function(e){return t._renderItemView$el(e)})),this},_renderItemView$el:function(e){return e.render(0).$el},_renderEmptyMessage:function(e){this.debug("_renderEmptyMessage",e,this.searchFor);var t=this.searchFor?this.noneFoundMsg:this.emptyMsg;return this.$emptyMessage(e).text(t)},expandAll:function(){a.each(this.views,function(e){e.expand()})},collapseAll:function(){a.each(this.views,function(e){e.collapse()})},addItemView:function(e,t,i){var n=this,s=n._filterCollection().indexOf(e);if(s!==-1){var o=n._createItemView(e);return r(o).queue("fx",[function(e){n.$emptyMessage().is(":visible")?n.$emptyMessage().fadeOut(n.fxSpeed,e):e()},function(e){n._attachView(o,s),e()}]),o}},_attachView:function(e,t,i){i=!!a.isUndefined(i)||i,t=t||0;var n=this;return n.views.splice(t,0,e),n._insertIntoListAt(t,n._renderItemView$el(e).hide()),n.trigger("view:attached",e),i?e.$el.slideDown(n.fxSpeed,function(){n.trigger("view:attached:rendered")}):(e.$el.show(),n.trigger("view:attached:rendered")),e},_insertIntoListAt:function(e,t){var i=this.$list();return 0===e?i.prepend(t):i.children().eq(e-1).after(t),t},removeItemView:function(e,t,i){var n=this,s=a.find(n.views,function(t){return t.model===e});if(s)return n.views=a.without(n.views,s),n.trigger("view:removed",s),r({}).queue("fx",[function(e){s.$el.fadeOut(n.fxSpeed,e)},function(e){s.remove(),n.trigger("view:removed:rendered"),n.views.length?e():n._renderEmptyMessage().fadeIn(n.fxSpeed,e)}]),s},viewFromModelId:function(e){return a.find(this.views,function(t){return t.model.id===e})},viewFromModel:function(e){return e?this.viewFromModelId(e.id):void 0},viewsWhereModel:function(e){return this.views.filter(function(t){return a.isMatch(t.model.attributes,e)})},viewRange:function(e,t){if(e===t)return e?[e]:[];var i=this.views.indexOf(e),n=this.views.indexOf(t);return i===-1||n===-1?i===n?[]:i===-1?[t]:[e]:i .controls .search-query");return i.val()!==e&&i.val(e),this},clearSearch:function(e){return this.searchFor="",this.trigger("search:clear",this),this.$("> .controls .search-query").val(""),this.renderItems(),this},THROTTLE_SELECTOR_FX_AT:20,showSelectors:function(e){e=void 0!==e?e:this.fxSpeed,this.selecting=!0,this.$(".list-actions").slideDown(e),e=this.views.length>=this.THROTTLE_SELECTOR_FX_AT?0:e,a.each(this.views,function(t){t.showSelector(e)})},hideSelectors:function(e){e=void 0!==e?e:this.fxSpeed,this.selecting=!1,this.$(".list-actions").slideUp(e),e=this.views.length>=this.THROTTLE_SELECTOR_FX_AT?0:e,a.each(this.views,function(t){t.hideSelector(e)}),this.selected=[],this.lastSelected=null},toggleSelectors:function(){this.selecting?this.hideSelectors():this.showSelectors()},selectAll:function(e){a.each(this.views,function(t){t.select(e)})},deselectAll:function(e){this.lastSelected=null,a.each(this.views,function(t){t.deselect(e)})},selectRange:function(e,t){var i=this.viewRange(e,t);return a.each(i,function(e){e.select()}),i},getSelectedViews:function(){return a.filter(this.views,function(e){return e.selected})},getSelectedModels:function(){return new this.collection.constructor(a.map(this.getSelectedViews(),function(e){return e.model}))},_showLoadingIndicator:function(e,i,n){this.debug("_showLoadingIndicator",this.indicator,e,i,n),i=void 0!==i?i:this.fxSpeed,this.indicator||(this.indicator=new t(this.$el),this.debug("\t created",this.indicator)),this.$el.is(":visible")?(this.$el.fadeOut(i),this.indicator.show(e,i,n)):this.indicator.show(0,n)},_hideLoadingIndicator:function(e,t){this.debug("_hideLoadingIndicator",this.indicator,e,t),e=void 0!==e?e:this.fxSpeed,this.indicator&&this.indicator.hide(e,t)},scrollPosition:function(){return this.$scrollContainer().scrollTop()},scrollTo:function(e,t){return t=t||0,this.$scrollContainer().animate({scrollTop:e},t),this},scrollToTop:function(e){return this.scrollTo(0,e)},scrollToItem:function(e,t){return e?this:this},scrollToId:function(e,t){return this.scrollToItem(this.viewFromModelId(e),t)},events:{"click .select-all":"selectAll","click .deselect-all":"deselectAll"},toString:function(){return"ListPanel("+this.collection+")"}});l.prototype.templates=function(){var e=i.wrapTemplate(["
    ",'
    ','
    ','
    ',"
    "]),t=i.wrapTemplate(['
    ','
    ','
    <%- view.title %>
    ',"
    ",'
    <%- view.subtitle %>
    ','
    ','
    ','",'
    ','
    ','",'","
    ",'
    ',"
    ","
    ","
    "]);return{el:e,controls:t}}();var c=l.extend({modelCollectionKey:"contents",initialize:function(e){l.prototype.initialize.call(this,e),this.selecting=void 0!==e.selecting&&e.selecting,this.setModel(this.model,e)},setModel:function(e,t){if(t=t||{},this.debug(this+".setModel:",e,t),this.freeModel(),this.freeViews(),e){var i=this.model?this.model.get("id"):null;this.model=e,this.logger&&(this.model.logger=this.logger),this._setUpModelListeners(),this.stopListening(this.collection),this.collection=this.model[this.modelCollectionKey]||t.collection||this._createDefaultCollection(),this._setUpCollectionListeners(),i&&e.get("id")!==i&&this.trigger("new-model",this)}return this},freeModel:function(){return this.model&&this.stopListening(this.model),this},_setUpModelListeners:function(){return this.log(this+"._setUpModelListeners",this.model),this.listenTo(this.model,"error",function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("error"),this.trigger.apply(this,e)},this),this.logger&&this.listenTo(this.model,"all",function(e){this.info(this+"(model)",e,arguments)}),this},_renderControls:function(e){this.debug(this+"(ModelListPanel)._renderControls");var t=this.model?this.model.toJSON():{},i=r(this.templates.controls(t,this));return e.find(".controls").replaceWith(i),i},toString:function(){return"ModelListPanel("+this.model+")"}});return c.prototype.templates=function(){var e=i.wrapTemplate(['
    ','
    ','
    <%- model.name %>
    ',"
    ",'
    <%- view.subtitle %>
    ','
    ','
    ','",'
    ','
    ','",'","
    ",'
    ',"
    ","
    ","
    "]);return a.extend(a.clone(l.prototype.templates),{controls:e})}(),{ListPanel:l,ModelListPanel:c}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2),i(1))},function(e,t,i){var n,s;(function(o,a){n=[i(6),i(5)],s=function(e,t){var i=o.View.extend(e.LoggableMixin).extend(e.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"tags-display",initialize:function(e){this.listenTo(this.model,"change:tags",function(){this.render()}),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.$el.html(this._template()),this.$input().select2({placeholder:"Add tags",width:"100%",tags:function(){return e._getTagsUsed()}}),this._setUpBehaviors(),this},_template:function(){return['",''].join("")},tagsToCSV:function(){var e=this.model.get("tags");return!a.isArray(e)||a.isEmpty(e)?"":e.map(function(e){return a.escape(e)}).sort().join(",")},$input:function(){return this.$el.find("input.tags-input")},_getTagsUsed:function(){return Galaxy.user.get("tags_used")},_setUpBehaviors:function(){var e=this;this.$input().on("change",function(t){e.model.save({tags:t.val},{silent:!0}),t.added&&e._addNewTagToTagsUsed(t.added.text+"")})},_addNewTagToTagsUsed:function(e){var t=Galaxy.user.get("tags_used");a.contains(t,e)||(t.push(e),t.sort(),Galaxy.user.set("tags_used",t))},remove:function(){this.$input.off(),this.stopListening(this.model),o.View.prototype.remove.call(this)},toString:function(){return["TagsEditor(",this.model+"",")"].join("")}});return{TagsEditor:i}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(2))},function(e,t,i){var n,s;(function(o,a){n=[i(5)],s=function(e){"use strict";function t(t,i,n){return Galaxy.modal.show({title:i,body:t,closing_events:!0,buttons:{Ok:function(){Galaxy.modal.hide()}}}),Galaxy.modal.$el.addClass("error-modal"),n&&(Galaxy.modal.$(".error-details").add(Galaxy.modal.$('button:contains("Details")')).remove(),o("
    ").addClass("error-details").hide().appendTo(Galaxy.modal.$(".modal-content")).append([o("

    ").text(h),o("

    ").text(JSON.stringify(n,null,"  "))]),o('").appendTo(Galaxy.modal.$(".buttons")).click(function(){Galaxy.modal.$(".error-details").toggle()})),Galaxy.modal}function i(i,n,s){if(i){if(i=e(i),n=e(n)||e("Error:"),window.Galaxy&&Galaxy.modal)return t(i,n,s);alert(n+"\n\n"+i),console.log("error details:",JSON.stringify(s))}}function n(){return i(e("You appear to be offline. Please check your connection and try again."),e("Offline?"))}function s(){return i(e("Galaxy is currently unreachable. Please try again in a few minutes.")+" "+c,e("Cannot connect to Galaxy"))}function r(t,n,s,o,a){o=o||d,o+=" "+c,a=a||e("An error occurred");var r=l(t,n,s);return i(o,a,r)}function l(e,t,i){return{raven:a.result(window.Raven,"lastEventId"),userAgent:navigator.userAgent,onLine:navigator.onLine,version:a.result(Galaxy.config,"version_major"),xhr:a.omit(t,a.functions(t)),options:a.omit(i,"xhr"),url:a.result(Galaxy.lastAjax,"url"),data:a.result(Galaxy.lastAjax,"data"),model:a.result(e,"toJSON",e+""),user:a.omit(a.result(Galaxy.user,"toJSON"),"email")}}var c=e("Please contact a Galaxy administrator if the problem persists."),d=e("An error occurred while updating information with the server."),h=e("The following information can assist the developers in finding the source of the error:");return{errorModal:i,offlineErrorModal:n,badGatewayErrorModal:s,ajaxErrorModal:r}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(1),i(2))},function(e,t,i){var n,s;(function(i,o,a,r){n=[],s=function(){var e=i.View.extend({initialize:function(e,t){this.$button=e,this.$button.length||(this.$button=o("
    ")),this.options=t||[],this.$button.data("popupmenu",this);var i=this;this.$button.click(function(e){return o(".popmenu-wrapper").remove(),i._renderAndShow(e),!1})},_renderAndShow:function(e){this.render(),this.$el.appendTo("body").css(this._getShownPosition(e)).show(),this._setUpCloseBehavior()},render:function(){if(this.$el.addClass("popmenu-wrapper").hide().css({position:"absolute"}).html(this.template(this.$button.attr("id"),this.options)), -this.options.length){var e=this;this.$el.find("li").each(function(t,i){var n=e.options[t];n.func&&o(this).children("a.popupmenu-option").click(function(t){n.func.call(e,t,n),t.preventDefault()})})}return this},template:function(e,t){return['"].join("")},_templateOptions:function(e){return e.length?a.map(e,function(e){if(e.divider)return'
  • ';if(e.header)return['
  • ',e.html,"
  • "].join("");var t=e.href||"javascript:void(0);",i=e.target?' target="'+e.target+'"':"",n=e.checked?'':"";return['
  • ",n,e.html,"
  • "].join("")}).join(""):"
  • (no options)
  • "},_getShownPosition:function(e){var t=this.$el.width(),i=e.pageX-t/2;return i=Math.min(i,o(document).scrollLeft()+o(window).width()-t-5),i=Math.max(i,o(document).scrollLeft()+5),{top:e.pageY,left:i}},_setUpCloseBehavior:function(){function e(e){if(o(document).off("click.close_popup"),window&&window.parent!==window)try{o(window.parent.document).off("click.close_popup")}catch(i){}else try{o("iframe#galaxy_main").contents().off("click.close_popup")}catch(i){}t.remove()}var t=this;if(o("html").one("click.close_popup",e),window&&window.parent!==window)try{o(window.parent.document).find("html").one("click.close_popup",e)}catch(i){}else try{o("iframe#galaxy_main").contents().one("click.close_popup",e)}catch(i){}},addItem:function(e,t){return t=t>=0?t:this.options.length,this.options.splice(t,0,e),this},removeItem:function(e){return e>=0&&this.options.splice(e,1),this},findIndexByHtml:function(e){for(var t=0;t0){this.$(".upload-ftp-content").html(a(this._templateTable()));var i=0;for(index in t)this.rows.push(this._add(t[index])),i+=t[index].size;if(this.$(".upload-ftp-number").html(t.length+" files"),this.$(".upload-ftp-disk").html(e.bytesToString(i,!0)),this.collection){var n=this;this.$("._has_collection").show(),this.$select_all=this.$(".upload-selectall").addClass(this.options.class_add),this.$select_all.on("click",function(){var e=n.$select_all.hasClass(n.options.class_add);for(index in t){var i=t[index],s=n._find(i);(!s&&e||s&&!e)&&n.rows[index].trigger("click")}}),this._refresh()}}else this.$(".upload-ftp-content").html(a(this._templateInfo()));this.$(".upload-ftp-wait").hide()},_add:function(e){var t=this,i=a(this._templateRow(e)),n=i.find(".icon");return this.$("tbody").append(i),this.collection?(n.addClass(this._find(e)?this.options.class_remove:this.options.class_add),i.on("click",function(){var i=t._find(e);n.removeClass(),i?(t.options.onremove(i),n.addClass(t.options.class_add)):(t.options.onadd(e),n.addClass(t.options.class_remove)),t._refresh()})):i.on("click",function(){t.options.onchange(e)}),i},_refresh:function(){var e=this.collection.where({file_mode:"ftp",enabled:!0});this.$select_all.removeClass(),0==e.length?this.$select_all.addClass(this.options.class_add):this.$select_all.addClass(e.length==this.rows.length?this.options.class_remove:this.options.class_partial)},_find:function(e){var t=this.collection.findWhere({file_path:e.path,file_mode:"ftp",enabled:!0});return t&&t.get("id")},_templateRow:function(t){return'
    '+t.path+''+e.bytesToString(t.size)+''+t.ctime+""},_templateTable:function(){return'Available files:   
    NameSizeCreated
    '},_templateInfo:function(){return'
    Your FTP directory does not contain any files.
    '},_template:function(){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).
    '}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4)],s=function(e){return o.View.extend({options:{class_check:"fa-check-square-o",class_uncheck:"fa-square-o",parameters:[{id:"space_to_tab",title:"Convert spaces to tabs"},{id:"to_posix_lines",title:"Use POSIX standard"}]},initialize:function(e){this.model=e.model,this.setElement(a("
    ").addClass("upload-settings")),this.$el.append(a("
    ").addClass("upload-settings-cover")),this.$el.append(a("").addClass("upload-settings-table ui-table-striped").append("")),this.$cover=this.$(".upload-settings-cover"),this.$table=this.$(".upload-settings-table > tbody"),this.listenTo(this.model,"change",this.render,this),this.model.trigger("change")},render:function(){var e=this;this.$table.empty(),r.each(this.options.parameters,function(t){var i=a("
    ").addClass("upload-"+t.id+" upload-icon-button fa").addClass(e.model.get(t.id)&&e.options.class_check||e.options.class_uncheck).on("click",function(){e.model.get("enabled")&&e.model.set(t.id,!e.model.get(t.id))});e.$table.append(a("
    ").append(a(""},_templateTable:function(){return'Available files:   
    ").append(i)).append(a("").append(t.title)))}),this.$cover[this.model.get("enabled")&&"hide"||"show"]()}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},,,function(e,t,i){var n,s,o;(function(i,a){!function(i){s=[],n=i,o="function"==typeof n?n.apply(t,s):n,!(void 0!==o&&(e.exports=o))}(function(){i.fn.extend({hoverhighlight:function(e,t){return e=e||"body",this.length?(a(this).each(function(){var i=a(this),n=i.data("target");n&&i.mouseover(function(i){a(n,e).css({background:t})}).mouseout(function(e){a(n).css({background:""})})}),this):this}})})}).call(t,i(1),i(1))},function(e,t,i){var n,s,o;(function(i,a){!function(i){s=[],n=i,o="function"==typeof n?n.apply(t,s):n,!(void 0!==o&&(e.exports=o))}(function(){function e(e,n){function s(e){var t=i(this).parent().children("input");t.val("").trigger("searchInput.clear").blur(),n.onclear()}function o(e,t){return t?(i(this).trigger("search.search",t),void("function"==typeof n.onfirstsearch&&g?(g=!1,n.onfirstsearch(t)):n.onsearch(t))):s()}function r(){return['"].join("")}function l(){return i(r()).focus(function(e){i(this).select()}).keyup(function(e){if(e.preventDefault(),e.stopPropagation(),e.which===u&&n.escWillClear)s.call(this,e);else{var t=i(this).val();(e.which===p||n.minSearchLen&&t.length>=n.minSearchLen)&&o.call(this,e,t)}}).val(n.initialVal)}function c(){return i([''].join("")).tooltip({placement:"bottom"}).click(function(e){s.call(this,e)})}function d(){return i([''].join("")).hide().tooltip({placement:"bottom"})}function h(){f.find(".search-loading").toggle(),f.find(".search-clear").toggle()}var u=27,p=13,f=i(e),g=!0,m={initialVal:"",name:"search",placeholder:"search",classes:"",onclear:function(){},onfirstsearch:null,onsearch:function(e){},minSearchLen:0,escWillClear:!0,oninit:function(){}};return"string"===a.type(n)?("toggle-loading"===n&&h(),f):("object"===a.type(n)&&(n=a.extend(!0,{},m,n)),f.addClass("search-input").prepend([l(),c(),d()]))}var t=window._l||function(e){return e};a.fn.extend({searchInput:function(t){return this.each(function(){return e(this,t)})}})})}).call(t,i(1),i(1))},,function(e,t,i){var n,s;n=[],s=function(){function e(e,t){var i=/(-?[0-9\.]+)/g,n=e.toString().toLowerCase()||"",s=t.toString().toLowerCase()||"",o=String.fromCharCode(0),a=n.replace(i,o+"$1"+o).split(o),r=s.replace(i,o+"$1"+o).split(o),l=new Date(n).getTime(),c=l?new Date(s).getTime():null;if(c){if(lc)return 1}for(var d,h,u=0,p=Math.max(a.length,r.length);uh)return 1}return 0}return e}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){(function(e,t){!function(i){e.event.props.push("dataTransfer"),i.uploadpost=function(t){var n=i.extend({},{data:{},success:function(){},error:function(){},progress:function(){},url:null,maxfilesize:2048,error_filesize:"File exceeds 2GB. Please use a FTP client.",error_default:"Please make sure the file is available.",error_server:"Upload request failed.",error_login:"Uploads require you to log in."},t),s=n.data;if(s.error_message)return void n.error(s.error_message);var o=new FormData;for(var a in s.payload)o.append(a,s.payload[a]);var r=0;for(var a in s.files){var l=s.files[a];o.append(l.name,l.file,l.file.name),r+=l.file.size}return r>1048576*n.maxfilesize?void n.error(n.error_filesize):(xhr=new XMLHttpRequest,xhr.open("POST",n.url,!0),xhr.setRequestHeader("Accept","application/json"),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.onreadystatechange=function(){if(xhr.readyState==xhr.DONE){var t=null;if(xhr.responseText)try{t=e.parseJSON(xhr.responseText)}catch(i){t=xhr.responseText}if(xhr.status<200||xhr.status>299){var s=xhr.statusText;403==xhr.status?s=n.error_login:0==xhr.status?s=n.error_server:s||(s=n.error_default),n.error(s+" ("+xhr.status+")")}else n.success(t)}},xhr.upload.addEventListener("progress",function(e){e.lengthComputable&&n.progress(Math.round(100*e.loaded/e.total))},!1),Galaxy.emit.debug("uploadbox::uploadpost()","Posting following data.",n),void xhr.send(o))},i.fn.uploadinput=function(e){var t=this,n=i.extend({},{ondragover:function(){},ondragleave:function(){},onchange:function(){},multiple:!1},e),s=i('");return t.append(s.change(function(e){n.onchange(e.target.files),i(this).val("")})),t.on("drop",function(e){n.ondragleave(e),e.dataTransfer&&(n.onchange(e.dataTransfer.files),e.preventDefault())}),t.on("dragover",function(e){e.preventDefault(),n.ondragover(e)}),t.on("dragleave",function(e){e.stopPropagation(),n.ondragleave(e)}),{dialog:function(){s.trigger("click")}}},i.fn.uploadbox=function(e){function n(e){if(e&&e.length&&!m){var i=f;return t.each(e,function(e,i){"new"!==e.mode&&t.filter(p,function(t){return t.name===e.name&&t.size===e.size}).length&&(e.duplicate=!0)}),t.each(e,function(e){if(!e.duplicate){var t=String(f++);p[t]=e,u.announce(t,p[t]),g++}}),i}}function s(e){p[e]&&(delete p[e],g--)}function o(){if(0==g||v)return v=!1,m=!1,void u.complete();m=!0;var e=-1;for(var t in p){e=t;break}p[e];s(e),i.uploadpost({url:u.url,data:u.initialize(e),success:function(t){u.success(e,t),o()},error:function(t){u.error(e,t),o()},progress:function(t){u.progress(e,t)}})}function a(){_.dialog()}function r(e){for(e in p)s(e)}function l(){m||(m=!0,o())}function c(){v=!0}function d(e){return u=i.extend({},u,e)}function h(){return window.File&&window.FormData&&window.XMLHttpRequest&&window.FileList}var u=i.extend({},{dragover:function(){},dragleave:function(){},announce:function(e){},initialize:function(e){},progress:function(e,t){},success:function(e,t){},error:function(e,t){alert(t)},complete:function(){}},e),p={},f=0,g=0,m=!1,v=!1,_=i(this).uploadinput({multiple:!0,onchange:function(e){n(e)},ondragover:e.ondragover,ondragleave:e.ondragleave});return{select:a,add:n,remove:s,start:l,stop:c,reset:r,configure:d,compatible:h}}}(e)}).call(t,i(1),i(2))},function(e,t,i){(function(t){var n=i(10).RightPanel,s=(i(7),i(116));CurrentHistoryView=i(113).CurrentHistoryView,_l=i(5);var o=n.extend({title:_l("History"),initialize:function(e){n.prototype.initialize.call(this,e),this.options=t.pick(e,"userIsAnonymous","allow_user_dataset_purge","galaxyRoot"),this.historyView=new CurrentHistoryView({className:CurrentHistoryView.prototype.className+" middle",purgeAllowed:e.allow_user_dataset_purge,linkTarget:"galaxy_main"})},$toggleButton:function(){return this.$(".footer > .panel-collapse")},render:function(){n.prototype.render.call(this),this.optionsMenu=s(this.$("#history-options-button"),{anonymous:this.options.userIsAnonymous,purgeAllowed:this.options.allow_user_dataset_purge,root:this.options.galaxyRoot}),this.$("> .header .buttons [title]").tooltip({placement:"bottom"}),this.historyView.setElement(this.$(".history-panel")),this.$el.attr("class","history-right-panel")},_templateHeader:function(e){var i=this.options.galaxyRoot+"history",n=this.options.galaxyRoot+"history/view_multiple";return['
    ','
    ','','',this.options.userIsAnonymous?"":[''].join(""),"
    ",'
    ',t.escape(this.title),"
    ","
    "].join("")},_templateBody:function(e){return['
    '].join("")},_templateFooter:function(e){return['
    '+t.path+''+e.bytesToString(t.size)+''+t.ctime+"
    NameSizeCreated
    '},_templateInfo:function(){return'
    Your FTP directory does not contain any files.
    '},_template:function(){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).
    '}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1))},function(e,t,i){var n,s;(function(o,a,r){n=[i(4)],s=function(e){return o.View.extend({options:{class_check:"fa-check-square-o",class_uncheck:"fa-square-o",parameters:[{id:"space_to_tab",title:"Convert spaces to tabs"},{id:"to_posix_lines",title:"Use POSIX standard"}]},initialize:function(e){this.model=e.model,this.setElement(a("
    ").addClass("upload-settings")),this.$el.append(a("
    ").addClass("upload-settings-cover")),this.$el.append(a("").addClass("upload-settings-table ui-table-striped").append("")),this.$cover=this.$(".upload-settings-cover"),this.$table=this.$(".upload-settings-table > tbody"),this.listenTo(this.model,"change",this.render,this),this.model.trigger("change")},render:function(){var e=this;this.$table.empty(),r.each(this.options.parameters,function(t){var i=a("
    ").addClass("upload-"+t.id+" upload-icon-button fa").addClass(e.model.get(t.id)&&e.options.class_check||e.options.class_uncheck).on("click",function(){e.model.get("enabled")&&e.model.set(t.id,!e.model.get(t.id))});e.$table.append(a("
    ").append(a("');\n\t wrapper.append($el);\n\t this.row.append(wrapper);\n\t },\n\t \n\t // header\n\t appendHeader: function() {\n\t // append header row\n\t this.$thead.append(this.row);\n\t\n\t // row\n\t this.row = $('');\n\t },\n\t \n\t // add row cell\n\t add: function($el, width, align) {\n\t var wrapper = $('');\n\t if (width) {\n\t wrapper.css('width', width);\n\t }\n\t if (align) {\n\t wrapper.css('text-align', align);\n\t }\n\t wrapper.append($el);\n\t this.row.append(wrapper);\n\t },\n\t \n\t // append\n\t append: function(id, fade) {\n\t this._commit(id, fade, false);\n\t },\n\t \n\t // prepend\n\t prepend: function(id, fade) {\n\t this._commit(id, fade, true);\n\t },\n\t \n\t // get element\n\t get: function(id) {\n\t return this.$el.find('#' + id);\n\t },\n\t \n\t // delete\n\t del: function(id) {\n\t var item = this.$tbody.find('#' + id);\n\t if (item.length > 0) {\n\t item.remove();\n\t this.row_count--;\n\t this._refresh();\n\t }\n\t },\n\t\n\t // delete all\n\t delAll: function() {\n\t this.$tbody.empty();\n\t this.row_count = 0;\n\t this._refresh();\n\t },\n\t \n\t // value\n\t value: function(new_value) {\n\t // get current id/value\n\t this.before = this.$tbody.find('.current').attr('id');\n\t \n\t // check if new_value is defined\n\t if (new_value !== undefined) {\n\t this.$tbody.find('tr').removeClass('current');\n\t if (new_value) {\n\t this.$tbody.find('#' + new_value).addClass('current');\n\t }\n\t }\n\t \n\t // get current id/value\n\t var after = this.$tbody.find('.current').attr('id');\n\t if(after === undefined) {\n\t return null;\n\t } else {\n\t // fire onchange\n\t if (after != this.before && this.options.onchange) {\n\t this.options.onchange(new_value);\n\t }\n\t \n\t // return current value\n\t return after;\n\t }\n\t },\n\t \n\t // size\n\t size: function() {\n\t return this.$tbody.find('tr').length;\n\t },\n\t \n\t // commit\n\t _commit: function(id, fade, prepend) {\n\t // remove previous item with same id\n\t this.del(id);\n\t \n\t // add\n\t this.row.attr('id', id);\n\t \n\t // add row\n\t if (prepend) {\n\t this.$tbody.prepend(this.row);\n\t } else {\n\t this.$tbody.append(this.row);\n\t }\n\t \n\t // fade mode\n\t if (fade) {\n\t this.row.hide();\n\t this.row.fadeIn();\n\t }\n\t \n\t // row\n\t this.row = this._row();\n\t \n\t // row count\n\t this.row_count++;\n\t this._refresh();\n\t },\n\t \n\t // create new row\n\t _row: function() {\n\t return $('');\n\t },\n\t \n\t // onclick\n\t _onclick: function(e) {\n\t // get values\n\t var old_value = this.value();\n\t var new_value = $(e.target).closest('tr').attr('id');\n\t if (new_value != ''){\n\t // check equality\n\t if (new_value && old_value != new_value) {\n\t if (this.options.onconfirm) {\n\t this.options.onconfirm(new_value);\n\t } else {\n\t this.value(new_value);\n\t }\n\t }\n\t }\n\t },\n\t\n\t // ondblclick\n\t _ondblclick: function(e) {\n\t var value = this.value();\n\t if (value && this.options.ondblclick) {\n\t this.options.ondblclick(value);\n\t }\n\t },\n\t \n\t // refresh\n\t _refresh: function() {\n\t if (this.row_count == 0) {\n\t this.$tmessage.show();\n\t } else {\n\t this.$tmessage.hide();\n\t }\n\t },\n\t \n\t // load html template\n\t _template: function(options) {\n\t return '
    ' +\n\t '
    ").append(i)).append(a("").append(t.title)))}),this.$cover[this.model.get("enabled")&&"hide"||"show"]()}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2))},,,function(e,t,i){var n,s,o;(function(i,a){!function(i){s=[],n=i,o="function"==typeof n?n.apply(t,s):n,!(void 0!==o&&(e.exports=o))}(function(){i.fn.extend({hoverhighlight:function(e,t){return e=e||"body",this.length?(a(this).each(function(){var i=a(this),n=i.data("target");n&&i.mouseover(function(i){a(n,e).css({background:t})}).mouseout(function(e){a(n).css({background:""})})}),this):this}})})}).call(t,i(1),i(1))},function(e,t,i){var n,s,o;(function(i,a){!function(i){s=[],n=i,o="function"==typeof n?n.apply(t,s):n,!(void 0!==o&&(e.exports=o))}(function(){function e(e,n){function s(e){var t=i(this).parent().children("input");t.val("").trigger("searchInput.clear").blur(),n.onclear()}function o(e,t){return t?(i(this).trigger("search.search",t),void("function"==typeof n.onfirstsearch&&f?(f=!1,n.onfirstsearch(t)):n.onsearch(t))):s()}function r(){return['"].join("")}function l(){return i(r()).focus(function(e){i(this).select()}).keyup(function(e){if(e.preventDefault(),e.stopPropagation(),e.which===u&&n.escWillClear)s.call(this,e);else{var t=i(this).val();(e.which===p||n.minSearchLen&&t.length>=n.minSearchLen)&&o.call(this,e,t)}}).val(n.initialVal)}function c(){return i([''].join("")).tooltip({placement:"bottom"}).click(function(e){s.call(this,e)})}function d(){return i([''].join("")).hide().tooltip({placement:"bottom"})}function h(){g.find(".search-loading").toggle(),g.find(".search-clear").toggle()}var u=27,p=13,g=i(e),f=!0,m={initialVal:"",name:"search",placeholder:"search",classes:"",onclear:function(){},onfirstsearch:null,onsearch:function(e){},minSearchLen:0,escWillClear:!0,oninit:function(){}};return"string"===a.type(n)?("toggle-loading"===n&&h(),g):("object"===a.type(n)&&(n=a.extend(!0,{},m,n)),g.addClass("search-input").prepend([l(),c(),d()]))}var t=window._l||function(e){return e};a.fn.extend({searchInput:function(t){return this.each(function(){return e(this,t)})}})})}).call(t,i(1),i(1))},,function(e,t,i){var n,s;n=[],s=function(){function e(e,t){var i=/(-?[0-9\.]+)/g,n=e.toString().toLowerCase()||"",s=t.toString().toLowerCase()||"",o=String.fromCharCode(0),a=n.replace(i,o+"$1"+o).split(o),r=s.replace(i,o+"$1"+o).split(o),l=new Date(n).getTime(),c=l?new Date(s).getTime():null;if(c){if(lc)return 1}for(var d,h,u=0,p=Math.max(a.length,r.length);uh)return 1}return 0}return e}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){(function(e,t){!function(i){e.event.props.push("dataTransfer"),i.uploadpost=function(t){var n=i.extend({},{data:{},success:function(){},error:function(){},progress:function(){},url:null,maxfilesize:2048,error_filesize:"File exceeds 2GB. Please use a FTP client.",error_default:"Please make sure the file is available.",error_server:"Upload request failed.",error_login:"Uploads require you to log in."},t),s=n.data;if(s.error_message)return void n.error(s.error_message);var o=new FormData;for(var a in s.payload)o.append(a,s.payload[a]);var r=0;for(var a in s.files){var l=s.files[a];o.append(l.name,l.file,l.file.name),r+=l.file.size}return r>1048576*n.maxfilesize?void n.error(n.error_filesize):(xhr=new XMLHttpRequest,xhr.open("POST",n.url,!0),xhr.setRequestHeader("Accept","application/json"),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.onreadystatechange=function(){if(xhr.readyState==xhr.DONE){var t=null;if(xhr.responseText)try{t=e.parseJSON(xhr.responseText)}catch(i){t=xhr.responseText}if(xhr.status<200||xhr.status>299){var s=xhr.statusText;403==xhr.status?s=n.error_login:0==xhr.status?s=n.error_server:s||(s=n.error_default),n.error(s+" ("+xhr.status+")")}else n.success(t)}},xhr.upload.addEventListener("progress",function(e){e.lengthComputable&&n.progress(Math.round(100*e.loaded/e.total))},!1),Galaxy.emit.debug("uploadbox::uploadpost()","Posting following data.",n),void xhr.send(o))},i.fn.uploadinput=function(e){var t=this,n=i.extend({},{ondragover:function(){},ondragleave:function(){},onchange:function(){},multiple:!1},e),s=i('");return t.append(s.change(function(e){n.onchange(e.target.files),i(this).val("")})),t.on("drop",function(e){n.ondragleave(e),e.dataTransfer&&(n.onchange(e.dataTransfer.files),e.preventDefault())}),t.on("dragover",function(e){e.preventDefault(),n.ondragover(e)}),t.on("dragleave",function(e){e.stopPropagation(),n.ondragleave(e)}),{dialog:function(){s.trigger("click")}}},i.fn.uploadbox=function(e){function n(e){if(e&&e.length&&!m){var i=g;return t.each(e,function(e,i){"new"!==e.mode&&t.filter(p,function(t){return t.name===e.name&&t.size===e.size}).length&&(e.duplicate=!0)}),t.each(e,function(e){if(!e.duplicate){var t=String(g++);p[t]=e,u.announce(t,p[t]),f++}}),i}}function s(e){p[e]&&(delete p[e],f--)}function o(){if(0==f||v)return v=!1,m=!1,void u.complete();m=!0;var e=-1;for(var t in p){e=t;break}p[e];s(e),i.uploadpost({url:u.url,data:u.initialize(e),success:function(t){u.success(e,t),o()},error:function(t){u.error(e,t),o()},progress:function(t){u.progress(e,t)}})}function a(){_.dialog()}function r(e){for(e in p)s(e)}function l(){m||(m=!0,o())}function c(){v=!0}function d(e){return u=i.extend({},u,e)}function h(){return window.File&&window.FormData&&window.XMLHttpRequest&&window.FileList}var u=i.extend({},{dragover:function(){},dragleave:function(){},announce:function(e){},initialize:function(e){},progress:function(e,t){},success:function(e,t){},error:function(e,t){alert(t)},complete:function(){}},e),p={},g=0,f=0,m=!1,v=!1,_=i(this).uploadinput({multiple:!0,onchange:function(e){n(e)},ondragover:e.ondragover,ondragleave:e.ondragleave});return{select:a,add:n,remove:s,start:l,stop:c,reset:r,configure:d,compatible:h}}}(e)}).call(t,i(1),i(2))},function(e,t,i){(function(t){var n=i(10).RightPanel,s=(i(7),i(116));CurrentHistoryView=i(113).CurrentHistoryView,_l=i(5);var o=n.extend({title:_l("History"),initialize:function(e){n.prototype.initialize.call(this,e),this.options=t.pick(e,"userIsAnonymous","allow_user_dataset_purge","galaxyRoot"),this.historyView=new CurrentHistoryView({className:CurrentHistoryView.prototype.className+" middle",purgeAllowed:e.allow_user_dataset_purge,linkTarget:"galaxy_main"})},$toggleButton:function(){return this.$(".footer > .panel-collapse")},render:function(){n.prototype.render.call(this),this.optionsMenu=s(this.$("#history-options-button"),{anonymous:this.options.userIsAnonymous,purgeAllowed:this.options.allow_user_dataset_purge,root:this.options.galaxyRoot}),this.$("> .header .buttons [title]").tooltip({placement:"bottom"}),this.historyView.setElement(this.$(".history-panel")),this.$el.attr("class","history-right-panel")},_templateHeader:function(e){var i=this.options.galaxyRoot+"history",n=this.options.galaxyRoot+"history/view_multiple";return['
    ','
    ','','',this.options.userIsAnonymous?"":[''].join(""),"
    ",'
    ',t.escape(this.title),"
    ","
    "].join("")},_templateBody:function(e){return['
    '].join("")},_templateFooter:function(e){return['
    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\t '
    ',\n\t '
    '\n\t ].join( '' );\n\t }\n\t});\n\t\n\t//==============================================================================\n\treturn {\n\t CitationView : CitationView,\n\t CitationListView : CitationListView\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 29 */\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__ = [\n\t __webpack_require__(42),\n\t __webpack_require__(32),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_ITEM, DATASET_LI, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t//==============================================================================\n\tvar FoldoutListItemView = LIST_ITEM.FoldoutListItemView,\n\t ListItemView = LIST_ITEM.ListItemView;\n\t/** @class Read only view for DatasetCollection.\n\t */\n\tvar 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\tDCListItemView.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 ){ %>',\n\t '
    ',\n\t _l( 'There was an error getting the data for this collection' ), ': <%- model.error %>',\n\t '
    ',\n\t '<% } %>'\n\t ]),\n\t purged : BASE_MVC.wrapTemplate([\n\t '<% if( model.purged ){ %>',\n\t '
    ',\n\t _l( 'This collection has been deleted and removed from disk' ),\n\t '
    ',\n\t '<% } %>'\n\t ]),\n\t deleted : BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>',\n\t '
    ',\n\t _l( 'This collection has been deleted' ),\n\t '
    ',\n\t '<% } %>'\n\t ])\n\t });\n\t\n\t // use element identifier\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t '
    ',\n\t '
    ',\n\t '<%- collection.element_identifier || collection.name %>',\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ], 'collection' );\n\t\n\t // use element identifier\n\t var subtitleTemplate = BASE_MVC.wrapTemplate([\n\t '
    ',\n\t '<% var countText = collection.element_count? ( collection.element_count + \" \" ) : \"\"; %>',\n\t '<% if( collection.collection_type === \"list\" ){ %>',\n\t _l( 'a list of <%- countText %>datasets' ),\n\t '<% } else if( collection.collection_type === \"paired\" ){ %>',\n\t _l( 'a pair of datasets' ),\n\t '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n\t _l( 'a list of <%- countText %>dataset pairs' ),\n\t '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n\t _l( 'a list of <%- countText %>dataset lists' ),\n\t '<% } %>',\n\t '
    '\n\t ], '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//==============================================================================\n\t/** @class Read only view for DatasetCollectionElement.\n\t */\n\tvar 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 ){ this.logger = this.model.logger = attributes.logger; }\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\tDCEListItemView.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([\n\t '
    ',\n\t '
    ',\n\t '<%- element.element_identifier %>',\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ], 'element' );\n\t\n\t return _.extend( {}, ListItemView.prototype.templates, {\n\t titleBar : titleBarTemplate\n\t });\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\tvar 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 ){ this.logger = this.model.logger = attributes.logger; }\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\tDatasetDCEListItemView.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([\n\t '
    ',\n\t '',\n\t '
    ',\n\t '<%- element.element_identifier %>',\n\t '
    ',\n\t '
    '\n\t ], '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//==============================================================================\n\t/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 30 */\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__ = [\n\t __webpack_require__(70),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DATASET_MODEL, BASE_MVC, _l ){\n\t'use strict';\n\t\n\t//==============================================================================\n\t/*\n\tNotes:\n\t\n\tTerminology:\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\tThis 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\tMany of the classes and heirarchy are meant as extension points so, while the\n\trelations and flow may be difficult to understand initially, they'll allow us to\n\thandle the growth or flux dataset collection in the future (w/o actually implementing\n\tany 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\tvar 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\tvar DatasetCollectionElement = Backbone.Model\n\t .extend( BASE_MVC.LoggableMixin )\n\t .extend( DatasetCollectionElementMixin )\n\t .extend({ _logNamespace : 'collections' });\n\t\n\t\n\t//==============================================================================\n\t/** @class Base/Abstract Backbone collection for Generic DCEs. */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for a dataset collection element that is a dataset (HDA).\n\t */\n\tvar 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( {},\n\t DATASET_MODEL.DatasetAssociation.prototype.defaults,\n\t DatasetCollectionElementMixin.defaults\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//==============================================================================\n\t/** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n\t */\n\tvar 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\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\tvar DatasetCollection = Backbone.Model\n\t .extend( BASE_MVC.LoggableMixin )\n\t .extend( BASE_MVC.SearchableModelMixin )\n\t .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 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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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 : [\n\t 'name'\n\t ],\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//==============================================================================\n\t/** Model for a DatasetCollection containing datasets (non-nested).\n\t */\n\tvar 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(){ 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\tvar PairDatasetCollection = ListDatasetCollection.extend(\n\t/** @lends PairDatasetCollection.prototype */{\n\t\n\t /** String representation. */\n\t toString : function(){ 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\tvar 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//==============================================================================\n\t/** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone collection for a backbone collection containing paired dataset collections.\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for a list dataset collection within a list:list dataset collection. */\n\tvar 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//==============================================================================\n\t/** @class Backbone collection containing list dataset collections. */\n\tvar 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//==============================================================================\n\t/** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 31 */\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__ = [\n\t __webpack_require__(39),\n\t __webpack_require__(12),\n\t __webpack_require__(6),\n\t __webpack_require__(8),\n\t __webpack_require__(87),\n\t __webpack_require__(5),\n\t __webpack_require__(84)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( HDCA, STATES, BASE_MVC, UI_MODAL, naturalSort, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'collections';\n\t/*==============================================================================\n\tTODO:\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\tvar 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\n\t .attr( 'data-element-id', this.element.id )\n\t .attr( 'draggable', true )\n\t .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([\n\t '',\n\t '<%- element.name %>',\n\t '',\n\t '',\n\t ].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(',\n\t _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 ){ ev = ev.originalEvent; }\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// ============================================================================\n\t/** An interface for building collections.\n\t */\n\tvar ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).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(){ throw new TypeError( 'no creation fn for creator' ); },\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 /** 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._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 if( element.state !== STATES.OK ){\n\t if( _.contains( STATES.NOT_READY_STATES, element.state ) ){\n\t return _l( \"hasn't finished running yet\" );\n\t }\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\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() )\n\t .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 /** render the footer, completion controls, and cancel controls */\n\t _renderFooter : function( speed, callback ){\n\t var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );\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 /** 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 /** 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 _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 )\n\t .always( function(){\n\t creator.blocking = false;\n\t })\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 })\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.' ) +\n\t _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 'click .cancel-create' : function( ev ){\n\t if( typeof this.oncancel === 'function' ){\n\t this.oncancel.call( this );\n\t }\n\t },\n\t 'click .create-collection' : '_clickCreate'//,\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' )\n\t .attr( 'class', 'alert alert-dismissable' ).addClass( alertClass ).show()\n\t .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 // ........................................................................ 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 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 ){ ev = ev.originalEvent; }\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 // ........................................................................ 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 /** 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 // ------------------------------------------------------------------------ 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 : {\n\t /** the skeleton */\n\t main : _.template([\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ].join('')),\n\t\n\t /** the header (not including help text) */\n\t header : _.template([\n\t '
    ',\n\t '', _l( 'More help' ), '',\n\t '
    ',\n\t '', _l( 'Less' ), '',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '',\n\t '',\n\t '
    ',\n\t ].join('')),\n\t\n\t /** the middle: element list */\n\t middle : _.template([\n\t '',\n\t '
    ',\n\t '
    '\n\t ].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer : _.template([\n\t '
    ',\n\t '
    ',\n\t '',\n\t '
    ', _l( 'Name' ), ':
    ',\n\t '
    ',\n\t '
    ',\n\t\n\t '
    ',\n\t '
    ',\n\t '',\n\t '
    ',\n\t '',\n\t '',\n\t '
    ',\n\t '
    ',\n\t\n\t '
    ',\n\t '',\n\t '
    ',\n\t '
    '\n\t ].join('')),\n\t\n\t /** help content */\n\t helpContent : _.template([\n\t '

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

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

    ',\n\t '

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

    '\n\t ].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t invalidElements : _.template([\n\t _l( 'The following selections could not be included due to problems:' ),\n\t '
      <% _.each( problems, function( problem ){ %>',\n\t '
    • <%- problem.element.name %>: <%- problem.text %>
    • ',\n\t '<% }); %>
    '\n\t ].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t noElementsLeft : _.template([\n\t '
  • ',\n\t _l( 'No elements left! ' ),\n\t _l( 'Would you like to ' ), '', _l( 'start over' ), '?',\n\t '
  • '\n\t ].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([\n\t '
    ',\n\t '
    ',\n\t '',\n\t '<% if( _.size( problems ) ){ %>',\n\t _l( 'The following selections could not be included due to problems' ), ':',\n\t '
      <% _.each( problems, function( problem ){ %>',\n\t '
    • <%- problem.element.name %>: <%- problem.text %>
    • ',\n\t '<% }); %>
    ',\n\t '<% } else if( _.size( elements ) < 1 ){ %>',\n\t _l( 'No datasets were selected' ), '.',\n\t '<% } %>',\n\t '
    ',\n\t _l( 'At least one element is needed for the collection' ), '. ',\n\t _l( 'You may need to ' ),\n\t '', _l( 'cancel' ), ' ',\n\t _l( 'and reselect new elements' ), '.',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ].join('')),\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString : function(){ return 'ListCollectionCreator'; }\n\t});\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\tvar 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\tvar 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//==============================================================================\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\tfunction createListCollection( contents ){\n\t var elements = contents.toJSON(),\n\t promise = listCollectionCreatorModal( elements, {\n\t creationFn : function( elements, name ){\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 );\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 32 */\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__ = [\n\t __webpack_require__(42),\n\t __webpack_require__(12),\n\t __webpack_require__(22),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_ITEM, STATES, faIconButton, BASE_MVC, _l ){\n\t'use strict';\n\t\n\tvar logNamespace = 'dataset';\n\t/*==============================================================================\n\tTODO:\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\tvar _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\tvar 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 ){ this.logger = this.model.logger = attributes.logger; }\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, options ){\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\n\t && self.model.inReadyState()\n\t && self.expanded\n\t && !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 })\n\t .done( function(){ self.render(); });\n\t\n\t } else {\n\t self.render();\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 ){ callback.call( view ); }\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 )\n\t || ( state === STATES.DISCARDED )\n\t || ( !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\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() )\n\t .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() ){ return ''; }\n\t // render both old and new display apps using the same template\n\t return [\n\t this.templates.displayApplications( this.model.get( 'display_apps' ), this ),\n\t this.templates.displayApplications( this.model.get( 'display_types' ), this )\n\t ].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() ){ return null; }\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 $([\n\t '',\n\t '',\n\t ''\n\t ].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 $([\n\t '
    ',\n\t '',\n\t '',\n\t '',\n\t '',\n\t '
    '\n\t ].join( '\\n' ));\n\t },\n\t\n\t // ......................................................................... misc\n\t events : _.extend( _.clone( _super.prototype.events ), {\n\t 'click .display-btn' : function( ev ){ this.trigger( 'display', this, ev ); },\n\t 'click .params-btn' : function( ev ){ this.trigger( 'params', this, ev ); },\n\t 'click .download-btn' : function( ev ){ this.trigger( 'download', this, ev ); }\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\tDatasetListItemView.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\" ){ %>',\n\t '
    ',\n\t _l( 'An error occurred setting the metadata for this dataset' ),\n\t '
    ',\n\t '<% } %>'\n\t ]),\n\t error : BASE_MVC.wrapTemplate([\n\t // error during index fetch - show error on dataset\n\t '<% if( model.error ){ %>',\n\t '
    ',\n\t _l( 'There was an error getting the data for this dataset' ), ': <%- model.error %>',\n\t '
    ',\n\t '<% } %>'\n\t ]),\n\t purged : BASE_MVC.wrapTemplate([\n\t '<% if( model.purged ){ %>',\n\t '
    ',\n\t _l( 'This dataset has been deleted and removed from disk' ),\n\t '
    ',\n\t '<% } %>'\n\t ]),\n\t deleted : BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>',\n\t '
    ',\n\t _l( 'This dataset has been deleted' ),\n\t '
    ',\n\t '<% } %>'\n\t ])\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 '
    ',\n\t\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t\n\t // do not display tags, annotation, display apps, or peek when deleted\n\t '<% if( !dataset.deleted && !dataset.purged ){ %>',\n\t '
    ',\n\t '
    ',\n\t\n\t '
    ',\n\t\n\t '<% if( dataset.peek ){ %>',\n\t '
    <%= dataset.peek %>
    ',\n\t '<% } %>',\n\t '<% } %>',\n\t '
    '\n\t ], 'dataset' );\n\t\n\t var noAccessTemplate = BASE_MVC.wrapTemplate([\n\t '
    ',\n\t '
    ',\n\t _l( 'You do not have permission to view this dataset' ),\n\t '
    ',\n\t '
    '\n\t ], '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([\n\t '<% if( dataset.misc_blurb ){ %>',\n\t '
    ',\n\t '<%- dataset.misc_blurb %>',\n\t '
    ',\n\t '<% } %>',\n\t\n\t '<% if( dataset.file_ext ){ %>',\n\t '
    ',\n\t '',\n\t '<%- dataset.file_ext %>',\n\t '
    ',\n\t '<% } %>',\n\t\n\t '<% if( dataset.metadata_dbkey ){ %>',\n\t '
    ',\n\t '',\n\t '',\n\t '<%- dataset.metadata_dbkey %>',\n\t '',\n\t '
    ',\n\t '<% } %>',\n\t\n\t '<% if( dataset.misc_info ){ %>',\n\t '
    ',\n\t '<%- dataset.misc_info %>',\n\t '
    ',\n\t '<% } %>'\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.NEW ] = BASE_MVC.wrapTemplate([\n\t '
    ', _l( 'This is a new dataset and not all of its data are available yet' ), '
    '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.NOT_VIEWABLE ] = BASE_MVC.wrapTemplate([\n\t '
    ', _l( 'You do not have permission to view this dataset' ), '
    '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.DISCARDED ] = BASE_MVC.wrapTemplate([\n\t '
    ', _l( 'The job creating this dataset was cancelled before completion' ), '
    '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.QUEUED ] = BASE_MVC.wrapTemplate([\n\t '
    ', _l( 'This job is waiting to run' ), '
    '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.RUNNING ] = BASE_MVC.wrapTemplate([\n\t '
    ', _l( 'This job is currently running' ), '
    '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.UPLOAD ] = BASE_MVC.wrapTemplate([\n\t '
    ', _l( 'This dataset is currently uploading' ), '
    '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.SETTING_METADATA ] = BASE_MVC.wrapTemplate([\n\t '
    ', _l( 'Metadata is being auto-detected' ), '
    '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.PAUSED ] = BASE_MVC.wrapTemplate([\n\t '
    ', _l( 'This job is paused. Use the \"Resume Paused Jobs\" in the history menu to resume' ), '
    '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.ERROR ] = BASE_MVC.wrapTemplate([\n\t '<% if( !dataset.purged ){ %>',\n\t '
    <%- dataset.misc_blurb %>
    ',\n\t '<% } %>',\n\t '', _l( 'An error occurred with this dataset' ), ':',\n\t '
    <%- dataset.misc_info %>
    '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.EMPTY ] = BASE_MVC.wrapTemplate([\n\t '
    ', _l( 'No data' ), ': <%- dataset.misc_blurb %>
    '\n\t ], 'dataset' );\n\t summaryTemplates.unknown = BASE_MVC.wrapTemplate([\n\t '
    Error: unknown dataset state: \"<%- dataset.state %>\"
    '\n\t ], '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 ){ %>',\n\t '
    ',\n\t _l( 'The job creating this dataset has been resubmitted' ),\n\t '
    ',\n\t '<% } %>'\n\t ])\n\t };\n\t\n\t // this is applied to both old and new style display apps\n\t var displayApplicationsTemplate = BASE_MVC.wrapTemplate([\n\t '<% _.each( apps, function( app ){ %>',\n\t '
    ',\n\t '<%- app.label %> ',\n\t '',\n\t '<% _.each( app.links, function( link ){ %>',\n\t '\" href=\"<%- link.href %>\">',\n\t '<% print( _l( link.text ) ); %>',\n\t ' ',\n\t '<% }); %>',\n\t '',\n\t '
    ',\n\t '<% }); %>'\n\t ], '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// ============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/* This class maps the form dom to an api compatible javascript dictionary. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils ) {\n\t var Manager = Backbone.Model.extend({\n\t initialize: function( app ) {\n\t this.app = app;\n\t },\n\t\n\t /** Creates a checksum. */\n\t checksum: function() {\n\t var sum = '';\n\t var self = this;\n\t this.app.section.$el.find( '.section-row' ).each( function() {\n\t var id = $(this).attr( 'id' );\n\t var field = self.app.field_list[ id ];\n\t if ( field ) {\n\t sum += id + ':' + JSON.stringify( field.value && field.value() ) + ':' + field.collapsed + ';';\n\t }\n\t });\n\t return sum;\n\t },\n\t\n\t /** Convert dom into a dictionary of flat id/value pairs used e.g. on job submission. */\n\t create: function() {\n\t var self = this;\n\t\n\t // get raw dictionary from dom\n\t var dict = {};\n\t this._iterate( this.app.section.$el, dict );\n\t\n\t // add to result dictionary, label elements\n\t var result_dict = {};\n\t this.flat_dict = {};\n\t function add( flat_id, input_id, input_value ) {\n\t self.flat_dict[ flat_id ] = input_id;\n\t result_dict[ flat_id ] = input_value;\n\t self.app.element_list[ input_id ] && self.app.element_list[ input_id ].$el.attr( 'tour_id', flat_id );\n\t }\n\t // converter between raw dictionary and job dictionary\n\t function convert( identifier, head ) {\n\t for ( var index in head ) {\n\t var node = head[ index ];\n\t if ( node.input ) {\n\t var input = node.input;\n\t var flat_id = identifier;\n\t if ( identifier != '' ) {\n\t flat_id += '|';\n\t }\n\t flat_id += input.name;\n\t switch ( input.type ) {\n\t case 'repeat':\n\t var section_label = 'section-';\n\t var block_indices = [];\n\t var block_prefix = null;\n\t for ( var block_label in node ) {\n\t var pos = block_label.indexOf( section_label );\n\t if ( pos != -1 ) {\n\t pos += section_label.length;\n\t block_indices.push( parseInt( block_label.substr( pos ) ));\n\t if ( !block_prefix ) {\n\t block_prefix = block_label.substr( 0, pos );\n\t }\n\t }\n\t }\n\t block_indices.sort( function( a, b ) { return a - b; });\n\t var index = 0;\n\t for ( var i in block_indices ) {\n\t convert( flat_id + '_' + index++, node[ block_prefix + block_indices[ i ] ]);\n\t }\n\t break;\n\t case 'conditional':\n\t var value = self.app.field_list[ input.id ].value();\n\t add( flat_id + '|' + input.test_param.name, input.id, value );\n\t var selectedCase = matchCase( input, value );\n\t if ( selectedCase != -1 ) {\n\t convert( flat_id, head[ input.id + '-section-' + selectedCase ] );\n\t }\n\t break;\n\t case 'section':\n\t convert( !input.flat && flat_id || '', node );\n\t break;\n\t default:\n\t var field = self.app.field_list[ input.id ];\n\t if ( field && field.value ) {\n\t var value = field.value();\n\t if ( input.ignore === undefined || input.ignore != value ) {\n\t if ( field.collapsed && input.collapsible_value ) {\n\t value = input.collapsible_value;\n\t }\n\t add( flat_id, input.id, value );\n\t if ( input.payload ) {\n\t for ( var p_id in input.payload ) {\n\t add( p_id, input.id, input.payload[ p_id ] );\n\t }\n\t }\n\t }\n\t }\n\t }\n\t }\n\t }\n\t }\n\t convert( '', dict );\n\t return result_dict;\n\t },\n\t\n\t /** Matches flat ids to corresponding input element\n\t * @param{string} flat_id - Flat input id to be looked up.\n\t */\n\t match: function ( flat_id ) {\n\t return this.flat_dict && this.flat_dict[ flat_id ];\n\t },\n\t\n\t /** Match conditional values to selected cases\n\t */\n\t matchCase: function( input, value ) {\n\t return matchCase( input, value );\n\t },\n\t\n\t /** Matches a new tool model to the current input elements e.g. used to update dynamic options\n\t */\n\t matchModel: function( model, callback ) {\n\t var self = this;\n\t visitInputs( model.inputs, function( input, name ) {\n\t self.flat_dict[ name ] && callback ( input, self.flat_dict[ name ] );\n\t });\n\t },\n\t\n\t /** Matches identifier from api response to input elements e.g. used to display validation errors\n\t */\n\t matchResponse: function( response ) {\n\t var result = {};\n\t var self = this;\n\t function search ( id, head ) {\n\t if ( typeof head === 'string' ) {\n\t var input_id = self.flat_dict[ id ];\n\t input_id && ( result[ input_id ] = head );\n\t } else {\n\t for ( var i in head ) {\n\t var new_id = i;\n\t if ( id !== '' ) {\n\t var separator = '|';\n\t if ( head instanceof Array ) {\n\t separator = '_';\n\t }\n\t new_id = id + separator + new_id;\n\t }\n\t search ( new_id, head[ i ] );\n\t }\n\t }\n\t }\n\t search( '', response );\n\t return result;\n\t },\n\t\n\t /** Map dom tree to dictionary tree with input elements.\n\t */\n\t _iterate: function( parent, dict ) {\n\t var self = this;\n\t var children = $( parent ).children();\n\t children.each( function() {\n\t var child = this;\n\t var id = $( child ).attr( 'id' );\n\t if ( $( child ).hasClass( 'section-row' ) ) {\n\t var input = self.app.input_list[ id ];\n\t dict[ id ] = ( input && { input : input } ) || {};\n\t self._iterate( child, dict[ id ] );\n\t } else {\n\t self._iterate( child, dict );\n\t }\n\t });\n\t }\n\t });\n\t\n\t /** Match conditional values to selected cases\n\t * @param{dict} input - Definition of conditional input parameter\n\t * @param{dict} value - Current value\n\t */\n\t var matchCase = function( input, value ) {\n\t if ( input.test_param.type == 'boolean' ) {\n\t if ( value == 'true' ) {\n\t value = input.test_param.truevalue || 'true';\n\t } else {\n\t value = input.test_param.falsevalue || 'false';\n\t }\n\t }\n\t for ( var i in input.cases ) {\n\t if ( input.cases[ i ].value == value ) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t };\n\t\n\t /** Visits tool inputs\n\t * @param{dict} inputs - Nested dictionary of input elements\n\t * @param{dict} callback - Called with the mapped dictionary object and corresponding model node\n\t */\n\t var visitInputs = function( inputs, callback, prefix, context ) {\n\t context = $.extend( true, {}, context );\n\t _.each( inputs, function ( input ) {\n\t if ( input && input.type && input.name ) {\n\t context[ input.name ] = input;\n\t }\n\t });\n\t for ( var key in inputs ) {\n\t var node = inputs[ key ];\n\t node.name = node.name || key;\n\t var name = prefix ? prefix + '|' + node.name : node.name;\n\t switch ( node.type ) {\n\t case 'repeat':\n\t _.each( node.cache, function( cache, j ) {\n\t visitInputs( cache, callback, name + '_' + j, context );\n\t });\n\t break;\n\t case 'conditional':\n\t if ( node.test_param ) {\n\t callback( node.test_param, name + '|' + node.test_param.name, context );\n\t var selectedCase = matchCase( node, node.test_param.value );\n\t if ( selectedCase != -1 ) {\n\t visitInputs( node.cases[ selectedCase ].inputs, callback, name, context );\n\t } else {\n\t Galaxy.emit.debug( 'form-data::visitInputs() - Invalid case for ' + name + '.' );\n\t }\n\t } else {\n\t Galaxy.emit.debug( 'form-data::visitInputs() - Conditional test parameter missing for ' + name + '.' );\n\t }\n\t break;\n\t case 'section':\n\t visitInputs( node.inputs, callback, name, context )\n\t break;\n\t default:\n\t callback( node, name, context );\n\t }\n\t }\n\t };\n\t\n\t return {\n\t Manager : Manager,\n\t visitInputs : visitInputs\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/* 34 */\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 creates a form input element wrapper\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {\n\t return Backbone.View.extend({\n\t initialize: function( app, options ) {\n\t this.app = app;\n\t this.app_options = app.options || {};\n\t this.field = options && options.field || new Backbone.View();\n\t this.model = options && options.model || new Backbone.Model({\n\t text_enable : this.app_options.text_enable || 'Enable',\n\t text_disable : this.app_options.text_disable || 'Disable',\n\t cls_enable : this.app_options.cls_enable || 'fa fa-caret-square-o-down',\n\t cls_disable : this.app_options.cls_disable || 'fa fa-caret-square-o-up'\n\t }).set( options );\n\t\n\t // set element and link components\n\t this.setElement( this._template() );\n\t this.$field = this.$( '.ui-form-field' );\n\t this.$info = this.$( '.ui-form-info' );\n\t this.$preview = this.$( '.ui-form-preview' );\n\t this.$collapsible = this.$( '.ui-form-collapsible' );\n\t this.$collapsible_text = this.$( '.ui-form-collapsible-text' );\n\t this.$collapsible_icon = this.$( '.ui-form-collapsible-icon' );\n\t this.$title = this.$( '.ui-form-title' );\n\t this.$title_text = this.$( '.ui-form-title-text' );\n\t this.$error_text = this.$( '.ui-form-error-text' );\n\t this.$error = this.$( '.ui-form-error' );\n\t this.$backdrop = this.$( '.ui-form-backdrop' );\n\t\n\t // add field element\n\t this.$field.prepend( this.field.$el );\n\t\n\t // decide wether to expand or collapse fields\n\t var collapsible_value = this.model.get( 'collapsible_value' );\n\t this.field.collapsed = collapsible_value !== undefined && JSON.stringify( this.model.get( 'value' ) ) == JSON.stringify( collapsible_value );\n\t this.listenTo( this.model, 'change', this.render, this );\n\t this.render();\n\t\n\t // add click handler\n\t var self = this;\n\t this.$collapsible.on( 'click', function() {\n\t self.field.collapsed = !self.field.collapsed;\n\t app.trigger && app.trigger( 'change' );\n\t self.render();\n\t });\n\t },\n\t\n\t /** Set backdrop for input element\n\t */\n\t backdrop: function() {\n\t this.model.set( 'backdrop', true );\n\t },\n\t\n\t /** Set error text\n\t */\n\t error: function( text ) {\n\t this.model.set( 'error_text', text );\n\t },\n\t\n\t /** Reset this view\n\t */\n\t reset: function() {\n\t this.model.set( 'error_text', null );\n\t },\n\t\n\t render: function() {\n\t // render help\n\t $( '.tooltip' ).hide();\n\t var help_text = this.model.get( 'help', '' );\n\t var help_argument = this.model.get( 'argument' );\n\t if ( help_argument && help_text.indexOf( '(' + help_argument + ')' ) == -1 ) {\n\t help_text += ' (' + help_argument + ')';\n\t }\n\t this.$info.html( help_text );\n\t // render visibility\n\t this.$el[ this.model.get( 'hidden' ) ? 'hide' : 'show' ]();\n\t // render preview view for collapsed fields\n\t this.$preview[ ( this.field.collapsed && this.model.get( 'collapsible_preview' ) || this.model.get( 'disabled' ) ) ? 'show' : 'hide' ]()\n\t .html( _.escape( this.model.get( 'text_value' ) ) );\n\t // render error messages\n\t var error_text = this.model.get( 'error_text' );\n\t this.$error[ error_text ? 'show' : 'hide' ]();\n\t this.$el[ error_text ? 'addClass' : 'removeClass' ]( 'ui-error' );\n\t this.$error_text.html( error_text );\n\t // render backdrop\n\t this.$backdrop[ this.model.get( 'backdrop' ) ? 'show' : 'hide' ]();\n\t // render input field\n\t this.field.collapsed || this.model.get( 'disabled' ) ? this.$field.hide() : this.$field.show();\n\t // render input field color and style\n\t this.field.model && this.field.model.set( { 'color': this.model.get( 'color' ), 'style': this.model.get( 'style' ) } );\n\t // render collapsible options\n\t if ( !this.model.get( 'disabled' ) && this.model.get( 'collapsible_value' ) !== undefined ) {\n\t var collapsible_state = this.field.collapsed ? 'enable' : 'disable';\n\t this.$title_text.hide();\n\t this.$collapsible.show();\n\t this.$collapsible_text.text( this.model.get( 'label' ) );\n\t this.$collapsible_icon.removeClass().addClass( 'icon' )\n\t .addClass( this.model.get( 'cls_' + collapsible_state ) )\n\t .attr( 'data-original-title', this.model.get( 'text_' + collapsible_state ) )\n\t .tooltip( { placement: 'bottom' } );\n\t } else {\n\t this.$title_text.show().text( this.model.get( 'label' ) );\n\t this.$collapsible.hide();\n\t }\n\t },\n\t\n\t _template: function() {\n\t return $( '
    ' ).addClass( 'ui-form-element' )\n\t .append( $( '
    ' ).addClass( 'ui-form-error ui-error' )\n\t .append( $( '' ).addClass( 'fa fa-arrow-down' ) )\n\t .append( $( '' ).addClass( 'ui-form-error-text' ) )\n\t )\n\t .append( $( '
    ' ).addClass( 'ui-form-title' )\n\t .append( $( '
    ' ).addClass( 'ui-form-collapsible' )\n\t .append( $( '' ).addClass( 'ui-form-collapsible-icon' ) )\n\t .append( $( '' ).addClass( 'ui-form-collapsible-text' ) )\n\t )\n\t .append( $( '' ).addClass( 'ui-form-title-text' ) )\n\t )\n\t .append( $( '
    ' ).addClass( 'ui-form-field' )\n\t .append( $( '' ).addClass( 'ui-form-info' ) )\n\t .append( $( '
    ' ).addClass( 'ui-form-backdrop' ) )\n\t )\n\t .append( $( '
    ' ).addClass( 'ui-form-preview' ) );\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__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 35 */\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 creates input elements. New input parameter types should be added to the types dictionary.\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4),\n\t __webpack_require__(7),\n\t __webpack_require__(48),\n\t __webpack_require__(50),\n\t __webpack_require__(49),\n\t __webpack_require__(46)], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Ui, SelectContent, SelectLibrary, SelectFtp, ColorPicker ) {\n\t\n\t // create form view\n\t return Backbone.Model.extend({\n\t /** Available parameter types */\n\t types: {\n\t 'text' : '_fieldText',\n\t 'select' : '_fieldSelect',\n\t 'data_column' : '_fieldSelect',\n\t 'genomebuild' : '_fieldSelect',\n\t 'data' : '_fieldData',\n\t 'data_collection' : '_fieldData',\n\t 'integer' : '_fieldSlider',\n\t 'float' : '_fieldSlider',\n\t 'boolean' : '_fieldBoolean',\n\t 'drill_down' : '_fieldDrilldown',\n\t 'color' : '_fieldColor',\n\t 'hidden' : '_fieldHidden',\n\t 'hidden_data' : '_fieldHidden',\n\t 'baseurl' : '_fieldHidden',\n\t 'library_data' : '_fieldLibrary',\n\t 'ftpfile' : '_fieldFtp'\n\t },\n\t\n\t /** Returns an input field for a given field type */\n\t create: function( input_def ) {\n\t var fieldClass = this.types[ input_def.type ];\n\t var field = typeof( this[ fieldClass ] ) === 'function' ? this[ fieldClass ].call( this, input_def ) : null;\n\t if ( !field ) {\n\t field = input_def.options ? this._fieldSelect( input_def ) : this._fieldText( input_def );\n\t Galaxy.emit.debug('form-parameters::_addRow()', 'Auto matched field type (' + input_def.type + ').');\n\t }\n\t input_def.value === undefined && ( input_def.value = null );\n\t field.value( input_def.value );\n\t return field;\n\t },\n\t\n\t /** Data input field */\n\t _fieldData: function( input_def ) {\n\t return new SelectContent.View({\n\t id : 'field-' + input_def.id,\n\t extensions : input_def.extensions,\n\t optional : input_def.optional,\n\t multiple : input_def.multiple,\n\t type : input_def.type,\n\t flavor : input_def.flavor,\n\t data : input_def.options,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Select/Checkbox/Radio options field */\n\t _fieldSelect: function ( input_def ) {\n\t // show text field e.g. in workflow editor\n\t if( input_def.is_workflow ) {\n\t return this._fieldText( input_def );\n\t }\n\t\n\t // customize properties\n\t if ( input_def.type == 'data_column' ) {\n\t input_def.error_text = 'Missing columns in referenced dataset.'\n\t }\n\t\n\t // identify available options\n\t var data = input_def.data;\n\t if( !data ) {\n\t data = [];\n\t _.each( input_def.options, function( option ) {\n\t data.push( { label: option[ 0 ], value: option[ 1 ] } );\n\t });\n\t }\n\t\n\t // identify display type\n\t var SelectClass = Ui.Select;\n\t switch ( input_def.display ) {\n\t case 'checkboxes':\n\t SelectClass = Ui.Checkbox;\n\t break;\n\t case 'radio':\n\t SelectClass = Ui.Radio;\n\t break;\n\t case 'radiobutton':\n\t SelectClass = Ui.RadioButton;\n\t break;\n\t }\n\t\n\t // create select field\n\t return new SelectClass.View({\n\t id : 'field-' + input_def.id,\n\t data : data,\n\t error_text : input_def.error_text || 'No options available',\n\t multiple : input_def.multiple,\n\t optional : input_def.optional,\n\t onchange : input_def.onchange,\n\t searchable : input_def.flavor !== 'workflow'\n\t });\n\t },\n\t\n\t /** Drill down options field */\n\t _fieldDrilldown: function ( input_def ) {\n\t // show text field e.g. in workflow editor\n\t if( input_def.is_workflow ) {\n\t return this._fieldText( input_def );\n\t }\n\t\n\t // create drill down field\n\t return new Ui.Drilldown.View({\n\t id : 'field-' + input_def.id,\n\t data : input_def.options,\n\t display : input_def.display,\n\t optional : input_def.optional,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Text input field */\n\t _fieldText: function( input_def ) {\n\t // field replaces e.g. a select field\n\t if ( input_def.options && input_def.data ) {\n\t input_def.area = input_def.multiple;\n\t if ( Utils.isEmpty( input_def.value ) ) {\n\t input_def.value = null;\n\t } else {\n\t if ( $.isArray( input_def.value ) ) {\n\t var str_value = '';\n\t for ( var i in input_def.value ) {\n\t str_value += String( input_def.value[ i ] );\n\t if ( !input_def.multiple ) {\n\t break;\n\t }\n\t str_value += '\\n';\n\t }\n\t input_def.value = str_value;\n\t }\n\t }\n\t }\n\t // create input element\n\t return new Ui.Input({\n\t id : 'field-' + input_def.id,\n\t area : input_def.area,\n\t placeholder : input_def.placeholder,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Slider field */\n\t _fieldSlider: function( input_def ) {\n\t return new Ui.Slider.View({\n\t id : 'field-' + input_def.id,\n\t precise : input_def.type == 'float',\n\t is_workflow : input_def.is_workflow,\n\t min : input_def.min,\n\t max : input_def.max,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Hidden field */\n\t _fieldHidden: function( input_def ) {\n\t return new Ui.Hidden({\n\t id : 'field-' + input_def.id,\n\t info : input_def.info\n\t });\n\t },\n\t\n\t /** Boolean field */\n\t _fieldBoolean: function( input_def ) {\n\t return new Ui.RadioButton.View({\n\t id : 'field-' + input_def.id,\n\t data : [ { label : 'Yes', value : 'true' },\n\t { label : 'No', value : 'false' }],\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Color picker field */\n\t _fieldColor: function( input_def ) {\n\t return new ColorPicker({\n\t id : 'field-' + input_def.id,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Library dataset field */\n\t _fieldLibrary: function( input_def ) {\n\t return new SelectLibrary.View({\n\t id : 'field-' + input_def.id,\n\t optional : input_def.optional,\n\t multiple : input_def.multiple,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** FTP file field */\n\t _fieldFtp: function( input_def ) {\n\t return new SelectFtp.View({\n\t id : 'field-' + input_def.id,\n\t optional : input_def.optional,\n\t multiple : input_def.multiple,\n\t onchange : input_def.onchange\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__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 36 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This class creates a ui component which enables the dynamic creation of portlets */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(9), __webpack_require__(7) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Portlet, Ui ) {\n\t var View = Backbone.View.extend({\n\t initialize: function( options ) {\n\t this.list = {};\n\t this.options = Utils.merge( options, {\n\t title : 'Repeat',\n\t empty_text : 'Not available.',\n\t max : null,\n\t min : null\n\t });\n\t this.button_new = new Ui.ButtonIcon({\n\t icon : 'fa-plus',\n\t title : 'Insert ' + this.options.title,\n\t tooltip : 'Add new ' + this.options.title + ' block',\n\t floating: 'clear',\n\t cls : 'ui-button-icon form-repeat-add',\n\t onclick : function() { options.onnew && options.onnew() }\n\t });\n\t this.setElement( $( '
    ' ).append( this.$list = $( '
    ' ) )\n\t .append( $( '
    ' ).append( this.button_new.$el ) ) );\n\t },\n\t\n\t /** Number of repeat blocks */\n\t size: function() {\n\t return _.size( this.list );\n\t },\n\t\n\t /** Add new repeat block */\n\t add: function( options ) {\n\t if ( !options.id || this.list[ options.id ] ) {\n\t Galaxy.emit.debug( 'form-repeat::add()', 'Duplicate or invalid repeat block id.' );\n\t return;\n\t }\n\t var button_delete = new Ui.ButtonIcon({\n\t icon : 'fa-trash-o',\n\t tooltip : 'Delete this repeat block',\n\t cls : 'ui-button-icon-plain form-repeat-delete',\n\t onclick : function() { options.ondel && options.ondel() }\n\t });\n\t var portlet = new Portlet.View({\n\t id : options.id,\n\t title : 'placeholder',\n\t cls : options.cls || 'ui-portlet-repeat',\n\t operations : { button_delete: button_delete }\n\t });\n\t portlet.append( options.$el );\n\t portlet.$el.addClass( 'section-row' ).hide();\n\t this.list[ options.id ] = portlet;\n\t this.$list.append( portlet.$el.fadeIn( 'fast' ) );\n\t this.options.max > 0 && this.size() >= this.options.max && this.button_new.disable();\n\t this._refresh();\n\t },\n\t\n\t /** Delete repeat block */\n\t del: function( id ) {\n\t if ( !this.list[ id ] ) {\n\t Galaxy.emit.debug( 'form-repeat::del()', 'Invalid repeat block id.' );\n\t return;\n\t }\n\t this.$list.find( '#' + id ).remove();\n\t delete this.list[ id ];\n\t this.button_new.enable();\n\t this._refresh();\n\t },\n\t\n\t /** Remove all */\n\t delAll: function() {\n\t for( var id in this.list ) {\n\t this.del( id );\n\t }\n\t },\n\t\n\t /** Hides add/del options */\n\t hideOptions: function() {\n\t this.button_new.$el.hide();\n\t _.each( this.list, function( portlet ) { portlet.hideOperation( 'button_delete' ) } );\n\t _.isEmpty( this.list ) && this.$el.append( $( '
    ' ).addClass( 'ui-form-info' ).html( this.options.empty_text ) );\n\t },\n\t\n\t /** Refresh view */\n\t _refresh: function() {\n\t var index = 0;\n\t for ( var id in this.list ) {\n\t var portlet = this.list[ id ];\n\t portlet.title( ++index + ': ' + this.options.title );\n\t portlet[ this.size() > this.options.min ? 'showOperation' : 'hideOperation' ]( 'button_delete' );\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 37 */\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 This class creates a form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections.\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(7), __webpack_require__(9), __webpack_require__(36), __webpack_require__(34), __webpack_require__(35) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Ui, Portlet, Repeat, InputElement, Parameters ) {\n\t var View = Backbone.View.extend({\n\t initialize: function( app, options ) {\n\t this.app = app;\n\t this.inputs = options.inputs;\n\t this.parameters = new Parameters();\n\t this.setElement( $( '
    ' ) );\n\t this.render();\n\t },\n\t\n\t /** Render section view */\n\t render: function() {\n\t var self = this;\n\t this.$el.empty();\n\t _.each( this.inputs, function( input ) { self.add( input ) } );\n\t },\n\t\n\t /** Add a new input element */\n\t add: function( input ) {\n\t var input_def = jQuery.extend( true, {}, input );\n\t input_def.id = input.id = Utils.uid();\n\t this.app.input_list[ input_def.id ] = input_def;\n\t switch( input_def.type ) {\n\t case 'conditional':\n\t this._addConditional( input_def );\n\t break;\n\t case 'repeat':\n\t this._addRepeat( input_def );\n\t break;\n\t case 'section':\n\t this._addSection( input_def );\n\t break;\n\t default:\n\t this._addRow( input_def );\n\t }\n\t },\n\t\n\t /** Add a conditional block */\n\t _addConditional: function( input_def ) {\n\t var self = this;\n\t input_def.test_param.id = input_def.id;\n\t this.app.options.sustain_conditionals && ( input_def.test_param.disabled = true );\n\t var field = this._addRow( input_def.test_param );\n\t\n\t // set onchange event for test parameter\n\t field.model && field.model.set( 'onchange', function( value ) {\n\t var selectedCase = self.app.data.matchCase( input_def, value );\n\t for ( var i in input_def.cases ) {\n\t var case_def = input_def.cases[ i ];\n\t var section_row = self.$( '#' + input_def.id + '-section-' + i );\n\t var nonhidden = false;\n\t for ( var j in case_def.inputs ) {\n\t if ( !case_def.inputs[ j ].hidden ) {\n\t nonhidden = true;\n\t break;\n\t }\n\t }\n\t if ( i == selectedCase && nonhidden ) {\n\t section_row.fadeIn( 'fast' );\n\t } else {\n\t section_row.hide();\n\t }\n\t }\n\t self.app.trigger( 'change' );\n\t });\n\t\n\t // add conditional sub sections\n\t for ( var i in input_def.cases ) {\n\t var sub_section = new View( this.app, { inputs: input_def.cases[ i ].inputs } );\n\t this._append( sub_section.$el.addClass( 'ui-form-section' ), input_def.id + '-section-' + i );\n\t }\n\t\n\t // trigger refresh on conditional input field after all input elements have been created\n\t field.trigger( 'change' );\n\t },\n\t\n\t /** Add a repeat block */\n\t _addRepeat: function( input_def ) {\n\t var self = this;\n\t var block_index = 0;\n\t\n\t // create repeat block element\n\t var repeat = new Repeat.View({\n\t title : input_def.title || 'Repeat',\n\t min : input_def.min,\n\t max : input_def.max,\n\t onnew : function() { create( input_def.inputs ); self.app.trigger( 'change' ); }\n\t });\n\t\n\t // helper function to create new repeat blocks\n\t function create ( inputs ) {\n\t var sub_section_id = input_def.id + '-section-' + ( block_index++ );\n\t var sub_section = new View( self.app, { inputs: inputs } );\n\t repeat.add( { id : sub_section_id,\n\t $el : sub_section.$el,\n\t ondel : function() { repeat.del( sub_section_id ); self.app.trigger( 'change' ); } } );\n\t }\n\t\n\t //\n\t // add parsed/minimum number of repeat blocks\n\t //\n\t var n_cache = _.size( input_def.cache );\n\t for ( var i = 0; i < Math.max( Math.max( n_cache, input_def.min ), input_def.default || 0 ); i++ ) {\n\t create( i < n_cache ? input_def.cache[ i ] : input_def.inputs );\n\t }\n\t\n\t // hide options\n\t this.app.options.sustain_repeats && repeat.hideOptions();\n\t\n\t // create input field wrapper\n\t var input_element = new InputElement( this.app, {\n\t label : input_def.title || input_def.name,\n\t help : input_def.help,\n\t field : repeat\n\t });\n\t this._append( input_element.$el, input_def.id );\n\t },\n\t\n\t /** Add a customized section */\n\t _addSection: function( input_def ) {\n\t var portlet = new Portlet.View({\n\t title : input_def.title || input_def.name,\n\t cls : 'ui-portlet-section',\n\t collapsible : true,\n\t collapsible_button : true,\n\t collapsed : !input_def.expanded\n\t });\n\t portlet.append( new View( this.app, { inputs: input_def.inputs } ).$el );\n\t portlet.append( $( '
    ' ).addClass( 'ui-form-info' ).html( input_def.help ) );\n\t this.app.on( 'expand', function( input_id ) { ( portlet.$( '#' + input_id ).length > 0 ) && portlet.expand(); } );\n\t this._append( portlet.$el, input_def.id );\n\t },\n\t\n\t /** Add a single input field element */\n\t _addRow: function( input_def ) {\n\t var self = this;\n\t var id = input_def.id;\n\t input_def.onchange = function() { self.app.trigger( 'change', id ) };\n\t var field = this.parameters.create( input_def );\n\t this.app.field_list[ id ] = field;\n\t var input_element = new InputElement( this.app, {\n\t name : input_def.name,\n\t label : input_def.label || input_def.name,\n\t value : input_def.value,\n\t text_value : input_def.text_value,\n\t collapsible_value : input_def.collapsible_value,\n\t collapsible_preview : input_def.collapsible_preview,\n\t help : input_def.help,\n\t argument : input_def.argument,\n\t disabled : input_def.disabled,\n\t color : input_def.color,\n\t style : input_def.style,\n\t backdrop : input_def.backdrop,\n\t hidden : input_def.hidden,\n\t field : field\n\t });\n\t this.app.element_list[ id ] = input_element;\n\t this._append( input_element.$el, input_def.id );\n\t return field;\n\t },\n\t\n\t /** Append a new element to the form i.e. input element, repeat block, conditionals etc. */\n\t _append: function( $el, id ) {\n\t this.$el.append( $el.addClass( 'section-row' ).attr( 'id', id ) );\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__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 38 */\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 is the main class of the form plugin. It is referenced as 'app' in lower level modules.\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(9), __webpack_require__(7), __webpack_require__(37), __webpack_require__(33) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Portlet, Ui, FormSection, FormData ) {\n\t return Backbone.View.extend({\n\t initialize: function( options ) {\n\t this.options = Utils.merge( options, {\n\t initial_errors : false,\n\t cls : 'ui-portlet-limited',\n\t icon : null,\n\t always_refresh : true\n\t });\n\t this.setElement( '
    ' );\n\t this.render();\n\t },\n\t\n\t /** Update available options */\n\t update: function( new_model ){\n\t var self = this;\n\t this.data.matchModel( new_model, function( node, input_id ) {\n\t var input = self.input_list[ input_id ];\n\t if ( input && input.options ) {\n\t if ( !_.isEqual( input.options, node.options ) ) {\n\t input.options = node.options;\n\t var field = self.field_list[ input_id ];\n\t if ( field.update ) {\n\t var new_options = [];\n\t if ( ( [ 'data', 'data_collection', 'drill_down' ] ).indexOf( input.type ) != -1 ) {\n\t new_options = input.options;\n\t } else {\n\t for ( var i in node.options ) {\n\t var opt = node.options[ i ];\n\t if ( opt.length > 2 ) {\n\t new_options.push( { label: opt[ 0 ], value: opt[ 1 ] } );\n\t }\n\t }\n\t }\n\t field.update( new_options );\n\t field.trigger( 'change' );\n\t Galaxy.emit.debug( 'form-view::update()', 'Updating options for ' + input_id );\n\t }\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** Set form into wait mode */\n\t wait: function( active ) {\n\t for ( var i in this.input_list ) {\n\t var field = this.field_list[ i ];\n\t var input = this.input_list[ i ];\n\t if ( input.is_dynamic && field.wait && field.unwait ) {\n\t field[ active ? 'wait' : 'unwait' ]();\n\t }\n\t }\n\t },\n\t\n\t /** Highlight and scroll to input element (currently only used for error notifications) */\n\t highlight: function ( input_id, message, silent ) {\n\t var input_element = this.element_list[ input_id ];\n\t if ( input_element ) {\n\t input_element.error( message || 'Please verify this parameter.' );\n\t this.portlet.expand();\n\t this.trigger( 'expand', input_id );\n\t if ( !silent ) {\n\t var $panel = this.$el.parents().filter(function() {\n\t return [ 'auto', 'scroll' ].indexOf( $( this ).css( 'overflow' ) ) != -1;\n\t }).first();\n\t $panel.animate( { scrollTop : $panel.scrollTop() + input_element.$el.offset().top - 120 }, 500 );\n\t }\n\t }\n\t },\n\t\n\t /** Highlights errors */\n\t errors: function( options ) {\n\t this.trigger( 'reset' );\n\t if ( options && options.errors ) {\n\t var error_messages = this.data.matchResponse( options.errors );\n\t for ( var input_id in this.element_list ) {\n\t var input = this.element_list[ input_id ];\n\t if ( error_messages[ input_id ] ) {\n\t this.highlight( input_id, error_messages[ input_id ], true );\n\t }\n\t }\n\t }\n\t },\n\t\n\t /** Render tool form */\n\t render: function() {\n\t var self = this;\n\t this.off('change');\n\t this.off('reset');\n\t // contains the dom field elements as created by the parameter factory i.e. form-parameters\n\t this.field_list = {};\n\t // contains input definitions/dictionaries as provided by the parameters to_dict() function through the api\n\t this.input_list = {};\n\t // contains the dom elements of each input element i.e. form-input which wraps the actual input field\n\t this.element_list = {};\n\t // converts the form into a json data structure\n\t this.data = new FormData.Manager( this );\n\t this._renderForm();\n\t this.data.create();\n\t this.options.initial_errors && this.errors( this.options );\n\t // add listener which triggers on checksum change, and reset the form input wrappers\n\t var current_check = this.data.checksum();\n\t this.on('change', function( input_id ) {\n\t var input = self.input_list[ input_id ];\n\t if ( !input || input.refresh_on_change || self.options.always_refresh ) {\n\t var new_check = self.data.checksum();\n\t if ( new_check != current_check ) {\n\t current_check = new_check;\n\t self.options.onchange && self.options.onchange();\n\t }\n\t }\n\t });\n\t this.on('reset', function() {\n\t _.each( self.element_list, function( input_element ) { input_element.reset() } );\n\t });\n\t return this;\n\t },\n\t\n\t /** Renders/appends dom elements of the form */\n\t _renderForm: function() {\n\t $( '.tooltip' ).remove();\n\t this.message = new Ui.Message();\n\t this.section = new FormSection.View( this, { inputs: this.options.inputs } );\n\t this.portlet = new Portlet.View({\n\t icon : this.options.icon,\n\t title : this.options.title,\n\t cls : this.options.cls,\n\t operations : this.options.operations,\n\t buttons : this.options.buttons,\n\t collapsible : this.options.collapsible,\n\t collapsed : this.options.collapsed\n\t });\n\t this.portlet.append( this.message.$el );\n\t this.portlet.append( this.section.$el );\n\t this.$el.empty();\n\t this.options.inputs && this.$el.append( this.portlet.$el );\n\t this.options.message && this.message.update( { persistent: true, status: 'warning', message: this.options.message } );\n\t Galaxy.emit.debug( 'form-view::initialize()', 'Completed' );\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__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 39 */\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__ = [\n\t __webpack_require__(30),\n\t __webpack_require__(74),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DC_MODEL, HISTORY_CONTENT, _l ){\n\t\n\t'use strict';\n\t\n\t/*==============================================================================\n\t\n\tModels for DatasetCollections contained within a history.\n\t\n\tTODO:\n\t these might be compactable to one class if some duplication with\n\t collection-model is used.\n\t\n\t==============================================================================*/\n\tvar 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\tfunction 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//==============================================================================\n\t/** @class Backbone model for List Dataset Collection within a History.\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for Pair Dataset Collection within a History.\n\t * @constructs\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for List of Pairs Dataset Collection within a History. */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for List of Lists Dataset Collection within a History. */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 40 */\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__ = [\n\t __webpack_require__(67),\n\t __webpack_require__(72),\n\t __webpack_require__(39),\n\t __webpack_require__(41),\n\t __webpack_require__(6),\n\t __webpack_require__(129)\n\t], __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\tvar _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\tvar 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\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 ){ return; }\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 ){ return !c.inReadyState(); });\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() )\n\t && ( 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 ){ return c.hasDetails(); });\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 ){ return c.hidden(); });\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 ){ return c.get( 'deleted' ); });\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' ) ){ return; }\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' ) ){ return; }\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\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 )\n\t .always( function(){ self.trigger( 'fetching-deleted-done', self ); });\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 )\n\t .always( function(){ self.trigger( 'fetching-hidden-done', self ); });\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 })\n\t .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(){ return fn.apply( content, args ); };\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 )\n\t .fail( deferred.reject )\n\t .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\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 = [\n\t 'HistoryDatasetAssociation',\n\t 'HistoryDatasetCollectionAssociation'\n\t ];\n\t return ( ( _.isObject( contentsJSON ) && contentsJSON.id )\n\t && ( _.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 })\n\t .done( function( response ){\n\t collection.add([ response ], { parse: true });\n\t })\n\t .fail( function( error, status, message ){\n\t collection.trigger( 'error', collection, xhr, {},\n\t '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, 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 // 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 41 */\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__ = [\n\t __webpack_require__(6)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( BASE_MVC ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'history';\n\t\n\t// ============================================================================\n\t/** session storage for individual history preferences */\n\tvar 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 ) ){ this.set( 'show_deleted', val ); }\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 ) ){ this.set( 'show_hidden', val ); }\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 42 */\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__ = [\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar 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\tvar 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\n\t } else {\n\t $( view ).queue( 'fx', [\n\t function( next ){\n\t view.$el.fadeOut( speed, next );\n\t },\n\t function( next ){\n\t view._swapNewRender( $newRender );\n\t next();\n\t },\n\t function( next ){\n\t view.$el.fadeIn( speed, next );\n\t },\n\t function( next ){\n\t view.trigger( 'rendered', view );\n\t next();\n\t }\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()\n\t .attr( 'class', _.isFunction( this.className )? this.className(): this.className )\n\t .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//==============================================================================\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\tvar ListItemView = ExpandableView.extend(\n\t 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 ){ this.showSelector( 0 ); }\n\t if( this.draggable ){ this.draggableOn(); }\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, KEYCODE_RETURN = 13;\n\t if( event && ( event.type === 'keydown' )\n\t &&( 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\tListItemView.prototype.templates = (function(){\n\t\n\t var elTemplato = BASE_MVC.wrapTemplate([\n\t '
    ',\n\t // errors, messages, etc.\n\t '
    ',\n\t\n\t // multi-select checkbox\n\t '
    ',\n\t '',\n\t '
    ',\n\t // space for title bar buttons - gen. floated to the right\n\t '
    ',\n\t '
    ',\n\t\n\t // expandable area for more details\n\t '
    ',\n\t '
    '\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 '',\n\t '
    ',\n\t '<%- element.name %>',\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ], 'element' );\n\t\n\t var subtitleTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
    '\n\t ]);\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
    '\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//==============================================================================\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\tvar 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' ){ this.expanded = false; }\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' ){ return $(); }\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()\n\t .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\tFoldoutListItemView.prototype.templates = (function(){\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate([\n\t '
    ',\n\t // override with more info (that goes above the panel)\n\t '
    '\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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {/**\n\t This is the base class of the tool form plugin. This class is e.g. inherited by the regular and the workflow tool form.\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(55), __webpack_require__(7), __webpack_require__(38),\n\t __webpack_require__(17), __webpack_require__(28)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Utils, Deferred, Ui, FormBase, CitationModel, CitationView) {\n\t return FormBase.extend({\n\t initialize: function(options) {\n\t var self = this;\n\t FormBase.prototype.initialize.call(this, options);\n\t this.deferred = new Deferred();\n\t if (options.inputs) {\n\t this._buildForm(options);\n\t } else {\n\t this.deferred.execute(function(process) {\n\t self._buildModel(process, options, true);\n\t });\n\t }\n\t // Listen to history panel\n\t if ( options.listen_to_history && parent.Galaxy && parent.Galaxy.currHistoryPanel ) {\n\t this.listenTo( parent.Galaxy.currHistoryPanel.collection, 'change', function() {\n\t this.refresh();\n\t });\n\t }\n\t },\n\t\n\t /** Listen to history panel changes and update the tool form */\n\t refresh: function() {\n\t var self = this;\n\t self.deferred.reset();\n\t this.deferred.execute( function (process){\n\t self._updateModel( process)\n\t });\n\t },\n\t\n\t /** Wait for deferred build processes before removal */\n\t remove: function() {\n\t var self = this;\n\t this.$el.hide();\n\t this.deferred.execute(function(){\n\t FormBase.prototype.remove.call(self);\n\t Galaxy.emit.debug('tool-form-base::remove()', 'Destroy view.');\n\t });\n\t },\n\t\n\t /** Build form */\n\t _buildForm: function(options) {\n\t var self = this;\n\t this.options = Utils.merge(options, this.options);\n\t this.options = Utils.merge({\n\t icon : options.icon,\n\t title : '' + options.name + ' ' + options.description + ' (Galaxy Version ' + options.version + ')',\n\t operations : !this.options.hide_operations && this._operations(),\n\t onchange : function() {\n\t self.refresh();\n\t }\n\t }, this.options);\n\t this.options.customize && this.options.customize( this.options );\n\t this.render();\n\t if ( !this.options.collapsible ) {\n\t this.$el.append( $( '
    ' ).addClass( 'ui-margin-top-large' ).append( this._footer() ) );\n\t }\n\t },\n\t\n\t /** Builds a new model through api call and recreates the entire form\n\t */\n\t _buildModel: function(process, options, hide_message) {\n\t var self = this;\n\t this.options.id = options.id;\n\t this.options.version = options.version;\n\t\n\t // build request url\n\t var build_url = '';\n\t var build_data = {};\n\t if ( options.job_id ) {\n\t build_url = Galaxy.root + 'api/jobs/' + options.job_id + '/build_for_rerun';\n\t } else {\n\t build_url = Galaxy.root + 'api/tools/' + options.id + '/build';\n\t if ( Galaxy.params && Galaxy.params.tool_id == options.id ) {\n\t build_data = $.extend( {}, Galaxy.params );\n\t options.version && ( build_data[ 'tool_version' ] = options.version );\n\t }\n\t }\n\t\n\t // get initial model\n\t Utils.get({\n\t url : build_url,\n\t data : build_data,\n\t success : function(new_model) {\n\t new_model = new_model.tool_model || new_model;\n\t if( !new_model.display ) {\n\t window.location = Galaxy.root;\n\t return;\n\t }\n\t self._buildForm(new_model);\n\t !hide_message && self.message.update({\n\t status : 'success',\n\t message : 'Now you are using \\'' + self.options.name + '\\' version ' + self.options.version + ', id \\'' + self.options.id + '\\'.',\n\t persistent : false\n\t });\n\t Galaxy.emit.debug('tool-form-base::initialize()', 'Initial tool model ready.', new_model);\n\t process.resolve();\n\t },\n\t error : function(response, xhr) {\n\t var error_message = ( response && response.err_msg ) || 'Uncaught error.';\n\t if ( xhr.status == 401 ) {\n\t window.location = Galaxy.root + 'user/login?' + $.param({ redirect : Galaxy.root + '?tool_id=' + self.options.id });\n\t } else if ( self.$el.is(':empty') ) {\n\t self.$el.prepend((new Ui.Message({\n\t message : error_message,\n\t status : 'danger',\n\t persistent : true,\n\t large : true\n\t })).$el);\n\t } else {\n\t Galaxy.modal && Galaxy.modal.show({\n\t title : 'Tool request failed',\n\t body : error_message,\n\t buttons : {\n\t 'Close' : function() {\n\t Galaxy.modal.hide();\n\t }\n\t }\n\t });\n\t }\n\t Galaxy.emit.debug('tool-form::initialize()', 'Initial tool model request failed.', response);\n\t process.reject();\n\t }\n\t });\n\t },\n\t\n\t /** Request a new model for an already created tool form and updates the form inputs\n\t */\n\t _updateModel: function(process) {\n\t // link this\n\t var self = this;\n\t var model_url = this.options.update_url || Galaxy.root + 'api/tools/' + this.options.id + '/build';\n\t var current_state = {\n\t tool_id : this.options.id,\n\t tool_version : this.options.version,\n\t inputs : $.extend(true, {}, self.data.create())\n\t }\n\t this.wait(true);\n\t\n\t // log tool state\n\t Galaxy.emit.debug('tool-form-base::_updateModel()', 'Sending current state.', current_state);\n\t\n\t // post job\n\t Utils.request({\n\t type : 'POST',\n\t url : model_url,\n\t data : current_state,\n\t success : function(new_model) {\n\t self.update(new_model['tool_model'] || new_model);\n\t self.options.update && self.options.update(new_model);\n\t self.wait(false);\n\t Galaxy.emit.debug('tool-form-base::_updateModel()', 'Received new model.', new_model);\n\t process.resolve();\n\t },\n\t error : function(response) {\n\t Galaxy.emit.debug('tool-form-base::_updateModel()', 'Refresh request failed.', response);\n\t process.reject();\n\t }\n\t });\n\t },\n\t\n\t /** Create tool operation menu\n\t */\n\t _operations: function() {\n\t var self = this;\n\t var options = this.options;\n\t\n\t // button for version selection\n\t var versions_button = new Ui.ButtonMenu({\n\t icon : 'fa-cubes',\n\t title : (!options.narrow && 'Versions') || null,\n\t tooltip : 'Select another tool version'\n\t });\n\t if (!options.sustain_version && options.versions && options.versions.length > 1) {\n\t for (var i in options.versions) {\n\t var version = options.versions[i];\n\t if (version != options.version) {\n\t versions_button.addMenu({\n\t title : 'Switch to ' + version,\n\t version : version,\n\t icon : 'fa-cube',\n\t onclick : function() {\n\t // here we update the tool version (some tools encode the version also in the id)\n\t var id = options.id.replace(options.version, this.version);\n\t var version = this.version;\n\t // queue model request\n\t self.deferred.reset();\n\t self.deferred.execute(function(process) {\n\t self._buildModel(process, {id: id, version: version})\n\t });\n\t }\n\t });\n\t }\n\t }\n\t } else {\n\t versions_button.$el.hide();\n\t }\n\t\n\t // button for options e.g. search, help\n\t var menu_button = new Ui.ButtonMenu({\n\t icon : 'fa-caret-down',\n\t title : (!options.narrow && 'Options') || null,\n\t tooltip : 'View available options'\n\t });\n\t if(options.biostar_url) {\n\t menu_button.addMenu({\n\t icon : 'fa-question-circle',\n\t title : 'Question?',\n\t tooltip : 'Ask a question about this tool (Biostar)',\n\t onclick : function() {\n\t window.open(options.biostar_url + '/p/new/post/');\n\t }\n\t });\n\t menu_button.addMenu({\n\t icon : 'fa-search',\n\t title : 'Search',\n\t tooltip : 'Search help for this tool (Biostar)',\n\t onclick : function() {\n\t window.open(options.biostar_url + '/local/search/page/?q=' + options.name);\n\t }\n\t });\n\t };\n\t menu_button.addMenu({\n\t icon : 'fa-share',\n\t title : 'Share',\n\t tooltip : 'Share this tool',\n\t onclick : function() {\n\t prompt('Copy to clipboard: Ctrl+C, Enter', window.location.origin + Galaxy.root + 'root?tool_id=' + options.id);\n\t }\n\t });\n\t\n\t // add admin operations\n\t if (Galaxy.user && Galaxy.user.get('is_admin')) {\n\t menu_button.addMenu({\n\t icon : 'fa-download',\n\t title : 'Download',\n\t tooltip : 'Download this tool',\n\t onclick : function() {\n\t window.location.href = Galaxy.root + 'api/tools/' + options.id + '/download';\n\t }\n\t });\n\t }\n\t\n\t // button for version selection\n\t if (options.requirements && options.requirements.length > 0) {\n\t menu_button.addMenu({\n\t icon : 'fa-info-circle',\n\t title : 'Requirements',\n\t tooltip : 'Display tool requirements',\n\t onclick : function() {\n\t if (!this.visible || self.portlet.collapsed ) {\n\t this.visible = true;\n\t self.portlet.expand();\n\t self.message.update({\n\t persistent : true,\n\t message : self._templateRequirements(options),\n\t status : 'info'\n\t });\n\t } else {\n\t this.visible = false;\n\t self.message.update({\n\t message : ''\n\t });\n\t }\n\t }\n\t });\n\t }\n\t\n\t // add toolshed url\n\t if (options.sharable_url) {\n\t menu_button.addMenu({\n\t icon : 'fa-external-link',\n\t title : 'See in Tool Shed',\n\t tooltip : 'Access the repository',\n\t onclick : function() {\n\t window.open(options.sharable_url);\n\t }\n\t });\n\t }\n\t\n\t return {\n\t menu : menu_button,\n\t versions : versions_button\n\t }\n\t },\n\t\n\t /** Create footer\n\t */\n\t _footer: function() {\n\t var options = this.options;\n\t var $el = $( '
    ' ).append( this._templateHelp( options ) );\n\t if ( options.citations ) {\n\t var $citations = $( '
    ' );\n\t var citations = new CitationModel.ToolCitationCollection();\n\t citations.tool_id = options.id;\n\t var citation_list_view = new CitationView.CitationListView({ el: $citations, collection: citations });\n\t citation_list_view.render();\n\t citations.fetch();\n\t $el.append( $citations );\n\t }\n\t return $el;\n\t },\n\t\n\t /** Templates\n\t */\n\t _templateHelp: function( options ) {\n\t var $tmpl = $( '
    ' ).addClass( 'ui-form-help' ).append( options.help );\n\t $tmpl.find( 'a' ).attr( 'target', '_blank' );\n\t return $tmpl;\n\t },\n\t\n\t _templateRequirements: function( options ) {\n\t var nreq = options.requirements.length;\n\t if ( nreq > 0 ) {\n\t var requirements_message = 'This tool requires ';\n\t _.each( options.requirements, function( req, i ) {\n\t requirements_message += req.name + ( req.version ? ' (Version ' + req.version + ')' : '' ) + ( i < nreq - 2 ? ', ' : ( i == nreq - 2 ? ' and ' : '' ) );\n\t });\n\t var requirements_link = $( '' ).attr( 'target', '_blank' ).attr( 'href', 'https://wiki.galaxyproject.org/Tools/Requirements' ).text( 'here' );\n\t return $( '' ).append( requirements_message + '. Click ' ).append( requirements_link ).append( ' for more information.' );\n\t }\n\t return 'No requirements found.';\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 44 */\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__ = [\n\t __webpack_require__(2),\n\t __webpack_require__(16),\n\t __webpack_require__(11),\n\t __webpack_require__(18)\n\t\n\t], __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\tvar 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\tvar 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\tvar ToolParameterCollection = Backbone.Collection.extend({\n\t model: ToolParameter\n\t});\n\t\n\t/**\n\t * A data tool parameter.\n\t */\n\tvar DataToolParameter = ToolParameter.extend({});\n\t\n\t/**\n\t * An integer tool parameter.\n\t */\n\tvar 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()\n\t .domain([this.get('min'), this.get('max')])\n\t .ticks(this.get('num_samples'));\n\t }\n\t});\n\t\n\tvar 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\tvar 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\tToolParameter.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\tvar 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) { return i.toJSON(); });\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\tvar ToolView = Backbone.View.extend({\n\t\n\t});\n\t\n\t/**\n\t * Wrap collection of tools for fast access/manipulation.\n\t */\n\tvar 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\tvar ToolSectionLabel = Backbone.Model.extend(VisibilityMixin);\n\t\n\t/**\n\t * Section of tool panel with elements (labels and tools).\n\t */\n\tvar 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 }\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 }\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\tvar 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 search_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\tvar 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 // 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 }\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 }\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 }\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 }\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 }\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\tvar 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\tvar 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 }\n\t else if ( formStyle === 'regular' ) { // regular tools\n\t var self = this;\n\t $link.find('a').on('click', function(e) {\n\t e.preventDefault();\n\t var form = new ToolForm.View( { id : self.model.id, version : self.model.get('version') } );\n\t form.deferred.execute(function() {\n\t Galaxy.app.display( form );\n\t });\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\tvar 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\tvar 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 }\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 }\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 ?\n\t this.$el.children(\".toolSectionBody\").slideDown(\"fast\") :\n\t this.$el.children(\".toolSectionBody\").slideUp(\"fast\")\n\t );\n\t }\n\t});\n\t\n\tvar 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 '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 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 ) &&\n\t ( 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\tvar 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 }\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 }\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\n\t 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 }\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\tvar 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\tvar 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\tvar templates = {\n\t // the search bar at the top of the tool panel\n\t tool_search : _.template([\n\t '\" autocomplete=\"off\" type=\"text\" />',\n\t ' ',\n\t //TODO: replace with icon\n\t '',\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([\n\t '
    \">',\n\t '<%- name %>',\n\t '
    ',\n\t '
    \" class=\"toolSectionBody\" style=\"display: none;\">',\n\t '
    ',\n\t '
    '\n\t ].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([\n\t '',\n\t '<% _.each( labels, function( label ){ %>',\n\t '\">',\n\t '<%- label %>',\n\t '',\n\t '<% }); %>',\n\t '',\n\t ' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">',\n\t '<%- name %>',\n\t '',\n\t ' <%- description %>'\n\t ].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([\n\t '
    <%- tool.name %> (version <%- tool.version %>)
    ',\n\t '
    ',\n\t '<% _.each( tool.inputs, function( input ){ %>',\n\t '
    ',\n\t '',\n\t '
    ',\n\t '<%= input.html %>',\n\t '
    ',\n\t '
    ',\n\t '<%- input.help %>',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '<% }); %>',\n\t '
    ',\n\t '
    ',\n\t '',\n\t '
    ',\n\t '
    ',\n\t '
    <% tool.help %>
    ',\n\t '
    ',\n\t // TODO: we need scoping here because 'help' is the dom for the help menu in the masthead\n\t // which implies a leaky variable that I can't find\n\t ].join(''), { variable: 'tool' }),\n\t};\n\t\n\t\n\t// Exports\n\treturn {\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\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 45 */,\n/* 46 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {/** Renders the color picker used e.g. in the tool form **/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils ) {\n\t return Backbone.View.extend({\n\t colors: {\n\t standard: ['c00000','ff0000','ffc000','ffff00','92d050','00b050','00b0f0','0070c0','002060','7030a0'],\n\t base : ['ffffff','000000','eeece1','1f497d','4f81bd','c0504d','9bbb59','8064a2','4bacc6','f79646'],\n\t theme :[['f2f2f2','7f7f7f','ddd9c3','c6d9f0','dbe5f1','f2dcdb','ebf1dd','e5e0ec','dbeef3','fdeada'],\n\t ['d8d8d8','595959','c4bd97','8db3e2','b8cce4','e5b9b7','d7e3bc','ccc1d9','b7dde8','fbd5b5'],\n\t ['bfbfbf','3f3f3f','938953','548dd4','95b3d7','d99694','c3d69b','b2a2c7','92cddc','fac08f'],\n\t ['a5a5a5','262626','494429','17365d','366092','953734','76923c','5f497a','31859b','e36c09'],\n\t ['7f7f7e','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]\n\t },\n\t\n\t initialize : function( options ) {\n\t this.options = Utils.merge( options, {} );\n\t this.setElement( this._template() );\n\t this.$panel = this.$( '.ui-color-picker-panel' );\n\t this.$view = this.$( '.ui-color-picker-view' );\n\t this.$value = this.$( '.ui-color-picker-value' );\n\t this.$header = this.$( '.ui-color-picker-header' );\n\t this._build();\n\t this.visible = false;\n\t this.value( this.options.value );\n\t this.$boxes = this.$( '.ui-color-picker-box' );\n\t var self = this;\n\t this.$boxes.on( 'click', function() {\n\t self.value( $( this ).css( 'background-color' ) );\n\t self.$header.trigger( 'click' );\n\t } );\n\t this.$header.on( 'click', function() {\n\t self.visible = !self.visible;\n\t if ( self.visible ) {\n\t self.$view.fadeIn( 'fast' );\n\t } else {\n\t self.$view.fadeOut( 'fast' );\n\t }\n\t } );\n\t },\n\t\n\t /** Get/set value */\n\t value : function ( new_val ) {\n\t if ( new_val !== undefined && new_val !== null ) {\n\t this.$value.css( 'background-color', new_val );\n\t this.$( '.ui-color-picker-box' ).empty();\n\t this.$( this._getValue() ).html( this._templateCheck() );\n\t this.options.onchange && this.options.onchange( new_val );\n\t }\n\t return this._getValue();\n\t },\n\t\n\t /** Get value from dom */\n\t _getValue: function() {\n\t var rgb = this.$value.css( 'background-color' );\n\t rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n\t if ( rgb ) {\n\t function hex( x ) {\n\t return ( '0' + parseInt( x ).toString( 16 ) ).slice( -2 );\n\t }\n\t return '#' + hex( rgb[ 1] ) + hex( rgb[ 2 ] ) + hex( rgb[ 3 ] );\n\t } else {\n\t return null;\n\t }\n\t },\n\t\n\t /** Build color panel */\n\t _build: function() {\n\t var $content = this._content({\n\t label : 'Theme Colors',\n\t colors : this.colors.base,\n\t padding : 10\n\t });\n\t for ( var i in this.colors.theme ) {\n\t var line_def = {};\n\t if ( i == 0 ) {\n\t line_def[ 'bottom' ] = true;\n\t } else {\n\t if ( i != this.colors.theme.length - 1 ) {\n\t line_def[ 'top' ] = true;\n\t line_def[ 'bottom' ] = true;\n\t } else {\n\t line_def[ 'top' ] = true;\n\t line_def[ 'padding' ] = 5;\n\t }\n\t }\n\t line_def[ 'colors' ] = this.colors.theme[ i ];\n\t this._content( line_def );\n\t }\n\t this._content({\n\t label : 'Standard Colors',\n\t colors : this.colors.standard,\n\t padding : 5\n\t });\n\t },\n\t\n\t /** Create content */\n\t _content: function( options ) {\n\t var label = options.label;\n\t var colors = options.colors;\n\t var padding = options.padding;\n\t var top = options.top;\n\t var bottom = options.bottom;\n\t var $content = $( this._templateContent() );\n\t var $label = $content.find( '.label' );\n\t if ( options.label ) {\n\t $label.html( options.label );\n\t } else {\n\t $label.hide();\n\t }\n\t var $line = $content.find( '.line' );\n\t this.$panel.append( $content );\n\t for ( var i in colors ) {\n\t var $box = $( this._templateBox( colors[ i ] ) );\n\t if ( top ) {\n\t $box.css( 'border-top', 'none' );\n\t $box.css( 'border-top-left-radius', '0px' );\n\t $box.css( 'border-top-right-radius', '0px' );\n\t }\n\t if ( bottom ) {\n\t $box.css( 'border-bottom', 'none' );\n\t $box.css( 'border-bottom-left-radius', '0px' );\n\t $box.css( 'border-bottom-right-radius', '0px' );\n\t }\n\t $line.append( $box );\n\t }\n\t if (padding) {\n\t $line.css( 'padding-bottom', padding );\n\t }\n\t return $content;\n\t },\n\t\n\t /** Check icon */\n\t _templateCheck: function() {\n\t return '
    ';\n\t },\n\t\n\t /** Content template */\n\t _templateContent: function() {\n\t return '
    ' +\n\t '
    ' +\n\t '
    ' +\n\t '
    ';\n\t },\n\t\n\t /** Box template */\n\t _templateBox: function( color ) {\n\t return '
    ';\n\t },\n\t\n\t /** Main template */\n\t _template: function() {\n\t return '
    ' +\n\t '
    ' +\n\t '
    ' +\n\t '
    Select a color
    ' +\n\t '
    ' +\n\t '
    ' +\n\t '
    ' +\n\t '
    '\n\t '
    ';\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__(3), __webpack_require__(1)))\n\n/***/ },\n/* 47 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {/** This class creates/wraps a drill down element. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(20) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Options ) {\n\t\n\tvar View = Options.BaseIcons.extend({\n\t initialize: function( options ) {\n\t options.type = options.display || 'checkbox';\n\t options.multiple = ( options.type == 'checkbox' );\n\t Options.BaseIcons.prototype.initialize.call( this, options );\n\t },\n\t\n\t /** Set states for selected values */\n\t _setValue: function ( new_value ) {\n\t Options.BaseIcons.prototype._setValue.call( this, new_value );\n\t if ( new_value !== undefined && new_value !== null && this.header_index ) {\n\t var self = this;\n\t var values = $.isArray( new_value ) ? new_value : [ new_value ];\n\t _.each( values, function( v ) {\n\t var list = self.header_index[ v ];\n\t _.each( list, function( element ) {\n\t self._setState( element, true );\n\t });\n\t });\n\t }\n\t },\n\t\n\t /** Expand/collapse a sub group */\n\t _setState: function ( header_id, is_expanded ) {\n\t var $button = this.$( '.button-' + header_id );\n\t var $subgroup = this.$( '.subgroup-' + header_id );\n\t $button.data( 'is_expanded', is_expanded );\n\t if ( is_expanded ) {\n\t $subgroup.show();\n\t $button.removeClass( 'fa-plus-square' ).addClass( 'fa-minus-square' );\n\t } else {\n\t $subgroup.hide();\n\t $button.removeClass( 'fa-minus-square' ).addClass( 'fa-plus-square' );\n\t }\n\t },\n\t\n\t /** Template to create options tree */\n\t _templateOptions: function() {\n\t var self = this;\n\t this.header_index = {};\n\t\n\t // attach event handler\n\t function attach( $el, header_id ) {\n\t var $button = $el.find( '.button-' + header_id );\n\t $button.on( 'click', function() {\n\t self._setState( header_id, !$button.data( 'is_expanded' ) );\n\t });\n\t }\n\t\n\t // recursive function which iterates through options\n\t function iterate ( $tmpl, options, header ) {\n\t header = header || [];\n\t for ( i in options ) {\n\t var level = options[ i ];\n\t var has_options = level.options && level.options.length > 0;\n\t var new_header = header.slice( 0 );\n\t self.header_index[ level.value ] = new_header.slice( 0 );\n\t var $group = $( '
    ' );\n\t if ( has_options ) {\n\t var header_id = Utils.uid();\n\t var $button = $( '' ).addClass( 'button-' + header_id ).addClass( 'ui-drilldown-button fa fa-plus-square' );\n\t var $subgroup = $( '
    ' ).addClass( 'subgroup-' + header_id ).addClass( 'ui-drilldown-subgroup' );\n\t $group.append( $( '
    ' )\n\t .append( $button )\n\t .append( self._templateOption( { label: level.name, value: level.value } ) ) );\n\t new_header.push( header_id );\n\t iterate ( $subgroup, level.options, new_header );\n\t $group.append( $subgroup );\n\t attach( $group, header_id );\n\t } else {\n\t $group.append( self._templateOption( { label: level.name, value: level.value } ) );\n\t }\n\t $tmpl.append( $group );\n\t }\n\t }\n\t\n\t // iterate through options and create dom\n\t var $tmpl = $( '
    ' );\n\t iterate( $tmpl, this.model.get( 'data' ) );\n\t return $tmpl;\n\t },\n\t\n\t /** Template for drill down view */\n\t _template: function() {\n\t return $( '
    ' ).addClass( 'ui-options-list drilldown-container' ).attr( 'id', this.model.id );\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 48 */\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__(7), __webpack_require__(21) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Ui, Select ) {\n\t\n\t/** Batch mode variations */\n\tvar Batch = { DISABLED: 'disabled', ENABLED: 'enabled', LINKED: 'linked' };\n\t\n\t/** List of available content selectors options */\n\tvar Configurations = {\n\t data: [\n\t { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED },\n\t { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.LINKED },\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.LINKED } ],\n\t data_multiple: [\n\t { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.DISABLED },\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n\t data_collection: [\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n\t workflow_data: [\n\t { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED } ],\n\t workflow_data_multiple: [\n\t { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.DISABLED } ],\n\t workflow_data_collection: [\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n\t module_data: [\n\t { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED },\n\t { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.ENABLED } ],\n\t module_data_collection: [\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED },\n\t { src: 'hdca', icon: 'fa-folder', tooltip: 'Multiple collections', multiple: true, batch: Batch.ENABLED } ]\n\t};\n\t\n\t/** View for hda and hdca content selector ui elements */\n\tvar View = Backbone.View.extend({\n\t initialize : function( options ) {\n\t var self = this;\n\t this.model = options && options.model || new Backbone.Model({\n\t src_labels : { 'hda' : 'dataset', 'hdca': 'dataset collection' },\n\t pagelimit : 100\n\t }).set( options );\n\t this.setElement( $( '
    ' ).addClass( 'ui-select-content' ) );\n\t this.button_product = new Ui.RadioButton.View( {\n\t value : 'false',\n\t data : [ { icon: 'fa fa-chain', value: 'false',\n\t tooltip: 'Linked inputs will be run in matched order with other datasets e.g. use this for matching forward and reverse reads.' },\n\t { icon: 'fa fa-chain-broken', value: 'true',\n\t tooltip: 'Unlinked dataset inputs will be run against *all* other inputs.' } ] } );\n\t var $batch_div = $( '
    ' ).addClass( 'ui-form-info' )\n\t .append( $( '' ).addClass( 'fa fa-sitemap' ) )\n\t .append( $( '' ).html( 'This is a batch mode input field. Separate jobs will be triggered for each dataset selection.' ) );\n\t this.$batch = {\n\t linked : $batch_div.clone(),\n\t enabled : $batch_div.clone().append( $( '
    ' )\n\t .append( $( '
    ' ).addClass( 'ui-form-title' ).html( 'Batch options:' ) )\n\t .append( this.button_product.$el ) )\n\t .append( $( '
    ' ).css( 'clear', 'both' ) )\n\t };\n\t\n\t // track current history elements\n\t this.history = {};\n\t\n\t // add listeners\n\t this.listenTo( this.model, 'change:data', this._changeData, this );\n\t this.listenTo( this.model, 'change:wait', this._changeWait, this );\n\t this.listenTo( this.model, 'change:current', this._changeCurrent, this );\n\t this.listenTo( this.model, 'change:value', this._changeValue, this );\n\t this.listenTo( this.model, 'change:type change:optional change:multiple change:extensions', this._changeType, this );\n\t this.render();\n\t\n\t // add change event\n\t this.on( 'change', function() { options.onchange && options.onchange( self.value() ) } );\n\t },\n\t\n\t render: function() {\n\t this._changeType();\n\t this._changeValue();\n\t this._changeWait();\n\t },\n\t\n\t /** Indicate that select fields are being updated */\n\t wait: function() {\n\t this.model.set( 'wait', true );\n\t },\n\t\n\t /** Indicate that the options update has been completed */\n\t unwait: function() {\n\t this.model.set( 'wait', false );\n\t },\n\t\n\t /** Update data representing selectable options */\n\t update: function( options ) {\n\t this.model.set( 'data', options );\n\t },\n\t\n\t /** Return the currently selected dataset values */\n\t value: function ( new_value ) {\n\t new_value !== undefined && this.model.set( 'value', new_value );\n\t var current = this.model.get( 'current' );\n\t if ( this.config[ current ] ) {\n\t var id_list = this.fields[ current ].value();\n\t if (id_list !== null) {\n\t id_list = $.isArray( id_list ) ? id_list : [ id_list ];\n\t if ( id_list.length > 0 ) {\n\t var result = this._batch( { values: [] } );\n\t for ( var i in id_list ) {\n\t var details = this.history[ id_list[ i ] + '_' + this.config[ current ].src ];\n\t if ( details ) {\n\t result.values.push( details );\n\t } else {\n\t Galaxy.emit.debug( 'ui-select-content::value()', 'Requested details not found for \\'' + id_list[ i ] + '\\'.' );\n\t return null;\n\t }\n\t }\n\t result.values.sort( function( a, b ) { return a.hid - b.hid } );\n\t return result;\n\t }\n\t }\n\t } else {\n\t Galaxy.emit.debug( 'ui-select-content::value()', 'Invalid value/source \\'' + new_value + '\\'.' );\n\t }\n\t return null;\n\t },\n\t\n\t /** Change of current select field */\n\t _changeCurrent: function() {\n\t var self = this;\n\t _.each( this.fields, function( field, i ) {\n\t if ( self.model.get( 'current' ) == i ) {\n\t field.$el.show();\n\t _.each( self.$batch, function( $batchfield, batchmode ) {\n\t $batchfield[ self.config[ i ].batch == batchmode ? 'show' : 'hide' ]();\n\t });\n\t self.button_type.value( i );\n\t } else {\n\t field.$el.hide();\n\t }\n\t });\n\t },\n\t\n\t /** Change of type */\n\t _changeType: function() {\n\t var self = this;\n\t\n\t // identify selector type identifier i.e. [ flavor ]_[ type ]_[ multiple ]\n\t var config_id = ( this.model.get( 'flavor' ) ? this.model.get( 'flavor' ) + '_' : '' ) +\n\t String( this.model.get( 'type' ) ) + ( this.model.get( 'multiple' ) ? '_multiple' : '' );\n\t if ( Configurations[ config_id ] ) {\n\t this.config = Configurations[ config_id ];\n\t } else {\n\t this.config = Configurations[ 'data' ];\n\t Galaxy.emit.debug( 'ui-select-content::_changeType()', 'Invalid configuration/type id \\'' + config_id + '\\'.' );\n\t }\n\t\n\t // prepare extension component of error message\n\t var data = self.model.get( 'data' );\n\t var extensions = Utils.textify( this.model.get( 'extensions' ) );\n\t var src_labels = this.model.get( 'src_labels' );\n\t\n\t // build views\n\t this.fields = [];\n\t this.button_data = [];\n\t _.each( this.config, function( c, i ) {\n\t self.button_data.push({\n\t value : i,\n\t icon : c.icon,\n\t tooltip : c.tooltip\n\t });\n\t self.fields.push(\n\t new Select.View({\n\t optional : self.model.get( 'optional' ),\n\t multiple : c.multiple,\n\t searchable : !c.multiple || ( data && data[ c.src ] && data[ c.src ].length > self.model.get( 'pagelimit' ) ),\n\t selectall : false,\n\t error_text : 'No ' + ( extensions ? extensions + ' ' : '' ) + ( src_labels[ c.src ] || 'content' ) + ' available.',\n\t onchange : function() {\n\t self.trigger( 'change' );\n\t }\n\t })\n\t );\n\t });\n\t this.button_type = new Ui.RadioButton.View({\n\t value : this.model.get( 'current' ),\n\t data : this.button_data,\n\t onchange: function( value ) {\n\t self.model.set( 'current', value );\n\t self.trigger( 'change' );\n\t }\n\t });\n\t\n\t // append views\n\t this.$el.empty();\n\t var button_width = 0;\n\t if ( this.fields.length > 1 ) {\n\t this.$el.append( this.button_type.$el );\n\t button_width = Math.max( 0, this.fields.length * 36 ) + 'px';\n\t }\n\t _.each( this.fields, function( field ) {\n\t self.$el.append( field.$el.css( { 'margin-left': button_width } ) );\n\t });\n\t _.each( this.$batch, function( $batchfield, batchmode ) {\n\t self.$el.append( $batchfield.css( { 'margin-left': button_width } ) );\n\t });\n\t this.model.set( 'current', 0 );\n\t this._changeCurrent();\n\t this._changeData();\n\t },\n\t\n\t /** Change of wait flag */\n\t _changeWait: function() {\n\t var self = this;\n\t _.each( this.fields, function( field ) { field[ self.model.get( 'wait' ) ? 'wait' : 'unwait' ]() } );\n\t },\n\t\n\t /** Change of available options */\n\t _changeData: function() {\n\t var options = this.model.get( 'data' );\n\t var self = this;\n\t var select_options = {};\n\t _.each( options, function( items, src ) {\n\t select_options[ src ] = [];\n\t _.each( items, function( item ) {\n\t select_options[ src ].push({\n\t hid : item.hid,\n\t keep : item.keep,\n\t label: item.hid + ': ' + item.name,\n\t value: item.id\n\t });\n\t self.history[ item.id + '_' + src ] = item;\n\t });\n\t });\n\t _.each( this.config, function( c, i ) {\n\t select_options[ c.src ] && self.fields[ i ].add( select_options[ c.src ], function( a, b ) { return b.hid - a.hid } );\n\t });\n\t },\n\t\n\t /** Change of incoming value */\n\t _changeValue: function () {\n\t var new_value = this.model.get( 'value' );\n\t if ( new_value && new_value.values && new_value.values.length > 0 ) {\n\t // create list with content ids\n\t var list = [];\n\t _.each( new_value.values, function( value ) {\n\t list.push( value.id );\n\t });\n\t // sniff first suitable field type from config list\n\t var src = new_value.values[ 0 ].src;\n\t var multiple = new_value.values.length > 1;\n\t for( var i = 0; i < this.config.length; i++ ) {\n\t var field = this.fields[ i ];\n\t var c = this.config[ i ];\n\t if ( c.src == src && [ multiple, true ].indexOf( c.multiple ) !== -1 ) {\n\t this.model.set( 'current', i );\n\t field.value( list );\n\t break;\n\t }\n\t }\n\t } else {\n\t _.each( this.fields, function( field ) {\n\t field.value( null );\n\t });\n\t }\n\t },\n\t\n\t /** Assists in identifying the batch mode */\n\t _batch: function( result ) {\n\t result[ 'batch' ] = false;\n\t var current = this.model.get( 'current' );\n\t var config = this.config[ current ];\n\t if ( config.src == 'hdca' && !config.multiple ) {\n\t var hdca = this.history[ this.fields[ current ].value() + '_hdca' ];\n\t if ( hdca && hdca.map_over_type ) {\n\t result[ 'batch' ] = true;\n\t }\n\t }\n\t if ( config.batch == Batch.LINKED || config.batch == Batch.ENABLED ) {\n\t result[ 'batch' ] = true;\n\t if ( config.batch == Batch.ENABLED && this.button_product.value() === 'true' ) {\n\t result[ 'product' ] = true;\n\t }\n\t }\n\t return result;\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone) {// dependencies\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(19)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Utils, List) {\n\t\n\t/**\n\t * FTP file selector\n\t */\n\tvar View = Backbone.View.extend({\n\t // initialize\n\t initialize : function(options) {\n\t // link this\n\t var self = this;\n\t\n\t // create ui-list view to keep track of selected ftp files\n\t this.ftpfile_list = new List.View({\n\t name : 'file',\n\t optional : options.optional,\n\t multiple : options.multiple,\n\t onchange : function() {\n\t options.onchange && options.onchange(self.value());\n\t }\n\t });\n\t\n\t // create elements\n\t this.setElement(this.ftpfile_list.$el);\n\t\n\t // initial fetch of ftps\n\t Utils.get({\n\t url : Galaxy.root + 'api/remote_files',\n\t success : function(response) {\n\t var data = [];\n\t for (var i in response) {\n\t data.push({\n\t value : response[i]['path'],\n\t label : response[i]['path']\n\t });\n\t }\n\t self.ftpfile_list.update(data);\n\t }\n\t });\n\t },\n\t\n\t /** Return/Set currently selected ftp datasets */\n\t value: function(val) {\n\t return this.ftpfile_list.value(val);\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 50 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone) {// dependencies\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(7), __webpack_require__(52), __webpack_require__(19)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Utils, Ui, Table, List) {\n\t\n\t// collection of libraries\n\tvar Libraries = Backbone.Collection.extend({\n\t url: Galaxy.root + 'api/libraries?deleted=false'\n\t});\n\t\n\t// collection of dataset\n\tvar LibraryDatasets = Backbone.Collection.extend({\n\t initialize: function() {\n\t var self = this;\n\t this.config = new Backbone.Model({ library_id: null });\n\t this.config.on('change', function() {\n\t self.fetch({ reset: true });\n\t });\n\t },\n\t url: function() {\n\t return Galaxy.root + 'api/libraries/' + this.config.get('library_id') + '/contents';\n\t }\n\t});\n\t\n\t// hda/hdca content selector ui element\n\tvar View = Backbone.View.extend({\n\t // initialize\n\t initialize : function(options) {\n\t // link this\n\t var self = this;\n\t\n\t // collections\n\t this.libraries = new Libraries();\n\t this.datasets = new LibraryDatasets();\n\t\n\t // link app and options\n\t this.options = options;\n\t\n\t // select field for the library\n\t // TODO: Remove this once the library API supports searching for library datasets\n\t this.library_select = new Ui.Select.View({\n\t onchange : function(value) {\n\t self.datasets.config.set('library_id', value);\n\t }\n\t });\n\t\n\t // create ui-list view to keep track of selected data libraries\n\t this.dataset_list = new List.View({\n\t name : 'dataset',\n\t optional : options.optional,\n\t multiple : options.multiple,\n\t onchange : function() {\n\t self.trigger('change');\n\t }\n\t });\n\t\n\t // add reset handler for fetched libraries\n\t this.libraries.on('reset', function() {\n\t var data = [];\n\t self.libraries.each(function(model) {\n\t data.push({\n\t value : model.id,\n\t label : model.get('name')\n\t });\n\t });\n\t self.library_select.update(data);\n\t });\n\t\n\t // add reset handler for fetched library datasets\n\t this.datasets.on('reset', function() {\n\t var data = [];\n\t var library_current = self.library_select.text();\n\t if (library_current !== null) {\n\t self.datasets.each(function(model) {\n\t if (model.get('type') === 'file') {\n\t data.push({\n\t value : model.id,\n\t label : model.get('name')\n\t });\n\t }\n\t });\n\t }\n\t self.dataset_list.update(data);\n\t });\n\t\n\t // add change event. fires on trigger\n\t this.on('change', function() {\n\t options.onchange && options.onchange(self.value());\n\t });\n\t\n\t // create elements\n\t this.setElement(this._template());\n\t this.$('.library-select').append(this.library_select.$el);\n\t this.$el.append(this.dataset_list.$el);\n\t\n\t // initial fetch of libraries\n\t this.libraries.fetch({\n\t reset: true,\n\t success: function() {\n\t self.library_select.trigger('change');\n\t if (self.options.value !== undefined) {\n\t self.value(self.options.value);\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** Return/Set currently selected library datasets */\n\t value: function(val) {\n\t return this.dataset_list.value(val);\n\t },\n\t\n\t /** Template */\n\t _template: function() {\n\t return '
    ' +\n\t '
    ' +\n\t 'Select Library' +\n\t '' +\n\t '
    ' +\n\t '
    ';\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 51 */\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_AMD_DEFINE_RESULT__ = function( Utils ) {\n\tvar View = Backbone.View.extend({\n\t initialize : function( options ) {\n\t var self = this;\n\t this.options = Utils.merge( options, {\n\t id : Utils.uid(),\n\t min : null,\n\t max : null,\n\t step : null,\n\t precise : false,\n\t split : 10000\n\t } );\n\t\n\t // create new element\n\t this.setElement( this._template( this.options ) );\n\t\n\t // determine wether to use the slider\n\t this.useslider = this.options.max !== null && this.options.min !== null && this.options.max > this.options.min;\n\t\n\t // set default step size\n\t if ( this.options.step === null ) {\n\t this.options.step = 1.0;\n\t if ( this.options.precise && this.useslider ) {\n\t this.options.step = ( this.options.max - this.options.min ) / this.options.split;\n\t }\n\t }\n\t\n\t // create slider if min and max are defined properly\n\t if ( this.useslider ) {\n\t this.$slider = this.$( '#slider' );\n\t this.$slider.slider( this.options );\n\t this.$slider.on( 'slide', function ( event, ui ) {\n\t self.value( ui.value );\n\t });\n\t } else {\n\t this.$( '.ui-form-slider-text' ).css( 'width', '100%' );\n\t }\n\t\n\t // link text input field\n\t this.$text = this.$( '#text' );\n\t\n\t // set initial value\n\t this.options.value !== undefined && ( this.value( this.options.value ) );\n\t\n\t // add text field event\n\t var pressed = [];\n\t this.$text.on( 'change', function () {\n\t self.value( $( this ).val() );\n\t });\n\t this.$text.on( 'keyup', function( e ) {\n\t pressed[e.which] = false;\n\t self.options.onchange && self.options.onchange( $( this ).val() );\n\t });\n\t this.$text.on( 'keydown', function ( e ) {\n\t var v = e.which;\n\t pressed[ v ] = true;\n\t if ( self.options.is_workflow && pressed[ 16 ] && v == 52 ) {\n\t self.value( '$' )\n\t event.preventDefault();\n\t } else if (!( v == 8 || v == 9 || v == 13 || v == 37 || v == 39 || ( v >= 48 && v <= 57 && !pressed[ 16 ] ) || ( v >= 96 && v <= 105 )\n\t || ( ( v == 190 || v == 110 ) && $( this ).val().indexOf( '.' ) == -1 && self.options.precise )\n\t || ( ( v == 189 || v == 109 ) && $( this ).val().indexOf( '-' ) == -1 )\n\t || self._isParameter( $( this ).val() )\n\t || pressed[ 91 ] || pressed[ 17 ] ) ) {\n\t event.preventDefault();\n\t }\n\t });\n\t },\n\t\n\t /** Set and Return the current value\n\t */\n\t value : function ( new_val ) {\n\t if ( new_val !== undefined ) {\n\t if ( new_val !== null && new_val !== '' && !this._isParameter( new_val ) ) {\n\t isNaN( new_val ) && ( new_val = 0 );\n\t this.options.max !== null && ( new_val = Math.min( new_val, this.options.max ) );\n\t this.options.min !== null && ( new_val = Math.max( new_val, this.options.min ) );\n\t }\n\t this.$slider && this.$slider.slider( 'value', new_val );\n\t this.$text.val( new_val );\n\t this.options.onchange && this.options.onchange( new_val );\n\t }\n\t return this.$text.val();\n\t },\n\t\n\t /** Return true if the field contains a workflow parameter i.e. $('name')\n\t */\n\t _isParameter: function( value ) {\n\t return this.options.is_workflow && String( value ).substring( 0, 1 ) === '$';\n\t },\n\t\n\t /** Slider template\n\t */\n\t _template: function( options ) {\n\t return '
    ' +\n\t '' +\n\t '
    ' +\n\t '
    ';\n\t }\n\t});\n\t\n\treturn {\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__(3), __webpack_require__(1)))\n\n/***/ },\n/* 52 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {// dependencies\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Utils) {\n\t\n\t/**\n\t * This class creates a ui table element.\n\t */\n\tvar View = Backbone.View.extend({\n\t // current row\n\t row: null,\n\t \n\t // count rows\n\t row_count: 0,\n\t \n\t // defaults options\n\t optionsDefault: {\n\t content : 'No content available.',\n\t onchange : null,\n\t ondblclick : null,\n\t onconfirm : null,\n\t cls : 'ui-table',\n\t cls_tr : ''\n\t },\n\t \n\t // events\n\t events : {\n\t 'click' : '_onclick',\n\t 'dblclick' : '_ondblclick'\n\t },\n\t \n\t // initialize\n\t initialize : function(options) {\n\t // configure options\n\t this.options = Utils.merge(options, this.optionsDefault);\n\t \n\t // create new element\n\t var $el = $(this._template(this.options));\n\t \n\t // link sub-elements\n\t this.$thead = $el.find('thead');\n\t this.$tbody = $el.find('tbody');\n\t this.$tmessage = $el.find('tmessage');\n\t \n\t // set element\n\t this.setElement($el);\n\t \n\t // initialize row\n\t this.row = this._row();\n\t },\n\t \n\t // add header cell\n\t addHeader: function($el) {\n\t var wrapper = $('
    ' +\n\t '' +\n\t '' +\n\t '
    ' +\n\t '' + options.content + '' +\n\t '
    ';\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 53 */\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_AMD_DEFINE_RESULT__ = function() {\n\t var Model = Backbone.Model.extend({\n\t defaults: {\n\t extension : 'auto',\n\t genome : '?',\n\t url_paste : '',\n\t status : 'init',\n\t info : null,\n\t file_name : '',\n\t file_mode : '',\n\t file_size : 0,\n\t file_type : null,\n\t file_path : '',\n\t file_data : null,\n\t percentage : 0,\n\t space_to_tab : false,\n\t to_posix_lines : true,\n\t enabled : true\n\t },\n\t reset: function( attr ) {\n\t this.clear().set( this.defaults ).set( attr );\n\t }\n\t });\n\t var Collection = Backbone.Collection.extend( { model: Model } );\n\t return { Model: Model, Collection : Collection };\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/* 54 */,\n/* 55 */\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 defines a queue to ensure that multiple deferred callbacks are executed sequentially.\n\t */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils ) {\n\treturn Backbone.Model.extend({\n\t initialize: function(){\n\t this.active = {};\n\t this.last = null;\n\t },\n\t\n\t /** Adds a callback to the queue. Upon execution a deferred object is parsed to the callback i.e. callback( deferred ).\n\t * If the callback does not take any arguments, the deferred is resolved instantly.\n\t */\n\t execute: function( callback ) {\n\t var self = this;\n\t var id = Utils.uid();\n\t var has_deferred = callback.length > 0;\n\t\n\t // register process\n\t this.active[ id ] = true;\n\t\n\t // deferred process\n\t var process = $.Deferred();\n\t process.promise().always(function() {\n\t delete self.active[ id ];\n\t has_deferred && Galaxy.emit.debug( 'deferred::execute()', this.state().charAt(0).toUpperCase() + this.state().slice(1) + ' ' + id );\n\t });\n\t\n\t // deferred queue\n\t $.when( this.last ).always(function() {\n\t if ( self.active[ id ] ) {\n\t has_deferred && Galaxy.emit.debug( 'deferred::execute()', 'Running ' + id );\n\t callback( process );\n\t !has_deferred && process.resolve();\n\t } else {\n\t process.reject();\n\t }\n\t });\n\t this.last = process.promise();\n\t },\n\t\n\t /** Resets the promise queue. All currently queued but unexecuted callbacks/promises will be rejected.\n\t */\n\t reset: function() {\n\t Galaxy.emit.debug('deferred::execute()', 'Reset');\n\t for ( var i in this.active ) {\n\t this.active[ i ] = false;\n\t }\n\t },\n\t\n\t /** Returns true if all processes are done.\n\t */\n\t ready: function() {\n\t return $.isEmptyObject( this.active );\n\t }\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__(3), __webpack_require__(1)))\n\n/***/ },\n/* 56 */,\n/* 57 */,\n/* 58 */,\n/* 59 */,\n/* 60 */,\n/* 61 */,\n/* 62 */,\n/* 63 */,\n/* 64 */,\n/* 65 */,\n/* 66 */\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__ = [\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(15),\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( baseMVC, _l ){\n\t// =============================================================================\n\t/** A view on any model that has a 'annotation' attribute\n\t */\n\tvar AnnotationEditor = Backbone.View\n\t .extend( baseMVC.LoggableMixin )\n\t .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 })\n\t .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 '
    ',\n\t _.escape( annotation ),\n\t '
    '\n\t ].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(){ return [ 'AnnotationEditor(', this.model + '', ')' ].join(''); }\n\t});\n\t// =============================================================================\n\treturn {\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2)))\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(jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(2),\n\t __webpack_require__(3),\n\t __webpack_require__(6),\n\t], __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\tvar 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 ){ defaults.order = this.order; }\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\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 === '' ){ return; }\n\t // json to python\n\t if( v === true ){ v = 'True'; }\n\t if( v === false ){ v = 'False'; }\n\t if( v === null ){ v = 'None'; }\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 ) ){ throw new Error( 'unknown order: ' + order ); }\n\t // if( _.isUndefined( comparator ) ){ return; }\n\t if( comparator === collection.comparator ){ return; }\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 */\n\tvar 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 )\n\t .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/**\n\t * A Collection that will load more elements without reseting.\n\t */\n\tvar 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 )\n\t .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\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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __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(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(76),\n\t __webpack_require__(30),\n\t __webpack_require__(29),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_VIEW, DC_MODEL, DC_LI, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'collections';\n\t/* =============================================================================\n\tTODO:\n\t\n\t============================================================================= */\n\t/** @class non-editable, read-only View/Controller for a dataset collection.\n\t */\n\tvar _super = LIST_VIEW.ModelListPanel;\n\tvar 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 },\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\n\t//------------------------------------------------------------------------------ TEMPLATES\n\tCollectionView.prototype.templates = (function(){\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate([\n\t '
    ',\n\t '',\n\t\n\t '
    ',\n\t '
    <%- collection.name || collection.element_identifier %>
    ',\n\t '
    ',\n\t '<% if( collection.collection_type === \"list\" ){ %>',\n\t _l( 'a list of datasets' ),\n\t '<% } else if( collection.collection_type === \"paired\" ){ %>',\n\t _l( 'a pair of datasets' ),\n\t '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n\t _l( 'a list of paired datasets' ),\n\t '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n\t _l( 'a list of dataset lists' ),\n\t '<% } %>',\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ], '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\n\t// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\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(_, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(12),\n\t __webpack_require__(32),\n\t __webpack_require__(77),\n\t __webpack_require__(66),\n\t __webpack_require__(22),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( STATES, DATASET_LI, TAGS, ANNOTATIONS, faIconButton, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t//==============================================================================\n\tvar _super = DATASET_LI.DatasetListItemView;\n\t/** @class Editing view for DatasetAssociation.\n\t */\n\tvar 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([\n\t this._renderEditButton(),\n\t this._renderDeleteButton()\n\t ]);\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 )\n\t || ( !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 : this.model.urls.edit,\n\t target : this.linkTarget,\n\t faIcon : 'fa-pencil',\n\t classes : 'edit-btn'\n\t };\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 /** 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() ]);\n\t case STATES.OK:\n\t case STATES.FAILED_METADATA:\n\t return actions.concat([ this._renderRerunButton(), this._renderVisualizationsButton() ]);\n\t }\n\t return actions.concat([ this._renderRerunButton() ]);\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 : this.model.urls.report_error,\n\t classes : 'report-error-btn',\n\t target : this.linkTarget,\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 // create webpack split point in order to load the tool form async\n\t // TODO: split not working (tool loads fine)\n\t !/* require */(/* empty */function() { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [ __webpack_require__(18) ]; (function( ToolForm ){\n\t var form = new ToolForm.View({ 'job_id' : creating_job });\n\t form.deferred.execute( function(){\n\t Galaxy.app.display( form );\n\t });\n\t }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}());\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() )\n\t || ( !this.hasUser )\n\t || ( !this.model.hasData() )\n\t || ( _.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 ){ return; }\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(){ this.render(); },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow : function(){ view.tagsEditorShown = true; },\n\t onhide : function(){ view.tagsEditorShown = false; },\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 ){ this.tagsEditor.toggle( true ); }\n\t },\n\t\n\t /** Render the annotation display/control */\n\t _renderAnnotation : function( $where ){\n\t if( !this.hasUser ){ return; }\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(){ this.render(); },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow : function(){ view.annotationEditorShown = true; },\n\t onhide : function(){ view.annotationEditorShown = false; },\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 ){ this.annotationEditor.toggle( true ); }\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' ) === '?'\n\t && !this.model.isDeletedOrPurged() ){\n\t var editableDbkey = $( '?' )\n\t .attr( 'href', this.model.urls.edit )\n\t .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 ){ this.trigger( 'edit', this, ev ); },\n\t 'click .delete-btn' : function( ev ){ this.trigger( 'delete', this, ev ); },\n\t 'click .rerun-btn' : function( ev ){ this.trigger( 'rerun', this, ev ); },\n\t 'click .report-err-btn' : function( ev ){ this.trigger( 'report-err', this, ev ); },\n\t 'click .visualization-btn' : function( ev ){ this.trigger( 'visualize', this, ev ); },\n\t 'click .dbkey a' : function( ev ){ this.trigger( 'edit', this, ev ); }\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\n\t// ............................................................................ TEMPLATES\n\t/** underscore templates */\n\tDatasetListItemEdit.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\" ){ %>',\n\t '',\n\t '<% } %>'\n\t ], '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 '
    ',\n\t _l( 'This dataset has been deleted' ),\n\t '
    ', _l( 'Undelete it' ), '',\n\t '<% if( view.purgeAllowed ){ %>',\n\t '
    ',\n\t _l( 'Permanently remove it from disk' ),\n\t '',\n\t '<% } %>',\n\t '
    ',\n\t '<% } %>'\n\t ], 'dataset' )\n\t });\n\t\n\t var visualizationsTemplate = BASE_MVC.wrapTemplate([\n\t '<% if( visualizations.length === 1 ){ %>',\n\t '\"',\n\t ' target=\"<%- visualizations[0].target %>\" title=\"', _l( 'Visualize in' ),\n\t ' <%- visualizations[0].html %>\">',\n\t '',\n\t '',\n\t\n\t '<% } else { %>',\n\t '
    ',\n\t '',\n\t '',\n\t '',\n\t '',\n\t '
    ',\n\t '<% } %>'\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\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, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(12),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( STATES, BASE_MVC, _l ){\n\t'use strict';\n\t\n\tvar logNamespace = 'dataset';\n\t//==============================================================================\n\tvar 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\tvar DatasetAssociation = Backbone.Model\n\t .extend( BASE_MVC.LoggableMixin )\n\t .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 ){ return {}; }\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?to_ext=' + this.get( 'file_ext' ),\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 /** 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' ) ){ return true; }\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 )\n\t .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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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 '\n\t + '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 : [\n\t 'name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'\n\t ],\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//==============================================================================\n\t/** @class Backbone collection for dataset associations.\n\t */\n\tvar 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 ){ return item.get('id'); });\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 ){ return dataset.hasDetails(); });\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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 71 */\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__ = [\n\t __webpack_require__(32),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DATASET_LI, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _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\tvar 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\tHDAListItemView.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 '',\n\t '
    ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- dataset.hid %> ',\n\t '<%- dataset.name %>',\n\t '
    ',\n\t '
    '\n\t ], '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 ){ %>',\n\t '
    ',\n\t _l( 'This dataset has been hidden' ),\n\t '
    ',\n\t '<% } %>'\n\t ], '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\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 72 */\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__ = [\n\t __webpack_require__(70),\n\t __webpack_require__(74),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DATASET, HISTORY_CONTENT, BASE_MVC, _l ){\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _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\tvar 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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 73 */\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__ = [\n\t __webpack_require__(12),\n\t __webpack_require__(29),\n\t __webpack_require__(68),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( STATES, DC_LI, DC_VIEW, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _super = DC_LI.DCListItemView;\n\t/** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n\t */\n\tvar 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\n\t this.listenTo( this.model, {\n\t 'change:populated change:visible' : function( model, options ){ this.render(); },\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\tHDCAListItemView.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 ){ %>',\n\t '
    ',\n\t _l( 'This collection has been hidden' ),\n\t '
    ',\n\t '<% } %>'\n\t ], '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 '',\n\t '
    ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- collection.hid %> ',\n\t '<%- collection.name %>',\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 74 */\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__ = [\n\t __webpack_require__(12),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __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\tvar 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 )\n\t && ( this.get( 'deleted' ) || this.get( 'purged' ) ) ){\n\t isVisible = false;\n\t }\n\t if( ( !includeHidden )\n\t && ( !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/'\n\t + 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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 75 */\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__ = [\n\t __webpack_require__(40),\n\t __webpack_require__(41),\n\t __webpack_require__(67),\n\t __webpack_require__(4),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __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\tvar History = Backbone.Model\n\t .extend( BASE_MVC.LoggableMixin )\n\t .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 : [\n\t 'name', 'annotation', 'tags'\n\t ],\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 ){ return this; }\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\n\t ? function(){ return self.contents.fetchPage( 0 ); }\n\t : function(){ return self.contents.fetchUpdated( lastUpdateTime ); };\n\t // note: if there was no previous update time, all summary contents will be fetched\n\t return fetchFn()\n\t .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 ){ return; }\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\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()\n\t .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\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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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()\n\t .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//==============================================================================\n\tvar _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\tvar 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(){ return this.urlRoot; },\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//==============================================================================\n\treturn {\n\t History : History,\n\t HistoryCollection : HistoryCollection\n\t};}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 76 */\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__ = [\n\t __webpack_require__(42),\n\t __webpack_require__(127),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(85)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_ITEM, LoadingIndicator, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'list';\n\t/* ============================================================================\n\tTODO:\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\tvar 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', [\n\t function( next ){\n\t panel.$el.fadeOut( speed, next );\n\t },\n\t function( next ){\n\t panel._swapNewRender( $newRender );\n\t next();\n\t },\n\t function( next ){\n\t panel.$el.fadeIn( speed, next );\n\t },\n\t function( next ){\n\t panel.trigger( 'rendered', panel );\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 this.$el.empty().attr( 'class', this.className ).append( $newRender.children() );\n\t if( this.selecting ){ this.showSelectors( 0 ); }\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 = $([\n\t '
    ',\n\t '',\n\t '
      ', '
    ',\n\t '
    '\n\t ].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 ){ 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 ){ return undefined; }\n\t var view = panel._createItemView( model );\n\t // console.log( 'adding and rendering:', modelIndex, view.toString() );\n\t\n\t $( view ).queue( 'fx', [\n\t 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 },\n\t function( next ){\n\t panel._attachView( view, modelIndex );\n\t next();\n\t }\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 ){ return v.model === model; });\n\t if( !view ){ return undefined; }\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', [\n\t function( next ){\n\t view.$el.fadeOut( panel.fxSpeed, next );\n\t },\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 ]);\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 ){ return v.model.id === id; });\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 ){ return ( viewA )?( [ viewA ] ):( [] ); }\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 ){ return []; }\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 )?\n\t this.views.slice( indexA, indexB + 1 ) :\n\t 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 ){ return this; }\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 ){ return this; }\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\tListPanel.prototype.templates = (function(){\n\t\n\t var elTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ]);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate([\n\t '
    ',\n\t '
    ',\n\t '
    <%- view.title %>
    ',\n\t '
    ',\n\t '
    <%- view.subtitle %>
    ',\n\t // buttons, controls go here\n\t '
    ',\n\t // deleted msg, etc.\n\t '
    ',\n\t\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t\n\t // show when selectors are shown\n\t '
    ',\n\t '
    ',\n\t '',\n\t '',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    '\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//=============================================================================\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\tvar 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 ]\n\t || attributes.collection\n\t || 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\tModelListPanel.prototype.templates = (function(){\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate([\n\t '
    ',\n\t '
    ',\n\t //TODO: this is really the only difference - consider factoring titlebar out\n\t '
    <%- model.name %>
    ',\n\t '
    ',\n\t '
    <%- view.subtitle %>
    ',\n\t '
    ',\n\t '
    ',\n\t\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t\n\t '
    ',\n\t '
    ',\n\t '',\n\t '',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ]);\n\t\n\t return _.extend( _.clone( ListPanel.prototype.templates ), {\n\t controls : controlsTemplate\n\t });\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 77 */\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__ = [\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( baseMVC, _l ){\n\t// =============================================================================\n\t/** A view on any model that has a 'tags' attribute (a list of tag strings)\n\t * Incorporates the select2 jQuery plugin for tags display/editing:\n\t * http://ivaynberg.github.io/select2/\n\t */\n\tvar TagsEditor = Backbone.View\n\t .extend( baseMVC.LoggableMixin )\n\t .extend( baseMVC.HiddenUntilActivatedViewMixin ).extend({\n\t\n\t tagName : 'div',\n\t className : 'tags-display',\n\t\n\t /** Set up listeners, parse options */\n\t initialize : function( options ){\n\t //console.debug( this, options );\n\t // only listen to the model only for changes to tags - re-render\n\t this.listenTo( this.model, 'change:tags', 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 this.$input().select2({\n\t placeholder : 'Add tags',\n\t width : '100%',\n\t tags : function(){\n\t // initialize possible tags in the dropdown based on all the tags the user has used so far\n\t return view._getTagsUsed();\n\t }\n\t });\n\t\n\t this._setUpBehaviors();\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 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 ''\n\t ].join( '' );\n\t },\n\t\n\t /** @returns {String} the sorted, comma-separated tags from the model */\n\t tagsToCSV : function(){\n\t var tagsArray = this.model.get( 'tags' );\n\t if( !_.isArray( tagsArray ) || _.isEmpty( tagsArray ) ){\n\t return '';\n\t }\n\t return tagsArray.map( function( tag ){\n\t return _.escape( tag );\n\t }).sort().join( ',' );\n\t },\n\t\n\t /** @returns {jQuery} the input for this view */\n\t $input : function(){\n\t return this.$el.find( 'input.tags-input' );\n\t },\n\t\n\t /** @returns {String[]} all tags used by the current user */\n\t _getTagsUsed : function(){\n\t//TODO: global\n\t return Galaxy.user.get( 'tags_used' );\n\t },\n\t\n\t /** set up any event listeners on the view's DOM (mostly handled by select2) */\n\t _setUpBehaviors : function(){\n\t var view = this;\n\t this.$input().on( 'change', function( event ){\n\t // save the model's tags in either remove or added event\n\t view.model.save({ tags: event.val }, { silent: true });\n\t // if it's new, add the tag to the users tags\n\t if( event.added ){\n\t //??: solve weird behavior in FF on test.galaxyproject.org where\n\t // event.added.text is string object: 'String{ 0=\"o\", 1=\"n\", 2=\"e\" }'\n\t view._addNewTagToTagsUsed( event.added.text + '' );\n\t }\n\t });\n\t },\n\t\n\t /** add a new tag (if not already there) to the list of all tags used by the user\n\t * @param {String} newTag the tag to add to the list of used\n\t */\n\t _addNewTagToTagsUsed : function( newTag ){\n\t//TODO: global\n\t var tagsUsed = Galaxy.user.get( 'tags_used' );\n\t if( !_.contains( tagsUsed, newTag ) ){\n\t tagsUsed.push( newTag );\n\t tagsUsed.sort();\n\t Galaxy.user.set( 'tags_used', tagsUsed );\n\t }\n\t },\n\t\n\t /** shut down event listeners and remove this view's DOM */\n\t remove : function(){\n\t this.$input.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(){ return [ 'TagsEditor(', this.model + '', ')' ].join(''); }\n\t});\n\t\n\t// =============================================================================\n\treturn {\n\t TagsEditor : TagsEditor\n\t};\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2)))\n\n/***/ },\n/* 78 */\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__ = [\n\t __webpack_require__(5)\n\t], __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\tError modals meant to replace the o-so-easy alerts.\n\t\n\tThese are currently styled as errormessages but use the Galaxy.modal\n\tinfrastructure to be shown/closed. They're capable of showing details in a\n\ttogglable dropdown and the details are formatted in a pre.\n\t\n\tExample:\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\tThere 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\tExamples:\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\tvar CONTACT_MSG = _l( 'Please contact a Galaxy administrator if the problem persists.' );\n\tvar DEFAULT_AJAX_ERR_MSG = _l( 'An error occurred while updating information with the server.' );\n\tvar 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\tfunction _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(){ Galaxy.modal.hide(); } },\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' )\n\t .hide().appendTo( Galaxy.modal.$( '.modal-content' ) )\n\t .append([\n\t $( '

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

    ' ).text( JSON.stringify( details, null, '  ' ) )\n\t            ]);\n\t\n\t        $( '' )\n\t            .appendTo( Galaxy.modal.$( '.buttons' ) )\n\t            .click( function(){ Galaxy.modal.$( '.error-details' ).toggle(); });\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\tfunction errorModal( message, title, details ){\n\t    if( !message ){ return; }\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// ----------------------------------------------------------------------------\n\t/** display a modal when the user may be offline */\n\tfunction offlineErrorModal(){\n\t    return errorModal(\n\t        _l( 'You appear to be offline. Please check your connection and try again.' ),\n\t        _l( 'Offline?' )\n\t    );\n\t}\n\t\n\t\n\t// ----------------------------------------------------------------------------\n\t/** 502 messages that should be displayed when galaxy is restarting */\n\tfunction badGatewayErrorModal(){\n\t    return errorModal(\n\t        _l( 'Galaxy is currently unreachable. Please try again in a few minutes.' ) + ' ' + CONTACT_MSG,\n\t        _l( 'Cannot connect to Galaxy' )\n\t    );\n\t}\n\t\n\t\n\t// ----------------------------------------------------------------------------\n\t/** display a modal (with details) about a failed Backbone ajax operation */\n\tfunction 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\tfunction _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//=============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 79 */\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__ = [\n\t    //jquery\n\t    //backbone\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function(){\n\t// =============================================================================\n\t/**\n\t * view for a popup menu\n\t */\n\tvar PopupMenu = Backbone.View.extend({\n\t//TODO: maybe better as singleton off the Galaxy obj\n\t    /** Cache the desired button element and options, set up the button click handler\n\t     *  NOTE: attaches this view as HTML/jQ data on the button for later use.\n\t     */\n\t    initialize: function( $button, options ){\n\t        // default settings\n\t        this.$button = $button;\n\t        if( !this.$button.length ){\n\t            this.$button = $( '
    ' );\n\t }\n\t this.options = options || [];\n\t this.$button.data( 'popupmenu', this );\n\t\n\t // set up button click -> open menu behavior\n\t var menu = this;\n\t this.$button.click( function( event ){\n\t // if there's already a menu open, remove it\n\t $( '.popmenu-wrapper' ).remove();\n\t menu._renderAndShow( event );\n\t return false;\n\t });\n\t },\n\t\n\t // render the menu, append to the page body at the click position, and set up the 'click-away' handlers, show\n\t _renderAndShow: function( clickEvent ){\n\t this.render();\n\t this.$el.appendTo( 'body' ).css( this._getShownPosition( clickEvent )).show();\n\t this._setUpCloseBehavior();\n\t },\n\t\n\t // render the menu\n\t // this menu doesn't attach itself to the DOM ( see _renderAndShow )\n\t render: function(){\n\t // render the menu body absolute and hidden, fill with template\n\t this.$el.addClass( 'popmenu-wrapper' ).hide()\n\t .css({ position : 'absolute' })\n\t .html( this.template( this.$button.attr( 'id' ), this.options ));\n\t\n\t // set up behavior on each link/anchor elem\n\t if( this.options.length ){\n\t var menu = this;\n\t //precondition: there should be one option per li\n\t this.$el.find( 'li' ).each( function( i, li ){\n\t var option = menu.options[i];\n\t\n\t // if the option has 'func', call that function when the anchor is clicked\n\t if( option.func ){\n\t $( this ).children( 'a.popupmenu-option' ).click( function( event ){\n\t option.func.call( menu, event, option );\n\t // We must preventDefault otherwise clicking \"cancel\"\n\t // on a purge or something still navigates and causes\n\t // the action.\n\t event.preventDefault();\n\t // bubble up so that an option click will call the close behavior\n\t });\n\t }\n\t });\n\t }\n\t return this;\n\t },\n\t\n\t template : function( id, options ){\n\t return [\n\t '
      ', this._templateOptions( options ), '
    '\n\t ].join( '' );\n\t },\n\t\n\t _templateOptions : function( options ){\n\t if( !options.length ){\n\t return '
  • (no options)
  • ';\n\t }\n\t return _.map( options, function( option ){\n\t if( option.divider ){\n\t return '
  • ';\n\t } else if( option.header ){\n\t return [ '
  • ', option.html, '
  • ' ].join( '' );\n\t }\n\t var href = option.href || 'javascript:void(0);',\n\t target = ( option.target )?( ' target=\"' + option.target + '\"' ):( '' ),\n\t check = ( option.checked )?( '' ):( '' );\n\t return [\n\t '
  • ',\n\t check, option.html,\n\t '
  • '\n\t ].join( '' );\n\t }).join( '' );\n\t },\n\t\n\t // get the absolute position/offset for the menu\n\t _getShownPosition : function( clickEvent ){\n\t\n\t // display menu horiz. centered on click...\n\t var menuWidth = this.$el.width();\n\t var x = clickEvent.pageX - menuWidth / 2 ;\n\t\n\t // adjust to handle horiz. scroll and window dimensions ( draw entirely on visible screen area )\n\t x = Math.min( x, $( document ).scrollLeft() + $( window ).width() - menuWidth - 5 );\n\t x = Math.max( x, $( document ).scrollLeft() + 5 );\n\t return {\n\t top: clickEvent.pageY,\n\t left: x\n\t };\n\t },\n\t\n\t // bind an event handler to all available frames so that when anything is clicked\n\t // the menu is removed from the DOM and the event handler unbinds itself\n\t _setUpCloseBehavior: function(){\n\t var menu = this;\n\t//TODO: alternately: focus hack, blocking overlay, jquery.blockui\n\t\n\t // function to close popup and unbind itself\n\t function closePopup( event ){\n\t $( document ).off( 'click.close_popup' );\n\t if( window && window.parent !== window ){\n\t try {\n\t $( window.parent.document ).off( \"click.close_popup\" );\n\t } catch( err ){}\n\t } else {\n\t try {\n\t $( 'iframe#galaxy_main' ).contents().off( \"click.close_popup\" );\n\t } catch( err ){}\n\t }\n\t menu.remove();\n\t }\n\t\n\t $( 'html' ).one( \"click.close_popup\", closePopup );\n\t if( window && window.parent !== window ){\n\t try {\n\t $( window.parent.document ).find( 'html' ).one( \"click.close_popup\", closePopup );\n\t } catch( err ){}\n\t } else {\n\t try {\n\t $( 'iframe#galaxy_main' ).contents().one( \"click.close_popup\", closePopup );\n\t } catch( err ){}\n\t }\n\t },\n\t\n\t // add a menu option/item at the given index\n\t addItem: function( item, index ){\n\t // append to end if no index\n\t index = ( index >= 0 ) ? index : this.options.length;\n\t this.options.splice( index, 0, item );\n\t return this;\n\t },\n\t\n\t // remove a menu option/item at the given index\n\t removeItem: function( index ){\n\t if( index >=0 ){\n\t this.options.splice( index, 1 );\n\t }\n\t return this;\n\t },\n\t\n\t // search for a menu option by its html\n\t findIndexByHtml: function( html ){\n\t for( var i = 0; i < this.options.length; i++ ){\n\t if( _.has( this.options[i], 'html' ) && ( this.options[i].html === html )){\n\t return i;\n\t }\n\t }\n\t return null;\n\t },\n\t\n\t // search for a menu option by its html\n\t findItemByHtml: function( html ){\n\t return this.options[( this.findIndexByHtml( html ))];\n\t },\n\t\n\t // string representation\n\t toString: function(){\n\t return 'PopupMenu';\n\t }\n\t});\n\t/** shortcut to new for when you don't need to preserve the ref */\n\tPopupMenu.create = function _create( $button, options ){\n\t return new PopupMenu( $button, options );\n\t};\n\t\n\t// -----------------------------------------------------------------------------\n\t// the following class functions are bridges from the original make_popupmenu and make_popup_menus\n\t// to the newer backbone.js PopupMenu\n\t\n\t/** Create a PopupMenu from simple map initial_options activated by clicking button_element.\n\t * Converts initial_options to object array used by PopupMenu.\n\t * @param {jQuery|DOMElement} button_element element which, when clicked, activates menu\n\t * @param {Object} initial_options map of key -> values, where\n\t * key is option text, value is fn to call when option is clicked\n\t * @returns {PopupMenu} the PopupMenu created\n\t */\n\tPopupMenu.make_popupmenu = function( button_element, initial_options ){\n\t var convertedOptions = [];\n\t _.each( initial_options, function( optionVal, optionKey ){\n\t var newOption = { html: optionKey };\n\t\n\t // keys with null values indicate: header\n\t if( optionVal === null ){ // !optionVal? (null only?)\n\t newOption.header = true;\n\t\n\t // keys with function values indicate: a menu option\n\t } else if( jQuery.type( optionVal ) === 'function' ){\n\t newOption.func = optionVal;\n\t }\n\t //TODO:?? any other special optionVals?\n\t // there was no divider option originally\n\t convertedOptions.push( newOption );\n\t });\n\t return new PopupMenu( $( button_element ), convertedOptions );\n\t};\n\t\n\t/** Find all anchors in $parent (using selector) and covert anchors into a PopupMenu options map.\n\t * @param {jQuery} $parent the element that contains the links to convert to options\n\t * @param {String} selector jq selector string to find links\n\t * @returns {Object[]} the options array to initialize a PopupMenu\n\t */\n\t//TODO: lose parent and selector, pass in array of links, use map to return options\n\tPopupMenu.convertLinksToOptions = function( $parent, selector ){\n\t $parent = $( $parent );\n\t selector = selector || 'a';\n\t var options = [];\n\t $parent.find( selector ).each( function( elem, i ){\n\t var option = {}, $link = $( elem );\n\t\n\t // convert link text to the option text (html) and the href into the option func\n\t option.html = $link.text();\n\t if( $link.attr( 'href' ) ){\n\t var linkHref = $link.attr( 'href' ),\n\t linkTarget = $link.attr( 'target' ),\n\t confirmText = $link.attr( 'confirm' );\n\t\n\t option.func = function(){\n\t // if there's a \"confirm\" attribute, throw up a confirmation dialog, and\n\t // if the user cancels - do nothing\n\t if( ( confirmText ) && ( !confirm( confirmText ) ) ){ return; }\n\t\n\t // if there's no confirm attribute, or the user accepted the confirm dialog:\n\t switch( linkTarget ){\n\t // relocate the center panel\n\t case '_parent':\n\t window.parent.location = linkHref;\n\t break;\n\t\n\t // relocate the entire window\n\t case '_top':\n\t window.top.location = linkHref;\n\t break;\n\t\n\t // relocate this panel\n\t default:\n\t window.location = linkHref;\n\t }\n\t };\n\t }\n\t options.push( option );\n\t });\n\t return options;\n\t};\n\t\n\t/** Create a single popupmenu from existing DOM button and anchor elements\n\t * @param {jQuery} $buttonElement the element that when clicked will open the menu\n\t * @param {jQuery} $menuElement the element that contains the anchors to convert into a menu\n\t * @param {String} menuElementLinkSelector jq selector string used to find anchors to be made into menu options\n\t * @returns {PopupMenu} the PopupMenu (Backbone View) that can render, control the menu\n\t */\n\tPopupMenu.fromExistingDom = function( $buttonElement, $menuElement, menuElementLinkSelector ){\n\t $buttonElement = $( $buttonElement );\n\t $menuElement = $( $menuElement );\n\t var options = PopupMenu.convertLinksToOptions( $menuElement, menuElementLinkSelector );\n\t // we're done with the menu (having converted it to an options map)\n\t $menuElement.remove();\n\t return new PopupMenu( $buttonElement, options );\n\t};\n\t\n\t/** Create all popupmenus within a document or a more specific element\n\t * @param {DOMElement} parent the DOM element in which to search for popupmenus to build (defaults to document)\n\t * @param {String} menuSelector jq selector string to find popupmenu menu elements (defaults to \"div[popupmenu]\")\n\t * @param {Function} buttonSelectorBuildFn the function to build the jq button selector.\n\t * Will be passed $menuElement, parent.\n\t * (Defaults to return '#' + $menuElement.attr( 'popupmenu' ); )\n\t * @returns {PopupMenu[]} array of popupmenus created\n\t */\n\tPopupMenu.make_popup_menus = function( parent, menuSelector, buttonSelectorBuildFn ){\n\t parent = parent || document;\n\t // orig. Glx popupmenu menus have a (non-std) attribute 'popupmenu'\n\t // which contains the id of the button that activates the menu\n\t menuSelector = menuSelector || 'div[popupmenu]';\n\t // default to (orig. Glx) matching button to menu by using the popupmenu attr of the menu as the id of the button\n\t buttonSelectorBuildFn = buttonSelectorBuildFn || function( $menuElement, parent ){\n\t return '#' + $menuElement.attr( 'popupmenu' );\n\t };\n\t\n\t // aggregate and return all PopupMenus\n\t var popupMenusCreated = [];\n\t $( parent ).find( menuSelector ).each( function(){\n\t var $menuElement = $( this ),\n\t $buttonElement = $( parent ).find( buttonSelectorBuildFn( $menuElement, parent ) );\n\t popupMenusCreated.push( PopupMenu.fromDom( $buttonElement, $menuElement ) );\n\t $buttonElement.addClass( 'popup' );\n\t });\n\t return popupMenusCreated;\n\t};\n\t\n\t\n\t// =============================================================================\n\t return PopupMenu;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 80 */\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 ) { self._fill( ftp_files ) },\n\t error : function() { self._fill(); }\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 ( 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 ( 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() { self.options.onchange( ftp_file ) } );\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 '' +\n\t '
    ' +\n\t '' + options.path + '' +\n\t '' + Utils.bytesToString( options.size ) + '' +\n\t '' + options.ctime + '' +\n\t '';\n\t },\n\t\n\t /** Template of table */\n\t _templateTable: function() {\n\t return 'Available files: ' +\n\t '' +\n\t '' +\n\t '  ' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '
    NameSizeCreated
    ';\n\t },\n\t\n\t /** Template of info message */\n\t _templateInfo: function() {\n\t return '
    ' +\n\t 'Your FTP directory does not contain any files.' +\n\t '
    ';\n\t },\n\t\n\t /** Template of main view */\n\t _template: function() {\n\t return '
    ' +\n\t '
    ' +\n\t '
    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 }\n\t });\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\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(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' )\n\t .addClass( self.model.get( parameter.id ) && self.options.class_check || self.options.class_uncheck )\n\t .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 wrapper.append($el);\n this.row.append(wrapper);\n },\n \n // header\n appendHeader: function() {\n // append header row\n this.$thead.append(this.row);\n\n // row\n this.row = $('');\n },\n \n // add row cell\n add: function($el, width, align) {\n var wrapper = $('');\n if (width) {\n wrapper.css('width', width);\n }\n if (align) {\n wrapper.css('text-align', align);\n }\n wrapper.append($el);\n this.row.append(wrapper);\n },\n \n // append\n append: function(id, fade) {\n this._commit(id, fade, false);\n },\n \n // prepend\n prepend: function(id, fade) {\n this._commit(id, fade, true);\n },\n \n // get element\n get: function(id) {\n return this.$el.find('#' + id);\n },\n \n // delete\n del: function(id) {\n var item = this.$tbody.find('#' + id);\n if (item.length > 0) {\n item.remove();\n this.row_count--;\n this._refresh();\n }\n },\n\n // delete all\n delAll: function() {\n this.$tbody.empty();\n this.row_count = 0;\n this._refresh();\n },\n \n // value\n value: function(new_value) {\n // get current id/value\n this.before = this.$tbody.find('.current').attr('id');\n \n // check if new_value is defined\n if (new_value !== undefined) {\n this.$tbody.find('tr').removeClass('current');\n if (new_value) {\n this.$tbody.find('#' + new_value).addClass('current');\n }\n }\n \n // get current id/value\n var after = this.$tbody.find('.current').attr('id');\n if(after === undefined) {\n return null;\n } else {\n // fire onchange\n if (after != this.before && this.options.onchange) {\n this.options.onchange(new_value);\n }\n \n // return current value\n return after;\n }\n },\n \n // size\n size: function() {\n return this.$tbody.find('tr').length;\n },\n \n // commit\n _commit: function(id, fade, prepend) {\n // remove previous item with same id\n this.del(id);\n \n // add\n this.row.attr('id', id);\n \n // add row\n if (prepend) {\n this.$tbody.prepend(this.row);\n } else {\n this.$tbody.append(this.row);\n }\n \n // fade mode\n if (fade) {\n this.row.hide();\n this.row.fadeIn();\n }\n \n // row\n this.row = this._row();\n \n // row count\n this.row_count++;\n this._refresh();\n },\n \n // create new row\n _row: function() {\n return $('');\n },\n \n // onclick\n _onclick: function(e) {\n // get values\n var old_value = this.value();\n var new_value = $(e.target).closest('tr').attr('id');\n if (new_value != ''){\n // check equality\n if (new_value && old_value != new_value) {\n if (this.options.onconfirm) {\n this.options.onconfirm(new_value);\n } else {\n this.value(new_value);\n }\n }\n }\n },\n\n // ondblclick\n _ondblclick: function(e) {\n var value = this.value();\n if (value && this.options.ondblclick) {\n this.options.ondblclick(value);\n }\n },\n \n // refresh\n _refresh: function() {\n if (this.row_count == 0) {\n this.$tmessage.show();\n } else {\n this.$tmessage.hide();\n }\n },\n \n // load html template\n _template: function(options) {\n return '
    ' +\n '
    ' ).append( $checkbox ) )\n\t .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__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 82 */,\n/* 83 */,\n/* 84 */\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\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 ){ return this; }\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 })\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 85 */\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\n\t}(function () {\n\t var _l = window._l || function( s ){ return s; };\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\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 )\n\t || ( options.minSearchLen && searchTerms.length >= options.minSearchLen ) ){\n\t search.call( this, event, searchTerms );\n\t }\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('') )\n\t .tooltip({ placement: 'bottom' })\n\t .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('') )\n\t .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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 86 */,\n/* 87 */\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\tfunction 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 ) { return -1; }\n\t else if ( xD > yD ) { return 1; }\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) { return -1; }\n\t else if (oFxNcL > oFyNcL) { return 1; }\n\t }\n\t return 0;\n\t}\n\t\n\treturn naturalSort;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n\n\n/***/ },\n/* 88 */\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 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 if (xhr.responseText) {\n\t try {\n\t response = jQuery.parseJSON(xhr.responseText);\n\t } catch (e) {\n\t response = xhr.responseText;\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 + ')');\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) { alert(m); },\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) { add(files); },\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) { opts.success(index, message); process();},\n\t error : function(message) { opts.error(index, message); process();},\n\t progress : function(percentage) { opts.progress(index, percentage); }\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\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 89 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(_) {var RightPanel = __webpack_require__( 10 ).RightPanel,\n\t Ui = __webpack_require__( 7 ),\n\t historyOptionsMenu = __webpack_require__( 116 );\n\t CurrentHistoryView = __webpack_require__( 113 ).CurrentHistoryView,\n\t _l = __webpack_require__( 5 );\n\t\n\t/** the right hand panel in the analysis page that shows the current history */\n\tvar HistoryPanel = RightPanel.extend({\n\t\n\t title : _l( 'History' ),\n\t\n\t initialize : function( options ){\n\t RightPanel.prototype.initialize.call( this, options );\n\t this.options = _.pick( options, 'userIsAnonymous', 'allow_user_dataset_purge', 'galaxyRoot' );\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 : options.allow_user_dataset_purge,\n\t linkTarget : 'galaxy_main'\n\t });\n\t },\n\t\n\t /** override to change footer selector */\n\t $toggleButton : function(){\n\t return this.$( '.footer > .panel-collapse' );\n\t },\n\t\n\t render : function(){\n\t RightPanel.prototype.render.call( this );\n\t this.optionsMenu = historyOptionsMenu( this.$( '#history-options-button' ), {\n\t anonymous : this.options.userIsAnonymous,\n\t purgeAllowed : this.options.allow_user_dataset_purge,\n\t root : this.options.galaxyRoot\n\t });\n\t this.$( '> .header .buttons [title]' ).tooltip({ placement: 'bottom' });\n\t this.historyView.setElement( this.$( '.history-panel' ) );\n\t this.$el.attr( 'class', 'history-right-panel' );\n\t },\n\t\n\t /** override to add buttons */\n\t _templateHeader: function( data ){\n\t var historyUrl = this.options.galaxyRoot + 'history';\n\t var multiUrl = this.options.galaxyRoot + 'history/view_multiple';\n\t return [\n\t '
    ',\n\t '
    ',\n\t // this button re-fetches the history and contents and re-renders the history panel\n\t '',\n\t // opens a drop down menu with history related functions (like view all, delete, share, etc.)\n\t '',\n\t !this.options.userIsAnonymous?\n\t [ '' ].join('') : '',\n\t '
    ',\n\t '
    ', _.escape( this.title ), '
    ',\n\t '
    ',\n\t ].join('');\n\t },\n\t\n\t /** add history view div */\n\t _templateBody : function( data ){\n\t return [\n\t '
    ',\n\t ].join('');\n\t },\n\t\n\t /** override to use simplified selector */\n\t _templateFooter: function( data ){\n\t return [\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t ].join('');\n\t },\n\t\n\t events : {\n\t 'click #history-refresh-button' : '_clickRefresh',\n\t // override to change footer selector\n\t 'mousedown .footer > .drag' : '_mousedownDragHandler',\n\t 'click .footer > .panel-collapse' : 'toggle'\n\t },\n\t\n\t _clickRefresh : function( ev ){\n\t ev.preventDefault();\n\t this.historyView.loadCurrentHistory();\n\t },\n\t\n\t toString : function(){ return 'HistoryPanel'; }\n\t});\n\t\n\tmodule.exports = HistoryPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 90 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function($, _) {var LeftPanel = __webpack_require__( 10 ).LeftPanel,\n\t Tools = __webpack_require__( 44 ),\n\t Upload = __webpack_require__( 123 ),\n\t _l = __webpack_require__( 5 );\n\t\n\t/* Builds the tool menu panel on the left of the analysis page */\n\tvar ToolPanel = LeftPanel.extend({\n\t\n\t title : _l( 'Tools' ),\n\t\n\t initialize: function( options ){\n\t LeftPanel.prototype.initialize.call( this, options );\n\t this.log( this + '.initialize:', options );\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 = options.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 search_url : options.search_url,\n\t hidden : false\n\t });\n\t var tools = new Tools.ToolCollection( options.toolbox );\n\t this.tool_panel = new Tools.ToolPanel({\n\t tool_search : tool_search,\n\t tools : tools,\n\t layout : options.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.uploadButton = new Upload({\n\t nginx_upload_path : options.nginx_upload_path,\n\t ftp_upload_site : options.ftp_upload_site,\n\t default_genome : options.default_genome,\n\t default_extension : options.default_extension,\n\t });\n\t },\n\t\n\t render : function(){\n\t var self = this;\n\t LeftPanel.prototype.render.call( self );\n\t self.$( '.panel-header-buttons' ).append( self.uploadButton.$el );\n\t\n\t // if there are tools, render panel and display everything\n\t if (self.tool_panel.get( 'layout' ).size() > 0) {\n\t self.tool_panel_view.render();\n\t //TODO: why the hide/show?\n\t self.$( '.toolMenu' ).show();\n\t }\n\t self.$( '.toolMenuContainer' ).prepend( self.tool_panel_view.$el );\n\t\n\t self._renderWorkflowMenu();\n\t\n\t // if a tool link has the minsizehint attribute, handle it here (gen. by hiding the tool panel)\n\t self.$( 'a[minsizehint]' ).click( function() {\n\t if ( parent.handle_minwidth_hint ) {\n\t parent.handle_minwidth_hint( $( self ).attr( 'minsizehint' ) );\n\t }\n\t });\n\t },\n\t\n\t /** build the dom for the workflow portion of the tool menu */\n\t _renderWorkflowMenu : function(){\n\t var self = this;\n\t // add internal workflow list\n\t self.$( '#internal-workflows' ).append( self._templateTool({\n\t title : _l( 'All workflows' ),\n\t href : 'workflow/list_for_run'\n\t }));\n\t _.each( self.stored_workflow_menu_entries, function( menu_entry ){\n\t self.$( '#internal-workflows' ).append( self._templateTool({\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 [\n\t '
    ',\n\t // global\n\t '', tool.title, '',\n\t '
    '\n\t ].join('');\n\t },\n\t\n\t /** override to include inital menu dom and workflow section */\n\t _templateBody : function(){\n\t return [\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '', _l( 'Search did not match any tools.' ), '',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '', _l( 'Workflows' ), '',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ].join('');\n\t },\n\t\n\t toString : function(){ return 'ToolPanel'; }\n\t});\n\t\n\tmodule.exports = ToolPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 91 */,\n/* 92 */,\n/* 93 */,\n/* 94 */,\n/* 95 */,\n/* 96 */,\n/* 97 */,\n/* 98 */,\n/* 99 */,\n/* 100 */,\n/* 101 */,\n/* 102 */,\n/* 103 */,\n/* 104 */,\n/* 105 */,\n/* 106 */\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__ = [\n\t __webpack_require__(29),\n\t __webpack_require__(69),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DC_LI, DATASET_LI_EDIT, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t//==============================================================================\n\tvar DCListItemView = DC_LI.DCListItemView;\n\t/** @class Edit view for DatasetCollection.\n\t */\n\tvar 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//==============================================================================\n\tvar DCEListItemView = DC_LI.DCEListItemView;\n\t/** @class Read only view for DatasetCollectionElement.\n\t */\n\tvar 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//==============================================================================\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\tvar 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\tDatasetDCEListItemEdit.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//==============================================================================\n\t/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 107 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(68),\n\t __webpack_require__(30),\n\t __webpack_require__(106),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(15),\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t/* =============================================================================\n\tTODO:\n\t\n\t============================================================================= */\n\t/** @class editable View/Controller for a dataset collection.\n\t */\n\tvar _super = DC_VIEW.CollectionView;\n\tvar 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 ){ return; }\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 //TODO: extract\n\t var panel = this,\n\t nameSelector = '> .controls .name';\n\t $where.find( nameSelector )\n\t .attr( 'title', _l( 'Click to rename collection' ) )\n\t .tooltip({ placement: 'bottom' })\n\t .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 })\n\t .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 // ........................................................................ 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// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class Editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class Editable (roughly since these collections are immutable),\n\t * View/Controller for a dataset collection.\n\t */\n\tvar 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// =============================================================================\n\t/** @class editable, View/Controller for a list of pairs dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class View/Controller for a list of lists dataset collection. */\n\tvar 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//==============================================================================\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/***/ },\n/* 108 */\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__ = [\n\t __webpack_require__(131),\n\t __webpack_require__(87),\n\t __webpack_require__(31),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(84)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( levenshteinDistance, naturalSort, LIST_COLLECTION_CREATOR, baseMVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'collections';\n\t/* ============================================================================\n\tTODO:\n\t\n\t\n\tPROGRAMMATICALLY:\n\tcurrPanel.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\tvar 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([\n\t '<%- pair.forward.name %>',\n\t '',\n\t '<%- pair.name %>',\n\t '',\n\t '<%- pair.reverse.name %>'\n\t ].join('')),\n\t\n\t render : function(){\n\t this.$el\n\t .attr( 'draggable', true )\n\t .data( 'pair', this.pair )\n\t .html( this.template({ pair: this.pair }) )\n\t .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 ){ ev = ev.originalEvent; }\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// ============================================================================\n\t/** returns an autopair function that uses the provided options.match function */\n\tfunction 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 ){ params.listB.splice( aInBIndex, 1 ); }\n\t if( bInAIndex !== -1 ){ params.listA.splice( bInAIndex, 1 ); }\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 = [\n\t new RegExp( this.filters[0] ),\n\t new RegExp( this.filters[1] )\n\t ];\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, 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= 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// ============================================================================\n\t/** An interface for building collections of paired datasets.\n\t */\n\tvar PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).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._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 ){ return naturalSort( a.name, b.name ); });\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 ){ return low; }\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 ){ mid++; }\n\t return mid;\n\t\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(){ return 1.0; },\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(){ return this.matchPercentage; },\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(){ return this.matchPercentage; },\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, 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 ){ return s1; }\n\t if( i === s2.length ){ return s2; }\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(\n\t fwdName.replace( new RegExp( this.filters[0] ), '' ),\n\t revName.replace( new RegExp( this.filters[1] ), '' )\n\t );\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 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 })\n\t .always( function(){\n\t creator.blocking = false;\n\t })\n\t .fail( function( xhr, status, message ){\n\t creator._ajaxErrHandler( xhr, status, message );\n\t })\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.' )\n\t + _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( PairedCollectionCreator.templates.main() );\n\t this.$el.empty().html( PairedCollectionCreator.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( PairedCollectionCreator.templates.header() )\n\t .find( '.help-content' ).prepend( $( PairedCollectionCreator.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] )\n\t .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( PairedCollectionCreator.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, $rev, $prd = [],\n\t split = this._splitByFilters();\n\t // update unpaired counts\n\t this.$( '.forward-column .title' )\n\t .text([ split[0].length, _l( 'unpaired forward' ) ].join( ' ' ));\n\t this.$( '.forward-column .unpaired-info' )\n\t .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[0].length ) );\n\t this.$( '.reverse-column .title' )\n\t .text([ split[1].length, _l( 'unpaired reverse' ) ].join( ' ' ));\n\t this.$( '.reverse-column .unpaired-info' )\n\t .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 )\n\t && ( 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 )\n\t .add( this.$( '.unpaired-columns .paired-column .column-datasets' ).append( $prd ) )\n\t .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 $( '
  • ')\n\t .attr( 'id', 'dataset-' + dataset.id )\n\t .addClass( 'dataset unpaired' )\n\t .attr( 'draggable', true )\n\t .addClass( dataset.selected? 'selected': '' )\n\t .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' )\n\t .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 = $( '
    ' )\n\t .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 = $( '
    ' )\n\t .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 ){ return; }\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' )\n\t .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' )\n\t .append( pairView.render().$el )\n\t .append([\n\t ''\n\t ].join( '' ));\n\t });\n\t },\n\t /** a message to display when none paired */\n\t _renderPairedEmpty : function(){\n\t var $msg = $( '
    ' )\n\t .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 /** render the footer, completion controls, and cancel controls */\n\t _renderFooter : function( speed, callback ){\n\t var $footer = this.$( '.footer' ).empty().html( PairedCollectionCreator.templates.footer() );\n\t this.$( '.remove-extensions' ).prop( 'checked', this.removeExtensions );\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 /** 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 [\n\t ''\n\t ].join('');\n\t }\n\t var $popoverContent = $( _.template([\n\t '
    ',\n\t '
    ',\n\t _l( 'Choose from the following filters to change which unpaired reads are shown in the display' ),\n\t ':
    ',\n\t _.values( this.commonFilters ).map( function( filterSet ){\n\t return filterChoice( filterSet[0], filterSet[1] );\n\t }).join( '' ),\n\t '
    '\n\t ].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 = [\n\t this.$( '.forward-unpaired-filter input' ).val(),\n\t this.$( '.reverse-unpaired-filter input' ).val()\n\t ];\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, 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([\n\t 'Could not automatically create any pairs from the given dataset names.',\n\t 'You may want to choose or enter different filters and try auto-pairing again.',\n\t 'Close this message using the X on the right to view more help.'\n\t ].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 .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 ){ this.trigger( 'filter-change' ); },\n\t 'focus .forward-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\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 ){ this.trigger( 'filter-change' ); },\n\t 'focus .reverse-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\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 ){ this.toggleExtensions(); },\n\t 'change .collection-name' : '_changeName',\n\t 'keydown .collection-name' : '_nameCheckForEnter',\n\t 'click .cancel-create' : function( ev ){\n\t if( typeof this.oncancel === 'function' ){\n\t this.oncancel.call( this );\n\t }\n\t },\n\t 'click .create-collection' : '_clickCreate'//,\n\t },\n\t\n\t // ........................................................................ header\n\t /** expand help */\n\t _clickMoreHelp : function( ev ){\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 this.$( '.main-help' ).removeClass( 'expanded' );\n\t this.$( '.more-help' ).show();\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()\n\t .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 /** 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 ){ return $dataset; }\n\t\n\t if( select ){\n\t $dataset.addClass( 'selected' );\n\t if( !options.waitToPair ){\n\t this.pairAllSelected();\n\t }\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\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\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 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\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 ){ return; }\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 /** 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 /** 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();\n\t }\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(){ return 'PairedCollectionCreator'; }\n\t});\n\t\n\t\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\tPairedCollectionCreator.templates = PairedCollectionCreator.templates || {\n\t\n\t /** the skeleton */\n\t main : _.template([\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ].join('')),\n\t\n\t /** the header (not including help text) */\n\t header : _.template([\n\t '
    ',\n\t '', _l( 'More help' ), '',\n\t '
    ',\n\t '', _l( 'Less' ), '',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '',\n\t '',\n\t '
    ',\n\t\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '', _l( 'Unpaired forward' ), '',\n\t '',\n\t '
    ',\n\t '
    ',\n\t '',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '', _l( 'Unpaired reverse' ), '',\n\t '',\n\t '
    ',\n\t '
    ',\n\t '',\n\t '
    ',\n\t '
    ',\n\t '
    ',\n\t '
    '\n\t ].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 '
    ',\n\t '
    ',\n\t '
      ',\n\t '
      ',\n\t '
      ',\n\t '
        ',\n\t '
        ',\n\t '
        ',\n\t '
          ',\n\t '
          ',\n\t '
          ',\n\t '
          ',\n\t '
          ',\n\t '
          ',\n\t '
          ',\n\t '',\n\t '
          ',\n\t '',\n\t _l( 'Unpair all' ),\n\t '',\n\t '
          ',\n\t '
          ',\n\t '
          ',\n\t '
            ',\n\t '
            '\n\t ].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer : _.template([\n\t '
            ',\n\t '
            ',\n\t '',\n\t '
            ',\n\t '
            ',\n\t '',\n\t '
            ', _l( 'Name' ), ':
            ',\n\t '
            ',\n\t '
            ',\n\t\n\t '
            ',\n\t '
            ',\n\t '',\n\t '
            ',\n\t '',\n\t '',\n\t '
            ',\n\t '
            ',\n\t\n\t '
            ',\n\t '',\n\t '
            ',\n\t '
            '\n\t ].join('')),\n\t\n\t /** help content */\n\t helpContent : _.template([\n\t '

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

            ',\n\t '

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

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

            ',\n\t '

            ', _l([\n\t '

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

            ',\n\t '

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

            ',\n\t '

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

            ',\n\t '

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

            '\n\t ].join(''))\n\t};\n\t\n\t\n\t//=============================================================================\n\t/** a modal version of the paired collection creator */\n\tvar 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//=============================================================================\n\tfunction createListOfPairsCollection( collection ){\n\t var elements = collection.toJSON();\n\t//TODO: validate elements\n\t return pairedCollectionCreatorModal( elements, {\n\t historyId : collection.historyId\n\t });\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 109 */\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__ = [\n\t __webpack_require__(31),\n\t __webpack_require__(39),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_CREATOR, HDCA, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'collections';\n\t/*==============================================================================\n\tTODO:\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\tvar 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\n\t .attr( 'data-element-id', this.element.id )\n\t .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([\n\t '<%- identifier %>',\n\t '<%- element.name %>',\n\t ].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// ============================================================================\n\tvar _super = LIST_CREATOR.ListCollectionCreator;\n\t\n\t/** An interface for building collections.\n\t */\n\tvar 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 = [\n\t this.workingElements[1],\n\t this.workingElements[0],\n\t ];\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([\n\t '',\n\t '
            ',\n\t '
            '\n\t ].join('')),\n\t\n\t /** help content */\n\t helpContent : _.template([\n\t '

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

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

            ',\n\t '

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

            '\n\t ].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([\n\t '
            ',\n\t '
            ',\n\t '',\n\t '<% if( _.size( problems ) ){ %>',\n\t _l( 'The following selections could not be included due to problems' ),\n\t '
              <% _.each( problems, function( problem ){ %>',\n\t '
            • <%- problem.element.name %>: <%- problem.text %>
            • ',\n\t '<% }); %>
            ',\n\t '<% } else if( _.size( elements ) === 0 ){ %>',\n\t _l( 'No datasets were selected' ), '.',\n\t '<% } else if( _.size( elements ) === 1 ){ %>',\n\t _l( 'Only one dataset was selected' ), ': <%- elements[0].name %>',\n\t '<% } else if( _.size( elements ) > 2 ){ %>',\n\t _l( 'Too many datasets were selected' ),\n\t ': <%- _.pluck( elements, \"name\" ).join( \", \") %>',\n\t '<% } %>',\n\t '
            ',\n\t _l( 'Two (and only two) elements are needed for the pair' ), '. ',\n\t _l( 'You may need to ' ),\n\t '', _l( 'cancel' ), ' ',\n\t _l( 'and reselect new elements' ), '.',\n\t '
            ',\n\t '
            ',\n\t '
            ',\n\t '
            ',\n\t '
            ',\n\t '
            ',\n\t '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
            ',\n\t '
            ',\n\t '
            '\n\t ].join('')),\n\t }),\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString : function(){ return 'PairCollectionCreator'; }\n\t});\n\t\n\t\n\t//==============================================================================\n\t/** List collection flavor of collectionCreatorModal. */\n\tvar 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//==============================================================================\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\tfunction createPairCollection( contents ){\n\t var elements = contents.toJSON(),\n\t promise = pairCollectionCreatorModal( elements, {\n\t creationFn : function( elements, name ){\n\t elements = [\n\t { name: \"forward\", src: \"hda\", id: elements[0].id },\n\t { name: \"reverse\", src: \"hda\", id: elements[1].id }\n\t ];\n\t return contents.createHDCA( elements, 'paired', name );\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 110 */\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__ = [\n\t __webpack_require__(8),\n\t __webpack_require__(78),\n\t __webpack_require__(5)\n\t], __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\tvar 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 ' ) +\n\t _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 ){ %>',\n\t '
            ',\n\t '<%- anonWarning %>',\n\t _l( 'You can' ),\n\t ' ', _l( 'login here' ), ' ', _l( 'or' ), ' ',\n\t ' ', _l( 'register here' ), '.',\n\t '
            ',\n\t '<% } %>',\n\t '
            ',\n\t '
            ',\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 '\" />',\n\t '

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

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

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

            ',\n\t // copy non-deleted is the default\n\t '/>',\n\t '',\n\t '
            ',\n\t '/>',\n\t '',\n\t '<% } %>',\n\t '
            '\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 // TODO: getting a little byzantine here\n\t defaultCopyNameFn = options.nameFn || this.defaultName,\n\t defaultCopyName = defaultCopyNameFn({ name: history.get( 'name' ) }),\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\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 )\n\t .done( function( response ){\n\t deferred.resolve( response );\n\t })\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 })\n\t .done( function(){\n\t if( autoClose ){ modal.hide(); }\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([\n\t [ _l( 'Cancel' ), function(){ modal.hide(); } ],\n\t [ this.submitLabel, checkNameAndCopy ]\n\t ]),\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\tvar 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 ' ) +\n\t _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\tvar 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?\n\t ImportDialog.dialog( modal, history, options ):\n\t CopyDialog.dialog( modal, history, options );\n\t};\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 111 */\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__ = [\n\t __webpack_require__(69),\n\t __webpack_require__(71),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DATASET_LI_EDIT, HDA_LI, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _super = DATASET_LI_EDIT.DatasetListItemEdit;\n\t/** @class Editing view for HistoryDatasetAssociation.\n\t */\n\tvar 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 ){ this.model.unhide(); return false; }\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\n\t// ............................................................................ TEMPLATES\n\t/** underscore templates */\n\tHDAListItemEdit.prototype.templates = (function(){\n\t\n\t var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n\t hidden : BASE_MVC.wrapTemplate([\n\t '<% if( !dataset.visible ){ %>',\n\t // add a link to unhide a dataset\n\t '
            ',\n\t _l( 'This dataset has been hidden' ),\n\t '
            ', _l( 'Unhide it' ), '',\n\t '
            ',\n\t '<% } %>'\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 112 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(73),\n\t __webpack_require__(107),\n\t __webpack_require__(22),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( HDCA_LI, DC_VIEW_EDIT, faIconButton, _l ){\n\t\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _super = HDCA_LI.HDCAListItemView;\n\t/** @class Editing view for HistoryDatasetCollectionAssociation.\n\t */\n\tvar 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 )\n\t .concat([\n\t this._renderDeleteButton()\n\t ]);\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/***/ },\n/* 113 */\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__ = [\n\t __webpack_require__(75),\n\t __webpack_require__(114),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __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\tvar 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\tHistoryViewPrefs.storageKey = function storageKey(){\n\t return ( 'history-panel' );\n\t};\n\t\n\t/* =============================================================================\n\tTODO:\n\t\n\t============================================================================= */\n\tvar _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\tvar 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 : [\n\t _l( 'This history is empty' ), '. ',\n\t _l( 'You can ' ),\n\t '',\n\t _l( 'load your own data' ),\n\t '',\n\t _l( ' or ' ),\n\t '',\n\t _l( 'get data from an external source' ),\n\t ''\n\t ].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(){ this.model.checkForUpdates(); });\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' ) )\n\t && ( !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 )\n\t .off( 'scroll', this._debouncedScrollCaptureHandler )\n\t .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 ){ return $(); }\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',\n\t function( tagsEditor ){\n\t panel.preferences.set( 'tagsEditorShown', tagsEditor.hidden );\n\t }\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',\n\t function( annotationEditor ){\n\t panel.preferences.set( 'annotationEditorShown', annotationEditor.hidden );\n\t }\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 ){ return view; }\n\t if( this.panelStack.length ){ return this._collapseDrilldownPanel(); }\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 ){ Galaxy.upload.show( ev ); },\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 'galaxy_main: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 )?\n\t $( ev.currentTarget )\n\t :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' ) ){ $msg.slideDown( this.fxSpeed ); }\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' ) ){ $msg.slideUp( this.fxSpeed ); }\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(\n\t { visible: false, deleted: '', purged: '' },\n\t { visible : true }\n\t ).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 }\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\n\t//------------------------------------------------------------------------------ TEMPLATES\n\tCurrentHistoryView.prototype.templates = (function(){\n\t\n\t var quotaMsgTemplate = BASE_MVC.wrapTemplate([\n\t '
            ',\n\t _l( 'You are over your disk quota' ), '. ',\n\t _l( 'Tool execution is on hold until your disk usage drops below your allocated quota' ), '.',\n\t '
            '\n\t ], 'history' );\n\t return _.extend( _.clone( _super.prototype.templates ), {\n\t quotaMsg : quotaMsgTemplate\n\t });\n\t\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 114 */\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__ = [\n\t __webpack_require__(115),\n\t __webpack_require__(40),\n\t __webpack_require__(12),\n\t __webpack_require__(72),\n\t __webpack_require__(111),\n\t __webpack_require__(112),\n\t __webpack_require__(77),\n\t __webpack_require__(66),\n\t __webpack_require__(31),\n\t __webpack_require__(109),\n\t __webpack_require__(108),\n\t __webpack_require__(22),\n\t __webpack_require__(79),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(15),\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function(\n\t HISTORY_VIEW,\n\t HISTORY_CONTENTS,\n\t STATES,\n\t HDA_MODEL,\n\t HDA_LI_EDIT,\n\t HDCA_LI_EDIT,\n\t TAGS,\n\t ANNOTATIONS,\n\t LIST_COLLECTION_CREATOR,\n\t PAIR_COLLECTION_CREATOR,\n\t LIST_OF_PAIRS_COLLECTION_CREATOR,\n\t faIconButton,\n\t PopupMenu,\n\t BASE_MVC,\n\t _l\n\t){\n\t\n\t'use strict';\n\t\n\t/* =============================================================================\n\tTODO:\n\t\n\t============================================================================= */\n\tvar _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\tvar 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 /** 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' )\n\t .html( '' + _l( 'loading...' ) + '' );\n\t },\n\t 'fetching-hidden' : function( collection ){\n\t this.$( '> .controls .hidden-count' )\n\t .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 ){ return $newRender; }\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 ){ this._renderCounts( $whereTo ); }\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(){ this.render(); },\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(){ this.render(); },\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 ){ return; }\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 || ( 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 )\n\t .attr( 'title', _l( 'Click to rename history' ) )\n\t .tooltip({ placement: 'bottom' })\n\t .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 })\n\t .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 = [\n\t { 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 },\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 },\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 },\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 ];\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 [\n\t { html: _l( 'Build Dataset List' ), func: function() {\n\t LIST_COLLECTION_CREATOR.createListCollection( panel.getSelectedModels() )\n\t .done( function(){ panel.model.refresh(); });\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 PAIR_COLLECTION_CREATOR.createPairCollection( panel.getSelectedModels() )\n\t .done( function(){ panel.model.refresh(); });\n\t }\n\t },\n\t { html: _l( 'Build List of Dataset Pairs' ), func: function() {\n\t LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection( panel.getSelectedModels() )\n\t .done( function(){ panel.model.refresh(); });\n\t }\n\t },\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 ){ this.toggleShowDeleted(); },\n\t 'click .toggle-hidden-link' : function( ev ){ this.toggleShowHidden(); }\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([\n\t '',\n\t _l( 'Searching ' ), stop, '/', this.model.contentsShown(),\n\t ''\n\t ].join(''));\n\t },\n\t\n\t /** override to display number found in subtitle */\n\t _renderSearchFindings : function(){\n\t this.$( '> .controls .subtitle' ).html([\n\t _l( 'Found' ), this.views.length\n\t ].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 ){ return this; }\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' )\n\t .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 ){ return this; }\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 )\n\t .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\tHistoryViewEdit.prototype.templates = (function(){\n\t\n\t var countsTemplate = BASE_MVC.wrapTemplate([\n\t '<% var shown = Math.max( view.views.length, history.contents_active.active ) %>',\n\t '<% if( shown ){ %>',\n\t '',\n\t '<%- shown %> ', _l( 'shown' ),\n\t '',\n\t '<% } %>',\n\t\n\t '<% if( history.contents_active.deleted ){ %>',\n\t '',\n\t '<% if( view.model.contents.includeDeleted ){ %>',\n\t '',\n\t _l( 'hide deleted' ),\n\t '',\n\t '<% } else { %>',\n\t '<%- history.contents_active.deleted %> ',\n\t '',\n\t _l( 'deleted' ),\n\t '',\n\t '<% } %>',\n\t '',\n\t '<% } %>',\n\t\n\t '<% if( history.contents_active.hidden ){ %>',\n\t '',\n\t '<% if( view.model.contents.includeHidden ){ %>',\n\t '',\n\t _l( 'hide hidden' ),\n\t '',\n\t '<% } else { %>',\n\t '<%- history.contents_active.hidden %> ',\n\t '',\n\t _l( 'hidden' ),\n\t '',\n\t '<% } %>',\n\t '',\n\t '<% } %>',\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 115 */\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__ = [\n\t __webpack_require__(76),\n\t __webpack_require__(75),\n\t __webpack_require__(40),\n\t __webpack_require__(41),\n\t __webpack_require__(71),\n\t __webpack_require__(73),\n\t __webpack_require__(82),\n\t __webpack_require__(78),\n\t __webpack_require__(22),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(85)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function(\n\t LIST_VIEW,\n\t HISTORY_MODEL,\n\t HISTORY_CONTENTS,\n\t HISTORY_PREFS,\n\t HDA_LI,\n\t HDCA_LI,\n\t USER,\n\t ERROR_MODAL,\n\t faIconButton,\n\t BASE_MVC,\n\t _l\n\t){\n\t'use strict';\n\t\n\t/* =============================================================================\n\tTODO:\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\tvar _super = LIST_VIEW.ModelListPanel;\n\tvar 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\n\t .fetchWithContents( options, contentsOptions )\n\t .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(){ this._toggleContentsLoadingIndicator( false ); },\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\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\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() )\n\t && ( contents.includeDeleted || !model.isDeletedOrPurged() )\n\t && ( _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\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.contents.fetchPrevPage();\n\t },\n\t\n\t _clickNextPage : function( ev ){\n\t this.model.contents.fetchNextPage();\n\t },\n\t\n\t _changePageSelect : function( ev ){\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 })\n\t .progress( function( response, limit, offset ){\n\t self.renderItems();\n\t self.trigger( 'search:loading-progress', limit, offset );\n\t })\n\t .always( function(){\n\t self.$el.find( inputSelector ).searchInput( 'toggle-loading' );\n\t })\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 })\n\t .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 )?\n\t $( ev.currentTarget )\n\t :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': return numStr + 'st';\n\t case '2': return numStr + 'nd';\n\t case '3': return numStr + 'rd';\n\t default : 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\n\t//------------------------------------------------------------------------------ TEMPLATES\n\tHistoryView.prototype.templates = (function(){\n\t\n\t var mainTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
            ',\n\t '
            ',\n\t '
              ',\n\t '
              ',\n\t '
              '\n\t ]);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate([\n\t '
              ',\n\t '
              ',\n\t '
              <%- history.name %>
              ',\n\t '
              ',\n\t '
              ',\n\t '
              <%- history.nice_size %>
              ',\n\t\n\t '
              ',\n\t\n\t '
              ',\n\t '<% if( history.deleted && history.purged ){ %>',\n\t '
              ',\n\t _l( 'This history has been purged and deleted' ),\n\t '
              ',\n\t '<% } else if( history.deleted ){ %>',\n\t '
              ',\n\t _l( 'This history has been deleted' ),\n\t '
              ',\n\t '<% } else if( history.purged ){ %>',\n\t '
              ',\n\t _l( 'This history has been purged' ),\n\t '
              ',\n\t '<% } %>',\n\t\n\t '<% if( history.message ){ %>',\n\t // should already be localized\n\t '
              messagesmall\">',\n\t '<%= history.message.text %>',\n\t '
              ',\n\t '<% } %>',\n\t '
              ',\n\t\n\t // add tags and annotations\n\t '
              ',\n\t '
              ',\n\t\n\t '
              ',\n\t '
              ',\n\t '
              ',\n\t\n\t '
              ',\n\t '
              ',\n\t '',\n\t '',\n\t '
              ',\n\t '
              ',\n\t '
              ',\n\t '
              ',\n\t '
              ',\n\t '
              '\n\t ], 'history' );\n\t\n\t var paginationTemplate = BASE_MVC.wrapTemplate([\n\t '',\n\t '',\n\t '',\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 116 */\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__ = [\n\t __webpack_require__(79),\n\t __webpack_require__(110),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( PopupMenu, historyCopyDialog, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\t// ============================================================================\n\tvar menu = [\n\t {\n\t html : _l( 'History Lists' ),\n\t header : true\n\t },\n\t {\n\t html : _l( 'Saved Histories' ),\n\t href : 'history/list',\n\t },\n\t {\n\t html : _l( 'Histories Shared with Me' ),\n\t href : 'history/list_shared'\n\t },\n\t\n\t {\n\t html : _l( 'History Actions' ),\n\t header : true,\n\t anon : true\n\t },\n\t {\n\t html : _l( 'Create New' ),\n\t func : function(){ Galaxy.currHistoryPanel.createNewHistory(); }\n\t },\n\t {\n\t html : _l( 'Copy History' ),\n\t func : function(){\n\t historyCopyDialog( Galaxy.currHistoryPanel.model )\n\t .done( function(){\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t },\n\t },\n\t {\n\t html : _l( 'Share or Publish' ),\n\t href : 'history/sharing',\n\t },\n\t {\n\t html : _l( 'Show Structure' ),\n\t href : 'history/display_structured',\n\t anon : true,\n\t },\n\t {\n\t html : _l( 'Extract Workflow' ),\n\t href : 'workflow/build_from_current_history',\n\t },\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_main.window.location.href = 'history/delete?id=' + Galaxy.currHistoryPanel.model.id;\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\n\t && confirm( _l( 'Really delete the current history permanently? This cannot be undone.' ) ) ){\n\t galaxy_main.window.location.href = 'history/delete?purge=True&id=' + Galaxy.currHistoryPanel.model.id;\n\t }\n\t },\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 {\n\t html : _l( 'Copy Datasets' ),\n\t href : 'dataset/copy_datasets',\n\t },\n\t {\n\t html : _l( 'Dataset Security' ),\n\t href : 'root/history_set_default_permissions',\n\t },\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 {\n\t html : _l( 'Collapse Expanded Datasets' ),\n\t func : function(){ Galaxy.currHistoryPanel.collapseAll(); }\n\t },\n\t {\n\t html : _l( 'Unhide Hidden Datasets' ),\n\t anon : true,\n\t func : function(){ Galaxy.currHistoryPanel.unhideHidden(); }\n\t },\n\t {\n\t html : _l( 'Delete Hidden Datasets' ),\n\t anon : true,\n\t func : function(){ Galaxy.currHistoryPanel.deleteHidden(); }\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\n\t {\n\t html : _l( 'Downloads' ),\n\t header : true\n\t },\n\t {\n\t html : _l( 'Export Tool Citations' ),\n\t href : 'history/citations',\n\t anon : true,\n\t },\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\n\t {\n\t html : _l( 'Other Actions' ),\n\t header : true\n\t },\n\t {\n\t html : _l( 'Import from File' ),\n\t href : 'history/import_archive',\n\t }\n\t];\n\t\n\tfunction 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 = '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\tvar 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// ============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 117 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/**\n\t * Renders tabs e.g. used in the Charts editor, behaves similar to repeat and section rendering\n\t */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils ) {\n\tvar View = Backbone.View.extend({\n\t initialize : function( options ) {\n\t var self = this;\n\t this.visible = false;\n\t this.$nav = null;\n\t this.$content = null;\n\t this.first_tab = null;\n\t this.current_id = null;\n\t this.list = {};\n\t this.options = Utils.merge( options, {\n\t title_new : '',\n\t operations : null,\n\t onnew : null,\n\t max : null,\n\t onchange : null\n\t });\n\t this.setElement( $( this._template( this.options ) ) );\n\t this.$nav = this.$( '.tab-navigation' );\n\t this.$content = this.$( '.tab-content' );\n\t this.$operations = this.$nav.find( '.tab-operations' );\n\t\n\t // Renders tab operations\n\t if ( this.options.operations ) {\n\t $.each( this.options.operations, function( name, item ) {\n\t item.$el.prop( 'id', name );\n\t self.$operations.append( item.$el );\n\t });\n\t }\n\t\n\t // Allows user to add new tabs\n\t this.options.onnew && this.$nav.append( $( this._template_tab_new( this.options ) )\n\t .tooltip( { title: 'Add a new tab', placement: 'bottom', container: self.$el } )\n\t .on( 'click', function( e ) { self.options.onnew() } )\n\t );\n\t this.$tabnew = this.$nav.find( '.tab-new' );\n\t\n\t // Remove all tooltips on click\n\t this.$el.on( 'click', function() { $( '.tooltip' ).hide() } );\n\t },\n\t\n\t /** Returns current number of tabs */\n\t size: function() {\n\t return _.size( this.list );\n\t },\n\t\n\t /** Returns tab id for currently shown tab */\n\t current: function() {\n\t return this.$el.find( '.tab-pane.active' ).attr( 'id' );\n\t },\n\t\n\t /** Adds a new tab */\n\t add: function( options ) {\n\t var self = this;\n\t var id = options.id;\n\t var $tab_title = $( this._template_tab( options ) );\n\t var $tab_content = $( '
              ' ).attr( 'id', options.id ).addClass( 'tab-pane' );\n\t\n\t // hide new tab if maximum number of tabs has been reached\n\t this.list[ id ] = true;\n\t if ( this.options.max && this.size() >= this.options.max ) {\n\t this.$tabnew.hide();\n\t }\n\t\n\t // insert tab before new tab or as last tab\n\t if ( this.options.onnew ) {\n\t this.$tabnew.before( $tab_title );\n\t } else {\n\t this.$nav.append( $tab_title );\n\t }\n\t\n\t // assing delete callback if provided\n\t if ( options.ondel ) {\n\t $tab_title.find( '.tab-delete' ).tooltip( { title: 'Delete this tab', placement: 'bottom', container: self.$el } )\n\t .on( 'click', function() { options.ondel() } );\n\t } else {\n\t $tab_title.tooltip( { title: options.tooltip, placement: 'bottom', container: self.$el } );\n\t }\n\t $tab_title.on( 'click', function( e ) {\n\t e.preventDefault();\n\t options.onclick ? options.onclick() : self.show( id );\n\t });\n\t this.$content.append( $tab_content.append( options.$el ) );\n\t\n\t // assign current/first tab\n\t if ( this.size() == 1 ) {\n\t $tab_title.addClass( 'active' );\n\t $tab_content.addClass( 'active' );\n\t this.first_tab = id;\n\t }\n\t if ( !this.current_id ) {\n\t this.current_id = id;\n\t }\n\t },\n\t\n\t /** Delete tab */\n\t del: function( id ) {\n\t this.$( '#tab-' + id ).remove();\n\t this.$( '#' + id ).remove();\n\t this.first_tab = this.first_tab == id ? null : this.first_tab;\n\t this.first_tab != null && this.show( this.first_tab );\n\t this.list[ id ] && delete this.list[ id ];\n\t if ( this.size() < this.options.max ) {\n\t this.$el.find( '.ui-tabs-new' ).show();\n\t }\n\t },\n\t\n\t /** Delete all tabs */\n\t delAll: function() {\n\t for ( var id in this.list ) {\n\t this.del( id );\n\t }\n\t },\n\t\n\t /** Show tab view and highlight a tab by id */\n\t show: function( id ){\n\t this.$el.fadeIn( 'fast' );\n\t this.visible = true;\n\t if ( id ) {\n\t this.$( '#tab-' + this.current_id ).removeClass('active' );\n\t this.$( '#' + this.current_id ).removeClass('active' );\n\t this.$( '#tab-' + id ).addClass( 'active' );\n\t this.$( '#' + id ).addClass( 'active' );\n\t this.current_id = id;\n\t }\n\t this.options.onchange && this.options.onchange( id );\n\t },\n\t \n\t /** Hide tab view */\n\t hide: function(){\n\t this.$el.fadeOut( 'fast' );\n\t this.visible = false;\n\t },\n\t\n\t /** Show tab */\n\t showTab: function( id ) {\n\t this.$( '#tab-' + id ).show();\n\t },\n\t\n\t /** hide tab */\n\t hideTab: function( id ) {\n\t this.$( '#tab-' + id ).hide();\n\t },\n\t\n\t /** Hide operation by id */\n\t hideOperation: function( id ) {\n\t this.$nav.find( '#' + id ).hide();\n\t },\n\t\n\t /** Show operation by id */\n\t showOperation: function( id ) {\n\t this.$nav.find( '#' + id ).show();\n\t },\n\t\n\t /** Reassign an operation to a new callback */\n\t setOperation: function( id, callback ) {\n\t this.$nav.find( '#' + id ).off('click').on( 'click', callback );\n\t },\n\t\n\t /** Set/Get title */\n\t title: function( id, new_title ) {\n\t var $el = this.$( '#tab-title-text-' + id );\n\t new_title && $el.html( new_title );\n\t return $el.html();\n\t },\n\t\n\t /** Enumerate titles */\n\t retitle: function( new_title ) {\n\t var index = 0;\n\t for ( var id in this.list ) {\n\t this.title( id, ++index + ': ' + new_title );\n\t }\n\t },\n\t\n\t /** Main template */\n\t _template: function( options ) {\n\t return $( '
              ' ).addClass( 'ui-tabs tabbable tabs-left' )\n\t .append( $( '
            • ' +\n\t '
              ' +\n\t '
              ' +\n\t '
              ' +\n\t '
              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\t '',\n '
              ',\n '
              '\n ].join( '' );\n }\n});\n\n//==============================================================================\nreturn {\n CitationView : CitationView,\n CitationListView : CitationListView\n};\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/citation/citation-view.js\n ** module id = 28\n ** module chunks = 0 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-li.js\n ** module id = 29\n ** module chunks = 3\n **/","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 // 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 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'\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-model.js\n ** module id = 30\n ** module chunks = 3\n **/","\ndefine([\n \"mvc/history/hdca-model\",\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"mvc/ui/ui-modal\",\n \"utils/natural-sort\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( HDCA, STATES, BASE_MVC, UI_MODAL, naturalSort, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\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({\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 /** 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._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 if( element.state !== STATES.OK ){\n if( _.contains( STATES.NOT_READY_STATES, element.state ) ){\n return _l( \"hasn't finished running yet\" );\n }\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 /** render the footer, completion controls, and cancel controls */\n _renderFooter : function( speed, callback ){\n var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n return $footer;\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 /** 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 _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 )\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 'click .cancel-create' : function( ev ){\n if( typeof this.oncancel === 'function' ){\n this.oncancel.call( this );\n }\n },\n 'click .create-collection' : '_clickCreate'//,\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 // ........................................................................ 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 // ........................................................................ 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 /** 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 // ------------------------------------------------------------------------ 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 : {\n /** the skeleton */\n main : _.template([\n '
              ',\n '
              ',\n '
              '\n ].join('')),\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 '
              ', _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 '
            • ',\n _l( 'No elements left! ' ),\n _l( 'Would you like to ' ), '', _l( 'start over' ), '?',\n '
            • '\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 ){\n var elements = contents.toJSON(),\n promise = listCollectionCreatorModal( elements, {\n creationFn : function( elements, name ){\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 );\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/list-collection-creator.js\n ** module id = 31\n ** module chunks = 3\n **/","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, options ){\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\n } else {\n self.render();\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 /** 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 // ......................................................................... 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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/dataset/dataset-li.js\n ** module id = 32\n ** module chunks = 3\n **/","/* This class maps the form dom to an api compatible javascript dictionary. */\ndefine([ 'utils/utils' ], function( Utils ) {\n var Manager = Backbone.Model.extend({\n initialize: function( app ) {\n this.app = app;\n },\n\n /** Creates a checksum. */\n checksum: function() {\n var sum = '';\n var self = this;\n this.app.section.$el.find( '.section-row' ).each( function() {\n var id = $(this).attr( 'id' );\n var field = self.app.field_list[ id ];\n if ( field ) {\n sum += id + ':' + JSON.stringify( field.value && field.value() ) + ':' + field.collapsed + ';';\n }\n });\n return sum;\n },\n\n /** Convert dom into a dictionary of flat id/value pairs used e.g. on job submission. */\n create: function() {\n var self = this;\n\n // get raw dictionary from dom\n var dict = {};\n this._iterate( this.app.section.$el, dict );\n\n // add to result dictionary, label elements\n var result_dict = {};\n this.flat_dict = {};\n function add( flat_id, input_id, input_value ) {\n self.flat_dict[ flat_id ] = input_id;\n result_dict[ flat_id ] = input_value;\n self.app.element_list[ input_id ] && self.app.element_list[ input_id ].$el.attr( 'tour_id', flat_id );\n }\n // converter between raw dictionary and job dictionary\n function convert( identifier, head ) {\n for ( var index in head ) {\n var node = head[ index ];\n if ( node.input ) {\n var input = node.input;\n var flat_id = identifier;\n if ( identifier != '' ) {\n flat_id += '|';\n }\n flat_id += input.name;\n switch ( input.type ) {\n case 'repeat':\n var section_label = 'section-';\n var block_indices = [];\n var block_prefix = null;\n for ( var block_label in node ) {\n var pos = block_label.indexOf( section_label );\n if ( pos != -1 ) {\n pos += section_label.length;\n block_indices.push( parseInt( block_label.substr( pos ) ));\n if ( !block_prefix ) {\n block_prefix = block_label.substr( 0, pos );\n }\n }\n }\n block_indices.sort( function( a, b ) { return a - b; });\n var index = 0;\n for ( var i in block_indices ) {\n convert( flat_id + '_' + index++, node[ block_prefix + block_indices[ i ] ]);\n }\n break;\n case 'conditional':\n var value = self.app.field_list[ input.id ].value();\n add( flat_id + '|' + input.test_param.name, input.id, value );\n var selectedCase = matchCase( input, value );\n if ( selectedCase != -1 ) {\n convert( flat_id, head[ input.id + '-section-' + selectedCase ] );\n }\n break;\n case 'section':\n convert( !input.flat && flat_id || '', node );\n break;\n default:\n var field = self.app.field_list[ input.id ];\n if ( field && field.value ) {\n var value = field.value();\n if ( input.ignore === undefined || input.ignore != value ) {\n if ( field.collapsed && input.collapsible_value ) {\n value = input.collapsible_value;\n }\n add( flat_id, input.id, value );\n if ( input.payload ) {\n for ( var p_id in input.payload ) {\n add( p_id, input.id, input.payload[ p_id ] );\n }\n }\n }\n }\n }\n }\n }\n }\n convert( '', dict );\n return result_dict;\n },\n\n /** Matches flat ids to corresponding input element\n * @param{string} flat_id - Flat input id to be looked up.\n */\n match: function ( flat_id ) {\n return this.flat_dict && this.flat_dict[ flat_id ];\n },\n\n /** Match conditional values to selected cases\n */\n matchCase: function( input, value ) {\n return matchCase( input, value );\n },\n\n /** Matches a new tool model to the current input elements e.g. used to update dynamic options\n */\n matchModel: function( model, callback ) {\n var self = this;\n visitInputs( model.inputs, function( input, name ) {\n self.flat_dict[ name ] && callback ( input, self.flat_dict[ name ] );\n });\n },\n\n /** Matches identifier from api response to input elements e.g. used to display validation errors\n */\n matchResponse: function( response ) {\n var result = {};\n var self = this;\n function search ( id, head ) {\n if ( typeof head === 'string' ) {\n var input_id = self.flat_dict[ id ];\n input_id && ( result[ input_id ] = head );\n } else {\n for ( var i in head ) {\n var new_id = i;\n if ( id !== '' ) {\n var separator = '|';\n if ( head instanceof Array ) {\n separator = '_';\n }\n new_id = id + separator + new_id;\n }\n search ( new_id, head[ i ] );\n }\n }\n }\n search( '', response );\n return result;\n },\n\n /** Map dom tree to dictionary tree with input elements.\n */\n _iterate: function( parent, dict ) {\n var self = this;\n var children = $( parent ).children();\n children.each( function() {\n var child = this;\n var id = $( child ).attr( 'id' );\n if ( $( child ).hasClass( 'section-row' ) ) {\n var input = self.app.input_list[ id ];\n dict[ id ] = ( input && { input : input } ) || {};\n self._iterate( child, dict[ id ] );\n } else {\n self._iterate( child, dict );\n }\n });\n }\n });\n\n /** Match conditional values to selected cases\n * @param{dict} input - Definition of conditional input parameter\n * @param{dict} value - Current value\n */\n var matchCase = function( input, value ) {\n if ( input.test_param.type == 'boolean' ) {\n if ( value == 'true' ) {\n value = input.test_param.truevalue || 'true';\n } else {\n value = input.test_param.falsevalue || 'false';\n }\n }\n for ( var i in input.cases ) {\n if ( input.cases[ i ].value == value ) {\n return i;\n }\n }\n return -1;\n };\n\n /** Visits tool inputs\n * @param{dict} inputs - Nested dictionary of input elements\n * @param{dict} callback - Called with the mapped dictionary object and corresponding model node\n */\n var visitInputs = function( inputs, callback, prefix, context ) {\n context = $.extend( true, {}, context );\n _.each( inputs, function ( input ) {\n if ( input && input.type && input.name ) {\n context[ input.name ] = input;\n }\n });\n for ( var key in inputs ) {\n var node = inputs[ key ];\n node.name = node.name || key;\n var name = prefix ? prefix + '|' + node.name : node.name;\n switch ( node.type ) {\n case 'repeat':\n _.each( node.cache, function( cache, j ) {\n visitInputs( cache, callback, name + '_' + j, context );\n });\n break;\n case 'conditional':\n if ( node.test_param ) {\n callback( node.test_param, name + '|' + node.test_param.name, context );\n var selectedCase = matchCase( node, node.test_param.value );\n if ( selectedCase != -1 ) {\n visitInputs( node.cases[ selectedCase ].inputs, callback, name, context );\n } else {\n Galaxy.emit.debug( 'form-data::visitInputs() - Invalid case for ' + name + '.' );\n }\n } else {\n Galaxy.emit.debug( 'form-data::visitInputs() - Conditional test parameter missing for ' + name + '.' );\n }\n break;\n case 'section':\n visitInputs( node.inputs, callback, name, context )\n break;\n default:\n callback( node, name, context );\n }\n }\n };\n\n return {\n Manager : Manager,\n visitInputs : visitInputs\n }\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-data.js\n ** module id = 33\n ** module chunks = 0 3\n **/","/**\n This class creates a form input element wrapper\n*/\ndefine([], function() {\n return Backbone.View.extend({\n initialize: function( app, options ) {\n this.app = app;\n this.app_options = app.options || {};\n this.field = options && options.field || new Backbone.View();\n this.model = options && options.model || new Backbone.Model({\n text_enable : this.app_options.text_enable || 'Enable',\n text_disable : this.app_options.text_disable || 'Disable',\n cls_enable : this.app_options.cls_enable || 'fa fa-caret-square-o-down',\n cls_disable : this.app_options.cls_disable || 'fa fa-caret-square-o-up'\n }).set( options );\n\n // set element and link components\n this.setElement( this._template() );\n this.$field = this.$( '.ui-form-field' );\n this.$info = this.$( '.ui-form-info' );\n this.$preview = this.$( '.ui-form-preview' );\n this.$collapsible = this.$( '.ui-form-collapsible' );\n this.$collapsible_text = this.$( '.ui-form-collapsible-text' );\n this.$collapsible_icon = this.$( '.ui-form-collapsible-icon' );\n this.$title = this.$( '.ui-form-title' );\n this.$title_text = this.$( '.ui-form-title-text' );\n this.$error_text = this.$( '.ui-form-error-text' );\n this.$error = this.$( '.ui-form-error' );\n this.$backdrop = this.$( '.ui-form-backdrop' );\n\n // add field element\n this.$field.prepend( this.field.$el );\n\n // decide wether to expand or collapse fields\n var collapsible_value = this.model.get( 'collapsible_value' );\n this.field.collapsed = collapsible_value !== undefined && JSON.stringify( this.model.get( 'value' ) ) == JSON.stringify( collapsible_value );\n this.listenTo( this.model, 'change', this.render, this );\n this.render();\n\n // add click handler\n var self = this;\n this.$collapsible.on( 'click', function() {\n self.field.collapsed = !self.field.collapsed;\n app.trigger && app.trigger( 'change' );\n self.render();\n });\n },\n\n /** Set backdrop for input element\n */\n backdrop: function() {\n this.model.set( 'backdrop', true );\n },\n\n /** Set error text\n */\n error: function( text ) {\n this.model.set( 'error_text', text );\n },\n\n /** Reset this view\n */\n reset: function() {\n this.model.set( 'error_text', null );\n },\n\n render: function() {\n // render help\n $( '.tooltip' ).hide();\n var help_text = this.model.get( 'help', '' );\n var help_argument = this.model.get( 'argument' );\n if ( help_argument && help_text.indexOf( '(' + help_argument + ')' ) == -1 ) {\n help_text += ' (' + help_argument + ')';\n }\n this.$info.html( help_text );\n // render visibility\n this.$el[ this.model.get( 'hidden' ) ? 'hide' : 'show' ]();\n // render preview view for collapsed fields\n this.$preview[ ( this.field.collapsed && this.model.get( 'collapsible_preview' ) || this.model.get( 'disabled' ) ) ? 'show' : 'hide' ]()\n .html( _.escape( this.model.get( 'text_value' ) ) );\n // render error messages\n var error_text = this.model.get( 'error_text' );\n this.$error[ error_text ? 'show' : 'hide' ]();\n this.$el[ error_text ? 'addClass' : 'removeClass' ]( 'ui-error' );\n this.$error_text.html( error_text );\n // render backdrop\n this.$backdrop[ this.model.get( 'backdrop' ) ? 'show' : 'hide' ]();\n // render input field\n this.field.collapsed || this.model.get( 'disabled' ) ? this.$field.hide() : this.$field.show();\n // render input field color and style\n this.field.model && this.field.model.set( { 'color': this.model.get( 'color' ), 'style': this.model.get( 'style' ) } );\n // render collapsible options\n if ( !this.model.get( 'disabled' ) && this.model.get( 'collapsible_value' ) !== undefined ) {\n var collapsible_state = this.field.collapsed ? 'enable' : 'disable';\n this.$title_text.hide();\n this.$collapsible.show();\n this.$collapsible_text.text( this.model.get( 'label' ) );\n this.$collapsible_icon.removeClass().addClass( 'icon' )\n .addClass( this.model.get( 'cls_' + collapsible_state ) )\n .attr( 'data-original-title', this.model.get( 'text_' + collapsible_state ) )\n .tooltip( { placement: 'bottom' } );\n } else {\n this.$title_text.show().text( this.model.get( 'label' ) );\n this.$collapsible.hide();\n }\n },\n\n _template: function() {\n return $( '
              ' ).addClass( 'ui-form-element' )\n .append( $( '
              ' ).addClass( 'ui-form-error ui-error' )\n .append( $( '' ).addClass( 'fa fa-arrow-down' ) )\n .append( $( '' ).addClass( 'ui-form-error-text' ) )\n )\n .append( $( '
              ' ).addClass( 'ui-form-title' )\n .append( $( '
              ' ).addClass( 'ui-form-collapsible' )\n .append( $( '' ).addClass( 'ui-form-collapsible-icon' ) )\n .append( $( '' ).addClass( 'ui-form-collapsible-text' ) )\n )\n .append( $( '' ).addClass( 'ui-form-title-text' ) )\n )\n .append( $( '
              ' ).addClass( 'ui-form-field' )\n .append( $( '' ).addClass( 'ui-form-info' ) )\n .append( $( '
              ' ).addClass( 'ui-form-backdrop' ) )\n )\n .append( $( '
              ' ).addClass( 'ui-form-preview' ) );\n }\n });\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-input.js\n ** module id = 34\n ** module chunks = 0 3\n **/","/**\n This class creates input elements. New input parameter types should be added to the types dictionary.\n*/\ndefine(['utils/utils',\n 'mvc/ui/ui-misc',\n 'mvc/ui/ui-select-content',\n 'mvc/ui/ui-select-library',\n 'mvc/ui/ui-select-ftp',\n 'mvc/ui/ui-color-picker'],\n function( Utils, Ui, SelectContent, SelectLibrary, SelectFtp, ColorPicker ) {\n\n // create form view\n return Backbone.Model.extend({\n /** Available parameter types */\n types: {\n 'text' : '_fieldText',\n 'select' : '_fieldSelect',\n 'data_column' : '_fieldSelect',\n 'genomebuild' : '_fieldSelect',\n 'data' : '_fieldData',\n 'data_collection' : '_fieldData',\n 'integer' : '_fieldSlider',\n 'float' : '_fieldSlider',\n 'boolean' : '_fieldBoolean',\n 'drill_down' : '_fieldDrilldown',\n 'color' : '_fieldColor',\n 'hidden' : '_fieldHidden',\n 'hidden_data' : '_fieldHidden',\n 'baseurl' : '_fieldHidden',\n 'library_data' : '_fieldLibrary',\n 'ftpfile' : '_fieldFtp'\n },\n\n /** Returns an input field for a given field type */\n create: function( input_def ) {\n var fieldClass = this.types[ input_def.type ];\n var field = typeof( this[ fieldClass ] ) === 'function' ? this[ fieldClass ].call( this, input_def ) : null;\n if ( !field ) {\n field = input_def.options ? this._fieldSelect( input_def ) : this._fieldText( input_def );\n Galaxy.emit.debug('form-parameters::_addRow()', 'Auto matched field type (' + input_def.type + ').');\n }\n input_def.value === undefined && ( input_def.value = null );\n field.value( input_def.value );\n return field;\n },\n\n /** Data input field */\n _fieldData: function( input_def ) {\n return new SelectContent.View({\n id : 'field-' + input_def.id,\n extensions : input_def.extensions,\n optional : input_def.optional,\n multiple : input_def.multiple,\n type : input_def.type,\n flavor : input_def.flavor,\n data : input_def.options,\n onchange : input_def.onchange\n });\n },\n\n /** Select/Checkbox/Radio options field */\n _fieldSelect: function ( input_def ) {\n // show text field e.g. in workflow editor\n if( input_def.is_workflow ) {\n return this._fieldText( input_def );\n }\n\n // customize properties\n if ( input_def.type == 'data_column' ) {\n input_def.error_text = 'Missing columns in referenced dataset.'\n }\n\n // identify available options\n var data = input_def.data;\n if( !data ) {\n data = [];\n _.each( input_def.options, function( option ) {\n data.push( { label: option[ 0 ], value: option[ 1 ] } );\n });\n }\n\n // identify display type\n var SelectClass = Ui.Select;\n switch ( input_def.display ) {\n case 'checkboxes':\n SelectClass = Ui.Checkbox;\n break;\n case 'radio':\n SelectClass = Ui.Radio;\n break;\n case 'radiobutton':\n SelectClass = Ui.RadioButton;\n break;\n }\n\n // create select field\n return new SelectClass.View({\n id : 'field-' + input_def.id,\n data : data,\n error_text : input_def.error_text || 'No options available',\n multiple : input_def.multiple,\n optional : input_def.optional,\n onchange : input_def.onchange,\n searchable : input_def.flavor !== 'workflow'\n });\n },\n\n /** Drill down options field */\n _fieldDrilldown: function ( input_def ) {\n // show text field e.g. in workflow editor\n if( input_def.is_workflow ) {\n return this._fieldText( input_def );\n }\n\n // create drill down field\n return new Ui.Drilldown.View({\n id : 'field-' + input_def.id,\n data : input_def.options,\n display : input_def.display,\n optional : input_def.optional,\n onchange : input_def.onchange\n });\n },\n\n /** Text input field */\n _fieldText: function( input_def ) {\n // field replaces e.g. a select field\n if ( input_def.options && input_def.data ) {\n input_def.area = input_def.multiple;\n if ( Utils.isEmpty( input_def.value ) ) {\n input_def.value = null;\n } else {\n if ( $.isArray( input_def.value ) ) {\n var str_value = '';\n for ( var i in input_def.value ) {\n str_value += String( input_def.value[ i ] );\n if ( !input_def.multiple ) {\n break;\n }\n str_value += '\\n';\n }\n input_def.value = str_value;\n }\n }\n }\n // create input element\n return new Ui.Input({\n id : 'field-' + input_def.id,\n area : input_def.area,\n placeholder : input_def.placeholder,\n onchange : input_def.onchange\n });\n },\n\n /** Slider field */\n _fieldSlider: function( input_def ) {\n return new Ui.Slider.View({\n id : 'field-' + input_def.id,\n precise : input_def.type == 'float',\n is_workflow : input_def.is_workflow,\n min : input_def.min,\n max : input_def.max,\n onchange : input_def.onchange\n });\n },\n\n /** Hidden field */\n _fieldHidden: function( input_def ) {\n return new Ui.Hidden({\n id : 'field-' + input_def.id,\n info : input_def.info\n });\n },\n\n /** Boolean field */\n _fieldBoolean: function( input_def ) {\n return new Ui.RadioButton.View({\n id : 'field-' + input_def.id,\n data : [ { label : 'Yes', value : 'true' },\n { label : 'No', value : 'false' }],\n onchange : input_def.onchange\n });\n },\n\n /** Color picker field */\n _fieldColor: function( input_def ) {\n return new ColorPicker({\n id : 'field-' + input_def.id,\n onchange : input_def.onchange\n });\n },\n\n /** Library dataset field */\n _fieldLibrary: function( input_def ) {\n return new SelectLibrary.View({\n id : 'field-' + input_def.id,\n optional : input_def.optional,\n multiple : input_def.multiple,\n onchange : input_def.onchange\n });\n },\n\n /** FTP file field */\n _fieldFtp: function( input_def ) {\n return new SelectFtp.View({\n id : 'field-' + input_def.id,\n optional : input_def.optional,\n multiple : input_def.multiple,\n onchange : input_def.onchange\n });\n }\n });\n\n return {\n View: View\n };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-parameters.js\n ** module id = 35\n ** module chunks = 0 3\n **/","/** This class creates a ui component which enables the dynamic creation of portlets */\ndefine( [ 'utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc' ],\nfunction( Utils, Portlet, Ui ) {\n var View = Backbone.View.extend({\n initialize: function( options ) {\n this.list = {};\n this.options = Utils.merge( options, {\n title : 'Repeat',\n empty_text : 'Not available.',\n max : null,\n min : null\n });\n this.button_new = new Ui.ButtonIcon({\n icon : 'fa-plus',\n title : 'Insert ' + this.options.title,\n tooltip : 'Add new ' + this.options.title + ' block',\n floating: 'clear',\n cls : 'ui-button-icon form-repeat-add',\n onclick : function() { options.onnew && options.onnew() }\n });\n this.setElement( $( '
              ' ).append( this.$list = $( '
              ' ) )\n .append( $( '
              ' ).append( this.button_new.$el ) ) );\n },\n\n /** Number of repeat blocks */\n size: function() {\n return _.size( this.list );\n },\n\n /** Add new repeat block */\n add: function( options ) {\n if ( !options.id || this.list[ options.id ] ) {\n Galaxy.emit.debug( 'form-repeat::add()', 'Duplicate or invalid repeat block id.' );\n return;\n }\n var button_delete = new Ui.ButtonIcon({\n icon : 'fa-trash-o',\n tooltip : 'Delete this repeat block',\n cls : 'ui-button-icon-plain form-repeat-delete',\n onclick : function() { options.ondel && options.ondel() }\n });\n var portlet = new Portlet.View({\n id : options.id,\n title : 'placeholder',\n cls : options.cls || 'ui-portlet-repeat',\n operations : { button_delete: button_delete }\n });\n portlet.append( options.$el );\n portlet.$el.addClass( 'section-row' ).hide();\n this.list[ options.id ] = portlet;\n this.$list.append( portlet.$el.fadeIn( 'fast' ) );\n this.options.max > 0 && this.size() >= this.options.max && this.button_new.disable();\n this._refresh();\n },\n\n /** Delete repeat block */\n del: function( id ) {\n if ( !this.list[ id ] ) {\n Galaxy.emit.debug( 'form-repeat::del()', 'Invalid repeat block id.' );\n return;\n }\n this.$list.find( '#' + id ).remove();\n delete this.list[ id ];\n this.button_new.enable();\n this._refresh();\n },\n\n /** Remove all */\n delAll: function() {\n for( var id in this.list ) {\n this.del( id );\n }\n },\n\n /** Hides add/del options */\n hideOptions: function() {\n this.button_new.$el.hide();\n _.each( this.list, function( portlet ) { portlet.hideOperation( 'button_delete' ) } );\n _.isEmpty( this.list ) && this.$el.append( $( '
              ' ).addClass( 'ui-form-info' ).html( this.options.empty_text ) );\n },\n\n /** Refresh view */\n _refresh: function() {\n var index = 0;\n for ( var id in this.list ) {\n var portlet = this.list[ id ];\n portlet.title( ++index + ': ' + this.options.title );\n portlet[ this.size() > this.options.min ? 'showOperation' : 'hideOperation' ]( 'button_delete' );\n }\n }\n });\n\n return {\n View : View\n }\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-repeat.js\n ** module id = 36\n ** module chunks = 0 3\n **/","/**\n This class creates a form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections.\n*/\ndefine([ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/ui/ui-portlet', 'mvc/form/form-repeat', 'mvc/form/form-input', 'mvc/form/form-parameters' ],\nfunction( Utils, Ui, Portlet, Repeat, InputElement, Parameters ) {\n var View = Backbone.View.extend({\n initialize: function( app, options ) {\n this.app = app;\n this.inputs = options.inputs;\n this.parameters = new Parameters();\n this.setElement( $( '
              ' ) );\n this.render();\n },\n\n /** Render section view */\n render: function() {\n var self = this;\n this.$el.empty();\n _.each( this.inputs, function( input ) { self.add( input ) } );\n },\n\n /** Add a new input element */\n add: function( input ) {\n var input_def = jQuery.extend( true, {}, input );\n input_def.id = input.id = Utils.uid();\n this.app.input_list[ input_def.id ] = input_def;\n switch( input_def.type ) {\n case 'conditional':\n this._addConditional( input_def );\n break;\n case 'repeat':\n this._addRepeat( input_def );\n break;\n case 'section':\n this._addSection( input_def );\n break;\n default:\n this._addRow( input_def );\n }\n },\n\n /** Add a conditional block */\n _addConditional: function( input_def ) {\n var self = this;\n input_def.test_param.id = input_def.id;\n this.app.options.sustain_conditionals && ( input_def.test_param.disabled = true );\n var field = this._addRow( input_def.test_param );\n\n // set onchange event for test parameter\n field.model && field.model.set( 'onchange', function( value ) {\n var selectedCase = self.app.data.matchCase( input_def, value );\n for ( var i in input_def.cases ) {\n var case_def = input_def.cases[ i ];\n var section_row = self.$( '#' + input_def.id + '-section-' + i );\n var nonhidden = false;\n for ( var j in case_def.inputs ) {\n if ( !case_def.inputs[ j ].hidden ) {\n nonhidden = true;\n break;\n }\n }\n if ( i == selectedCase && nonhidden ) {\n section_row.fadeIn( 'fast' );\n } else {\n section_row.hide();\n }\n }\n self.app.trigger( 'change' );\n });\n\n // add conditional sub sections\n for ( var i in input_def.cases ) {\n var sub_section = new View( this.app, { inputs: input_def.cases[ i ].inputs } );\n this._append( sub_section.$el.addClass( 'ui-form-section' ), input_def.id + '-section-' + i );\n }\n\n // trigger refresh on conditional input field after all input elements have been created\n field.trigger( 'change' );\n },\n\n /** Add a repeat block */\n _addRepeat: function( input_def ) {\n var self = this;\n var block_index = 0;\n\n // create repeat block element\n var repeat = new Repeat.View({\n title : input_def.title || 'Repeat',\n min : input_def.min,\n max : input_def.max,\n onnew : function() { create( input_def.inputs ); self.app.trigger( 'change' ); }\n });\n\n // helper function to create new repeat blocks\n function create ( inputs ) {\n var sub_section_id = input_def.id + '-section-' + ( block_index++ );\n var sub_section = new View( self.app, { inputs: inputs } );\n repeat.add( { id : sub_section_id,\n $el : sub_section.$el,\n ondel : function() { repeat.del( sub_section_id ); self.app.trigger( 'change' ); } } );\n }\n\n //\n // add parsed/minimum number of repeat blocks\n //\n var n_cache = _.size( input_def.cache );\n for ( var i = 0; i < Math.max( Math.max( n_cache, input_def.min ), input_def.default || 0 ); i++ ) {\n create( i < n_cache ? input_def.cache[ i ] : input_def.inputs );\n }\n\n // hide options\n this.app.options.sustain_repeats && repeat.hideOptions();\n\n // create input field wrapper\n var input_element = new InputElement( this.app, {\n label : input_def.title || input_def.name,\n help : input_def.help,\n field : repeat\n });\n this._append( input_element.$el, input_def.id );\n },\n\n /** Add a customized section */\n _addSection: function( input_def ) {\n var portlet = new Portlet.View({\n title : input_def.title || input_def.name,\n cls : 'ui-portlet-section',\n collapsible : true,\n collapsible_button : true,\n collapsed : !input_def.expanded\n });\n portlet.append( new View( this.app, { inputs: input_def.inputs } ).$el );\n portlet.append( $( '
              ' ).addClass( 'ui-form-info' ).html( input_def.help ) );\n this.app.on( 'expand', function( input_id ) { ( portlet.$( '#' + input_id ).length > 0 ) && portlet.expand(); } );\n this._append( portlet.$el, input_def.id );\n },\n\n /** Add a single input field element */\n _addRow: function( input_def ) {\n var self = this;\n var id = input_def.id;\n input_def.onchange = function() { self.app.trigger( 'change', id ) };\n var field = this.parameters.create( input_def );\n this.app.field_list[ id ] = field;\n var input_element = new InputElement( this.app, {\n name : input_def.name,\n label : input_def.label || input_def.name,\n value : input_def.value,\n text_value : input_def.text_value,\n collapsible_value : input_def.collapsible_value,\n collapsible_preview : input_def.collapsible_preview,\n help : input_def.help,\n argument : input_def.argument,\n disabled : input_def.disabled,\n color : input_def.color,\n style : input_def.style,\n backdrop : input_def.backdrop,\n hidden : input_def.hidden,\n field : field\n });\n this.app.element_list[ id ] = input_element;\n this._append( input_element.$el, input_def.id );\n return field;\n },\n\n /** Append a new element to the form i.e. input element, repeat block, conditionals etc. */\n _append: function( $el, id ) {\n this.$el.append( $el.addClass( 'section-row' ).attr( 'id', id ) );\n }\n });\n\n return {\n View: View\n };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-section.js\n ** module id = 37\n ** module chunks = 0 3\n **/","/**\n This is the main class of the form plugin. It is referenced as 'app' in lower level modules.\n*/\ndefine( [ 'utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc', 'mvc/form/form-section', 'mvc/form/form-data' ],\nfunction( Utils, Portlet, Ui, FormSection, FormData ) {\n return Backbone.View.extend({\n initialize: function( options ) {\n this.options = Utils.merge( options, {\n initial_errors : false,\n cls : 'ui-portlet-limited',\n icon : null,\n always_refresh : true\n });\n this.setElement( '
              ' );\n this.render();\n },\n\n /** Update available options */\n update: function( new_model ){\n var self = this;\n this.data.matchModel( new_model, function( node, input_id ) {\n var input = self.input_list[ input_id ];\n if ( input && input.options ) {\n if ( !_.isEqual( input.options, node.options ) ) {\n input.options = node.options;\n var field = self.field_list[ input_id ];\n if ( field.update ) {\n var new_options = [];\n if ( ( [ 'data', 'data_collection', 'drill_down' ] ).indexOf( input.type ) != -1 ) {\n new_options = input.options;\n } else {\n for ( var i in node.options ) {\n var opt = node.options[ i ];\n if ( opt.length > 2 ) {\n new_options.push( { label: opt[ 0 ], value: opt[ 1 ] } );\n }\n }\n }\n field.update( new_options );\n field.trigger( 'change' );\n Galaxy.emit.debug( 'form-view::update()', 'Updating options for ' + input_id );\n }\n }\n }\n });\n },\n\n /** Set form into wait mode */\n wait: function( active ) {\n for ( var i in this.input_list ) {\n var field = this.field_list[ i ];\n var input = this.input_list[ i ];\n if ( input.is_dynamic && field.wait && field.unwait ) {\n field[ active ? 'wait' : 'unwait' ]();\n }\n }\n },\n\n /** Highlight and scroll to input element (currently only used for error notifications) */\n highlight: function ( input_id, message, silent ) {\n var input_element = this.element_list[ input_id ];\n if ( input_element ) {\n input_element.error( message || 'Please verify this parameter.' );\n this.portlet.expand();\n this.trigger( 'expand', input_id );\n if ( !silent ) {\n var $panel = this.$el.parents().filter(function() {\n return [ 'auto', 'scroll' ].indexOf( $( this ).css( 'overflow' ) ) != -1;\n }).first();\n $panel.animate( { scrollTop : $panel.scrollTop() + input_element.$el.offset().top - 120 }, 500 );\n }\n }\n },\n\n /** Highlights errors */\n errors: function( options ) {\n this.trigger( 'reset' );\n if ( options && options.errors ) {\n var error_messages = this.data.matchResponse( options.errors );\n for ( var input_id in this.element_list ) {\n var input = this.element_list[ input_id ];\n if ( error_messages[ input_id ] ) {\n this.highlight( input_id, error_messages[ input_id ], true );\n }\n }\n }\n },\n\n /** Render tool form */\n render: function() {\n var self = this;\n this.off('change');\n this.off('reset');\n // contains the dom field elements as created by the parameter factory i.e. form-parameters\n this.field_list = {};\n // contains input definitions/dictionaries as provided by the parameters to_dict() function through the api\n this.input_list = {};\n // contains the dom elements of each input element i.e. form-input which wraps the actual input field\n this.element_list = {};\n // converts the form into a json data structure\n this.data = new FormData.Manager( this );\n this._renderForm();\n this.data.create();\n this.options.initial_errors && this.errors( this.options );\n // add listener which triggers on checksum change, and reset the form input wrappers\n var current_check = this.data.checksum();\n this.on('change', function( input_id ) {\n var input = self.input_list[ input_id ];\n if ( !input || input.refresh_on_change || self.options.always_refresh ) {\n var new_check = self.data.checksum();\n if ( new_check != current_check ) {\n current_check = new_check;\n self.options.onchange && self.options.onchange();\n }\n }\n });\n this.on('reset', function() {\n _.each( self.element_list, function( input_element ) { input_element.reset() } );\n });\n return this;\n },\n\n /** Renders/appends dom elements of the form */\n _renderForm: function() {\n $( '.tooltip' ).remove();\n this.message = new Ui.Message();\n this.section = new FormSection.View( this, { inputs: this.options.inputs } );\n this.portlet = new Portlet.View({\n icon : this.options.icon,\n title : this.options.title,\n cls : this.options.cls,\n operations : this.options.operations,\n buttons : this.options.buttons,\n collapsible : this.options.collapsible,\n collapsed : this.options.collapsed\n });\n this.portlet.append( this.message.$el );\n this.portlet.append( this.section.$el );\n this.$el.empty();\n this.options.inputs && this.$el.append( this.portlet.$el );\n this.options.message && this.message.update( { persistent: true, status: 'warning', message: this.options.message } );\n Galaxy.emit.debug( 'form-view::initialize()', 'Completed' );\n }\n });\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-view.js\n ** module id = 38\n ** module chunks = 0 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hdca-model.js\n ** module id = 39\n ** module chunks = 3\n **/","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, 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 // 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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-contents.js\n ** module id = 40\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-preferences.js\n ** module id = 41\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/list/list-item.js\n ** module id = 42\n ** module chunks = 3\n **/","/**\n This is the base class of the tool form plugin. This class is e.g. inherited by the regular and the workflow tool form.\n*/\ndefine(['utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view',\n 'mvc/citation/citation-model', 'mvc/citation/citation-view'],\n function(Utils, Deferred, Ui, FormBase, CitationModel, CitationView) {\n return FormBase.extend({\n initialize: function(options) {\n var self = this;\n FormBase.prototype.initialize.call(this, options);\n this.deferred = new Deferred();\n if (options.inputs) {\n this._buildForm(options);\n } else {\n this.deferred.execute(function(process) {\n self._buildModel(process, options, true);\n });\n }\n // Listen to history panel\n if ( options.listen_to_history && parent.Galaxy && parent.Galaxy.currHistoryPanel ) {\n this.listenTo( parent.Galaxy.currHistoryPanel.collection, 'change', function() {\n this.refresh();\n });\n }\n },\n\n /** Listen to history panel changes and update the tool form */\n refresh: function() {\n var self = this;\n self.deferred.reset();\n this.deferred.execute( function (process){\n self._updateModel( process)\n });\n },\n\n /** Wait for deferred build processes before removal */\n remove: function() {\n var self = this;\n this.$el.hide();\n this.deferred.execute(function(){\n FormBase.prototype.remove.call(self);\n Galaxy.emit.debug('tool-form-base::remove()', 'Destroy view.');\n });\n },\n\n /** Build form */\n _buildForm: function(options) {\n var self = this;\n this.options = Utils.merge(options, this.options);\n this.options = Utils.merge({\n icon : options.icon,\n title : '' + options.name + ' ' + options.description + ' (Galaxy Version ' + options.version + ')',\n operations : !this.options.hide_operations && this._operations(),\n onchange : function() {\n self.refresh();\n }\n }, this.options);\n this.options.customize && this.options.customize( this.options );\n this.render();\n if ( !this.options.collapsible ) {\n this.$el.append( $( '
              ' ).addClass( 'ui-margin-top-large' ).append( this._footer() ) );\n }\n },\n\n /** Builds a new model through api call and recreates the entire form\n */\n _buildModel: function(process, options, hide_message) {\n var self = this;\n this.options.id = options.id;\n this.options.version = options.version;\n\n // build request url\n var build_url = '';\n var build_data = {};\n if ( options.job_id ) {\n build_url = Galaxy.root + 'api/jobs/' + options.job_id + '/build_for_rerun';\n } else {\n build_url = Galaxy.root + 'api/tools/' + options.id + '/build';\n if ( Galaxy.params && Galaxy.params.tool_id == options.id ) {\n build_data = $.extend( {}, Galaxy.params );\n options.version && ( build_data[ 'tool_version' ] = options.version );\n }\n }\n\n // get initial model\n Utils.get({\n url : build_url,\n data : build_data,\n success : function(new_model) {\n new_model = new_model.tool_model || new_model;\n if( !new_model.display ) {\n window.location = Galaxy.root;\n return;\n }\n self._buildForm(new_model);\n !hide_message && self.message.update({\n status : 'success',\n message : 'Now you are using \\'' + self.options.name + '\\' version ' + self.options.version + ', id \\'' + self.options.id + '\\'.',\n persistent : false\n });\n Galaxy.emit.debug('tool-form-base::initialize()', 'Initial tool model ready.', new_model);\n process.resolve();\n },\n error : function(response, xhr) {\n var error_message = ( response && response.err_msg ) || 'Uncaught error.';\n if ( xhr.status == 401 ) {\n window.location = Galaxy.root + 'user/login?' + $.param({ redirect : Galaxy.root + '?tool_id=' + self.options.id });\n } else if ( self.$el.is(':empty') ) {\n self.$el.prepend((new Ui.Message({\n message : error_message,\n status : 'danger',\n persistent : true,\n large : true\n })).$el);\n } else {\n Galaxy.modal && Galaxy.modal.show({\n title : 'Tool request failed',\n body : error_message,\n buttons : {\n 'Close' : function() {\n Galaxy.modal.hide();\n }\n }\n });\n }\n Galaxy.emit.debug('tool-form::initialize()', 'Initial tool model request failed.', response);\n process.reject();\n }\n });\n },\n\n /** Request a new model for an already created tool form and updates the form inputs\n */\n _updateModel: function(process) {\n // link this\n var self = this;\n var model_url = this.options.update_url || Galaxy.root + 'api/tools/' + this.options.id + '/build';\n var current_state = {\n tool_id : this.options.id,\n tool_version : this.options.version,\n inputs : $.extend(true, {}, self.data.create())\n }\n this.wait(true);\n\n // log tool state\n Galaxy.emit.debug('tool-form-base::_updateModel()', 'Sending current state.', current_state);\n\n // post job\n Utils.request({\n type : 'POST',\n url : model_url,\n data : current_state,\n success : function(new_model) {\n self.update(new_model['tool_model'] || new_model);\n self.options.update && self.options.update(new_model);\n self.wait(false);\n Galaxy.emit.debug('tool-form-base::_updateModel()', 'Received new model.', new_model);\n process.resolve();\n },\n error : function(response) {\n Galaxy.emit.debug('tool-form-base::_updateModel()', 'Refresh request failed.', response);\n process.reject();\n }\n });\n },\n\n /** Create tool operation menu\n */\n _operations: function() {\n var self = this;\n var options = this.options;\n\n // button for version selection\n var versions_button = new Ui.ButtonMenu({\n icon : 'fa-cubes',\n title : (!options.narrow && 'Versions') || null,\n tooltip : 'Select another tool version'\n });\n if (!options.sustain_version && options.versions && options.versions.length > 1) {\n for (var i in options.versions) {\n var version = options.versions[i];\n if (version != options.version) {\n versions_button.addMenu({\n title : 'Switch to ' + version,\n version : version,\n icon : 'fa-cube',\n onclick : function() {\n // here we update the tool version (some tools encode the version also in the id)\n var id = options.id.replace(options.version, this.version);\n var version = this.version;\n // queue model request\n self.deferred.reset();\n self.deferred.execute(function(process) {\n self._buildModel(process, {id: id, version: version})\n });\n }\n });\n }\n }\n } else {\n versions_button.$el.hide();\n }\n\n // button for options e.g. search, help\n var menu_button = new Ui.ButtonMenu({\n icon : 'fa-caret-down',\n title : (!options.narrow && 'Options') || null,\n tooltip : 'View available options'\n });\n if(options.biostar_url) {\n menu_button.addMenu({\n icon : 'fa-question-circle',\n title : 'Question?',\n tooltip : 'Ask a question about this tool (Biostar)',\n onclick : function() {\n window.open(options.biostar_url + '/p/new/post/');\n }\n });\n menu_button.addMenu({\n icon : 'fa-search',\n title : 'Search',\n tooltip : 'Search help for this tool (Biostar)',\n onclick : function() {\n window.open(options.biostar_url + '/local/search/page/?q=' + options.name);\n }\n });\n };\n menu_button.addMenu({\n icon : 'fa-share',\n title : 'Share',\n tooltip : 'Share this tool',\n onclick : function() {\n prompt('Copy to clipboard: Ctrl+C, Enter', window.location.origin + Galaxy.root + 'root?tool_id=' + options.id);\n }\n });\n\n // add admin operations\n if (Galaxy.user && Galaxy.user.get('is_admin')) {\n menu_button.addMenu({\n icon : 'fa-download',\n title : 'Download',\n tooltip : 'Download this tool',\n onclick : function() {\n window.location.href = Galaxy.root + 'api/tools/' + options.id + '/download';\n }\n });\n }\n\n // button for version selection\n if (options.requirements && options.requirements.length > 0) {\n menu_button.addMenu({\n icon : 'fa-info-circle',\n title : 'Requirements',\n tooltip : 'Display tool requirements',\n onclick : function() {\n if (!this.visible || self.portlet.collapsed ) {\n this.visible = true;\n self.portlet.expand();\n self.message.update({\n persistent : true,\n message : self._templateRequirements(options),\n status : 'info'\n });\n } else {\n this.visible = false;\n self.message.update({\n message : ''\n });\n }\n }\n });\n }\n\n // add toolshed url\n if (options.sharable_url) {\n menu_button.addMenu({\n icon : 'fa-external-link',\n title : 'See in Tool Shed',\n tooltip : 'Access the repository',\n onclick : function() {\n window.open(options.sharable_url);\n }\n });\n }\n\n return {\n menu : menu_button,\n versions : versions_button\n }\n },\n\n /** Create footer\n */\n _footer: function() {\n var options = this.options;\n var $el = $( '
              ' ).append( this._templateHelp( options ) );\n if ( options.citations ) {\n var $citations = $( '
              ' );\n var citations = new CitationModel.ToolCitationCollection();\n citations.tool_id = options.id;\n var citation_list_view = new CitationView.CitationListView({ el: $citations, collection: citations });\n citation_list_view.render();\n citations.fetch();\n $el.append( $citations );\n }\n return $el;\n },\n\n /** Templates\n */\n _templateHelp: function( options ) {\n var $tmpl = $( '
              ' ).addClass( 'ui-form-help' ).append( options.help );\n $tmpl.find( 'a' ).attr( 'target', '_blank' );\n return $tmpl;\n },\n\n _templateRequirements: function( options ) {\n var nreq = options.requirements.length;\n if ( nreq > 0 ) {\n var requirements_message = 'This tool requires ';\n _.each( options.requirements, function( req, i ) {\n requirements_message += req.name + ( req.version ? ' (Version ' + req.version + ')' : '' ) + ( i < nreq - 2 ? ', ' : ( i == nreq - 2 ? ' and ' : '' ) );\n });\n var requirements_link = $( '' ).attr( 'target', '_blank' ).attr( 'href', 'https://wiki.galaxyproject.org/Tools/Requirements' ).text( 'here' );\n return $( '' ).append( requirements_message + '. Click ' ).append( requirements_link ).append( ' for more information.' );\n }\n return 'No requirements found.';\n }\n });\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/tool/tool-form-base.js\n ** module id = 43\n ** module chunks = 0 3\n **/","/**\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 search_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 var form = new ToolForm.View( { id : self.model.id, version : self.model.get('version') } );\n form.deferred.execute(function() {\n Galaxy.app.display( form );\n });\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 '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 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 '',\n '<% _.each( labels, function( label ){ %>',\n '\">',\n '<%- label %>',\n '',\n '<% }); %>',\n '',\n ' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">',\n '<%- name %>',\n '',\n ' <%- description %>'\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/tool/tools.js\n ** module id = 44\n ** module chunks = 0 3\n **/","/** Renders the color picker used e.g. in the tool form **/\ndefine(['utils/utils'], function( Utils ) {\n return Backbone.View.extend({\n colors: {\n standard: ['c00000','ff0000','ffc000','ffff00','92d050','00b050','00b0f0','0070c0','002060','7030a0'],\n base : ['ffffff','000000','eeece1','1f497d','4f81bd','c0504d','9bbb59','8064a2','4bacc6','f79646'],\n theme :[['f2f2f2','7f7f7f','ddd9c3','c6d9f0','dbe5f1','f2dcdb','ebf1dd','e5e0ec','dbeef3','fdeada'],\n ['d8d8d8','595959','c4bd97','8db3e2','b8cce4','e5b9b7','d7e3bc','ccc1d9','b7dde8','fbd5b5'],\n ['bfbfbf','3f3f3f','938953','548dd4','95b3d7','d99694','c3d69b','b2a2c7','92cddc','fac08f'],\n ['a5a5a5','262626','494429','17365d','366092','953734','76923c','5f497a','31859b','e36c09'],\n ['7f7f7e','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]\n },\n\n initialize : function( options ) {\n this.options = Utils.merge( options, {} );\n this.setElement( this._template() );\n this.$panel = this.$( '.ui-color-picker-panel' );\n this.$view = this.$( '.ui-color-picker-view' );\n this.$value = this.$( '.ui-color-picker-value' );\n this.$header = this.$( '.ui-color-picker-header' );\n this._build();\n this.visible = false;\n this.value( this.options.value );\n this.$boxes = this.$( '.ui-color-picker-box' );\n var self = this;\n this.$boxes.on( 'click', function() {\n self.value( $( this ).css( 'background-color' ) );\n self.$header.trigger( 'click' );\n } );\n this.$header.on( 'click', function() {\n self.visible = !self.visible;\n if ( self.visible ) {\n self.$view.fadeIn( 'fast' );\n } else {\n self.$view.fadeOut( 'fast' );\n }\n } );\n },\n\n /** Get/set value */\n value : function ( new_val ) {\n if ( new_val !== undefined && new_val !== null ) {\n this.$value.css( 'background-color', new_val );\n this.$( '.ui-color-picker-box' ).empty();\n this.$( this._getValue() ).html( this._templateCheck() );\n this.options.onchange && this.options.onchange( new_val );\n }\n return this._getValue();\n },\n\n /** Get value from dom */\n _getValue: function() {\n var rgb = this.$value.css( 'background-color' );\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n if ( rgb ) {\n function hex( x ) {\n return ( '0' + parseInt( x ).toString( 16 ) ).slice( -2 );\n }\n return '#' + hex( rgb[ 1] ) + hex( rgb[ 2 ] ) + hex( rgb[ 3 ] );\n } else {\n return null;\n }\n },\n\n /** Build color panel */\n _build: function() {\n var $content = this._content({\n label : 'Theme Colors',\n colors : this.colors.base,\n padding : 10\n });\n for ( var i in this.colors.theme ) {\n var line_def = {};\n if ( i == 0 ) {\n line_def[ 'bottom' ] = true;\n } else {\n if ( i != this.colors.theme.length - 1 ) {\n line_def[ 'top' ] = true;\n line_def[ 'bottom' ] = true;\n } else {\n line_def[ 'top' ] = true;\n line_def[ 'padding' ] = 5;\n }\n }\n line_def[ 'colors' ] = this.colors.theme[ i ];\n this._content( line_def );\n }\n this._content({\n label : 'Standard Colors',\n colors : this.colors.standard,\n padding : 5\n });\n },\n\n /** Create content */\n _content: function( options ) {\n var label = options.label;\n var colors = options.colors;\n var padding = options.padding;\n var top = options.top;\n var bottom = options.bottom;\n var $content = $( this._templateContent() );\n var $label = $content.find( '.label' );\n if ( options.label ) {\n $label.html( options.label );\n } else {\n $label.hide();\n }\n var $line = $content.find( '.line' );\n this.$panel.append( $content );\n for ( var i in colors ) {\n var $box = $( this._templateBox( colors[ i ] ) );\n if ( top ) {\n $box.css( 'border-top', 'none' );\n $box.css( 'border-top-left-radius', '0px' );\n $box.css( 'border-top-right-radius', '0px' );\n }\n if ( bottom ) {\n $box.css( 'border-bottom', 'none' );\n $box.css( 'border-bottom-left-radius', '0px' );\n $box.css( 'border-bottom-right-radius', '0px' );\n }\n $line.append( $box );\n }\n if (padding) {\n $line.css( 'padding-bottom', padding );\n }\n return $content;\n },\n\n /** Check icon */\n _templateCheck: function() {\n return '
              ';\n },\n\n /** Content template */\n _templateContent: function() {\n return '
              ' +\n '
              ' +\n '
              ' +\n '
              ';\n },\n\n /** Box template */\n _templateBox: function( color ) {\n return '
              ';\n },\n\n /** Main template */\n _template: function() {\n return '
              ' +\n '
              ' +\n '
              ' +\n '
              Select a color
              ' +\n '
              ' +\n '
              ' +\n '
              ' +\n '
              '\n '
              ';\n }\n });\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-color-picker.js\n ** module id = 46\n ** module chunks = 0 3\n **/","/** This class creates/wraps a drill down element. */\ndefine([ 'utils/utils', 'mvc/ui/ui-options' ], function( Utils, Options ) {\n\nvar View = Options.BaseIcons.extend({\n initialize: function( options ) {\n options.type = options.display || 'checkbox';\n options.multiple = ( options.type == 'checkbox' );\n Options.BaseIcons.prototype.initialize.call( this, options );\n },\n\n /** Set states for selected values */\n _setValue: function ( new_value ) {\n Options.BaseIcons.prototype._setValue.call( this, new_value );\n if ( new_value !== undefined && new_value !== null && this.header_index ) {\n var self = this;\n var values = $.isArray( new_value ) ? new_value : [ new_value ];\n _.each( values, function( v ) {\n var list = self.header_index[ v ];\n _.each( list, function( element ) {\n self._setState( element, true );\n });\n });\n }\n },\n\n /** Expand/collapse a sub group */\n _setState: function ( header_id, is_expanded ) {\n var $button = this.$( '.button-' + header_id );\n var $subgroup = this.$( '.subgroup-' + header_id );\n $button.data( 'is_expanded', is_expanded );\n if ( is_expanded ) {\n $subgroup.show();\n $button.removeClass( 'fa-plus-square' ).addClass( 'fa-minus-square' );\n } else {\n $subgroup.hide();\n $button.removeClass( 'fa-minus-square' ).addClass( 'fa-plus-square' );\n }\n },\n\n /** Template to create options tree */\n _templateOptions: function() {\n var self = this;\n this.header_index = {};\n\n // attach event handler\n function attach( $el, header_id ) {\n var $button = $el.find( '.button-' + header_id );\n $button.on( 'click', function() {\n self._setState( header_id, !$button.data( 'is_expanded' ) );\n });\n }\n\n // recursive function which iterates through options\n function iterate ( $tmpl, options, header ) {\n header = header || [];\n for ( i in options ) {\n var level = options[ i ];\n var has_options = level.options && level.options.length > 0;\n var new_header = header.slice( 0 );\n self.header_index[ level.value ] = new_header.slice( 0 );\n var $group = $( '
              ' );\n if ( has_options ) {\n var header_id = Utils.uid();\n var $button = $( '' ).addClass( 'button-' + header_id ).addClass( 'ui-drilldown-button fa fa-plus-square' );\n var $subgroup = $( '
              ' ).addClass( 'subgroup-' + header_id ).addClass( 'ui-drilldown-subgroup' );\n $group.append( $( '
              ' )\n .append( $button )\n .append( self._templateOption( { label: level.name, value: level.value } ) ) );\n new_header.push( header_id );\n iterate ( $subgroup, level.options, new_header );\n $group.append( $subgroup );\n attach( $group, header_id );\n } else {\n $group.append( self._templateOption( { label: level.name, value: level.value } ) );\n }\n $tmpl.append( $group );\n }\n }\n\n // iterate through options and create dom\n var $tmpl = $( '
              ' );\n iterate( $tmpl, this.model.get( 'data' ) );\n return $tmpl;\n },\n\n /** Template for drill down view */\n _template: function() {\n return $( '
              ' ).addClass( 'ui-options-list drilldown-container' ).attr( 'id', this.model.id );\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-drilldown.js\n ** module id = 47\n ** module chunks = 0 3\n **/","define([ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-default' ], function( Utils, Ui, Select ) {\n\n/** Batch mode variations */\nvar Batch = { DISABLED: 'disabled', ENABLED: 'enabled', LINKED: 'linked' };\n\n/** List of available content selectors options */\nvar Configurations = {\n data: [\n { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED },\n { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.LINKED },\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.LINKED } ],\n data_multiple: [\n { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.DISABLED },\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n data_collection: [\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n workflow_data: [\n { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED } ],\n workflow_data_multiple: [\n { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.DISABLED } ],\n workflow_data_collection: [\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n module_data: [\n { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED },\n { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.ENABLED } ],\n module_data_collection: [\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED },\n { src: 'hdca', icon: 'fa-folder', tooltip: 'Multiple collections', multiple: true, batch: Batch.ENABLED } ]\n};\n\n/** View for hda and hdca content selector ui elements */\nvar View = Backbone.View.extend({\n initialize : function( options ) {\n var self = this;\n this.model = options && options.model || new Backbone.Model({\n src_labels : { 'hda' : 'dataset', 'hdca': 'dataset collection' },\n pagelimit : 100\n }).set( options );\n this.setElement( $( '
              ' ).addClass( 'ui-select-content' ) );\n this.button_product = new Ui.RadioButton.View( {\n value : 'false',\n data : [ { icon: 'fa fa-chain', value: 'false',\n tooltip: 'Linked inputs will be run in matched order with other datasets e.g. use this for matching forward and reverse reads.' },\n { icon: 'fa fa-chain-broken', value: 'true',\n tooltip: 'Unlinked dataset inputs will be run against *all* other inputs.' } ] } );\n var $batch_div = $( '
              ' ).addClass( 'ui-form-info' )\n .append( $( '' ).addClass( 'fa fa-sitemap' ) )\n .append( $( '' ).html( 'This is a batch mode input field. Separate jobs will be triggered for each dataset selection.' ) );\n this.$batch = {\n linked : $batch_div.clone(),\n enabled : $batch_div.clone().append( $( '
              ' )\n .append( $( '
              ' ).addClass( 'ui-form-title' ).html( 'Batch options:' ) )\n .append( this.button_product.$el ) )\n .append( $( '
              ' ).css( 'clear', 'both' ) )\n };\n\n // track current history elements\n this.history = {};\n\n // add listeners\n this.listenTo( this.model, 'change:data', this._changeData, this );\n this.listenTo( this.model, 'change:wait', this._changeWait, this );\n this.listenTo( this.model, 'change:current', this._changeCurrent, this );\n this.listenTo( this.model, 'change:value', this._changeValue, this );\n this.listenTo( this.model, 'change:type change:optional change:multiple change:extensions', this._changeType, this );\n this.render();\n\n // add change event\n this.on( 'change', function() { options.onchange && options.onchange( self.value() ) } );\n },\n\n render: function() {\n this._changeType();\n this._changeValue();\n this._changeWait();\n },\n\n /** Indicate that select fields are being updated */\n wait: function() {\n this.model.set( 'wait', true );\n },\n\n /** Indicate that the options update has been completed */\n unwait: function() {\n this.model.set( 'wait', false );\n },\n\n /** Update data representing selectable options */\n update: function( options ) {\n this.model.set( 'data', options );\n },\n\n /** Return the currently selected dataset values */\n value: function ( new_value ) {\n new_value !== undefined && this.model.set( 'value', new_value );\n var current = this.model.get( 'current' );\n if ( this.config[ current ] ) {\n var id_list = this.fields[ current ].value();\n if (id_list !== null) {\n id_list = $.isArray( id_list ) ? id_list : [ id_list ];\n if ( id_list.length > 0 ) {\n var result = this._batch( { values: [] } );\n for ( var i in id_list ) {\n var details = this.history[ id_list[ i ] + '_' + this.config[ current ].src ];\n if ( details ) {\n result.values.push( details );\n } else {\n Galaxy.emit.debug( 'ui-select-content::value()', 'Requested details not found for \\'' + id_list[ i ] + '\\'.' );\n return null;\n }\n }\n result.values.sort( function( a, b ) { return a.hid - b.hid } );\n return result;\n }\n }\n } else {\n Galaxy.emit.debug( 'ui-select-content::value()', 'Invalid value/source \\'' + new_value + '\\'.' );\n }\n return null;\n },\n\n /** Change of current select field */\n _changeCurrent: function() {\n var self = this;\n _.each( this.fields, function( field, i ) {\n if ( self.model.get( 'current' ) == i ) {\n field.$el.show();\n _.each( self.$batch, function( $batchfield, batchmode ) {\n $batchfield[ self.config[ i ].batch == batchmode ? 'show' : 'hide' ]();\n });\n self.button_type.value( i );\n } else {\n field.$el.hide();\n }\n });\n },\n\n /** Change of type */\n _changeType: function() {\n var self = this;\n\n // identify selector type identifier i.e. [ flavor ]_[ type ]_[ multiple ]\n var config_id = ( this.model.get( 'flavor' ) ? this.model.get( 'flavor' ) + '_' : '' ) +\n String( this.model.get( 'type' ) ) + ( this.model.get( 'multiple' ) ? '_multiple' : '' );\n if ( Configurations[ config_id ] ) {\n this.config = Configurations[ config_id ];\n } else {\n this.config = Configurations[ 'data' ];\n Galaxy.emit.debug( 'ui-select-content::_changeType()', 'Invalid configuration/type id \\'' + config_id + '\\'.' );\n }\n\n // prepare extension component of error message\n var data = self.model.get( 'data' );\n var extensions = Utils.textify( this.model.get( 'extensions' ) );\n var src_labels = this.model.get( 'src_labels' );\n\n // build views\n this.fields = [];\n this.button_data = [];\n _.each( this.config, function( c, i ) {\n self.button_data.push({\n value : i,\n icon : c.icon,\n tooltip : c.tooltip\n });\n self.fields.push(\n new Select.View({\n optional : self.model.get( 'optional' ),\n multiple : c.multiple,\n searchable : !c.multiple || ( data && data[ c.src ] && data[ c.src ].length > self.model.get( 'pagelimit' ) ),\n selectall : false,\n error_text : 'No ' + ( extensions ? extensions + ' ' : '' ) + ( src_labels[ c.src ] || 'content' ) + ' available.',\n onchange : function() {\n self.trigger( 'change' );\n }\n })\n );\n });\n this.button_type = new Ui.RadioButton.View({\n value : this.model.get( 'current' ),\n data : this.button_data,\n onchange: function( value ) {\n self.model.set( 'current', value );\n self.trigger( 'change' );\n }\n });\n\n // append views\n this.$el.empty();\n var button_width = 0;\n if ( this.fields.length > 1 ) {\n this.$el.append( this.button_type.$el );\n button_width = Math.max( 0, this.fields.length * 36 ) + 'px';\n }\n _.each( this.fields, function( field ) {\n self.$el.append( field.$el.css( { 'margin-left': button_width } ) );\n });\n _.each( this.$batch, function( $batchfield, batchmode ) {\n self.$el.append( $batchfield.css( { 'margin-left': button_width } ) );\n });\n this.model.set( 'current', 0 );\n this._changeCurrent();\n this._changeData();\n },\n\n /** Change of wait flag */\n _changeWait: function() {\n var self = this;\n _.each( this.fields, function( field ) { field[ self.model.get( 'wait' ) ? 'wait' : 'unwait' ]() } );\n },\n\n /** Change of available options */\n _changeData: function() {\n var options = this.model.get( 'data' );\n var self = this;\n var select_options = {};\n _.each( options, function( items, src ) {\n select_options[ src ] = [];\n _.each( items, function( item ) {\n select_options[ src ].push({\n hid : item.hid,\n keep : item.keep,\n label: item.hid + ': ' + item.name,\n value: item.id\n });\n self.history[ item.id + '_' + src ] = item;\n });\n });\n _.each( this.config, function( c, i ) {\n select_options[ c.src ] && self.fields[ i ].add( select_options[ c.src ], function( a, b ) { return b.hid - a.hid } );\n });\n },\n\n /** Change of incoming value */\n _changeValue: function () {\n var new_value = this.model.get( 'value' );\n if ( new_value && new_value.values && new_value.values.length > 0 ) {\n // create list with content ids\n var list = [];\n _.each( new_value.values, function( value ) {\n list.push( value.id );\n });\n // sniff first suitable field type from config list\n var src = new_value.values[ 0 ].src;\n var multiple = new_value.values.length > 1;\n for( var i = 0; i < this.config.length; i++ ) {\n var field = this.fields[ i ];\n var c = this.config[ i ];\n if ( c.src == src && [ multiple, true ].indexOf( c.multiple ) !== -1 ) {\n this.model.set( 'current', i );\n field.value( list );\n break;\n }\n }\n } else {\n _.each( this.fields, function( field ) {\n field.value( null );\n });\n }\n },\n\n /** Assists in identifying the batch mode */\n _batch: function( result ) {\n result[ 'batch' ] = false;\n var current = this.model.get( 'current' );\n var config = this.config[ current ];\n if ( config.src == 'hdca' && !config.multiple ) {\n var hdca = this.history[ this.fields[ current ].value() + '_hdca' ];\n if ( hdca && hdca.map_over_type ) {\n result[ 'batch' ] = true;\n }\n }\n if ( config.batch == Batch.LINKED || config.batch == Batch.ENABLED ) {\n result[ 'batch' ] = true;\n if ( config.batch == Batch.ENABLED && this.button_product.value() === 'true' ) {\n result[ 'product' ] = true;\n }\n }\n return result;\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-select-content.js\n ** module id = 48\n ** module chunks = 0 3\n **/","// dependencies\ndefine(['utils/utils', 'mvc/ui/ui-list'],\n function(Utils, List) {\n\n/**\n * FTP file selector\n */\nvar View = Backbone.View.extend({\n // initialize\n initialize : function(options) {\n // link this\n var self = this;\n\n // create ui-list view to keep track of selected ftp files\n this.ftpfile_list = new List.View({\n name : 'file',\n optional : options.optional,\n multiple : options.multiple,\n onchange : function() {\n options.onchange && options.onchange(self.value());\n }\n });\n\n // create elements\n this.setElement(this.ftpfile_list.$el);\n\n // initial fetch of ftps\n Utils.get({\n url : Galaxy.root + 'api/remote_files',\n success : function(response) {\n var data = [];\n for (var i in response) {\n data.push({\n value : response[i]['path'],\n label : response[i]['path']\n });\n }\n self.ftpfile_list.update(data);\n }\n });\n },\n\n /** Return/Set currently selected ftp datasets */\n value: function(val) {\n return this.ftpfile_list.value(val);\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-select-ftp.js\n ** module id = 49\n ** module chunks = 0 3\n **/","// dependencies\ndefine(['utils/utils', 'mvc/ui/ui-misc', 'mvc/ui/ui-table', 'mvc/ui/ui-list'],\n function(Utils, Ui, Table, List) {\n\n// collection of libraries\nvar Libraries = Backbone.Collection.extend({\n url: Galaxy.root + 'api/libraries?deleted=false'\n});\n\n// collection of dataset\nvar LibraryDatasets = Backbone.Collection.extend({\n initialize: function() {\n var self = this;\n this.config = new Backbone.Model({ library_id: null });\n this.config.on('change', function() {\n self.fetch({ reset: true });\n });\n },\n url: function() {\n return Galaxy.root + 'api/libraries/' + this.config.get('library_id') + '/contents';\n }\n});\n\n// hda/hdca content selector ui element\nvar View = Backbone.View.extend({\n // initialize\n initialize : function(options) {\n // link this\n var self = this;\n\n // collections\n this.libraries = new Libraries();\n this.datasets = new LibraryDatasets();\n\n // link app and options\n this.options = options;\n\n // select field for the library\n // TODO: Remove this once the library API supports searching for library datasets\n this.library_select = new Ui.Select.View({\n onchange : function(value) {\n self.datasets.config.set('library_id', value);\n }\n });\n\n // create ui-list view to keep track of selected data libraries\n this.dataset_list = new List.View({\n name : 'dataset',\n optional : options.optional,\n multiple : options.multiple,\n onchange : function() {\n self.trigger('change');\n }\n });\n\n // add reset handler for fetched libraries\n this.libraries.on('reset', function() {\n var data = [];\n self.libraries.each(function(model) {\n data.push({\n value : model.id,\n label : model.get('name')\n });\n });\n self.library_select.update(data);\n });\n\n // add reset handler for fetched library datasets\n this.datasets.on('reset', function() {\n var data = [];\n var library_current = self.library_select.text();\n if (library_current !== null) {\n self.datasets.each(function(model) {\n if (model.get('type') === 'file') {\n data.push({\n value : model.id,\n label : model.get('name')\n });\n }\n });\n }\n self.dataset_list.update(data);\n });\n\n // add change event. fires on trigger\n this.on('change', function() {\n options.onchange && options.onchange(self.value());\n });\n\n // create elements\n this.setElement(this._template());\n this.$('.library-select').append(this.library_select.$el);\n this.$el.append(this.dataset_list.$el);\n\n // initial fetch of libraries\n this.libraries.fetch({\n reset: true,\n success: function() {\n self.library_select.trigger('change');\n if (self.options.value !== undefined) {\n self.value(self.options.value);\n }\n }\n });\n },\n\n /** Return/Set currently selected library datasets */\n value: function(val) {\n return this.dataset_list.value(val);\n },\n\n /** Template */\n _template: function() {\n return '
              ' +\n '
              ' +\n 'Select Library' +\n '' +\n '
              ' +\n '
              ';\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-select-library.js\n ** module id = 50\n ** module chunks = 0 3\n **/","define([ 'utils/utils' ], function( Utils ) {\nvar View = Backbone.View.extend({\n initialize : function( options ) {\n var self = this;\n this.options = Utils.merge( options, {\n id : Utils.uid(),\n min : null,\n max : null,\n step : null,\n precise : false,\n split : 10000\n } );\n\n // create new element\n this.setElement( this._template( this.options ) );\n\n // determine wether to use the slider\n this.useslider = this.options.max !== null && this.options.min !== null && this.options.max > this.options.min;\n\n // set default step size\n if ( this.options.step === null ) {\n this.options.step = 1.0;\n if ( this.options.precise && this.useslider ) {\n this.options.step = ( this.options.max - this.options.min ) / this.options.split;\n }\n }\n\n // create slider if min and max are defined properly\n if ( this.useslider ) {\n this.$slider = this.$( '#slider' );\n this.$slider.slider( this.options );\n this.$slider.on( 'slide', function ( event, ui ) {\n self.value( ui.value );\n });\n } else {\n this.$( '.ui-form-slider-text' ).css( 'width', '100%' );\n }\n\n // link text input field\n this.$text = this.$( '#text' );\n\n // set initial value\n this.options.value !== undefined && ( this.value( this.options.value ) );\n\n // add text field event\n var pressed = [];\n this.$text.on( 'change', function () {\n self.value( $( this ).val() );\n });\n this.$text.on( 'keyup', function( e ) {\n pressed[e.which] = false;\n self.options.onchange && self.options.onchange( $( this ).val() );\n });\n this.$text.on( 'keydown', function ( e ) {\n var v = e.which;\n pressed[ v ] = true;\n if ( self.options.is_workflow && pressed[ 16 ] && v == 52 ) {\n self.value( '$' )\n event.preventDefault();\n } else if (!( v == 8 || v == 9 || v == 13 || v == 37 || v == 39 || ( v >= 48 && v <= 57 && !pressed[ 16 ] ) || ( v >= 96 && v <= 105 )\n || ( ( v == 190 || v == 110 ) && $( this ).val().indexOf( '.' ) == -1 && self.options.precise )\n || ( ( v == 189 || v == 109 ) && $( this ).val().indexOf( '-' ) == -1 )\n || self._isParameter( $( this ).val() )\n || pressed[ 91 ] || pressed[ 17 ] ) ) {\n event.preventDefault();\n }\n });\n },\n\n /** Set and Return the current value\n */\n value : function ( new_val ) {\n if ( new_val !== undefined ) {\n if ( new_val !== null && new_val !== '' && !this._isParameter( new_val ) ) {\n isNaN( new_val ) && ( new_val = 0 );\n this.options.max !== null && ( new_val = Math.min( new_val, this.options.max ) );\n this.options.min !== null && ( new_val = Math.max( new_val, this.options.min ) );\n }\n this.$slider && this.$slider.slider( 'value', new_val );\n this.$text.val( new_val );\n this.options.onchange && this.options.onchange( new_val );\n }\n return this.$text.val();\n },\n\n /** Return true if the field contains a workflow parameter i.e. $('name')\n */\n _isParameter: function( value ) {\n return this.options.is_workflow && String( value ).substring( 0, 1 ) === '$';\n },\n\n /** Slider template\n */\n _template: function( options ) {\n return '
              ' +\n '' +\n '
              ' +\n '
              ';\n }\n});\n\nreturn {\n View : View\n};\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-slider.js\n ** module id = 51\n ** module chunks = 0 3\n **/","// dependencies\ndefine(['utils/utils'], function(Utils) {\n\n/**\n * This class creates a ui table element.\n */\nvar View = Backbone.View.extend({\n // current row\n row: null,\n \n // count rows\n row_count: 0,\n \n // defaults options\n optionsDefault: {\n content : 'No content available.',\n onchange : null,\n ondblclick : null,\n onconfirm : null,\n cls : 'ui-table',\n cls_tr : ''\n },\n \n // events\n events : {\n 'click' : '_onclick',\n 'dblclick' : '_ondblclick'\n },\n \n // initialize\n initialize : function(options) {\n // configure options\n this.options = Utils.merge(options, this.optionsDefault);\n \n // create new element\n var $el = $(this._template(this.options));\n \n // link sub-elements\n this.$thead = $el.find('thead');\n this.$tbody = $el.find('tbody');\n this.$tmessage = $el.find('tmessage');\n \n // set element\n this.setElement($el);\n \n // initialize row\n this.row = this._row();\n },\n \n // add header cell\n addHeader: function($el) {\n var wrapper = $('
              ' +\n '' +\n '' +\n '
              ' +\n '' + options.content + '' +\n '
              ';\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-table.js\n ** module id = 52\n ** module chunks = 0 3\n **/","define( [], function() {\n var Model = Backbone.Model.extend({\n defaults: {\n extension : 'auto',\n genome : '?',\n url_paste : '',\n status : 'init',\n info : null,\n file_name : '',\n file_mode : '',\n file_size : 0,\n file_type : null,\n file_path : '',\n file_data : null,\n percentage : 0,\n space_to_tab : false,\n to_posix_lines : true,\n enabled : true\n },\n reset: function( attr ) {\n this.clear().set( this.defaults ).set( attr );\n }\n });\n var Collection = Backbone.Collection.extend( { model: Model } );\n return { Model: Model, Collection : Collection };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/upload/upload-model.js\n ** module id = 53\n ** module chunks = 3\n **/","/**\n * This class defines a queue to ensure that multiple deferred callbacks are executed sequentially.\n */\ndefine(['utils/utils'], function( Utils ) {\nreturn Backbone.Model.extend({\n initialize: function(){\n this.active = {};\n this.last = null;\n },\n\n /** Adds a callback to the queue. Upon execution a deferred object is parsed to the callback i.e. callback( deferred ).\n * If the callback does not take any arguments, the deferred is resolved instantly.\n */\n execute: function( callback ) {\n var self = this;\n var id = Utils.uid();\n var has_deferred = callback.length > 0;\n\n // register process\n this.active[ id ] = true;\n\n // deferred process\n var process = $.Deferred();\n process.promise().always(function() {\n delete self.active[ id ];\n has_deferred && Galaxy.emit.debug( 'deferred::execute()', this.state().charAt(0).toUpperCase() + this.state().slice(1) + ' ' + id );\n });\n\n // deferred queue\n $.when( this.last ).always(function() {\n if ( self.active[ id ] ) {\n has_deferred && Galaxy.emit.debug( 'deferred::execute()', 'Running ' + id );\n callback( process );\n !has_deferred && process.resolve();\n } else {\n process.reject();\n }\n });\n this.last = process.promise();\n },\n\n /** Resets the promise queue. All currently queued but unexecuted callbacks/promises will be rejected.\n */\n reset: function() {\n Galaxy.emit.debug('deferred::execute()', 'Reset');\n for ( var i in this.active ) {\n this.active[ i ] = false;\n }\n },\n\n /** Returns true if all processes are done.\n */\n ready: function() {\n return $.isEmptyObject( this.active );\n }\n});\n\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/utils/deferred.js\n ** module id = 55\n ** module chunks = 0 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/annotation.js\n ** module id = 66\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/base/controlled-fetch-collection.js\n ** module id = 67\n ** module chunks = 3\n **/","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 },\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 ], '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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-view.js\n ** module id = 68\n ** module chunks = 3\n **/","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 : this.model.urls.edit,\n target : this.linkTarget,\n faIcon : 'fa-pencil',\n classes : 'edit-btn'\n };\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 /** 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() ]);\n case STATES.OK:\n case STATES.FAILED_METADATA:\n return actions.concat([ this._renderRerunButton(), this._renderVisualizationsButton() ]);\n }\n return actions.concat([ this._renderRerunButton() ]);\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 : this.model.urls.report_error,\n classes : 'report-error-btn',\n target : this.linkTarget,\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 // create webpack split point in order to load the tool form async\n // TODO: split not working (tool loads fine)\n require([ 'mvc/tool/tool-form' ], function( ToolForm ){\n var form = new ToolForm.View({ 'job_id' : creating_job });\n form.deferred.execute( function(){\n Galaxy.app.display( form );\n });\n });\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/dataset/dataset-li-edit.js\n ** module id = 69\n ** module chunks = 3\n **/","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?to_ext=' + this.get( 'file_ext' ),\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 /** 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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/dataset/dataset-model.js\n ** module id = 70\n ** module chunks = 3\n **/","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 ], '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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hda-li.js\n ** module id = 71\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hda-model.js\n ** module id = 72\n ** module chunks = 3\n **/","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\n this.listenTo( this.model, {\n '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 ], '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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hdca-li.js\n ** module id = 73\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-content-model.js\n ** module id = 74\n ** module chunks = 3\n **/","\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( 0 ); }\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-model.js\n ** module id = 75\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/list/list-view.js\n ** module id = 76\n ** module chunks = 3\n **/","define([\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( baseMVC, _l ){\n// =============================================================================\n/** A view on any model that has a 'tags' attribute (a list of tag strings)\n * Incorporates the select2 jQuery plugin for tags display/editing:\n * http://ivaynberg.github.io/select2/\n */\nvar TagsEditor = Backbone.View\n .extend( baseMVC.LoggableMixin )\n .extend( baseMVC.HiddenUntilActivatedViewMixin ).extend({\n\n tagName : 'div',\n className : 'tags-display',\n\n /** Set up listeners, parse options */\n initialize : function( options ){\n //console.debug( this, options );\n // only listen to the model only for changes to tags - re-render\n this.listenTo( this.model, 'change:tags', 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 this.$input().select2({\n placeholder : 'Add tags',\n width : '100%',\n tags : function(){\n // initialize possible tags in the dropdown based on all the tags the user has used so far\n return view._getTagsUsed();\n }\n });\n\n this._setUpBehaviors();\n return this;\n },\n\n /** @returns {String} the html text used to build the view's DOM */\n _template : function(){\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 ].join( '' );\n },\n\n /** @returns {String} the sorted, comma-separated tags from the model */\n tagsToCSV : function(){\n var tagsArray = this.model.get( 'tags' );\n if( !_.isArray( tagsArray ) || _.isEmpty( tagsArray ) ){\n return '';\n }\n return tagsArray.map( function( tag ){\n return _.escape( tag );\n }).sort().join( ',' );\n },\n\n /** @returns {jQuery} the input for this view */\n $input : function(){\n return this.$el.find( 'input.tags-input' );\n },\n\n /** @returns {String[]} all tags used by the current user */\n _getTagsUsed : function(){\n//TODO: global\n return Galaxy.user.get( 'tags_used' );\n },\n\n /** set up any event listeners on the view's DOM (mostly handled by select2) */\n _setUpBehaviors : function(){\n var view = this;\n this.$input().on( 'change', function( event ){\n // save the model's tags in either remove or added event\n view.model.save({ tags: event.val }, { silent: true });\n // if it's new, add the tag to the users tags\n if( event.added ){\n //??: solve weird behavior in FF on test.galaxyproject.org where\n // event.added.text is string object: 'String{ 0=\"o\", 1=\"n\", 2=\"e\" }'\n view._addNewTagToTagsUsed( event.added.text + '' );\n }\n });\n },\n\n /** add a new tag (if not already there) to the list of all tags used by the user\n * @param {String} newTag the tag to add to the list of used\n */\n _addNewTagToTagsUsed : function( newTag ){\n//TODO: global\n var tagsUsed = Galaxy.user.get( 'tags_used' );\n if( !_.contains( tagsUsed, newTag ) ){\n tagsUsed.push( newTag );\n tagsUsed.sort();\n Galaxy.user.set( 'tags_used', tagsUsed );\n }\n },\n\n /** shut down event listeners and remove this view's DOM */\n remove : function(){\n this.$input.off();\n this.stopListening( this.model );\n Backbone.View.prototype.remove.call( this );\n },\n\n /** string rep */\n toString : function(){ return [ 'TagsEditor(', this.model + '', ')' ].join(''); }\n});\n\n// =============================================================================\nreturn {\n TagsEditor : TagsEditor\n};\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/tag.js\n ** module id = 77\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/error-modal.js\n ** module id = 78\n ** module chunks = 3\n **/","define([\n    //jquery\n    //backbone\n], function(){\n// =============================================================================\n/**\n * view for a popup menu\n */\nvar PopupMenu = Backbone.View.extend({\n//TODO: maybe better as singleton off the Galaxy obj\n    /** Cache the desired button element and options, set up the button click handler\n     *  NOTE: attaches this view as HTML/jQ data on the button for later use.\n     */\n    initialize: function( $button, options ){\n        // default settings\n        this.$button = $button;\n        if( !this.$button.length ){\n            this.$button = $( '
              ' );\n }\n this.options = options || [];\n this.$button.data( 'popupmenu', this );\n\n // set up button click -> open menu behavior\n var menu = this;\n this.$button.click( function( event ){\n // if there's already a menu open, remove it\n $( '.popmenu-wrapper' ).remove();\n menu._renderAndShow( event );\n return false;\n });\n },\n\n // render the menu, append to the page body at the click position, and set up the 'click-away' handlers, show\n _renderAndShow: function( clickEvent ){\n this.render();\n this.$el.appendTo( 'body' ).css( this._getShownPosition( clickEvent )).show();\n this._setUpCloseBehavior();\n },\n\n // render the menu\n // this menu doesn't attach itself to the DOM ( see _renderAndShow )\n render: function(){\n // render the menu body absolute and hidden, fill with template\n this.$el.addClass( 'popmenu-wrapper' ).hide()\n .css({ position : 'absolute' })\n .html( this.template( this.$button.attr( 'id' ), this.options ));\n\n // set up behavior on each link/anchor elem\n if( this.options.length ){\n var menu = this;\n //precondition: there should be one option per li\n this.$el.find( 'li' ).each( function( i, li ){\n var option = menu.options[i];\n\n // if the option has 'func', call that function when the anchor is clicked\n if( option.func ){\n $( this ).children( 'a.popupmenu-option' ).click( function( event ){\n option.func.call( menu, event, option );\n // We must preventDefault otherwise clicking \"cancel\"\n // on a purge or something still navigates and causes\n // the action.\n event.preventDefault();\n // bubble up so that an option click will call the close behavior\n });\n }\n });\n }\n return this;\n },\n\n template : function( id, options ){\n return [\n '
                ', this._templateOptions( options ), '
              '\n ].join( '' );\n },\n\n _templateOptions : function( options ){\n if( !options.length ){\n return '
            • (no options)
            • ';\n }\n return _.map( options, function( option ){\n if( option.divider ){\n return '
            • ';\n } else if( option.header ){\n return [ '
            • ', option.html, '
            • ' ].join( '' );\n }\n var href = option.href || 'javascript:void(0);',\n target = ( option.target )?( ' target=\"' + option.target + '\"' ):( '' ),\n check = ( option.checked )?( '' ):( '' );\n return [\n '
            • ',\n check, option.html,\n '
            • '\n ].join( '' );\n }).join( '' );\n },\n\n // get the absolute position/offset for the menu\n _getShownPosition : function( clickEvent ){\n\n // display menu horiz. centered on click...\n var menuWidth = this.$el.width();\n var x = clickEvent.pageX - menuWidth / 2 ;\n\n // adjust to handle horiz. scroll and window dimensions ( draw entirely on visible screen area )\n x = Math.min( x, $( document ).scrollLeft() + $( window ).width() - menuWidth - 5 );\n x = Math.max( x, $( document ).scrollLeft() + 5 );\n return {\n top: clickEvent.pageY,\n left: x\n };\n },\n\n // bind an event handler to all available frames so that when anything is clicked\n // the menu is removed from the DOM and the event handler unbinds itself\n _setUpCloseBehavior: function(){\n var menu = this;\n//TODO: alternately: focus hack, blocking overlay, jquery.blockui\n\n // function to close popup and unbind itself\n function closePopup( event ){\n $( document ).off( 'click.close_popup' );\n if( window && window.parent !== window ){\n try {\n $( window.parent.document ).off( \"click.close_popup\" );\n } catch( err ){}\n } else {\n try {\n $( 'iframe#galaxy_main' ).contents().off( \"click.close_popup\" );\n } catch( err ){}\n }\n menu.remove();\n }\n\n $( 'html' ).one( \"click.close_popup\", closePopup );\n if( window && window.parent !== window ){\n try {\n $( window.parent.document ).find( 'html' ).one( \"click.close_popup\", closePopup );\n } catch( err ){}\n } else {\n try {\n $( 'iframe#galaxy_main' ).contents().one( \"click.close_popup\", closePopup );\n } catch( err ){}\n }\n },\n\n // add a menu option/item at the given index\n addItem: function( item, index ){\n // append to end if no index\n index = ( index >= 0 ) ? index : this.options.length;\n this.options.splice( index, 0, item );\n return this;\n },\n\n // remove a menu option/item at the given index\n removeItem: function( index ){\n if( index >=0 ){\n this.options.splice( index, 1 );\n }\n return this;\n },\n\n // search for a menu option by its html\n findIndexByHtml: function( html ){\n for( var i = 0; i < this.options.length; i++ ){\n if( _.has( this.options[i], 'html' ) && ( this.options[i].html === html )){\n return i;\n }\n }\n return null;\n },\n\n // search for a menu option by its html\n findItemByHtml: function( html ){\n return this.options[( this.findIndexByHtml( html ))];\n },\n\n // string representation\n toString: function(){\n return 'PopupMenu';\n }\n});\n/** shortcut to new for when you don't need to preserve the ref */\nPopupMenu.create = function _create( $button, options ){\n return new PopupMenu( $button, options );\n};\n\n// -----------------------------------------------------------------------------\n// the following class functions are bridges from the original make_popupmenu and make_popup_menus\n// to the newer backbone.js PopupMenu\n\n/** Create a PopupMenu from simple map initial_options activated by clicking button_element.\n * Converts initial_options to object array used by PopupMenu.\n * @param {jQuery|DOMElement} button_element element which, when clicked, activates menu\n * @param {Object} initial_options map of key -> values, where\n * key is option text, value is fn to call when option is clicked\n * @returns {PopupMenu} the PopupMenu created\n */\nPopupMenu.make_popupmenu = function( button_element, initial_options ){\n var convertedOptions = [];\n _.each( initial_options, function( optionVal, optionKey ){\n var newOption = { html: optionKey };\n\n // keys with null values indicate: header\n if( optionVal === null ){ // !optionVal? (null only?)\n newOption.header = true;\n\n // keys with function values indicate: a menu option\n } else if( jQuery.type( optionVal ) === 'function' ){\n newOption.func = optionVal;\n }\n //TODO:?? any other special optionVals?\n // there was no divider option originally\n convertedOptions.push( newOption );\n });\n return new PopupMenu( $( button_element ), convertedOptions );\n};\n\n/** Find all anchors in $parent (using selector) and covert anchors into a PopupMenu options map.\n * @param {jQuery} $parent the element that contains the links to convert to options\n * @param {String} selector jq selector string to find links\n * @returns {Object[]} the options array to initialize a PopupMenu\n */\n//TODO: lose parent and selector, pass in array of links, use map to return options\nPopupMenu.convertLinksToOptions = function( $parent, selector ){\n $parent = $( $parent );\n selector = selector || 'a';\n var options = [];\n $parent.find( selector ).each( function( elem, i ){\n var option = {}, $link = $( elem );\n\n // convert link text to the option text (html) and the href into the option func\n option.html = $link.text();\n if( $link.attr( 'href' ) ){\n var linkHref = $link.attr( 'href' ),\n linkTarget = $link.attr( 'target' ),\n confirmText = $link.attr( 'confirm' );\n\n option.func = function(){\n // if there's a \"confirm\" attribute, throw up a confirmation dialog, and\n // if the user cancels - do nothing\n if( ( confirmText ) && ( !confirm( confirmText ) ) ){ return; }\n\n // if there's no confirm attribute, or the user accepted the confirm dialog:\n switch( linkTarget ){\n // relocate the center panel\n case '_parent':\n window.parent.location = linkHref;\n break;\n\n // relocate the entire window\n case '_top':\n window.top.location = linkHref;\n break;\n\n // relocate this panel\n default:\n window.location = linkHref;\n }\n };\n }\n options.push( option );\n });\n return options;\n};\n\n/** Create a single popupmenu from existing DOM button and anchor elements\n * @param {jQuery} $buttonElement the element that when clicked will open the menu\n * @param {jQuery} $menuElement the element that contains the anchors to convert into a menu\n * @param {String} menuElementLinkSelector jq selector string used to find anchors to be made into menu options\n * @returns {PopupMenu} the PopupMenu (Backbone View) that can render, control the menu\n */\nPopupMenu.fromExistingDom = function( $buttonElement, $menuElement, menuElementLinkSelector ){\n $buttonElement = $( $buttonElement );\n $menuElement = $( $menuElement );\n var options = PopupMenu.convertLinksToOptions( $menuElement, menuElementLinkSelector );\n // we're done with the menu (having converted it to an options map)\n $menuElement.remove();\n return new PopupMenu( $buttonElement, options );\n};\n\n/** Create all popupmenus within a document or a more specific element\n * @param {DOMElement} parent the DOM element in which to search for popupmenus to build (defaults to document)\n * @param {String} menuSelector jq selector string to find popupmenu menu elements (defaults to \"div[popupmenu]\")\n * @param {Function} buttonSelectorBuildFn the function to build the jq button selector.\n * Will be passed $menuElement, parent.\n * (Defaults to return '#' + $menuElement.attr( 'popupmenu' ); )\n * @returns {PopupMenu[]} array of popupmenus created\n */\nPopupMenu.make_popup_menus = function( parent, menuSelector, buttonSelectorBuildFn ){\n parent = parent || document;\n // orig. Glx popupmenu menus have a (non-std) attribute 'popupmenu'\n // which contains the id of the button that activates the menu\n menuSelector = menuSelector || 'div[popupmenu]';\n // default to (orig. Glx) matching button to menu by using the popupmenu attr of the menu as the id of the button\n buttonSelectorBuildFn = buttonSelectorBuildFn || function( $menuElement, parent ){\n return '#' + $menuElement.attr( 'popupmenu' );\n };\n\n // aggregate and return all PopupMenus\n var popupMenusCreated = [];\n $( parent ).find( menuSelector ).each( function(){\n var $menuElement = $( this ),\n $buttonElement = $( parent ).find( buttonSelectorBuildFn( $menuElement, parent ) );\n popupMenusCreated.push( PopupMenu.fromDom( $buttonElement, $menuElement ) );\n $buttonElement.addClass( 'popup' );\n });\n return popupMenusCreated;\n};\n\n\n// =============================================================================\n return PopupMenu;\n});\n\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/popup-menu.js\n ** module id = 79\n ** module chunks = 3\n **/","/** 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 ( 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 ( 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 '' +\n '
              ' +\n '' + options.path + '' +\n '' + Utils.bytesToString( options.size ) + '' +\n '' + options.ctime + '' +\n '';\n },\n\n /** Template of table */\n _templateTable: function() {\n return 'Available files: ' +\n '' +\n '' +\n '  ' +\n '' +\n '' +\n '' +\n '' +\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/upload/upload-ftp.js\n ** module id = 80\n ** module chunks = 3\n **/","/** 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\t wrapper.append($el);\n\t this.row.append(wrapper);\n\t },\n\t \n\t // header\n\t appendHeader: function() {\n\t // append header row\n\t this.$thead.append(this.row);\n\t\n\t // row\n\t this.row = $('');\n\t },\n\t \n\t // add row cell\n\t add: function($el, width, align) {\n\t var wrapper = $('');\n\t if (width) {\n\t wrapper.css('width', width);\n\t }\n\t if (align) {\n\t wrapper.css('text-align', align);\n\t }\n\t wrapper.append($el);\n\t this.row.append(wrapper);\n\t },\n\t \n\t // append\n\t append: function(id, fade) {\n\t this._commit(id, fade, false);\n\t },\n\t \n\t // prepend\n\t prepend: function(id, fade) {\n\t this._commit(id, fade, true);\n\t },\n\t \n\t // get element\n\t get: function(id) {\n\t return this.$el.find('#' + id);\n\t },\n\t \n\t // delete\n\t del: function(id) {\n\t var item = this.$tbody.find('#' + id);\n\t if (item.length > 0) {\n\t item.remove();\n\t this.row_count--;\n\t this._refresh();\n\t }\n\t },\n\t\n\t // delete all\n\t delAll: function() {\n\t this.$tbody.empty();\n\t this.row_count = 0;\n\t this._refresh();\n\t },\n\t \n\t // value\n\t value: function(new_value) {\n\t // get current id/value\n\t this.before = this.$tbody.find('.current').attr('id');\n\t \n\t // check if new_value is defined\n\t if (new_value !== undefined) {\n\t this.$tbody.find('tr').removeClass('current');\n\t if (new_value) {\n\t this.$tbody.find('#' + new_value).addClass('current');\n\t }\n\t }\n\t \n\t // get current id/value\n\t var after = this.$tbody.find('.current').attr('id');\n\t if(after === undefined) {\n\t return null;\n\t } else {\n\t // fire onchange\n\t if (after != this.before && this.options.onchange) {\n\t this.options.onchange(new_value);\n\t }\n\t \n\t // return current value\n\t return after;\n\t }\n\t },\n\t \n\t // size\n\t size: function() {\n\t return this.$tbody.find('tr').length;\n\t },\n\t \n\t // commit\n\t _commit: function(id, fade, prepend) {\n\t // remove previous item with same id\n\t this.del(id);\n\t \n\t // add\n\t this.row.attr('id', id);\n\t \n\t // add row\n\t if (prepend) {\n\t this.$tbody.prepend(this.row);\n\t } else {\n\t this.$tbody.append(this.row);\n\t }\n\t \n\t // fade mode\n\t if (fade) {\n\t this.row.hide();\n\t this.row.fadeIn();\n\t }\n\t \n\t // row\n\t this.row = this._row();\n\t \n\t // row count\n\t this.row_count++;\n\t this._refresh();\n\t },\n\t \n\t // create new row\n\t _row: function() {\n\t return $('');\n\t },\n\t \n\t // onclick\n\t _onclick: function(e) {\n\t // get values\n\t var old_value = this.value();\n\t var new_value = $(e.target).closest('tr').attr('id');\n\t if (new_value != ''){\n\t // check equality\n\t if (new_value && old_value != new_value) {\n\t if (this.options.onconfirm) {\n\t this.options.onconfirm(new_value);\n\t } else {\n\t this.value(new_value);\n\t }\n\t }\n\t }\n\t },\n\t\n\t // ondblclick\n\t _ondblclick: function(e) {\n\t var value = this.value();\n\t if (value && this.options.ondblclick) {\n\t this.options.ondblclick(value);\n\t }\n\t },\n\t \n\t // refresh\n\t _refresh: function() {\n\t if (this.row_count == 0) {\n\t this.$tmessage.show();\n\t } else {\n\t this.$tmessage.hide();\n\t }\n\t },\n\t \n\t // load html template\n\t _template: function(options) {\n\t return '
              ' +\n\t '
              ' ).append( $checkbox ) )\n .append( $( '' ).append( parameter.title ) ) )\n });\n this.$cover[ this.model.get( 'enabled' ) && 'hide' || 'show' ]();\n }\n });\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/upload/upload-settings.js\n ** module id = 81\n ** module chunks = 3\n **/","(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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/ui/hoverhighlight.js\n ** module id = 84\n ** module chunks = 3\n **/","// 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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/ui/search-input.js\n ** module id = 85\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/utils/natural-sort.js\n ** module id = 87\n ** module chunks = 3\n **/","/*\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 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 if (xhr.responseText) {\n try {\n response = jQuery.parseJSON(xhr.responseText);\n } catch (e) {\n response = xhr.responseText;\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 + ')');\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/utils/uploadbox.js\n ** module id = 88\n ** module chunks = 3\n **/","var RightPanel = require( 'layout/panel' ).RightPanel,\n 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 = RightPanel.extend({\n\n title : _l( 'History' ),\n\n initialize : function( options ){\n RightPanel.prototype.initialize.call( this, options );\n this.options = _.pick( options, 'userIsAnonymous', 'allow_user_dataset_purge', 'galaxyRoot' );\n\n // view of the current history\n this.historyView = new CurrentHistoryView({\n className : CurrentHistoryView.prototype.className + ' middle',\n purgeAllowed : options.allow_user_dataset_purge,\n linkTarget : 'galaxy_main'\n });\n },\n\n /** override to change footer selector */\n $toggleButton : function(){\n return this.$( '.footer > .panel-collapse' );\n },\n\n render : function(){\n RightPanel.prototype.render.call( this );\n this.optionsMenu = historyOptionsMenu( this.$( '#history-options-button' ), {\n anonymous : this.options.userIsAnonymous,\n purgeAllowed : this.options.allow_user_dataset_purge,\n root : this.options.galaxyRoot\n });\n this.$( '> .header .buttons [title]' ).tooltip({ placement: 'bottom' });\n this.historyView.setElement( this.$( '.history-panel' ) );\n this.$el.attr( 'class', 'history-right-panel' );\n },\n\n /** override to add buttons */\n _templateHeader: function( data ){\n var historyUrl = this.options.galaxyRoot + 'history';\n var multiUrl = this.options.galaxyRoot + 'history/view_multiple';\n return [\n '
              ',\n '
              ',\n // this button re-fetches the history and contents and re-renders the history panel\n '',\n // opens a drop down menu with history related functions (like view all, delete, share, etc.)\n '',\n !this.options.userIsAnonymous?\n [ '' ].join('') : '',\n '
              ',\n '
              ', _.escape( this.title ), '
              ',\n '
              ',\n ].join('');\n },\n\n /** add history view div */\n _templateBody : function( data ){\n return [\n '
              ',\n ].join('');\n },\n\n /** override to use simplified selector */\n _templateFooter: function( data ){\n return [\n '
              ',\n '
              ',\n '
              ',\n '
              ',\n ].join('');\n },\n\n events : {\n 'click #history-refresh-button' : '_clickRefresh',\n // override to change footer selector\n 'mousedown .footer > .drag' : '_mousedownDragHandler',\n 'click .footer > .panel-collapse' : 'toggle'\n },\n\n _clickRefresh : function( ev ){\n ev.preventDefault();\n this.historyView.loadCurrentHistory();\n },\n\n toString : function(){ return 'HistoryPanel'; }\n});\n\nmodule.exports = HistoryPanel;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/apps/history-panel.js\n ** module id = 89\n ** module chunks = 3\n **/","var LeftPanel = require( 'layout/panel' ).LeftPanel,\n Tools = require( 'mvc/tool/tools' ),\n Upload = require( 'mvc/upload/upload-view' ),\n _l = require( 'utils/localization' );\n\n/* Builds the tool menu panel on the left of the analysis page */\nvar ToolPanel = LeftPanel.extend({\n\n title : _l( 'Tools' ),\n\n initialize: function( options ){\n LeftPanel.prototype.initialize.call( this, options );\n this.log( this + '.initialize:', options );\n\n /** @type {Object[]} descriptions of user's workflows to be shown in the tool menu */\n this.stored_workflow_menu_entries = options.stored_workflow_menu_entries || [];\n\n // create tool search, tool panel, and tool panel view.\n var tool_search = new Tools.ToolSearch({\n search_url : options.search_url,\n hidden : false\n });\n var tools = new Tools.ToolCollection( options.toolbox );\n this.tool_panel = new Tools.ToolPanel({\n tool_search : tool_search,\n tools : tools,\n layout : options.toolbox_in_panel\n });\n this.tool_panel_view = new Tools.ToolPanelView({ model: this.tool_panel });\n\n // add upload modal\n this.uploadButton = new Upload({\n nginx_upload_path : options.nginx_upload_path,\n ftp_upload_site : options.ftp_upload_site,\n default_genome : options.default_genome,\n default_extension : options.default_extension,\n });\n },\n\n render : function(){\n var self = this;\n LeftPanel.prototype.render.call( self );\n self.$( '.panel-header-buttons' ).append( self.uploadButton.$el );\n\n // if there are tools, render panel and display everything\n if (self.tool_panel.get( 'layout' ).size() > 0) {\n self.tool_panel_view.render();\n //TODO: why the hide/show?\n self.$( '.toolMenu' ).show();\n }\n self.$( '.toolMenuContainer' ).prepend( self.tool_panel_view.$el );\n\n self._renderWorkflowMenu();\n\n // if a tool link has the minsizehint attribute, handle it here (gen. by hiding the tool panel)\n self.$( 'a[minsizehint]' ).click( function() {\n if ( parent.handle_minwidth_hint ) {\n parent.handle_minwidth_hint( $( self ).attr( 'minsizehint' ) );\n }\n });\n },\n\n /** build the dom for the workflow portion of the tool menu */\n _renderWorkflowMenu : function(){\n var self = this;\n // add internal workflow list\n self.$( '#internal-workflows' ).append( self._templateTool({\n title : _l( 'All workflows' ),\n href : 'workflow/list_for_run'\n }));\n _.each( self.stored_workflow_menu_entries, function( menu_entry ){\n self.$( '#internal-workflows' ).append( self._templateTool({\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 // global\n '', tool.title, '',\n '
              '\n ].join('');\n },\n\n /** override to include inital menu dom and workflow section */\n _templateBody : function(){\n return [\n '
              ',\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 '
              '\n ].join('');\n },\n\n toString : function(){ return 'ToolPanel'; }\n});\n\nmodule.exports = ToolPanel;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/apps/tool-panel.js\n ** module id = 90\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-li-edit.js\n ** module id = 106\n ** module chunks = 3\n **/","define([\n \"mvc/collection/collection-view\",\n \"mvc/collection/collection-model\",\n \"mvc/collection/collection-li-edit\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function( DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, _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 //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 },\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-view-edit.js\n ** module id = 107\n ** module chunks = 3\n **/","define([\n \"utils/levenshtein\",\n \"utils/natural-sort\",\n \"mvc/collection/list-collection-creator\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( levenshteinDistance, naturalSort, LIST_COLLECTION_CREATOR, 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({\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._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 1.0; },\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 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( PairedCollectionCreator.templates.main() );\n this.$el.empty().html( PairedCollectionCreator.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( PairedCollectionCreator.templates.header() )\n .find( '.help-content' ).prepend( $( PairedCollectionCreator.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( PairedCollectionCreator.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 /** render the footer, completion controls, and cancel controls */\n _renderFooter : function( speed, callback ){\n var $footer = this.$( '.footer' ).empty().html( PairedCollectionCreator.templates.footer() );\n this.$( '.remove-extensions' ).prop( 'checked', this.removeExtensions );\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n return $footer;\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 .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 'click .cancel-create' : function( ev ){\n if( typeof this.oncancel === 'function' ){\n this.oncancel.call( this );\n }\n },\n 'click .create-collection' : '_clickCreate'//,\n },\n\n // ........................................................................ header\n /** expand help */\n _clickMoreHelp : function( ev ){\n this.$( '.main-help' ).addClass( 'expanded' );\n this.$( '.more-help' ).hide();\n },\n /** collapse help */\n _clickLessHelp : function( ev ){\n this.$( '.main-help' ).removeClass( 'expanded' );\n this.$( '.more-help' ).show();\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' ).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 /** 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 /** 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 /** 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();\n }\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\n\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 */\nPairedCollectionCreator.templates = PairedCollectionCreator.templates || {\n\n /** the skeleton */\n main : _.template([\n '
              ',\n '
              ',\n '
              '\n ].join('')),\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 '
                      ', _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 ){\n var elements = collection.toJSON();\n//TODO: validate elements\n return pairedCollectionCreatorModal( elements, {\n historyId : collection.historyId\n });\n}\n\n\n//=============================================================================\n return {\n PairedCollectionCreator : PairedCollectionCreator,\n pairedCollectionCreatorModal : pairedCollectionCreatorModal,\n createListOfPairsCollection : createListOfPairsCollection\n };\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js\n ** module id = 108\n ** module chunks = 3\n **/","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 ){\n var elements = contents.toJSON(),\n promise = pairCollectionCreatorModal( elements, {\n creationFn : function( elements, name ){\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 );\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/pair-collection-creator.js\n ** module id = 109\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/copy-dialog.js\n ** module id = 110\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hda-li-edit.js\n ** module id = 111\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hdca-li-edit.js\n ** module id = 112\n ** module chunks = 3\n **/","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 'galaxy_main: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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-view-edit-current.js\n ** module id = 113\n ** module chunks = 3\n **/","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 /** 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() {\n LIST_COLLECTION_CREATOR.createListCollection( panel.getSelectedModels() )\n .done( function(){ panel.model.refresh(); });\n }\n },\n // TODO: Only show quick pair if two things selected.\n { html: _l( 'Build Dataset Pair' ), func: function() {\n PAIR_COLLECTION_CREATOR.createPairCollection( panel.getSelectedModels() )\n .done( function(){ panel.model.refresh(); });\n }\n },\n { html: _l( 'Build List of Dataset Pairs' ), func: function() {\n LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection( panel.getSelectedModels() )\n .done( function(){ panel.model.refresh(); });\n }\n },\n ];\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-view-edit.js\n ** module id = 114\n ** module chunks = 3\n **/","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.contents.fetchPrevPage();\n },\n\n _clickNextPage : function( ev ){\n this.model.contents.fetchNextPage();\n },\n\n _changePageSelect : function( ev ){\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-view.js\n ** module id = 115\n ** module chunks = 3\n **/","define([\n \"mvc/ui/popup-menu\",\n \"mvc/history/copy-dialog\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( PopupMenu, historyCopyDialog, BASE_MVC, _l ){\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 : 'history/list',\n },\n {\n html : _l( 'Histories Shared with Me' ),\n href : 'history/list_shared'\n },\n\n {\n html : _l( 'History Actions' ),\n header : true,\n anon : true\n },\n {\n html : _l( 'Create New' ),\n func : function(){ Galaxy.currHistoryPanel.createNewHistory(); }\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_main.window.location.href = 'history/delete?id=' + Galaxy.currHistoryPanel.model.id;\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_main.window.location.href = 'history/delete?purge=True&id=' + Galaxy.currHistoryPanel.model.id;\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(){ Galaxy.currHistoryPanel.collapseAll(); }\n },\n {\n html : _l( 'Unhide Hidden Datasets' ),\n anon : true,\n func : function(){ Galaxy.currHistoryPanel.unhideHidden(); }\n },\n {\n html : _l( 'Delete Hidden Datasets' ),\n anon : true,\n func : function(){ Galaxy.currHistoryPanel.deleteHidden(); }\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 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\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 = '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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/options-menu.js\n ** module id = 116\n ** module chunks = 3\n **/","/**\n * Renders tabs e.g. used in the Charts editor, behaves similar to repeat and section rendering\n */\ndefine( [ 'utils/utils' ], function( Utils ) {\nvar View = Backbone.View.extend({\n initialize : function( options ) {\n var self = this;\n this.visible = false;\n this.$nav = null;\n this.$content = null;\n this.first_tab = null;\n this.current_id = null;\n this.list = {};\n this.options = Utils.merge( options, {\n title_new : '',\n operations : null,\n onnew : null,\n max : null,\n onchange : null\n });\n this.setElement( $( this._template( this.options ) ) );\n this.$nav = this.$( '.tab-navigation' );\n this.$content = this.$( '.tab-content' );\n this.$operations = this.$nav.find( '.tab-operations' );\n\n // Renders tab operations\n if ( this.options.operations ) {\n $.each( this.options.operations, function( name, item ) {\n item.$el.prop( 'id', name );\n self.$operations.append( item.$el );\n });\n }\n\n // Allows user to add new tabs\n this.options.onnew && this.$nav.append( $( this._template_tab_new( this.options ) )\n .tooltip( { title: 'Add a new tab', placement: 'bottom', container: self.$el } )\n .on( 'click', function( e ) { self.options.onnew() } )\n );\n this.$tabnew = this.$nav.find( '.tab-new' );\n\n // Remove all tooltips on click\n this.$el.on( 'click', function() { $( '.tooltip' ).hide() } );\n },\n\n /** Returns current number of tabs */\n size: function() {\n return _.size( this.list );\n },\n\n /** Returns tab id for currently shown tab */\n current: function() {\n return this.$el.find( '.tab-pane.active' ).attr( 'id' );\n },\n\n /** Adds a new tab */\n add: function( options ) {\n var self = this;\n var id = options.id;\n var $tab_title = $( this._template_tab( options ) );\n var $tab_content = $( '
                        ' ).attr( 'id', options.id ).addClass( 'tab-pane' );\n\n // hide new tab if maximum number of tabs has been reached\n this.list[ id ] = true;\n if ( this.options.max && this.size() >= this.options.max ) {\n this.$tabnew.hide();\n }\n\n // insert tab before new tab or as last tab\n if ( this.options.onnew ) {\n this.$tabnew.before( $tab_title );\n } else {\n this.$nav.append( $tab_title );\n }\n\n // assing delete callback if provided\n if ( options.ondel ) {\n $tab_title.find( '.tab-delete' ).tooltip( { title: 'Delete this tab', placement: 'bottom', container: self.$el } )\n .on( 'click', function() { options.ondel() } );\n } else {\n $tab_title.tooltip( { title: options.tooltip, placement: 'bottom', container: self.$el } );\n }\n $tab_title.on( 'click', function( e ) {\n e.preventDefault();\n options.onclick ? options.onclick() : self.show( id );\n });\n this.$content.append( $tab_content.append( options.$el ) );\n\n // assign current/first tab\n if ( this.size() == 1 ) {\n $tab_title.addClass( 'active' );\n $tab_content.addClass( 'active' );\n this.first_tab = id;\n }\n if ( !this.current_id ) {\n this.current_id = id;\n }\n },\n\n /** Delete tab */\n del: function( id ) {\n this.$( '#tab-' + id ).remove();\n this.$( '#' + id ).remove();\n this.first_tab = this.first_tab == id ? null : this.first_tab;\n this.first_tab != null && this.show( this.first_tab );\n this.list[ id ] && delete this.list[ id ];\n if ( this.size() < this.options.max ) {\n this.$el.find( '.ui-tabs-new' ).show();\n }\n },\n\n /** Delete all tabs */\n delAll: function() {\n for ( var id in this.list ) {\n this.del( id );\n }\n },\n\n /** Show tab view and highlight a tab by id */\n show: function( id ){\n this.$el.fadeIn( 'fast' );\n this.visible = true;\n if ( id ) {\n this.$( '#tab-' + this.current_id ).removeClass('active' );\n this.$( '#' + this.current_id ).removeClass('active' );\n this.$( '#tab-' + id ).addClass( 'active' );\n this.$( '#' + id ).addClass( 'active' );\n this.current_id = id;\n }\n this.options.onchange && this.options.onchange( id );\n },\n \n /** Hide tab view */\n hide: function(){\n this.$el.fadeOut( 'fast' );\n this.visible = false;\n },\n\n /** Show tab */\n showTab: function( id ) {\n this.$( '#tab-' + id ).show();\n },\n\n /** hide tab */\n hideTab: function( id ) {\n this.$( '#tab-' + id ).hide();\n },\n\n /** Hide operation by id */\n hideOperation: function( id ) {\n this.$nav.find( '#' + id ).hide();\n },\n\n /** Show operation by id */\n showOperation: function( id ) {\n this.$nav.find( '#' + id ).show();\n },\n\n /** Reassign an operation to a new callback */\n setOperation: function( id, callback ) {\n this.$nav.find( '#' + id ).off('click').on( 'click', callback );\n },\n\n /** Set/Get title */\n title: function( id, new_title ) {\n var $el = this.$( '#tab-title-text-' + id );\n new_title && $el.html( new_title );\n return $el.html();\n },\n\n /** Enumerate titles */\n retitle: function( new_title ) {\n var index = 0;\n for ( var id in this.list ) {\n this.title( id, ++index + ': ' + new_title );\n }\n },\n\n /** Main template */\n _template: function( options ) {\n return $( '
                        ' ).addClass( 'ui-tabs tabbable tabs-left' )\n .append( $( '
                      • ' +\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 '
                        ',\n\t '
                        '\n\t ].join( '' );\n\t }\n\t});\n\t\n\t//==============================================================================\n\treturn {\n\t CitationView : CitationView,\n\t CitationListView : CitationListView\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 29 */\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__ = [\n\t __webpack_require__(42),\n\t __webpack_require__(32),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_ITEM, DATASET_LI, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t//==============================================================================\n\tvar FoldoutListItemView = LIST_ITEM.FoldoutListItemView,\n\t ListItemView = LIST_ITEM.ListItemView;\n\t/** @class Read only view for DatasetCollection.\n\t */\n\tvar 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\tDCListItemView.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 ){ %>',\n\t '
                        ',\n\t _l( 'There was an error getting the data for this collection' ), ': <%- model.error %>',\n\t '
                        ',\n\t '<% } %>'\n\t ]),\n\t purged : BASE_MVC.wrapTemplate([\n\t '<% if( model.purged ){ %>',\n\t '
                        ',\n\t _l( 'This collection has been deleted and removed from disk' ),\n\t '
                        ',\n\t '<% } %>'\n\t ]),\n\t deleted : BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>',\n\t '
                        ',\n\t _l( 'This collection has been deleted' ),\n\t '
                        ',\n\t '<% } %>'\n\t ])\n\t });\n\t\n\t // use element identifier\n\t var titleBarTemplate = BASE_MVC.wrapTemplate([\n\t '
                        ',\n\t '
                        ',\n\t '<%- collection.element_identifier || collection.name %>',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ], 'collection' );\n\t\n\t // use element identifier\n\t var subtitleTemplate = BASE_MVC.wrapTemplate([\n\t '
                        ',\n\t '<% var countText = collection.element_count? ( collection.element_count + \" \" ) : \"\"; %>',\n\t '<% if( collection.collection_type === \"list\" ){ %>',\n\t _l( 'a list of <%- countText %>datasets' ),\n\t '<% } else if( collection.collection_type === \"paired\" ){ %>',\n\t _l( 'a pair of datasets' ),\n\t '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n\t _l( 'a list of <%- countText %>dataset pairs' ),\n\t '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n\t _l( 'a list of <%- countText %>dataset lists' ),\n\t '<% } %>',\n\t '
                        '\n\t ], '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//==============================================================================\n\t/** @class Read only view for DatasetCollectionElement.\n\t */\n\tvar 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 ){ this.logger = this.model.logger = attributes.logger; }\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\tDCEListItemView.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([\n\t '
                        ',\n\t '
                        ',\n\t '<%- element.element_identifier %>',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ], 'element' );\n\t\n\t return _.extend( {}, ListItemView.prototype.templates, {\n\t titleBar : titleBarTemplate\n\t });\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\tvar 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 ){ this.logger = this.model.logger = attributes.logger; }\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\tDatasetDCEListItemView.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([\n\t '
                        ',\n\t '',\n\t '
                        ',\n\t '<%- element.element_identifier %>',\n\t '
                        ',\n\t '
                        '\n\t ], '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//==============================================================================\n\t/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 30 */\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__ = [\n\t __webpack_require__(70),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DATASET_MODEL, BASE_MVC, _l ){\n\t'use strict';\n\t\n\t//==============================================================================\n\t/*\n\tNotes:\n\t\n\tTerminology:\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\tThis 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\tMany of the classes and heirarchy are meant as extension points so, while the\n\trelations and flow may be difficult to understand initially, they'll allow us to\n\thandle the growth or flux dataset collection in the future (w/o actually implementing\n\tany 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\tvar 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\tvar DatasetCollectionElement = Backbone.Model\n\t .extend( BASE_MVC.LoggableMixin )\n\t .extend( DatasetCollectionElementMixin )\n\t .extend({ _logNamespace : 'collections' });\n\t\n\t\n\t//==============================================================================\n\t/** @class Base/Abstract Backbone collection for Generic DCEs. */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for a dataset collection element that is a dataset (HDA).\n\t */\n\tvar 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( {},\n\t DATASET_MODEL.DatasetAssociation.prototype.defaults,\n\t DatasetCollectionElementMixin.defaults\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//==============================================================================\n\t/** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n\t */\n\tvar 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\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\tvar DatasetCollection = Backbone.Model\n\t .extend( BASE_MVC.LoggableMixin )\n\t .extend( BASE_MVC.SearchableModelMixin )\n\t .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 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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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 : [\n\t 'name'\n\t ],\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//==============================================================================\n\t/** Model for a DatasetCollection containing datasets (non-nested).\n\t */\n\tvar 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(){ 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\tvar PairDatasetCollection = ListDatasetCollection.extend(\n\t/** @lends PairDatasetCollection.prototype */{\n\t\n\t /** String representation. */\n\t toString : function(){ 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\tvar 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//==============================================================================\n\t/** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone collection for a backbone collection containing paired dataset collections.\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for a list dataset collection within a list:list dataset collection. */\n\tvar 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//==============================================================================\n\t/** @class Backbone collection containing list dataset collections. */\n\tvar 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//==============================================================================\n\t/** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 31 */\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__ = [\n\t __webpack_require__(39),\n\t __webpack_require__(12),\n\t __webpack_require__(6),\n\t __webpack_require__(8),\n\t __webpack_require__(87),\n\t __webpack_require__(5),\n\t __webpack_require__(84)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( HDCA, STATES, BASE_MVC, UI_MODAL, naturalSort, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'collections';\n\t/*==============================================================================\n\tTODO:\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\tvar 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\n\t .attr( 'data-element-id', this.element.id )\n\t .attr( 'draggable', true )\n\t .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([\n\t '',\n\t '<%- element.name %>',\n\t '',\n\t '',\n\t ].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(',\n\t _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 ){ ev = ev.originalEvent; }\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// ============================================================================\n\t/** An interface for building collections.\n\t */\n\tvar ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).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(){ throw new TypeError( 'no creation fn for creator' ); },\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 /** 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._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 if( element.state !== STATES.OK ){\n\t if( _.contains( STATES.NOT_READY_STATES, element.state ) ){\n\t return _l( \"hasn't finished running yet\" );\n\t }\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\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() )\n\t .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 /** render the footer, completion controls, and cancel controls */\n\t _renderFooter : function( speed, callback ){\n\t var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );\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 /** 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 /** 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 _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 )\n\t .always( function(){\n\t creator.blocking = false;\n\t })\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 })\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.' ) +\n\t _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 'click .cancel-create' : function( ev ){\n\t if( typeof this.oncancel === 'function' ){\n\t this.oncancel.call( this );\n\t }\n\t },\n\t 'click .create-collection' : '_clickCreate'//,\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' )\n\t .attr( 'class', 'alert alert-dismissable' ).addClass( alertClass ).show()\n\t .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 // ........................................................................ 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 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 ){ ev = ev.originalEvent; }\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 // ........................................................................ 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 /** 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 // ------------------------------------------------------------------------ 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 : {\n\t /** the skeleton */\n\t main : _.template([\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ].join('')),\n\t\n\t /** the header (not including help text) */\n\t header : _.template([\n\t '
                        ',\n\t '', _l( 'More help' ), '',\n\t '
                        ',\n\t '', _l( 'Less' ), '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '',\n\t '
                        ',\n\t ].join('')),\n\t\n\t /** the middle: element list */\n\t middle : _.template([\n\t '',\n\t '
                        ',\n\t '
                        '\n\t ].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer : _.template([\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '
                        ', _l( 'Name' ), ':
                        ',\n\t '
                        ',\n\t '
                        ',\n\t\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '
                        ',\n\t '',\n\t '',\n\t '
                        ',\n\t '
                        ',\n\t\n\t '
                        ',\n\t '',\n\t '
                        ',\n\t '
                        '\n\t ].join('')),\n\t\n\t /** help content */\n\t helpContent : _.template([\n\t '

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

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

                        ',\n\t '

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

                        '\n\t ].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t invalidElements : _.template([\n\t _l( 'The following selections could not be included due to problems:' ),\n\t '
                          <% _.each( problems, function( problem ){ %>',\n\t '
                        • <%- problem.element.name %>: <%- problem.text %>
                        • ',\n\t '<% }); %>
                        '\n\t ].join('')),\n\t\n\t /** shown in list when all elements are discarded */\n\t noElementsLeft : _.template([\n\t '
                      • ',\n\t _l( 'No elements left! ' ),\n\t _l( 'Would you like to ' ), '', _l( 'start over' ), '?',\n\t '
                      • '\n\t ].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([\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '<% if( _.size( problems ) ){ %>',\n\t _l( 'The following selections could not be included due to problems' ), ':',\n\t '
                          <% _.each( problems, function( problem ){ %>',\n\t '
                        • <%- problem.element.name %>: <%- problem.text %>
                        • ',\n\t '<% }); %>
                        ',\n\t '<% } else if( _.size( elements ) < 1 ){ %>',\n\t _l( 'No datasets were selected' ), '.',\n\t '<% } %>',\n\t '
                        ',\n\t _l( 'At least one element is needed for the collection' ), '. ',\n\t _l( 'You may need to ' ),\n\t '', _l( 'cancel' ), ' ',\n\t _l( 'and reselect new elements' ), '.',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ].join('')),\n\t },\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString : function(){ return 'ListCollectionCreator'; }\n\t});\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\tvar 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\tvar 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//==============================================================================\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\tfunction createListCollection( contents ){\n\t var elements = contents.toJSON(),\n\t promise = listCollectionCreatorModal( elements, {\n\t creationFn : function( elements, name ){\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 );\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 32 */\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__ = [\n\t __webpack_require__(42),\n\t __webpack_require__(12),\n\t __webpack_require__(22),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_ITEM, STATES, faIconButton, BASE_MVC, _l ){\n\t'use strict';\n\t\n\tvar logNamespace = 'dataset';\n\t/*==============================================================================\n\tTODO:\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\tvar _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\tvar 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 ){ this.logger = this.model.logger = attributes.logger; }\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, options ){\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\n\t && self.model.inReadyState()\n\t && self.expanded\n\t && !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 })\n\t .done( function(){ self.render(); });\n\t\n\t } else {\n\t self.render();\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 ){ callback.call( view ); }\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 )\n\t || ( state === STATES.DISCARDED )\n\t || ( !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\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() )\n\t .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() ){ return ''; }\n\t // render both old and new display apps using the same template\n\t return [\n\t this.templates.displayApplications( this.model.get( 'display_apps' ), this ),\n\t this.templates.displayApplications( this.model.get( 'display_types' ), this )\n\t ].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() ){ return null; }\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 $([\n\t '',\n\t '',\n\t ''\n\t ].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 $([\n\t '
                        ',\n\t '',\n\t '',\n\t '',\n\t '',\n\t '
                        '\n\t ].join( '\\n' ));\n\t },\n\t\n\t // ......................................................................... misc\n\t events : _.extend( _.clone( _super.prototype.events ), {\n\t 'click .display-btn' : function( ev ){ this.trigger( 'display', this, ev ); },\n\t 'click .params-btn' : function( ev ){ this.trigger( 'params', this, ev ); },\n\t 'click .download-btn' : function( ev ){ this.trigger( 'download', this, ev ); }\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\tDatasetListItemView.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\" ){ %>',\n\t '
                        ',\n\t _l( 'An error occurred setting the metadata for this dataset' ),\n\t '
                        ',\n\t '<% } %>'\n\t ]),\n\t error : BASE_MVC.wrapTemplate([\n\t // error during index fetch - show error on dataset\n\t '<% if( model.error ){ %>',\n\t '
                        ',\n\t _l( 'There was an error getting the data for this dataset' ), ': <%- model.error %>',\n\t '
                        ',\n\t '<% } %>'\n\t ]),\n\t purged : BASE_MVC.wrapTemplate([\n\t '<% if( model.purged ){ %>',\n\t '
                        ',\n\t _l( 'This dataset has been deleted and removed from disk' ),\n\t '
                        ',\n\t '<% } %>'\n\t ]),\n\t deleted : BASE_MVC.wrapTemplate([\n\t // deleted not purged\n\t '<% if( model.deleted && !model.purged ){ %>',\n\t '
                        ',\n\t _l( 'This dataset has been deleted' ),\n\t '
                        ',\n\t '<% } %>'\n\t ])\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 '
                        ',\n\t\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t\n\t // do not display tags, annotation, display apps, or peek when deleted\n\t '<% if( !dataset.deleted && !dataset.purged ){ %>',\n\t '
                        ',\n\t '
                        ',\n\t\n\t '
                        ',\n\t\n\t '<% if( dataset.peek ){ %>',\n\t '
                        <%= dataset.peek %>
                        ',\n\t '<% } %>',\n\t '<% } %>',\n\t '
                        '\n\t ], 'dataset' );\n\t\n\t var noAccessTemplate = BASE_MVC.wrapTemplate([\n\t '
                        ',\n\t '
                        ',\n\t _l( 'You do not have permission to view this dataset' ),\n\t '
                        ',\n\t '
                        '\n\t ], '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([\n\t '<% if( dataset.misc_blurb ){ %>',\n\t '
                        ',\n\t '<%- dataset.misc_blurb %>',\n\t '
                        ',\n\t '<% } %>',\n\t\n\t '<% if( dataset.file_ext ){ %>',\n\t '
                        ',\n\t '',\n\t '<%- dataset.file_ext %>',\n\t '
                        ',\n\t '<% } %>',\n\t\n\t '<% if( dataset.metadata_dbkey ){ %>',\n\t '
                        ',\n\t '',\n\t '',\n\t '<%- dataset.metadata_dbkey %>',\n\t '',\n\t '
                        ',\n\t '<% } %>',\n\t\n\t '<% if( dataset.misc_info ){ %>',\n\t '
                        ',\n\t '<%- dataset.misc_info %>',\n\t '
                        ',\n\t '<% } %>'\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.NEW ] = BASE_MVC.wrapTemplate([\n\t '
                        ', _l( 'This is a new dataset and not all of its data are available yet' ), '
                        '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.NOT_VIEWABLE ] = BASE_MVC.wrapTemplate([\n\t '
                        ', _l( 'You do not have permission to view this dataset' ), '
                        '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.DISCARDED ] = BASE_MVC.wrapTemplate([\n\t '
                        ', _l( 'The job creating this dataset was cancelled before completion' ), '
                        '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.QUEUED ] = BASE_MVC.wrapTemplate([\n\t '
                        ', _l( 'This job is waiting to run' ), '
                        '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.RUNNING ] = BASE_MVC.wrapTemplate([\n\t '
                        ', _l( 'This job is currently running' ), '
                        '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.UPLOAD ] = BASE_MVC.wrapTemplate([\n\t '
                        ', _l( 'This dataset is currently uploading' ), '
                        '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.SETTING_METADATA ] = BASE_MVC.wrapTemplate([\n\t '
                        ', _l( 'Metadata is being auto-detected' ), '
                        '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.PAUSED ] = BASE_MVC.wrapTemplate([\n\t '
                        ', _l( 'This job is paused. Use the \"Resume Paused Jobs\" in the history menu to resume' ), '
                        '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.ERROR ] = BASE_MVC.wrapTemplate([\n\t '<% if( !dataset.purged ){ %>',\n\t '
                        <%- dataset.misc_blurb %>
                        ',\n\t '<% } %>',\n\t '', _l( 'An error occurred with this dataset' ), ':',\n\t '
                        <%- dataset.misc_info %>
                        '\n\t ], 'dataset' );\n\t summaryTemplates[ STATES.EMPTY ] = BASE_MVC.wrapTemplate([\n\t '
                        ', _l( 'No data' ), ': <%- dataset.misc_blurb %>
                        '\n\t ], 'dataset' );\n\t summaryTemplates.unknown = BASE_MVC.wrapTemplate([\n\t '
                        Error: unknown dataset state: \"<%- dataset.state %>\"
                        '\n\t ], '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 ){ %>',\n\t '
                        ',\n\t _l( 'The job creating this dataset has been resubmitted' ),\n\t '
                        ',\n\t '<% } %>'\n\t ])\n\t };\n\t\n\t // this is applied to both old and new style display apps\n\t var displayApplicationsTemplate = BASE_MVC.wrapTemplate([\n\t '<% _.each( apps, function( app ){ %>',\n\t '
                        ',\n\t '<%- app.label %> ',\n\t '',\n\t '<% _.each( app.links, function( link ){ %>',\n\t '\" href=\"<%- link.href %>\">',\n\t '<% print( _l( link.text ) ); %>',\n\t ' ',\n\t '<% }); %>',\n\t '',\n\t '
                        ',\n\t '<% }); %>'\n\t ], '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// ============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/* This class maps the form dom to an api compatible javascript dictionary. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils ) {\n\t var Manager = Backbone.Model.extend({\n\t initialize: function( app ) {\n\t this.app = app;\n\t },\n\t\n\t /** Creates a checksum. */\n\t checksum: function() {\n\t var sum = '';\n\t var self = this;\n\t this.app.section.$el.find( '.section-row' ).each( function() {\n\t var id = $(this).attr( 'id' );\n\t var field = self.app.field_list[ id ];\n\t if ( field ) {\n\t sum += id + ':' + JSON.stringify( field.value && field.value() ) + ':' + field.collapsed + ';';\n\t }\n\t });\n\t return sum;\n\t },\n\t\n\t /** Convert dom into a dictionary of flat id/value pairs used e.g. on job submission. */\n\t create: function() {\n\t var self = this;\n\t\n\t // get raw dictionary from dom\n\t var dict = {};\n\t this._iterate( this.app.section.$el, dict );\n\t\n\t // add to result dictionary, label elements\n\t var result_dict = {};\n\t this.flat_dict = {};\n\t function add( flat_id, input_id, input_value ) {\n\t self.flat_dict[ flat_id ] = input_id;\n\t result_dict[ flat_id ] = input_value;\n\t self.app.element_list[ input_id ] && self.app.element_list[ input_id ].$el.attr( 'tour_id', flat_id );\n\t }\n\t // converter between raw dictionary and job dictionary\n\t function convert( identifier, head ) {\n\t for ( var index in head ) {\n\t var node = head[ index ];\n\t if ( node.input ) {\n\t var input = node.input;\n\t var flat_id = identifier;\n\t if ( identifier != '' ) {\n\t flat_id += '|';\n\t }\n\t flat_id += input.name;\n\t switch ( input.type ) {\n\t case 'repeat':\n\t var section_label = 'section-';\n\t var block_indices = [];\n\t var block_prefix = null;\n\t for ( var block_label in node ) {\n\t var pos = block_label.indexOf( section_label );\n\t if ( pos != -1 ) {\n\t pos += section_label.length;\n\t block_indices.push( parseInt( block_label.substr( pos ) ));\n\t if ( !block_prefix ) {\n\t block_prefix = block_label.substr( 0, pos );\n\t }\n\t }\n\t }\n\t block_indices.sort( function( a, b ) { return a - b; });\n\t var index = 0;\n\t for ( var i in block_indices ) {\n\t convert( flat_id + '_' + index++, node[ block_prefix + block_indices[ i ] ]);\n\t }\n\t break;\n\t case 'conditional':\n\t var value = self.app.field_list[ input.id ].value();\n\t add( flat_id + '|' + input.test_param.name, input.id, value );\n\t var selectedCase = matchCase( input, value );\n\t if ( selectedCase != -1 ) {\n\t convert( flat_id, head[ input.id + '-section-' + selectedCase ] );\n\t }\n\t break;\n\t case 'section':\n\t convert( !input.flat && flat_id || '', node );\n\t break;\n\t default:\n\t var field = self.app.field_list[ input.id ];\n\t if ( field && field.value ) {\n\t var value = field.value();\n\t if ( input.ignore === undefined || input.ignore != value ) {\n\t if ( field.collapsed && input.collapsible_value ) {\n\t value = input.collapsible_value;\n\t }\n\t add( flat_id, input.id, value );\n\t if ( input.payload ) {\n\t for ( var p_id in input.payload ) {\n\t add( p_id, input.id, input.payload[ p_id ] );\n\t }\n\t }\n\t }\n\t }\n\t }\n\t }\n\t }\n\t }\n\t convert( '', dict );\n\t return result_dict;\n\t },\n\t\n\t /** Matches flat ids to corresponding input element\n\t * @param{string} flat_id - Flat input id to be looked up.\n\t */\n\t match: function ( flat_id ) {\n\t return this.flat_dict && this.flat_dict[ flat_id ];\n\t },\n\t\n\t /** Match conditional values to selected cases\n\t */\n\t matchCase: function( input, value ) {\n\t return matchCase( input, value );\n\t },\n\t\n\t /** Matches a new tool model to the current input elements e.g. used to update dynamic options\n\t */\n\t matchModel: function( model, callback ) {\n\t var self = this;\n\t visitInputs( model.inputs, function( input, name ) {\n\t self.flat_dict[ name ] && callback ( input, self.flat_dict[ name ] );\n\t });\n\t },\n\t\n\t /** Matches identifier from api response to input elements e.g. used to display validation errors\n\t */\n\t matchResponse: function( response ) {\n\t var result = {};\n\t var self = this;\n\t function search ( id, head ) {\n\t if ( typeof head === 'string' ) {\n\t var input_id = self.flat_dict[ id ];\n\t input_id && ( result[ input_id ] = head );\n\t } else {\n\t for ( var i in head ) {\n\t var new_id = i;\n\t if ( id !== '' ) {\n\t var separator = '|';\n\t if ( head instanceof Array ) {\n\t separator = '_';\n\t }\n\t new_id = id + separator + new_id;\n\t }\n\t search ( new_id, head[ i ] );\n\t }\n\t }\n\t }\n\t search( '', response );\n\t return result;\n\t },\n\t\n\t /** Map dom tree to dictionary tree with input elements.\n\t */\n\t _iterate: function( parent, dict ) {\n\t var self = this;\n\t var children = $( parent ).children();\n\t children.each( function() {\n\t var child = this;\n\t var id = $( child ).attr( 'id' );\n\t if ( $( child ).hasClass( 'section-row' ) ) {\n\t var input = self.app.input_list[ id ];\n\t dict[ id ] = ( input && { input : input } ) || {};\n\t self._iterate( child, dict[ id ] );\n\t } else {\n\t self._iterate( child, dict );\n\t }\n\t });\n\t }\n\t });\n\t\n\t /** Match conditional values to selected cases\n\t * @param{dict} input - Definition of conditional input parameter\n\t * @param{dict} value - Current value\n\t */\n\t var matchCase = function( input, value ) {\n\t if ( input.test_param.type == 'boolean' ) {\n\t if ( value == 'true' ) {\n\t value = input.test_param.truevalue || 'true';\n\t } else {\n\t value = input.test_param.falsevalue || 'false';\n\t }\n\t }\n\t for ( var i in input.cases ) {\n\t if ( input.cases[ i ].value == value ) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t };\n\t\n\t /** Visits tool inputs\n\t * @param{dict} inputs - Nested dictionary of input elements\n\t * @param{dict} callback - Called with the mapped dictionary object and corresponding model node\n\t */\n\t var visitInputs = function( inputs, callback, prefix, context ) {\n\t context = $.extend( true, {}, context );\n\t _.each( inputs, function ( input ) {\n\t if ( input && input.type && input.name ) {\n\t context[ input.name ] = input;\n\t }\n\t });\n\t for ( var key in inputs ) {\n\t var node = inputs[ key ];\n\t node.name = node.name || key;\n\t var name = prefix ? prefix + '|' + node.name : node.name;\n\t switch ( node.type ) {\n\t case 'repeat':\n\t _.each( node.cache, function( cache, j ) {\n\t visitInputs( cache, callback, name + '_' + j, context );\n\t });\n\t break;\n\t case 'conditional':\n\t if ( node.test_param ) {\n\t callback( node.test_param, name + '|' + node.test_param.name, context );\n\t var selectedCase = matchCase( node, node.test_param.value );\n\t if ( selectedCase != -1 ) {\n\t visitInputs( node.cases[ selectedCase ].inputs, callback, name, context );\n\t } else {\n\t Galaxy.emit.debug( 'form-data::visitInputs() - Invalid case for ' + name + '.' );\n\t }\n\t } else {\n\t Galaxy.emit.debug( 'form-data::visitInputs() - Conditional test parameter missing for ' + name + '.' );\n\t }\n\t break;\n\t case 'section':\n\t visitInputs( node.inputs, callback, name, context )\n\t break;\n\t default:\n\t callback( node, name, context );\n\t }\n\t }\n\t };\n\t\n\t return {\n\t Manager : Manager,\n\t visitInputs : visitInputs\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/* 34 */\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 creates a form input element wrapper\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {\n\t return Backbone.View.extend({\n\t initialize: function( app, options ) {\n\t this.app = app;\n\t this.app_options = app.options || {};\n\t this.field = options && options.field || new Backbone.View();\n\t this.model = options && options.model || new Backbone.Model({\n\t text_enable : this.app_options.text_enable || 'Enable',\n\t text_disable : this.app_options.text_disable || 'Disable',\n\t cls_enable : this.app_options.cls_enable || 'fa fa-caret-square-o-down',\n\t cls_disable : this.app_options.cls_disable || 'fa fa-caret-square-o-up'\n\t }).set( options );\n\t\n\t // set element and link components\n\t this.setElement( this._template() );\n\t this.$field = this.$( '.ui-form-field' );\n\t this.$info = this.$( '.ui-form-info' );\n\t this.$preview = this.$( '.ui-form-preview' );\n\t this.$collapsible = this.$( '.ui-form-collapsible' );\n\t this.$collapsible_text = this.$( '.ui-form-collapsible-text' );\n\t this.$collapsible_icon = this.$( '.ui-form-collapsible-icon' );\n\t this.$title = this.$( '.ui-form-title' );\n\t this.$title_text = this.$( '.ui-form-title-text' );\n\t this.$error_text = this.$( '.ui-form-error-text' );\n\t this.$error = this.$( '.ui-form-error' );\n\t this.$backdrop = this.$( '.ui-form-backdrop' );\n\t\n\t // add field element\n\t this.$field.prepend( this.field.$el );\n\t\n\t // decide wether to expand or collapse fields\n\t var collapsible_value = this.model.get( 'collapsible_value' );\n\t this.field.collapsed = collapsible_value !== undefined && JSON.stringify( this.model.get( 'value' ) ) == JSON.stringify( collapsible_value );\n\t this.listenTo( this.model, 'change', this.render, this );\n\t this.render();\n\t\n\t // add click handler\n\t var self = this;\n\t this.$collapsible.on( 'click', function() {\n\t self.field.collapsed = !self.field.collapsed;\n\t app.trigger && app.trigger( 'change' );\n\t self.render();\n\t });\n\t },\n\t\n\t /** Set backdrop for input element\n\t */\n\t backdrop: function() {\n\t this.model.set( 'backdrop', true );\n\t },\n\t\n\t /** Set error text\n\t */\n\t error: function( text ) {\n\t this.model.set( 'error_text', text );\n\t },\n\t\n\t /** Reset this view\n\t */\n\t reset: function() {\n\t this.model.set( 'error_text', null );\n\t },\n\t\n\t render: function() {\n\t // render help\n\t $( '.tooltip' ).hide();\n\t var help_text = this.model.get( 'help', '' );\n\t var help_argument = this.model.get( 'argument' );\n\t if ( help_argument && help_text.indexOf( '(' + help_argument + ')' ) == -1 ) {\n\t help_text += ' (' + help_argument + ')';\n\t }\n\t this.$info.html( help_text );\n\t // render visibility\n\t this.$el[ this.model.get( 'hidden' ) ? 'hide' : 'show' ]();\n\t // render preview view for collapsed fields\n\t this.$preview[ ( this.field.collapsed && this.model.get( 'collapsible_preview' ) || this.model.get( 'disabled' ) ) ? 'show' : 'hide' ]()\n\t .html( _.escape( this.model.get( 'text_value' ) ) );\n\t // render error messages\n\t var error_text = this.model.get( 'error_text' );\n\t this.$error[ error_text ? 'show' : 'hide' ]();\n\t this.$el[ error_text ? 'addClass' : 'removeClass' ]( 'ui-error' );\n\t this.$error_text.html( error_text );\n\t // render backdrop\n\t this.$backdrop[ this.model.get( 'backdrop' ) ? 'show' : 'hide' ]();\n\t // render input field\n\t this.field.collapsed || this.model.get( 'disabled' ) ? this.$field.hide() : this.$field.show();\n\t // render input field color and style\n\t this.field.model && this.field.model.set( { 'color': this.model.get( 'color' ), 'style': this.model.get( 'style' ) } );\n\t // render collapsible options\n\t if ( !this.model.get( 'disabled' ) && this.model.get( 'collapsible_value' ) !== undefined ) {\n\t var collapsible_state = this.field.collapsed ? 'enable' : 'disable';\n\t this.$title_text.hide();\n\t this.$collapsible.show();\n\t this.$collapsible_text.text( this.model.get( 'label' ) );\n\t this.$collapsible_icon.removeClass().addClass( 'icon' )\n\t .addClass( this.model.get( 'cls_' + collapsible_state ) )\n\t .attr( 'data-original-title', this.model.get( 'text_' + collapsible_state ) )\n\t .tooltip( { placement: 'bottom' } );\n\t } else {\n\t this.$title_text.show().text( this.model.get( 'label' ) );\n\t this.$collapsible.hide();\n\t }\n\t },\n\t\n\t _template: function() {\n\t return $( '
                        ' ).addClass( 'ui-form-element' )\n\t .append( $( '
                        ' ).addClass( 'ui-form-error ui-error' )\n\t .append( $( '' ).addClass( 'fa fa-arrow-down' ) )\n\t .append( $( '' ).addClass( 'ui-form-error-text' ) )\n\t )\n\t .append( $( '
                        ' ).addClass( 'ui-form-title' )\n\t .append( $( '
                        ' ).addClass( 'ui-form-collapsible' )\n\t .append( $( '' ).addClass( 'ui-form-collapsible-icon' ) )\n\t .append( $( '' ).addClass( 'ui-form-collapsible-text' ) )\n\t )\n\t .append( $( '' ).addClass( 'ui-form-title-text' ) )\n\t )\n\t .append( $( '
                        ' ).addClass( 'ui-form-field' )\n\t .append( $( '' ).addClass( 'ui-form-info' ) )\n\t .append( $( '
                        ' ).addClass( 'ui-form-backdrop' ) )\n\t )\n\t .append( $( '
                        ' ).addClass( 'ui-form-preview' ) );\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__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 35 */\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 creates input elements. New input parameter types should be added to the types dictionary.\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4),\n\t __webpack_require__(7),\n\t __webpack_require__(48),\n\t __webpack_require__(50),\n\t __webpack_require__(49),\n\t __webpack_require__(46)], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Ui, SelectContent, SelectLibrary, SelectFtp, ColorPicker ) {\n\t\n\t // create form view\n\t return Backbone.Model.extend({\n\t /** Available parameter types */\n\t types: {\n\t 'text' : '_fieldText',\n\t 'select' : '_fieldSelect',\n\t 'data_column' : '_fieldSelect',\n\t 'genomebuild' : '_fieldSelect',\n\t 'data' : '_fieldData',\n\t 'data_collection' : '_fieldData',\n\t 'integer' : '_fieldSlider',\n\t 'float' : '_fieldSlider',\n\t 'boolean' : '_fieldBoolean',\n\t 'drill_down' : '_fieldDrilldown',\n\t 'color' : '_fieldColor',\n\t 'hidden' : '_fieldHidden',\n\t 'hidden_data' : '_fieldHidden',\n\t 'baseurl' : '_fieldHidden',\n\t 'library_data' : '_fieldLibrary',\n\t 'ftpfile' : '_fieldFtp'\n\t },\n\t\n\t /** Returns an input field for a given field type */\n\t create: function( input_def ) {\n\t var fieldClass = this.types[ input_def.type ];\n\t var field = typeof( this[ fieldClass ] ) === 'function' ? this[ fieldClass ].call( this, input_def ) : null;\n\t if ( !field ) {\n\t field = input_def.options ? this._fieldSelect( input_def ) : this._fieldText( input_def );\n\t Galaxy.emit.debug('form-parameters::_addRow()', 'Auto matched field type (' + input_def.type + ').');\n\t }\n\t input_def.value === undefined && ( input_def.value = null );\n\t field.value( input_def.value );\n\t return field;\n\t },\n\t\n\t /** Data input field */\n\t _fieldData: function( input_def ) {\n\t return new SelectContent.View({\n\t id : 'field-' + input_def.id,\n\t extensions : input_def.extensions,\n\t optional : input_def.optional,\n\t multiple : input_def.multiple,\n\t type : input_def.type,\n\t flavor : input_def.flavor,\n\t data : input_def.options,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Select/Checkbox/Radio options field */\n\t _fieldSelect: function ( input_def ) {\n\t // show text field e.g. in workflow editor\n\t if( input_def.is_workflow ) {\n\t return this._fieldText( input_def );\n\t }\n\t\n\t // customize properties\n\t if ( input_def.type == 'data_column' ) {\n\t input_def.error_text = 'Missing columns in referenced dataset.'\n\t }\n\t\n\t // identify available options\n\t var data = input_def.data;\n\t if( !data ) {\n\t data = [];\n\t _.each( input_def.options, function( option ) {\n\t data.push( { label: option[ 0 ], value: option[ 1 ] } );\n\t });\n\t }\n\t\n\t // identify display type\n\t var SelectClass = Ui.Select;\n\t switch ( input_def.display ) {\n\t case 'checkboxes':\n\t SelectClass = Ui.Checkbox;\n\t break;\n\t case 'radio':\n\t SelectClass = Ui.Radio;\n\t break;\n\t case 'radiobutton':\n\t SelectClass = Ui.RadioButton;\n\t break;\n\t }\n\t\n\t // create select field\n\t return new SelectClass.View({\n\t id : 'field-' + input_def.id,\n\t data : data,\n\t error_text : input_def.error_text || 'No options available',\n\t multiple : input_def.multiple,\n\t optional : input_def.optional,\n\t onchange : input_def.onchange,\n\t searchable : input_def.flavor !== 'workflow'\n\t });\n\t },\n\t\n\t /** Drill down options field */\n\t _fieldDrilldown: function ( input_def ) {\n\t // show text field e.g. in workflow editor\n\t if( input_def.is_workflow ) {\n\t return this._fieldText( input_def );\n\t }\n\t\n\t // create drill down field\n\t return new Ui.Drilldown.View({\n\t id : 'field-' + input_def.id,\n\t data : input_def.options,\n\t display : input_def.display,\n\t optional : input_def.optional,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Text input field */\n\t _fieldText: function( input_def ) {\n\t // field replaces e.g. a select field\n\t if ( input_def.options && input_def.data ) {\n\t input_def.area = input_def.multiple;\n\t if ( Utils.isEmpty( input_def.value ) ) {\n\t input_def.value = null;\n\t } else {\n\t if ( $.isArray( input_def.value ) ) {\n\t var str_value = '';\n\t for ( var i in input_def.value ) {\n\t str_value += String( input_def.value[ i ] );\n\t if ( !input_def.multiple ) {\n\t break;\n\t }\n\t str_value += '\\n';\n\t }\n\t input_def.value = str_value;\n\t }\n\t }\n\t }\n\t // create input element\n\t return new Ui.Input({\n\t id : 'field-' + input_def.id,\n\t area : input_def.area,\n\t placeholder : input_def.placeholder,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Slider field */\n\t _fieldSlider: function( input_def ) {\n\t return new Ui.Slider.View({\n\t id : 'field-' + input_def.id,\n\t precise : input_def.type == 'float',\n\t is_workflow : input_def.is_workflow,\n\t min : input_def.min,\n\t max : input_def.max,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Hidden field */\n\t _fieldHidden: function( input_def ) {\n\t return new Ui.Hidden({\n\t id : 'field-' + input_def.id,\n\t info : input_def.info\n\t });\n\t },\n\t\n\t /** Boolean field */\n\t _fieldBoolean: function( input_def ) {\n\t return new Ui.RadioButton.View({\n\t id : 'field-' + input_def.id,\n\t data : [ { label : 'Yes', value : 'true' },\n\t { label : 'No', value : 'false' }],\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Color picker field */\n\t _fieldColor: function( input_def ) {\n\t return new ColorPicker({\n\t id : 'field-' + input_def.id,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** Library dataset field */\n\t _fieldLibrary: function( input_def ) {\n\t return new SelectLibrary.View({\n\t id : 'field-' + input_def.id,\n\t optional : input_def.optional,\n\t multiple : input_def.multiple,\n\t onchange : input_def.onchange\n\t });\n\t },\n\t\n\t /** FTP file field */\n\t _fieldFtp: function( input_def ) {\n\t return new SelectFtp.View({\n\t id : 'field-' + input_def.id,\n\t optional : input_def.optional,\n\t multiple : input_def.multiple,\n\t onchange : input_def.onchange\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__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 36 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/** This class creates a ui component which enables the dynamic creation of portlets */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(9), __webpack_require__(7) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Portlet, Ui ) {\n\t var View = Backbone.View.extend({\n\t initialize: function( options ) {\n\t this.list = {};\n\t this.options = Utils.merge( options, {\n\t title : 'Repeat',\n\t empty_text : 'Not available.',\n\t max : null,\n\t min : null\n\t });\n\t this.button_new = new Ui.ButtonIcon({\n\t icon : 'fa-plus',\n\t title : 'Insert ' + this.options.title,\n\t tooltip : 'Add new ' + this.options.title + ' block',\n\t floating: 'clear',\n\t cls : 'ui-button-icon form-repeat-add',\n\t onclick : function() { options.onnew && options.onnew() }\n\t });\n\t this.setElement( $( '
                        ' ).append( this.$list = $( '
                        ' ) )\n\t .append( $( '
                        ' ).append( this.button_new.$el ) ) );\n\t },\n\t\n\t /** Number of repeat blocks */\n\t size: function() {\n\t return _.size( this.list );\n\t },\n\t\n\t /** Add new repeat block */\n\t add: function( options ) {\n\t if ( !options.id || this.list[ options.id ] ) {\n\t Galaxy.emit.debug( 'form-repeat::add()', 'Duplicate or invalid repeat block id.' );\n\t return;\n\t }\n\t var button_delete = new Ui.ButtonIcon({\n\t icon : 'fa-trash-o',\n\t tooltip : 'Delete this repeat block',\n\t cls : 'ui-button-icon-plain form-repeat-delete',\n\t onclick : function() { options.ondel && options.ondel() }\n\t });\n\t var portlet = new Portlet.View({\n\t id : options.id,\n\t title : 'placeholder',\n\t cls : options.cls || 'ui-portlet-repeat',\n\t operations : { button_delete: button_delete }\n\t });\n\t portlet.append( options.$el );\n\t portlet.$el.addClass( 'section-row' ).hide();\n\t this.list[ options.id ] = portlet;\n\t this.$list.append( portlet.$el.fadeIn( 'fast' ) );\n\t this.options.max > 0 && this.size() >= this.options.max && this.button_new.disable();\n\t this._refresh();\n\t },\n\t\n\t /** Delete repeat block */\n\t del: function( id ) {\n\t if ( !this.list[ id ] ) {\n\t Galaxy.emit.debug( 'form-repeat::del()', 'Invalid repeat block id.' );\n\t return;\n\t }\n\t this.$list.find( '#' + id ).remove();\n\t delete this.list[ id ];\n\t this.button_new.enable();\n\t this._refresh();\n\t },\n\t\n\t /** Remove all */\n\t delAll: function() {\n\t for( var id in this.list ) {\n\t this.del( id );\n\t }\n\t },\n\t\n\t /** Hides add/del options */\n\t hideOptions: function() {\n\t this.button_new.$el.hide();\n\t _.each( this.list, function( portlet ) { portlet.hideOperation( 'button_delete' ) } );\n\t _.isEmpty( this.list ) && this.$el.append( $( '
                        ' ).addClass( 'ui-form-info' ).html( this.options.empty_text ) );\n\t },\n\t\n\t /** Refresh view */\n\t _refresh: function() {\n\t var index = 0;\n\t for ( var id in this.list ) {\n\t var portlet = this.list[ id ];\n\t portlet.title( ++index + ': ' + this.options.title );\n\t portlet[ this.size() > this.options.min ? 'showOperation' : 'hideOperation' ]( 'button_delete' );\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 37 */\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 This class creates a form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections.\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(7), __webpack_require__(9), __webpack_require__(36), __webpack_require__(34), __webpack_require__(35) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Ui, Portlet, Repeat, InputElement, Parameters ) {\n\t var View = Backbone.View.extend({\n\t initialize: function( app, options ) {\n\t this.app = app;\n\t this.inputs = options.inputs;\n\t this.parameters = new Parameters();\n\t this.setElement( $( '
                        ' ) );\n\t this.render();\n\t },\n\t\n\t /** Render section view */\n\t render: function() {\n\t var self = this;\n\t this.$el.empty();\n\t _.each( this.inputs, function( input ) { self.add( input ) } );\n\t },\n\t\n\t /** Add a new input element */\n\t add: function( input ) {\n\t var input_def = jQuery.extend( true, {}, input );\n\t input_def.id = input.id = Utils.uid();\n\t this.app.input_list[ input_def.id ] = input_def;\n\t switch( input_def.type ) {\n\t case 'conditional':\n\t this._addConditional( input_def );\n\t break;\n\t case 'repeat':\n\t this._addRepeat( input_def );\n\t break;\n\t case 'section':\n\t this._addSection( input_def );\n\t break;\n\t default:\n\t this._addRow( input_def );\n\t }\n\t },\n\t\n\t /** Add a conditional block */\n\t _addConditional: function( input_def ) {\n\t var self = this;\n\t input_def.test_param.id = input_def.id;\n\t this.app.options.sustain_conditionals && ( input_def.test_param.disabled = true );\n\t var field = this._addRow( input_def.test_param );\n\t\n\t // set onchange event for test parameter\n\t field.model && field.model.set( 'onchange', function( value ) {\n\t var selectedCase = self.app.data.matchCase( input_def, value );\n\t for ( var i in input_def.cases ) {\n\t var case_def = input_def.cases[ i ];\n\t var section_row = self.$( '#' + input_def.id + '-section-' + i );\n\t var nonhidden = false;\n\t for ( var j in case_def.inputs ) {\n\t if ( !case_def.inputs[ j ].hidden ) {\n\t nonhidden = true;\n\t break;\n\t }\n\t }\n\t if ( i == selectedCase && nonhidden ) {\n\t section_row.fadeIn( 'fast' );\n\t } else {\n\t section_row.hide();\n\t }\n\t }\n\t self.app.trigger( 'change' );\n\t });\n\t\n\t // add conditional sub sections\n\t for ( var i in input_def.cases ) {\n\t var sub_section = new View( this.app, { inputs: input_def.cases[ i ].inputs } );\n\t this._append( sub_section.$el.addClass( 'ui-form-section' ), input_def.id + '-section-' + i );\n\t }\n\t\n\t // trigger refresh on conditional input field after all input elements have been created\n\t field.trigger( 'change' );\n\t },\n\t\n\t /** Add a repeat block */\n\t _addRepeat: function( input_def ) {\n\t var self = this;\n\t var block_index = 0;\n\t\n\t // create repeat block element\n\t var repeat = new Repeat.View({\n\t title : input_def.title || 'Repeat',\n\t min : input_def.min,\n\t max : input_def.max,\n\t onnew : function() { create( input_def.inputs ); self.app.trigger( 'change' ); }\n\t });\n\t\n\t // helper function to create new repeat blocks\n\t function create ( inputs ) {\n\t var sub_section_id = input_def.id + '-section-' + ( block_index++ );\n\t var sub_section = new View( self.app, { inputs: inputs } );\n\t repeat.add( { id : sub_section_id,\n\t $el : sub_section.$el,\n\t ondel : function() { repeat.del( sub_section_id ); self.app.trigger( 'change' ); } } );\n\t }\n\t\n\t //\n\t // add parsed/minimum number of repeat blocks\n\t //\n\t var n_cache = _.size( input_def.cache );\n\t for ( var i = 0; i < Math.max( Math.max( n_cache, input_def.min ), input_def.default || 0 ); i++ ) {\n\t create( i < n_cache ? input_def.cache[ i ] : input_def.inputs );\n\t }\n\t\n\t // hide options\n\t this.app.options.sustain_repeats && repeat.hideOptions();\n\t\n\t // create input field wrapper\n\t var input_element = new InputElement( this.app, {\n\t label : input_def.title || input_def.name,\n\t help : input_def.help,\n\t field : repeat\n\t });\n\t this._append( input_element.$el, input_def.id );\n\t },\n\t\n\t /** Add a customized section */\n\t _addSection: function( input_def ) {\n\t var portlet = new Portlet.View({\n\t title : input_def.title || input_def.name,\n\t cls : 'ui-portlet-section',\n\t collapsible : true,\n\t collapsible_button : true,\n\t collapsed : !input_def.expanded\n\t });\n\t portlet.append( new View( this.app, { inputs: input_def.inputs } ).$el );\n\t portlet.append( $( '
                        ' ).addClass( 'ui-form-info' ).html( input_def.help ) );\n\t this.app.on( 'expand', function( input_id ) { ( portlet.$( '#' + input_id ).length > 0 ) && portlet.expand(); } );\n\t this._append( portlet.$el, input_def.id );\n\t },\n\t\n\t /** Add a single input field element */\n\t _addRow: function( input_def ) {\n\t var self = this;\n\t var id = input_def.id;\n\t input_def.onchange = function() { self.app.trigger( 'change', id ) };\n\t var field = this.parameters.create( input_def );\n\t this.app.field_list[ id ] = field;\n\t var input_element = new InputElement( this.app, {\n\t name : input_def.name,\n\t label : input_def.label || input_def.name,\n\t value : input_def.value,\n\t text_value : input_def.text_value,\n\t collapsible_value : input_def.collapsible_value,\n\t collapsible_preview : input_def.collapsible_preview,\n\t help : input_def.help,\n\t argument : input_def.argument,\n\t disabled : input_def.disabled,\n\t color : input_def.color,\n\t style : input_def.style,\n\t backdrop : input_def.backdrop,\n\t hidden : input_def.hidden,\n\t field : field\n\t });\n\t this.app.element_list[ id ] = input_element;\n\t this._append( input_element.$el, input_def.id );\n\t return field;\n\t },\n\t\n\t /** Append a new element to the form i.e. input element, repeat block, conditionals etc. */\n\t _append: function( $el, id ) {\n\t this.$el.append( $el.addClass( 'section-row' ).attr( 'id', id ) );\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__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 38 */\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 is the main class of the form plugin. It is referenced as 'app' in lower level modules.\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(9), __webpack_require__(7), __webpack_require__(37), __webpack_require__(33) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Portlet, Ui, FormSection, FormData ) {\n\t return Backbone.View.extend({\n\t initialize: function( options ) {\n\t this.options = Utils.merge( options, {\n\t initial_errors : false,\n\t cls : 'ui-portlet-limited',\n\t icon : null,\n\t always_refresh : true\n\t });\n\t this.setElement( '
                        ' );\n\t this.render();\n\t },\n\t\n\t /** Update available options */\n\t update: function( new_model ){\n\t var self = this;\n\t this.data.matchModel( new_model, function( node, input_id ) {\n\t var input = self.input_list[ input_id ];\n\t if ( input && input.options ) {\n\t if ( !_.isEqual( input.options, node.options ) ) {\n\t input.options = node.options;\n\t var field = self.field_list[ input_id ];\n\t if ( field.update ) {\n\t var new_options = [];\n\t if ( ( [ 'data', 'data_collection', 'drill_down' ] ).indexOf( input.type ) != -1 ) {\n\t new_options = input.options;\n\t } else {\n\t for ( var i in node.options ) {\n\t var opt = node.options[ i ];\n\t if ( opt.length > 2 ) {\n\t new_options.push( { label: opt[ 0 ], value: opt[ 1 ] } );\n\t }\n\t }\n\t }\n\t field.update( new_options );\n\t field.trigger( 'change' );\n\t Galaxy.emit.debug( 'form-view::update()', 'Updating options for ' + input_id );\n\t }\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** Set form into wait mode */\n\t wait: function( active ) {\n\t for ( var i in this.input_list ) {\n\t var field = this.field_list[ i ];\n\t var input = this.input_list[ i ];\n\t if ( input.is_dynamic && field.wait && field.unwait ) {\n\t field[ active ? 'wait' : 'unwait' ]();\n\t }\n\t }\n\t },\n\t\n\t /** Highlight and scroll to input element (currently only used for error notifications) */\n\t highlight: function ( input_id, message, silent ) {\n\t var input_element = this.element_list[ input_id ];\n\t if ( input_element ) {\n\t input_element.error( message || 'Please verify this parameter.' );\n\t this.portlet.expand();\n\t this.trigger( 'expand', input_id );\n\t if ( !silent ) {\n\t var $panel = this.$el.parents().filter(function() {\n\t return [ 'auto', 'scroll' ].indexOf( $( this ).css( 'overflow' ) ) != -1;\n\t }).first();\n\t $panel.animate( { scrollTop : $panel.scrollTop() + input_element.$el.offset().top - 120 }, 500 );\n\t }\n\t }\n\t },\n\t\n\t /** Highlights errors */\n\t errors: function( options ) {\n\t this.trigger( 'reset' );\n\t if ( options && options.errors ) {\n\t var error_messages = this.data.matchResponse( options.errors );\n\t for ( var input_id in this.element_list ) {\n\t var input = this.element_list[ input_id ];\n\t if ( error_messages[ input_id ] ) {\n\t this.highlight( input_id, error_messages[ input_id ], true );\n\t }\n\t }\n\t }\n\t },\n\t\n\t /** Render tool form */\n\t render: function() {\n\t var self = this;\n\t this.off('change');\n\t this.off('reset');\n\t // contains the dom field elements as created by the parameter factory i.e. form-parameters\n\t this.field_list = {};\n\t // contains input definitions/dictionaries as provided by the parameters to_dict() function through the api\n\t this.input_list = {};\n\t // contains the dom elements of each input element i.e. form-input which wraps the actual input field\n\t this.element_list = {};\n\t // converts the form into a json data structure\n\t this.data = new FormData.Manager( this );\n\t this._renderForm();\n\t this.data.create();\n\t this.options.initial_errors && this.errors( this.options );\n\t // add listener which triggers on checksum change, and reset the form input wrappers\n\t var current_check = this.data.checksum();\n\t this.on('change', function( input_id ) {\n\t var input = self.input_list[ input_id ];\n\t if ( !input || input.refresh_on_change || self.options.always_refresh ) {\n\t var new_check = self.data.checksum();\n\t if ( new_check != current_check ) {\n\t current_check = new_check;\n\t self.options.onchange && self.options.onchange();\n\t }\n\t }\n\t });\n\t this.on('reset', function() {\n\t _.each( self.element_list, function( input_element ) { input_element.reset() } );\n\t });\n\t return this;\n\t },\n\t\n\t /** Renders/appends dom elements of the form */\n\t _renderForm: function() {\n\t $( '.tooltip' ).remove();\n\t this.message = new Ui.Message();\n\t this.section = new FormSection.View( this, { inputs: this.options.inputs } );\n\t this.portlet = new Portlet.View({\n\t icon : this.options.icon,\n\t title : this.options.title,\n\t cls : this.options.cls,\n\t operations : this.options.operations,\n\t buttons : this.options.buttons,\n\t collapsible : this.options.collapsible,\n\t collapsed : this.options.collapsed\n\t });\n\t this.portlet.append( this.message.$el );\n\t this.portlet.append( this.section.$el );\n\t this.$el.empty();\n\t this.options.inputs && this.$el.append( this.portlet.$el );\n\t this.options.message && this.message.update( { persistent: true, status: 'warning', message: this.options.message } );\n\t Galaxy.emit.debug( 'form-view::initialize()', 'Completed' );\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__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 39 */\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__ = [\n\t __webpack_require__(30),\n\t __webpack_require__(74),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DC_MODEL, HISTORY_CONTENT, _l ){\n\t\n\t'use strict';\n\t\n\t/*==============================================================================\n\t\n\tModels for DatasetCollections contained within a history.\n\t\n\tTODO:\n\t these might be compactable to one class if some duplication with\n\t collection-model is used.\n\t\n\t==============================================================================*/\n\tvar 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\tfunction 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//==============================================================================\n\t/** @class Backbone model for List Dataset Collection within a History.\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for Pair Dataset Collection within a History.\n\t * @constructs\n\t */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for List of Pairs Dataset Collection within a History. */\n\tvar 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//==============================================================================\n\t/** @class Backbone model for List of Lists Dataset Collection within a History. */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 40 */\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__ = [\n\t __webpack_require__(67),\n\t __webpack_require__(72),\n\t __webpack_require__(39),\n\t __webpack_require__(41),\n\t __webpack_require__(6),\n\t __webpack_require__(129)\n\t], __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\tvar _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\tvar 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\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 ){ return; }\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 ){ return !c.inReadyState(); });\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() )\n\t && ( 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 ){ return c.hasDetails(); });\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 ){ return c.hidden(); });\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 ){ return c.get( 'deleted' ); });\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' ) ){ return; }\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' ) ){ return; }\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\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 )\n\t .always( function(){ self.trigger( 'fetching-deleted-done', self ); });\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 )\n\t .always( function(){ self.trigger( 'fetching-hidden-done', self ); });\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 })\n\t .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(){ return fn.apply( content, args ); };\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 )\n\t .fail( deferred.reject )\n\t .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\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 = [\n\t 'HistoryDatasetAssociation',\n\t 'HistoryDatasetCollectionAssociation'\n\t ];\n\t return ( ( _.isObject( contentsJSON ) && contentsJSON.id )\n\t && ( _.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 })\n\t .done( function( response ){\n\t collection.add([ response ], { parse: true });\n\t })\n\t .fail( function( error, status, message ){\n\t collection.trigger( 'error', collection, xhr, {},\n\t '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, 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 // 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(3)))\n\n/***/ },\n/* 41 */\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__ = [\n\t __webpack_require__(6)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( BASE_MVC ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'history';\n\t\n\t// ============================================================================\n\t/** session storage for individual history preferences */\n\tvar 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 ) ){ this.set( 'show_deleted', val ); }\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 ) ){ this.set( 'show_hidden', val ); }\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 42 */\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__ = [\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar 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\tvar 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\n\t } else {\n\t $( view ).queue( 'fx', [\n\t function( next ){\n\t view.$el.fadeOut( speed, next );\n\t },\n\t function( next ){\n\t view._swapNewRender( $newRender );\n\t next();\n\t },\n\t function( next ){\n\t view.$el.fadeIn( speed, next );\n\t },\n\t function( next ){\n\t view.trigger( 'rendered', view );\n\t next();\n\t }\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()\n\t .attr( 'class', _.isFunction( this.className )? this.className(): this.className )\n\t .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//==============================================================================\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\tvar ListItemView = ExpandableView.extend(\n\t 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 ){ this.showSelector( 0 ); }\n\t if( this.draggable ){ this.draggableOn(); }\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, KEYCODE_RETURN = 13;\n\t if( event && ( event.type === 'keydown' )\n\t &&( 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\tListItemView.prototype.templates = (function(){\n\t\n\t var elTemplato = BASE_MVC.wrapTemplate([\n\t '
                        ',\n\t // errors, messages, etc.\n\t '
                        ',\n\t\n\t // multi-select checkbox\n\t '
                        ',\n\t '',\n\t '
                        ',\n\t // space for title bar buttons - gen. floated to the right\n\t '
                        ',\n\t '
                        ',\n\t\n\t // expandable area for more details\n\t '
                        ',\n\t '
                        '\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 '',\n\t '
                        ',\n\t '<%- element.name %>',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ], 'element' );\n\t\n\t var subtitleTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
                        '\n\t ]);\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate([\n\t // override this\n\t '
                        '\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//==============================================================================\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\tvar 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' ){ this.expanded = false; }\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' ){ return $(); }\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()\n\t .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\tFoldoutListItemView.prototype.templates = (function(){\n\t\n\t var detailsTemplate = BASE_MVC.wrapTemplate([\n\t '
                        ',\n\t // override with more info (that goes above the panel)\n\t '
                        '\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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {/**\n\t This is the base class of the tool form plugin. This class is e.g. inherited by the regular and the workflow tool form.\n\t*/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(55), __webpack_require__(7), __webpack_require__(38),\n\t __webpack_require__(17), __webpack_require__(28)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Utils, Deferred, Ui, FormBase, CitationModel, CitationView) {\n\t return FormBase.extend({\n\t initialize: function(options) {\n\t var self = this;\n\t FormBase.prototype.initialize.call(this, options);\n\t this.deferred = new Deferred();\n\t if (options.inputs) {\n\t this._buildForm(options);\n\t } else {\n\t this.deferred.execute(function(process) {\n\t self._buildModel(process, options, true);\n\t });\n\t }\n\t // listen to history panel\n\t if ( options.listen_to_history && parent.Galaxy && parent.Galaxy.currHistoryPanel ) {\n\t this.listenTo( parent.Galaxy.currHistoryPanel.collection, 'change', function() {\n\t this.refresh();\n\t });\n\t }\n\t // destroy dom elements\n\t this.$el.on( 'remove', function() { self.remove() } );\n\t },\n\t\n\t /** Listen to history panel changes and update the tool form */\n\t refresh: function() {\n\t var self = this;\n\t self.deferred.reset();\n\t this.deferred.execute( function (process){\n\t self._updateModel( process)\n\t });\n\t },\n\t\n\t /** Wait for deferred build processes before removal */\n\t remove: function() {\n\t var self = this;\n\t this.$el.hide();\n\t this.deferred.execute(function(){\n\t FormBase.prototype.remove.call(self);\n\t Galaxy.emit.debug('tool-form-base::remove()', 'Destroy view.');\n\t });\n\t },\n\t\n\t /** Build form */\n\t _buildForm: function(options) {\n\t var self = this;\n\t this.options = Utils.merge(options, this.options);\n\t this.options = Utils.merge({\n\t icon : options.icon,\n\t title : '' + options.name + ' ' + options.description + ' (Galaxy Version ' + options.version + ')',\n\t operations : !this.options.hide_operations && this._operations(),\n\t onchange : function() {\n\t self.refresh();\n\t }\n\t }, this.options);\n\t this.options.customize && this.options.customize( this.options );\n\t this.render();\n\t if ( !this.options.collapsible ) {\n\t this.$el.append( $( '
                        ' ).addClass( 'ui-margin-top-large' ).append( this._footer() ) );\n\t }\n\t },\n\t\n\t /** Builds a new model through api call and recreates the entire form\n\t */\n\t _buildModel: function(process, options, hide_message) {\n\t var self = this;\n\t this.options.id = options.id;\n\t this.options.version = options.version;\n\t\n\t // build request url\n\t var build_url = '';\n\t var build_data = {};\n\t if ( options.job_id ) {\n\t build_url = Galaxy.root + 'api/jobs/' + options.job_id + '/build_for_rerun';\n\t } else {\n\t build_url = Galaxy.root + 'api/tools/' + options.id + '/build';\n\t if ( Galaxy.params && Galaxy.params.tool_id == options.id ) {\n\t build_data = $.extend( {}, Galaxy.params );\n\t options.version && ( build_data[ 'tool_version' ] = options.version );\n\t }\n\t }\n\t\n\t // get initial model\n\t Utils.get({\n\t url : build_url,\n\t data : build_data,\n\t success : function(new_model) {\n\t new_model = new_model.tool_model || new_model;\n\t if( !new_model.display ) {\n\t window.location = Galaxy.root;\n\t return;\n\t }\n\t self._buildForm(new_model);\n\t !hide_message && self.message.update({\n\t status : 'success',\n\t message : 'Now you are using \\'' + self.options.name + '\\' version ' + self.options.version + ', id \\'' + self.options.id + '\\'.',\n\t persistent : false\n\t });\n\t Galaxy.emit.debug('tool-form-base::initialize()', 'Initial tool model ready.', new_model);\n\t process.resolve();\n\t },\n\t error : function(response, xhr) {\n\t var error_message = ( response && response.err_msg ) || 'Uncaught error.';\n\t if ( xhr.status == 401 ) {\n\t window.location = Galaxy.root + 'user/login?' + $.param({ redirect : Galaxy.root + '?tool_id=' + self.options.id });\n\t } else if ( self.$el.is(':empty') ) {\n\t self.$el.prepend((new Ui.Message({\n\t message : error_message,\n\t status : 'danger',\n\t persistent : true,\n\t large : true\n\t })).$el);\n\t } else {\n\t Galaxy.modal && Galaxy.modal.show({\n\t title : 'Tool request failed',\n\t body : error_message,\n\t buttons : {\n\t 'Close' : function() {\n\t Galaxy.modal.hide();\n\t }\n\t }\n\t });\n\t }\n\t Galaxy.emit.debug('tool-form::initialize()', 'Initial tool model request failed.', response);\n\t process.reject();\n\t }\n\t });\n\t },\n\t\n\t /** Request a new model for an already created tool form and updates the form inputs\n\t */\n\t _updateModel: function(process) {\n\t // link this\n\t var self = this;\n\t var model_url = this.options.update_url || Galaxy.root + 'api/tools/' + this.options.id + '/build';\n\t var current_state = {\n\t tool_id : this.options.id,\n\t tool_version : this.options.version,\n\t inputs : $.extend(true, {}, self.data.create())\n\t }\n\t this.wait(true);\n\t\n\t // log tool state\n\t Galaxy.emit.debug('tool-form-base::_updateModel()', 'Sending current state.', current_state);\n\t\n\t // post job\n\t Utils.request({\n\t type : 'POST',\n\t url : model_url,\n\t data : current_state,\n\t success : function(new_model) {\n\t self.update(new_model['tool_model'] || new_model);\n\t self.options.update && self.options.update(new_model);\n\t self.wait(false);\n\t Galaxy.emit.debug('tool-form-base::_updateModel()', 'Received new model.', new_model);\n\t process.resolve();\n\t },\n\t error : function(response) {\n\t Galaxy.emit.debug('tool-form-base::_updateModel()', 'Refresh request failed.', response);\n\t process.reject();\n\t }\n\t });\n\t },\n\t\n\t /** Create tool operation menu\n\t */\n\t _operations: function() {\n\t var self = this;\n\t var options = this.options;\n\t\n\t // button for version selection\n\t var versions_button = new Ui.ButtonMenu({\n\t icon : 'fa-cubes',\n\t title : (!options.narrow && 'Versions') || null,\n\t tooltip : 'Select another tool version'\n\t });\n\t if (!options.sustain_version && options.versions && options.versions.length > 1) {\n\t for (var i in options.versions) {\n\t var version = options.versions[i];\n\t if (version != options.version) {\n\t versions_button.addMenu({\n\t title : 'Switch to ' + version,\n\t version : version,\n\t icon : 'fa-cube',\n\t onclick : function() {\n\t // here we update the tool version (some tools encode the version also in the id)\n\t var id = options.id.replace(options.version, this.version);\n\t var version = this.version;\n\t // queue model request\n\t self.deferred.reset();\n\t self.deferred.execute(function(process) {\n\t self._buildModel(process, {id: id, version: version})\n\t });\n\t }\n\t });\n\t }\n\t }\n\t } else {\n\t versions_button.$el.hide();\n\t }\n\t\n\t // button for options e.g. search, help\n\t var menu_button = new Ui.ButtonMenu({\n\t icon : 'fa-caret-down',\n\t title : (!options.narrow && 'Options') || null,\n\t tooltip : 'View available options'\n\t });\n\t if(options.biostar_url) {\n\t menu_button.addMenu({\n\t icon : 'fa-question-circle',\n\t title : 'Question?',\n\t tooltip : 'Ask a question about this tool (Biostar)',\n\t onclick : function() {\n\t window.open(options.biostar_url + '/p/new/post/');\n\t }\n\t });\n\t menu_button.addMenu({\n\t icon : 'fa-search',\n\t title : 'Search',\n\t tooltip : 'Search help for this tool (Biostar)',\n\t onclick : function() {\n\t window.open(options.biostar_url + '/local/search/page/?q=' + options.name);\n\t }\n\t });\n\t };\n\t menu_button.addMenu({\n\t icon : 'fa-share',\n\t title : 'Share',\n\t tooltip : 'Share this tool',\n\t onclick : function() {\n\t prompt('Copy to clipboard: Ctrl+C, Enter', window.location.origin + Galaxy.root + 'root?tool_id=' + options.id);\n\t }\n\t });\n\t\n\t // add admin operations\n\t if (Galaxy.user && Galaxy.user.get('is_admin')) {\n\t menu_button.addMenu({\n\t icon : 'fa-download',\n\t title : 'Download',\n\t tooltip : 'Download this tool',\n\t onclick : function() {\n\t window.location.href = Galaxy.root + 'api/tools/' + options.id + '/download';\n\t }\n\t });\n\t }\n\t\n\t // button for version selection\n\t if (options.requirements && options.requirements.length > 0) {\n\t menu_button.addMenu({\n\t icon : 'fa-info-circle',\n\t title : 'Requirements',\n\t tooltip : 'Display tool requirements',\n\t onclick : function() {\n\t if (!this.visible || self.portlet.collapsed ) {\n\t this.visible = true;\n\t self.portlet.expand();\n\t self.message.update({\n\t persistent : true,\n\t message : self._templateRequirements(options),\n\t status : 'info'\n\t });\n\t } else {\n\t this.visible = false;\n\t self.message.update({\n\t message : ''\n\t });\n\t }\n\t }\n\t });\n\t }\n\t\n\t // add toolshed url\n\t if (options.sharable_url) {\n\t menu_button.addMenu({\n\t icon : 'fa-external-link',\n\t title : 'See in Tool Shed',\n\t tooltip : 'Access the repository',\n\t onclick : function() {\n\t window.open(options.sharable_url);\n\t }\n\t });\n\t }\n\t\n\t return {\n\t menu : menu_button,\n\t versions : versions_button\n\t }\n\t },\n\t\n\t /** Create footer\n\t */\n\t _footer: function() {\n\t var options = this.options;\n\t var $el = $( '
                        ' ).append( this._templateHelp( options ) );\n\t if ( options.citations ) {\n\t var $citations = $( '
                        ' );\n\t var citations = new CitationModel.ToolCitationCollection();\n\t citations.tool_id = options.id;\n\t var citation_list_view = new CitationView.CitationListView({ el: $citations, collection: citations });\n\t citation_list_view.render();\n\t citations.fetch();\n\t $el.append( $citations );\n\t }\n\t return $el;\n\t },\n\t\n\t /** Templates\n\t */\n\t _templateHelp: function( options ) {\n\t var $tmpl = $( '
                        ' ).addClass( 'ui-form-help' ).append( options.help );\n\t $tmpl.find( 'a' ).attr( 'target', '_blank' );\n\t return $tmpl;\n\t },\n\t\n\t _templateRequirements: function( options ) {\n\t var nreq = options.requirements.length;\n\t if ( nreq > 0 ) {\n\t var requirements_message = 'This tool requires ';\n\t _.each( options.requirements, function( req, i ) {\n\t requirements_message += req.name + ( req.version ? ' (Version ' + req.version + ')' : '' ) + ( i < nreq - 2 ? ', ' : ( i == nreq - 2 ? ' and ' : '' ) );\n\t });\n\t var requirements_link = $( '' ).attr( 'target', '_blank' ).attr( 'href', 'https://wiki.galaxyproject.org/Tools/Requirements' ).text( 'here' );\n\t return $( '' ).append( requirements_message + '. Click ' ).append( requirements_link ).append( ' for more information.' );\n\t }\n\t return 'No requirements found.';\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 44 */\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__ = [\n\t __webpack_require__(2),\n\t __webpack_require__(16),\n\t __webpack_require__(11),\n\t __webpack_require__(18)\n\t\n\t], __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\tvar 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\tvar 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\tvar ToolParameterCollection = Backbone.Collection.extend({\n\t model: ToolParameter\n\t});\n\t\n\t/**\n\t * A data tool parameter.\n\t */\n\tvar DataToolParameter = ToolParameter.extend({});\n\t\n\t/**\n\t * An integer tool parameter.\n\t */\n\tvar 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()\n\t .domain([this.get('min'), this.get('max')])\n\t .ticks(this.get('num_samples'));\n\t }\n\t});\n\t\n\tvar 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\tvar 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\tToolParameter.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\tvar 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) { return i.toJSON(); });\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\tvar ToolView = Backbone.View.extend({\n\t\n\t});\n\t\n\t/**\n\t * Wrap collection of tools for fast access/manipulation.\n\t */\n\tvar 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\tvar ToolSectionLabel = Backbone.Model.extend(VisibilityMixin);\n\t\n\t/**\n\t * Section of tool panel with elements (labels and tools).\n\t */\n\tvar 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 }\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 }\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\tvar 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 search_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\tvar 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 // 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 }\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 }\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 }\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 }\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 }\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\tvar 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\tvar 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 }\n\t else if ( formStyle === 'regular' ) { // regular tools\n\t var self = this;\n\t $link.find('a').on('click', function(e) {\n\t e.preventDefault();\n\t var form = new ToolForm.View( { id : self.model.id, version : self.model.get('version') } );\n\t form.deferred.execute(function() {\n\t Galaxy.app.display( form );\n\t });\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\tvar 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\tvar 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 }\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 }\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 ?\n\t this.$el.children(\".toolSectionBody\").slideDown(\"fast\") :\n\t this.$el.children(\".toolSectionBody\").slideUp(\"fast\")\n\t );\n\t }\n\t});\n\t\n\tvar 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 '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 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 ) &&\n\t ( 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\tvar 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 }\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 }\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\n\t 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 }\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\tvar 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\tvar 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\tvar templates = {\n\t // the search bar at the top of the tool panel\n\t tool_search : _.template([\n\t '\" autocomplete=\"off\" type=\"text\" />',\n\t ' ',\n\t //TODO: replace with icon\n\t '',\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([\n\t '
                        \">',\n\t '<%- name %>',\n\t '
                        ',\n\t '
                        \" class=\"toolSectionBody\" style=\"display: none;\">',\n\t '
                        ',\n\t '
                        '\n\t ].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([\n\t '',\n\t '<% _.each( labels, function( label ){ %>',\n\t '\">',\n\t '<%- label %>',\n\t '',\n\t '<% }); %>',\n\t '',\n\t ' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">',\n\t '<%- name %>',\n\t '',\n\t ' <%- description %>'\n\t ].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([\n\t '
                        <%- tool.name %> (version <%- tool.version %>)
                        ',\n\t '
                        ',\n\t '<% _.each( tool.inputs, function( input ){ %>',\n\t '
                        ',\n\t '',\n\t '
                        ',\n\t '<%= input.html %>',\n\t '
                        ',\n\t '
                        ',\n\t '<%- input.help %>',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '<% }); %>',\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        <% tool.help %>
                        ',\n\t '
                        ',\n\t // TODO: we need scoping here because 'help' is the dom for the help menu in the masthead\n\t // which implies a leaky variable that I can't find\n\t ].join(''), { variable: 'tool' }),\n\t};\n\t\n\t\n\t// Exports\n\treturn {\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\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 45 */,\n/* 46 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {/** Renders the color picker used e.g. in the tool form **/\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils ) {\n\t return Backbone.View.extend({\n\t colors: {\n\t standard: ['c00000','ff0000','ffc000','ffff00','92d050','00b050','00b0f0','0070c0','002060','7030a0'],\n\t base : ['ffffff','000000','eeece1','1f497d','4f81bd','c0504d','9bbb59','8064a2','4bacc6','f79646'],\n\t theme :[['f2f2f2','7f7f7f','ddd9c3','c6d9f0','dbe5f1','f2dcdb','ebf1dd','e5e0ec','dbeef3','fdeada'],\n\t ['d8d8d8','595959','c4bd97','8db3e2','b8cce4','e5b9b7','d7e3bc','ccc1d9','b7dde8','fbd5b5'],\n\t ['bfbfbf','3f3f3f','938953','548dd4','95b3d7','d99694','c3d69b','b2a2c7','92cddc','fac08f'],\n\t ['a5a5a5','262626','494429','17365d','366092','953734','76923c','5f497a','31859b','e36c09'],\n\t ['7f7f7e','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]\n\t },\n\t\n\t initialize : function( options ) {\n\t this.options = Utils.merge( options, {} );\n\t this.setElement( this._template() );\n\t this.$panel = this.$( '.ui-color-picker-panel' );\n\t this.$view = this.$( '.ui-color-picker-view' );\n\t this.$value = this.$( '.ui-color-picker-value' );\n\t this.$header = this.$( '.ui-color-picker-header' );\n\t this._build();\n\t this.visible = false;\n\t this.value( this.options.value );\n\t this.$boxes = this.$( '.ui-color-picker-box' );\n\t var self = this;\n\t this.$boxes.on( 'click', function() {\n\t self.value( $( this ).css( 'background-color' ) );\n\t self.$header.trigger( 'click' );\n\t } );\n\t this.$header.on( 'click', function() {\n\t self.visible = !self.visible;\n\t if ( self.visible ) {\n\t self.$view.fadeIn( 'fast' );\n\t } else {\n\t self.$view.fadeOut( 'fast' );\n\t }\n\t } );\n\t },\n\t\n\t /** Get/set value */\n\t value : function ( new_val ) {\n\t if ( new_val !== undefined && new_val !== null ) {\n\t this.$value.css( 'background-color', new_val );\n\t this.$( '.ui-color-picker-box' ).empty();\n\t this.$( this._getValue() ).html( this._templateCheck() );\n\t this.options.onchange && this.options.onchange( new_val );\n\t }\n\t return this._getValue();\n\t },\n\t\n\t /** Get value from dom */\n\t _getValue: function() {\n\t var rgb = this.$value.css( 'background-color' );\n\t rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n\t if ( rgb ) {\n\t function hex( x ) {\n\t return ( '0' + parseInt( x ).toString( 16 ) ).slice( -2 );\n\t }\n\t return '#' + hex( rgb[ 1] ) + hex( rgb[ 2 ] ) + hex( rgb[ 3 ] );\n\t } else {\n\t return null;\n\t }\n\t },\n\t\n\t /** Build color panel */\n\t _build: function() {\n\t var $content = this._content({\n\t label : 'Theme Colors',\n\t colors : this.colors.base,\n\t padding : 10\n\t });\n\t for ( var i in this.colors.theme ) {\n\t var line_def = {};\n\t if ( i == 0 ) {\n\t line_def[ 'bottom' ] = true;\n\t } else {\n\t if ( i != this.colors.theme.length - 1 ) {\n\t line_def[ 'top' ] = true;\n\t line_def[ 'bottom' ] = true;\n\t } else {\n\t line_def[ 'top' ] = true;\n\t line_def[ 'padding' ] = 5;\n\t }\n\t }\n\t line_def[ 'colors' ] = this.colors.theme[ i ];\n\t this._content( line_def );\n\t }\n\t this._content({\n\t label : 'Standard Colors',\n\t colors : this.colors.standard,\n\t padding : 5\n\t });\n\t },\n\t\n\t /** Create content */\n\t _content: function( options ) {\n\t var label = options.label;\n\t var colors = options.colors;\n\t var padding = options.padding;\n\t var top = options.top;\n\t var bottom = options.bottom;\n\t var $content = $( this._templateContent() );\n\t var $label = $content.find( '.label' );\n\t if ( options.label ) {\n\t $label.html( options.label );\n\t } else {\n\t $label.hide();\n\t }\n\t var $line = $content.find( '.line' );\n\t this.$panel.append( $content );\n\t for ( var i in colors ) {\n\t var $box = $( this._templateBox( colors[ i ] ) );\n\t if ( top ) {\n\t $box.css( 'border-top', 'none' );\n\t $box.css( 'border-top-left-radius', '0px' );\n\t $box.css( 'border-top-right-radius', '0px' );\n\t }\n\t if ( bottom ) {\n\t $box.css( 'border-bottom', 'none' );\n\t $box.css( 'border-bottom-left-radius', '0px' );\n\t $box.css( 'border-bottom-right-radius', '0px' );\n\t }\n\t $line.append( $box );\n\t }\n\t if (padding) {\n\t $line.css( 'padding-bottom', padding );\n\t }\n\t return $content;\n\t },\n\t\n\t /** Check icon */\n\t _templateCheck: function() {\n\t return '
                        ';\n\t },\n\t\n\t /** Content template */\n\t _templateContent: function() {\n\t return '
                        ' +\n\t '
                        ' +\n\t '
                        ' +\n\t '
                        ';\n\t },\n\t\n\t /** Box template */\n\t _templateBox: function( color ) {\n\t return '
                        ';\n\t },\n\t\n\t /** Main template */\n\t _template: function() {\n\t return '
                        ' +\n\t '
                        ' +\n\t '
                        ' +\n\t '
                        Select a color
                        ' +\n\t '
                        ' +\n\t '
                        ' +\n\t '
                        ' +\n\t '
                        '\n\t '
                        ';\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__(3), __webpack_require__(1)))\n\n/***/ },\n/* 47 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function($, _) {/** This class creates/wraps a drill down element. */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(20) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Options ) {\n\t\n\tvar View = Options.BaseIcons.extend({\n\t initialize: function( options ) {\n\t options.type = options.display || 'checkbox';\n\t options.multiple = ( options.type == 'checkbox' );\n\t Options.BaseIcons.prototype.initialize.call( this, options );\n\t },\n\t\n\t /** Set states for selected values */\n\t _setValue: function ( new_value ) {\n\t Options.BaseIcons.prototype._setValue.call( this, new_value );\n\t if ( new_value !== undefined && new_value !== null && this.header_index ) {\n\t var self = this;\n\t var values = $.isArray( new_value ) ? new_value : [ new_value ];\n\t _.each( values, function( v ) {\n\t var list = self.header_index[ v ];\n\t _.each( list, function( element ) {\n\t self._setState( element, true );\n\t });\n\t });\n\t }\n\t },\n\t\n\t /** Expand/collapse a sub group */\n\t _setState: function ( header_id, is_expanded ) {\n\t var $button = this.$( '.button-' + header_id );\n\t var $subgroup = this.$( '.subgroup-' + header_id );\n\t $button.data( 'is_expanded', is_expanded );\n\t if ( is_expanded ) {\n\t $subgroup.show();\n\t $button.removeClass( 'fa-plus-square' ).addClass( 'fa-minus-square' );\n\t } else {\n\t $subgroup.hide();\n\t $button.removeClass( 'fa-minus-square' ).addClass( 'fa-plus-square' );\n\t }\n\t },\n\t\n\t /** Template to create options tree */\n\t _templateOptions: function() {\n\t var self = this;\n\t this.header_index = {};\n\t\n\t // attach event handler\n\t function attach( $el, header_id ) {\n\t var $button = $el.find( '.button-' + header_id );\n\t $button.on( 'click', function() {\n\t self._setState( header_id, !$button.data( 'is_expanded' ) );\n\t });\n\t }\n\t\n\t // recursive function which iterates through options\n\t function iterate ( $tmpl, options, header ) {\n\t header = header || [];\n\t for ( i in options ) {\n\t var level = options[ i ];\n\t var has_options = level.options && level.options.length > 0;\n\t var new_header = header.slice( 0 );\n\t self.header_index[ level.value ] = new_header.slice( 0 );\n\t var $group = $( '
                        ' );\n\t if ( has_options ) {\n\t var header_id = Utils.uid();\n\t var $button = $( '' ).addClass( 'button-' + header_id ).addClass( 'ui-drilldown-button fa fa-plus-square' );\n\t var $subgroup = $( '
                        ' ).addClass( 'subgroup-' + header_id ).addClass( 'ui-drilldown-subgroup' );\n\t $group.append( $( '
                        ' )\n\t .append( $button )\n\t .append( self._templateOption( { label: level.name, value: level.value } ) ) );\n\t new_header.push( header_id );\n\t iterate ( $subgroup, level.options, new_header );\n\t $group.append( $subgroup );\n\t attach( $group, header_id );\n\t } else {\n\t $group.append( self._templateOption( { label: level.name, value: level.value } ) );\n\t }\n\t $tmpl.append( $group );\n\t }\n\t }\n\t\n\t // iterate through options and create dom\n\t var $tmpl = $( '
                        ' );\n\t iterate( $tmpl, this.model.get( 'data' ) );\n\t return $tmpl;\n\t },\n\t\n\t /** Template for drill down view */\n\t _template: function() {\n\t return $( '
                        ' ).addClass( 'ui-options-list drilldown-container' ).attr( 'id', this.model.id );\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 48 */\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__(7), __webpack_require__(21) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils, Ui, Select ) {\n\t\n\t/** Batch mode variations */\n\tvar Batch = { DISABLED: 'disabled', ENABLED: 'enabled', LINKED: 'linked' };\n\t\n\t/** List of available content selectors options */\n\tvar Configurations = {\n\t data: [\n\t { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED },\n\t { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.LINKED },\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.LINKED } ],\n\t data_multiple: [\n\t { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.DISABLED },\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n\t data_collection: [\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n\t workflow_data: [\n\t { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED } ],\n\t workflow_data_multiple: [\n\t { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.DISABLED } ],\n\t workflow_data_collection: [\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n\t module_data: [\n\t { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED },\n\t { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.ENABLED } ],\n\t module_data_collection: [\n\t { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED },\n\t { src: 'hdca', icon: 'fa-folder', tooltip: 'Multiple collections', multiple: true, batch: Batch.ENABLED } ]\n\t};\n\t\n\t/** View for hda and hdca content selector ui elements */\n\tvar View = Backbone.View.extend({\n\t initialize : function( options ) {\n\t var self = this;\n\t this.model = options && options.model || new Backbone.Model({\n\t src_labels : { 'hda' : 'dataset', 'hdca': 'dataset collection' },\n\t pagelimit : 100\n\t }).set( options );\n\t this.setElement( $( '
                        ' ).addClass( 'ui-select-content' ) );\n\t this.button_product = new Ui.RadioButton.View( {\n\t value : 'false',\n\t data : [ { icon: 'fa fa-chain', value: 'false',\n\t tooltip: 'Linked inputs will be run in matched order with other datasets e.g. use this for matching forward and reverse reads.' },\n\t { icon: 'fa fa-chain-broken', value: 'true',\n\t tooltip: 'Unlinked dataset inputs will be run against *all* other inputs.' } ] } );\n\t var $batch_div = $( '
                        ' ).addClass( 'ui-form-info' )\n\t .append( $( '' ).addClass( 'fa fa-sitemap' ) )\n\t .append( $( '' ).html( 'This is a batch mode input field. Separate jobs will be triggered for each dataset selection.' ) );\n\t this.$batch = {\n\t linked : $batch_div.clone(),\n\t enabled : $batch_div.clone().append( $( '
                        ' )\n\t .append( $( '
                        ' ).addClass( 'ui-form-title' ).html( 'Batch options:' ) )\n\t .append( this.button_product.$el ) )\n\t .append( $( '
                        ' ).css( 'clear', 'both' ) )\n\t };\n\t\n\t // track current history elements\n\t this.history = {};\n\t\n\t // add listeners\n\t this.listenTo( this.model, 'change:data', this._changeData, this );\n\t this.listenTo( this.model, 'change:wait', this._changeWait, this );\n\t this.listenTo( this.model, 'change:current', this._changeCurrent, this );\n\t this.listenTo( this.model, 'change:value', this._changeValue, this );\n\t this.listenTo( this.model, 'change:type change:optional change:multiple change:extensions', this._changeType, this );\n\t this.render();\n\t\n\t // add change event\n\t this.on( 'change', function() { options.onchange && options.onchange( self.value() ) } );\n\t },\n\t\n\t render: function() {\n\t this._changeType();\n\t this._changeValue();\n\t this._changeWait();\n\t },\n\t\n\t /** Indicate that select fields are being updated */\n\t wait: function() {\n\t this.model.set( 'wait', true );\n\t },\n\t\n\t /** Indicate that the options update has been completed */\n\t unwait: function() {\n\t this.model.set( 'wait', false );\n\t },\n\t\n\t /** Update data representing selectable options */\n\t update: function( options ) {\n\t this.model.set( 'data', options );\n\t },\n\t\n\t /** Return the currently selected dataset values */\n\t value: function ( new_value ) {\n\t new_value !== undefined && this.model.set( 'value', new_value );\n\t var current = this.model.get( 'current' );\n\t if ( this.config[ current ] ) {\n\t var id_list = this.fields[ current ].value();\n\t if (id_list !== null) {\n\t id_list = $.isArray( id_list ) ? id_list : [ id_list ];\n\t if ( id_list.length > 0 ) {\n\t var result = this._batch( { values: [] } );\n\t for ( var i in id_list ) {\n\t var details = this.history[ id_list[ i ] + '_' + this.config[ current ].src ];\n\t if ( details ) {\n\t result.values.push( details );\n\t } else {\n\t Galaxy.emit.debug( 'ui-select-content::value()', 'Requested details not found for \\'' + id_list[ i ] + '\\'.' );\n\t return null;\n\t }\n\t }\n\t result.values.sort( function( a, b ) { return a.hid - b.hid } );\n\t return result;\n\t }\n\t }\n\t } else {\n\t Galaxy.emit.debug( 'ui-select-content::value()', 'Invalid value/source \\'' + new_value + '\\'.' );\n\t }\n\t return null;\n\t },\n\t\n\t /** Change of current select field */\n\t _changeCurrent: function() {\n\t var self = this;\n\t _.each( this.fields, function( field, i ) {\n\t if ( self.model.get( 'current' ) == i ) {\n\t field.$el.show();\n\t _.each( self.$batch, function( $batchfield, batchmode ) {\n\t $batchfield[ self.config[ i ].batch == batchmode ? 'show' : 'hide' ]();\n\t });\n\t self.button_type.value( i );\n\t } else {\n\t field.$el.hide();\n\t }\n\t });\n\t },\n\t\n\t /** Change of type */\n\t _changeType: function() {\n\t var self = this;\n\t\n\t // identify selector type identifier i.e. [ flavor ]_[ type ]_[ multiple ]\n\t var config_id = ( this.model.get( 'flavor' ) ? this.model.get( 'flavor' ) + '_' : '' ) +\n\t String( this.model.get( 'type' ) ) + ( this.model.get( 'multiple' ) ? '_multiple' : '' );\n\t if ( Configurations[ config_id ] ) {\n\t this.config = Configurations[ config_id ];\n\t } else {\n\t this.config = Configurations[ 'data' ];\n\t Galaxy.emit.debug( 'ui-select-content::_changeType()', 'Invalid configuration/type id \\'' + config_id + '\\'.' );\n\t }\n\t\n\t // prepare extension component of error message\n\t var data = self.model.get( 'data' );\n\t var extensions = Utils.textify( this.model.get( 'extensions' ) );\n\t var src_labels = this.model.get( 'src_labels' );\n\t\n\t // build views\n\t this.fields = [];\n\t this.button_data = [];\n\t _.each( this.config, function( c, i ) {\n\t self.button_data.push({\n\t value : i,\n\t icon : c.icon,\n\t tooltip : c.tooltip\n\t });\n\t self.fields.push(\n\t new Select.View({\n\t optional : self.model.get( 'optional' ),\n\t multiple : c.multiple,\n\t searchable : !c.multiple || ( data && data[ c.src ] && data[ c.src ].length > self.model.get( 'pagelimit' ) ),\n\t selectall : false,\n\t error_text : 'No ' + ( extensions ? extensions + ' ' : '' ) + ( src_labels[ c.src ] || 'content' ) + ' available.',\n\t onchange : function() {\n\t self.trigger( 'change' );\n\t }\n\t })\n\t );\n\t });\n\t this.button_type = new Ui.RadioButton.View({\n\t value : this.model.get( 'current' ),\n\t data : this.button_data,\n\t onchange: function( value ) {\n\t self.model.set( 'current', value );\n\t self.trigger( 'change' );\n\t }\n\t });\n\t\n\t // append views\n\t this.$el.empty();\n\t var button_width = 0;\n\t if ( this.fields.length > 1 ) {\n\t this.$el.append( this.button_type.$el );\n\t button_width = Math.max( 0, this.fields.length * 36 ) + 'px';\n\t }\n\t _.each( this.fields, function( field ) {\n\t self.$el.append( field.$el.css( { 'margin-left': button_width } ) );\n\t });\n\t _.each( this.$batch, function( $batchfield, batchmode ) {\n\t self.$el.append( $batchfield.css( { 'margin-left': button_width } ) );\n\t });\n\t this.model.set( 'current', 0 );\n\t this._changeCurrent();\n\t this._changeData();\n\t },\n\t\n\t /** Change of wait flag */\n\t _changeWait: function() {\n\t var self = this;\n\t _.each( this.fields, function( field ) { field[ self.model.get( 'wait' ) ? 'wait' : 'unwait' ]() } );\n\t },\n\t\n\t /** Change of available options */\n\t _changeData: function() {\n\t var options = this.model.get( 'data' );\n\t var self = this;\n\t var select_options = {};\n\t _.each( options, function( items, src ) {\n\t select_options[ src ] = [];\n\t _.each( items, function( item ) {\n\t select_options[ src ].push({\n\t hid : item.hid,\n\t keep : item.keep,\n\t label: item.hid + ': ' + item.name,\n\t value: item.id\n\t });\n\t self.history[ item.id + '_' + src ] = item;\n\t });\n\t });\n\t _.each( this.config, function( c, i ) {\n\t select_options[ c.src ] && self.fields[ i ].add( select_options[ c.src ], function( a, b ) { return b.hid - a.hid } );\n\t });\n\t },\n\t\n\t /** Change of incoming value */\n\t _changeValue: function () {\n\t var new_value = this.model.get( 'value' );\n\t if ( new_value && new_value.values && new_value.values.length > 0 ) {\n\t // create list with content ids\n\t var list = [];\n\t _.each( new_value.values, function( value ) {\n\t list.push( value.id );\n\t });\n\t // sniff first suitable field type from config list\n\t var src = new_value.values[ 0 ].src;\n\t var multiple = new_value.values.length > 1;\n\t for( var i = 0; i < this.config.length; i++ ) {\n\t var field = this.fields[ i ];\n\t var c = this.config[ i ];\n\t if ( c.src == src && [ multiple, true ].indexOf( c.multiple ) !== -1 ) {\n\t this.model.set( 'current', i );\n\t field.value( list );\n\t break;\n\t }\n\t }\n\t } else {\n\t _.each( this.fields, function( field ) {\n\t field.value( null );\n\t });\n\t }\n\t },\n\t\n\t /** Assists in identifying the batch mode */\n\t _batch: function( result ) {\n\t result[ 'batch' ] = false;\n\t var current = this.model.get( 'current' );\n\t var config = this.config[ current ];\n\t if ( config.src == 'hdca' && !config.multiple ) {\n\t var hdca = this.history[ this.fields[ current ].value() + '_hdca' ];\n\t if ( hdca && hdca.map_over_type ) {\n\t result[ 'batch' ] = true;\n\t }\n\t }\n\t if ( config.batch == Batch.LINKED || config.batch == Batch.ENABLED ) {\n\t result[ 'batch' ] = true;\n\t if ( config.batch == Batch.ENABLED && this.button_product.value() === 'true' ) {\n\t result[ 'product' ] = true;\n\t }\n\t }\n\t return result;\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone) {// dependencies\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(19)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Utils, List) {\n\t\n\t/**\n\t * FTP file selector\n\t */\n\tvar View = Backbone.View.extend({\n\t // initialize\n\t initialize : function(options) {\n\t // link this\n\t var self = this;\n\t\n\t // create ui-list view to keep track of selected ftp files\n\t this.ftpfile_list = new List.View({\n\t name : 'file',\n\t optional : options.optional,\n\t multiple : options.multiple,\n\t onchange : function() {\n\t options.onchange && options.onchange(self.value());\n\t }\n\t });\n\t\n\t // create elements\n\t this.setElement(this.ftpfile_list.$el);\n\t\n\t // initial fetch of ftps\n\t Utils.get({\n\t url : Galaxy.root + 'api/remote_files',\n\t success : function(response) {\n\t var data = [];\n\t for (var i in response) {\n\t data.push({\n\t value : response[i]['path'],\n\t label : response[i]['path']\n\t });\n\t }\n\t self.ftpfile_list.update(data);\n\t }\n\t });\n\t },\n\t\n\t /** Return/Set currently selected ftp datasets */\n\t value: function(val) {\n\t return this.ftpfile_list.value(val);\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 50 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone) {// dependencies\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(7), __webpack_require__(52), __webpack_require__(19)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Utils, Ui, Table, List) {\n\t\n\t// collection of libraries\n\tvar Libraries = Backbone.Collection.extend({\n\t url: Galaxy.root + 'api/libraries?deleted=false'\n\t});\n\t\n\t// collection of dataset\n\tvar LibraryDatasets = Backbone.Collection.extend({\n\t initialize: function() {\n\t var self = this;\n\t this.config = new Backbone.Model({ library_id: null });\n\t this.config.on('change', function() {\n\t self.fetch({ reset: true });\n\t });\n\t },\n\t url: function() {\n\t return Galaxy.root + 'api/libraries/' + this.config.get('library_id') + '/contents';\n\t }\n\t});\n\t\n\t// hda/hdca content selector ui element\n\tvar View = Backbone.View.extend({\n\t // initialize\n\t initialize : function(options) {\n\t // link this\n\t var self = this;\n\t\n\t // collections\n\t this.libraries = new Libraries();\n\t this.datasets = new LibraryDatasets();\n\t\n\t // link app and options\n\t this.options = options;\n\t\n\t // select field for the library\n\t // TODO: Remove this once the library API supports searching for library datasets\n\t this.library_select = new Ui.Select.View({\n\t onchange : function(value) {\n\t self.datasets.config.set('library_id', value);\n\t }\n\t });\n\t\n\t // create ui-list view to keep track of selected data libraries\n\t this.dataset_list = new List.View({\n\t name : 'dataset',\n\t optional : options.optional,\n\t multiple : options.multiple,\n\t onchange : function() {\n\t self.trigger('change');\n\t }\n\t });\n\t\n\t // add reset handler for fetched libraries\n\t this.libraries.on('reset', function() {\n\t var data = [];\n\t self.libraries.each(function(model) {\n\t data.push({\n\t value : model.id,\n\t label : model.get('name')\n\t });\n\t });\n\t self.library_select.update(data);\n\t });\n\t\n\t // add reset handler for fetched library datasets\n\t this.datasets.on('reset', function() {\n\t var data = [];\n\t var library_current = self.library_select.text();\n\t if (library_current !== null) {\n\t self.datasets.each(function(model) {\n\t if (model.get('type') === 'file') {\n\t data.push({\n\t value : model.id,\n\t label : model.get('name')\n\t });\n\t }\n\t });\n\t }\n\t self.dataset_list.update(data);\n\t });\n\t\n\t // add change event. fires on trigger\n\t this.on('change', function() {\n\t options.onchange && options.onchange(self.value());\n\t });\n\t\n\t // create elements\n\t this.setElement(this._template());\n\t this.$('.library-select').append(this.library_select.$el);\n\t this.$el.append(this.dataset_list.$el);\n\t\n\t // initial fetch of libraries\n\t this.libraries.fetch({\n\t reset: true,\n\t success: function() {\n\t self.library_select.trigger('change');\n\t if (self.options.value !== undefined) {\n\t self.value(self.options.value);\n\t }\n\t }\n\t });\n\t },\n\t\n\t /** Return/Set currently selected library datasets */\n\t value: function(val) {\n\t return this.dataset_list.value(val);\n\t },\n\t\n\t /** Template */\n\t _template: function() {\n\t return '
                        ' +\n\t '
                        ' +\n\t 'Select Library' +\n\t '' +\n\t '
                        ' +\n\t '
                        ';\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))\n\n/***/ },\n/* 51 */\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_AMD_DEFINE_RESULT__ = function( Utils ) {\n\tvar View = Backbone.View.extend({\n\t initialize : function( options ) {\n\t var self = this;\n\t this.options = Utils.merge( options, {\n\t id : Utils.uid(),\n\t min : null,\n\t max : null,\n\t step : null,\n\t precise : false,\n\t split : 10000\n\t } );\n\t\n\t // create new element\n\t this.setElement( this._template( this.options ) );\n\t\n\t // determine wether to use the slider\n\t this.useslider = this.options.max !== null && this.options.min !== null && this.options.max > this.options.min;\n\t\n\t // set default step size\n\t if ( this.options.step === null ) {\n\t this.options.step = 1.0;\n\t if ( this.options.precise && this.useslider ) {\n\t this.options.step = ( this.options.max - this.options.min ) / this.options.split;\n\t }\n\t }\n\t\n\t // create slider if min and max are defined properly\n\t if ( this.useslider ) {\n\t this.$slider = this.$( '#slider' );\n\t this.$slider.slider( this.options );\n\t this.$slider.on( 'slide', function ( event, ui ) {\n\t self.value( ui.value );\n\t });\n\t } else {\n\t this.$( '.ui-form-slider-text' ).css( 'width', '100%' );\n\t }\n\t\n\t // link text input field\n\t this.$text = this.$( '#text' );\n\t\n\t // set initial value\n\t this.options.value !== undefined && ( this.value( this.options.value ) );\n\t\n\t // add text field event\n\t var pressed = [];\n\t this.$text.on( 'change', function () {\n\t self.value( $( this ).val() );\n\t });\n\t this.$text.on( 'keyup', function( e ) {\n\t pressed[e.which] = false;\n\t self.options.onchange && self.options.onchange( $( this ).val() );\n\t });\n\t this.$text.on( 'keydown', function ( e ) {\n\t var v = e.which;\n\t pressed[ v ] = true;\n\t if ( self.options.is_workflow && pressed[ 16 ] && v == 52 ) {\n\t self.value( '$' )\n\t event.preventDefault();\n\t } else if (!( v == 8 || v == 9 || v == 13 || v == 37 || v == 39 || ( v >= 48 && v <= 57 && !pressed[ 16 ] ) || ( v >= 96 && v <= 105 )\n\t || ( ( v == 190 || v == 110 ) && $( this ).val().indexOf( '.' ) == -1 && self.options.precise )\n\t || ( ( v == 189 || v == 109 ) && $( this ).val().indexOf( '-' ) == -1 )\n\t || self._isParameter( $( this ).val() )\n\t || pressed[ 91 ] || pressed[ 17 ] ) ) {\n\t event.preventDefault();\n\t }\n\t });\n\t },\n\t\n\t /** Set and Return the current value\n\t */\n\t value : function ( new_val ) {\n\t if ( new_val !== undefined ) {\n\t if ( new_val !== null && new_val !== '' && !this._isParameter( new_val ) ) {\n\t isNaN( new_val ) && ( new_val = 0 );\n\t this.options.max !== null && ( new_val = Math.min( new_val, this.options.max ) );\n\t this.options.min !== null && ( new_val = Math.max( new_val, this.options.min ) );\n\t }\n\t this.$slider && this.$slider.slider( 'value', new_val );\n\t this.$text.val( new_val );\n\t this.options.onchange && this.options.onchange( new_val );\n\t }\n\t return this.$text.val();\n\t },\n\t\n\t /** Return true if the field contains a workflow parameter i.e. $('name')\n\t */\n\t _isParameter: function( value ) {\n\t return this.options.is_workflow && String( value ).substring( 0, 1 ) === '$';\n\t },\n\t\n\t /** Slider template\n\t */\n\t _template: function( options ) {\n\t return '
                        ' +\n\t '' +\n\t '
                        ' +\n\t '
                        ';\n\t }\n\t});\n\t\n\treturn {\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__(3), __webpack_require__(1)))\n\n/***/ },\n/* 52 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $) {// dependencies\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Utils) {\n\t\n\t/**\n\t * This class creates a ui table element.\n\t */\n\tvar View = Backbone.View.extend({\n\t // current row\n\t row: null,\n\t \n\t // count rows\n\t row_count: 0,\n\t \n\t // defaults options\n\t optionsDefault: {\n\t content : 'No content available.',\n\t onchange : null,\n\t ondblclick : null,\n\t onconfirm : null,\n\t cls : 'ui-table',\n\t cls_tr : ''\n\t },\n\t \n\t // events\n\t events : {\n\t 'click' : '_onclick',\n\t 'dblclick' : '_ondblclick'\n\t },\n\t \n\t // initialize\n\t initialize : function(options) {\n\t // configure options\n\t this.options = Utils.merge(options, this.optionsDefault);\n\t \n\t // create new element\n\t var $el = $(this._template(this.options));\n\t \n\t // link sub-elements\n\t this.$thead = $el.find('thead');\n\t this.$tbody = $el.find('tbody');\n\t this.$tmessage = $el.find('tmessage');\n\t \n\t // set element\n\t this.setElement($el);\n\t \n\t // initialize row\n\t this.row = this._row();\n\t },\n\t \n\t // add header cell\n\t addHeader: function($el) {\n\t var wrapper = $('
                        ' +\n\t '' +\n\t '' +\n\t '
                        ' +\n\t '' + options.content + '' +\n\t '
                        ';\n\t }\n\t});\n\t\n\treturn {\n\t View: View\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\n\n/***/ },\n/* 53 */\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_AMD_DEFINE_RESULT__ = function() {\n\t var Model = Backbone.Model.extend({\n\t defaults: {\n\t extension : 'auto',\n\t genome : '?',\n\t url_paste : '',\n\t status : 'init',\n\t info : null,\n\t file_name : '',\n\t file_mode : '',\n\t file_size : 0,\n\t file_type : null,\n\t file_path : '',\n\t file_data : null,\n\t percentage : 0,\n\t space_to_tab : false,\n\t to_posix_lines : true,\n\t enabled : true\n\t },\n\t reset: function( attr ) {\n\t this.clear().set( this.defaults ).set( attr );\n\t }\n\t });\n\t var Collection = Backbone.Collection.extend( { model: Model } );\n\t return { Model: Model, Collection : Collection };\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/* 54 */,\n/* 55 */\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 defines a queue to ensure that multiple deferred callbacks are executed sequentially.\n\t */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils ) {\n\treturn Backbone.Model.extend({\n\t initialize: function(){\n\t this.active = {};\n\t this.last = null;\n\t },\n\t\n\t /** Adds a callback to the queue. Upon execution a deferred object is parsed to the callback i.e. callback( deferred ).\n\t * If the callback does not take any arguments, the deferred is resolved instantly.\n\t */\n\t execute: function( callback ) {\n\t var self = this;\n\t var id = Utils.uid();\n\t var has_deferred = callback.length > 0;\n\t\n\t // register process\n\t this.active[ id ] = true;\n\t\n\t // deferred process\n\t var process = $.Deferred();\n\t process.promise().always(function() {\n\t delete self.active[ id ];\n\t has_deferred && Galaxy.emit.debug( 'deferred::execute()', this.state().charAt(0).toUpperCase() + this.state().slice(1) + ' ' + id );\n\t });\n\t\n\t // deferred queue\n\t $.when( this.last ).always(function() {\n\t if ( self.active[ id ] ) {\n\t has_deferred && Galaxy.emit.debug( 'deferred::execute()', 'Running ' + id );\n\t callback( process );\n\t !has_deferred && process.resolve();\n\t } else {\n\t process.reject();\n\t }\n\t });\n\t this.last = process.promise();\n\t },\n\t\n\t /** Resets the promise queue. All currently queued but unexecuted callbacks/promises will be rejected.\n\t */\n\t reset: function() {\n\t Galaxy.emit.debug('deferred::execute()', 'Reset');\n\t for ( var i in this.active ) {\n\t this.active[ i ] = false;\n\t }\n\t },\n\t\n\t /** Returns true if all processes are done.\n\t */\n\t ready: function() {\n\t return $.isEmptyObject( this.active );\n\t }\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__(3), __webpack_require__(1)))\n\n/***/ },\n/* 56 */,\n/* 57 */,\n/* 58 */,\n/* 59 */,\n/* 60 */,\n/* 61 */,\n/* 62 */,\n/* 63 */,\n/* 64 */,\n/* 65 */,\n/* 66 */\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__ = [\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(15),\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( baseMVC, _l ){\n\t// =============================================================================\n\t/** A view on any model that has a 'annotation' attribute\n\t */\n\tvar AnnotationEditor = Backbone.View\n\t .extend( baseMVC.LoggableMixin )\n\t .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 })\n\t .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 '
                        ',\n\t _.escape( annotation ),\n\t '
                        '\n\t ].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(){ return [ 'AnnotationEditor(', this.model + '', ')' ].join(''); }\n\t});\n\t// =============================================================================\n\treturn {\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2)))\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(jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(2),\n\t __webpack_require__(3),\n\t __webpack_require__(6),\n\t], __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\tvar 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 ){ defaults.order = this.order; }\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\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 === '' ){ return; }\n\t // json to python\n\t if( v === true ){ v = 'True'; }\n\t if( v === false ){ v = 'False'; }\n\t if( v === null ){ v = 'None'; }\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 ) ){ throw new Error( 'unknown order: ' + order ); }\n\t // if( _.isUndefined( comparator ) ){ return; }\n\t if( comparator === collection.comparator ){ return; }\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 */\n\tvar 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 )\n\t .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/**\n\t * A Collection that will load more elements without reseting.\n\t */\n\tvar 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 )\n\t .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\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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __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(_) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(76),\n\t __webpack_require__(30),\n\t __webpack_require__(29),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_VIEW, DC_MODEL, DC_LI, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'collections';\n\t/* =============================================================================\n\tTODO:\n\t\n\t============================================================================= */\n\t/** @class non-editable, read-only View/Controller for a dataset collection.\n\t */\n\tvar _super = LIST_VIEW.ModelListPanel;\n\tvar 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 },\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\n\t//------------------------------------------------------------------------------ TEMPLATES\n\tCollectionView.prototype.templates = (function(){\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate([\n\t '
                        ',\n\t '',\n\t\n\t '
                        ',\n\t '
                        <%- collection.name || collection.element_identifier %>
                        ',\n\t '
                        ',\n\t '<% if( collection.collection_type === \"list\" ){ %>',\n\t _l( 'a list of datasets' ),\n\t '<% } else if( collection.collection_type === \"paired\" ){ %>',\n\t _l( 'a pair of datasets' ),\n\t '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n\t _l( 'a list of paired datasets' ),\n\t '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n\t _l( 'a list of dataset lists' ),\n\t '<% } %>',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ], '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\n\t// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\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(_, $) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(12),\n\t __webpack_require__(32),\n\t __webpack_require__(77),\n\t __webpack_require__(66),\n\t __webpack_require__(22),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( STATES, DATASET_LI, TAGS, ANNOTATIONS, faIconButton, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t//==============================================================================\n\tvar _super = DATASET_LI.DatasetListItemView;\n\t/** @class Editing view for DatasetAssociation.\n\t */\n\tvar 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([\n\t this._renderEditButton(),\n\t this._renderDeleteButton()\n\t ]);\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 )\n\t || ( !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 : this.model.urls.edit,\n\t target : this.linkTarget,\n\t faIcon : 'fa-pencil',\n\t classes : 'edit-btn'\n\t };\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 /** 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() ]);\n\t case STATES.OK:\n\t case STATES.FAILED_METADATA:\n\t return actions.concat([ this._renderRerunButton(), this._renderVisualizationsButton() ]);\n\t }\n\t return actions.concat([ this._renderRerunButton() ]);\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 : this.model.urls.report_error,\n\t classes : 'report-error-btn',\n\t target : this.linkTarget,\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 // create webpack split point in order to load the tool form async\n\t // TODO: split not working (tool loads fine)\n\t !/* require */(/* empty */function() { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [ __webpack_require__(18) ]; (function( ToolForm ){\n\t var form = new ToolForm.View({ 'job_id' : creating_job });\n\t form.deferred.execute( function(){\n\t Galaxy.app.display( form );\n\t });\n\t }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}());\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() )\n\t || ( !this.hasUser )\n\t || ( !this.model.hasData() )\n\t || ( _.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 ){ return; }\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(){ this.render(); },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow : function(){ view.tagsEditorShown = true; },\n\t onhide : function(){ view.tagsEditorShown = false; },\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 ){ this.tagsEditor.toggle( true ); }\n\t },\n\t\n\t /** Render the annotation display/control */\n\t _renderAnnotation : function( $where ){\n\t if( !this.hasUser ){ return; }\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(){ this.render(); },\n\t // persist state on the hda view (and not the editor) since these are currently re-created each time\n\t onshow : function(){ view.annotationEditorShown = true; },\n\t onhide : function(){ view.annotationEditorShown = false; },\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 ){ this.annotationEditor.toggle( true ); }\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' ) === '?'\n\t && !this.model.isDeletedOrPurged() ){\n\t var editableDbkey = $( '?' )\n\t .attr( 'href', this.model.urls.edit )\n\t .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 ){ this.trigger( 'edit', this, ev ); },\n\t 'click .delete-btn' : function( ev ){ this.trigger( 'delete', this, ev ); },\n\t 'click .rerun-btn' : function( ev ){ this.trigger( 'rerun', this, ev ); },\n\t 'click .report-err-btn' : function( ev ){ this.trigger( 'report-err', this, ev ); },\n\t 'click .visualization-btn' : function( ev ){ this.trigger( 'visualize', this, ev ); },\n\t 'click .dbkey a' : function( ev ){ this.trigger( 'edit', this, ev ); }\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\n\t// ............................................................................ TEMPLATES\n\t/** underscore templates */\n\tDatasetListItemEdit.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\" ){ %>',\n\t '',\n\t '<% } %>'\n\t ], '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 '
                        ',\n\t _l( 'This dataset has been deleted' ),\n\t '
                        ', _l( 'Undelete it' ), '',\n\t '<% if( view.purgeAllowed ){ %>',\n\t '
                        ',\n\t _l( 'Permanently remove it from disk' ),\n\t '',\n\t '<% } %>',\n\t '
                        ',\n\t '<% } %>'\n\t ], 'dataset' )\n\t });\n\t\n\t var visualizationsTemplate = BASE_MVC.wrapTemplate([\n\t '<% if( visualizations.length === 1 ){ %>',\n\t '\"',\n\t ' target=\"<%- visualizations[0].target %>\" title=\"', _l( 'Visualize in' ),\n\t ' <%- visualizations[0].html %>\">',\n\t '',\n\t '',\n\t\n\t '<% } else { %>',\n\t '
                        ',\n\t '',\n\t '',\n\t '',\n\t '',\n\t '
                        ',\n\t '<% } %>'\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\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, _, jQuery) {!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(12),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( STATES, BASE_MVC, _l ){\n\t'use strict';\n\t\n\tvar logNamespace = 'dataset';\n\t//==============================================================================\n\tvar 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\tvar DatasetAssociation = Backbone.Model\n\t .extend( BASE_MVC.LoggableMixin )\n\t .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 ){ return {}; }\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?to_ext=' + this.get( 'file_ext' ),\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 /** 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' ) ){ return true; }\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 )\n\t .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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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 '\n\t + '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 : [\n\t 'name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'\n\t ],\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//==============================================================================\n\t/** @class Backbone collection for dataset associations.\n\t */\n\tvar 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 ){ return item.get('id'); });\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 ){ return dataset.hasDetails(); });\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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 71 */\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__ = [\n\t __webpack_require__(32),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DATASET_LI, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _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\tvar 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\tHDAListItemView.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 '',\n\t '
                        ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- dataset.hid %> ',\n\t '<%- dataset.name %>',\n\t '
                        ',\n\t '
                        '\n\t ], '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 ){ %>',\n\t '
                        ',\n\t _l( 'This dataset has been hidden' ),\n\t '
                        ',\n\t '<% } %>'\n\t ], '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\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 72 */\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__ = [\n\t __webpack_require__(70),\n\t __webpack_require__(74),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DATASET, HISTORY_CONTENT, BASE_MVC, _l ){\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _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\tvar 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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 73 */\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__ = [\n\t __webpack_require__(12),\n\t __webpack_require__(29),\n\t __webpack_require__(68),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( STATES, DC_LI, DC_VIEW, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _super = DC_LI.DCListItemView;\n\t/** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n\t */\n\tvar 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\n\t this.listenTo( this.model, {\n\t 'change:populated change:visible' : function( model, options ){ this.render(); },\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\tHDCAListItemView.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 ){ %>',\n\t '
                        ',\n\t _l( 'This collection has been hidden' ),\n\t '
                        ',\n\t '<% } %>'\n\t ], '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 '',\n\t '
                        ',\n\t //TODO: remove whitespace and use margin-right\n\t '<%- collection.hid %> ',\n\t '<%- collection.name %>',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 74 */\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__ = [\n\t __webpack_require__(12),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __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\tvar 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 )\n\t && ( this.get( 'deleted' ) || this.get( 'purged' ) ) ){\n\t isVisible = false;\n\t }\n\t if( ( !includeHidden )\n\t && ( !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/'\n\t + 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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 75 */\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__ = [\n\t __webpack_require__(40),\n\t __webpack_require__(41),\n\t __webpack_require__(67),\n\t __webpack_require__(4),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __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\tvar History = Backbone.Model\n\t .extend( BASE_MVC.LoggableMixin )\n\t .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 : [\n\t 'name', 'annotation', 'tags'\n\t ],\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 ){ return this; }\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\n\t ? function(){ return self.contents.fetchPage( 0 ); }\n\t : function(){ return self.contents.fetchUpdated( lastUpdateTime ); };\n\t // note: if there was no previous update time, all summary contents will be fetched\n\t return fetchFn()\n\t .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 ){ return; }\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\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()\n\t .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\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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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' ) ){ return jQuery.when(); }\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()\n\t .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//==============================================================================\n\tvar _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\tvar 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(){ return this.urlRoot; },\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//==============================================================================\n\treturn {\n\t History : History,\n\t HistoryCollection : HistoryCollection\n\t};}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 76 */\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__ = [\n\t __webpack_require__(42),\n\t __webpack_require__(127),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(85)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_ITEM, LoadingIndicator, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'list';\n\t/* ============================================================================\n\tTODO:\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\tvar 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', [\n\t function( next ){\n\t panel.$el.fadeOut( speed, next );\n\t },\n\t function( next ){\n\t panel._swapNewRender( $newRender );\n\t next();\n\t },\n\t function( next ){\n\t panel.$el.fadeIn( speed, next );\n\t },\n\t function( next ){\n\t panel.trigger( 'rendered', panel );\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 this.$el.empty().attr( 'class', this.className ).append( $newRender.children() );\n\t if( this.selecting ){ this.showSelectors( 0 ); }\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 = $([\n\t '
                        ',\n\t '',\n\t '
                          ', '
                        ',\n\t '
                        '\n\t ].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 ){ 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 ){ return undefined; }\n\t var view = panel._createItemView( model );\n\t // console.log( 'adding and rendering:', modelIndex, view.toString() );\n\t\n\t $( view ).queue( 'fx', [\n\t 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 },\n\t function( next ){\n\t panel._attachView( view, modelIndex );\n\t next();\n\t }\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 ){ return v.model === model; });\n\t if( !view ){ return undefined; }\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', [\n\t function( next ){\n\t view.$el.fadeOut( panel.fxSpeed, next );\n\t },\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 ]);\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 ){ return v.model.id === id; });\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 ){ return ( viewA )?( [ viewA ] ):( [] ); }\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 ){ return []; }\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 )?\n\t this.views.slice( indexA, indexB + 1 ) :\n\t 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 ){ return this; }\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 ){ return this; }\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\tListPanel.prototype.templates = (function(){\n\t\n\t var elTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ]);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate([\n\t '
                        ',\n\t '
                        ',\n\t '
                        <%- view.title %>
                        ',\n\t '
                        ',\n\t '
                        <%- view.subtitle %>
                        ',\n\t // buttons, controls go here\n\t '
                        ',\n\t // deleted msg, etc.\n\t '
                        ',\n\t\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t\n\t // show when selectors are shown\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\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//=============================================================================\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\tvar 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 ]\n\t || attributes.collection\n\t || 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\tModelListPanel.prototype.templates = (function(){\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate([\n\t '
                        ',\n\t '
                        ',\n\t //TODO: this is really the only difference - consider factoring titlebar out\n\t '
                        <%- model.name %>
                        ',\n\t '
                        ',\n\t '
                        <%- view.subtitle %>
                        ',\n\t '
                        ',\n\t '
                        ',\n\t\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ]);\n\t\n\t return _.extend( _.clone( ListPanel.prototype.templates ), {\n\t controls : controlsTemplate\n\t });\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 77 */\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__ = [\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( baseMVC, _l ){\n\t// =============================================================================\n\t/** A view on any model that has a 'tags' attribute (a list of tag strings)\n\t * Incorporates the select2 jQuery plugin for tags display/editing:\n\t * http://ivaynberg.github.io/select2/\n\t */\n\tvar TagsEditor = Backbone.View\n\t .extend( baseMVC.LoggableMixin )\n\t .extend( baseMVC.HiddenUntilActivatedViewMixin ).extend({\n\t\n\t tagName : 'div',\n\t className : 'tags-display',\n\t\n\t /** Set up listeners, parse options */\n\t initialize : function( options ){\n\t //console.debug( this, options );\n\t // only listen to the model only for changes to tags - re-render\n\t this.listenTo( this.model, 'change:tags', 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 this.$input().select2({\n\t placeholder : 'Add tags',\n\t width : '100%',\n\t tags : function(){\n\t // initialize possible tags in the dropdown based on all the tags the user has used so far\n\t return view._getTagsUsed();\n\t }\n\t });\n\t\n\t this._setUpBehaviors();\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 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 ''\n\t ].join( '' );\n\t },\n\t\n\t /** @returns {String} the sorted, comma-separated tags from the model */\n\t tagsToCSV : function(){\n\t var tagsArray = this.model.get( 'tags' );\n\t if( !_.isArray( tagsArray ) || _.isEmpty( tagsArray ) ){\n\t return '';\n\t }\n\t return tagsArray.map( function( tag ){\n\t return _.escape( tag );\n\t }).sort().join( ',' );\n\t },\n\t\n\t /** @returns {jQuery} the input for this view */\n\t $input : function(){\n\t return this.$el.find( 'input.tags-input' );\n\t },\n\t\n\t /** @returns {String[]} all tags used by the current user */\n\t _getTagsUsed : function(){\n\t//TODO: global\n\t return Galaxy.user.get( 'tags_used' );\n\t },\n\t\n\t /** set up any event listeners on the view's DOM (mostly handled by select2) */\n\t _setUpBehaviors : function(){\n\t var view = this;\n\t this.$input().on( 'change', function( event ){\n\t // save the model's tags in either remove or added event\n\t view.model.save({ tags: event.val }, { silent: true });\n\t // if it's new, add the tag to the users tags\n\t if( event.added ){\n\t //??: solve weird behavior in FF on test.galaxyproject.org where\n\t // event.added.text is string object: 'String{ 0=\"o\", 1=\"n\", 2=\"e\" }'\n\t view._addNewTagToTagsUsed( event.added.text + '' );\n\t }\n\t });\n\t },\n\t\n\t /** add a new tag (if not already there) to the list of all tags used by the user\n\t * @param {String} newTag the tag to add to the list of used\n\t */\n\t _addNewTagToTagsUsed : function( newTag ){\n\t//TODO: global\n\t var tagsUsed = Galaxy.user.get( 'tags_used' );\n\t if( !_.contains( tagsUsed, newTag ) ){\n\t tagsUsed.push( newTag );\n\t tagsUsed.sort();\n\t Galaxy.user.set( 'tags_used', tagsUsed );\n\t }\n\t },\n\t\n\t /** shut down event listeners and remove this view's DOM */\n\t remove : function(){\n\t this.$input.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(){ return [ 'TagsEditor(', this.model + '', ')' ].join(''); }\n\t});\n\t\n\t// =============================================================================\n\treturn {\n\t TagsEditor : TagsEditor\n\t};\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2)))\n\n/***/ },\n/* 78 */\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__ = [\n\t __webpack_require__(5)\n\t], __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\tError modals meant to replace the o-so-easy alerts.\n\t\n\tThese are currently styled as errormessages but use the Galaxy.modal\n\tinfrastructure to be shown/closed. They're capable of showing details in a\n\ttogglable dropdown and the details are formatted in a pre.\n\t\n\tExample:\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\tThere 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\tExamples:\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\tvar CONTACT_MSG = _l( 'Please contact a Galaxy administrator if the problem persists.' );\n\tvar DEFAULT_AJAX_ERR_MSG = _l( 'An error occurred while updating information with the server.' );\n\tvar 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\tfunction _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(){ Galaxy.modal.hide(); } },\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' )\n\t .hide().appendTo( Galaxy.modal.$( '.modal-content' ) )\n\t .append([\n\t $( '

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

                        ' ).text( JSON.stringify( details, null, '  ' ) )\n\t            ]);\n\t\n\t        $( '' )\n\t            .appendTo( Galaxy.modal.$( '.buttons' ) )\n\t            .click( function(){ Galaxy.modal.$( '.error-details' ).toggle(); });\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\tfunction errorModal( message, title, details ){\n\t    if( !message ){ return; }\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// ----------------------------------------------------------------------------\n\t/** display a modal when the user may be offline */\n\tfunction offlineErrorModal(){\n\t    return errorModal(\n\t        _l( 'You appear to be offline. Please check your connection and try again.' ),\n\t        _l( 'Offline?' )\n\t    );\n\t}\n\t\n\t\n\t// ----------------------------------------------------------------------------\n\t/** 502 messages that should be displayed when galaxy is restarting */\n\tfunction badGatewayErrorModal(){\n\t    return errorModal(\n\t        _l( 'Galaxy is currently unreachable. Please try again in a few minutes.' ) + ' ' + CONTACT_MSG,\n\t        _l( 'Cannot connect to Galaxy' )\n\t    );\n\t}\n\t\n\t\n\t// ----------------------------------------------------------------------------\n\t/** display a modal (with details) about a failed Backbone ajax operation */\n\tfunction 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\tfunction _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//=============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 79 */\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__ = [\n\t    //jquery\n\t    //backbone\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function(){\n\t// =============================================================================\n\t/**\n\t * view for a popup menu\n\t */\n\tvar PopupMenu = Backbone.View.extend({\n\t//TODO: maybe better as singleton off the Galaxy obj\n\t    /** Cache the desired button element and options, set up the button click handler\n\t     *  NOTE: attaches this view as HTML/jQ data on the button for later use.\n\t     */\n\t    initialize: function( $button, options ){\n\t        // default settings\n\t        this.$button = $button;\n\t        if( !this.$button.length ){\n\t            this.$button = $( '
                        ' );\n\t }\n\t this.options = options || [];\n\t this.$button.data( 'popupmenu', this );\n\t\n\t // set up button click -> open menu behavior\n\t var menu = this;\n\t this.$button.click( function( event ){\n\t // if there's already a menu open, remove it\n\t $( '.popmenu-wrapper' ).remove();\n\t menu._renderAndShow( event );\n\t return false;\n\t });\n\t },\n\t\n\t // render the menu, append to the page body at the click position, and set up the 'click-away' handlers, show\n\t _renderAndShow: function( clickEvent ){\n\t this.render();\n\t this.$el.appendTo( 'body' ).css( this._getShownPosition( clickEvent )).show();\n\t this._setUpCloseBehavior();\n\t },\n\t\n\t // render the menu\n\t // this menu doesn't attach itself to the DOM ( see _renderAndShow )\n\t render: function(){\n\t // render the menu body absolute and hidden, fill with template\n\t this.$el.addClass( 'popmenu-wrapper' ).hide()\n\t .css({ position : 'absolute' })\n\t .html( this.template( this.$button.attr( 'id' ), this.options ));\n\t\n\t // set up behavior on each link/anchor elem\n\t if( this.options.length ){\n\t var menu = this;\n\t //precondition: there should be one option per li\n\t this.$el.find( 'li' ).each( function( i, li ){\n\t var option = menu.options[i];\n\t\n\t // if the option has 'func', call that function when the anchor is clicked\n\t if( option.func ){\n\t $( this ).children( 'a.popupmenu-option' ).click( function( event ){\n\t option.func.call( menu, event, option );\n\t // We must preventDefault otherwise clicking \"cancel\"\n\t // on a purge or something still navigates and causes\n\t // the action.\n\t event.preventDefault();\n\t // bubble up so that an option click will call the close behavior\n\t });\n\t }\n\t });\n\t }\n\t return this;\n\t },\n\t\n\t template : function( id, options ){\n\t return [\n\t '
                          ', this._templateOptions( options ), '
                        '\n\t ].join( '' );\n\t },\n\t\n\t _templateOptions : function( options ){\n\t if( !options.length ){\n\t return '
                      • (no options)
                      • ';\n\t }\n\t return _.map( options, function( option ){\n\t if( option.divider ){\n\t return '
                      • ';\n\t } else if( option.header ){\n\t return [ '
                      • ', option.html, '
                      • ' ].join( '' );\n\t }\n\t var href = option.href || 'javascript:void(0);',\n\t target = ( option.target )?( ' target=\"' + option.target + '\"' ):( '' ),\n\t check = ( option.checked )?( '' ):( '' );\n\t return [\n\t '
                      • ',\n\t check, option.html,\n\t '
                      • '\n\t ].join( '' );\n\t }).join( '' );\n\t },\n\t\n\t // get the absolute position/offset for the menu\n\t _getShownPosition : function( clickEvent ){\n\t\n\t // display menu horiz. centered on click...\n\t var menuWidth = this.$el.width();\n\t var x = clickEvent.pageX - menuWidth / 2 ;\n\t\n\t // adjust to handle horiz. scroll and window dimensions ( draw entirely on visible screen area )\n\t x = Math.min( x, $( document ).scrollLeft() + $( window ).width() - menuWidth - 5 );\n\t x = Math.max( x, $( document ).scrollLeft() + 5 );\n\t return {\n\t top: clickEvent.pageY,\n\t left: x\n\t };\n\t },\n\t\n\t // bind an event handler to all available frames so that when anything is clicked\n\t // the menu is removed from the DOM and the event handler unbinds itself\n\t _setUpCloseBehavior: function(){\n\t var menu = this;\n\t//TODO: alternately: focus hack, blocking overlay, jquery.blockui\n\t\n\t // function to close popup and unbind itself\n\t function closePopup( event ){\n\t $( document ).off( 'click.close_popup' );\n\t if( window && window.parent !== window ){\n\t try {\n\t $( window.parent.document ).off( \"click.close_popup\" );\n\t } catch( err ){}\n\t } else {\n\t try {\n\t $( 'iframe#galaxy_main' ).contents().off( \"click.close_popup\" );\n\t } catch( err ){}\n\t }\n\t menu.remove();\n\t }\n\t\n\t $( 'html' ).one( \"click.close_popup\", closePopup );\n\t if( window && window.parent !== window ){\n\t try {\n\t $( window.parent.document ).find( 'html' ).one( \"click.close_popup\", closePopup );\n\t } catch( err ){}\n\t } else {\n\t try {\n\t $( 'iframe#galaxy_main' ).contents().one( \"click.close_popup\", closePopup );\n\t } catch( err ){}\n\t }\n\t },\n\t\n\t // add a menu option/item at the given index\n\t addItem: function( item, index ){\n\t // append to end if no index\n\t index = ( index >= 0 ) ? index : this.options.length;\n\t this.options.splice( index, 0, item );\n\t return this;\n\t },\n\t\n\t // remove a menu option/item at the given index\n\t removeItem: function( index ){\n\t if( index >=0 ){\n\t this.options.splice( index, 1 );\n\t }\n\t return this;\n\t },\n\t\n\t // search for a menu option by its html\n\t findIndexByHtml: function( html ){\n\t for( var i = 0; i < this.options.length; i++ ){\n\t if( _.has( this.options[i], 'html' ) && ( this.options[i].html === html )){\n\t return i;\n\t }\n\t }\n\t return null;\n\t },\n\t\n\t // search for a menu option by its html\n\t findItemByHtml: function( html ){\n\t return this.options[( this.findIndexByHtml( html ))];\n\t },\n\t\n\t // string representation\n\t toString: function(){\n\t return 'PopupMenu';\n\t }\n\t});\n\t/** shortcut to new for when you don't need to preserve the ref */\n\tPopupMenu.create = function _create( $button, options ){\n\t return new PopupMenu( $button, options );\n\t};\n\t\n\t// -----------------------------------------------------------------------------\n\t// the following class functions are bridges from the original make_popupmenu and make_popup_menus\n\t// to the newer backbone.js PopupMenu\n\t\n\t/** Create a PopupMenu from simple map initial_options activated by clicking button_element.\n\t * Converts initial_options to object array used by PopupMenu.\n\t * @param {jQuery|DOMElement} button_element element which, when clicked, activates menu\n\t * @param {Object} initial_options map of key -> values, where\n\t * key is option text, value is fn to call when option is clicked\n\t * @returns {PopupMenu} the PopupMenu created\n\t */\n\tPopupMenu.make_popupmenu = function( button_element, initial_options ){\n\t var convertedOptions = [];\n\t _.each( initial_options, function( optionVal, optionKey ){\n\t var newOption = { html: optionKey };\n\t\n\t // keys with null values indicate: header\n\t if( optionVal === null ){ // !optionVal? (null only?)\n\t newOption.header = true;\n\t\n\t // keys with function values indicate: a menu option\n\t } else if( jQuery.type( optionVal ) === 'function' ){\n\t newOption.func = optionVal;\n\t }\n\t //TODO:?? any other special optionVals?\n\t // there was no divider option originally\n\t convertedOptions.push( newOption );\n\t });\n\t return new PopupMenu( $( button_element ), convertedOptions );\n\t};\n\t\n\t/** Find all anchors in $parent (using selector) and covert anchors into a PopupMenu options map.\n\t * @param {jQuery} $parent the element that contains the links to convert to options\n\t * @param {String} selector jq selector string to find links\n\t * @returns {Object[]} the options array to initialize a PopupMenu\n\t */\n\t//TODO: lose parent and selector, pass in array of links, use map to return options\n\tPopupMenu.convertLinksToOptions = function( $parent, selector ){\n\t $parent = $( $parent );\n\t selector = selector || 'a';\n\t var options = [];\n\t $parent.find( selector ).each( function( elem, i ){\n\t var option = {}, $link = $( elem );\n\t\n\t // convert link text to the option text (html) and the href into the option func\n\t option.html = $link.text();\n\t if( $link.attr( 'href' ) ){\n\t var linkHref = $link.attr( 'href' ),\n\t linkTarget = $link.attr( 'target' ),\n\t confirmText = $link.attr( 'confirm' );\n\t\n\t option.func = function(){\n\t // if there's a \"confirm\" attribute, throw up a confirmation dialog, and\n\t // if the user cancels - do nothing\n\t if( ( confirmText ) && ( !confirm( confirmText ) ) ){ return; }\n\t\n\t // if there's no confirm attribute, or the user accepted the confirm dialog:\n\t switch( linkTarget ){\n\t // relocate the center panel\n\t case '_parent':\n\t window.parent.location = linkHref;\n\t break;\n\t\n\t // relocate the entire window\n\t case '_top':\n\t window.top.location = linkHref;\n\t break;\n\t\n\t // relocate this panel\n\t default:\n\t window.location = linkHref;\n\t }\n\t };\n\t }\n\t options.push( option );\n\t });\n\t return options;\n\t};\n\t\n\t/** Create a single popupmenu from existing DOM button and anchor elements\n\t * @param {jQuery} $buttonElement the element that when clicked will open the menu\n\t * @param {jQuery} $menuElement the element that contains the anchors to convert into a menu\n\t * @param {String} menuElementLinkSelector jq selector string used to find anchors to be made into menu options\n\t * @returns {PopupMenu} the PopupMenu (Backbone View) that can render, control the menu\n\t */\n\tPopupMenu.fromExistingDom = function( $buttonElement, $menuElement, menuElementLinkSelector ){\n\t $buttonElement = $( $buttonElement );\n\t $menuElement = $( $menuElement );\n\t var options = PopupMenu.convertLinksToOptions( $menuElement, menuElementLinkSelector );\n\t // we're done with the menu (having converted it to an options map)\n\t $menuElement.remove();\n\t return new PopupMenu( $buttonElement, options );\n\t};\n\t\n\t/** Create all popupmenus within a document or a more specific element\n\t * @param {DOMElement} parent the DOM element in which to search for popupmenus to build (defaults to document)\n\t * @param {String} menuSelector jq selector string to find popupmenu menu elements (defaults to \"div[popupmenu]\")\n\t * @param {Function} buttonSelectorBuildFn the function to build the jq button selector.\n\t * Will be passed $menuElement, parent.\n\t * (Defaults to return '#' + $menuElement.attr( 'popupmenu' ); )\n\t * @returns {PopupMenu[]} array of popupmenus created\n\t */\n\tPopupMenu.make_popup_menus = function( parent, menuSelector, buttonSelectorBuildFn ){\n\t parent = parent || document;\n\t // orig. Glx popupmenu menus have a (non-std) attribute 'popupmenu'\n\t // which contains the id of the button that activates the menu\n\t menuSelector = menuSelector || 'div[popupmenu]';\n\t // default to (orig. Glx) matching button to menu by using the popupmenu attr of the menu as the id of the button\n\t buttonSelectorBuildFn = buttonSelectorBuildFn || function( $menuElement, parent ){\n\t return '#' + $menuElement.attr( 'popupmenu' );\n\t };\n\t\n\t // aggregate and return all PopupMenus\n\t var popupMenusCreated = [];\n\t $( parent ).find( menuSelector ).each( function(){\n\t var $menuElement = $( this ),\n\t $buttonElement = $( parent ).find( buttonSelectorBuildFn( $menuElement, parent ) );\n\t popupMenusCreated.push( PopupMenu.fromDom( $buttonElement, $menuElement ) );\n\t $buttonElement.addClass( 'popup' );\n\t });\n\t return popupMenusCreated;\n\t};\n\t\n\t\n\t// =============================================================================\n\t return PopupMenu;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 80 */\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 ) { self._fill( ftp_files ) },\n\t error : function() { self._fill(); }\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 ( 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 ( 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() { self.options.onchange( ftp_file ) } );\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 '' +\n\t '
                        ' +\n\t '' + options.path + '' +\n\t '' + Utils.bytesToString( options.size ) + '' +\n\t '' + options.ctime + '' +\n\t '';\n\t },\n\t\n\t /** Template of table */\n\t _templateTable: function() {\n\t return 'Available files: ' +\n\t '' +\n\t '' +\n\t '  ' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '' +\n\t '
                        NameSizeCreated
                        ';\n\t },\n\t\n\t /** Template of info message */\n\t _templateInfo: function() {\n\t return '
                        ' +\n\t 'Your FTP directory does not contain any files.' +\n\t '
                        ';\n\t },\n\t\n\t /** Template of main view */\n\t _template: function() {\n\t return '
                        ' +\n\t '
                        ' +\n\t '
                        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 }\n\t });\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(1)))\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(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' )\n\t .addClass( self.model.get( parameter.id ) && self.options.class_check || self.options.class_uncheck )\n\t .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 wrapper.append($el);\n this.row.append(wrapper);\n },\n \n // header\n appendHeader: function() {\n // append header row\n this.$thead.append(this.row);\n\n // row\n this.row = $('');\n },\n \n // add row cell\n add: function($el, width, align) {\n var wrapper = $('');\n if (width) {\n wrapper.css('width', width);\n }\n if (align) {\n wrapper.css('text-align', align);\n }\n wrapper.append($el);\n this.row.append(wrapper);\n },\n \n // append\n append: function(id, fade) {\n this._commit(id, fade, false);\n },\n \n // prepend\n prepend: function(id, fade) {\n this._commit(id, fade, true);\n },\n \n // get element\n get: function(id) {\n return this.$el.find('#' + id);\n },\n \n // delete\n del: function(id) {\n var item = this.$tbody.find('#' + id);\n if (item.length > 0) {\n item.remove();\n this.row_count--;\n this._refresh();\n }\n },\n\n // delete all\n delAll: function() {\n this.$tbody.empty();\n this.row_count = 0;\n this._refresh();\n },\n \n // value\n value: function(new_value) {\n // get current id/value\n this.before = this.$tbody.find('.current').attr('id');\n \n // check if new_value is defined\n if (new_value !== undefined) {\n this.$tbody.find('tr').removeClass('current');\n if (new_value) {\n this.$tbody.find('#' + new_value).addClass('current');\n }\n }\n \n // get current id/value\n var after = this.$tbody.find('.current').attr('id');\n if(after === undefined) {\n return null;\n } else {\n // fire onchange\n if (after != this.before && this.options.onchange) {\n this.options.onchange(new_value);\n }\n \n // return current value\n return after;\n }\n },\n \n // size\n size: function() {\n return this.$tbody.find('tr').length;\n },\n \n // commit\n _commit: function(id, fade, prepend) {\n // remove previous item with same id\n this.del(id);\n \n // add\n this.row.attr('id', id);\n \n // add row\n if (prepend) {\n this.$tbody.prepend(this.row);\n } else {\n this.$tbody.append(this.row);\n }\n \n // fade mode\n if (fade) {\n this.row.hide();\n this.row.fadeIn();\n }\n \n // row\n this.row = this._row();\n \n // row count\n this.row_count++;\n this._refresh();\n },\n \n // create new row\n _row: function() {\n return $('');\n },\n \n // onclick\n _onclick: function(e) {\n // get values\n var old_value = this.value();\n var new_value = $(e.target).closest('tr').attr('id');\n if (new_value != ''){\n // check equality\n if (new_value && old_value != new_value) {\n if (this.options.onconfirm) {\n this.options.onconfirm(new_value);\n } else {\n this.value(new_value);\n }\n }\n }\n },\n\n // ondblclick\n _ondblclick: function(e) {\n var value = this.value();\n if (value && this.options.ondblclick) {\n this.options.ondblclick(value);\n }\n },\n \n // refresh\n _refresh: function() {\n if (this.row_count == 0) {\n this.$tmessage.show();\n } else {\n this.$tmessage.hide();\n }\n },\n \n // load html template\n _template: function(options) {\n return '
                        ' +\n '
                        ' ).append( $checkbox ) )\n\t .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__(3), __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 82 */,\n/* 83 */,\n/* 84 */\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\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 ){ return this; }\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 })\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 85 */\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\n\t}(function () {\n\t var _l = window._l || function( s ){ return s; };\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\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 )\n\t || ( options.minSearchLen && searchTerms.length >= options.minSearchLen ) ){\n\t search.call( this, event, searchTerms );\n\t }\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('') )\n\t .tooltip({ placement: 'bottom' })\n\t .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('') )\n\t .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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 86 */,\n/* 87 */\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\tfunction 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 ) { return -1; }\n\t else if ( xD > yD ) { return 1; }\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) { return -1; }\n\t else if (oFxNcL > oFyNcL) { return 1; }\n\t }\n\t return 0;\n\t}\n\t\n\treturn naturalSort;\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n\n\n/***/ },\n/* 88 */\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 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 if (xhr.responseText) {\n\t try {\n\t response = jQuery.parseJSON(xhr.responseText);\n\t } catch (e) {\n\t response = xhr.responseText;\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 + ')');\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) { alert(m); },\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) { add(files); },\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) { opts.success(index, message); process();},\n\t error : function(message) { opts.error(index, message); process();},\n\t progress : function(percentage) { opts.progress(index, percentage); }\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\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 89 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(_) {var RightPanel = __webpack_require__( 10 ).RightPanel,\n\t Ui = __webpack_require__( 7 ),\n\t historyOptionsMenu = __webpack_require__( 116 );\n\t CurrentHistoryView = __webpack_require__( 113 ).CurrentHistoryView,\n\t _l = __webpack_require__( 5 );\n\t\n\t/** the right hand panel in the analysis page that shows the current history */\n\tvar HistoryPanel = RightPanel.extend({\n\t\n\t title : _l( 'History' ),\n\t\n\t initialize : function( options ){\n\t RightPanel.prototype.initialize.call( this, options );\n\t this.options = _.pick( options, 'userIsAnonymous', 'allow_user_dataset_purge', 'galaxyRoot' );\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 : options.allow_user_dataset_purge,\n\t linkTarget : 'galaxy_main'\n\t });\n\t },\n\t\n\t /** override to change footer selector */\n\t $toggleButton : function(){\n\t return this.$( '.footer > .panel-collapse' );\n\t },\n\t\n\t render : function(){\n\t RightPanel.prototype.render.call( this );\n\t this.optionsMenu = historyOptionsMenu( this.$( '#history-options-button' ), {\n\t anonymous : this.options.userIsAnonymous,\n\t purgeAllowed : this.options.allow_user_dataset_purge,\n\t root : this.options.galaxyRoot\n\t });\n\t this.$( '> .header .buttons [title]' ).tooltip({ placement: 'bottom' });\n\t this.historyView.setElement( this.$( '.history-panel' ) );\n\t this.$el.attr( 'class', 'history-right-panel' );\n\t },\n\t\n\t /** override to add buttons */\n\t _templateHeader: function( data ){\n\t var historyUrl = this.options.galaxyRoot + 'history';\n\t var multiUrl = this.options.galaxyRoot + 'history/view_multiple';\n\t return [\n\t '
                        ',\n\t '
                        ',\n\t // this button re-fetches the history and contents and re-renders the history panel\n\t '',\n\t // opens a drop down menu with history related functions (like view all, delete, share, etc.)\n\t '',\n\t !this.options.userIsAnonymous?\n\t [ '' ].join('') : '',\n\t '
                        ',\n\t '
                        ', _.escape( this.title ), '
                        ',\n\t '
                        ',\n\t ].join('');\n\t },\n\t\n\t /** add history view div */\n\t _templateBody : function( data ){\n\t return [\n\t '
                        ',\n\t ].join('');\n\t },\n\t\n\t /** override to use simplified selector */\n\t _templateFooter: function( data ){\n\t return [\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t ].join('');\n\t },\n\t\n\t events : {\n\t 'click #history-refresh-button' : '_clickRefresh',\n\t // override to change footer selector\n\t 'mousedown .footer > .drag' : '_mousedownDragHandler',\n\t 'click .footer > .panel-collapse' : 'toggle'\n\t },\n\t\n\t _clickRefresh : function( ev ){\n\t ev.preventDefault();\n\t this.historyView.loadCurrentHistory();\n\t },\n\t\n\t toString : function(){ return 'HistoryPanel'; }\n\t});\n\t\n\tmodule.exports = HistoryPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 90 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function($, _) {var LeftPanel = __webpack_require__( 10 ).LeftPanel,\n\t Tools = __webpack_require__( 44 ),\n\t Upload = __webpack_require__( 123 ),\n\t _l = __webpack_require__( 5 );\n\t\n\t/* Builds the tool menu panel on the left of the analysis page */\n\tvar ToolPanel = LeftPanel.extend({\n\t\n\t title : _l( 'Tools' ),\n\t\n\t initialize: function( options ){\n\t LeftPanel.prototype.initialize.call( this, options );\n\t this.log( this + '.initialize:', options );\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 = options.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 search_url : options.search_url,\n\t hidden : false\n\t });\n\t var tools = new Tools.ToolCollection( options.toolbox );\n\t this.tool_panel = new Tools.ToolPanel({\n\t tool_search : tool_search,\n\t tools : tools,\n\t layout : options.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.uploadButton = new Upload({\n\t nginx_upload_path : options.nginx_upload_path,\n\t ftp_upload_site : options.ftp_upload_site,\n\t default_genome : options.default_genome,\n\t default_extension : options.default_extension,\n\t });\n\t },\n\t\n\t render : function(){\n\t var self = this;\n\t LeftPanel.prototype.render.call( self );\n\t self.$( '.panel-header-buttons' ).append( self.uploadButton.$el );\n\t\n\t // if there are tools, render panel and display everything\n\t if (self.tool_panel.get( 'layout' ).size() > 0) {\n\t self.tool_panel_view.render();\n\t //TODO: why the hide/show?\n\t self.$( '.toolMenu' ).show();\n\t }\n\t self.$( '.toolMenuContainer' ).prepend( self.tool_panel_view.$el );\n\t\n\t self._renderWorkflowMenu();\n\t\n\t // if a tool link has the minsizehint attribute, handle it here (gen. by hiding the tool panel)\n\t self.$( 'a[minsizehint]' ).click( function() {\n\t if ( parent.handle_minwidth_hint ) {\n\t parent.handle_minwidth_hint( $( self ).attr( 'minsizehint' ) );\n\t }\n\t });\n\t },\n\t\n\t /** build the dom for the workflow portion of the tool menu */\n\t _renderWorkflowMenu : function(){\n\t var self = this;\n\t // add internal workflow list\n\t self.$( '#internal-workflows' ).append( self._templateTool({\n\t title : _l( 'All workflows' ),\n\t href : 'workflow/list_for_run'\n\t }));\n\t _.each( self.stored_workflow_menu_entries, function( menu_entry ){\n\t self.$( '#internal-workflows' ).append( self._templateTool({\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 [\n\t '
                        ',\n\t // global\n\t '', tool.title, '',\n\t '
                        '\n\t ].join('');\n\t },\n\t\n\t /** override to include inital menu dom and workflow section */\n\t _templateBody : function(){\n\t return [\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '', _l( 'Search did not match any tools.' ), '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '', _l( 'Workflows' ), '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ].join('');\n\t },\n\t\n\t toString : function(){ return 'ToolPanel'; }\n\t});\n\t\n\tmodule.exports = ToolPanel;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 91 */,\n/* 92 */,\n/* 93 */,\n/* 94 */,\n/* 95 */,\n/* 96 */,\n/* 97 */,\n/* 98 */,\n/* 99 */,\n/* 100 */,\n/* 101 */,\n/* 102 */,\n/* 103 */,\n/* 104 */,\n/* 105 */,\n/* 106 */\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__ = [\n\t __webpack_require__(29),\n\t __webpack_require__(69),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DC_LI, DATASET_LI_EDIT, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t//==============================================================================\n\tvar DCListItemView = DC_LI.DCListItemView;\n\t/** @class Edit view for DatasetCollection.\n\t */\n\tvar 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//==============================================================================\n\tvar DCEListItemView = DC_LI.DCEListItemView;\n\t/** @class Read only view for DatasetCollectionElement.\n\t */\n\tvar 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//==============================================================================\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\tvar 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\tDatasetDCEListItemEdit.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//==============================================================================\n\t/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection\n\t * (a nested DC).\n\t */\n\tvar 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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 107 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(68),\n\t __webpack_require__(30),\n\t __webpack_require__(106),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(15),\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t/* =============================================================================\n\tTODO:\n\t\n\t============================================================================= */\n\t/** @class editable View/Controller for a dataset collection.\n\t */\n\tvar _super = DC_VIEW.CollectionView;\n\tvar 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 ){ return; }\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 //TODO: extract\n\t var panel = this,\n\t nameSelector = '> .controls .name';\n\t $where.find( nameSelector )\n\t .attr( 'title', _l( 'Click to rename collection' ) )\n\t .tooltip({ placement: 'bottom' })\n\t .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 })\n\t .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 // ........................................................................ 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// =============================================================================\n\t/** @class non-editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class Editable, read-only View/Controller for a dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class Editable (roughly since these collections are immutable),\n\t * View/Controller for a dataset collection.\n\t */\n\tvar 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// =============================================================================\n\t/** @class editable, View/Controller for a list of pairs dataset collection. */\n\tvar 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// =============================================================================\n\t/** @class View/Controller for a list of lists dataset collection. */\n\tvar 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//==============================================================================\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/***/ },\n/* 108 */\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__ = [\n\t __webpack_require__(131),\n\t __webpack_require__(87),\n\t __webpack_require__(31),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(84)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( levenshteinDistance, naturalSort, LIST_COLLECTION_CREATOR, baseMVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'collections';\n\t/* ============================================================================\n\tTODO:\n\t\n\t\n\tPROGRAMMATICALLY:\n\tcurrPanel.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\tvar 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([\n\t '<%- pair.forward.name %>',\n\t '',\n\t '<%- pair.name %>',\n\t '',\n\t '<%- pair.reverse.name %>'\n\t ].join('')),\n\t\n\t render : function(){\n\t this.$el\n\t .attr( 'draggable', true )\n\t .data( 'pair', this.pair )\n\t .html( this.template({ pair: this.pair }) )\n\t .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 ){ ev = ev.originalEvent; }\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// ============================================================================\n\t/** returns an autopair function that uses the provided options.match function */\n\tfunction 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 ){ params.listB.splice( aInBIndex, 1 ); }\n\t if( bInAIndex !== -1 ){ params.listA.splice( bInAIndex, 1 ); }\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 = [\n\t new RegExp( this.filters[0] ),\n\t new RegExp( this.filters[1] )\n\t ];\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, 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= 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// ============================================================================\n\t/** An interface for building collections of paired datasets.\n\t */\n\tvar PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).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._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 ){ return naturalSort( a.name, b.name ); });\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 ){ return low; }\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 ){ mid++; }\n\t return mid;\n\t\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(){ return 1.0; },\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(){ return this.matchPercentage; },\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(){ return this.matchPercentage; },\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, 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 ){ return s1; }\n\t if( i === s2.length ){ return s2; }\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(\n\t fwdName.replace( new RegExp( this.filters[0] ), '' ),\n\t revName.replace( new RegExp( this.filters[1] ), '' )\n\t );\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 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 })\n\t .always( function(){\n\t creator.blocking = false;\n\t })\n\t .fail( function( xhr, status, message ){\n\t creator._ajaxErrHandler( xhr, status, message );\n\t })\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.' )\n\t + _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( PairedCollectionCreator.templates.main() );\n\t this.$el.empty().html( PairedCollectionCreator.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( PairedCollectionCreator.templates.header() )\n\t .find( '.help-content' ).prepend( $( PairedCollectionCreator.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] )\n\t .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( PairedCollectionCreator.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, $rev, $prd = [],\n\t split = this._splitByFilters();\n\t // update unpaired counts\n\t this.$( '.forward-column .title' )\n\t .text([ split[0].length, _l( 'unpaired forward' ) ].join( ' ' ));\n\t this.$( '.forward-column .unpaired-info' )\n\t .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[0].length ) );\n\t this.$( '.reverse-column .title' )\n\t .text([ split[1].length, _l( 'unpaired reverse' ) ].join( ' ' ));\n\t this.$( '.reverse-column .unpaired-info' )\n\t .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 )\n\t && ( 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 )\n\t .add( this.$( '.unpaired-columns .paired-column .column-datasets' ).append( $prd ) )\n\t .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 $( '
                      • ')\n\t .attr( 'id', 'dataset-' + dataset.id )\n\t .addClass( 'dataset unpaired' )\n\t .attr( 'draggable', true )\n\t .addClass( dataset.selected? 'selected': '' )\n\t .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' )\n\t .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 = $( '
                        ' )\n\t .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 = $( '
                        ' )\n\t .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 ){ return; }\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' )\n\t .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' )\n\t .append( pairView.render().$el )\n\t .append([\n\t ''\n\t ].join( '' ));\n\t });\n\t },\n\t /** a message to display when none paired */\n\t _renderPairedEmpty : function(){\n\t var $msg = $( '
                        ' )\n\t .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 /** render the footer, completion controls, and cancel controls */\n\t _renderFooter : function( speed, callback ){\n\t var $footer = this.$( '.footer' ).empty().html( PairedCollectionCreator.templates.footer() );\n\t this.$( '.remove-extensions' ).prop( 'checked', this.removeExtensions );\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 /** 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 [\n\t ''\n\t ].join('');\n\t }\n\t var $popoverContent = $( _.template([\n\t '
                        ',\n\t '
                        ',\n\t _l( 'Choose from the following filters to change which unpaired reads are shown in the display' ),\n\t ':
                        ',\n\t _.values( this.commonFilters ).map( function( filterSet ){\n\t return filterChoice( filterSet[0], filterSet[1] );\n\t }).join( '' ),\n\t '
                        '\n\t ].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 = [\n\t this.$( '.forward-unpaired-filter input' ).val(),\n\t this.$( '.reverse-unpaired-filter input' ).val()\n\t ];\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, 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([\n\t 'Could not automatically create any pairs from the given dataset names.',\n\t 'You may want to choose or enter different filters and try auto-pairing again.',\n\t 'Close this message using the X on the right to view more help.'\n\t ].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 .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 ){ this.trigger( 'filter-change' ); },\n\t 'focus .forward-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\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 ){ this.trigger( 'filter-change' ); },\n\t 'focus .reverse-unpaired-filter input' : function( ev ){ $( ev.currentTarget ).select(); },\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 ){ this.toggleExtensions(); },\n\t 'change .collection-name' : '_changeName',\n\t 'keydown .collection-name' : '_nameCheckForEnter',\n\t 'click .cancel-create' : function( ev ){\n\t if( typeof this.oncancel === 'function' ){\n\t this.oncancel.call( this );\n\t }\n\t },\n\t 'click .create-collection' : '_clickCreate'//,\n\t },\n\t\n\t // ........................................................................ header\n\t /** expand help */\n\t _clickMoreHelp : function( ev ){\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 this.$( '.main-help' ).removeClass( 'expanded' );\n\t this.$( '.more-help' ).show();\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()\n\t .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 /** 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 ){ return $dataset; }\n\t\n\t if( select ){\n\t $dataset.addClass( 'selected' );\n\t if( !options.waitToPair ){\n\t this.pairAllSelected();\n\t }\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\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\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 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\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 ){ return; }\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 /** 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 /** 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();\n\t }\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(){ return 'PairedCollectionCreator'; }\n\t});\n\t\n\t\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\tPairedCollectionCreator.templates = PairedCollectionCreator.templates || {\n\t\n\t /** the skeleton */\n\t main : _.template([\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ].join('')),\n\t\n\t /** the header (not including help text) */\n\t header : _.template([\n\t '
                        ',\n\t '', _l( 'More help' ), '',\n\t '
                        ',\n\t '', _l( 'Less' ), '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '',\n\t '
                        ',\n\t\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '', _l( 'Unpaired forward' ), '',\n\t '',\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '', _l( 'Unpaired reverse' ), '',\n\t '',\n\t '
                        ',\n\t '
                        ',\n\t '',\n\t '
                        ',\n\t '
                        ',\n\t '
                        ',\n\t '
                        '\n\t ].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 '
                        ',\n\t '
                        ',\n\t '
                          ',\n\t '
                          ',\n\t '
                          ',\n\t '
                            ',\n\t '
                            ',\n\t '
                            ',\n\t '
                              ',\n\t '
                              ',\n\t '
                              ',\n\t '
                              ',\n\t '
                              ',\n\t '
                              ',\n\t '
                              ',\n\t '',\n\t '
                              ',\n\t '',\n\t _l( 'Unpair all' ),\n\t '',\n\t '
                              ',\n\t '
                              ',\n\t '
                              ',\n\t '
                                ',\n\t '
                                '\n\t ].join('')),\n\t\n\t /** creation and cancel controls */\n\t footer : _.template([\n\t '
                                ',\n\t '
                                ',\n\t '',\n\t '
                                ',\n\t '
                                ',\n\t '',\n\t '
                                ', _l( 'Name' ), ':
                                ',\n\t '
                                ',\n\t '
                                ',\n\t\n\t '
                                ',\n\t '
                                ',\n\t '',\n\t '
                                ',\n\t '',\n\t '',\n\t '
                                ',\n\t '
                                ',\n\t\n\t '
                                ',\n\t '',\n\t '
                                ',\n\t '
                                '\n\t ].join('')),\n\t\n\t /** help content */\n\t helpContent : _.template([\n\t '

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

                                ',\n\t '

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

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

                                ',\n\t '

                                ', _l([\n\t '

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

                                ',\n\t '

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

                                ',\n\t '

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

                                ',\n\t '

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

                                '\n\t ].join(''))\n\t};\n\t\n\t\n\t//=============================================================================\n\t/** a modal version of the paired collection creator */\n\tvar 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//=============================================================================\n\tfunction createListOfPairsCollection( collection ){\n\t var elements = collection.toJSON();\n\t//TODO: validate elements\n\t return pairedCollectionCreatorModal( elements, {\n\t historyId : collection.historyId\n\t });\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 109 */\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__ = [\n\t __webpack_require__(31),\n\t __webpack_require__(39),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( LIST_CREATOR, HDCA, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\tvar logNamespace = 'collections';\n\t/*==============================================================================\n\tTODO:\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\tvar 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\n\t .attr( 'data-element-id', this.element.id )\n\t .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([\n\t '<%- identifier %>',\n\t '<%- element.name %>',\n\t ].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// ============================================================================\n\tvar _super = LIST_CREATOR.ListCollectionCreator;\n\t\n\t/** An interface for building collections.\n\t */\n\tvar 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 = [\n\t this.workingElements[1],\n\t this.workingElements[0],\n\t ];\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([\n\t '',\n\t '
                                ',\n\t '
                                '\n\t ].join('')),\n\t\n\t /** help content */\n\t helpContent : _.template([\n\t '

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

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

                                ',\n\t '

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

                                '\n\t ].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([\n\t '
                                ',\n\t '
                                ',\n\t '',\n\t '<% if( _.size( problems ) ){ %>',\n\t _l( 'The following selections could not be included due to problems' ),\n\t '
                                  <% _.each( problems, function( problem ){ %>',\n\t '
                                • <%- problem.element.name %>: <%- problem.text %>
                                • ',\n\t '<% }); %>
                                ',\n\t '<% } else if( _.size( elements ) === 0 ){ %>',\n\t _l( 'No datasets were selected' ), '.',\n\t '<% } else if( _.size( elements ) === 1 ){ %>',\n\t _l( 'Only one dataset was selected' ), ': <%- elements[0].name %>',\n\t '<% } else if( _.size( elements ) > 2 ){ %>',\n\t _l( 'Too many datasets were selected' ),\n\t ': <%- _.pluck( elements, \"name\" ).join( \", \") %>',\n\t '<% } %>',\n\t '
                                ',\n\t _l( 'Two (and only two) elements are needed for the pair' ), '. ',\n\t _l( 'You may need to ' ),\n\t '', _l( 'cancel' ), ' ',\n\t _l( 'and reselect new elements' ), '.',\n\t '
                                ',\n\t '
                                ',\n\t '
                                ',\n\t '
                                ',\n\t '
                                ',\n\t '
                                ',\n\t '',\n\t // _l( 'Create a different kind of collection' ),\n\t '
                                ',\n\t '
                                ',\n\t '
                                '\n\t ].join('')),\n\t }),\n\t\n\t // ------------------------------------------------------------------------ misc\n\t /** string rep */\n\t toString : function(){ return 'PairCollectionCreator'; }\n\t});\n\t\n\t\n\t//==============================================================================\n\t/** List collection flavor of collectionCreatorModal. */\n\tvar 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//==============================================================================\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\tfunction createPairCollection( contents ){\n\t var elements = contents.toJSON(),\n\t promise = pairCollectionCreatorModal( elements, {\n\t creationFn : function( elements, name ){\n\t elements = [\n\t { name: \"forward\", src: \"hda\", id: elements[0].id },\n\t { name: \"reverse\", src: \"hda\", id: elements[1].id }\n\t ];\n\t return contents.createHDCA( elements, 'paired', name );\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 110 */\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__ = [\n\t __webpack_require__(8),\n\t __webpack_require__(78),\n\t __webpack_require__(5)\n\t], __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\tvar 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 ' ) +\n\t _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 ){ %>',\n\t '
                                ',\n\t '<%- anonWarning %>',\n\t _l( 'You can' ),\n\t ' ', _l( 'login here' ), ' ', _l( 'or' ), ' ',\n\t ' ', _l( 'register here' ), '.',\n\t '
                                ',\n\t '<% } %>',\n\t '
                                ',\n\t '
                                ',\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 '\" />',\n\t '

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

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

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

                                ',\n\t // copy non-deleted is the default\n\t '/>',\n\t '',\n\t '
                                ',\n\t '/>',\n\t '',\n\t '<% } %>',\n\t '
                                '\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 // TODO: getting a little byzantine here\n\t defaultCopyNameFn = options.nameFn || this.defaultName,\n\t defaultCopyName = defaultCopyNameFn({ name: history.get( 'name' ) }),\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\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 )\n\t .done( function( response ){\n\t deferred.resolve( response );\n\t })\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 })\n\t .done( function(){\n\t if( autoClose ){ modal.hide(); }\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([\n\t [ _l( 'Cancel' ), function(){ modal.hide(); } ],\n\t [ this.submitLabel, checkNameAndCopy ]\n\t ]),\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\tvar 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 ' ) +\n\t _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\tvar 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?\n\t ImportDialog.dialog( modal, history, options ):\n\t CopyDialog.dialog( modal, history, options );\n\t};\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 111 */\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__ = [\n\t __webpack_require__(69),\n\t __webpack_require__(71),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( DATASET_LI_EDIT, HDA_LI, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _super = DATASET_LI_EDIT.DatasetListItemEdit;\n\t/** @class Editing view for HistoryDatasetAssociation.\n\t */\n\tvar 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 ){ this.model.unhide(); return false; }\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\n\t// ............................................................................ TEMPLATES\n\t/** underscore templates */\n\tHDAListItemEdit.prototype.templates = (function(){\n\t\n\t var warnings = _.extend( {}, _super.prototype.templates.warnings, {\n\t hidden : BASE_MVC.wrapTemplate([\n\t '<% if( !dataset.visible ){ %>',\n\t // add a link to unhide a dataset\n\t '
                                ',\n\t _l( 'This dataset has been hidden' ),\n\t '
                                ', _l( 'Unhide it' ), '',\n\t '
                                ',\n\t '<% } %>'\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2)))\n\n/***/ },\n/* 112 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t __webpack_require__(73),\n\t __webpack_require__(107),\n\t __webpack_require__(22),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( HDCA_LI, DC_VIEW_EDIT, faIconButton, _l ){\n\t\n\t'use strict';\n\t\n\t//==============================================================================\n\tvar _super = HDCA_LI.HDCAListItemView;\n\t/** @class Editing view for HistoryDatasetCollectionAssociation.\n\t */\n\tvar 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 )\n\t .concat([\n\t this._renderDeleteButton()\n\t ]);\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/***/ },\n/* 113 */\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__ = [\n\t __webpack_require__(75),\n\t __webpack_require__(114),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __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\tvar 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\tHistoryViewPrefs.storageKey = function storageKey(){\n\t return ( 'history-panel' );\n\t};\n\t\n\t/* =============================================================================\n\tTODO:\n\t\n\t============================================================================= */\n\tvar _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\tvar 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 : [\n\t _l( 'This history is empty' ), '. ',\n\t _l( 'You can ' ),\n\t '',\n\t _l( 'load your own data' ),\n\t '',\n\t _l( ' or ' ),\n\t '',\n\t _l( 'get data from an external source' ),\n\t ''\n\t ].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(){ this.model.checkForUpdates(); });\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' ) )\n\t && ( !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 )\n\t .off( 'scroll', this._debouncedScrollCaptureHandler )\n\t .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 ){ return $(); }\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',\n\t function( tagsEditor ){\n\t panel.preferences.set( 'tagsEditorShown', tagsEditor.hidden );\n\t }\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',\n\t function( annotationEditor ){\n\t panel.preferences.set( 'annotationEditorShown', annotationEditor.hidden );\n\t }\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 ){ return view; }\n\t if( this.panelStack.length ){ return this._collapseDrilldownPanel(); }\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 ){ Galaxy.upload.show( ev ); },\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 'galaxy_main: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 )?\n\t $( ev.currentTarget )\n\t :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' ) ){ $msg.slideDown( this.fxSpeed ); }\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' ) ){ $msg.slideUp( this.fxSpeed ); }\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(\n\t { visible: false, deleted: '', purged: '' },\n\t { visible : true }\n\t ).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 }\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\n\t//------------------------------------------------------------------------------ TEMPLATES\n\tCurrentHistoryView.prototype.templates = (function(){\n\t\n\t var quotaMsgTemplate = BASE_MVC.wrapTemplate([\n\t '
                                ',\n\t _l( 'You are over your disk quota' ), '. ',\n\t _l( 'Tool execution is on hold until your disk usage drops below your allocated quota' ), '.',\n\t '
                                '\n\t ], 'history' );\n\t return _.extend( _.clone( _super.prototype.templates ), {\n\t quotaMsg : quotaMsgTemplate\n\t });\n\t\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(1)))\n\n/***/ },\n/* 114 */\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__ = [\n\t __webpack_require__(115),\n\t __webpack_require__(40),\n\t __webpack_require__(12),\n\t __webpack_require__(72),\n\t __webpack_require__(111),\n\t __webpack_require__(112),\n\t __webpack_require__(77),\n\t __webpack_require__(66),\n\t __webpack_require__(31),\n\t __webpack_require__(109),\n\t __webpack_require__(108),\n\t __webpack_require__(22),\n\t __webpack_require__(79),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(15),\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function(\n\t HISTORY_VIEW,\n\t HISTORY_CONTENTS,\n\t STATES,\n\t HDA_MODEL,\n\t HDA_LI_EDIT,\n\t HDCA_LI_EDIT,\n\t TAGS,\n\t ANNOTATIONS,\n\t LIST_COLLECTION_CREATOR,\n\t PAIR_COLLECTION_CREATOR,\n\t LIST_OF_PAIRS_COLLECTION_CREATOR,\n\t faIconButton,\n\t PopupMenu,\n\t BASE_MVC,\n\t _l\n\t){\n\t\n\t'use strict';\n\t\n\t/* =============================================================================\n\tTODO:\n\t\n\t============================================================================= */\n\tvar _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\tvar 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 /** 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' )\n\t .html( '' + _l( 'loading...' ) + '' );\n\t },\n\t 'fetching-hidden' : function( collection ){\n\t this.$( '> .controls .hidden-count' )\n\t .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 ){ return $newRender; }\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 ){ this._renderCounts( $whereTo ); }\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(){ this.render(); },\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(){ this.render(); },\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 ){ return; }\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 || ( 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 )\n\t .attr( 'title', _l( 'Click to rename history' ) )\n\t .tooltip({ placement: 'bottom' })\n\t .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 })\n\t .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 = [\n\t { 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 },\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 },\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 },\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 ];\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 [\n\t { html: _l( 'Build Dataset List' ), func: function() {\n\t LIST_COLLECTION_CREATOR.createListCollection( panel.getSelectedModels() )\n\t .done( function(){ panel.model.refresh(); });\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 PAIR_COLLECTION_CREATOR.createPairCollection( panel.getSelectedModels() )\n\t .done( function(){ panel.model.refresh(); });\n\t }\n\t },\n\t { html: _l( 'Build List of Dataset Pairs' ), func: function() {\n\t LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection( panel.getSelectedModels() )\n\t .done( function(){ panel.model.refresh(); });\n\t }\n\t },\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 ){ this.toggleShowDeleted(); },\n\t 'click .toggle-hidden-link' : function( ev ){ this.toggleShowHidden(); }\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([\n\t '',\n\t _l( 'Searching ' ), stop, '/', this.model.contentsShown(),\n\t ''\n\t ].join(''));\n\t },\n\t\n\t /** override to display number found in subtitle */\n\t _renderSearchFindings : function(){\n\t this.$( '> .controls .subtitle' ).html([\n\t _l( 'Found' ), this.views.length\n\t ].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 ){ return this; }\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' )\n\t .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 ){ return this; }\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 )\n\t .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\tHistoryViewEdit.prototype.templates = (function(){\n\t\n\t var countsTemplate = BASE_MVC.wrapTemplate([\n\t '<% var shown = Math.max( view.views.length, history.contents_active.active ) %>',\n\t '<% if( shown ){ %>',\n\t '',\n\t '<%- shown %> ', _l( 'shown' ),\n\t '',\n\t '<% } %>',\n\t\n\t '<% if( history.contents_active.deleted ){ %>',\n\t '',\n\t '<% if( view.model.contents.includeDeleted ){ %>',\n\t '',\n\t _l( 'hide deleted' ),\n\t '',\n\t '<% } else { %>',\n\t '<%- history.contents_active.deleted %> ',\n\t '',\n\t _l( 'deleted' ),\n\t '',\n\t '<% } %>',\n\t '',\n\t '<% } %>',\n\t\n\t '<% if( history.contents_active.hidden ){ %>',\n\t '',\n\t '<% if( view.model.contents.includeHidden ){ %>',\n\t '',\n\t _l( 'hide hidden' ),\n\t '',\n\t '<% } else { %>',\n\t '<%- history.contents_active.hidden %> ',\n\t '',\n\t _l( 'hidden' ),\n\t '',\n\t '<% } %>',\n\t '',\n\t '<% } %>',\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 115 */\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__ = [\n\t __webpack_require__(76),\n\t __webpack_require__(75),\n\t __webpack_require__(40),\n\t __webpack_require__(41),\n\t __webpack_require__(71),\n\t __webpack_require__(73),\n\t __webpack_require__(82),\n\t __webpack_require__(78),\n\t __webpack_require__(22),\n\t __webpack_require__(6),\n\t __webpack_require__(5),\n\t __webpack_require__(85)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function(\n\t LIST_VIEW,\n\t HISTORY_MODEL,\n\t HISTORY_CONTENTS,\n\t HISTORY_PREFS,\n\t HDA_LI,\n\t HDCA_LI,\n\t USER,\n\t ERROR_MODAL,\n\t faIconButton,\n\t BASE_MVC,\n\t _l\n\t){\n\t'use strict';\n\t\n\t/* =============================================================================\n\tTODO:\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\tvar _super = LIST_VIEW.ModelListPanel;\n\tvar 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\n\t .fetchWithContents( options, contentsOptions )\n\t .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(){ this._toggleContentsLoadingIndicator( false ); },\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\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\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() )\n\t && ( contents.includeDeleted || !model.isDeletedOrPurged() )\n\t && ( _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\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.contents.fetchPrevPage();\n\t },\n\t\n\t _clickNextPage : function( ev ){\n\t this.model.contents.fetchNextPage();\n\t },\n\t\n\t _changePageSelect : function( ev ){\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 })\n\t .progress( function( response, limit, offset ){\n\t self.renderItems();\n\t self.trigger( 'search:loading-progress', limit, offset );\n\t })\n\t .always( function(){\n\t self.$el.find( inputSelector ).searchInput( 'toggle-loading' );\n\t })\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 })\n\t .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 )?\n\t $( ev.currentTarget )\n\t :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': return numStr + 'st';\n\t case '2': return numStr + 'nd';\n\t case '3': return numStr + 'rd';\n\t default : 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\n\t//------------------------------------------------------------------------------ TEMPLATES\n\tHistoryView.prototype.templates = (function(){\n\t\n\t var mainTemplate = BASE_MVC.wrapTemplate([\n\t // temp container\n\t '
                                ',\n\t '
                                ',\n\t '
                                  ',\n\t '
                                  ',\n\t '
                                  '\n\t ]);\n\t\n\t var controlsTemplate = BASE_MVC.wrapTemplate([\n\t '
                                  ',\n\t '
                                  ',\n\t '
                                  <%- history.name %>
                                  ',\n\t '
                                  ',\n\t '
                                  ',\n\t '
                                  <%- history.nice_size %>
                                  ',\n\t\n\t '
                                  ',\n\t\n\t '
                                  ',\n\t '<% if( history.deleted && history.purged ){ %>',\n\t '
                                  ',\n\t _l( 'This history has been purged and deleted' ),\n\t '
                                  ',\n\t '<% } else if( history.deleted ){ %>',\n\t '
                                  ',\n\t _l( 'This history has been deleted' ),\n\t '
                                  ',\n\t '<% } else if( history.purged ){ %>',\n\t '
                                  ',\n\t _l( 'This history has been purged' ),\n\t '
                                  ',\n\t '<% } %>',\n\t\n\t '<% if( history.message ){ %>',\n\t // should already be localized\n\t '
                                  messagesmall\">',\n\t '<%= history.message.text %>',\n\t '
                                  ',\n\t '<% } %>',\n\t '
                                  ',\n\t\n\t // add tags and annotations\n\t '
                                  ',\n\t '
                                  ',\n\t\n\t '
                                  ',\n\t '
                                  ',\n\t '
                                  ',\n\t\n\t '
                                  ',\n\t '
                                  ',\n\t '',\n\t '',\n\t '
                                  ',\n\t '
                                  ',\n\t '
                                  ',\n\t '
                                  ',\n\t '
                                  ',\n\t '
                                  '\n\t ], 'history' );\n\t\n\t var paginationTemplate = BASE_MVC.wrapTemplate([\n\t '',\n\t '',\n\t '',\n\t ], '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//==============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1)))\n\n/***/ },\n/* 116 */\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__ = [\n\t __webpack_require__(79),\n\t __webpack_require__(110),\n\t __webpack_require__(6),\n\t __webpack_require__(5)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( PopupMenu, historyCopyDialog, BASE_MVC, _l ){\n\t\n\t'use strict';\n\t\n\t// ============================================================================\n\tvar menu = [\n\t {\n\t html : _l( 'History Lists' ),\n\t header : true\n\t },\n\t {\n\t html : _l( 'Saved Histories' ),\n\t href : 'history/list',\n\t },\n\t {\n\t html : _l( 'Histories Shared with Me' ),\n\t href : 'history/list_shared'\n\t },\n\t\n\t {\n\t html : _l( 'History Actions' ),\n\t header : true,\n\t anon : true\n\t },\n\t {\n\t html : _l( 'Create New' ),\n\t func : function(){ Galaxy.currHistoryPanel.createNewHistory(); }\n\t },\n\t {\n\t html : _l( 'Copy History' ),\n\t func : function(){\n\t historyCopyDialog( Galaxy.currHistoryPanel.model )\n\t .done( function(){\n\t Galaxy.currHistoryPanel.loadCurrentHistory();\n\t });\n\t },\n\t },\n\t {\n\t html : _l( 'Share or Publish' ),\n\t href : 'history/sharing',\n\t },\n\t {\n\t html : _l( 'Show Structure' ),\n\t href : 'history/display_structured',\n\t anon : true,\n\t },\n\t {\n\t html : _l( 'Extract Workflow' ),\n\t href : 'workflow/build_from_current_history',\n\t },\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_main.window.location.href = 'history/delete?id=' + Galaxy.currHistoryPanel.model.id;\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\n\t && confirm( _l( 'Really delete the current history permanently? This cannot be undone.' ) ) ){\n\t galaxy_main.window.location.href = 'history/delete?purge=True&id=' + Galaxy.currHistoryPanel.model.id;\n\t }\n\t },\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 {\n\t html : _l( 'Copy Datasets' ),\n\t href : 'dataset/copy_datasets',\n\t },\n\t {\n\t html : _l( 'Dataset Security' ),\n\t href : 'root/history_set_default_permissions',\n\t },\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 {\n\t html : _l( 'Collapse Expanded Datasets' ),\n\t func : function(){ Galaxy.currHistoryPanel.collapseAll(); }\n\t },\n\t {\n\t html : _l( 'Unhide Hidden Datasets' ),\n\t anon : true,\n\t func : function(){ Galaxy.currHistoryPanel.unhideHidden(); }\n\t },\n\t {\n\t html : _l( 'Delete Hidden Datasets' ),\n\t anon : true,\n\t func : function(){ Galaxy.currHistoryPanel.deleteHidden(); }\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\n\t {\n\t html : _l( 'Downloads' ),\n\t header : true\n\t },\n\t {\n\t html : _l( 'Export Tool Citations' ),\n\t href : 'history/citations',\n\t anon : true,\n\t },\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\n\t {\n\t html : _l( 'Other Actions' ),\n\t header : true\n\t },\n\t {\n\t html : _l( 'Import from File' ),\n\t href : 'history/import_archive',\n\t }\n\t];\n\t\n\tfunction 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 = '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\tvar 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// ============================================================================\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\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ },\n/* 117 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {/**\n\t * Renders tabs e.g. used in the Charts editor, behaves similar to repeat and section rendering\n\t */\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Utils ) {\n\tvar View = Backbone.View.extend({\n\t initialize : function( options ) {\n\t var self = this;\n\t this.visible = false;\n\t this.$nav = null;\n\t this.$content = null;\n\t this.first_tab = null;\n\t this.current_id = null;\n\t this.list = {};\n\t this.options = Utils.merge( options, {\n\t title_new : '',\n\t operations : null,\n\t onnew : null,\n\t max : null,\n\t onchange : null\n\t });\n\t this.setElement( $( this._template( this.options ) ) );\n\t this.$nav = this.$( '.tab-navigation' );\n\t this.$content = this.$( '.tab-content' );\n\t this.$operations = this.$nav.find( '.tab-operations' );\n\t\n\t // Renders tab operations\n\t if ( this.options.operations ) {\n\t $.each( this.options.operations, function( name, item ) {\n\t item.$el.prop( 'id', name );\n\t self.$operations.append( item.$el );\n\t });\n\t }\n\t\n\t // Allows user to add new tabs\n\t this.options.onnew && this.$nav.append( $( this._template_tab_new( this.options ) )\n\t .tooltip( { title: 'Add a new tab', placement: 'bottom', container: self.$el } )\n\t .on( 'click', function( e ) { self.options.onnew() } )\n\t );\n\t this.$tabnew = this.$nav.find( '.tab-new' );\n\t\n\t // Remove all tooltips on click\n\t this.$el.on( 'click', function() { $( '.tooltip' ).hide() } );\n\t },\n\t\n\t /** Returns current number of tabs */\n\t size: function() {\n\t return _.size( this.list );\n\t },\n\t\n\t /** Returns tab id for currently shown tab */\n\t current: function() {\n\t return this.$el.find( '.tab-pane.active' ).attr( 'id' );\n\t },\n\t\n\t /** Adds a new tab */\n\t add: function( options ) {\n\t var self = this;\n\t var id = options.id;\n\t var $tab_title = $( this._template_tab( options ) );\n\t var $tab_content = $( '
                                  ' ).attr( 'id', options.id ).addClass( 'tab-pane' );\n\t\n\t // hide new tab if maximum number of tabs has been reached\n\t this.list[ id ] = true;\n\t if ( this.options.max && this.size() >= this.options.max ) {\n\t this.$tabnew.hide();\n\t }\n\t\n\t // insert tab before new tab or as last tab\n\t if ( this.options.onnew ) {\n\t this.$tabnew.before( $tab_title );\n\t } else {\n\t this.$nav.append( $tab_title );\n\t }\n\t\n\t // assing delete callback if provided\n\t if ( options.ondel ) {\n\t $tab_title.find( '.tab-delete' ).tooltip( { title: 'Delete this tab', placement: 'bottom', container: self.$el } )\n\t .on( 'click', function() { options.ondel() } );\n\t } else {\n\t $tab_title.tooltip( { title: options.tooltip, placement: 'bottom', container: self.$el } );\n\t }\n\t $tab_title.on( 'click', function( e ) {\n\t e.preventDefault();\n\t options.onclick ? options.onclick() : self.show( id );\n\t });\n\t this.$content.append( $tab_content.append( options.$el ) );\n\t\n\t // assign current/first tab\n\t if ( this.size() == 1 ) {\n\t $tab_title.addClass( 'active' );\n\t $tab_content.addClass( 'active' );\n\t this.first_tab = id;\n\t }\n\t if ( !this.current_id ) {\n\t this.current_id = id;\n\t }\n\t },\n\t\n\t /** Delete tab */\n\t del: function( id ) {\n\t this.$( '#tab-' + id ).remove();\n\t this.$( '#' + id ).remove();\n\t this.first_tab = this.first_tab == id ? null : this.first_tab;\n\t this.first_tab != null && this.show( this.first_tab );\n\t this.list[ id ] && delete this.list[ id ];\n\t if ( this.size() < this.options.max ) {\n\t this.$el.find( '.ui-tabs-new' ).show();\n\t }\n\t },\n\t\n\t /** Delete all tabs */\n\t delAll: function() {\n\t for ( var id in this.list ) {\n\t this.del( id );\n\t }\n\t },\n\t\n\t /** Show tab view and highlight a tab by id */\n\t show: function( id ){\n\t this.$el.fadeIn( 'fast' );\n\t this.visible = true;\n\t if ( id ) {\n\t this.$( '#tab-' + this.current_id ).removeClass('active' );\n\t this.$( '#' + this.current_id ).removeClass('active' );\n\t this.$( '#tab-' + id ).addClass( 'active' );\n\t this.$( '#' + id ).addClass( 'active' );\n\t this.current_id = id;\n\t }\n\t this.options.onchange && this.options.onchange( id );\n\t },\n\t \n\t /** Hide tab view */\n\t hide: function(){\n\t this.$el.fadeOut( 'fast' );\n\t this.visible = false;\n\t },\n\t\n\t /** Show tab */\n\t showTab: function( id ) {\n\t this.$( '#tab-' + id ).show();\n\t },\n\t\n\t /** hide tab */\n\t hideTab: function( id ) {\n\t this.$( '#tab-' + id ).hide();\n\t },\n\t\n\t /** Hide operation by id */\n\t hideOperation: function( id ) {\n\t this.$nav.find( '#' + id ).hide();\n\t },\n\t\n\t /** Show operation by id */\n\t showOperation: function( id ) {\n\t this.$nav.find( '#' + id ).show();\n\t },\n\t\n\t /** Reassign an operation to a new callback */\n\t setOperation: function( id, callback ) {\n\t this.$nav.find( '#' + id ).off('click').on( 'click', callback );\n\t },\n\t\n\t /** Set/Get title */\n\t title: function( id, new_title ) {\n\t var $el = this.$( '#tab-title-text-' + id );\n\t new_title && $el.html( new_title );\n\t return $el.html();\n\t },\n\t\n\t /** Enumerate titles */\n\t retitle: function( new_title ) {\n\t var index = 0;\n\t for ( var id in this.list ) {\n\t this.title( id, ++index + ': ' + new_title );\n\t }\n\t },\n\t\n\t /** Main template */\n\t _template: function( options ) {\n\t return $( '
                                  ' ).addClass( 'ui-tabs tabbable tabs-left' )\n\t .append( $( '
                                • ' +\n\t '
                                  ' +\n\t '
                                  ' +\n\t '
                                  ' +\n\t '
                                  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\t '',\n '
                                  ',\n '
                                  '\n ].join( '' );\n }\n});\n\n//==============================================================================\nreturn {\n CitationView : CitationView,\n CitationListView : CitationListView\n};\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/citation/citation-view.js\n ** module id = 28\n ** module chunks = 0 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-li.js\n ** module id = 29\n ** module chunks = 3\n **/","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 // 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 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'\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-model.js\n ** module id = 30\n ** module chunks = 3\n **/","\ndefine([\n \"mvc/history/hdca-model\",\n \"mvc/dataset/states\",\n \"mvc/base-mvc\",\n \"mvc/ui/ui-modal\",\n \"utils/natural-sort\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( HDCA, STATES, BASE_MVC, UI_MODAL, naturalSort, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\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({\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 /** 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._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 if( element.state !== STATES.OK ){\n if( _.contains( STATES.NOT_READY_STATES, element.state ) ){\n return _l( \"hasn't finished running yet\" );\n }\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 /** render the footer, completion controls, and cancel controls */\n _renderFooter : function( speed, callback ){\n var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n return $footer;\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 /** 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 _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 )\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 'click .cancel-create' : function( ev ){\n if( typeof this.oncancel === 'function' ){\n this.oncancel.call( this );\n }\n },\n 'click .create-collection' : '_clickCreate'//,\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 // ........................................................................ 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 // ........................................................................ 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 /** 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 // ------------------------------------------------------------------------ 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 : {\n /** the skeleton */\n main : _.template([\n '
                                  ',\n '
                                  ',\n '
                                  '\n ].join('')),\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 '
                                  ', _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 '
                                • ',\n _l( 'No elements left! ' ),\n _l( 'Would you like to ' ), '', _l( 'start over' ), '?',\n '
                                • '\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 ){\n var elements = contents.toJSON(),\n promise = listCollectionCreatorModal( elements, {\n creationFn : function( elements, name ){\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 );\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/list-collection-creator.js\n ** module id = 31\n ** module chunks = 3\n **/","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, options ){\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\n } else {\n self.render();\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 /** 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 // ......................................................................... 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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/dataset/dataset-li.js\n ** module id = 32\n ** module chunks = 3\n **/","/* This class maps the form dom to an api compatible javascript dictionary. */\ndefine([ 'utils/utils' ], function( Utils ) {\n var Manager = Backbone.Model.extend({\n initialize: function( app ) {\n this.app = app;\n },\n\n /** Creates a checksum. */\n checksum: function() {\n var sum = '';\n var self = this;\n this.app.section.$el.find( '.section-row' ).each( function() {\n var id = $(this).attr( 'id' );\n var field = self.app.field_list[ id ];\n if ( field ) {\n sum += id + ':' + JSON.stringify( field.value && field.value() ) + ':' + field.collapsed + ';';\n }\n });\n return sum;\n },\n\n /** Convert dom into a dictionary of flat id/value pairs used e.g. on job submission. */\n create: function() {\n var self = this;\n\n // get raw dictionary from dom\n var dict = {};\n this._iterate( this.app.section.$el, dict );\n\n // add to result dictionary, label elements\n var result_dict = {};\n this.flat_dict = {};\n function add( flat_id, input_id, input_value ) {\n self.flat_dict[ flat_id ] = input_id;\n result_dict[ flat_id ] = input_value;\n self.app.element_list[ input_id ] && self.app.element_list[ input_id ].$el.attr( 'tour_id', flat_id );\n }\n // converter between raw dictionary and job dictionary\n function convert( identifier, head ) {\n for ( var index in head ) {\n var node = head[ index ];\n if ( node.input ) {\n var input = node.input;\n var flat_id = identifier;\n if ( identifier != '' ) {\n flat_id += '|';\n }\n flat_id += input.name;\n switch ( input.type ) {\n case 'repeat':\n var section_label = 'section-';\n var block_indices = [];\n var block_prefix = null;\n for ( var block_label in node ) {\n var pos = block_label.indexOf( section_label );\n if ( pos != -1 ) {\n pos += section_label.length;\n block_indices.push( parseInt( block_label.substr( pos ) ));\n if ( !block_prefix ) {\n block_prefix = block_label.substr( 0, pos );\n }\n }\n }\n block_indices.sort( function( a, b ) { return a - b; });\n var index = 0;\n for ( var i in block_indices ) {\n convert( flat_id + '_' + index++, node[ block_prefix + block_indices[ i ] ]);\n }\n break;\n case 'conditional':\n var value = self.app.field_list[ input.id ].value();\n add( flat_id + '|' + input.test_param.name, input.id, value );\n var selectedCase = matchCase( input, value );\n if ( selectedCase != -1 ) {\n convert( flat_id, head[ input.id + '-section-' + selectedCase ] );\n }\n break;\n case 'section':\n convert( !input.flat && flat_id || '', node );\n break;\n default:\n var field = self.app.field_list[ input.id ];\n if ( field && field.value ) {\n var value = field.value();\n if ( input.ignore === undefined || input.ignore != value ) {\n if ( field.collapsed && input.collapsible_value ) {\n value = input.collapsible_value;\n }\n add( flat_id, input.id, value );\n if ( input.payload ) {\n for ( var p_id in input.payload ) {\n add( p_id, input.id, input.payload[ p_id ] );\n }\n }\n }\n }\n }\n }\n }\n }\n convert( '', dict );\n return result_dict;\n },\n\n /** Matches flat ids to corresponding input element\n * @param{string} flat_id - Flat input id to be looked up.\n */\n match: function ( flat_id ) {\n return this.flat_dict && this.flat_dict[ flat_id ];\n },\n\n /** Match conditional values to selected cases\n */\n matchCase: function( input, value ) {\n return matchCase( input, value );\n },\n\n /** Matches a new tool model to the current input elements e.g. used to update dynamic options\n */\n matchModel: function( model, callback ) {\n var self = this;\n visitInputs( model.inputs, function( input, name ) {\n self.flat_dict[ name ] && callback ( input, self.flat_dict[ name ] );\n });\n },\n\n /** Matches identifier from api response to input elements e.g. used to display validation errors\n */\n matchResponse: function( response ) {\n var result = {};\n var self = this;\n function search ( id, head ) {\n if ( typeof head === 'string' ) {\n var input_id = self.flat_dict[ id ];\n input_id && ( result[ input_id ] = head );\n } else {\n for ( var i in head ) {\n var new_id = i;\n if ( id !== '' ) {\n var separator = '|';\n if ( head instanceof Array ) {\n separator = '_';\n }\n new_id = id + separator + new_id;\n }\n search ( new_id, head[ i ] );\n }\n }\n }\n search( '', response );\n return result;\n },\n\n /** Map dom tree to dictionary tree with input elements.\n */\n _iterate: function( parent, dict ) {\n var self = this;\n var children = $( parent ).children();\n children.each( function() {\n var child = this;\n var id = $( child ).attr( 'id' );\n if ( $( child ).hasClass( 'section-row' ) ) {\n var input = self.app.input_list[ id ];\n dict[ id ] = ( input && { input : input } ) || {};\n self._iterate( child, dict[ id ] );\n } else {\n self._iterate( child, dict );\n }\n });\n }\n });\n\n /** Match conditional values to selected cases\n * @param{dict} input - Definition of conditional input parameter\n * @param{dict} value - Current value\n */\n var matchCase = function( input, value ) {\n if ( input.test_param.type == 'boolean' ) {\n if ( value == 'true' ) {\n value = input.test_param.truevalue || 'true';\n } else {\n value = input.test_param.falsevalue || 'false';\n }\n }\n for ( var i in input.cases ) {\n if ( input.cases[ i ].value == value ) {\n return i;\n }\n }\n return -1;\n };\n\n /** Visits tool inputs\n * @param{dict} inputs - Nested dictionary of input elements\n * @param{dict} callback - Called with the mapped dictionary object and corresponding model node\n */\n var visitInputs = function( inputs, callback, prefix, context ) {\n context = $.extend( true, {}, context );\n _.each( inputs, function ( input ) {\n if ( input && input.type && input.name ) {\n context[ input.name ] = input;\n }\n });\n for ( var key in inputs ) {\n var node = inputs[ key ];\n node.name = node.name || key;\n var name = prefix ? prefix + '|' + node.name : node.name;\n switch ( node.type ) {\n case 'repeat':\n _.each( node.cache, function( cache, j ) {\n visitInputs( cache, callback, name + '_' + j, context );\n });\n break;\n case 'conditional':\n if ( node.test_param ) {\n callback( node.test_param, name + '|' + node.test_param.name, context );\n var selectedCase = matchCase( node, node.test_param.value );\n if ( selectedCase != -1 ) {\n visitInputs( node.cases[ selectedCase ].inputs, callback, name, context );\n } else {\n Galaxy.emit.debug( 'form-data::visitInputs() - Invalid case for ' + name + '.' );\n }\n } else {\n Galaxy.emit.debug( 'form-data::visitInputs() - Conditional test parameter missing for ' + name + '.' );\n }\n break;\n case 'section':\n visitInputs( node.inputs, callback, name, context )\n break;\n default:\n callback( node, name, context );\n }\n }\n };\n\n return {\n Manager : Manager,\n visitInputs : visitInputs\n }\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-data.js\n ** module id = 33\n ** module chunks = 0 3\n **/","/**\n This class creates a form input element wrapper\n*/\ndefine([], function() {\n return Backbone.View.extend({\n initialize: function( app, options ) {\n this.app = app;\n this.app_options = app.options || {};\n this.field = options && options.field || new Backbone.View();\n this.model = options && options.model || new Backbone.Model({\n text_enable : this.app_options.text_enable || 'Enable',\n text_disable : this.app_options.text_disable || 'Disable',\n cls_enable : this.app_options.cls_enable || 'fa fa-caret-square-o-down',\n cls_disable : this.app_options.cls_disable || 'fa fa-caret-square-o-up'\n }).set( options );\n\n // set element and link components\n this.setElement( this._template() );\n this.$field = this.$( '.ui-form-field' );\n this.$info = this.$( '.ui-form-info' );\n this.$preview = this.$( '.ui-form-preview' );\n this.$collapsible = this.$( '.ui-form-collapsible' );\n this.$collapsible_text = this.$( '.ui-form-collapsible-text' );\n this.$collapsible_icon = this.$( '.ui-form-collapsible-icon' );\n this.$title = this.$( '.ui-form-title' );\n this.$title_text = this.$( '.ui-form-title-text' );\n this.$error_text = this.$( '.ui-form-error-text' );\n this.$error = this.$( '.ui-form-error' );\n this.$backdrop = this.$( '.ui-form-backdrop' );\n\n // add field element\n this.$field.prepend( this.field.$el );\n\n // decide wether to expand or collapse fields\n var collapsible_value = this.model.get( 'collapsible_value' );\n this.field.collapsed = collapsible_value !== undefined && JSON.stringify( this.model.get( 'value' ) ) == JSON.stringify( collapsible_value );\n this.listenTo( this.model, 'change', this.render, this );\n this.render();\n\n // add click handler\n var self = this;\n this.$collapsible.on( 'click', function() {\n self.field.collapsed = !self.field.collapsed;\n app.trigger && app.trigger( 'change' );\n self.render();\n });\n },\n\n /** Set backdrop for input element\n */\n backdrop: function() {\n this.model.set( 'backdrop', true );\n },\n\n /** Set error text\n */\n error: function( text ) {\n this.model.set( 'error_text', text );\n },\n\n /** Reset this view\n */\n reset: function() {\n this.model.set( 'error_text', null );\n },\n\n render: function() {\n // render help\n $( '.tooltip' ).hide();\n var help_text = this.model.get( 'help', '' );\n var help_argument = this.model.get( 'argument' );\n if ( help_argument && help_text.indexOf( '(' + help_argument + ')' ) == -1 ) {\n help_text += ' (' + help_argument + ')';\n }\n this.$info.html( help_text );\n // render visibility\n this.$el[ this.model.get( 'hidden' ) ? 'hide' : 'show' ]();\n // render preview view for collapsed fields\n this.$preview[ ( this.field.collapsed && this.model.get( 'collapsible_preview' ) || this.model.get( 'disabled' ) ) ? 'show' : 'hide' ]()\n .html( _.escape( this.model.get( 'text_value' ) ) );\n // render error messages\n var error_text = this.model.get( 'error_text' );\n this.$error[ error_text ? 'show' : 'hide' ]();\n this.$el[ error_text ? 'addClass' : 'removeClass' ]( 'ui-error' );\n this.$error_text.html( error_text );\n // render backdrop\n this.$backdrop[ this.model.get( 'backdrop' ) ? 'show' : 'hide' ]();\n // render input field\n this.field.collapsed || this.model.get( 'disabled' ) ? this.$field.hide() : this.$field.show();\n // render input field color and style\n this.field.model && this.field.model.set( { 'color': this.model.get( 'color' ), 'style': this.model.get( 'style' ) } );\n // render collapsible options\n if ( !this.model.get( 'disabled' ) && this.model.get( 'collapsible_value' ) !== undefined ) {\n var collapsible_state = this.field.collapsed ? 'enable' : 'disable';\n this.$title_text.hide();\n this.$collapsible.show();\n this.$collapsible_text.text( this.model.get( 'label' ) );\n this.$collapsible_icon.removeClass().addClass( 'icon' )\n .addClass( this.model.get( 'cls_' + collapsible_state ) )\n .attr( 'data-original-title', this.model.get( 'text_' + collapsible_state ) )\n .tooltip( { placement: 'bottom' } );\n } else {\n this.$title_text.show().text( this.model.get( 'label' ) );\n this.$collapsible.hide();\n }\n },\n\n _template: function() {\n return $( '
                                  ' ).addClass( 'ui-form-element' )\n .append( $( '
                                  ' ).addClass( 'ui-form-error ui-error' )\n .append( $( '' ).addClass( 'fa fa-arrow-down' ) )\n .append( $( '' ).addClass( 'ui-form-error-text' ) )\n )\n .append( $( '
                                  ' ).addClass( 'ui-form-title' )\n .append( $( '
                                  ' ).addClass( 'ui-form-collapsible' )\n .append( $( '' ).addClass( 'ui-form-collapsible-icon' ) )\n .append( $( '' ).addClass( 'ui-form-collapsible-text' ) )\n )\n .append( $( '' ).addClass( 'ui-form-title-text' ) )\n )\n .append( $( '
                                  ' ).addClass( 'ui-form-field' )\n .append( $( '' ).addClass( 'ui-form-info' ) )\n .append( $( '
                                  ' ).addClass( 'ui-form-backdrop' ) )\n )\n .append( $( '
                                  ' ).addClass( 'ui-form-preview' ) );\n }\n });\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-input.js\n ** module id = 34\n ** module chunks = 0 3\n **/","/**\n This class creates input elements. New input parameter types should be added to the types dictionary.\n*/\ndefine(['utils/utils',\n 'mvc/ui/ui-misc',\n 'mvc/ui/ui-select-content',\n 'mvc/ui/ui-select-library',\n 'mvc/ui/ui-select-ftp',\n 'mvc/ui/ui-color-picker'],\n function( Utils, Ui, SelectContent, SelectLibrary, SelectFtp, ColorPicker ) {\n\n // create form view\n return Backbone.Model.extend({\n /** Available parameter types */\n types: {\n 'text' : '_fieldText',\n 'select' : '_fieldSelect',\n 'data_column' : '_fieldSelect',\n 'genomebuild' : '_fieldSelect',\n 'data' : '_fieldData',\n 'data_collection' : '_fieldData',\n 'integer' : '_fieldSlider',\n 'float' : '_fieldSlider',\n 'boolean' : '_fieldBoolean',\n 'drill_down' : '_fieldDrilldown',\n 'color' : '_fieldColor',\n 'hidden' : '_fieldHidden',\n 'hidden_data' : '_fieldHidden',\n 'baseurl' : '_fieldHidden',\n 'library_data' : '_fieldLibrary',\n 'ftpfile' : '_fieldFtp'\n },\n\n /** Returns an input field for a given field type */\n create: function( input_def ) {\n var fieldClass = this.types[ input_def.type ];\n var field = typeof( this[ fieldClass ] ) === 'function' ? this[ fieldClass ].call( this, input_def ) : null;\n if ( !field ) {\n field = input_def.options ? this._fieldSelect( input_def ) : this._fieldText( input_def );\n Galaxy.emit.debug('form-parameters::_addRow()', 'Auto matched field type (' + input_def.type + ').');\n }\n input_def.value === undefined && ( input_def.value = null );\n field.value( input_def.value );\n return field;\n },\n\n /** Data input field */\n _fieldData: function( input_def ) {\n return new SelectContent.View({\n id : 'field-' + input_def.id,\n extensions : input_def.extensions,\n optional : input_def.optional,\n multiple : input_def.multiple,\n type : input_def.type,\n flavor : input_def.flavor,\n data : input_def.options,\n onchange : input_def.onchange\n });\n },\n\n /** Select/Checkbox/Radio options field */\n _fieldSelect: function ( input_def ) {\n // show text field e.g. in workflow editor\n if( input_def.is_workflow ) {\n return this._fieldText( input_def );\n }\n\n // customize properties\n if ( input_def.type == 'data_column' ) {\n input_def.error_text = 'Missing columns in referenced dataset.'\n }\n\n // identify available options\n var data = input_def.data;\n if( !data ) {\n data = [];\n _.each( input_def.options, function( option ) {\n data.push( { label: option[ 0 ], value: option[ 1 ] } );\n });\n }\n\n // identify display type\n var SelectClass = Ui.Select;\n switch ( input_def.display ) {\n case 'checkboxes':\n SelectClass = Ui.Checkbox;\n break;\n case 'radio':\n SelectClass = Ui.Radio;\n break;\n case 'radiobutton':\n SelectClass = Ui.RadioButton;\n break;\n }\n\n // create select field\n return new SelectClass.View({\n id : 'field-' + input_def.id,\n data : data,\n error_text : input_def.error_text || 'No options available',\n multiple : input_def.multiple,\n optional : input_def.optional,\n onchange : input_def.onchange,\n searchable : input_def.flavor !== 'workflow'\n });\n },\n\n /** Drill down options field */\n _fieldDrilldown: function ( input_def ) {\n // show text field e.g. in workflow editor\n if( input_def.is_workflow ) {\n return this._fieldText( input_def );\n }\n\n // create drill down field\n return new Ui.Drilldown.View({\n id : 'field-' + input_def.id,\n data : input_def.options,\n display : input_def.display,\n optional : input_def.optional,\n onchange : input_def.onchange\n });\n },\n\n /** Text input field */\n _fieldText: function( input_def ) {\n // field replaces e.g. a select field\n if ( input_def.options && input_def.data ) {\n input_def.area = input_def.multiple;\n if ( Utils.isEmpty( input_def.value ) ) {\n input_def.value = null;\n } else {\n if ( $.isArray( input_def.value ) ) {\n var str_value = '';\n for ( var i in input_def.value ) {\n str_value += String( input_def.value[ i ] );\n if ( !input_def.multiple ) {\n break;\n }\n str_value += '\\n';\n }\n input_def.value = str_value;\n }\n }\n }\n // create input element\n return new Ui.Input({\n id : 'field-' + input_def.id,\n area : input_def.area,\n placeholder : input_def.placeholder,\n onchange : input_def.onchange\n });\n },\n\n /** Slider field */\n _fieldSlider: function( input_def ) {\n return new Ui.Slider.View({\n id : 'field-' + input_def.id,\n precise : input_def.type == 'float',\n is_workflow : input_def.is_workflow,\n min : input_def.min,\n max : input_def.max,\n onchange : input_def.onchange\n });\n },\n\n /** Hidden field */\n _fieldHidden: function( input_def ) {\n return new Ui.Hidden({\n id : 'field-' + input_def.id,\n info : input_def.info\n });\n },\n\n /** Boolean field */\n _fieldBoolean: function( input_def ) {\n return new Ui.RadioButton.View({\n id : 'field-' + input_def.id,\n data : [ { label : 'Yes', value : 'true' },\n { label : 'No', value : 'false' }],\n onchange : input_def.onchange\n });\n },\n\n /** Color picker field */\n _fieldColor: function( input_def ) {\n return new ColorPicker({\n id : 'field-' + input_def.id,\n onchange : input_def.onchange\n });\n },\n\n /** Library dataset field */\n _fieldLibrary: function( input_def ) {\n return new SelectLibrary.View({\n id : 'field-' + input_def.id,\n optional : input_def.optional,\n multiple : input_def.multiple,\n onchange : input_def.onchange\n });\n },\n\n /** FTP file field */\n _fieldFtp: function( input_def ) {\n return new SelectFtp.View({\n id : 'field-' + input_def.id,\n optional : input_def.optional,\n multiple : input_def.multiple,\n onchange : input_def.onchange\n });\n }\n });\n\n return {\n View: View\n };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-parameters.js\n ** module id = 35\n ** module chunks = 0 3\n **/","/** This class creates a ui component which enables the dynamic creation of portlets */\ndefine( [ 'utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc' ],\nfunction( Utils, Portlet, Ui ) {\n var View = Backbone.View.extend({\n initialize: function( options ) {\n this.list = {};\n this.options = Utils.merge( options, {\n title : 'Repeat',\n empty_text : 'Not available.',\n max : null,\n min : null\n });\n this.button_new = new Ui.ButtonIcon({\n icon : 'fa-plus',\n title : 'Insert ' + this.options.title,\n tooltip : 'Add new ' + this.options.title + ' block',\n floating: 'clear',\n cls : 'ui-button-icon form-repeat-add',\n onclick : function() { options.onnew && options.onnew() }\n });\n this.setElement( $( '
                                  ' ).append( this.$list = $( '
                                  ' ) )\n .append( $( '
                                  ' ).append( this.button_new.$el ) ) );\n },\n\n /** Number of repeat blocks */\n size: function() {\n return _.size( this.list );\n },\n\n /** Add new repeat block */\n add: function( options ) {\n if ( !options.id || this.list[ options.id ] ) {\n Galaxy.emit.debug( 'form-repeat::add()', 'Duplicate or invalid repeat block id.' );\n return;\n }\n var button_delete = new Ui.ButtonIcon({\n icon : 'fa-trash-o',\n tooltip : 'Delete this repeat block',\n cls : 'ui-button-icon-plain form-repeat-delete',\n onclick : function() { options.ondel && options.ondel() }\n });\n var portlet = new Portlet.View({\n id : options.id,\n title : 'placeholder',\n cls : options.cls || 'ui-portlet-repeat',\n operations : { button_delete: button_delete }\n });\n portlet.append( options.$el );\n portlet.$el.addClass( 'section-row' ).hide();\n this.list[ options.id ] = portlet;\n this.$list.append( portlet.$el.fadeIn( 'fast' ) );\n this.options.max > 0 && this.size() >= this.options.max && this.button_new.disable();\n this._refresh();\n },\n\n /** Delete repeat block */\n del: function( id ) {\n if ( !this.list[ id ] ) {\n Galaxy.emit.debug( 'form-repeat::del()', 'Invalid repeat block id.' );\n return;\n }\n this.$list.find( '#' + id ).remove();\n delete this.list[ id ];\n this.button_new.enable();\n this._refresh();\n },\n\n /** Remove all */\n delAll: function() {\n for( var id in this.list ) {\n this.del( id );\n }\n },\n\n /** Hides add/del options */\n hideOptions: function() {\n this.button_new.$el.hide();\n _.each( this.list, function( portlet ) { portlet.hideOperation( 'button_delete' ) } );\n _.isEmpty( this.list ) && this.$el.append( $( '
                                  ' ).addClass( 'ui-form-info' ).html( this.options.empty_text ) );\n },\n\n /** Refresh view */\n _refresh: function() {\n var index = 0;\n for ( var id in this.list ) {\n var portlet = this.list[ id ];\n portlet.title( ++index + ': ' + this.options.title );\n portlet[ this.size() > this.options.min ? 'showOperation' : 'hideOperation' ]( 'button_delete' );\n }\n }\n });\n\n return {\n View : View\n }\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-repeat.js\n ** module id = 36\n ** module chunks = 0 3\n **/","/**\n This class creates a form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections.\n*/\ndefine([ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/ui/ui-portlet', 'mvc/form/form-repeat', 'mvc/form/form-input', 'mvc/form/form-parameters' ],\nfunction( Utils, Ui, Portlet, Repeat, InputElement, Parameters ) {\n var View = Backbone.View.extend({\n initialize: function( app, options ) {\n this.app = app;\n this.inputs = options.inputs;\n this.parameters = new Parameters();\n this.setElement( $( '
                                  ' ) );\n this.render();\n },\n\n /** Render section view */\n render: function() {\n var self = this;\n this.$el.empty();\n _.each( this.inputs, function( input ) { self.add( input ) } );\n },\n\n /** Add a new input element */\n add: function( input ) {\n var input_def = jQuery.extend( true, {}, input );\n input_def.id = input.id = Utils.uid();\n this.app.input_list[ input_def.id ] = input_def;\n switch( input_def.type ) {\n case 'conditional':\n this._addConditional( input_def );\n break;\n case 'repeat':\n this._addRepeat( input_def );\n break;\n case 'section':\n this._addSection( input_def );\n break;\n default:\n this._addRow( input_def );\n }\n },\n\n /** Add a conditional block */\n _addConditional: function( input_def ) {\n var self = this;\n input_def.test_param.id = input_def.id;\n this.app.options.sustain_conditionals && ( input_def.test_param.disabled = true );\n var field = this._addRow( input_def.test_param );\n\n // set onchange event for test parameter\n field.model && field.model.set( 'onchange', function( value ) {\n var selectedCase = self.app.data.matchCase( input_def, value );\n for ( var i in input_def.cases ) {\n var case_def = input_def.cases[ i ];\n var section_row = self.$( '#' + input_def.id + '-section-' + i );\n var nonhidden = false;\n for ( var j in case_def.inputs ) {\n if ( !case_def.inputs[ j ].hidden ) {\n nonhidden = true;\n break;\n }\n }\n if ( i == selectedCase && nonhidden ) {\n section_row.fadeIn( 'fast' );\n } else {\n section_row.hide();\n }\n }\n self.app.trigger( 'change' );\n });\n\n // add conditional sub sections\n for ( var i in input_def.cases ) {\n var sub_section = new View( this.app, { inputs: input_def.cases[ i ].inputs } );\n this._append( sub_section.$el.addClass( 'ui-form-section' ), input_def.id + '-section-' + i );\n }\n\n // trigger refresh on conditional input field after all input elements have been created\n field.trigger( 'change' );\n },\n\n /** Add a repeat block */\n _addRepeat: function( input_def ) {\n var self = this;\n var block_index = 0;\n\n // create repeat block element\n var repeat = new Repeat.View({\n title : input_def.title || 'Repeat',\n min : input_def.min,\n max : input_def.max,\n onnew : function() { create( input_def.inputs ); self.app.trigger( 'change' ); }\n });\n\n // helper function to create new repeat blocks\n function create ( inputs ) {\n var sub_section_id = input_def.id + '-section-' + ( block_index++ );\n var sub_section = new View( self.app, { inputs: inputs } );\n repeat.add( { id : sub_section_id,\n $el : sub_section.$el,\n ondel : function() { repeat.del( sub_section_id ); self.app.trigger( 'change' ); } } );\n }\n\n //\n // add parsed/minimum number of repeat blocks\n //\n var n_cache = _.size( input_def.cache );\n for ( var i = 0; i < Math.max( Math.max( n_cache, input_def.min ), input_def.default || 0 ); i++ ) {\n create( i < n_cache ? input_def.cache[ i ] : input_def.inputs );\n }\n\n // hide options\n this.app.options.sustain_repeats && repeat.hideOptions();\n\n // create input field wrapper\n var input_element = new InputElement( this.app, {\n label : input_def.title || input_def.name,\n help : input_def.help,\n field : repeat\n });\n this._append( input_element.$el, input_def.id );\n },\n\n /** Add a customized section */\n _addSection: function( input_def ) {\n var portlet = new Portlet.View({\n title : input_def.title || input_def.name,\n cls : 'ui-portlet-section',\n collapsible : true,\n collapsible_button : true,\n collapsed : !input_def.expanded\n });\n portlet.append( new View( this.app, { inputs: input_def.inputs } ).$el );\n portlet.append( $( '
                                  ' ).addClass( 'ui-form-info' ).html( input_def.help ) );\n this.app.on( 'expand', function( input_id ) { ( portlet.$( '#' + input_id ).length > 0 ) && portlet.expand(); } );\n this._append( portlet.$el, input_def.id );\n },\n\n /** Add a single input field element */\n _addRow: function( input_def ) {\n var self = this;\n var id = input_def.id;\n input_def.onchange = function() { self.app.trigger( 'change', id ) };\n var field = this.parameters.create( input_def );\n this.app.field_list[ id ] = field;\n var input_element = new InputElement( this.app, {\n name : input_def.name,\n label : input_def.label || input_def.name,\n value : input_def.value,\n text_value : input_def.text_value,\n collapsible_value : input_def.collapsible_value,\n collapsible_preview : input_def.collapsible_preview,\n help : input_def.help,\n argument : input_def.argument,\n disabled : input_def.disabled,\n color : input_def.color,\n style : input_def.style,\n backdrop : input_def.backdrop,\n hidden : input_def.hidden,\n field : field\n });\n this.app.element_list[ id ] = input_element;\n this._append( input_element.$el, input_def.id );\n return field;\n },\n\n /** Append a new element to the form i.e. input element, repeat block, conditionals etc. */\n _append: function( $el, id ) {\n this.$el.append( $el.addClass( 'section-row' ).attr( 'id', id ) );\n }\n });\n\n return {\n View: View\n };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-section.js\n ** module id = 37\n ** module chunks = 0 3\n **/","/**\n This is the main class of the form plugin. It is referenced as 'app' in lower level modules.\n*/\ndefine( [ 'utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc', 'mvc/form/form-section', 'mvc/form/form-data' ],\nfunction( Utils, Portlet, Ui, FormSection, FormData ) {\n return Backbone.View.extend({\n initialize: function( options ) {\n this.options = Utils.merge( options, {\n initial_errors : false,\n cls : 'ui-portlet-limited',\n icon : null,\n always_refresh : true\n });\n this.setElement( '
                                  ' );\n this.render();\n },\n\n /** Update available options */\n update: function( new_model ){\n var self = this;\n this.data.matchModel( new_model, function( node, input_id ) {\n var input = self.input_list[ input_id ];\n if ( input && input.options ) {\n if ( !_.isEqual( input.options, node.options ) ) {\n input.options = node.options;\n var field = self.field_list[ input_id ];\n if ( field.update ) {\n var new_options = [];\n if ( ( [ 'data', 'data_collection', 'drill_down' ] ).indexOf( input.type ) != -1 ) {\n new_options = input.options;\n } else {\n for ( var i in node.options ) {\n var opt = node.options[ i ];\n if ( opt.length > 2 ) {\n new_options.push( { label: opt[ 0 ], value: opt[ 1 ] } );\n }\n }\n }\n field.update( new_options );\n field.trigger( 'change' );\n Galaxy.emit.debug( 'form-view::update()', 'Updating options for ' + input_id );\n }\n }\n }\n });\n },\n\n /** Set form into wait mode */\n wait: function( active ) {\n for ( var i in this.input_list ) {\n var field = this.field_list[ i ];\n var input = this.input_list[ i ];\n if ( input.is_dynamic && field.wait && field.unwait ) {\n field[ active ? 'wait' : 'unwait' ]();\n }\n }\n },\n\n /** Highlight and scroll to input element (currently only used for error notifications) */\n highlight: function ( input_id, message, silent ) {\n var input_element = this.element_list[ input_id ];\n if ( input_element ) {\n input_element.error( message || 'Please verify this parameter.' );\n this.portlet.expand();\n this.trigger( 'expand', input_id );\n if ( !silent ) {\n var $panel = this.$el.parents().filter(function() {\n return [ 'auto', 'scroll' ].indexOf( $( this ).css( 'overflow' ) ) != -1;\n }).first();\n $panel.animate( { scrollTop : $panel.scrollTop() + input_element.$el.offset().top - 120 }, 500 );\n }\n }\n },\n\n /** Highlights errors */\n errors: function( options ) {\n this.trigger( 'reset' );\n if ( options && options.errors ) {\n var error_messages = this.data.matchResponse( options.errors );\n for ( var input_id in this.element_list ) {\n var input = this.element_list[ input_id ];\n if ( error_messages[ input_id ] ) {\n this.highlight( input_id, error_messages[ input_id ], true );\n }\n }\n }\n },\n\n /** Render tool form */\n render: function() {\n var self = this;\n this.off('change');\n this.off('reset');\n // contains the dom field elements as created by the parameter factory i.e. form-parameters\n this.field_list = {};\n // contains input definitions/dictionaries as provided by the parameters to_dict() function through the api\n this.input_list = {};\n // contains the dom elements of each input element i.e. form-input which wraps the actual input field\n this.element_list = {};\n // converts the form into a json data structure\n this.data = new FormData.Manager( this );\n this._renderForm();\n this.data.create();\n this.options.initial_errors && this.errors( this.options );\n // add listener which triggers on checksum change, and reset the form input wrappers\n var current_check = this.data.checksum();\n this.on('change', function( input_id ) {\n var input = self.input_list[ input_id ];\n if ( !input || input.refresh_on_change || self.options.always_refresh ) {\n var new_check = self.data.checksum();\n if ( new_check != current_check ) {\n current_check = new_check;\n self.options.onchange && self.options.onchange();\n }\n }\n });\n this.on('reset', function() {\n _.each( self.element_list, function( input_element ) { input_element.reset() } );\n });\n return this;\n },\n\n /** Renders/appends dom elements of the form */\n _renderForm: function() {\n $( '.tooltip' ).remove();\n this.message = new Ui.Message();\n this.section = new FormSection.View( this, { inputs: this.options.inputs } );\n this.portlet = new Portlet.View({\n icon : this.options.icon,\n title : this.options.title,\n cls : this.options.cls,\n operations : this.options.operations,\n buttons : this.options.buttons,\n collapsible : this.options.collapsible,\n collapsed : this.options.collapsed\n });\n this.portlet.append( this.message.$el );\n this.portlet.append( this.section.$el );\n this.$el.empty();\n this.options.inputs && this.$el.append( this.portlet.$el );\n this.options.message && this.message.update( { persistent: true, status: 'warning', message: this.options.message } );\n Galaxy.emit.debug( 'form-view::initialize()', 'Completed' );\n }\n });\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/form/form-view.js\n ** module id = 38\n ** module chunks = 0 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hdca-model.js\n ** module id = 39\n ** module chunks = 3\n **/","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, 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 // 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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-contents.js\n ** module id = 40\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-preferences.js\n ** module id = 41\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/list/list-item.js\n ** module id = 42\n ** module chunks = 3\n **/","/**\n This is the base class of the tool form plugin. This class is e.g. inherited by the regular and the workflow tool form.\n*/\ndefine(['utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view',\n 'mvc/citation/citation-model', 'mvc/citation/citation-view'],\n function(Utils, Deferred, Ui, FormBase, CitationModel, CitationView) {\n return FormBase.extend({\n initialize: function(options) {\n var self = this;\n FormBase.prototype.initialize.call(this, options);\n this.deferred = new Deferred();\n if (options.inputs) {\n this._buildForm(options);\n } else {\n this.deferred.execute(function(process) {\n self._buildModel(process, options, true);\n });\n }\n // listen to history panel\n if ( options.listen_to_history && parent.Galaxy && parent.Galaxy.currHistoryPanel ) {\n this.listenTo( parent.Galaxy.currHistoryPanel.collection, 'change', function() {\n this.refresh();\n });\n }\n // destroy dom elements\n this.$el.on( 'remove', function() { self.remove() } );\n },\n\n /** Listen to history panel changes and update the tool form */\n refresh: function() {\n var self = this;\n self.deferred.reset();\n this.deferred.execute( function (process){\n self._updateModel( process)\n });\n },\n\n /** Wait for deferred build processes before removal */\n remove: function() {\n var self = this;\n this.$el.hide();\n this.deferred.execute(function(){\n FormBase.prototype.remove.call(self);\n Galaxy.emit.debug('tool-form-base::remove()', 'Destroy view.');\n });\n },\n\n /** Build form */\n _buildForm: function(options) {\n var self = this;\n this.options = Utils.merge(options, this.options);\n this.options = Utils.merge({\n icon : options.icon,\n title : '' + options.name + ' ' + options.description + ' (Galaxy Version ' + options.version + ')',\n operations : !this.options.hide_operations && this._operations(),\n onchange : function() {\n self.refresh();\n }\n }, this.options);\n this.options.customize && this.options.customize( this.options );\n this.render();\n if ( !this.options.collapsible ) {\n this.$el.append( $( '
                                  ' ).addClass( 'ui-margin-top-large' ).append( this._footer() ) );\n }\n },\n\n /** Builds a new model through api call and recreates the entire form\n */\n _buildModel: function(process, options, hide_message) {\n var self = this;\n this.options.id = options.id;\n this.options.version = options.version;\n\n // build request url\n var build_url = '';\n var build_data = {};\n if ( options.job_id ) {\n build_url = Galaxy.root + 'api/jobs/' + options.job_id + '/build_for_rerun';\n } else {\n build_url = Galaxy.root + 'api/tools/' + options.id + '/build';\n if ( Galaxy.params && Galaxy.params.tool_id == options.id ) {\n build_data = $.extend( {}, Galaxy.params );\n options.version && ( build_data[ 'tool_version' ] = options.version );\n }\n }\n\n // get initial model\n Utils.get({\n url : build_url,\n data : build_data,\n success : function(new_model) {\n new_model = new_model.tool_model || new_model;\n if( !new_model.display ) {\n window.location = Galaxy.root;\n return;\n }\n self._buildForm(new_model);\n !hide_message && self.message.update({\n status : 'success',\n message : 'Now you are using \\'' + self.options.name + '\\' version ' + self.options.version + ', id \\'' + self.options.id + '\\'.',\n persistent : false\n });\n Galaxy.emit.debug('tool-form-base::initialize()', 'Initial tool model ready.', new_model);\n process.resolve();\n },\n error : function(response, xhr) {\n var error_message = ( response && response.err_msg ) || 'Uncaught error.';\n if ( xhr.status == 401 ) {\n window.location = Galaxy.root + 'user/login?' + $.param({ redirect : Galaxy.root + '?tool_id=' + self.options.id });\n } else if ( self.$el.is(':empty') ) {\n self.$el.prepend((new Ui.Message({\n message : error_message,\n status : 'danger',\n persistent : true,\n large : true\n })).$el);\n } else {\n Galaxy.modal && Galaxy.modal.show({\n title : 'Tool request failed',\n body : error_message,\n buttons : {\n 'Close' : function() {\n Galaxy.modal.hide();\n }\n }\n });\n }\n Galaxy.emit.debug('tool-form::initialize()', 'Initial tool model request failed.', response);\n process.reject();\n }\n });\n },\n\n /** Request a new model for an already created tool form and updates the form inputs\n */\n _updateModel: function(process) {\n // link this\n var self = this;\n var model_url = this.options.update_url || Galaxy.root + 'api/tools/' + this.options.id + '/build';\n var current_state = {\n tool_id : this.options.id,\n tool_version : this.options.version,\n inputs : $.extend(true, {}, self.data.create())\n }\n this.wait(true);\n\n // log tool state\n Galaxy.emit.debug('tool-form-base::_updateModel()', 'Sending current state.', current_state);\n\n // post job\n Utils.request({\n type : 'POST',\n url : model_url,\n data : current_state,\n success : function(new_model) {\n self.update(new_model['tool_model'] || new_model);\n self.options.update && self.options.update(new_model);\n self.wait(false);\n Galaxy.emit.debug('tool-form-base::_updateModel()', 'Received new model.', new_model);\n process.resolve();\n },\n error : function(response) {\n Galaxy.emit.debug('tool-form-base::_updateModel()', 'Refresh request failed.', response);\n process.reject();\n }\n });\n },\n\n /** Create tool operation menu\n */\n _operations: function() {\n var self = this;\n var options = this.options;\n\n // button for version selection\n var versions_button = new Ui.ButtonMenu({\n icon : 'fa-cubes',\n title : (!options.narrow && 'Versions') || null,\n tooltip : 'Select another tool version'\n });\n if (!options.sustain_version && options.versions && options.versions.length > 1) {\n for (var i in options.versions) {\n var version = options.versions[i];\n if (version != options.version) {\n versions_button.addMenu({\n title : 'Switch to ' + version,\n version : version,\n icon : 'fa-cube',\n onclick : function() {\n // here we update the tool version (some tools encode the version also in the id)\n var id = options.id.replace(options.version, this.version);\n var version = this.version;\n // queue model request\n self.deferred.reset();\n self.deferred.execute(function(process) {\n self._buildModel(process, {id: id, version: version})\n });\n }\n });\n }\n }\n } else {\n versions_button.$el.hide();\n }\n\n // button for options e.g. search, help\n var menu_button = new Ui.ButtonMenu({\n icon : 'fa-caret-down',\n title : (!options.narrow && 'Options') || null,\n tooltip : 'View available options'\n });\n if(options.biostar_url) {\n menu_button.addMenu({\n icon : 'fa-question-circle',\n title : 'Question?',\n tooltip : 'Ask a question about this tool (Biostar)',\n onclick : function() {\n window.open(options.biostar_url + '/p/new/post/');\n }\n });\n menu_button.addMenu({\n icon : 'fa-search',\n title : 'Search',\n tooltip : 'Search help for this tool (Biostar)',\n onclick : function() {\n window.open(options.biostar_url + '/local/search/page/?q=' + options.name);\n }\n });\n };\n menu_button.addMenu({\n icon : 'fa-share',\n title : 'Share',\n tooltip : 'Share this tool',\n onclick : function() {\n prompt('Copy to clipboard: Ctrl+C, Enter', window.location.origin + Galaxy.root + 'root?tool_id=' + options.id);\n }\n });\n\n // add admin operations\n if (Galaxy.user && Galaxy.user.get('is_admin')) {\n menu_button.addMenu({\n icon : 'fa-download',\n title : 'Download',\n tooltip : 'Download this tool',\n onclick : function() {\n window.location.href = Galaxy.root + 'api/tools/' + options.id + '/download';\n }\n });\n }\n\n // button for version selection\n if (options.requirements && options.requirements.length > 0) {\n menu_button.addMenu({\n icon : 'fa-info-circle',\n title : 'Requirements',\n tooltip : 'Display tool requirements',\n onclick : function() {\n if (!this.visible || self.portlet.collapsed ) {\n this.visible = true;\n self.portlet.expand();\n self.message.update({\n persistent : true,\n message : self._templateRequirements(options),\n status : 'info'\n });\n } else {\n this.visible = false;\n self.message.update({\n message : ''\n });\n }\n }\n });\n }\n\n // add toolshed url\n if (options.sharable_url) {\n menu_button.addMenu({\n icon : 'fa-external-link',\n title : 'See in Tool Shed',\n tooltip : 'Access the repository',\n onclick : function() {\n window.open(options.sharable_url);\n }\n });\n }\n\n return {\n menu : menu_button,\n versions : versions_button\n }\n },\n\n /** Create footer\n */\n _footer: function() {\n var options = this.options;\n var $el = $( '
                                  ' ).append( this._templateHelp( options ) );\n if ( options.citations ) {\n var $citations = $( '
                                  ' );\n var citations = new CitationModel.ToolCitationCollection();\n citations.tool_id = options.id;\n var citation_list_view = new CitationView.CitationListView({ el: $citations, collection: citations });\n citation_list_view.render();\n citations.fetch();\n $el.append( $citations );\n }\n return $el;\n },\n\n /** Templates\n */\n _templateHelp: function( options ) {\n var $tmpl = $( '
                                  ' ).addClass( 'ui-form-help' ).append( options.help );\n $tmpl.find( 'a' ).attr( 'target', '_blank' );\n return $tmpl;\n },\n\n _templateRequirements: function( options ) {\n var nreq = options.requirements.length;\n if ( nreq > 0 ) {\n var requirements_message = 'This tool requires ';\n _.each( options.requirements, function( req, i ) {\n requirements_message += req.name + ( req.version ? ' (Version ' + req.version + ')' : '' ) + ( i < nreq - 2 ? ', ' : ( i == nreq - 2 ? ' and ' : '' ) );\n });\n var requirements_link = $( '' ).attr( 'target', '_blank' ).attr( 'href', 'https://wiki.galaxyproject.org/Tools/Requirements' ).text( 'here' );\n return $( '' ).append( requirements_message + '. Click ' ).append( requirements_link ).append( ' for more information.' );\n }\n return 'No requirements found.';\n }\n });\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/tool/tool-form-base.js\n ** module id = 43\n ** module chunks = 0 3\n **/","/**\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 search_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 var form = new ToolForm.View( { id : self.model.id, version : self.model.get('version') } );\n form.deferred.execute(function() {\n Galaxy.app.display( form );\n });\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 '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 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 '',\n '<% _.each( labels, function( label ){ %>',\n '\">',\n '<%- label %>',\n '',\n '<% }); %>',\n '',\n ' tool-link\" href=\"<%= link %>\" target=\"<%- target %>\" minsizehint=\"<%- min_width %>\">',\n '<%- name %>',\n '',\n ' <%- description %>'\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/tool/tools.js\n ** module id = 44\n ** module chunks = 0 3\n **/","/** Renders the color picker used e.g. in the tool form **/\ndefine(['utils/utils'], function( Utils ) {\n return Backbone.View.extend({\n colors: {\n standard: ['c00000','ff0000','ffc000','ffff00','92d050','00b050','00b0f0','0070c0','002060','7030a0'],\n base : ['ffffff','000000','eeece1','1f497d','4f81bd','c0504d','9bbb59','8064a2','4bacc6','f79646'],\n theme :[['f2f2f2','7f7f7f','ddd9c3','c6d9f0','dbe5f1','f2dcdb','ebf1dd','e5e0ec','dbeef3','fdeada'],\n ['d8d8d8','595959','c4bd97','8db3e2','b8cce4','e5b9b7','d7e3bc','ccc1d9','b7dde8','fbd5b5'],\n ['bfbfbf','3f3f3f','938953','548dd4','95b3d7','d99694','c3d69b','b2a2c7','92cddc','fac08f'],\n ['a5a5a5','262626','494429','17365d','366092','953734','76923c','5f497a','31859b','e36c09'],\n ['7f7f7e','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]\n },\n\n initialize : function( options ) {\n this.options = Utils.merge( options, {} );\n this.setElement( this._template() );\n this.$panel = this.$( '.ui-color-picker-panel' );\n this.$view = this.$( '.ui-color-picker-view' );\n this.$value = this.$( '.ui-color-picker-value' );\n this.$header = this.$( '.ui-color-picker-header' );\n this._build();\n this.visible = false;\n this.value( this.options.value );\n this.$boxes = this.$( '.ui-color-picker-box' );\n var self = this;\n this.$boxes.on( 'click', function() {\n self.value( $( this ).css( 'background-color' ) );\n self.$header.trigger( 'click' );\n } );\n this.$header.on( 'click', function() {\n self.visible = !self.visible;\n if ( self.visible ) {\n self.$view.fadeIn( 'fast' );\n } else {\n self.$view.fadeOut( 'fast' );\n }\n } );\n },\n\n /** Get/set value */\n value : function ( new_val ) {\n if ( new_val !== undefined && new_val !== null ) {\n this.$value.css( 'background-color', new_val );\n this.$( '.ui-color-picker-box' ).empty();\n this.$( this._getValue() ).html( this._templateCheck() );\n this.options.onchange && this.options.onchange( new_val );\n }\n return this._getValue();\n },\n\n /** Get value from dom */\n _getValue: function() {\n var rgb = this.$value.css( 'background-color' );\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n if ( rgb ) {\n function hex( x ) {\n return ( '0' + parseInt( x ).toString( 16 ) ).slice( -2 );\n }\n return '#' + hex( rgb[ 1] ) + hex( rgb[ 2 ] ) + hex( rgb[ 3 ] );\n } else {\n return null;\n }\n },\n\n /** Build color panel */\n _build: function() {\n var $content = this._content({\n label : 'Theme Colors',\n colors : this.colors.base,\n padding : 10\n });\n for ( var i in this.colors.theme ) {\n var line_def = {};\n if ( i == 0 ) {\n line_def[ 'bottom' ] = true;\n } else {\n if ( i != this.colors.theme.length - 1 ) {\n line_def[ 'top' ] = true;\n line_def[ 'bottom' ] = true;\n } else {\n line_def[ 'top' ] = true;\n line_def[ 'padding' ] = 5;\n }\n }\n line_def[ 'colors' ] = this.colors.theme[ i ];\n this._content( line_def );\n }\n this._content({\n label : 'Standard Colors',\n colors : this.colors.standard,\n padding : 5\n });\n },\n\n /** Create content */\n _content: function( options ) {\n var label = options.label;\n var colors = options.colors;\n var padding = options.padding;\n var top = options.top;\n var bottom = options.bottom;\n var $content = $( this._templateContent() );\n var $label = $content.find( '.label' );\n if ( options.label ) {\n $label.html( options.label );\n } else {\n $label.hide();\n }\n var $line = $content.find( '.line' );\n this.$panel.append( $content );\n for ( var i in colors ) {\n var $box = $( this._templateBox( colors[ i ] ) );\n if ( top ) {\n $box.css( 'border-top', 'none' );\n $box.css( 'border-top-left-radius', '0px' );\n $box.css( 'border-top-right-radius', '0px' );\n }\n if ( bottom ) {\n $box.css( 'border-bottom', 'none' );\n $box.css( 'border-bottom-left-radius', '0px' );\n $box.css( 'border-bottom-right-radius', '0px' );\n }\n $line.append( $box );\n }\n if (padding) {\n $line.css( 'padding-bottom', padding );\n }\n return $content;\n },\n\n /** Check icon */\n _templateCheck: function() {\n return '
                                  ';\n },\n\n /** Content template */\n _templateContent: function() {\n return '
                                  ' +\n '
                                  ' +\n '
                                  ' +\n '
                                  ';\n },\n\n /** Box template */\n _templateBox: function( color ) {\n return '
                                  ';\n },\n\n /** Main template */\n _template: function() {\n return '
                                  ' +\n '
                                  ' +\n '
                                  ' +\n '
                                  Select a color
                                  ' +\n '
                                  ' +\n '
                                  ' +\n '
                                  ' +\n '
                                  '\n '
                                  ';\n }\n });\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-color-picker.js\n ** module id = 46\n ** module chunks = 0 3\n **/","/** This class creates/wraps a drill down element. */\ndefine([ 'utils/utils', 'mvc/ui/ui-options' ], function( Utils, Options ) {\n\nvar View = Options.BaseIcons.extend({\n initialize: function( options ) {\n options.type = options.display || 'checkbox';\n options.multiple = ( options.type == 'checkbox' );\n Options.BaseIcons.prototype.initialize.call( this, options );\n },\n\n /** Set states for selected values */\n _setValue: function ( new_value ) {\n Options.BaseIcons.prototype._setValue.call( this, new_value );\n if ( new_value !== undefined && new_value !== null && this.header_index ) {\n var self = this;\n var values = $.isArray( new_value ) ? new_value : [ new_value ];\n _.each( values, function( v ) {\n var list = self.header_index[ v ];\n _.each( list, function( element ) {\n self._setState( element, true );\n });\n });\n }\n },\n\n /** Expand/collapse a sub group */\n _setState: function ( header_id, is_expanded ) {\n var $button = this.$( '.button-' + header_id );\n var $subgroup = this.$( '.subgroup-' + header_id );\n $button.data( 'is_expanded', is_expanded );\n if ( is_expanded ) {\n $subgroup.show();\n $button.removeClass( 'fa-plus-square' ).addClass( 'fa-minus-square' );\n } else {\n $subgroup.hide();\n $button.removeClass( 'fa-minus-square' ).addClass( 'fa-plus-square' );\n }\n },\n\n /** Template to create options tree */\n _templateOptions: function() {\n var self = this;\n this.header_index = {};\n\n // attach event handler\n function attach( $el, header_id ) {\n var $button = $el.find( '.button-' + header_id );\n $button.on( 'click', function() {\n self._setState( header_id, !$button.data( 'is_expanded' ) );\n });\n }\n\n // recursive function which iterates through options\n function iterate ( $tmpl, options, header ) {\n header = header || [];\n for ( i in options ) {\n var level = options[ i ];\n var has_options = level.options && level.options.length > 0;\n var new_header = header.slice( 0 );\n self.header_index[ level.value ] = new_header.slice( 0 );\n var $group = $( '
                                  ' );\n if ( has_options ) {\n var header_id = Utils.uid();\n var $button = $( '' ).addClass( 'button-' + header_id ).addClass( 'ui-drilldown-button fa fa-plus-square' );\n var $subgroup = $( '
                                  ' ).addClass( 'subgroup-' + header_id ).addClass( 'ui-drilldown-subgroup' );\n $group.append( $( '
                                  ' )\n .append( $button )\n .append( self._templateOption( { label: level.name, value: level.value } ) ) );\n new_header.push( header_id );\n iterate ( $subgroup, level.options, new_header );\n $group.append( $subgroup );\n attach( $group, header_id );\n } else {\n $group.append( self._templateOption( { label: level.name, value: level.value } ) );\n }\n $tmpl.append( $group );\n }\n }\n\n // iterate through options and create dom\n var $tmpl = $( '
                                  ' );\n iterate( $tmpl, this.model.get( 'data' ) );\n return $tmpl;\n },\n\n /** Template for drill down view */\n _template: function() {\n return $( '
                                  ' ).addClass( 'ui-options-list drilldown-container' ).attr( 'id', this.model.id );\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-drilldown.js\n ** module id = 47\n ** module chunks = 0 3\n **/","define([ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-default' ], function( Utils, Ui, Select ) {\n\n/** Batch mode variations */\nvar Batch = { DISABLED: 'disabled', ENABLED: 'enabled', LINKED: 'linked' };\n\n/** List of available content selectors options */\nvar Configurations = {\n data: [\n { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED },\n { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.LINKED },\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.LINKED } ],\n data_multiple: [\n { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.DISABLED },\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n data_collection: [\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n workflow_data: [\n { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED } ],\n workflow_data_multiple: [\n { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.DISABLED } ],\n workflow_data_collection: [\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED } ],\n module_data: [\n { src: 'hda', icon: 'fa-file-o', tooltip: 'Single dataset', multiple: false, batch: Batch.DISABLED },\n { src: 'hda', icon: 'fa-files-o', tooltip: 'Multiple datasets', multiple: true, batch: Batch.ENABLED } ],\n module_data_collection: [\n { src: 'hdca', icon: 'fa-folder-o', tooltip: 'Dataset collection', multiple: false, batch: Batch.DISABLED },\n { src: 'hdca', icon: 'fa-folder', tooltip: 'Multiple collections', multiple: true, batch: Batch.ENABLED } ]\n};\n\n/** View for hda and hdca content selector ui elements */\nvar View = Backbone.View.extend({\n initialize : function( options ) {\n var self = this;\n this.model = options && options.model || new Backbone.Model({\n src_labels : { 'hda' : 'dataset', 'hdca': 'dataset collection' },\n pagelimit : 100\n }).set( options );\n this.setElement( $( '
                                  ' ).addClass( 'ui-select-content' ) );\n this.button_product = new Ui.RadioButton.View( {\n value : 'false',\n data : [ { icon: 'fa fa-chain', value: 'false',\n tooltip: 'Linked inputs will be run in matched order with other datasets e.g. use this for matching forward and reverse reads.' },\n { icon: 'fa fa-chain-broken', value: 'true',\n tooltip: 'Unlinked dataset inputs will be run against *all* other inputs.' } ] } );\n var $batch_div = $( '
                                  ' ).addClass( 'ui-form-info' )\n .append( $( '' ).addClass( 'fa fa-sitemap' ) )\n .append( $( '' ).html( 'This is a batch mode input field. Separate jobs will be triggered for each dataset selection.' ) );\n this.$batch = {\n linked : $batch_div.clone(),\n enabled : $batch_div.clone().append( $( '
                                  ' )\n .append( $( '
                                  ' ).addClass( 'ui-form-title' ).html( 'Batch options:' ) )\n .append( this.button_product.$el ) )\n .append( $( '
                                  ' ).css( 'clear', 'both' ) )\n };\n\n // track current history elements\n this.history = {};\n\n // add listeners\n this.listenTo( this.model, 'change:data', this._changeData, this );\n this.listenTo( this.model, 'change:wait', this._changeWait, this );\n this.listenTo( this.model, 'change:current', this._changeCurrent, this );\n this.listenTo( this.model, 'change:value', this._changeValue, this );\n this.listenTo( this.model, 'change:type change:optional change:multiple change:extensions', this._changeType, this );\n this.render();\n\n // add change event\n this.on( 'change', function() { options.onchange && options.onchange( self.value() ) } );\n },\n\n render: function() {\n this._changeType();\n this._changeValue();\n this._changeWait();\n },\n\n /** Indicate that select fields are being updated */\n wait: function() {\n this.model.set( 'wait', true );\n },\n\n /** Indicate that the options update has been completed */\n unwait: function() {\n this.model.set( 'wait', false );\n },\n\n /** Update data representing selectable options */\n update: function( options ) {\n this.model.set( 'data', options );\n },\n\n /** Return the currently selected dataset values */\n value: function ( new_value ) {\n new_value !== undefined && this.model.set( 'value', new_value );\n var current = this.model.get( 'current' );\n if ( this.config[ current ] ) {\n var id_list = this.fields[ current ].value();\n if (id_list !== null) {\n id_list = $.isArray( id_list ) ? id_list : [ id_list ];\n if ( id_list.length > 0 ) {\n var result = this._batch( { values: [] } );\n for ( var i in id_list ) {\n var details = this.history[ id_list[ i ] + '_' + this.config[ current ].src ];\n if ( details ) {\n result.values.push( details );\n } else {\n Galaxy.emit.debug( 'ui-select-content::value()', 'Requested details not found for \\'' + id_list[ i ] + '\\'.' );\n return null;\n }\n }\n result.values.sort( function( a, b ) { return a.hid - b.hid } );\n return result;\n }\n }\n } else {\n Galaxy.emit.debug( 'ui-select-content::value()', 'Invalid value/source \\'' + new_value + '\\'.' );\n }\n return null;\n },\n\n /** Change of current select field */\n _changeCurrent: function() {\n var self = this;\n _.each( this.fields, function( field, i ) {\n if ( self.model.get( 'current' ) == i ) {\n field.$el.show();\n _.each( self.$batch, function( $batchfield, batchmode ) {\n $batchfield[ self.config[ i ].batch == batchmode ? 'show' : 'hide' ]();\n });\n self.button_type.value( i );\n } else {\n field.$el.hide();\n }\n });\n },\n\n /** Change of type */\n _changeType: function() {\n var self = this;\n\n // identify selector type identifier i.e. [ flavor ]_[ type ]_[ multiple ]\n var config_id = ( this.model.get( 'flavor' ) ? this.model.get( 'flavor' ) + '_' : '' ) +\n String( this.model.get( 'type' ) ) + ( this.model.get( 'multiple' ) ? '_multiple' : '' );\n if ( Configurations[ config_id ] ) {\n this.config = Configurations[ config_id ];\n } else {\n this.config = Configurations[ 'data' ];\n Galaxy.emit.debug( 'ui-select-content::_changeType()', 'Invalid configuration/type id \\'' + config_id + '\\'.' );\n }\n\n // prepare extension component of error message\n var data = self.model.get( 'data' );\n var extensions = Utils.textify( this.model.get( 'extensions' ) );\n var src_labels = this.model.get( 'src_labels' );\n\n // build views\n this.fields = [];\n this.button_data = [];\n _.each( this.config, function( c, i ) {\n self.button_data.push({\n value : i,\n icon : c.icon,\n tooltip : c.tooltip\n });\n self.fields.push(\n new Select.View({\n optional : self.model.get( 'optional' ),\n multiple : c.multiple,\n searchable : !c.multiple || ( data && data[ c.src ] && data[ c.src ].length > self.model.get( 'pagelimit' ) ),\n selectall : false,\n error_text : 'No ' + ( extensions ? extensions + ' ' : '' ) + ( src_labels[ c.src ] || 'content' ) + ' available.',\n onchange : function() {\n self.trigger( 'change' );\n }\n })\n );\n });\n this.button_type = new Ui.RadioButton.View({\n value : this.model.get( 'current' ),\n data : this.button_data,\n onchange: function( value ) {\n self.model.set( 'current', value );\n self.trigger( 'change' );\n }\n });\n\n // append views\n this.$el.empty();\n var button_width = 0;\n if ( this.fields.length > 1 ) {\n this.$el.append( this.button_type.$el );\n button_width = Math.max( 0, this.fields.length * 36 ) + 'px';\n }\n _.each( this.fields, function( field ) {\n self.$el.append( field.$el.css( { 'margin-left': button_width } ) );\n });\n _.each( this.$batch, function( $batchfield, batchmode ) {\n self.$el.append( $batchfield.css( { 'margin-left': button_width } ) );\n });\n this.model.set( 'current', 0 );\n this._changeCurrent();\n this._changeData();\n },\n\n /** Change of wait flag */\n _changeWait: function() {\n var self = this;\n _.each( this.fields, function( field ) { field[ self.model.get( 'wait' ) ? 'wait' : 'unwait' ]() } );\n },\n\n /** Change of available options */\n _changeData: function() {\n var options = this.model.get( 'data' );\n var self = this;\n var select_options = {};\n _.each( options, function( items, src ) {\n select_options[ src ] = [];\n _.each( items, function( item ) {\n select_options[ src ].push({\n hid : item.hid,\n keep : item.keep,\n label: item.hid + ': ' + item.name,\n value: item.id\n });\n self.history[ item.id + '_' + src ] = item;\n });\n });\n _.each( this.config, function( c, i ) {\n select_options[ c.src ] && self.fields[ i ].add( select_options[ c.src ], function( a, b ) { return b.hid - a.hid } );\n });\n },\n\n /** Change of incoming value */\n _changeValue: function () {\n var new_value = this.model.get( 'value' );\n if ( new_value && new_value.values && new_value.values.length > 0 ) {\n // create list with content ids\n var list = [];\n _.each( new_value.values, function( value ) {\n list.push( value.id );\n });\n // sniff first suitable field type from config list\n var src = new_value.values[ 0 ].src;\n var multiple = new_value.values.length > 1;\n for( var i = 0; i < this.config.length; i++ ) {\n var field = this.fields[ i ];\n var c = this.config[ i ];\n if ( c.src == src && [ multiple, true ].indexOf( c.multiple ) !== -1 ) {\n this.model.set( 'current', i );\n field.value( list );\n break;\n }\n }\n } else {\n _.each( this.fields, function( field ) {\n field.value( null );\n });\n }\n },\n\n /** Assists in identifying the batch mode */\n _batch: function( result ) {\n result[ 'batch' ] = false;\n var current = this.model.get( 'current' );\n var config = this.config[ current ];\n if ( config.src == 'hdca' && !config.multiple ) {\n var hdca = this.history[ this.fields[ current ].value() + '_hdca' ];\n if ( hdca && hdca.map_over_type ) {\n result[ 'batch' ] = true;\n }\n }\n if ( config.batch == Batch.LINKED || config.batch == Batch.ENABLED ) {\n result[ 'batch' ] = true;\n if ( config.batch == Batch.ENABLED && this.button_product.value() === 'true' ) {\n result[ 'product' ] = true;\n }\n }\n return result;\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-select-content.js\n ** module id = 48\n ** module chunks = 0 3\n **/","// dependencies\ndefine(['utils/utils', 'mvc/ui/ui-list'],\n function(Utils, List) {\n\n/**\n * FTP file selector\n */\nvar View = Backbone.View.extend({\n // initialize\n initialize : function(options) {\n // link this\n var self = this;\n\n // create ui-list view to keep track of selected ftp files\n this.ftpfile_list = new List.View({\n name : 'file',\n optional : options.optional,\n multiple : options.multiple,\n onchange : function() {\n options.onchange && options.onchange(self.value());\n }\n });\n\n // create elements\n this.setElement(this.ftpfile_list.$el);\n\n // initial fetch of ftps\n Utils.get({\n url : Galaxy.root + 'api/remote_files',\n success : function(response) {\n var data = [];\n for (var i in response) {\n data.push({\n value : response[i]['path'],\n label : response[i]['path']\n });\n }\n self.ftpfile_list.update(data);\n }\n });\n },\n\n /** Return/Set currently selected ftp datasets */\n value: function(val) {\n return this.ftpfile_list.value(val);\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-select-ftp.js\n ** module id = 49\n ** module chunks = 0 3\n **/","// dependencies\ndefine(['utils/utils', 'mvc/ui/ui-misc', 'mvc/ui/ui-table', 'mvc/ui/ui-list'],\n function(Utils, Ui, Table, List) {\n\n// collection of libraries\nvar Libraries = Backbone.Collection.extend({\n url: Galaxy.root + 'api/libraries?deleted=false'\n});\n\n// collection of dataset\nvar LibraryDatasets = Backbone.Collection.extend({\n initialize: function() {\n var self = this;\n this.config = new Backbone.Model({ library_id: null });\n this.config.on('change', function() {\n self.fetch({ reset: true });\n });\n },\n url: function() {\n return Galaxy.root + 'api/libraries/' + this.config.get('library_id') + '/contents';\n }\n});\n\n// hda/hdca content selector ui element\nvar View = Backbone.View.extend({\n // initialize\n initialize : function(options) {\n // link this\n var self = this;\n\n // collections\n this.libraries = new Libraries();\n this.datasets = new LibraryDatasets();\n\n // link app and options\n this.options = options;\n\n // select field for the library\n // TODO: Remove this once the library API supports searching for library datasets\n this.library_select = new Ui.Select.View({\n onchange : function(value) {\n self.datasets.config.set('library_id', value);\n }\n });\n\n // create ui-list view to keep track of selected data libraries\n this.dataset_list = new List.View({\n name : 'dataset',\n optional : options.optional,\n multiple : options.multiple,\n onchange : function() {\n self.trigger('change');\n }\n });\n\n // add reset handler for fetched libraries\n this.libraries.on('reset', function() {\n var data = [];\n self.libraries.each(function(model) {\n data.push({\n value : model.id,\n label : model.get('name')\n });\n });\n self.library_select.update(data);\n });\n\n // add reset handler for fetched library datasets\n this.datasets.on('reset', function() {\n var data = [];\n var library_current = self.library_select.text();\n if (library_current !== null) {\n self.datasets.each(function(model) {\n if (model.get('type') === 'file') {\n data.push({\n value : model.id,\n label : model.get('name')\n });\n }\n });\n }\n self.dataset_list.update(data);\n });\n\n // add change event. fires on trigger\n this.on('change', function() {\n options.onchange && options.onchange(self.value());\n });\n\n // create elements\n this.setElement(this._template());\n this.$('.library-select').append(this.library_select.$el);\n this.$el.append(this.dataset_list.$el);\n\n // initial fetch of libraries\n this.libraries.fetch({\n reset: true,\n success: function() {\n self.library_select.trigger('change');\n if (self.options.value !== undefined) {\n self.value(self.options.value);\n }\n }\n });\n },\n\n /** Return/Set currently selected library datasets */\n value: function(val) {\n return this.dataset_list.value(val);\n },\n\n /** Template */\n _template: function() {\n return '
                                  ' +\n '
                                  ' +\n 'Select Library' +\n '' +\n '
                                  ' +\n '
                                  ';\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-select-library.js\n ** module id = 50\n ** module chunks = 0 3\n **/","define([ 'utils/utils' ], function( Utils ) {\nvar View = Backbone.View.extend({\n initialize : function( options ) {\n var self = this;\n this.options = Utils.merge( options, {\n id : Utils.uid(),\n min : null,\n max : null,\n step : null,\n precise : false,\n split : 10000\n } );\n\n // create new element\n this.setElement( this._template( this.options ) );\n\n // determine wether to use the slider\n this.useslider = this.options.max !== null && this.options.min !== null && this.options.max > this.options.min;\n\n // set default step size\n if ( this.options.step === null ) {\n this.options.step = 1.0;\n if ( this.options.precise && this.useslider ) {\n this.options.step = ( this.options.max - this.options.min ) / this.options.split;\n }\n }\n\n // create slider if min and max are defined properly\n if ( this.useslider ) {\n this.$slider = this.$( '#slider' );\n this.$slider.slider( this.options );\n this.$slider.on( 'slide', function ( event, ui ) {\n self.value( ui.value );\n });\n } else {\n this.$( '.ui-form-slider-text' ).css( 'width', '100%' );\n }\n\n // link text input field\n this.$text = this.$( '#text' );\n\n // set initial value\n this.options.value !== undefined && ( this.value( this.options.value ) );\n\n // add text field event\n var pressed = [];\n this.$text.on( 'change', function () {\n self.value( $( this ).val() );\n });\n this.$text.on( 'keyup', function( e ) {\n pressed[e.which] = false;\n self.options.onchange && self.options.onchange( $( this ).val() );\n });\n this.$text.on( 'keydown', function ( e ) {\n var v = e.which;\n pressed[ v ] = true;\n if ( self.options.is_workflow && pressed[ 16 ] && v == 52 ) {\n self.value( '$' )\n event.preventDefault();\n } else if (!( v == 8 || v == 9 || v == 13 || v == 37 || v == 39 || ( v >= 48 && v <= 57 && !pressed[ 16 ] ) || ( v >= 96 && v <= 105 )\n || ( ( v == 190 || v == 110 ) && $( this ).val().indexOf( '.' ) == -1 && self.options.precise )\n || ( ( v == 189 || v == 109 ) && $( this ).val().indexOf( '-' ) == -1 )\n || self._isParameter( $( this ).val() )\n || pressed[ 91 ] || pressed[ 17 ] ) ) {\n event.preventDefault();\n }\n });\n },\n\n /** Set and Return the current value\n */\n value : function ( new_val ) {\n if ( new_val !== undefined ) {\n if ( new_val !== null && new_val !== '' && !this._isParameter( new_val ) ) {\n isNaN( new_val ) && ( new_val = 0 );\n this.options.max !== null && ( new_val = Math.min( new_val, this.options.max ) );\n this.options.min !== null && ( new_val = Math.max( new_val, this.options.min ) );\n }\n this.$slider && this.$slider.slider( 'value', new_val );\n this.$text.val( new_val );\n this.options.onchange && this.options.onchange( new_val );\n }\n return this.$text.val();\n },\n\n /** Return true if the field contains a workflow parameter i.e. $('name')\n */\n _isParameter: function( value ) {\n return this.options.is_workflow && String( value ).substring( 0, 1 ) === '$';\n },\n\n /** Slider template\n */\n _template: function( options ) {\n return '
                                  ' +\n '' +\n '
                                  ' +\n '
                                  ';\n }\n});\n\nreturn {\n View : View\n};\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-slider.js\n ** module id = 51\n ** module chunks = 0 3\n **/","// dependencies\ndefine(['utils/utils'], function(Utils) {\n\n/**\n * This class creates a ui table element.\n */\nvar View = Backbone.View.extend({\n // current row\n row: null,\n \n // count rows\n row_count: 0,\n \n // defaults options\n optionsDefault: {\n content : 'No content available.',\n onchange : null,\n ondblclick : null,\n onconfirm : null,\n cls : 'ui-table',\n cls_tr : ''\n },\n \n // events\n events : {\n 'click' : '_onclick',\n 'dblclick' : '_ondblclick'\n },\n \n // initialize\n initialize : function(options) {\n // configure options\n this.options = Utils.merge(options, this.optionsDefault);\n \n // create new element\n var $el = $(this._template(this.options));\n \n // link sub-elements\n this.$thead = $el.find('thead');\n this.$tbody = $el.find('tbody');\n this.$tmessage = $el.find('tmessage');\n \n // set element\n this.setElement($el);\n \n // initialize row\n this.row = this._row();\n },\n \n // add header cell\n addHeader: function($el) {\n var wrapper = $('
                                  ' +\n '' +\n '' +\n '
                                  ' +\n '' + options.content + '' +\n '
                                  ';\n }\n});\n\nreturn {\n View: View\n}\n\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/ui-table.js\n ** module id = 52\n ** module chunks = 0 3\n **/","define( [], function() {\n var Model = Backbone.Model.extend({\n defaults: {\n extension : 'auto',\n genome : '?',\n url_paste : '',\n status : 'init',\n info : null,\n file_name : '',\n file_mode : '',\n file_size : 0,\n file_type : null,\n file_path : '',\n file_data : null,\n percentage : 0,\n space_to_tab : false,\n to_posix_lines : true,\n enabled : true\n },\n reset: function( attr ) {\n this.clear().set( this.defaults ).set( attr );\n }\n });\n var Collection = Backbone.Collection.extend( { model: Model } );\n return { Model: Model, Collection : Collection };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/upload/upload-model.js\n ** module id = 53\n ** module chunks = 3\n **/","/**\n * This class defines a queue to ensure that multiple deferred callbacks are executed sequentially.\n */\ndefine(['utils/utils'], function( Utils ) {\nreturn Backbone.Model.extend({\n initialize: function(){\n this.active = {};\n this.last = null;\n },\n\n /** Adds a callback to the queue. Upon execution a deferred object is parsed to the callback i.e. callback( deferred ).\n * If the callback does not take any arguments, the deferred is resolved instantly.\n */\n execute: function( callback ) {\n var self = this;\n var id = Utils.uid();\n var has_deferred = callback.length > 0;\n\n // register process\n this.active[ id ] = true;\n\n // deferred process\n var process = $.Deferred();\n process.promise().always(function() {\n delete self.active[ id ];\n has_deferred && Galaxy.emit.debug( 'deferred::execute()', this.state().charAt(0).toUpperCase() + this.state().slice(1) + ' ' + id );\n });\n\n // deferred queue\n $.when( this.last ).always(function() {\n if ( self.active[ id ] ) {\n has_deferred && Galaxy.emit.debug( 'deferred::execute()', 'Running ' + id );\n callback( process );\n !has_deferred && process.resolve();\n } else {\n process.reject();\n }\n });\n this.last = process.promise();\n },\n\n /** Resets the promise queue. All currently queued but unexecuted callbacks/promises will be rejected.\n */\n reset: function() {\n Galaxy.emit.debug('deferred::execute()', 'Reset');\n for ( var i in this.active ) {\n this.active[ i ] = false;\n }\n },\n\n /** Returns true if all processes are done.\n */\n ready: function() {\n return $.isEmptyObject( this.active );\n }\n});\n\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/utils/deferred.js\n ** module id = 55\n ** module chunks = 0 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/annotation.js\n ** module id = 66\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/base/controlled-fetch-collection.js\n ** module id = 67\n ** module chunks = 3\n **/","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 },\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 ], '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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-view.js\n ** module id = 68\n ** module chunks = 3\n **/","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 : this.model.urls.edit,\n target : this.linkTarget,\n faIcon : 'fa-pencil',\n classes : 'edit-btn'\n };\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 /** 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() ]);\n case STATES.OK:\n case STATES.FAILED_METADATA:\n return actions.concat([ this._renderRerunButton(), this._renderVisualizationsButton() ]);\n }\n return actions.concat([ this._renderRerunButton() ]);\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 : this.model.urls.report_error,\n classes : 'report-error-btn',\n target : this.linkTarget,\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 // create webpack split point in order to load the tool form async\n // TODO: split not working (tool loads fine)\n require([ 'mvc/tool/tool-form' ], function( ToolForm ){\n var form = new ToolForm.View({ 'job_id' : creating_job });\n form.deferred.execute( function(){\n Galaxy.app.display( form );\n });\n });\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/dataset/dataset-li-edit.js\n ** module id = 69\n ** module chunks = 3\n **/","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?to_ext=' + this.get( 'file_ext' ),\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 /** 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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/dataset/dataset-model.js\n ** module id = 70\n ** module chunks = 3\n **/","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 ], '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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hda-li.js\n ** module id = 71\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hda-model.js\n ** module id = 72\n ** module chunks = 3\n **/","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\n this.listenTo( this.model, {\n '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 ], '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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hdca-li.js\n ** module id = 73\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-content-model.js\n ** module id = 74\n ** module chunks = 3\n **/","\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( 0 ); }\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-model.js\n ** module id = 75\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/list/list-view.js\n ** module id = 76\n ** module chunks = 3\n **/","define([\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( baseMVC, _l ){\n// =============================================================================\n/** A view on any model that has a 'tags' attribute (a list of tag strings)\n * Incorporates the select2 jQuery plugin for tags display/editing:\n * http://ivaynberg.github.io/select2/\n */\nvar TagsEditor = Backbone.View\n .extend( baseMVC.LoggableMixin )\n .extend( baseMVC.HiddenUntilActivatedViewMixin ).extend({\n\n tagName : 'div',\n className : 'tags-display',\n\n /** Set up listeners, parse options */\n initialize : function( options ){\n //console.debug( this, options );\n // only listen to the model only for changes to tags - re-render\n this.listenTo( this.model, 'change:tags', 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 this.$input().select2({\n placeholder : 'Add tags',\n width : '100%',\n tags : function(){\n // initialize possible tags in the dropdown based on all the tags the user has used so far\n return view._getTagsUsed();\n }\n });\n\n this._setUpBehaviors();\n return this;\n },\n\n /** @returns {String} the html text used to build the view's DOM */\n _template : function(){\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 ].join( '' );\n },\n\n /** @returns {String} the sorted, comma-separated tags from the model */\n tagsToCSV : function(){\n var tagsArray = this.model.get( 'tags' );\n if( !_.isArray( tagsArray ) || _.isEmpty( tagsArray ) ){\n return '';\n }\n return tagsArray.map( function( tag ){\n return _.escape( tag );\n }).sort().join( ',' );\n },\n\n /** @returns {jQuery} the input for this view */\n $input : function(){\n return this.$el.find( 'input.tags-input' );\n },\n\n /** @returns {String[]} all tags used by the current user */\n _getTagsUsed : function(){\n//TODO: global\n return Galaxy.user.get( 'tags_used' );\n },\n\n /** set up any event listeners on the view's DOM (mostly handled by select2) */\n _setUpBehaviors : function(){\n var view = this;\n this.$input().on( 'change', function( event ){\n // save the model's tags in either remove or added event\n view.model.save({ tags: event.val }, { silent: true });\n // if it's new, add the tag to the users tags\n if( event.added ){\n //??: solve weird behavior in FF on test.galaxyproject.org where\n // event.added.text is string object: 'String{ 0=\"o\", 1=\"n\", 2=\"e\" }'\n view._addNewTagToTagsUsed( event.added.text + '' );\n }\n });\n },\n\n /** add a new tag (if not already there) to the list of all tags used by the user\n * @param {String} newTag the tag to add to the list of used\n */\n _addNewTagToTagsUsed : function( newTag ){\n//TODO: global\n var tagsUsed = Galaxy.user.get( 'tags_used' );\n if( !_.contains( tagsUsed, newTag ) ){\n tagsUsed.push( newTag );\n tagsUsed.sort();\n Galaxy.user.set( 'tags_used', tagsUsed );\n }\n },\n\n /** shut down event listeners and remove this view's DOM */\n remove : function(){\n this.$input.off();\n this.stopListening( this.model );\n Backbone.View.prototype.remove.call( this );\n },\n\n /** string rep */\n toString : function(){ return [ 'TagsEditor(', this.model + '', ')' ].join(''); }\n});\n\n// =============================================================================\nreturn {\n TagsEditor : TagsEditor\n};\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/tag.js\n ** module id = 77\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/error-modal.js\n ** module id = 78\n ** module chunks = 3\n **/","define([\n    //jquery\n    //backbone\n], function(){\n// =============================================================================\n/**\n * view for a popup menu\n */\nvar PopupMenu = Backbone.View.extend({\n//TODO: maybe better as singleton off the Galaxy obj\n    /** Cache the desired button element and options, set up the button click handler\n     *  NOTE: attaches this view as HTML/jQ data on the button for later use.\n     */\n    initialize: function( $button, options ){\n        // default settings\n        this.$button = $button;\n        if( !this.$button.length ){\n            this.$button = $( '
                                  ' );\n }\n this.options = options || [];\n this.$button.data( 'popupmenu', this );\n\n // set up button click -> open menu behavior\n var menu = this;\n this.$button.click( function( event ){\n // if there's already a menu open, remove it\n $( '.popmenu-wrapper' ).remove();\n menu._renderAndShow( event );\n return false;\n });\n },\n\n // render the menu, append to the page body at the click position, and set up the 'click-away' handlers, show\n _renderAndShow: function( clickEvent ){\n this.render();\n this.$el.appendTo( 'body' ).css( this._getShownPosition( clickEvent )).show();\n this._setUpCloseBehavior();\n },\n\n // render the menu\n // this menu doesn't attach itself to the DOM ( see _renderAndShow )\n render: function(){\n // render the menu body absolute and hidden, fill with template\n this.$el.addClass( 'popmenu-wrapper' ).hide()\n .css({ position : 'absolute' })\n .html( this.template( this.$button.attr( 'id' ), this.options ));\n\n // set up behavior on each link/anchor elem\n if( this.options.length ){\n var menu = this;\n //precondition: there should be one option per li\n this.$el.find( 'li' ).each( function( i, li ){\n var option = menu.options[i];\n\n // if the option has 'func', call that function when the anchor is clicked\n if( option.func ){\n $( this ).children( 'a.popupmenu-option' ).click( function( event ){\n option.func.call( menu, event, option );\n // We must preventDefault otherwise clicking \"cancel\"\n // on a purge or something still navigates and causes\n // the action.\n event.preventDefault();\n // bubble up so that an option click will call the close behavior\n });\n }\n });\n }\n return this;\n },\n\n template : function( id, options ){\n return [\n '
                                    ', this._templateOptions( options ), '
                                  '\n ].join( '' );\n },\n\n _templateOptions : function( options ){\n if( !options.length ){\n return '
                                • (no options)
                                • ';\n }\n return _.map( options, function( option ){\n if( option.divider ){\n return '
                                • ';\n } else if( option.header ){\n return [ '
                                • ', option.html, '
                                • ' ].join( '' );\n }\n var href = option.href || 'javascript:void(0);',\n target = ( option.target )?( ' target=\"' + option.target + '\"' ):( '' ),\n check = ( option.checked )?( '' ):( '' );\n return [\n '
                                • ',\n check, option.html,\n '
                                • '\n ].join( '' );\n }).join( '' );\n },\n\n // get the absolute position/offset for the menu\n _getShownPosition : function( clickEvent ){\n\n // display menu horiz. centered on click...\n var menuWidth = this.$el.width();\n var x = clickEvent.pageX - menuWidth / 2 ;\n\n // adjust to handle horiz. scroll and window dimensions ( draw entirely on visible screen area )\n x = Math.min( x, $( document ).scrollLeft() + $( window ).width() - menuWidth - 5 );\n x = Math.max( x, $( document ).scrollLeft() + 5 );\n return {\n top: clickEvent.pageY,\n left: x\n };\n },\n\n // bind an event handler to all available frames so that when anything is clicked\n // the menu is removed from the DOM and the event handler unbinds itself\n _setUpCloseBehavior: function(){\n var menu = this;\n//TODO: alternately: focus hack, blocking overlay, jquery.blockui\n\n // function to close popup and unbind itself\n function closePopup( event ){\n $( document ).off( 'click.close_popup' );\n if( window && window.parent !== window ){\n try {\n $( window.parent.document ).off( \"click.close_popup\" );\n } catch( err ){}\n } else {\n try {\n $( 'iframe#galaxy_main' ).contents().off( \"click.close_popup\" );\n } catch( err ){}\n }\n menu.remove();\n }\n\n $( 'html' ).one( \"click.close_popup\", closePopup );\n if( window && window.parent !== window ){\n try {\n $( window.parent.document ).find( 'html' ).one( \"click.close_popup\", closePopup );\n } catch( err ){}\n } else {\n try {\n $( 'iframe#galaxy_main' ).contents().one( \"click.close_popup\", closePopup );\n } catch( err ){}\n }\n },\n\n // add a menu option/item at the given index\n addItem: function( item, index ){\n // append to end if no index\n index = ( index >= 0 ) ? index : this.options.length;\n this.options.splice( index, 0, item );\n return this;\n },\n\n // remove a menu option/item at the given index\n removeItem: function( index ){\n if( index >=0 ){\n this.options.splice( index, 1 );\n }\n return this;\n },\n\n // search for a menu option by its html\n findIndexByHtml: function( html ){\n for( var i = 0; i < this.options.length; i++ ){\n if( _.has( this.options[i], 'html' ) && ( this.options[i].html === html )){\n return i;\n }\n }\n return null;\n },\n\n // search for a menu option by its html\n findItemByHtml: function( html ){\n return this.options[( this.findIndexByHtml( html ))];\n },\n\n // string representation\n toString: function(){\n return 'PopupMenu';\n }\n});\n/** shortcut to new for when you don't need to preserve the ref */\nPopupMenu.create = function _create( $button, options ){\n return new PopupMenu( $button, options );\n};\n\n// -----------------------------------------------------------------------------\n// the following class functions are bridges from the original make_popupmenu and make_popup_menus\n// to the newer backbone.js PopupMenu\n\n/** Create a PopupMenu from simple map initial_options activated by clicking button_element.\n * Converts initial_options to object array used by PopupMenu.\n * @param {jQuery|DOMElement} button_element element which, when clicked, activates menu\n * @param {Object} initial_options map of key -> values, where\n * key is option text, value is fn to call when option is clicked\n * @returns {PopupMenu} the PopupMenu created\n */\nPopupMenu.make_popupmenu = function( button_element, initial_options ){\n var convertedOptions = [];\n _.each( initial_options, function( optionVal, optionKey ){\n var newOption = { html: optionKey };\n\n // keys with null values indicate: header\n if( optionVal === null ){ // !optionVal? (null only?)\n newOption.header = true;\n\n // keys with function values indicate: a menu option\n } else if( jQuery.type( optionVal ) === 'function' ){\n newOption.func = optionVal;\n }\n //TODO:?? any other special optionVals?\n // there was no divider option originally\n convertedOptions.push( newOption );\n });\n return new PopupMenu( $( button_element ), convertedOptions );\n};\n\n/** Find all anchors in $parent (using selector) and covert anchors into a PopupMenu options map.\n * @param {jQuery} $parent the element that contains the links to convert to options\n * @param {String} selector jq selector string to find links\n * @returns {Object[]} the options array to initialize a PopupMenu\n */\n//TODO: lose parent and selector, pass in array of links, use map to return options\nPopupMenu.convertLinksToOptions = function( $parent, selector ){\n $parent = $( $parent );\n selector = selector || 'a';\n var options = [];\n $parent.find( selector ).each( function( elem, i ){\n var option = {}, $link = $( elem );\n\n // convert link text to the option text (html) and the href into the option func\n option.html = $link.text();\n if( $link.attr( 'href' ) ){\n var linkHref = $link.attr( 'href' ),\n linkTarget = $link.attr( 'target' ),\n confirmText = $link.attr( 'confirm' );\n\n option.func = function(){\n // if there's a \"confirm\" attribute, throw up a confirmation dialog, and\n // if the user cancels - do nothing\n if( ( confirmText ) && ( !confirm( confirmText ) ) ){ return; }\n\n // if there's no confirm attribute, or the user accepted the confirm dialog:\n switch( linkTarget ){\n // relocate the center panel\n case '_parent':\n window.parent.location = linkHref;\n break;\n\n // relocate the entire window\n case '_top':\n window.top.location = linkHref;\n break;\n\n // relocate this panel\n default:\n window.location = linkHref;\n }\n };\n }\n options.push( option );\n });\n return options;\n};\n\n/** Create a single popupmenu from existing DOM button and anchor elements\n * @param {jQuery} $buttonElement the element that when clicked will open the menu\n * @param {jQuery} $menuElement the element that contains the anchors to convert into a menu\n * @param {String} menuElementLinkSelector jq selector string used to find anchors to be made into menu options\n * @returns {PopupMenu} the PopupMenu (Backbone View) that can render, control the menu\n */\nPopupMenu.fromExistingDom = function( $buttonElement, $menuElement, menuElementLinkSelector ){\n $buttonElement = $( $buttonElement );\n $menuElement = $( $menuElement );\n var options = PopupMenu.convertLinksToOptions( $menuElement, menuElementLinkSelector );\n // we're done with the menu (having converted it to an options map)\n $menuElement.remove();\n return new PopupMenu( $buttonElement, options );\n};\n\n/** Create all popupmenus within a document or a more specific element\n * @param {DOMElement} parent the DOM element in which to search for popupmenus to build (defaults to document)\n * @param {String} menuSelector jq selector string to find popupmenu menu elements (defaults to \"div[popupmenu]\")\n * @param {Function} buttonSelectorBuildFn the function to build the jq button selector.\n * Will be passed $menuElement, parent.\n * (Defaults to return '#' + $menuElement.attr( 'popupmenu' ); )\n * @returns {PopupMenu[]} array of popupmenus created\n */\nPopupMenu.make_popup_menus = function( parent, menuSelector, buttonSelectorBuildFn ){\n parent = parent || document;\n // orig. Glx popupmenu menus have a (non-std) attribute 'popupmenu'\n // which contains the id of the button that activates the menu\n menuSelector = menuSelector || 'div[popupmenu]';\n // default to (orig. Glx) matching button to menu by using the popupmenu attr of the menu as the id of the button\n buttonSelectorBuildFn = buttonSelectorBuildFn || function( $menuElement, parent ){\n return '#' + $menuElement.attr( 'popupmenu' );\n };\n\n // aggregate and return all PopupMenus\n var popupMenusCreated = [];\n $( parent ).find( menuSelector ).each( function(){\n var $menuElement = $( this ),\n $buttonElement = $( parent ).find( buttonSelectorBuildFn( $menuElement, parent ) );\n popupMenusCreated.push( PopupMenu.fromDom( $buttonElement, $menuElement ) );\n $buttonElement.addClass( 'popup' );\n });\n return popupMenusCreated;\n};\n\n\n// =============================================================================\n return PopupMenu;\n});\n\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/ui/popup-menu.js\n ** module id = 79\n ** module chunks = 3\n **/","/** 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 ( 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 ( 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 '' +\n '
                                  ' +\n '' + options.path + '' +\n '' + Utils.bytesToString( options.size ) + '' +\n '' + options.ctime + '' +\n '';\n },\n\n /** Template of table */\n _templateTable: function() {\n return 'Available files: ' +\n '' +\n '' +\n '  ' +\n '' +\n '' +\n '' +\n '' +\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/upload/upload-ftp.js\n ** module id = 80\n ** module chunks = 3\n **/","/** 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 ' from table fragments\n\t\t\t\t\tif ( !support.tbody ) {\n\t\n\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/upload/upload-settings.js\n ** module id = 81\n ** module chunks = 3\n **/","(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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/ui/hoverhighlight.js\n ** module id = 84\n ** module chunks = 3\n **/","// 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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/ui/search-input.js\n ** module id = 85\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/utils/natural-sort.js\n ** module id = 87\n ** module chunks = 3\n **/","/*\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 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 if (xhr.responseText) {\n try {\n response = jQuery.parseJSON(xhr.responseText);\n } catch (e) {\n response = xhr.responseText;\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 + ')');\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/utils/uploadbox.js\n ** module id = 88\n ** module chunks = 3\n **/","var RightPanel = require( 'layout/panel' ).RightPanel,\n 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 = RightPanel.extend({\n\n title : _l( 'History' ),\n\n initialize : function( options ){\n RightPanel.prototype.initialize.call( this, options );\n this.options = _.pick( options, 'userIsAnonymous', 'allow_user_dataset_purge', 'galaxyRoot' );\n\n // view of the current history\n this.historyView = new CurrentHistoryView({\n className : CurrentHistoryView.prototype.className + ' middle',\n purgeAllowed : options.allow_user_dataset_purge,\n linkTarget : 'galaxy_main'\n });\n },\n\n /** override to change footer selector */\n $toggleButton : function(){\n return this.$( '.footer > .panel-collapse' );\n },\n\n render : function(){\n RightPanel.prototype.render.call( this );\n this.optionsMenu = historyOptionsMenu( this.$( '#history-options-button' ), {\n anonymous : this.options.userIsAnonymous,\n purgeAllowed : this.options.allow_user_dataset_purge,\n root : this.options.galaxyRoot\n });\n this.$( '> .header .buttons [title]' ).tooltip({ placement: 'bottom' });\n this.historyView.setElement( this.$( '.history-panel' ) );\n this.$el.attr( 'class', 'history-right-panel' );\n },\n\n /** override to add buttons */\n _templateHeader: function( data ){\n var historyUrl = this.options.galaxyRoot + 'history';\n var multiUrl = this.options.galaxyRoot + 'history/view_multiple';\n return [\n '
                                  ',\n '
                                  ',\n // this button re-fetches the history and contents and re-renders the history panel\n '',\n // opens a drop down menu with history related functions (like view all, delete, share, etc.)\n '',\n !this.options.userIsAnonymous?\n [ '' ].join('') : '',\n '
                                  ',\n '
                                  ', _.escape( this.title ), '
                                  ',\n '
                                  ',\n ].join('');\n },\n\n /** add history view div */\n _templateBody : function( data ){\n return [\n '
                                  ',\n ].join('');\n },\n\n /** override to use simplified selector */\n _templateFooter: function( data ){\n return [\n '
                                  ',\n '
                                  ',\n '
                                  ',\n '
                                  ',\n ].join('');\n },\n\n events : {\n 'click #history-refresh-button' : '_clickRefresh',\n // override to change footer selector\n 'mousedown .footer > .drag' : '_mousedownDragHandler',\n 'click .footer > .panel-collapse' : 'toggle'\n },\n\n _clickRefresh : function( ev ){\n ev.preventDefault();\n this.historyView.loadCurrentHistory();\n },\n\n toString : function(){ return 'HistoryPanel'; }\n});\n\nmodule.exports = HistoryPanel;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/apps/history-panel.js\n ** module id = 89\n ** module chunks = 3\n **/","var LeftPanel = require( 'layout/panel' ).LeftPanel,\n Tools = require( 'mvc/tool/tools' ),\n Upload = require( 'mvc/upload/upload-view' ),\n _l = require( 'utils/localization' );\n\n/* Builds the tool menu panel on the left of the analysis page */\nvar ToolPanel = LeftPanel.extend({\n\n title : _l( 'Tools' ),\n\n initialize: function( options ){\n LeftPanel.prototype.initialize.call( this, options );\n this.log( this + '.initialize:', options );\n\n /** @type {Object[]} descriptions of user's workflows to be shown in the tool menu */\n this.stored_workflow_menu_entries = options.stored_workflow_menu_entries || [];\n\n // create tool search, tool panel, and tool panel view.\n var tool_search = new Tools.ToolSearch({\n search_url : options.search_url,\n hidden : false\n });\n var tools = new Tools.ToolCollection( options.toolbox );\n this.tool_panel = new Tools.ToolPanel({\n tool_search : tool_search,\n tools : tools,\n layout : options.toolbox_in_panel\n });\n this.tool_panel_view = new Tools.ToolPanelView({ model: this.tool_panel });\n\n // add upload modal\n this.uploadButton = new Upload({\n nginx_upload_path : options.nginx_upload_path,\n ftp_upload_site : options.ftp_upload_site,\n default_genome : options.default_genome,\n default_extension : options.default_extension,\n });\n },\n\n render : function(){\n var self = this;\n LeftPanel.prototype.render.call( self );\n self.$( '.panel-header-buttons' ).append( self.uploadButton.$el );\n\n // if there are tools, render panel and display everything\n if (self.tool_panel.get( 'layout' ).size() > 0) {\n self.tool_panel_view.render();\n //TODO: why the hide/show?\n self.$( '.toolMenu' ).show();\n }\n self.$( '.toolMenuContainer' ).prepend( self.tool_panel_view.$el );\n\n self._renderWorkflowMenu();\n\n // if a tool link has the minsizehint attribute, handle it here (gen. by hiding the tool panel)\n self.$( 'a[minsizehint]' ).click( function() {\n if ( parent.handle_minwidth_hint ) {\n parent.handle_minwidth_hint( $( self ).attr( 'minsizehint' ) );\n }\n });\n },\n\n /** build the dom for the workflow portion of the tool menu */\n _renderWorkflowMenu : function(){\n var self = this;\n // add internal workflow list\n self.$( '#internal-workflows' ).append( self._templateTool({\n title : _l( 'All workflows' ),\n href : 'workflow/list_for_run'\n }));\n _.each( self.stored_workflow_menu_entries, function( menu_entry ){\n self.$( '#internal-workflows' ).append( self._templateTool({\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 // global\n '', tool.title, '',\n '
                                  '\n ].join('');\n },\n\n /** override to include inital menu dom and workflow section */\n _templateBody : function(){\n return [\n '
                                  ',\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 '
                                  '\n ].join('');\n },\n\n toString : function(){ return 'ToolPanel'; }\n});\n\nmodule.exports = ToolPanel;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/apps/tool-panel.js\n ** module id = 90\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-li-edit.js\n ** module id = 106\n ** module chunks = 3\n **/","define([\n \"mvc/collection/collection-view\",\n \"mvc/collection/collection-model\",\n \"mvc/collection/collection-li-edit\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/editable-text\",\n], function( DC_VIEW, DC_MODEL, DC_EDIT, BASE_MVC, _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 //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 },\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/collection-view-edit.js\n ** module id = 107\n ** module chunks = 3\n **/","define([\n \"utils/levenshtein\",\n \"utils/natural-sort\",\n \"mvc/collection/list-collection-creator\",\n \"mvc/base-mvc\",\n \"utils/localization\",\n \"ui/hoverhighlight\"\n], function( levenshteinDistance, naturalSort, LIST_COLLECTION_CREATOR, 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({\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._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 1.0; },\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 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( PairedCollectionCreator.templates.main() );\n this.$el.empty().html( PairedCollectionCreator.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( PairedCollectionCreator.templates.header() )\n .find( '.help-content' ).prepend( $( PairedCollectionCreator.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( PairedCollectionCreator.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 /** render the footer, completion controls, and cancel controls */\n _renderFooter : function( speed, callback ){\n var $footer = this.$( '.footer' ).empty().html( PairedCollectionCreator.templates.footer() );\n this.$( '.remove-extensions' ).prop( 'checked', this.removeExtensions );\n if( typeof this.oncancel === 'function' ){\n this.$( '.cancel-create.btn' ).show();\n }\n return $footer;\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 .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 'click .cancel-create' : function( ev ){\n if( typeof this.oncancel === 'function' ){\n this.oncancel.call( this );\n }\n },\n 'click .create-collection' : '_clickCreate'//,\n },\n\n // ........................................................................ header\n /** expand help */\n _clickMoreHelp : function( ev ){\n this.$( '.main-help' ).addClass( 'expanded' );\n this.$( '.more-help' ).hide();\n },\n /** collapse help */\n _clickLessHelp : function( ev ){\n this.$( '.main-help' ).removeClass( 'expanded' );\n this.$( '.more-help' ).show();\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' ).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 /** 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 /** 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 /** 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();\n }\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\n\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 */\nPairedCollectionCreator.templates = PairedCollectionCreator.templates || {\n\n /** the skeleton */\n main : _.template([\n '
                                  ',\n '
                                  ',\n '
                                  '\n ].join('')),\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 '
                                          ', _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 ){\n var elements = collection.toJSON();\n//TODO: validate elements\n return pairedCollectionCreatorModal( elements, {\n historyId : collection.historyId\n });\n}\n\n\n//=============================================================================\n return {\n PairedCollectionCreator : PairedCollectionCreator,\n pairedCollectionCreatorModal : pairedCollectionCreatorModal,\n createListOfPairsCollection : createListOfPairsCollection\n };\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js\n ** module id = 108\n ** module chunks = 3\n **/","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 ){\n var elements = contents.toJSON(),\n promise = pairCollectionCreatorModal( elements, {\n creationFn : function( elements, name ){\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 );\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/collection/pair-collection-creator.js\n ** module id = 109\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/copy-dialog.js\n ** module id = 110\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hda-li-edit.js\n ** module id = 111\n ** module chunks = 3\n **/","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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/hdca-li-edit.js\n ** module id = 112\n ** module chunks = 3\n **/","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 'galaxy_main: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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-view-edit-current.js\n ** module id = 113\n ** module chunks = 3\n **/","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 /** 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() {\n LIST_COLLECTION_CREATOR.createListCollection( panel.getSelectedModels() )\n .done( function(){ panel.model.refresh(); });\n }\n },\n // TODO: Only show quick pair if two things selected.\n { html: _l( 'Build Dataset Pair' ), func: function() {\n PAIR_COLLECTION_CREATOR.createPairCollection( panel.getSelectedModels() )\n .done( function(){ panel.model.refresh(); });\n }\n },\n { html: _l( 'Build List of Dataset Pairs' ), func: function() {\n LIST_OF_PAIRS_COLLECTION_CREATOR.createListOfPairsCollection( panel.getSelectedModels() )\n .done( function(){ panel.model.refresh(); });\n }\n },\n ];\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-view-edit.js\n ** module id = 114\n ** module chunks = 3\n **/","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.contents.fetchPrevPage();\n },\n\n _clickNextPage : function( ev ){\n this.model.contents.fetchNextPage();\n },\n\n _changePageSelect : function( ev ){\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/history-view.js\n ** module id = 115\n ** module chunks = 3\n **/","define([\n \"mvc/ui/popup-menu\",\n \"mvc/history/copy-dialog\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( PopupMenu, historyCopyDialog, BASE_MVC, _l ){\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 : 'history/list',\n },\n {\n html : _l( 'Histories Shared with Me' ),\n href : 'history/list_shared'\n },\n\n {\n html : _l( 'History Actions' ),\n header : true,\n anon : true\n },\n {\n html : _l( 'Create New' ),\n func : function(){ Galaxy.currHistoryPanel.createNewHistory(); }\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_main.window.location.href = 'history/delete?id=' + Galaxy.currHistoryPanel.model.id;\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_main.window.location.href = 'history/delete?purge=True&id=' + Galaxy.currHistoryPanel.model.id;\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(){ Galaxy.currHistoryPanel.collapseAll(); }\n },\n {\n html : _l( 'Unhide Hidden Datasets' ),\n anon : true,\n func : function(){ Galaxy.currHistoryPanel.unhideHidden(); }\n },\n {\n html : _l( 'Delete Hidden Datasets' ),\n anon : true,\n func : function(){ Galaxy.currHistoryPanel.deleteHidden(); }\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 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\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 = '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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/mvc/history/options-menu.js\n ** module id = 116\n ** module chunks = 3\n **/","/**\n * Renders tabs e.g. used in the Charts editor, behaves similar to repeat and section rendering\n */\ndefine( [ 'utils/utils' ], function( Utils ) {\nvar View = Backbone.View.extend({\n initialize : function( options ) {\n var self = this;\n this.visible = false;\n this.$nav = null;\n this.$content = null;\n this.first_tab = null;\n this.current_id = null;\n this.list = {};\n this.options = Utils.merge( options, {\n title_new : '',\n operations : null,\n onnew : null,\n max : null,\n onchange : null\n });\n this.setElement( $( this._template( this.options ) ) );\n this.$nav = this.$( '.tab-navigation' );\n this.$content = this.$( '.tab-content' );\n this.$operations = this.$nav.find( '.tab-operations' );\n\n // Renders tab operations\n if ( this.options.operations ) {\n $.each( this.options.operations, function( name, item ) {\n item.$el.prop( 'id', name );\n self.$operations.append( item.$el );\n });\n }\n\n // Allows user to add new tabs\n this.options.onnew && this.$nav.append( $( this._template_tab_new( this.options ) )\n .tooltip( { title: 'Add a new tab', placement: 'bottom', container: self.$el } )\n .on( 'click', function( e ) { self.options.onnew() } )\n );\n this.$tabnew = this.$nav.find( '.tab-new' );\n\n // Remove all tooltips on click\n this.$el.on( 'click', function() { $( '.tooltip' ).hide() } );\n },\n\n /** Returns current number of tabs */\n size: function() {\n return _.size( this.list );\n },\n\n /** Returns tab id for currently shown tab */\n current: function() {\n return this.$el.find( '.tab-pane.active' ).attr( 'id' );\n },\n\n /** Adds a new tab */\n add: function( options ) {\n var self = this;\n var id = options.id;\n var $tab_title = $( this._template_tab( options ) );\n var $tab_content = $( '
                                            ' ).attr( 'id', options.id ).addClass( 'tab-pane' );\n\n // hide new tab if maximum number of tabs has been reached\n this.list[ id ] = true;\n if ( this.options.max && this.size() >= this.options.max ) {\n this.$tabnew.hide();\n }\n\n // insert tab before new tab or as last tab\n if ( this.options.onnew ) {\n this.$tabnew.before( $tab_title );\n } else {\n this.$nav.append( $tab_title );\n }\n\n // assing delete callback if provided\n if ( options.ondel ) {\n $tab_title.find( '.tab-delete' ).tooltip( { title: 'Delete this tab', placement: 'bottom', container: self.$el } )\n .on( 'click', function() { options.ondel() } );\n } else {\n $tab_title.tooltip( { title: options.tooltip, placement: 'bottom', container: self.$el } );\n }\n $tab_title.on( 'click', function( e ) {\n e.preventDefault();\n options.onclick ? options.onclick() : self.show( id );\n });\n this.$content.append( $tab_content.append( options.$el ) );\n\n // assign current/first tab\n if ( this.size() == 1 ) {\n $tab_title.addClass( 'active' );\n $tab_content.addClass( 'active' );\n this.first_tab = id;\n }\n if ( !this.current_id ) {\n this.current_id = id;\n }\n },\n\n /** Delete tab */\n del: function( id ) {\n this.$( '#tab-' + id ).remove();\n this.$( '#' + id ).remove();\n this.first_tab = this.first_tab == id ? null : this.first_tab;\n this.first_tab != null && this.show( this.first_tab );\n this.list[ id ] && delete this.list[ id ];\n if ( this.size() < this.options.max ) {\n this.$el.find( '.ui-tabs-new' ).show();\n }\n },\n\n /** Delete all tabs */\n delAll: function() {\n for ( var id in this.list ) {\n this.del( id );\n }\n },\n\n /** Show tab view and highlight a tab by id */\n show: function( id ){\n this.$el.fadeIn( 'fast' );\n this.visible = true;\n if ( id ) {\n this.$( '#tab-' + this.current_id ).removeClass('active' );\n this.$( '#' + this.current_id ).removeClass('active' );\n this.$( '#tab-' + id ).addClass( 'active' );\n this.$( '#' + id ).addClass( 'active' );\n this.current_id = id;\n }\n this.options.onchange && this.options.onchange( id );\n },\n \n /** Hide tab view */\n hide: function(){\n this.$el.fadeOut( 'fast' );\n this.visible = false;\n },\n\n /** Show tab */\n showTab: function( id ) {\n this.$( '#tab-' + id ).show();\n },\n\n /** hide tab */\n hideTab: function( id ) {\n this.$( '#tab-' + id ).hide();\n },\n\n /** Hide operation by id */\n hideOperation: function( id ) {\n this.$nav.find( '#' + id ).hide();\n },\n\n /** Show operation by id */\n showOperation: function( id ) {\n this.$nav.find( '#' + id ).show();\n },\n\n /** Reassign an operation to a new callback */\n setOperation: function( id, callback ) {\n this.$nav.find( '#' + id ).off('click').on( 'click', callback );\n },\n\n /** Set/Get title */\n title: function( id, new_title ) {\n var $el = this.$( '#tab-title-text-' + id );\n new_title && $el.html( new_title );\n return $el.html();\n },\n\n /** Enumerate titles */\n retitle: function( new_title ) {\n var index = 0;\n for ( var id in this.list ) {\n this.title( id, ++index + ': ' + new_title );\n }\n },\n\n /** Main template */\n _template: function( options ) {\n return $( '
                                            ' ).addClass( 'ui-tabs tabbable tabs-left' )\n .append( $( '
                                          • ' +\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\tsupport.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;\n\t\n\t\t// #11217 - WebKit loses check when the name is after the checked attribute\n\t\tfragment.appendChild( div );\n\t\n\t\t// Support: Windows Web Apps (WWA)\n\t\t// `name` and `type` must use .setAttribute for WWA (#14901)\n\t\tinput = document.createElement( \"input\" );\n\t\tinput.setAttribute( \"type\", \"radio\" );\n\t\tinput.setAttribute( \"checked\", \"checked\" );\n\t\tinput.setAttribute( \"name\", \"t\" );\n\t\n\t\tdiv.appendChild( input );\n\t\n\t\t// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3\n\t\t// old WebKit doesn't clone checked state correctly in fragments\n\t\tsupport.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;\n\t\n\t\t// Support: IE<9\n\t\t// Cloned elements keep attachEvent handlers, we use addEventListener on IE9+\n\t\tsupport.noCloneEvent = !!div.addEventListener;\n\t\n\t\t// Support: IE<9\n\t\t// Since attributes and properties are the same in IE,\n\t\t// cleanData must set properties to undefined rather than use removeAttribute\n\t\tdiv[ jQuery.expando ] = 1;\n\t\tsupport.attributes = !div.getAttribute( jQuery.expando );\n\t} )();\n\t\n\t\n\t// We have to close these tags to support XHTML (#13200)\n\tvar wrapMap = {\n\t\toption: [ 1, \"\" ],\n\t\tlegend: [ 1, \"
                                            \", \"
                                            \" ],\n\t\tarea: [ 1, \"\", \"\" ],\n\t\n\t\t// Support: IE8\n\t\tparam: [ 1, \"\", \"\" ],\n\t\tthead: [ 1, \"\", \"
                                            \" ],\n\t\ttr: [ 2, \"\", \"
                                            \" ],\n\t\tcol: [ 2, \"\", \"
                                            \" ],\n\t\ttd: [ 3, \"\", \"
                                            \" ],\n\t\n\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\t_default: support.htmlSerialize ? [ 0, \"\", \"\" ] : [ 1, \"X
                                            \", \"
                                            \" ]\n\t};\n\t\n\t// Support: IE8-IE9\n\twrapMap.optgroup = wrapMap.option;\n\t\n\twrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n\twrapMap.th = wrapMap.td;\n\t\n\t\n\tfunction getAll( context, tag ) {\n\t\tvar elems, elem,\n\t\t\ti = 0,\n\t\t\tfound = typeof context.getElementsByTagName !== \"undefined\" ?\n\t\t\t\tcontext.getElementsByTagName( tag || \"*\" ) :\n\t\t\t\ttypeof context.querySelectorAll !== \"undefined\" ?\n\t\t\t\t\tcontext.querySelectorAll( tag || \"*\" ) :\n\t\t\t\t\tundefined;\n\t\n\t\tif ( !found ) {\n\t\t\tfor ( found = [], elems = context.childNodes || context;\n\t\t\t\t( elem = elems[ i ] ) != null;\n\t\t\t\ti++\n\t\t\t) {\n\t\t\t\tif ( !tag || jQuery.nodeName( elem, tag ) ) {\n\t\t\t\t\tfound.push( elem );\n\t\t\t\t} else {\n\t\t\t\t\tjQuery.merge( found, getAll( elem, tag ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn tag === undefined || tag && jQuery.nodeName( context, tag ) ?\n\t\t\tjQuery.merge( [ context ], found ) :\n\t\t\tfound;\n\t}\n\t\n\t\n\t// Mark scripts as having already been evaluated\n\tfunction setGlobalEval( elems, refElements ) {\n\t\tvar elem,\n\t\t\ti = 0;\n\t\tfor ( ; ( elem = elems[ i ] ) != null; i++ ) {\n\t\t\tjQuery._data(\n\t\t\t\telem,\n\t\t\t\t\"globalEval\",\n\t\t\t\t!refElements || jQuery._data( refElements[ i ], \"globalEval\" )\n\t\t\t);\n\t\t}\n\t}\n\t\n\t\n\tvar rhtml = /<|&#?\\w+;/,\n\t\trtbody = /
                                            , *may* have spurious \n\t\t\t\t\t\telem = tag === \"table\" && !rtbody.test( elem ) ?\n\t\t\t\t\t\t\ttmp.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 ) ?\n\t\t\t\t\t\t\t\ttmp :\n\t\t\t\t\t\t\t\t0;\n\t\n\t\t\t\t\t\tj = elem && elem.childNodes.length;\n\t\t\t\t\t\twhile ( j-- ) {\n\t\t\t\t\t\t\tif ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), \"tbody\" ) &&\n\t\t\t\t\t\t\t\t!tbody.childNodes.length ) {\n\t\n\t\t\t\t\t\t\t\telem.removeChild( tbody );\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\tjQuery.merge( nodes, tmp.childNodes );\n\t\n\t\t\t\t\t// Fix #12392 for WebKit and IE > 9\n\t\t\t\t\ttmp.textContent = \"\";\n\t\n\t\t\t\t\t// Fix #12392 for oldIE\n\t\t\t\t\twhile ( tmp.firstChild ) {\n\t\t\t\t\t\ttmp.removeChild( tmp.firstChild );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Remember the top-level container for proper cleanup\n\t\t\t\t\ttmp = safe.lastChild;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// Fix #11356: Clear elements from fragment\n\t\tif ( tmp ) {\n\t\t\tsafe.removeChild( tmp );\n\t\t}\n\t\n\t\t// Reset defaultChecked for any radios and checkboxes\n\t\t// about to be appended to the DOM in IE 6/7 (#8060)\n\t\tif ( !support.appendChecked ) {\n\t\t\tjQuery.grep( getAll( nodes, \"input\" ), fixDefaultChecked );\n\t\t}\n\t\n\t\ti = 0;\n\t\twhile ( ( elem = nodes[ i++ ] ) ) {\n\t\n\t\t\t// Skip elements already in the context collection (trac-4087)\n\t\t\tif ( selection && jQuery.inArray( elem, selection ) > -1 ) {\n\t\t\t\tif ( ignored ) {\n\t\t\t\t\tignored.push( elem );\n\t\t\t\t}\n\t\n\t\t\t\tcontinue;\n\t\t\t}\n\t\n\t\t\tcontains = jQuery.contains( elem.ownerDocument, elem );\n\t\n\t\t\t// Append to fragment\n\t\t\ttmp = getAll( safe.appendChild( elem ), \"script\" );\n\t\n\t\t\t// Preserve script evaluation history\n\t\t\tif ( contains ) {\n\t\t\t\tsetGlobalEval( tmp );\n\t\t\t}\n\t\n\t\t\t// Capture executables\n\t\t\tif ( scripts ) {\n\t\t\t\tj = 0;\n\t\t\t\twhile ( ( elem = tmp[ j++ ] ) ) {\n\t\t\t\t\tif ( rscriptType.test( elem.type || \"\" ) ) {\n\t\t\t\t\t\tscripts.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\ttmp = null;\n\t\n\t\treturn safe;\n\t}\n\t\n\t\n\t( function() {\n\t\tvar i, eventName,\n\t\t\tdiv = document.createElement( \"div\" );\n\t\n\t\t// Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events)\n\t\tfor ( i in { submit: true, change: true, focusin: true } ) {\n\t\t\teventName = \"on\" + i;\n\t\n\t\t\tif ( !( support[ i ] = eventName in window ) ) {\n\t\n\t\t\t\t// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)\n\t\t\t\tdiv.setAttribute( eventName, \"t\" );\n\t\t\t\tsupport[ i ] = div.attributes[ eventName ].expando === false;\n\t\t\t}\n\t\t}\n\t\n\t\t// Null elements to avoid leaks in IE.\n\t\tdiv = null;\n\t} )();\n\t\n\t\n\tvar rformElems = /^(?:input|select|textarea)$/i,\n\t\trkeyEvent = /^key/,\n\t\trmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,\n\t\trfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\n\t\trtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n\t\n\tfunction returnTrue() {\n\t\treturn true;\n\t}\n\t\n\tfunction returnFalse() {\n\t\treturn false;\n\t}\n\t\n\t// Support: IE9\n\t// See #13393 for more info\n\tfunction safeActiveElement() {\n\t\ttry {\n\t\t\treturn document.activeElement;\n\t\t} catch ( err ) { }\n\t}\n\t\n\tfunction on( elem, types, selector, data, fn, one ) {\n\t\tvar origFn, type;\n\t\n\t\t// Types can be a map of types/handlers\n\t\tif ( typeof types === \"object\" ) {\n\t\n\t\t\t// ( types-Object, selector, data )\n\t\t\tif ( typeof selector !== \"string\" ) {\n\t\n\t\t\t\t// ( types-Object, data )\n\t\t\t\tdata = data || selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t\tfor ( type in types ) {\n\t\t\t\ton( elem, type, selector, data, types[ type ], one );\n\t\t\t}\n\t\t\treturn elem;\n\t\t}\n\t\n\t\tif ( data == null && fn == null ) {\n\t\n\t\t\t// ( types, fn )\n\t\t\tfn = selector;\n\t\t\tdata = selector = undefined;\n\t\t} else if ( fn == null ) {\n\t\t\tif ( typeof selector === \"string\" ) {\n\t\n\t\t\t\t// ( types, selector, fn )\n\t\t\t\tfn = data;\n\t\t\t\tdata = undefined;\n\t\t\t} else {\n\t\n\t\t\t\t// ( types, data, fn )\n\t\t\t\tfn = data;\n\t\t\t\tdata = selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t}\n\t\tif ( fn === false ) {\n\t\t\tfn = returnFalse;\n\t\t} else if ( !fn ) {\n\t\t\treturn elem;\n\t\t}\n\t\n\t\tif ( one === 1 ) {\n\t\t\torigFn = fn;\n\t\t\tfn = function( event ) {\n\t\n\t\t\t\t// Can use an empty set, since event contains the info\n\t\t\t\tjQuery().off( event );\n\t\t\t\treturn origFn.apply( this, arguments );\n\t\t\t};\n\t\n\t\t\t// Use same guid so caller can remove using origFn\n\t\t\tfn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );\n\t\t}\n\t\treturn elem.each( function() {\n\t\t\tjQuery.event.add( this, types, fn, data, selector );\n\t\t} );\n\t}\n\t\n\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\tjQuery.event = {\n\t\n\t\tglobal: {},\n\t\n\t\tadd: function( elem, types, handler, data, selector ) {\n\t\t\tvar tmp, events, t, handleObjIn,\n\t\t\t\tspecial, eventHandle, handleObj,\n\t\t\t\thandlers, type, namespaces, origType,\n\t\t\t\telemData = jQuery._data( elem );\n\t\n\t\t\t// Don't attach events to noData or text/comment nodes (but allow plain objects)\n\t\t\tif ( !elemData ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Caller can pass in an object of custom data in lieu of the handler\n\t\t\tif ( handler.handler ) {\n\t\t\t\thandleObjIn = handler;\n\t\t\t\thandler = handleObjIn.handler;\n\t\t\t\tselector = handleObjIn.selector;\n\t\t\t}\n\t\n\t\t\t// Make sure that the handler has a unique ID, used to find/remove it later\n\t\t\tif ( !handler.guid ) {\n\t\t\t\thandler.guid = jQuery.guid++;\n\t\t\t}\n\t\n\t\t\t// Init the element's event structure and main handler, if this is the first\n\t\t\tif ( !( events = elemData.events ) ) {\n\t\t\t\tevents = elemData.events = {};\n\t\t\t}\n\t\t\tif ( !( eventHandle = elemData.handle ) ) {\n\t\t\t\teventHandle = elemData.handle = function( e ) {\n\t\n\t\t\t\t\t// Discard the second event of a jQuery.event.trigger() and\n\t\t\t\t\t// when an event is called after a page has unloaded\n\t\t\t\t\treturn typeof jQuery !== \"undefined\" &&\n\t\t\t\t\t\t( !e || jQuery.event.triggered !== e.type ) ?\n\t\t\t\t\t\tjQuery.event.dispatch.apply( eventHandle.elem, arguments ) :\n\t\t\t\t\t\tundefined;\n\t\t\t\t};\n\t\n\t\t\t\t// Add elem as a property of the handle fn to prevent a memory leak\n\t\t\t\t// with IE non-native events\n\t\t\t\teventHandle.elem = elem;\n\t\t\t}\n\t\n\t\t\t// Handle multiple events separated by a space\n\t\t\ttypes = ( types || \"\" ).match( rnotwhite ) || [ \"\" ];\n\t\t\tt = types.length;\n\t\t\twhile ( t-- ) {\n\t\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\t\ttype = origType = tmp[ 1 ];\n\t\t\t\tnamespaces = ( tmp[ 2 ] || \"\" ).split( \".\" ).sort();\n\t\n\t\t\t\t// There *must* be a type, no attaching namespace-only handlers\n\t\t\t\tif ( !type ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\n\t\t\t\t// If event changes its type, use the special event handlers for the changed type\n\t\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\n\t\t\t\t// If selector defined, determine special event api type, otherwise given type\n\t\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\t\n\t\t\t\t// Update special based on newly reset type\n\t\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\n\t\t\t\t// handleObj is passed to all event handlers\n\t\t\t\thandleObj = jQuery.extend( {\n\t\t\t\t\ttype: type,\n\t\t\t\t\torigType: origType,\n\t\t\t\t\tdata: data,\n\t\t\t\t\thandler: handler,\n\t\t\t\t\tguid: handler.guid,\n\t\t\t\t\tselector: selector,\n\t\t\t\t\tneedsContext: selector && jQuery.expr.match.needsContext.test( selector ),\n\t\t\t\t\tnamespace: namespaces.join( \".\" )\n\t\t\t\t}, handleObjIn );\n\t\n\t\t\t\t// Init the event handler queue if we're the first\n\t\t\t\tif ( !( handlers = events[ type ] ) ) {\n\t\t\t\t\thandlers = events[ type ] = [];\n\t\t\t\t\thandlers.delegateCount = 0;\n\t\n\t\t\t\t\t// Only use addEventListener/attachEvent if the special events handler returns false\n\t\t\t\t\tif ( !special.setup ||\n\t\t\t\t\t\tspecial.setup.call( elem, data, namespaces, eventHandle ) === false ) {\n\t\n\t\t\t\t\t\t// Bind the global event handler to the element\n\t\t\t\t\t\tif ( elem.addEventListener ) {\n\t\t\t\t\t\t\telem.addEventListener( type, eventHandle, false );\n\t\n\t\t\t\t\t\t} else if ( elem.attachEvent ) {\n\t\t\t\t\t\t\telem.attachEvent( \"on\" + type, eventHandle );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\tif ( special.add ) {\n\t\t\t\t\tspecial.add.call( elem, handleObj );\n\t\n\t\t\t\t\tif ( !handleObj.handler.guid ) {\n\t\t\t\t\t\thandleObj.handler.guid = handler.guid;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Add to the element's handler list, delegates in front\n\t\t\t\tif ( selector ) {\n\t\t\t\t\thandlers.splice( handlers.delegateCount++, 0, handleObj );\n\t\t\t\t} else {\n\t\t\t\t\thandlers.push( handleObj );\n\t\t\t\t}\n\t\n\t\t\t\t// Keep track of which events have ever been used, for event optimization\n\t\t\t\tjQuery.event.global[ type ] = true;\n\t\t\t}\n\t\n\t\t\t// Nullify elem to prevent memory leaks in IE\n\t\t\telem = null;\n\t\t},\n\t\n\t\t// Detach an event or set of events from an element\n\t\tremove: function( elem, types, handler, selector, mappedTypes ) {\n\t\t\tvar j, handleObj, tmp,\n\t\t\t\torigCount, t, events,\n\t\t\t\tspecial, handlers, type,\n\t\t\t\tnamespaces, origType,\n\t\t\t\telemData = jQuery.hasData( elem ) && jQuery._data( elem );\n\t\n\t\t\tif ( !elemData || !( events = elemData.events ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Once for each type.namespace in types; type may be omitted\n\t\t\ttypes = ( types || \"\" ).match( rnotwhite ) || [ \"\" ];\n\t\t\tt = types.length;\n\t\t\twhile ( t-- ) {\n\t\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\t\ttype = origType = tmp[ 1 ];\n\t\t\t\tnamespaces = ( tmp[ 2 ] || \"\" ).split( \".\" ).sort();\n\t\n\t\t\t\t// Unbind all events (on this namespace, if provided) for the element\n\t\t\t\tif ( !type ) {\n\t\t\t\t\tfor ( type in events ) {\n\t\t\t\t\t\tjQuery.event.remove( elem, type + types[ t ], handler, selector, true );\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\n\t\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\t\t\t\thandlers = events[ type ] || [];\n\t\t\t\ttmp = tmp[ 2 ] &&\n\t\t\t\t\tnew RegExp( \"(^|\\\\.)\" + namespaces.join( \"\\\\.(?:.*\\\\.|)\" ) + \"(\\\\.|$)\" );\n\t\n\t\t\t\t// Remove matching events\n\t\t\t\torigCount = j = handlers.length;\n\t\t\t\twhile ( j-- ) {\n\t\t\t\t\thandleObj = handlers[ j ];\n\t\n\t\t\t\t\tif ( ( mappedTypes || origType === handleObj.origType ) &&\n\t\t\t\t\t\t( !handler || handler.guid === handleObj.guid ) &&\n\t\t\t\t\t\t( !tmp || tmp.test( handleObj.namespace ) ) &&\n\t\t\t\t\t\t( !selector || selector === handleObj.selector ||\n\t\t\t\t\t\t\tselector === \"**\" && handleObj.selector ) ) {\n\t\t\t\t\t\thandlers.splice( j, 1 );\n\t\n\t\t\t\t\t\tif ( handleObj.selector ) {\n\t\t\t\t\t\t\thandlers.delegateCount--;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( special.remove ) {\n\t\t\t\t\t\t\tspecial.remove.call( elem, handleObj );\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// Remove generic event handler if we removed something and no more handlers exist\n\t\t\t\t// (avoids potential for endless recursion during removal of special event handlers)\n\t\t\t\tif ( origCount && !handlers.length ) {\n\t\t\t\t\tif ( !special.teardown ||\n\t\t\t\t\t\tspecial.teardown.call( elem, namespaces, elemData.handle ) === false ) {\n\t\n\t\t\t\t\t\tjQuery.removeEvent( elem, type, elemData.handle );\n\t\t\t\t\t}\n\t\n\t\t\t\t\tdelete events[ type ];\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Remove the expando if it's no longer used\n\t\t\tif ( jQuery.isEmptyObject( events ) ) {\n\t\t\t\tdelete elemData.handle;\n\t\n\t\t\t\t// removeData also checks for emptiness and clears the expando if empty\n\t\t\t\t// so use it instead of delete\n\t\t\t\tjQuery._removeData( elem, \"events\" );\n\t\t\t}\n\t\t},\n\t\n\t\ttrigger: function( event, data, elem, onlyHandlers ) {\n\t\t\tvar handle, ontype, cur,\n\t\t\t\tbubbleType, special, tmp, i,\n\t\t\t\teventPath = [ elem || document ],\n\t\t\t\ttype = hasOwn.call( event, \"type\" ) ? event.type : event,\n\t\t\t\tnamespaces = hasOwn.call( event, \"namespace\" ) ? event.namespace.split( \".\" ) : [];\n\t\n\t\t\tcur = tmp = elem = elem || document;\n\t\n\t\t\t// Don't do events on text and comment nodes\n\t\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// focus/blur morphs to focusin/out; ensure we're not firing them right now\n\t\t\tif ( rfocusMorph.test( type + jQuery.event.triggered ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif ( type.indexOf( \".\" ) > -1 ) {\n\t\n\t\t\t\t// Namespaced trigger; create a regexp to match event type in handle()\n\t\t\t\tnamespaces = type.split( \".\" );\n\t\t\t\ttype = namespaces.shift();\n\t\t\t\tnamespaces.sort();\n\t\t\t}\n\t\t\tontype = type.indexOf( \":\" ) < 0 && \"on\" + type;\n\t\n\t\t\t// Caller can pass in a jQuery.Event object, Object, or just an event type string\n\t\t\tevent = event[ jQuery.expando ] ?\n\t\t\t\tevent :\n\t\t\t\tnew jQuery.Event( type, typeof event === \"object\" && event );\n\t\n\t\t\t// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n\t\t\tevent.isTrigger = onlyHandlers ? 2 : 3;\n\t\t\tevent.namespace = namespaces.join( \".\" );\n\t\t\tevent.rnamespace = event.namespace ?\n\t\t\t\tnew RegExp( \"(^|\\\\.)\" + namespaces.join( \"\\\\.(?:.*\\\\.|)\" ) + \"(\\\\.|$)\" ) :\n\t\t\t\tnull;\n\t\n\t\t\t// Clean up the event in case it is being reused\n\t\t\tevent.result = undefined;\n\t\t\tif ( !event.target ) {\n\t\t\t\tevent.target = elem;\n\t\t\t}\n\t\n\t\t\t// Clone any incoming data and prepend the event, creating the handler arg list\n\t\t\tdata = data == null ?\n\t\t\t\t[ event ] :\n\t\t\t\tjQuery.makeArray( data, [ event ] );\n\t\n\t\t\t// Allow special events to draw outside the lines\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\t\tif ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Determine event propagation path in advance, per W3C events spec (#9951)\n\t\t\t// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n\t\t\tif ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {\n\t\n\t\t\t\tbubbleType = special.delegateType || type;\n\t\t\t\tif ( !rfocusMorph.test( bubbleType + type ) ) {\n\t\t\t\t\tcur = cur.parentNode;\n\t\t\t\t}\n\t\t\t\tfor ( ; cur; cur = cur.parentNode ) {\n\t\t\t\t\teventPath.push( cur );\n\t\t\t\t\ttmp = cur;\n\t\t\t\t}\n\t\n\t\t\t\t// Only add window if we got to document (e.g., not plain obj or detached DOM)\n\t\t\t\tif ( tmp === ( elem.ownerDocument || document ) ) {\n\t\t\t\t\teventPath.push( tmp.defaultView || tmp.parentWindow || window );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Fire handlers on the event path\n\t\t\ti = 0;\n\t\t\twhile ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {\n\t\n\t\t\t\tevent.type = i > 1 ?\n\t\t\t\t\tbubbleType :\n\t\t\t\t\tspecial.bindType || type;\n\t\n\t\t\t\t// jQuery handler\n\t\t\t\thandle = ( jQuery._data( cur, \"events\" ) || {} )[ event.type ] &&\n\t\t\t\t\tjQuery._data( cur, \"handle\" );\n\t\n\t\t\t\tif ( handle ) {\n\t\t\t\t\thandle.apply( cur, data );\n\t\t\t\t}\n\t\n\t\t\t\t// Native handler\n\t\t\t\thandle = ontype && cur[ ontype ];\n\t\t\t\tif ( handle && handle.apply && acceptData( cur ) ) {\n\t\t\t\t\tevent.result = handle.apply( cur, data );\n\t\t\t\t\tif ( event.result === false ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tevent.type = type;\n\t\n\t\t\t// If nobody prevented the default action, do it now\n\t\t\tif ( !onlyHandlers && !event.isDefaultPrevented() ) {\n\t\n\t\t\t\tif (\n\t\t\t\t\t( !special._default ||\n\t\t\t\t\t special._default.apply( eventPath.pop(), data ) === false\n\t\t\t\t\t) && acceptData( elem )\n\t\t\t\t) {\n\t\n\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// Can't use an .isFunction() check here because IE6/7 fails that test.\n\t\t\t\t\t// Don't do default actions on window, that's where global variables be (#6170)\n\t\t\t\t\tif ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {\n\t\n\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\ttmp = elem[ ontype ];\n\t\n\t\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\t\telem[ ontype ] = null;\n\t\t\t\t\t\t}\n\t\n\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\tjQuery.event.triggered = type;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\telem[ type ]();\n\t\t\t\t\t\t} catch ( e ) {\n\t\n\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// only reproducible on winXP IE8 native, not IE9 in IE8 mode\n\t\t\t\t\t\t}\n\t\t\t\t\t\tjQuery.event.triggered = undefined;\n\t\n\t\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\t\telem[ ontype ] = tmp;\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\treturn event.result;\n\t\t},\n\t\n\t\tdispatch: function( event ) {\n\t\n\t\t\t// Make a writable jQuery.Event from the native event object\n\t\t\tevent = jQuery.event.fix( event );\n\t\n\t\t\tvar i, j, ret, matched, handleObj,\n\t\t\t\thandlerQueue = [],\n\t\t\t\targs = slice.call( arguments ),\n\t\t\t\thandlers = ( jQuery._data( this, \"events\" ) || {} )[ event.type ] || [],\n\t\t\t\tspecial = jQuery.event.special[ event.type ] || {};\n\t\n\t\t\t// Use the fix-ed jQuery.Event rather than the (read-only) native event\n\t\t\targs[ 0 ] = event;\n\t\t\tevent.delegateTarget = this;\n\t\n\t\t\t// Call the preDispatch hook for the mapped type, and let it bail if desired\n\t\t\tif ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Determine handlers\n\t\t\thandlerQueue = jQuery.event.handlers.call( this, event, handlers );\n\t\n\t\t\t// Run delegates first; they may want to stop propagation beneath us\n\t\t\ti = 0;\n\t\t\twhile ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {\n\t\t\t\tevent.currentTarget = matched.elem;\n\t\n\t\t\t\tj = 0;\n\t\t\t\twhile ( ( handleObj = matched.handlers[ j++ ] ) &&\n\t\t\t\t\t!event.isImmediatePropagationStopped() ) {\n\t\n\t\t\t\t\t// Triggered event must either 1) have no namespace, or 2) have namespace(s)\n\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\tif ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {\n\t\n\t\t\t\t\t\tevent.handleObj = handleObj;\n\t\t\t\t\t\tevent.data = handleObj.data;\n\t\n\t\t\t\t\t\tret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||\n\t\t\t\t\t\t\thandleObj.handler ).apply( matched.elem, args );\n\t\n\t\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\t\tif ( ( event.result = ret ) === false ) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tevent.stopPropagation();\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\n\t\t\t// Call the postDispatch hook for the mapped type\n\t\t\tif ( special.postDispatch ) {\n\t\t\t\tspecial.postDispatch.call( this, event );\n\t\t\t}\n\t\n\t\t\treturn event.result;\n\t\t},\n\t\n\t\thandlers: function( event, handlers ) {\n\t\t\tvar i, matches, sel, handleObj,\n\t\t\t\thandlerQueue = [],\n\t\t\t\tdelegateCount = handlers.delegateCount,\n\t\t\t\tcur = event.target;\n\t\n\t\t\t// Support (at least): Chrome, IE9\n\t\t\t// Find delegate handlers\n\t\t\t// Black-hole SVG instance trees (#13180)\n\t\t\t//\n\t\t\t// Support: Firefox<=42+\n\t\t\t// Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)\n\t\t\tif ( delegateCount && cur.nodeType &&\n\t\t\t\t( event.type !== \"click\" || isNaN( event.button ) || event.button < 1 ) ) {\n\t\n\t\t\t\t/* jshint eqeqeq: false */\n\t\t\t\tfor ( ; cur != this; cur = cur.parentNode || this ) {\n\t\t\t\t\t/* jshint eqeqeq: true */\n\t\n\t\t\t\t\t// Don't check non-elements (#13208)\n\t\t\t\t\t// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)\n\t\t\t\t\tif ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== \"click\" ) ) {\n\t\t\t\t\t\tmatches = [];\n\t\t\t\t\t\tfor ( i = 0; i < delegateCount; i++ ) {\n\t\t\t\t\t\t\thandleObj = handlers[ i ];\n\t\n\t\t\t\t\t\t\t// Don't conflict with Object.prototype properties (#13203)\n\t\t\t\t\t\t\tsel = handleObj.selector + \" \";\n\t\n\t\t\t\t\t\t\tif ( matches[ sel ] === undefined ) {\n\t\t\t\t\t\t\t\tmatches[ sel ] = handleObj.needsContext ?\n\t\t\t\t\t\t\t\t\tjQuery( sel, this ).index( cur ) > -1 :\n\t\t\t\t\t\t\t\t\tjQuery.find( sel, this, null, [ cur ] ).length;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( matches[ sel ] ) {\n\t\t\t\t\t\t\t\tmatches.push( handleObj );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( matches.length ) {\n\t\t\t\t\t\t\thandlerQueue.push( { elem: cur, handlers: matches } );\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// Add the remaining (directly-bound) handlers\n\t\t\tif ( delegateCount < handlers.length ) {\n\t\t\t\thandlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );\n\t\t\t}\n\t\n\t\t\treturn handlerQueue;\n\t\t},\n\t\n\t\tfix: function( event ) {\n\t\t\tif ( event[ jQuery.expando ] ) {\n\t\t\t\treturn event;\n\t\t\t}\n\t\n\t\t\t// Create a writable copy of the event object and normalize some properties\n\t\t\tvar i, prop, copy,\n\t\t\t\ttype = event.type,\n\t\t\t\toriginalEvent = event,\n\t\t\t\tfixHook = this.fixHooks[ type ];\n\t\n\t\t\tif ( !fixHook ) {\n\t\t\t\tthis.fixHooks[ type ] = fixHook =\n\t\t\t\t\trmouseEvent.test( type ) ? this.mouseHooks :\n\t\t\t\t\trkeyEvent.test( type ) ? this.keyHooks :\n\t\t\t\t\t{};\n\t\t\t}\n\t\t\tcopy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;\n\t\n\t\t\tevent = new jQuery.Event( originalEvent );\n\t\n\t\t\ti = copy.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tprop = copy[ i ];\n\t\t\t\tevent[ prop ] = originalEvent[ prop ];\n\t\t\t}\n\t\n\t\t\t// Support: IE<9\n\t\t\t// Fix target property (#1925)\n\t\t\tif ( !event.target ) {\n\t\t\t\tevent.target = originalEvent.srcElement || document;\n\t\t\t}\n\t\n\t\t\t// Support: Safari 6-8+\n\t\t\t// Target should not be a text node (#504, #13143)\n\t\t\tif ( event.target.nodeType === 3 ) {\n\t\t\t\tevent.target = event.target.parentNode;\n\t\t\t}\n\t\n\t\t\t// Support: IE<9\n\t\t\t// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)\n\t\t\tevent.metaKey = !!event.metaKey;\n\t\n\t\t\treturn fixHook.filter ? fixHook.filter( event, originalEvent ) : event;\n\t\t},\n\t\n\t\t// Includes some event props shared by KeyEvent and MouseEvent\n\t\tprops: ( \"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase \" +\n\t\t\t\"metaKey relatedTarget shiftKey target timeStamp view which\" ).split( \" \" ),\n\t\n\t\tfixHooks: {},\n\t\n\t\tkeyHooks: {\n\t\t\tprops: \"char charCode key keyCode\".split( \" \" ),\n\t\t\tfilter: function( event, original ) {\n\t\n\t\t\t\t// Add which for key events\n\t\t\t\tif ( event.which == null ) {\n\t\t\t\t\tevent.which = original.charCode != null ? original.charCode : original.keyCode;\n\t\t\t\t}\n\t\n\t\t\t\treturn event;\n\t\t\t}\n\t\t},\n\t\n\t\tmouseHooks: {\n\t\t\tprops: ( \"button buttons clientX clientY fromElement offsetX offsetY \" +\n\t\t\t\t\"pageX pageY screenX screenY toElement\" ).split( \" \" ),\n\t\t\tfilter: function( event, original ) {\n\t\t\t\tvar body, eventDoc, doc,\n\t\t\t\t\tbutton = original.button,\n\t\t\t\t\tfromElement = original.fromElement;\n\t\n\t\t\t\t// Calculate pageX/Y if missing and clientX/Y available\n\t\t\t\tif ( event.pageX == null && original.clientX != null ) {\n\t\t\t\t\teventDoc = event.target.ownerDocument || document;\n\t\t\t\t\tdoc = eventDoc.documentElement;\n\t\t\t\t\tbody = eventDoc.body;\n\t\n\t\t\t\t\tevent.pageX = original.clientX +\n\t\t\t\t\t\t( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -\n\t\t\t\t\t\t( doc && doc.clientLeft || body && body.clientLeft || 0 );\n\t\t\t\t\tevent.pageY = original.clientY +\n\t\t\t\t\t\t( doc && doc.scrollTop || body && body.scrollTop || 0 ) -\n\t\t\t\t\t\t( doc && doc.clientTop || body && body.clientTop || 0 );\n\t\t\t\t}\n\t\n\t\t\t\t// Add relatedTarget, if necessary\n\t\t\t\tif ( !event.relatedTarget && fromElement ) {\n\t\t\t\t\tevent.relatedTarget = fromElement === event.target ?\n\t\t\t\t\t\toriginal.toElement :\n\t\t\t\t\t\tfromElement;\n\t\t\t\t}\n\t\n\t\t\t\t// Add which for click: 1 === left; 2 === middle; 3 === right\n\t\t\t\t// Note: button is not normalized, so don't use it\n\t\t\t\tif ( !event.which && button !== undefined ) {\n\t\t\t\t\tevent.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );\n\t\t\t\t}\n\t\n\t\t\t\treturn event;\n\t\t\t}\n\t\t},\n\t\n\t\tspecial: {\n\t\t\tload: {\n\t\n\t\t\t\t// Prevent triggered image.load events from bubbling to window.load\n\t\t\t\tnoBubble: true\n\t\t\t},\n\t\t\tfocus: {\n\t\n\t\t\t\t// Fire native event if possible so blur/focus sequence is correct\n\t\t\t\ttrigger: function() {\n\t\t\t\t\tif ( this !== safeActiveElement() && this.focus ) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tthis.focus();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t} catch ( e ) {\n\t\n\t\t\t\t\t\t\t// Support: IE<9\n\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// let .trigger() run the handlers\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdelegateType: \"focusin\"\n\t\t\t},\n\t\t\tblur: {\n\t\t\t\ttrigger: function() {\n\t\t\t\t\tif ( this === safeActiveElement() && this.blur ) {\n\t\t\t\t\t\tthis.blur();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdelegateType: \"focusout\"\n\t\t\t},\n\t\t\tclick: {\n\t\n\t\t\t\t// For checkbox, fire native event so checked state will be right\n\t\t\t\ttrigger: function() {\n\t\t\t\t\tif ( jQuery.nodeName( this, \"input\" ) && this.type === \"checkbox\" && this.click ) {\n\t\t\t\t\t\tthis.click();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\n\t\t\t\t// For cross-browser consistency, don't fire native .click() on links\n\t\t\t\t_default: function( event ) {\n\t\t\t\t\treturn jQuery.nodeName( event.target, \"a\" );\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\tbeforeunload: {\n\t\t\t\tpostDispatch: function( event ) {\n\t\n\t\t\t\t\t// Support: Firefox 20+\n\t\t\t\t\t// Firefox doesn't alert if the returnValue field is not set.\n\t\t\t\t\tif ( event.result !== undefined && event.originalEvent ) {\n\t\t\t\t\t\tevent.originalEvent.returnValue = event.result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t// Piggyback on a donor event to simulate a different one\n\t\tsimulate: function( type, elem, event ) {\n\t\t\tvar e = jQuery.extend(\n\t\t\t\tnew jQuery.Event(),\n\t\t\t\tevent,\n\t\t\t\t{\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\t\t);\n\t\n\t\t\tjQuery.event.trigger( e, null, elem );\n\t\n\t\t\tif ( e.isDefaultPrevented() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t};\n\t\n\tjQuery.removeEvent = document.removeEventListener ?\n\t\tfunction( 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} :\n\t\tfunction( 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\tjQuery.Event = function( src, props ) {\n\t\n\t\t// Allow instantiation without the 'new' keyword\n\t\tif ( !( this instanceof jQuery.Event ) ) {\n\t\t\treturn new jQuery.Event( src, props );\n\t\t}\n\t\n\t\t// Event object\n\t\tif ( src && src.type ) {\n\t\t\tthis.originalEvent = src;\n\t\t\tthis.type = src.type;\n\t\n\t\t\t// Events bubbling up the document may have been marked as prevented\n\t\t\t// by a handler lower down the tree; reflect the correct value.\n\t\t\tthis.isDefaultPrevented = src.defaultPrevented ||\n\t\t\t\t\tsrc.defaultPrevented === undefined &&\n\t\n\t\t\t\t\t// Support: IE < 9, Android < 4.0\n\t\t\t\t\tsrc.returnValue === false ?\n\t\t\t\treturnTrue :\n\t\t\t\treturnFalse;\n\t\n\t\t// Event type\n\t\t} else {\n\t\t\tthis.type = src;\n\t\t}\n\t\n\t\t// Put explicitly provided properties onto the event object\n\t\tif ( props ) {\n\t\t\tjQuery.extend( this, props );\n\t\t}\n\t\n\t\t// Create a timestamp if incoming event doesn't have one\n\t\tthis.timeStamp = src && src.timeStamp || jQuery.now();\n\t\n\t\t// Mark it as fixed\n\t\tthis[ jQuery.expando ] = true;\n\t};\n\t\n\t// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n\t// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\n\tjQuery.Event.prototype = {\n\t\tconstructor: jQuery.Event,\n\t\tisDefaultPrevented: returnFalse,\n\t\tisPropagationStopped: returnFalse,\n\t\tisImmediatePropagationStopped: returnFalse,\n\t\n\t\tpreventDefault: function() {\n\t\t\tvar e = this.originalEvent;\n\t\n\t\t\tthis.isDefaultPrevented = returnTrue;\n\t\t\tif ( !e ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// If preventDefault exists, run it on the original event\n\t\t\tif ( e.preventDefault ) {\n\t\t\t\te.preventDefault();\n\t\n\t\t\t// Support: IE\n\t\t\t// Otherwise set the returnValue property of the original event to false\n\t\t\t} else {\n\t\t\t\te.returnValue = false;\n\t\t\t}\n\t\t},\n\t\tstopPropagation: function() {\n\t\t\tvar e = this.originalEvent;\n\t\n\t\t\tthis.isPropagationStopped = returnTrue;\n\t\n\t\t\tif ( !e || this.isSimulated ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// If stopPropagation exists, run it on the original event\n\t\t\tif ( e.stopPropagation ) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\n\t\t\t// Support: IE\n\t\t\t// Set the cancelBubble property of the original event to true\n\t\t\te.cancelBubble = true;\n\t\t},\n\t\tstopImmediatePropagation: function() {\n\t\t\tvar e = this.originalEvent;\n\t\n\t\t\tthis.isImmediatePropagationStopped = returnTrue;\n\t\n\t\t\tif ( e && e.stopImmediatePropagation ) {\n\t\t\t\te.stopImmediatePropagation();\n\t\t\t}\n\t\n\t\t\tthis.stopPropagation();\n\t\t}\n\t};\n\t\n\t// Create mouseenter/leave events using mouseover/out and event-time checks\n\t// so that event delegation works in jQuery.\n\t// Do the same for pointerenter/pointerleave and pointerover/pointerout\n\t//\n\t// Support: Safari 7 only\n\t// Safari sends mouseenter too often; see:\n\t// https://code.google.com/p/chromium/issues/detail?id=470258\n\t// for the description of the bug (it existed in older Chrome versions as well).\n\tjQuery.each( {\n\t\tmouseenter: \"mouseover\",\n\t\tmouseleave: \"mouseout\",\n\t\tpointerenter: \"pointerover\",\n\t\tpointerleave: \"pointerout\"\n\t}, function( orig, fix ) {\n\t\tjQuery.event.special[ orig ] = {\n\t\t\tdelegateType: fix,\n\t\t\tbindType: fix,\n\t\n\t\t\thandle: function( event ) {\n\t\t\t\tvar ret,\n\t\t\t\t\ttarget = this,\n\t\t\t\t\trelated = event.relatedTarget,\n\t\t\t\t\thandleObj = event.handleObj;\n\t\n\t\t\t\t// For mouseenter/leave call the handler if related is outside the target.\n\t\t\t\t// NB: No relatedTarget if the mouse left/entered the browser window\n\t\t\t\tif ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {\n\t\t\t\t\tevent.type = handleObj.origType;\n\t\t\t\t\tret = handleObj.handler.apply( this, arguments );\n\t\t\t\t\tevent.type = fix;\n\t\t\t\t}\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t};\n\t} );\n\t\n\t// IE submit delegation\n\tif ( !support.submit ) {\n\t\n\t\tjQuery.event.special.submit = {\n\t\t\tsetup: function() {\n\t\n\t\t\t\t// Only need this for delegated form submit events\n\t\t\t\tif ( jQuery.nodeName( this, \"form\" ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\n\t\t\t\t// Lazy-add a submit handler when a descendant form may potentially be submitted\n\t\t\t\tjQuery.event.add( this, \"click._submit keypress._submit\", function( e ) {\n\t\n\t\t\t\t\t// Node name check avoids a VML-related crash in IE (#9807)\n\t\t\t\t\tvar elem = e.target,\n\t\t\t\t\t\tform = jQuery.nodeName( elem, \"input\" ) || jQuery.nodeName( elem, \"button\" ) ?\n\t\n\t\t\t\t\t\t\t// Support: IE <=8\n\t\t\t\t\t\t\t// We use jQuery.prop instead of elem.form\n\t\t\t\t\t\t\t// to allow fixing the IE8 delegated submit issue (gh-2332)\n\t\t\t\t\t\t\t// by 3rd party polyfills/workarounds.\n\t\t\t\t\t\t\tjQuery.prop( elem, \"form\" ) :\n\t\t\t\t\t\t\tundefined;\n\t\n\t\t\t\t\tif ( form && !jQuery._data( form, \"submit\" ) ) {\n\t\t\t\t\t\tjQuery.event.add( form, \"submit._submit\", function( event ) {\n\t\t\t\t\t\t\tevent._submitBubble = true;\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tjQuery._data( form, \"submit\", true );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\n\t\t\t\t// return undefined since we don't need an event listener\n\t\t\t},\n\t\n\t\t\tpostDispatch: function( event ) {\n\t\n\t\t\t\t// If form was submitted by the user, bubble the event up the tree\n\t\t\t\tif ( event._submitBubble ) {\n\t\t\t\t\tdelete event._submitBubble;\n\t\t\t\t\tif ( this.parentNode && !event.isTrigger ) {\n\t\t\t\t\t\tjQuery.event.simulate( \"submit\", this.parentNode, event );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\tteardown: function() {\n\t\n\t\t\t\t// Only need this for delegated form submit events\n\t\t\t\tif ( jQuery.nodeName( this, \"form\" ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\n\t\t\t\t// Remove delegated handlers; cleanData eventually reaps submit handlers attached above\n\t\t\t\tjQuery.event.remove( this, \"._submit\" );\n\t\t\t}\n\t\t};\n\t}\n\t\n\t// IE change delegation and checkbox/radio fix\n\tif ( !support.change ) {\n\t\n\t\tjQuery.event.special.change = {\n\t\n\t\t\tsetup: function() {\n\t\n\t\t\t\tif ( rformElems.test( this.nodeName ) ) {\n\t\n\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// after a propertychange. Eat the blur-change in special.change.handle.\n\t\t\t\t\t// This still fires onchange a second time for check/radio after blur.\n\t\t\t\t\tif ( this.type === \"checkbox\" || this.type === \"radio\" ) {\n\t\t\t\t\t\tjQuery.event.add( this, \"propertychange._change\", function( event ) {\n\t\t\t\t\t\t\tif ( event.originalEvent.propertyName === \"checked\" ) {\n\t\t\t\t\t\t\t\tthis._justChanged = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tjQuery.event.add( this, \"click._change\", function( event ) {\n\t\t\t\t\t\t\tif ( this._justChanged && !event.isTrigger ) {\n\t\t\t\t\t\t\t\tthis._justChanged = false;\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t// Allow triggered, simulated change events (#11500)\n\t\t\t\t\t\t\tjQuery.event.simulate( \"change\", this, event );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\n\t\t\t\t// Delegated event; lazy-add a change handler on descendant inputs\n\t\t\t\tjQuery.event.add( this, \"beforeactivate._change\", function( e ) {\n\t\t\t\t\tvar elem = e.target;\n\t\n\t\t\t\t\tif ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, \"change\" ) ) {\n\t\t\t\t\t\tjQuery.event.add( elem, \"change._change\", function( event ) {\n\t\t\t\t\t\t\tif ( this.parentNode && !event.isSimulated && !event.isTrigger ) {\n\t\t\t\t\t\t\t\tjQuery.event.simulate( \"change\", this.parentNode, event );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tjQuery._data( elem, \"change\", true );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\n\t\t\thandle: function( event ) {\n\t\t\t\tvar elem = event.target;\n\t\n\t\t\t\t// Swallow native change events from checkbox/radio, we already triggered them above\n\t\t\t\tif ( this !== elem || event.isSimulated || event.isTrigger ||\n\t\t\t\t\t( elem.type !== \"radio\" && elem.type !== \"checkbox\" ) ) {\n\t\n\t\t\t\t\treturn event.handleObj.handler.apply( this, arguments );\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\tteardown: function() {\n\t\t\t\tjQuery.event.remove( this, \"._change\" );\n\t\n\t\t\t\treturn !rformElems.test( this.nodeName );\n\t\t\t}\n\t\t};\n\t}\n\t\n\t// Support: Firefox\n\t// Firefox doesn't have focus(in | out) events\n\t// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n\t//\n\t// Support: Chrome, Safari\n\t// focus(in | out) events fire after focus & blur events,\n\t// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n\t// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857\n\tif ( !support.focusin ) {\n\t\tjQuery.each( { focus: \"focusin\", blur: \"focusout\" }, function( orig, fix ) {\n\t\n\t\t\t// Attach a single capturing handler on the document while someone wants focusin/focusout\n\t\t\tvar handler = function( event ) {\n\t\t\t\tjQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );\n\t\t\t};\n\t\n\t\t\tjQuery.event.special[ fix ] = {\n\t\t\t\tsetup: function() {\n\t\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\t\tattaches = jQuery._data( doc, fix );\n\t\n\t\t\t\t\tif ( !attaches ) {\n\t\t\t\t\t\tdoc.addEventListener( orig, handler, true );\n\t\t\t\t\t}\n\t\t\t\t\tjQuery._data( doc, fix, ( attaches || 0 ) + 1 );\n\t\t\t\t},\n\t\t\t\tteardown: function() {\n\t\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\t\tattaches = jQuery._data( doc, fix ) - 1;\n\t\n\t\t\t\t\tif ( !attaches ) {\n\t\t\t\t\t\tdoc.removeEventListener( orig, handler, true );\n\t\t\t\t\t\tjQuery._removeData( doc, fix );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery._data( doc, fix, attaches );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t} );\n\t}\n\t\n\tjQuery.fn.extend( {\n\t\n\t\ton: function( types, selector, data, fn ) {\n\t\t\treturn on( this, types, selector, data, fn );\n\t\t},\n\t\tone: function( types, selector, data, fn ) {\n\t\t\treturn on( this, types, selector, data, fn, 1 );\n\t\t},\n\t\toff: function( types, selector, fn ) {\n\t\t\tvar handleObj, type;\n\t\t\tif ( types && types.preventDefault && types.handleObj ) {\n\t\n\t\t\t\t// ( event ) dispatched jQuery.Event\n\t\t\t\thandleObj = types.handleObj;\n\t\t\t\tjQuery( types.delegateTarget ).off(\n\t\t\t\t\thandleObj.namespace ?\n\t\t\t\t\t\thandleObj.origType + \".\" + handleObj.namespace :\n\t\t\t\t\t\thandleObj.origType,\n\t\t\t\t\thandleObj.selector,\n\t\t\t\t\thandleObj.handler\n\t\t\t\t);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tif ( typeof types === \"object\" ) {\n\t\n\t\t\t\t// ( types-object [, selector] )\n\t\t\t\tfor ( type in types ) {\n\t\t\t\t\tthis.off( type, selector, types[ type ] );\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tif ( selector === false || typeof selector === \"function\" ) {\n\t\n\t\t\t\t// ( types [, fn] )\n\t\t\t\tfn = selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t\tif ( fn === false ) {\n\t\t\t\tfn = returnFalse;\n\t\t\t}\n\t\t\treturn this.each( function() {\n\t\t\t\tjQuery.event.remove( this, types, fn, selector );\n\t\t\t} );\n\t\t},\n\t\n\t\ttrigger: function( type, data ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tjQuery.event.trigger( type, data, this );\n\t\t\t} );\n\t\t},\n\t\ttriggerHandler: function( type, data ) {\n\t\t\tvar elem = this[ 0 ];\n\t\t\tif ( elem ) {\n\t\t\t\treturn jQuery.event.trigger( type, data, elem, true );\n\t\t\t}\n\t\t}\n\t} );\n\t\n\t\n\tvar rinlinejQuery = / jQuery\\d+=\"(?:null|\\d+)\"/g,\n\t\trnoshimcache = new RegExp( \"<(?:\" + nodeNames + \")[\\\\s/>]\", \"i\" ),\n\t\trxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:-]+)[^>]*)\\/>/gi,\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\tsafeFragment = createSafeFragment( document ),\n\t\tfragmentDiv = safeFragment.appendChild( document.createElement( \"div\" ) );\n\t\n\t// Support: IE<8\n\t// Manipulating tables requires a tbody\n\tfunction manipulationTarget( elem, content ) {\n\t\treturn jQuery.nodeName( elem, \"table\" ) &&\n\t\t\tjQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, \"tr\" ) ?\n\t\n\t\t\telem.getElementsByTagName( \"tbody\" )[ 0 ] ||\n\t\t\t\telem.appendChild( elem.ownerDocument.createElement( \"tbody\" ) ) :\n\t\t\telem;\n\t}\n\t\n\t// Replace/restore the type attribute of script elements for safe DOM manipulation\n\tfunction disableScript( elem ) {\n\t\telem.type = ( jQuery.find.attr( elem, \"type\" ) !== null ) + \"/\" + elem.type;\n\t\treturn elem;\n\t}\n\tfunction restoreScript( elem ) {\n\t\tvar match = rscriptTypeMasked.exec( elem.type );\n\t\tif ( match ) {\n\t\t\telem.type = match[ 1 ];\n\t\t} else {\n\t\t\telem.removeAttribute( \"type\" );\n\t\t}\n\t\treturn elem;\n\t}\n\t\n\tfunction cloneCopyEvent( src, dest ) {\n\t\tif ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\tvar type, i, l,\n\t\t\toldData = jQuery._data( src ),\n\t\t\tcurData = jQuery._data( dest, oldData ),\n\t\t\tevents = oldData.events;\n\t\n\t\tif ( events ) {\n\t\t\tdelete curData.handle;\n\t\t\tcurData.events = {};\n\t\n\t\t\tfor ( type in events ) {\n\t\t\t\tfor ( i = 0, l = events[ type ].length; i < l; i++ ) {\n\t\t\t\t\tjQuery.event.add( dest, type, events[ type ][ i ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// make the cloned public data object a copy from the original\n\t\tif ( curData.data ) {\n\t\t\tcurData.data = jQuery.extend( {}, curData.data );\n\t\t}\n\t}\n\t\n\tfunction fixCloneNodeIssues( src, dest ) {\n\t\tvar nodeName, e, data;\n\t\n\t\t// We do not need to do anything for non-Elements\n\t\tif ( dest.nodeType !== 1 ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\tnodeName = dest.nodeName.toLowerCase();\n\t\n\t\t// IE6-8 copies events bound via attachEvent when using cloneNode.\n\t\tif ( !support.noCloneEvent && dest[ jQuery.expando ] ) {\n\t\t\tdata = jQuery._data( dest );\n\t\n\t\t\tfor ( e in data.events ) {\n\t\t\t\tjQuery.removeEvent( dest, e, data.handle );\n\t\t\t}\n\t\n\t\t\t// Event data gets referenced instead of copied if the expando gets copied too\n\t\t\tdest.removeAttribute( jQuery.expando );\n\t\t}\n\t\n\t\t// IE blanks contents when cloning scripts, and tries to evaluate newly-set text\n\t\tif ( nodeName === \"script\" && dest.text !== src.text ) {\n\t\t\tdisableScript( dest ).text = src.text;\n\t\t\trestoreScript( dest );\n\t\n\t\t// IE6-10 improperly clones children of object elements using classid.\n\t\t// IE10 throws NoModificationAllowedError if parent is null, #12132.\n\t\t} else if ( nodeName === \"object\" ) {\n\t\t\tif ( dest.parentNode ) {\n\t\t\t\tdest.outerHTML = src.outerHTML;\n\t\t\t}\n\t\n\t\t\t// This path appears unavoidable for IE9. When cloning an object\n\t\t\t// element in IE9, the outerHTML strategy above is not sufficient.\n\t\t\t// If the src has innerHTML and the destination does not,\n\t\t\t// copy the src.innerHTML into the dest.innerHTML. #10324\n\t\t\tif ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) {\n\t\t\t\tdest.innerHTML = src.innerHTML;\n\t\t\t}\n\t\n\t\t} else if ( nodeName === \"input\" && rcheckableType.test( src.type ) ) {\n\t\n\t\t\t// IE6-8 fails to persist the checked state of a cloned checkbox\n\t\t\t// or radio button. Worse, IE6-7 fail to give the cloned element\n\t\t\t// a checked appearance if the defaultChecked value isn't also set\n\t\n\t\t\tdest.defaultChecked = dest.checked = src.checked;\n\t\n\t\t\t// IE6-7 get confused and end up setting the value of a cloned\n\t\t\t// checkbox/radio button to an empty string instead of \"on\"\n\t\t\tif ( dest.value !== src.value ) {\n\t\t\t\tdest.value = src.value;\n\t\t\t}\n\t\n\t\t// IE6-8 fails to return the selected option to the default selected\n\t\t// state when cloning options\n\t\t} else if ( nodeName === \"option\" ) {\n\t\t\tdest.defaultSelected = dest.selected = src.defaultSelected;\n\t\n\t\t// IE6-8 fails to set the defaultValue to the correct value when\n\t\t// cloning other types of input fields\n\t\t} else if ( nodeName === \"input\" || nodeName === \"textarea\" ) {\n\t\t\tdest.defaultValue = src.defaultValue;\n\t\t}\n\t}\n\t\n\tfunction domManip( collection, args, callback, ignored ) {\n\t\n\t\t// Flatten any nested arrays\n\t\targs = concat.apply( [], args );\n\t\n\t\tvar first, node, hasScripts,\n\t\t\tscripts, doc, fragment,\n\t\t\ti = 0,\n\t\t\tl = collection.length,\n\t\t\tiNoClone = l - 1,\n\t\t\tvalue = args[ 0 ],\n\t\t\tisFunction = jQuery.isFunction( value );\n\t\n\t\t// We can't cloneNode fragments that contain checked, in WebKit\n\t\tif ( isFunction ||\n\t\t\t\t( l > 1 && typeof value === \"string\" &&\n\t\t\t\t\t!support.checkClone && rchecked.test( value ) ) ) {\n\t\t\treturn collection.each( function( index ) {\n\t\t\t\tvar self = collection.eq( index );\n\t\t\t\tif ( isFunction ) {\n\t\t\t\t\targs[ 0 ] = value.call( this, index, self.html() );\n\t\t\t\t}\n\t\t\t\tdomManip( self, args, callback, ignored );\n\t\t\t} );\n\t\t}\n\t\n\t\tif ( l ) {\n\t\t\tfragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );\n\t\t\tfirst = fragment.firstChild;\n\t\n\t\t\tif ( fragment.childNodes.length === 1 ) {\n\t\t\t\tfragment = first;\n\t\t\t}\n\t\n\t\t\t// Require either new content or an interest in ignored elements to invoke the callback\n\t\t\tif ( first || ignored ) {\n\t\t\t\tscripts = jQuery.map( getAll( fragment, \"script\" ), disableScript );\n\t\t\t\thasScripts = scripts.length;\n\t\n\t\t\t\t// Use the original fragment for the last item\n\t\t\t\t// instead of the first because it can end up\n\t\t\t\t// being emptied incorrectly in certain situations (#8070).\n\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\tnode = fragment;\n\t\n\t\t\t\t\tif ( i !== iNoClone ) {\n\t\t\t\t\t\tnode = jQuery.clone( node, true, true );\n\t\n\t\t\t\t\t\t// Keep references to cloned scripts for later restoration\n\t\t\t\t\t\tif ( hasScripts ) {\n\t\n\t\t\t\t\t\t\t// Support: Android<4.1, PhantomJS<2\n\t\t\t\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\t\t\t\tjQuery.merge( scripts, getAll( node, \"script\" ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\tcallback.call( collection[ i ], node, i );\n\t\t\t\t}\n\t\n\t\t\t\tif ( hasScripts ) {\n\t\t\t\t\tdoc = scripts[ scripts.length - 1 ].ownerDocument;\n\t\n\t\t\t\t\t// Reenable scripts\n\t\t\t\t\tjQuery.map( scripts, restoreScript );\n\t\n\t\t\t\t\t// Evaluate executable scripts on first document insertion\n\t\t\t\t\tfor ( i = 0; i < hasScripts; i++ ) {\n\t\t\t\t\t\tnode = scripts[ i ];\n\t\t\t\t\t\tif ( rscriptType.test( node.type || \"\" ) &&\n\t\t\t\t\t\t\t!jQuery._data( node, \"globalEval\" ) &&\n\t\t\t\t\t\t\tjQuery.contains( doc, node ) ) {\n\t\n\t\t\t\t\t\t\tif ( node.src ) {\n\t\n\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\tif ( jQuery._evalUrl ) {\n\t\t\t\t\t\t\t\t\tjQuery._evalUrl( node.src );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjQuery.globalEval(\n\t\t\t\t\t\t\t\t\t( node.text || node.textContent || node.innerHTML || \"\" )\n\t\t\t\t\t\t\t\t\t\t.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\t\t\t}\n\t\n\t\t\t\t// Fix #11809: Avoid leaking memory\n\t\t\t\tfragment = first = null;\n\t\t\t}\n\t\t}\n\t\n\t\treturn collection;\n\t}\n\t\n\tfunction remove( elem, selector, keepData ) {\n\t\tvar node,\n\t\t\telems = selector ? jQuery.filter( selector, elem ) : elem,\n\t\t\ti = 0;\n\t\n\t\tfor ( ; ( node = elems[ i ] ) != null; i++ ) {\n\t\n\t\t\tif ( !keepData && node.nodeType === 1 ) {\n\t\t\t\tjQuery.cleanData( getAll( node ) );\n\t\t\t}\n\t\n\t\t\tif ( node.parentNode ) {\n\t\t\t\tif ( keepData && jQuery.contains( node.ownerDocument, node ) ) {\n\t\t\t\t\tsetGlobalEval( getAll( node, \"script\" ) );\n\t\t\t\t}\n\t\t\t\tnode.parentNode.removeChild( node );\n\t\t\t}\n\t\t}\n\t\n\t\treturn elem;\n\t}\n\t\n\tjQuery.extend( {\n\t\thtmlPrefilter: function( html ) {\n\t\t\treturn html.replace( rxhtmlTag, \"<$1>\" );\n\t\t},\n\t\n\t\tclone: function( elem, dataAndEvents, deepDataAndEvents ) {\n\t\t\tvar destElements, node, clone, i, srcElements,\n\t\t\t\tinPage = jQuery.contains( elem.ownerDocument, elem );\n\t\n\t\t\tif ( support.html5Clone || jQuery.isXMLDoc( elem ) ||\n\t\t\t\t!rnoshimcache.test( \"<\" + elem.nodeName + \">\" ) ) {\n\t\n\t\t\t\tclone = elem.cloneNode( true );\n\t\n\t\t\t// IE<=8 does not properly clone detached, unknown element nodes\n\t\t\t} else {\n\t\t\t\tfragmentDiv.innerHTML = elem.outerHTML;\n\t\t\t\tfragmentDiv.removeChild( clone = fragmentDiv.firstChild );\n\t\t\t}\n\t\n\t\t\tif ( ( !support.noCloneEvent || !support.noCloneChecked ) &&\n\t\t\t\t\t( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {\n\t\n\t\t\t\t// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2\n\t\t\t\tdestElements = getAll( clone );\n\t\t\t\tsrcElements = getAll( elem );\n\t\n\t\t\t\t// Fix all IE cloning issues\n\t\t\t\tfor ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) {\n\t\n\t\t\t\t\t// Ensure that the destination node is not null; Fixes #9587\n\t\t\t\t\tif ( destElements[ i ] ) {\n\t\t\t\t\t\tfixCloneNodeIssues( node, destElements[ i ] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Copy the events from the original to the clone\n\t\t\tif ( dataAndEvents ) {\n\t\t\t\tif ( deepDataAndEvents ) {\n\t\t\t\t\tsrcElements = srcElements || getAll( elem );\n\t\t\t\t\tdestElements = destElements || getAll( clone );\n\t\n\t\t\t\t\tfor ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) {\n\t\t\t\t\t\tcloneCopyEvent( node, destElements[ i ] );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcloneCopyEvent( elem, clone );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Preserve script evaluation history\n\t\t\tdestElements = getAll( clone, \"script\" );\n\t\t\tif ( destElements.length > 0 ) {\n\t\t\t\tsetGlobalEval( destElements, !inPage && getAll( elem, \"script\" ) );\n\t\t\t}\n\t\n\t\t\tdestElements = srcElements = node = null;\n\t\n\t\t\t// Return the cloned set\n\t\t\treturn clone;\n\t\t},\n\t\n\t\tcleanData: function( elems, /* internal */ forceAcceptData ) {\n\t\t\tvar elem, type, id, data,\n\t\t\t\ti = 0,\n\t\t\t\tinternalKey = jQuery.expando,\n\t\t\t\tcache = jQuery.cache,\n\t\t\t\tattributes = support.attributes,\n\t\t\t\tspecial = jQuery.event.special;\n\t\n\t\t\tfor ( ; ( elem = elems[ i ] ) != null; i++ ) {\n\t\t\t\tif ( forceAcceptData || acceptData( elem ) ) {\n\t\n\t\t\t\t\tid = elem[ internalKey ];\n\t\t\t\t\tdata = id && cache[ id ];\n\t\n\t\t\t\t\tif ( data ) {\n\t\t\t\t\t\tif ( data.events ) {\n\t\t\t\t\t\t\tfor ( type in data.events ) {\n\t\t\t\t\t\t\t\tif ( special[ type ] ) {\n\t\t\t\t\t\t\t\t\tjQuery.event.remove( elem, type );\n\t\n\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} else {\n\t\t\t\t\t\t\t\t\tjQuery.removeEvent( elem, type, data.handle );\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\t// Remove cache only if it was not already removed by jQuery.event.remove\n\t\t\t\t\t\tif ( cache[ id ] ) {\n\t\n\t\t\t\t\t\t\tdelete cache[ id ];\n\t\n\t\t\t\t\t\t\t// Support: IE<9\n\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// IE creates expando attributes along with the property\n\t\t\t\t\t\t\t// IE does not have a removeAttribute function on Document nodes\n\t\t\t\t\t\t\tif ( !attributes && typeof elem.removeAttribute !== \"undefined\" ) {\n\t\t\t\t\t\t\t\telem.removeAttribute( internalKey );\n\t\n\t\t\t\t\t\t\t// Webkit & Blink performance suffers when deleting properties\n\t\t\t\t\t\t\t// from DOM nodes, so set to undefined instead\n\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} else {\n\t\t\t\t\t\t\t\telem[ internalKey ] = undefined;\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\tdeletedIds.push( id );\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\n\tjQuery.fn.extend( {\n\t\n\t\t// Keep domManip exposed until 3.0 (gh-2225)\n\t\tdomManip: domManip,\n\t\n\t\tdetach: function( selector ) {\n\t\t\treturn remove( this, selector, true );\n\t\t},\n\t\n\t\tremove: function( selector ) {\n\t\t\treturn remove( this, selector );\n\t\t},\n\t\n\t\ttext: function( value ) {\n\t\t\treturn access( this, function( value ) {\n\t\t\t\treturn value === undefined ?\n\t\t\t\t\tjQuery.text( this ) :\n\t\t\t\t\tthis.empty().append(\n\t\t\t\t\t\t( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value )\n\t\t\t\t\t);\n\t\t\t}, null, value, arguments.length );\n\t\t},\n\t\n\t\tappend: function() {\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\t\ttarget.appendChild( elem );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tprepend: function() {\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\t\ttarget.insertBefore( elem, target.firstChild );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tbefore: function() {\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tif ( this.parentNode ) {\n\t\t\t\t\tthis.parentNode.insertBefore( elem, this );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tafter: function() {\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tif ( this.parentNode ) {\n\t\t\t\t\tthis.parentNode.insertBefore( elem, this.nextSibling );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tempty: function() {\n\t\t\tvar elem,\n\t\t\t\ti = 0;\n\t\n\t\t\tfor ( ; ( elem = this[ i ] ) != null; i++ ) {\n\t\n\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\t\t\t\t}\n\t\n\t\t\t\t// Remove any remaining nodes\n\t\t\t\twhile ( elem.firstChild ) {\n\t\t\t\t\telem.removeChild( elem.firstChild );\n\t\t\t\t}\n\t\n\t\t\t\t// If this is a select, ensure that it displays empty (#12336)\n\t\t\t\t// Support: IE<9\n\t\t\t\tif ( elem.options && jQuery.nodeName( elem, \"select\" ) ) {\n\t\t\t\t\telem.options.length = 0;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn this;\n\t\t},\n\t\n\t\tclone: function( dataAndEvents, deepDataAndEvents ) {\n\t\t\tdataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n\t\t\tdeepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\t\n\t\t\treturn this.map( function() {\n\t\t\t\treturn jQuery.clone( this, dataAndEvents, deepDataAndEvents );\n\t\t\t} );\n\t\t},\n\t\n\t\thtml: function( value ) {\n\t\t\treturn access( this, function( value ) {\n\t\t\t\tvar elem = this[ 0 ] || {},\n\t\t\t\t\ti = 0,\n\t\t\t\t\tl = this.length;\n\t\n\t\t\t\tif ( value === undefined ) {\n\t\t\t\t\treturn elem.nodeType === 1 ?\n\t\t\t\t\t\telem.innerHTML.replace( rinlinejQuery, \"\" ) :\n\t\t\t\t\t\tundefined;\n\t\t\t\t}\n\t\n\t\t\t\t// See if we can take a shortcut and just use innerHTML\n\t\t\t\tif ( typeof value === \"string\" && !rnoInnerhtml.test( value ) &&\n\t\t\t\t\t( support.htmlSerialize || !rnoshimcache.test( value ) ) &&\n\t\t\t\t\t( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&\n\t\t\t\t\t!wrapMap[ ( rtagName.exec( value ) || [ \"\", \"\" ] )[ 1 ].toLowerCase() ] ) {\n\t\n\t\t\t\t\tvalue = jQuery.htmlPrefilter( value );\n\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor ( ; i < l; i++ ) {\n\t\n\t\t\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\t\t\telem = this[ i ] || {};\n\t\t\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\t\t\t\t\t\t\t\telem.innerHTML = value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\telem = 0;\n\t\n\t\t\t\t\t// If using innerHTML throws an exception, use the fallback method\n\t\t\t\t\t} catch ( e ) {}\n\t\t\t\t}\n\t\n\t\t\t\tif ( elem ) {\n\t\t\t\t\tthis.empty().append( value );\n\t\t\t\t}\n\t\t\t}, null, value, arguments.length );\n\t\t},\n\t\n\t\treplaceWith: function() {\n\t\t\tvar ignored = [];\n\t\n\t\t\t// Make the changes, replacing each non-ignored context element with the new content\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tvar parent = this.parentNode;\n\t\n\t\t\t\tif ( jQuery.inArray( this, ignored ) < 0 ) {\n\t\t\t\t\tjQuery.cleanData( getAll( this ) );\n\t\t\t\t\tif ( parent ) {\n\t\t\t\t\t\tparent.replaceChild( elem, this );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t// Force callback invocation\n\t\t\t}, ignored );\n\t\t}\n\t} );\n\t\n\tjQuery.each( {\n\t\tappendTo: \"append\",\n\t\tprependTo: \"prepend\",\n\t\tinsertBefore: \"before\",\n\t\tinsertAfter: \"after\",\n\t\treplaceAll: \"replaceWith\"\n\t}, function( name, original ) {\n\t\tjQuery.fn[ name ] = function( selector ) {\n\t\t\tvar elems,\n\t\t\t\ti = 0,\n\t\t\t\tret = [],\n\t\t\t\tinsert = jQuery( selector ),\n\t\t\t\tlast = insert.length - 1;\n\t\n\t\t\tfor ( ; i <= last; i++ ) {\n\t\t\t\telems = i === last ? this : this.clone( true );\n\t\t\t\tjQuery( insert[ i ] )[ original ]( elems );\n\t\n\t\t\t\t// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()\n\t\t\t\tpush.apply( ret, elems.get() );\n\t\t\t}\n\t\n\t\t\treturn this.pushStack( ret );\n\t\t};\n\t} );\n\t\n\t\n\tvar iframe,\n\t\telemdisplay = {\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/**\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// Called only from within defaultDisplay\n\tfunction actualDisplay( name, doc ) {\n\t\tvar elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),\n\t\n\t\t\tdisplay = jQuery.css( elem[ 0 ], \"display\" );\n\t\n\t\t// We don't have any data stored on the element,\n\t\t// so use \"detach\" method as fast way to get rid of the element\n\t\telem.detach();\n\t\n\t\treturn display;\n\t}\n\t\n\t/**\n\t * Try to determine the default display value of an element\n\t * @param {String} nodeName\n\t */\n\tfunction defaultDisplay( nodeName ) {\n\t\tvar doc = document,\n\t\t\tdisplay = elemdisplay[ nodeName ];\n\t\n\t\tif ( !display ) {\n\t\t\tdisplay = actualDisplay( nodeName, doc );\n\t\n\t\t\t// If the simple way fails, read from inside an iframe\n\t\t\tif ( display === \"none\" || !display ) {\n\t\n\t\t\t\t// Use the already-created iframe if possible\n\t\t\t\tiframe = ( iframe || jQuery( \"\"\n\t )\n\t });\n\t modal.show( { backdrop: true } );\n\t}\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/***/ },\n/* 59 */\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__ = [\n\t __webpack_require__(92),\n\t __webpack_require__(10),\n\t __webpack_require__(8),\n\t __webpack_require__(6)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( Masthead, Panel, Modal, BaseMVC ) {\n\t\n\t// ============================================================================\n\tvar PageLayoutView = Backbone.View.extend( BaseMVC.LoggableMixin ).extend({\n\t _logNamespace : 'layout',\n\t\n\t el : 'body',\n\t className : 'full-content',\n\t\n\t _panelIds : [\n\t 'left', 'center', 'right'\n\t ],\n\t\n\t defaultOptions : {\n\t message_box_visible : false,\n\t message_box_content : '',\n\t message_box_class : 'info',\n\t show_inactivity_warning : false,\n\t inactivity_box_content : ''\n\t },\n\t\n\t initialize : function( options ) {\n\t // TODO: remove globals\n\t this.log( this + '.initialize:', options );\n\t _.extend( this, _.pick( options, this._panelIds ) );\n\t this.options = _.defaults( _.omit( options.config, this._panelIds ), this.defaultOptions );\n\t Galaxy.modal = this.modal = new Modal.View();\n\t this.masthead = new Masthead.View( this.options );\n\t this.$el.attr( 'scroll', 'no' );\n\t this.$el.html( this._template() );\n\t this.$el.append( this.masthead.frame.$el );\n\t this.$( '#masthead' ).replaceWith( this.masthead.$el );\n\t this.$el.append( this.modal.$el );\n\t this.$messagebox = this.$( '#messagebox' );\n\t this.$inactivebox = this.$( '#inactivebox' );\n\t },\n\t\n\t render : function() {\n\t // TODO: Remove this line after select2 update\n\t $( '.select2-hidden-accessible' ).remove();\n\t this.log( this + '.render:' );\n\t this.masthead.render();\n\t this.renderMessageBox();\n\t this.renderInactivityBox();\n\t this.renderPanels();\n\t this._checkCommunicationServerOnline();\n\t return this;\n\t },\n\t\n\t /** Render message box */\n\t renderMessageBox : function() {\n\t if ( this.options.message_box_visible ){\n\t var content = this.options.message_box_content || '';\n\t var level = this.options.message_box_class || 'info';\n\t this.$el.addClass( 'has-message-box' );\n\t this.$messagebox\n\t .attr( 'class', 'panel-' + level + '-message' )\n\t .html( content )\n\t .toggle( !!content )\n\t .show();\n\t } else {\n\t this.$el.removeClass( 'has-message-box' );\n\t this.$messagebox.hide();\n\t }\n\t return this;\n\t },\n\t\n\t /** Render inactivity warning */\n\t renderInactivityBox : function() {\n\t if( this.options.show_inactivity_warning ){\n\t var content = this.options.inactivity_box_content || '';\n\t var verificationLink = $( '' ).attr( 'href', Galaxy.root + 'user/resend_verification' ).text( 'Resend verification' );\n\t this.$el.addClass( 'has-inactivity-box' );\n\t this.$inactivebox\n\t .html( content + ' ' )\n\t .append( verificationLink )\n\t .toggle( !!content )\n\t .show();\n\t } else {\n\t this.$el.removeClass( 'has-inactivity-box' );\n\t this.$inactivebox.hide();\n\t }\n\t return this;\n\t },\n\t\n\t /** Render panels */\n\t renderPanels : function() {\n\t var page = this;\n\t this._panelIds.forEach( function( panelId ){\n\t if( _.has( page, panelId ) ){\n\t page[ panelId ].setElement( '#' + panelId );\n\t page[ panelId ].render();\n\t }\n\t });\n\t if( !this.left ){\n\t this.center.$el.css( 'left', 0 );\n\t }\n\t if( !this.right ){\n\t this.center.$el.css( 'right', 0 );\n\t }\n\t return this;\n\t },\n\t\n\t /** body template */\n\t _template: function() {\n\t return [\n\t '
                                            ',\n\t '
                                            ',\n\t '
                                            ',\n\t '
                                            ',\n\t '
                                            ',\n\t this.left? '
                                            ' : '',\n\t this.center? '
                                            ' : '',\n\t this.right? '
                                            ' : '',\n\t '
                                            ',\n\t '
                                            ',\n\t ].join('');\n\t },\n\t\n\t /** hide both side panels if previously shown */\n\t hideSidePanels : function(){\n\t if( this.left ){\n\t this.left.hide();\n\t }\n\t if( this.right ){\n\t this.right.hide();\n\t }\n\t },\n\t\n\t toString : function() { return 'PageLayoutView'; },\n\t\n\t /** Check if the communication server is online and show the icon otherwise hide the icon */\n\t _checkCommunicationServerOnline: function(){\n\t var host = window.Galaxy.config.communication_server_host,\n\t port = window.Galaxy.config.communication_server_port,\n\t $chat_icon_element = $( \"#show-chat-online\" );\n\t /** Check if the user has deactivated the communication in it's personal settings */\n\t if (window.Galaxy.user.attributes.preferences !== undefined && window.Galaxy.user.attributes.preferences.communication_server === '1') {\n\t // See if the configured communication server is available\n\t $.ajax({\n\t url: host + \":\" + port,\n\t })\n\t .success( function( data ) { \n\t // enable communication only when a user is logged in\n\t if( window.Galaxy.user.id !== null ) {\n\t if( $chat_icon_element.css( \"visibility\") === \"hidden\" ) {\n\t $chat_icon_element.css( \"visibility\", \"visible\" ); \n\t }\n\t }\n\t })\n\t .error( function( data ) { \n\t // hide the communication icon if the communication server is not available\n\t $chat_icon_element.css( \"visibility\", \"hidden\" ); \n\t });\n\t } else {\n\t $chat_icon_element.css( \"visibility\", \"hidden\" ); \n\t }\n\t },\n\t});\n\t\n\t// ============================================================================\n\t return {\n\t PageLayoutView: PageLayoutView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\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\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 })();\n\t return window.Tour = Tour;\n\t})(jQuery, window);\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 61 */\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){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 )\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/layout/modal.js\n ** module id = 58\n ** module chunks = 2\n **/","define([\n 'layout/masthead',\n 'layout/panel',\n 'mvc/ui/ui-modal',\n 'mvc/base-mvc'\n], function( Masthead, Panel, Modal, BaseMVC ) {\n\n// ============================================================================\nvar PageLayoutView = Backbone.View.extend( BaseMVC.LoggableMixin ).extend({\n _logNamespace : 'layout',\n\n el : 'body',\n className : 'full-content',\n\n _panelIds : [\n 'left', 'center', 'right'\n ],\n\n defaultOptions : {\n message_box_visible : false,\n message_box_content : '',\n message_box_class : 'info',\n show_inactivity_warning : false,\n inactivity_box_content : ''\n },\n\n initialize : function( options ) {\n // TODO: remove globals\n this.log( this + '.initialize:', options );\n _.extend( this, _.pick( options, this._panelIds ) );\n this.options = _.defaults( _.omit( options.config, this._panelIds ), this.defaultOptions );\n Galaxy.modal = this.modal = new Modal.View();\n this.masthead = new Masthead.View( this.options );\n this.$el.attr( 'scroll', 'no' );\n this.$el.html( this._template() );\n this.$el.append( this.masthead.frame.$el );\n this.$( '#masthead' ).replaceWith( this.masthead.$el );\n this.$el.append( this.modal.$el );\n this.$messagebox = this.$( '#messagebox' );\n this.$inactivebox = this.$( '#inactivebox' );\n },\n\n render : function() {\n // TODO: Remove this line after select2 update\n $( '.select2-hidden-accessible' ).remove();\n this.log( this + '.render:' );\n this.masthead.render();\n this.renderMessageBox();\n this.renderInactivityBox();\n this.renderPanels();\n this._checkCommunicationServerOnline();\n return this;\n },\n\n /** Render message box */\n renderMessageBox : function() {\n if ( this.options.message_box_visible ){\n var content = this.options.message_box_content || '';\n var level = this.options.message_box_class || 'info';\n this.$el.addClass( 'has-message-box' );\n this.$messagebox\n .attr( 'class', 'panel-' + level + '-message' )\n .html( content )\n .toggle( !!content )\n .show();\n } else {\n this.$el.removeClass( 'has-message-box' );\n this.$messagebox.hide();\n }\n return this;\n },\n\n /** Render inactivity warning */\n renderInactivityBox : function() {\n if( this.options.show_inactivity_warning ){\n var content = this.options.inactivity_box_content || '';\n var verificationLink = $( '
                                            ' ).attr( 'href', Galaxy.root + 'user/resend_verification' ).text( 'Resend verification' );\n this.$el.addClass( 'has-inactivity-box' );\n this.$inactivebox\n .html( content + ' ' )\n .append( verificationLink )\n .toggle( !!content )\n .show();\n } else {\n this.$el.removeClass( 'has-inactivity-box' );\n this.$inactivebox.hide();\n }\n return this;\n },\n\n /** Render panels */\n renderPanels : function() {\n var page = this;\n this._panelIds.forEach( function( panelId ){\n if( _.has( page, panelId ) ){\n page[ panelId ].setElement( '#' + panelId );\n page[ panelId ].render();\n }\n });\n if( !this.left ){\n this.center.$el.css( 'left', 0 );\n }\n if( !this.right ){\n this.center.$el.css( 'right', 0 );\n }\n return this;\n },\n\n /** body template */\n _template: function() {\n return [\n '
                                            ',\n '
                                            ',\n '
                                            ',\n '
                                            ',\n '
                                            ',\n this.left? '
                                            ' : '',\n this.center? '
                                            ' : '',\n this.right? '
                                            ' : '',\n '
                                            ',\n '
                                            ',\n ].join('');\n },\n\n /** hide both side panels if previously shown */\n hideSidePanels : function(){\n if( this.left ){\n this.left.hide();\n }\n if( this.right ){\n this.right.hide();\n }\n },\n\n toString : function() { return 'PageLayoutView'; },\n\n /** Check if the communication server is online and show the icon otherwise hide the icon */\n _checkCommunicationServerOnline: function(){\n var host = window.Galaxy.config.communication_server_host,\n port = window.Galaxy.config.communication_server_port,\n $chat_icon_element = $( \"#show-chat-online\" );\n /** Check if the user has deactivated the communication in it's personal settings */\n if (window.Galaxy.user.attributes.preferences !== undefined && window.Galaxy.user.attributes.preferences.communication_server === '1') {\n // See if the configured communication server is available\n $.ajax({\n url: host + \":\" + port,\n })\n .success( function( data ) { \n // enable communication only when a user is logged in\n if( window.Galaxy.user.id !== null ) {\n if( $chat_icon_element.css( \"visibility\") === \"hidden\" ) {\n $chat_icon_element.css( \"visibility\", \"visible\" ); \n }\n }\n })\n .error( function( data ) { \n // hide the communication icon if the communication server is not available\n $chat_icon_element.css( \"visibility\", \"hidden\" ); \n });\n } else {\n $chat_icon_element.css( \"visibility\", \"hidden\" ); \n }\n },\n});\n\n// ============================================================================\n return {\n PageLayoutView: PageLayoutView\n };\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/layout/page.js\n ** module id = 59\n ** module chunks = 2\n **/","/* ========================================================================\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/libs/bootstrap-tour.js\n ** module id = 60\n ** module chunks = 2\n **/","/*! 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 });\n\t modal.show( { backdrop: true } );\n\t}\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/***/ },\n/* 59 */\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__ = [\n\t __webpack_require__(92),\n\t __webpack_require__(10),\n\t __webpack_require__(8),\n\t __webpack_require__(6)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function( Masthead, Panel, Modal, BaseMVC ) {\n\t\n\t// ============================================================================\n\tvar PageLayoutView = Backbone.View.extend( BaseMVC.LoggableMixin ).extend({\n\t _logNamespace : 'layout',\n\t\n\t el : 'body',\n\t className : 'full-content',\n\t\n\t _panelIds : [\n\t 'left', 'center', 'right'\n\t ],\n\t\n\t defaultOptions : {\n\t message_box_visible : false,\n\t message_box_content : '',\n\t message_box_class : 'info',\n\t show_inactivity_warning : false,\n\t inactivity_box_content : ''\n\t },\n\t\n\t initialize : function( options ) {\n\t // TODO: remove globals\n\t this.log( this + '.initialize:', options );\n\t _.extend( this, _.pick( options, this._panelIds ) );\n\t this.options = _.defaults( _.omit( options.config, this._panelIds ), this.defaultOptions );\n\t Galaxy.modal = this.modal = new Modal.View();\n\t this.masthead = new Masthead.View( this.options );\n\t this.$el.attr( 'scroll', 'no' );\n\t this.$el.html( this._template() );\n\t this.$el.append( this.masthead.frame.$el );\n\t this.$( '#masthead' ).replaceWith( this.masthead.$el );\n\t this.$el.append( this.modal.$el );\n\t this.$messagebox = this.$( '#messagebox' );\n\t this.$inactivebox = this.$( '#inactivebox' );\n\t },\n\t\n\t render : function() {\n\t // TODO: Remove this line after select2 update\n\t $( '.select2-hidden-accessible' ).remove();\n\t this.log( this + '.render:' );\n\t this.masthead.render();\n\t this.renderMessageBox();\n\t this.renderInactivityBox();\n\t this.renderPanels();\n\t this._checkCommunicationServerOnline();\n\t return this;\n\t },\n\t\n\t /** Render message box */\n\t renderMessageBox : function() {\n\t if ( this.options.message_box_visible ){\n\t var content = this.options.message_box_content || '';\n\t var level = this.options.message_box_class || 'info';\n\t this.$el.addClass( 'has-message-box' );\n\t this.$messagebox\n\t .attr( 'class', 'panel-' + level + '-message' )\n\t .html( content )\n\t .toggle( !!content )\n\t .show();\n\t } else {\n\t this.$el.removeClass( 'has-message-box' );\n\t this.$messagebox.hide();\n\t }\n\t return this;\n\t },\n\t\n\t /** Render inactivity warning */\n\t renderInactivityBox : function() {\n\t if( this.options.show_inactivity_warning ){\n\t var content = this.options.inactivity_box_content || '';\n\t var verificationLink = $( '
                                            ' ).attr( 'href', Galaxy.root + 'user/resend_verification' ).text( 'Resend verification' );\n\t this.$el.addClass( 'has-inactivity-box' );\n\t this.$inactivebox\n\t .html( content + ' ' )\n\t .append( verificationLink )\n\t .toggle( !!content )\n\t .show();\n\t } else {\n\t this.$el.removeClass( 'has-inactivity-box' );\n\t this.$inactivebox.hide();\n\t }\n\t return this;\n\t },\n\t\n\t /** Render panels */\n\t renderPanels : function() {\n\t var page = this;\n\t this._panelIds.forEach( function( panelId ){\n\t if( _.has( page, panelId ) ){\n\t page[ panelId ].setElement( '#' + panelId );\n\t page[ panelId ].render();\n\t }\n\t });\n\t if( !this.left ){\n\t this.center.$el.css( 'left', 0 );\n\t }\n\t if( !this.right ){\n\t this.center.$el.css( 'right', 0 );\n\t }\n\t return this;\n\t },\n\t\n\t /** body template */\n\t _template: function() {\n\t return [\n\t '
                                            ',\n\t '
                                            ',\n\t '
                                            ',\n\t '
                                            ',\n\t '
                                            ',\n\t this.left? '
                                            ' : '',\n\t this.center? '
                                            ' : '',\n\t this.right? '
                                            ' : '',\n\t '
                                            ',\n\t '
                                            ',\n\t ].join('');\n\t },\n\t\n\t /** hide both side panels if previously shown */\n\t hideSidePanels : function(){\n\t if( this.left ){\n\t this.left.hide();\n\t }\n\t if( this.right ){\n\t this.right.hide();\n\t }\n\t },\n\t\n\t toString : function() { return 'PageLayoutView'; },\n\t\n\t /** Check if the communication server is online and show the icon otherwise hide the icon */\n\t _checkCommunicationServerOnline: function(){\n\t var host = window.Galaxy.config.communication_server_host,\n\t port = window.Galaxy.config.communication_server_port,\n\t $chat_icon_element = $( \"#show-chat-online\" );\n\t /** Check if the user has deactivated the communication in it's personal settings */\n\t if (window.Galaxy.user.attributes.preferences !== undefined && window.Galaxy.user.attributes.preferences.communication_server === '1') {\n\t // See if the configured communication server is available\n\t $.ajax({\n\t url: host + \":\" + port,\n\t })\n\t .success( function( data ) { \n\t // enable communication only when a user is logged in\n\t if( window.Galaxy.user.id !== null ) {\n\t if( $chat_icon_element.css( \"visibility\") === \"hidden\" ) {\n\t $chat_icon_element.css( \"visibility\", \"visible\" ); \n\t }\n\t }\n\t })\n\t .error( function( data ) { \n\t // hide the communication icon if the communication server is not available\n\t $chat_icon_element.css( \"visibility\", \"hidden\" ); \n\t });\n\t } else {\n\t $chat_icon_element.css( \"visibility\", \"hidden\" ); \n\t }\n\t },\n\t});\n\t\n\t// ============================================================================\n\t return {\n\t PageLayoutView: PageLayoutView\n\t };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\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\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 })();\n\t return window.Tour = Tour;\n\t})(jQuery, window);\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 61 */\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){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 )\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/layout/modal.js\n ** module id = 58\n ** module chunks = 2\n **/","define([\n 'layout/masthead',\n 'layout/panel',\n 'mvc/ui/ui-modal',\n 'mvc/base-mvc'\n], function( Masthead, Panel, Modal, BaseMVC ) {\n\n// ============================================================================\nvar PageLayoutView = Backbone.View.extend( BaseMVC.LoggableMixin ).extend({\n _logNamespace : 'layout',\n\n el : 'body',\n className : 'full-content',\n\n _panelIds : [\n 'left', 'center', 'right'\n ],\n\n defaultOptions : {\n message_box_visible : false,\n message_box_content : '',\n message_box_class : 'info',\n show_inactivity_warning : false,\n inactivity_box_content : ''\n },\n\n initialize : function( options ) {\n // TODO: remove globals\n this.log( this + '.initialize:', options );\n _.extend( this, _.pick( options, this._panelIds ) );\n this.options = _.defaults( _.omit( options.config, this._panelIds ), this.defaultOptions );\n Galaxy.modal = this.modal = new Modal.View();\n this.masthead = new Masthead.View( this.options );\n this.$el.attr( 'scroll', 'no' );\n this.$el.html( this._template() );\n this.$el.append( this.masthead.frame.$el );\n this.$( '#masthead' ).replaceWith( this.masthead.$el );\n this.$el.append( this.modal.$el );\n this.$messagebox = this.$( '#messagebox' );\n this.$inactivebox = this.$( '#inactivebox' );\n },\n\n render : function() {\n // TODO: Remove this line after select2 update\n $( '.select2-hidden-accessible' ).remove();\n this.log( this + '.render:' );\n this.masthead.render();\n this.renderMessageBox();\n this.renderInactivityBox();\n this.renderPanels();\n this._checkCommunicationServerOnline();\n return this;\n },\n\n /** Render message box */\n renderMessageBox : function() {\n if ( this.options.message_box_visible ){\n var content = this.options.message_box_content || '';\n var level = this.options.message_box_class || 'info';\n this.$el.addClass( 'has-message-box' );\n this.$messagebox\n .attr( 'class', 'panel-' + level + '-message' )\n .html( content )\n .toggle( !!content )\n .show();\n } else {\n this.$el.removeClass( 'has-message-box' );\n this.$messagebox.hide();\n }\n return this;\n },\n\n /** Render inactivity warning */\n renderInactivityBox : function() {\n if( this.options.show_inactivity_warning ){\n var content = this.options.inactivity_box_content || '';\n var verificationLink = $( '
                                            ' ).attr( 'href', Galaxy.root + 'user/resend_verification' ).text( 'Resend verification' );\n this.$el.addClass( 'has-inactivity-box' );\n this.$inactivebox\n .html( content + ' ' )\n .append( verificationLink )\n .toggle( !!content )\n .show();\n } else {\n this.$el.removeClass( 'has-inactivity-box' );\n this.$inactivebox.hide();\n }\n return this;\n },\n\n /** Render panels */\n renderPanels : function() {\n var page = this;\n this._panelIds.forEach( function( panelId ){\n if( _.has( page, panelId ) ){\n page[ panelId ].setElement( '#' + panelId );\n page[ panelId ].render();\n }\n });\n if( !this.left ){\n this.center.$el.css( 'left', 0 );\n }\n if( !this.right ){\n this.center.$el.css( 'right', 0 );\n }\n return this;\n },\n\n /** body template */\n _template: function() {\n return [\n '
                                            ',\n '
                                            ',\n '
                                            ',\n '
                                            ',\n '
                                            ',\n this.left? '
                                            ' : '',\n this.center? '
                                            ' : '',\n this.right? '
                                            ' : '',\n '
                                            ',\n '
                                            ',\n ].join('');\n },\n\n /** hide both side panels if previously shown */\n hideSidePanels : function(){\n if( this.left ){\n this.left.hide();\n }\n if( this.right ){\n this.right.hide();\n }\n },\n\n toString : function() { return 'PageLayoutView'; },\n\n /** Check if the communication server is online and show the icon otherwise hide the icon */\n _checkCommunicationServerOnline: function(){\n var host = window.Galaxy.config.communication_server_host,\n port = window.Galaxy.config.communication_server_port,\n $chat_icon_element = $( \"#show-chat-online\" );\n /** Check if the user has deactivated the communication in it's personal settings */\n if (window.Galaxy.user.attributes.preferences !== undefined && window.Galaxy.user.attributes.preferences.communication_server === '1') {\n // See if the configured communication server is available\n $.ajax({\n url: host + \":\" + port,\n })\n .success( function( data ) { \n // enable communication only when a user is logged in\n if( window.Galaxy.user.id !== null ) {\n if( $chat_icon_element.css( \"visibility\") === \"hidden\" ) {\n $chat_icon_element.css( \"visibility\", \"visible\" ); \n }\n }\n })\n .error( function( data ) { \n // hide the communication icon if the communication server is not available\n $chat_icon_element.css( \"visibility\", \"hidden\" ); \n });\n } else {\n $chat_icon_element.css( \"visibility\", \"hidden\" ); \n }\n },\n});\n\n// ============================================================================\n return {\n PageLayoutView: PageLayoutView\n };\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/layout/page.js\n ** module id = 59\n ** module chunks = 2\n **/","/* ========================================================================\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/*****************\n ** WEBPACK FOOTER\n ** ./galaxy/scripts/libs/bootstrap-tour.js\n ** module id = 60\n ** module chunks = 2\n **/","/*! 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:\"