UNPKG

@gmod/jbrowse

Version:

JBrowse - client-side genome browser

1 lines 1.29 MB
(function(){(this||window).webpackJsonp.registerAbsMids({"JBrowse/Browser":328,"JBrowse/Util":330,"css!css/genome.scss":331,"JBrowse/Model/XHRBlob":334,"JBrowse/Store/SeqFeature":335,"JBrowse/Model/SimpleFeature":336,"JBrowse/Store/DeferredFeaturesMixin":337,"dojo/json":338,"JBrowse/has":339,"JBrowse/Model/FileBlob":340,"JBrowse/Model/Location":341,"dojo/io-query":343,"JBrowse/View/Dialog/WithActionBar":344,"JBrowse/Errors":345,"JBrowse/Digest/Crc32":346,"JBrowse/View/Track/BlockBased":347,"JBrowse/Component":348,"JBrowse/Store/LRUCache":349,"JBrowse/View/InfoDialog":350,"JBrowse/View/FileDialog/TrackList/_IndexedFileDriver":351,"JBrowse/FeatureFiltererMixin":353,"JBrowse/Util/TextIterator":354,"JBrowse/View/FileDialog/TrackList/_MultiIndexedFileDriver":355,"JBrowse/View/TrackConfigEditor":356,"JBrowse/View/Animation":358,"JBrowse/View/FileDialog":359,"JBrowse/View/LocationList":364,"JBrowse/View/Dialog/SetTrackHeight":365,"JBrowse/Store":366,"JBrowse/Store/SeqFeature/IndexedFasta":367,"JBrowse/Store/SeqFeature/TwoBit":368,"JBrowse/Model/BlobFilehandleWrapper":369,"JBrowse/Store/LazyTrie":374,"JBrowse/Store/Names/LazyTrieDojoData":375,"JBrowse/GenomeView":376,"JBrowse/View/Track/LocationScale":377,"JBrowse/View/ConfirmDialog":378,"JBrowse/View/Track/BlockBased/Block":379,"JBrowse/View/DetailsMixin":380,"JBrowse/View/Track/GridLines":381,"JBrowse/BehaviorManager":382,"JBrowse/View/Animation/Zoomer":383,"JBrowse/View/Animation/Slider":384,"JBrowse/TouchScreenSupport":385,"JBrowse/ConfigManager":386,"JBrowse/ConfigAdaptor/AdaptorUtil":387,"JBrowse/View/FileDialog/TrackList/BigWigDriver":388,"JBrowse/View/FileDialog/TrackList/BAMDriver":389,"JBrowse/View/FileDialog/TrackList/CRAMDriver":390,"JBrowse/View/FileDialog/TrackList/GFF3Driver":391,"JBrowse/View/FileDialog/TrackList/GTFDriver":392,"JBrowse/View/FileDialog/TrackList/VCFTabixDriver":393,"JBrowse/View/FileDialog/TrackList/VCFTribbleDriver":394,"JBrowse/View/FileDialog/TrackList/BEDTabixDriver":395,"JBrowse/View/FileDialog/TrackList/GFF3TabixDriver":396,"JBrowse/View/FileDialog/TrackList/BEDDriver":397,"JBrowse/View/FileDialog/TrackList/BigBedDriver":398,"JBrowse/View/FileDialog/ResourceList":399,"JBrowse/View/FileDialog/TrackList":400,"JBrowse/View/FastaFileDialog":401,"JBrowse/View/FileDialog/TrackList/IndexedFASTADriver":402,"JBrowse/View/FileDialog/TrackList/_OptionallyIndexedFileDriver":403,"JBrowse/View/FileDialog/TrackList/TwoBitDriver":404,"JBrowse/View/LocationChoiceDialog":405,"JBrowse/View/Dialog/SetHighlight":406,"JBrowse/View/Dialog/Preferences":407,"JBrowse/View/Dialog/OpenDirectory":408,"JBrowse/View/Dialog/QuickHelp":409,"JBrowse/View/StandaloneDatasetList":410,"JBrowse/Store/SeqFeature/UnindexedFasta":411,"JBrowse/Store/SeqFeature/UnindexedFasta/File":412,"JBrowse/Store/SeqFeature/IndexedFasta/File":413,"dojo/_base/declare":546,"dojo/_base/lang":547,"dojo/_base/array":548,"dojo/_base/kernel":549,"dojo/on":550,"dojo/has":551,"dojo/dom-construct":552,"dojo/dom":553,"dojo/sniff":555,"dojo/dom-class":556,"dojo/dom-style":557,"dojo/dom-attr":558,"dojo/dom-geometry":559,"dojo/Deferred":560,"dojo/query":561,"dojo/_base/window":562,"dojo/keys":563,"dojo/aspect":565,"dijit/form/Button":566,"dijit/registry":568,"dojo/_base/connect":569,"dojo/when":570,"dijit/focus":571,"dojo/_base/config":574,"dijit/main":575,"dijit/_Widget":576,"dijit/_TemplatedMixin":577,"dojo/_base/sniff":582,"dojo/touch":583,"dojo/ready":585,"dojo/window":586,"dojo/mouse":587,"dojox/main":588,"dojo/Evented":589,"dojo/i18n":590,"dojo/promise/all":591,"dijit/_WidgetBase":592,"dojo/_base/event":594,"dojo/_base/Deferred":595,"dojo/string":596,"dojo/domReady":598,"dijit/Dialog":599,"dijit/a11yclick":600,"dojo/_base/Color":602,"dojo/dnd/common":604,"dijit/form/TextBox":605,"dojo/_base/html":606,"dojo/topic":608,"dojo/request":609,"dojo/store/util/QueryResults":613,"dojo/_base/xhr":620,"dijit/_CssStateMixin":621,"dijit/MenuItem":622,"dojo/promise/Promise":628,"dijit/_Container":629,"dijit/Viewport":630,"dojo/_base/json":631,"dojo/dom-form":632,"dojo/request/default!":637,"dojo/request/xhr":637,"dojo/_base/fx":638,"dojo/NodeList-dom":639,"dojo/global":643,"dojo/errors/CancelError":644,"dojo/date/stamp":645,"dojo/request/util":646,"dijit/layout/ContentPane":647,"dijit/_FocusMixin":648,"dijit/layout/utils":649,"dojo/dnd/Moveable":650,"dijit/popup":651,"dijit/form/RadioButton":657,"dijit/Destroyable":665,"dijit/a11y":666,"dijit/hccss":667,"dojo/regexp":668,"dijit/form/_TextBoxMixin":669,"dijit/_HasDropDown":670,"dijit/form/Select":671,"dojox/lang/functional/lambda":672,"dojo/main":681,"dojo/parser":685,"dojo/errors/create":686,"dojo/errors/RequestError":687,"dojo/request/watch":688,"dijit/_Contained":689,"dijit/_base/manager":690,"dijit/BackgroundIframe":691,"dojo/i18n!dijit/form/nls/validate":692,"dijit/DropDownMenu":693,"dijit/MenuSeparator":694,"dgrid/util/misc":695,"dojo/_base/unload":703,"dojo/Stateful":719,"dojo/dnd/Mover":720,"dijit/form/_FormValueWidget":721,"dijit/form/ToggleButton":722,"dijit/CheckedMenuItem":723,"dojox/lang/functional/object":724,"dojox/lang/functional/fold":725,"dojo/dnd/Source":726,"dijit/form/RangeBoundTextBox":734,"dojo/data/util/simpleFetch":735,"dojo/html":736,"dojo/dom-prop":737,"dojo/_base/url":738,"dojo/request/handlers":739,"dojo/hccss":740,"dojo/dnd/autoscroll":741,"dijit/form/ValidationTextBox":742,"dijit/form/_FormWidget":743,"dijit/form/_FormWidgetMixin":744,"dijit/Tooltip":745,"dijit/place":746,"dojo/store/Memory":747,"dojo/store/util/SimpleQueryEngine":748,"dojo/data/util/sorter":749,"dijit/_KeyNavMixin":750,"dijit/form/_ToggleButtonMixin":751,"dojo/dnd/move":752,"dojo/_base/NodeList":753,"dojo/dnd/Manager":754,"dstore/Memory":755,"dstore/QueryResults":756,"dgrid/OnDemandGrid":757,"dgrid/List":758,"dgrid/extensions/DijitRegistry":759,"dijit/form/CheckBox":776,"dojo/_firebug/firebug":777,"dijit/form/NumberTextBox":778,"dojo/number":779,"dojox/rpc/Rest":790,"dijit/_BidiMixin":828,"dojo/i18n!dijit/nls/loading":829,"dijit/layout/_LayoutWidget":830,"dijit/form/ComboBox":831,"dijit/form/_ListMouseMixin":832,"dojo/text!dijit/form/templates/DropDownBox.html":833,"dijit/_KeyNavContainer":834,"dijit/form/DropDownButton":835,"dojo/dnd/Avatar":836,"dijit/form/NumberSpinner":845,"dijit/typematic":846,"dojo/data/util/filter":851,"dojo/promise/instrumentation":868,"dojo/promise/tracer":869,"dojo/selector/_loader":870,"dojo/selector/_loader!default":871,"dojo/selector/lite":871,"dojo/DeferredList":872,"dojo/errors/RequestTimeoutError":873,"dijit/_OnDijitClickMixin":874,"dojo/uacss":875,"dijit/layout/_ContentPaneResizeMixin":876,"dijit/nls/loading":877,"dijit/layout/BorderContainer":878,"dojo/cookie":879,"dojo/cache":880,"dojo/text":881,"dijit/_AttachMixin":882,"dijit/layout/LayoutContainer":883,"dojo/dnd/TimedMoveable":884,"dijit/form/_FormMixin":885,"dijit/_DialogMixin":886,"dijit/DialogUnderlay":887,"dojo/text!dijit/templates/Dialog.html":888,"dojo/i18n!dijit/nls/common":889,"dijit/nls/common":890,"dijit/form/_FormValueMixin":891,"dojo/text!dijit/form/templates/TextBox.html":892,"dojo/text!dijit/templates/Tooltip.html":893,"dojo/text!dijit/form/templates/ValidationTextBox.html":894,"dijit/form/nls/validate":895,"dijit/form/ComboBoxMixin":896,"dijit/form/_AutoCompleterMixin":897,"dijit/form/DataList":898,"dijit/form/_SearchMixin":899,"dijit/form/_ComboBoxMenu":900,"dijit/form/_ComboBoxMenuMixin":901,"dojo/i18n!dijit/form/nls/ComboBox":902,"dijit/form/nls/ComboBox":903,"dijit/form/_ListBase":904,"dijit/form/_ButtonMixin":905,"dojo/text!dijit/form/templates/Button.html":906,"dijit/form/_FormSelectWidget":907,"dojo/text!dijit/templates/Menu.html":908,"dijit/_MenuBase":909,"dojo/text!dijit/templates/MenuItem.html":910,"dojo/text!dijit/templates/MenuSeparator.html":911,"dojo/text!dijit/form/templates/Select.html":912,"dojo/text!dijit/form/templates/DropDownButton.html":913,"dojo/text!dijit/templates/CheckedMenuItem.html":914,"dojox/html/entities":915,"dojo/store/DataStore":916,"dojo/dnd/Selector":917,"dojo/dnd/Container":918,"dijit/Menu":919,"dijit/PopupMenuItem":920,"dstore/Store":921,"dstore/QueryMethod":922,"dstore/Filter":923,"dstore/Promised":924,"dstore/SimpleQuery":925,"dgrid/Grid":926,"dgrid/OnDemandList":927,"dgrid/_StoreMixin":928,"dijit/form/_CheckBoxMixin":981,"dojo/text!dijit/form/templates/CheckBox.html":982,"dijit/form/_RadioButtonMixin":983,"dojo/query!css2":984,"dojox/form/Uploader":986,"dojox/form/uploader/_Base":987,"dijit/_WidgetsInTemplateMixin":988,"dojox/form/uploader/_HTML5":989,"dojo/_base/browser":990,"dojox/form/uploader/_IFrame":991,"dojo/request/iframe":992,"dojox/form/uploader/_Flash":993,"dojox/embed/Flash":994,"dojo/i18n!dojox/form/nls/Uploader":995,"dojox/form/nls/Uploader":996,"dojo/text!dojox/form/resources/Uploader.html":997,"dijit/form/_Spinner":998,"dijit/form/MappedTextBox":999,"dojo/text!dijit/form/templates/Spinner.html":1e3,"dojo/i18n!dojo/cldr/nls/number":1001,"dojo/cldr/nls/en/number":1002,"dojo/cldr/nls/en-au/number":1003,"dojo/cldr/nls/number":1004,"dojo/text!JBrowse/package.json":1029,"dojox/data/CsvStore":1030,"dojox/data/JsonRestStore":1031,"dojox/rpc/JsonRest":1032,"dojox/json/ref":1033,"dojox/json/schema":1034,"dojox/data/ServiceStore":1035,"dojox/form/TriStateCheckBox":1036,"dojo/text!dojox/form/resources/TriStateCheckBox.html":1037})})(),webpackJsonp([1],Array(328).concat([function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,_slicedToArray=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],i=!0,o=!1,r=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){o=!0,r=t}finally{try{!i&&s.return&&s.return()}finally{if(o)throw r}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},url=__webpack_require__(718);__WEBPACK_AMD_DEFINE_ARRAY__=[__webpack_require__(546),__webpack_require__(547),__webpack_require__(550),__webpack_require__(736),__webpack_require__(561),__webpack_require__(552),__webpack_require__(563),__webpack_require__(560),__webpack_require__(872),__webpack_require__(608),__webpack_require__(565),__webpack_require__(609),__webpack_require__(343),__webpack_require__(339),__webpack_require__(548),__webpack_require__(647),__webpack_require__(878),__webpack_require__(599),__webpack_require__(831),__webpack_require__(747),__webpack_require__(566),__webpack_require__(671),__webpack_require__(722),__webpack_require__(835),__webpack_require__(693),__webpack_require__(723),__webpack_require__(622),__webpack_require__(694),__webpack_require__(1036),__webpack_require__(915),__webpack_require__(330),__webpack_require__(374),__webpack_require__(375),__webpack_require__(916),__webpack_require__(353),__webpack_require__(376),__webpack_require__(385),__webpack_require__(386),__webpack_require__(350),__webpack_require__(359),__webpack_require__(401),__webpack_require__(341),__webpack_require__(405),__webpack_require__(406),__webpack_require__(407),__webpack_require__(408),__webpack_require__(365),__webpack_require__(409),__webpack_require__(410),__webpack_require__(411),__webpack_require__(367),__webpack_require__(368),__webpack_require__(571),__webpack_require__(1028),__webpack_require__(1029),__webpack_require__(1030),__webpack_require__(1031)],__WEBPACK_AMD_DEFINE_RESULT__=function(declare,lang,on,html,query,domConstruct,keys,Deferred,DeferredList,topic,aspect,request,ioQuery,has,array,dijitContentPane,dijitBorderContainer,dijitDialog,dijitComboBox,dojoMemoryStore,dijitButton,dijitSelectBox,dijitToggleButton,dijitDropDownButton,dijitDropDownMenu,dijitCheckedMenuItem,dijitMenuItem,dijitMenuSeparator,dojoxTriStateCheckBox,dojoxHtmlEntities,Util,LazyTrie,NamesLazyTrieDojoDataStore,DojoDataStore,FeatureFiltererMixin,GenomeView,Touch,ConfigManager,InfoDialog,FileDialog,FastaFileDialog,Location,LocationChoiceDialog,SetHighlightDialog,PreferencesDialog,OpenDirectoryDialog,SetTrackHeightDialog,HelpDialog,StandaloneDatasetList,UnindexedFasta,IndexedFasta,TwoBit,dijitFocus,LazyLoad,packagejson){var dojof=Util.dojof;return require.on("error",function(t){var e=t.info&&t.info[0]&&t.info[0].mid?t.info.map(function(t){return t.mid}).join(", "):t;window.JBrowse.fatalError("Failed to load resource: "+e)}),declare(FeatureFiltererMixin,{constructor:function(t){if(this.globalKeyboardShortcuts={},this.config=t||{},!this.config.unitTestMode){"function"==typeof this.config.initExtra&&this.config.initExtra(this,t),this.startTime=new Date;var e=this;dojo.addOnLoad(function(){if(Util.isElectron()&&!e.config.dataRoot)return dojo.addClass(document.body,"jbrowse"),dojo.addClass(document.body,e.config.theme||"tundra"),void e.welcomeScreen(document.body);e.loadConfig().then(function(){e.container=dojo.byId(e.config.containerID),e.container.onselectstart=function(){return!1},e.config.initialHighlight&&"/"!=e.config.initialHighlight&&e.setHighlight(new Location(e.config.initialHighlight)),e.initPlugins().then(function(){e.loadNames(),e.loadUserCSS().then(function(){e.initTrackMetadata(),e.loadRefSeqs().then(function(){var t=e._initialLocation(),n=Util.parseLocString(t);n&&n.ref&&e.allRefs[n.ref]&&(e.refSeq=e.allRefs[n.ref]),e.ensureNonzeroContainerDimensions(),e.initView().then(function(){Touch.loadTouch(),t&&e.navigateTo(t);var n=[];e.config.alwaysOnTracks&&(n=n.concat(e.config.alwaysOnTracks.split(","))),e.config.forceTracks?n=n.concat(e.config.forceTracks.split(",")):e.cookie("tracks")?n=n.concat(e.cookie("tracks").split(",")):e.config.defaultTracks&&(e.config.defaultTracks instanceof Array||(n=n.concat(e.config.defaultTracks.split(",")))),0==n.length&&n.push("DNA"),n=Util.uniq(n),e.showTracks(n),e.passMilestone("completely initialized",{success:!0})}),e.reportUsageStats()})})})})})}},_initialLocation:function(){var t=dojo.fromJson(this.cookie("location"))||{};return this.config.location?this.config.location:t[this.refSeq.name]?t[this.refSeq.name].l||t[this.refSeq.name]:this.config.defaultLocation?this.config.defaultLocation:Util.assembleLocString({ref:this.refSeq.name,start:.4*(this.refSeq.start+this.refSeq.end),end:.6*(this.refSeq.start+this.refSeq.end)})},version:function(){return JSON.parse(packagejson).version}.call(),getPlugin:function(t,e){this.afterMilestone("initPlugins",dojo.hitch(this,function(){e(this.plugins[t])}))},_corePlugins:function(){return["RegexSequenceSearch"]},initPlugins:function(){return this._milestoneFunction("initPlugins",function(t){var e=this;this.plugins={};var n=this.config.plugins||this.config.Plugins||{};if(lang.isArray(n)||n.name||(n=function(){var t=[];for(var e in n)!lang.isObject(n[e])||"name"in n[e]||(n[e].name=e),t.push(n[e]);return t}.call(this)),lang.isArray(n)||(n=[n]),n.unshift.apply(n,this._corePlugins()),(n=array.map(n,function(t){return"object"==(void 0===t?"undefined":_typeof(t))?t:{name:t}})).length){n.forEach(function(t){var n=dojoConfig.packages.find(function(e){return e.name===t.name});n?(t.css=!!n.css&&n.pluginDir+"/"+n.css,t.js=n.location):e.fatalError("plugin "+t.name+" not found, please ensure the plugin was included in this JBrowse build")});var i=array.map(n,function(t){return new Deferred});new DeferredList(i).then(function(){t.resolve({success:!0})}),dojo.global.require(array.map(n,function(t){return t.name+"/main"}),dojo.hitch(this,function(){array.forEach(arguments,function(t,e){var o=n[e],r=i[e];if("string"==typeof t)console.error("could not load plugin "+o.name+": "+t);else{var a,s=dojo.mixin(dojo.clone(n[e]),{config:this.config[o.name]||{}});s.browser=this,s=dojo.mixin(s,{browser:this}),o.css?a=this._loadCSS({url:this.resolveUrl(o.css+"/main.css")}):(a=new Deferred).resolve(),a.then(function(){r.resolve({success:!0})}),s.cssLoaded=a,this.plugins[o.name]=new t(s)}},this)}))}else t.resolve({success:!0})})},resolveUrl:function(t){var e=this.config.browserRoot||this.config.baseUrl||"";return Util.resolveUrl(e,t)},welcomeScreen:function(t,e){var n=this;__webpack_require__.e(3).then(function(){var i=[__webpack_require__(1169)];(function(i){t.innerHTML=i;dojo.create("div",{style:{overflow:"hidden"}},n.container);dojo.byId("welcome").innerHTML="Welcome! To get started with <i>JBrowse-"+n.version+"</i>, select a sequence file or an existing data directory",on(dojo.byId("newOpen"),"click",dojo.hitch(n,"openFastaElectron")),on(dojo.byId("newOpenDirectory"),"click",function(){new OpenDirectoryDialog({browser:n,setCallback:dojo.hitch(n,"openDirectoryElectron")}).show()});try{n.loadSessions()}catch(t){console.error(t)}if(e){console.log(e);var o=dojo.byId("fatal_error_list");dojo.create("div",{className:"error",innerHTML:e},o)}request(n.resolveUrl("sample_data/json/volvox/successfully_run")).then(function(){try{document.getElementById("volvox_data_placeholder").innerHTML='The example dataset is also available. View <a href="?data=sample_data/json/volvox">Volvox test data here</a>.'}catch(t){}})}).apply(null,i)}).catch(__webpack_require__.oe)},ensureNonzeroContainerDimensions:function(){var t=this.container.offsetWidth,e=this.container.offsetHeight;t||(console.warn("JBrowse container element #"+this.config.containerID+" has no width, please set one with CSS. Setting fallback width of 640 pixels"),this.container.style.width="640px"),e||(console.warn("JBrowse container element #"+this.config.containerID+" has no height, please set one with CSS. Setting fallback height of 480 pixels"),this.container.style.height="480px")},fatalError:function(t){function e(t){return t&&(console.error(t.stack||""+t),/\.$/.exec(t+="")||(t+="."),t=dojoxHtmlEntities.encode(t)),t}if(this.renderedFatalErrors){var n=dojo.byId("fatal_error_list")||document.body;dojo.create("div",{className:"error",innerHTML:e(t)+""},n)}else if(/^Could not load reference sequence/.test(t)&&this.config.datasets&&!this.config.datasets._DEFAULT_EXAMPLES)dojo.empty(this.container),new StandaloneDatasetList({datasets:this.config.datasets}).placeAt(this.container);else{var i=this.container||document.body,o=this;dojo.addClass(document.body,this.config.theme||"tundra"),Util.isElectron()?this.welcomeScreen(i,e(t)):__webpack_require__.e(2).then(function(){var n=[__webpack_require__(1170)];(function(n){if(i.innerHTML=n,t){var r=dojo.byId("fatal_error_list");dojo.create("div",{className:"error",innerHTML:e(t)+""},r)}request(o.resolveUrl("sample_data/json/volvox/successfully_run")).then(function(){try{dojo.byId("volvox_data_placeholder").innerHTML='However, it appears you have successfully run <code>./setup.sh</code>, so you can see the <a href="?data=sample_data/json/volvox">Volvox test data here</a>.'}catch(t){}})}).apply(null,n)}).catch(__webpack_require__.oe),this.renderedFatalErrors=!0}},loadSessions:function(){var t=electronRequire("fs"),e=(electronRequire("electron").remote.app,this.config.electronData+"/sessions.json"),n=JSON.parse(t.readFileSync(e,"utf8")),i=dojo.create("table",{id:"previousSessionsTable",style:{overflow:"hidden",width:"90%"}},dojo.byId("previousSessions")),o=this;if(!n.length){var r=dojo.create("tr",{},i);dojo.create("div",{innerHTML:"<ul><li>No sessions yet!</li></ul>"},r)}array.forEach(n,function(r){var a=dojo.create("tr",{},i),s=window.location.href.split("?")[0]+"?data="+Util.replacePath(r.session);dojo.create("div",{class:"dijitIconDelete",onclick:function(a){if(confirm("This will simply delete your session from the list, it won't remove any data files. Are you sure you want to continue?")){dojo.empty(i);var s=n.indexOf(r);-1!=s&&n.splice(s,1),t.writeFileSync(e,JSON.stringify(n,null,2),"utf8"),o.loadSessions()}}},a),dojo.create("td",{innerHTML:'<a href="'+s+'">'+r.session+"</a>"},a)})},loadRefSeqs:function(){var t=this;return this._milestoneFunction("loadRefSeqs",function(e){"string"==typeof this.config.refSeqs&&(this.config.refSeqs={url:this.config.refSeqs}),this.config.refSeqs.url&&this.config.refSeqs.url.match(/.fai$/)?new IndexedFasta({browser:this,faiUrlTemplate:this.config.refSeqs.url}).getRefSeqs(function(n){t.addRefseqs(n),e.resolve({success:!0})},function(t){e.reject(t)}):this.config.refSeqs.url&&this.config.refSeqs.url.match(/.2bit$/)?new TwoBit({browser:this,urlTemplate:this.config.refSeqs.url}).getRefSeqs(function(n){t.addRefseqs(n),e.resolve({success:!0})}):this.config.refSeqs.url&&this.config.refSeqs.url.match(/.fa$/)?new UnindexedFasta({browser:this,urlTemplate:this.config.refSeqs.url}).getRefSeqs(function(n){t.addRefseqs(n),e.resolve({success:!0})}):"data"in this.config.refSeqs?(this.addRefseqs(this.config.refSeqs.data),e.resolve({success:!0})):request(this.resolveUrl(this.config.refSeqs.url),{handleAs:"text",headers:{"X-Requested-With":null}}).then(function(n){t.addRefseqs(dojo.fromJson(n)),e.resolve({success:!0})},function(t){e.reject("Could not load reference sequence definitions. "+t)})})},loadUserCSS:function(){return this._milestoneFunction("loadUserCSS",function(t){this.config.css&&!lang.isArray(this.config.css)&&(this.config.css=[this.config.css]);var e=this.config.css||[];if(e.length){var n=this,i=array.map(e,function(t){return n._loadCSS(t)});new DeferredList(i).then(function(){t.resolve({success:!0})})}else t.resolve({success:!0})})},_loadCSS:function(t){var e=new Deferred;return"string"==typeof t&&(t.indexOf("{")>-1?(dojo.create("style",{"data-from":"JBrowse Config",type:"text/css",innerHTML:t},document.head),e.resolve(!0)):t={url:t}),"object"==(void 0===t?"undefined":_typeof(t))&&LazyLoad.css(t.url,function(){e.resolve(!0)}),e},loadNames:function(){return this._milestoneFunction("loadNames",function(t){var e,n=dojo.mixin(dojo.clone(this.config.names||{}),this.config.autocomplete||{});if(n.url||(n.url=this.config.nameUrl||"data/names/"),n.baseUrl&&(n.url=Util.resolveUrl(n.baseUrl,n.url)),e=n.type){var i=this;-1==e.indexOf("/")&&(e="JBrowse/Store/Names/"+e),dojo.global.require([e],function(e){i.nameStore=new e(dojo.mixin({browser:i},n)),t.resolve({success:!0})})}else this.nameStore=new DojoDataStore({store:new NamesLazyTrieDojoDataStore({browser:this,namesTrie:new LazyTrie(n.url,"lazy-{Chunk}.json"),stopPrefixes:n.stopPrefixes,resultLimit:n.resultLimit||15,tooManyMatchesMessage:n.tooManyMatchesMessage})}),t.resolve({success:!0})})},compareReferenceNames:function(t,e){return this.regularizeReferenceName(t).localeCompare(this.regularizeReferenceName(e))},regularizeLocation:function(t){var e=this.findReferenceSequence(t.ref||t.objectName);return e&&(t.ref=e.name),t},regularizeReferenceName:function(t){return this.config.exactReferenceSequenceNames?t:t=t.toLowerCase().replace(/^chro?m?(osome)?/,"chr").replace(/^co?n?ti?g/,"ctg").replace(/^scaff?o?l?d?/,"scaffold").replace(/^([a-z]*)0+/,"$1").replace(/^(\d+)$/,"chr$1")},initView:function(){var t=this;return this._milestoneFunction("initView",function(e){var n=this;dojo.addClass(this.container,"jbrowse"),dojo.addClass(document.body,this.config.theme||"tundra");var i=dojo.create("div",{style:{overflow:"hidden"}},this.container),o=this.browserMeta(),r=new InfoDialog({title:"About "+o.title,content:o.description,className:"about-dialog"}),a=dojo.create("div",{className:this.config.show_nav?"menuBar":"topLink"});t.menuBar=a,this.config.show_menu&&(this.config.show_nav?i:this.container).appendChild(a);var s=dojo.create("div",{className:"overview",id:"overview"},i);function d(){new HelpDialog(lang.mixin(t.config.quickHelp||{},{browser:t})).show()}if(this.overviewDiv=s,this.config.show_overview||(s.style.cssText="display: none"),Util.isElectron()&&!this.config.hideGenomeOptions?(this.addGlobalMenuItem(this.config.classicMenu?"file":"dataset",new dijitMenuItem({id:"menubar_dataset_file",label:"Open sequence file",iconClass:"dijitIconFolderOpen",onClick:dojo.hitch(this,"openFastaElectron")})),this.addGlobalMenuItem(this.config.classicMenu?"file":"dataset",new dijitMenuItem({id:"menubar_dataset_directory",label:"Open data directory",iconClass:"dijitIconFolderOpen",onClick:function(){new OpenDirectoryDialog({browser:t,setCallback:dojo.hitch(t,"openDirectoryElectron")}).show()}})),this.addGlobalMenuItem(this.config.classicMenu?"file":"dataset",new dijitMenuItem({id:"menubar_dataset_save",label:"Save session",iconClass:"dijitIconSave",onClick:dojo.hitch(this,"saveData")})),this.addGlobalMenuItem(this.config.classicMenu?"file":"dataset",new dijitMenuItem({id:"menubar_dataset_home",label:"Return to main menu",iconClass:"dijitIconTask",onClick:dojo.hitch(this,function(){var e=t.container||document.body;t.welcomeScreen(e)})}))):this.config.hideGenomeOptions||this.addGlobalMenuItem(this.config.classicMenu?"file":"dataset",new dijitMenuItem({id:"menubar_dataset_open",label:"Open sequence file",iconClass:"dijitIconFolderOpen",onClick:dojo.hitch(this,"openFasta")})),this.config.show_nav&&(this.navbox=this.createNavBox(i),this.config.classicMenu?(this.config.datasets&&!this.config.dataset_id&&console.warn("In JBrowse configuration, datasets specified, but dataset_id not set. Dataset selector will not be shown."),this.config.datasets&&this.config.dataset_id?this.renderDatasetSelect(a):(this.poweredByLink=dojo.create("a",{className:"powered_by",innerHTML:this.browserMeta().title,title:"powered by JBrowse"},a),t.poweredBy_clickHandle=dojo.connect(this.poweredByLink,"onclick",dojo.hitch(r,"show")))):this.renderDatasetSelect(a),this.addGlobalMenuItem("file",new dijitMenuItem({id:"menubar_fileopen",label:"Open track file or URL",iconClass:"dijitIconFolderOpen",onClick:dojo.hitch(this,"openFileDialog")})),this.addGlobalMenuItem("file",new dijitMenuSeparator),this.fileDialog=new FileDialog({browser:this}),this.addGlobalMenuItem("file",new dijitMenuItem({id:"menubar_combotrack",label:"Add combination track",iconClass:"dijitIconSample",onClick:dojo.hitch(this,"createCombinationTrack")})),this.renderGlobalMenu("file",{text:this.config.classicMenu?"File":"Track"},a),this.addGlobalMenuItem("view",new dijitMenuItem({id:"menubar_sethighlight",label:"Set highlight",iconClass:"dijitIconFilter",onClick:function(){new SetHighlightDialog({browser:t,setCallback:dojo.hitch(t,"setHighlightAndRedraw")}).show()}})),this._highlightClearButton=new dijitMenuItem({id:"menubar_clearhighlight",label:"Clear highlight",iconClass:"dijitIconFilter",onClick:dojo.hitch(this,function(){var t=this.getHighlight();t&&(this.clearHighlight(),this.view.redrawRegion(t))})}),this._updateHighlightClearButton(),this.subscribe("/jbrowse/v1/n/globalHighlightChanged",dojo.hitch(this,"_updateHighlightClearButton")),this.addGlobalMenuItem("view",this._highlightClearButton),this.addGlobalMenuItem("view",new dijitMenuItem({label:"Resize quant. tracks",id:"menubar_settrackheight",title:"Set all visible quantitative tracks to a new height",iconClass:"jbrowseIconVerticalResize",onClick:function(){new SetTrackHeightDialog({setCallback:function(e){var n=t.view.visibleTracks();array.forEach(n,function(t){/\b(XYPlot|Density)/.test(t.config.type)&&(t.trackHeightChanged=!0,t.updateUserStyles({height:e}))})}}).show()}})),this.config.disableSearch||this.addGlobalMenuItem("view",new dijitMenuItem({label:"Search features",id:"menubar_search",title:"Search for features",onClick:function(){var t=dojo.mixin(dojo.clone(n.config.names||{}),n.config.autocomplete||{}),e=t.dialog||"JBrowse/View/Dialog/Search";dojo.global.require([e],function(e){new e(dojo.mixin({browser:n},t)).show()})}})),this.renderGlobalMenu("view",{text:"View"},a),this.renderGlobalMenu("options",{text:"Options",title:"configure JBrowse"},a)),this.config.show_nav&&(this.addGlobalMenuItem("help",new dijitMenuItem({id:"menubar_about",label:"About",onClick:dojo.hitch(r,"show")})),this.setGlobalKeyboardShortcut("?",d),this.addGlobalMenuItem("help",new dijitMenuItem({id:"menubar_generalhelp",label:"General",iconClass:"jbrowseIconHelp",onClick:d})),this.renderGlobalMenu("help",{},a),!this.config.classicMenu)){var l=lang.getObject("config.datasets."+this.config.dataset_id+".name",!1,this);this.menuBarDatasetName=dojo.create("div",{className:"dataset-name",innerHTML:l,title:"name of current dataset",style:{display:l?"inline-block":"none"}},a)}if(this.config.show_nav&&this.config.show_tracklist&&this.config.show_overview&&!Util.isElectron()){var c=this.makeShareLink();c&&a.appendChild(c)}else if(Util.isElectron()){var u=this.makeSnapLink();u&&a.appendChild(u)}else this.config.show_fullviewlink&&a.appendChild(this.makeFullViewLink());this.viewElem=document.createElement("div"),this.viewElem.className="dragWindow",this.container.appendChild(this.viewElem),this.containerWidget=new dijitBorderContainer({liveSplitters:!1,design:"sidebar",gutters:!1},this.container);new dijitContentPane({region:"top"},i);function h(){var e=t.makeCurrentViewURL();t.config.updateBrowserURL&&window.history&&window.history.replaceState&&window.history.replaceState({},"",e),t.config.update_browser_title&&(document.title=t.browserMeta().title+" "+t.view.visibleRegionLocString())}this.view=this.viewElem.view=new GenomeView({browser:this,elem:this.viewElem,config:this.config.view,stripeWidth:250,refSeq:this.refSeq,zoomLevel:.005}),dojo.connect(this.view,"onFineMove",this,"onFineMove"),dojo.connect(this.view,"onCoarseMove",this,"onCoarseMove"),this.browserWidget=new dijitContentPane({region:"center"},this.viewElem),dojo.connect(this.browserWidget,"resize",this,"onResize"),dojo.connect(this.browserWidget,"resize",this.view,"onResize"),dojo.connect(this,"onCoarseMove",h),this.subscribe("/jbrowse/v1/n/tracks/visibleChanged",h),this.subscribe("/jbrowse/v1/n/globalHighlightChanged",h),this.afterMilestone("loadRefSeqs",dojo.hitch(this,function(){this.afterMilestone("initTrackMetadata",dojo.hitch(this,function(){this.createTrackList().then(dojo.hitch(this,function(){this.containerWidget.startup(),this.onResize(),on(document.body,"keypress",dojo.hitch(this,"globalKeyHandler")),this._initEventRouting(),e.resolve({success:!0})}))}))}))})},createCombinationTrack:function(){void 0===this._combinationTrackCount&&(this._combinationTrackCount=0);var t=new Deferred,e={browser:this,refSeq:this.refSeq,type:"JBrowse/Store/SeqFeature/Combination"},n=this.addStoreConfig(void 0,e);e.name=n,this.getStore(n,function(e){t.resolve(!0)});var i=this;t.promise.then(function(){var t={type:"JBrowse/View/Track/Combination",label:"combination_track"+i._combinationTrackCount++,key:"Combination Track "+i._combinationTrackCount,metadata:{Description:"Drag-and-drop interface that creates a track out of combinations of other tracks."},store:n};i.publish("/jbrowse/v1/v/tracks/new",[t]),i.publish("/jbrowse/v1/v/tracks/show",[t])})},renderDatasetSelect:function(t){var e=this;if(this.config.classicMenu){var n=this.config.datasets||{},i=[];for(var o in n)/^_/.test(o)||i.push(Object.assign({id:o},n[o]));var r=new dijitComboBox({name:"dataset",className:"dataset_select",value:this.config.datasets[this.config.dataset_id].name,store:new dojoMemoryStore({data:i}),onChange:function(t){if(!t)return!1;var n=i.find(function(e){return e.name===t}).id,o=(e.config.datasets||{})[n];return o&&(window.location=o.url),!1}});r.placeAt(t),r.focusNode.onclick=function(){this.select()},this.config.datasetSelectorWidth&&(r.domNode.style.width=this.config.datasetSelectorWidth,r.focusNode.style.width=this.config.datasetSelectorWidth)}else{if(this.config.datasets&&this.config.dataset_id)for(var o in this.addGlobalMenuItem("dataset",new dijitMenuSeparator),this.config.datasets)if(!/^_/.test(o)){var a=this.config.datasets[o];this.addGlobalMenuItem("dataset",new dijitMenuItem({id:"menubar_dataset_bookmark_"+o,label:o==this.config.dataset_id?"<b>"+a.name+"</b>":a.name,iconClass:"dijitIconBookmark",onClick:dojo.hitch(a,function(){window.location=this.url})}))}this.renderGlobalMenu("dataset",{text:"Genome"},t)}},saveSessionDir:function(t){var e=electronRequire("fs"),n=this.config.electronData+"/sessions.json",i=[];try{i=JSON.parse(e.readFileSync(n,"utf8"))}catch(t){console.error(t)}var o=Util.replacePath(t);array.every(i,function(t){return t.session!=o})&&i.push({session:o}),e.writeFileSync(n,JSON.stringify(i,null,2),"utf8")},openDirectoryElectron:function(t){this.saveSessionDir(t),window.location="?data="+Util.replacePath(t)},openConfig:function(t){if(confirm("If you have opened any new tracks, please save them before continuing. Are you sure you want to continue?")){var e=electronRequire("fs"),n=this.config.dataRoot,i=JSON.parse(e.readFileSync(n+"/trackList.json","utf8"));if(i.plugins=i.plugins||{},lang.isArray(i.plugins)){var o={};array.forEach(i.plugins,function(t){o[t]={name:t,location:n+"/"+t}}),i.plugins=o}array.forEach(t,function(t){var e=t.match(/\/(\w+)$/)[1];i.plugins[e]={location:t,name:e}});try{e.writeFileSync(n+"/trackList.json",JSON.stringify(i,null,2))}catch(t){console.error("Failed to save trackList.json",t)}window.location.reload()}},saveData:function(){if(confirm("This will overwrite tracks and config data in your data directory. Are you sure you want to continue?")){var t=electronRequire("fs"),e=this.config.dataRoot,n=array.map(this.config.tracks,function(t){var e=lang.clone(t);return this.getStore(e.store,lang.hitch(this,function(t){e.storeClass=t.config.type,e.urlTemplate||(lang.mixin(e,t.saveStore()),e.histograms&&e.histograms.store&&this.getStore(e.histograms.store,function(t){lang.mixin(e.histograms,t.saveStore())})),delete e.store})),e},this),i=(array.filter(Util.uniq(this.config.plugins),function(t){return"RegexSequenceSearch"!=t}),{});lang.isArray(this.config.plugins)?array.forEach(this.config.plugins,function(t){i[t]="object"==(void 0===t?"undefined":_typeof(t))?t:{name:t}}):i=this.config.plugins;var o={tracks:n,refSeqs:this.config.refSeqs,refSeqOrder:this.config.refSeqOrder,plugins:i};try{t.writeFileSync(Util.unReplacePath(e)+"/trackList.json",JSON.stringify(o,null,2))}catch(t){alert("Unable to save track data"),console.error(t)}}},openFastaElectron:function(){this.fastaFileDialog=this.fastaFileDialog||new FastaFileDialog({browser:this});electronRequire("electron").remote.app;var t=electronRequire("fs");electronRequire("path");this.fastaFileDialog.show({openCallback:dojo.hitch(this,function(e){var n=e.trackConfs||[];if(n.length){var i={tracks:[{label:n[0].label,key:n[0].key,type:"SequenceTrack",category:"Reference sequence",useAsRefSeqStore:!0,chunkSize:2e4}],refSeqs:r,refSeqOrder:e.refSeqOrder};if(n[0].store.fasta&&n[0].store.fai){var o=Util.replacePath(n[0].store.fasta.url),r=Util.replacePath(n[0].store.fai.url);i.tracks[0].storeClass="JBrowse/Store/SeqFeature/IndexedFasta",i.tracks[0].urlTemplate=o,i.tracks[0].faiUrlTemplate=r,i.refSeqs=r}else if("JBrowse/Store/SeqFeature/TwoBit"==n[0].store.type){var a=Util.replacePath(n[0].store.blob.url);i.tracks[0].storeClass="JBrowse/Store/SeqFeature/TwoBit",i.tracks[0].urlTemplate=a,i.refSeqs=a}else{o=Util.replacePath(n[0].store.fasta.url);try{if(t.statSync(o).size>1e8)return void alert("Unindexed file too large. You must have an index file (.fai) for sequence files larger than 100 MB.")}catch(t){console.error(t)}i.tracks[0].storeClass="JBrowse/Store/SeqFeature/UnindexedFasta",i.tracks[0].urlTemplate=o,i.refSeqs=o}var s=this.config.electronData;t.existsSync(s)||t.mkdirSync(s),s+="/"+n[0].label;try{t.existsSync(s)||t.mkdirSync(s),t.writeFileSync(s+"/trackList.json",JSON.stringify(i,null,2)),t.closeSync(t.openSync(s+"/tracks.conf","w")),this.saveSessionDir(s),window.location=window.location.href.split("?")[0]+"?data="+Util.replacePath(s)}catch(t){alert("Failed to save session"),console.error(t)}}})})},openFasta:function(){var t=this;this.fastaFileDialog=this.fastaFileDialog||new FastaFileDialog({browser:this}),this.fastaFileDialog.show({openCallback:function(e){return new Promise(function(n,i){var o=e.trackConfs||[],r=_slicedToArray(o,1)[0];if(!r)return i("no track configs");var a=r.store;if(!a)return i("no store config");dojo.global.require([a.type],function(o){if(/\/Unindexed/i.test(a.type)&&a.fasta&&a.fasta.size>1e8)return alert("Unindexed file too large. You must have an index file (.fai) for sequence files larger than 100 MB."),i("sequence file too large");new o(Object.assign({browser:t},a)).getRefSeqs(function(i){t.teardown();var o=new t.constructor({refSeqs:{data:i},refSeqOrder:e.refSeqOrder});o.afterMilestone("completely initialized",function(){a.name="refseqs",o.addStoreConfig(a.name,a),r.store="refseqs",o.publish("/jbrowse/v1/v/tracks/new",[r])}),n()},function(e){t.fatalError("Error getting refSeq: "+e),i(e)})})})}})},browserMeta:function(){var t=this.config.aboutThisBrowser||{};t.title=t.title||"JBrowse";var e=this.version;return t.description?t.description+='<div class="powered_by">Powered by <a target="_blank" href="http://jbrowse.org">JBrowse '+e+"</a>.</div>":t.description='<div class="default_about"> <img class="logo" src="'+this.resolveUrl("img/JBrowseLogo_small.png")+'"> <h1>JBrowse '+e+'</h1> <div class="tagline">A next-generation genome browser<br> built with JavaScript and HTML5.</div> <a class="mainsite" target="_blank" href="http://jbrowse.org">JBrowse website</a> <div class="gmod">JBrowse is a <a target="_blank" href="http://gmod.org">GMOD</a> project.</div> <div class="copyright">'+JSON.parse(packagejson).copyright+"</div>"+(Object.keys(this.plugins).length>1&&!this.config.noPluginsForAboutBox?' <div class="loaded-plugins">Loaded plugins<ul class="plugins-list">'+array.map(Object.keys(this.plugins),function(t){var e=this.plugins[t];return"<li>"+(e.url?'<a href="'+e.url+'">':"")+e.name+(e.url?"</a>":"")+(e.author?" ("+e.author+")":"")+"</li>"},this).join("")+" </ul></div>":"")+"</div>",t},registerTrackType:function(t){var e=this.getTrackTypes(),n=t.type,i=t.defaultForStoreTypes||[];t.label;e.knownTrackTypes.push(n),t.label&&(e.trackTypeLabels[n]=t.label);var o={};e.knownTrackTypes=array.filter(e.knownTrackTypes,function(t){var e=o[t];return o[t]=!0,!e}),array.forEach(i,function(t){e.trackTypeDefaults[t]=n}),this._knownTrackTypes=e},getTrackTypes:function(){return this._knownTrackTypes||(this._knownTrackTypes={trackTypeDefaults:{"JBrowse/Store/SeqFeature/BAM":"JBrowse/View/Track/Alignments2","JBrowse/Store/SeqFeature/CRAM":"JBrowse/View/Track/Alignments2","JBrowse/Store/SeqFeature/NCList":"JBrowse/View/Track/CanvasFeatures","JBrowse/Store/SeqFeature/BigWig":"JBrowse/View/Track/Wiggle/XYPlot","JBrowse/Store/SeqFeature/VCFTabix":"JBrowse/View/Track/CanvasVariants","JBrowse/Store/SeqFeature/VCFTribble":"JBrowse/View/Track/CanvasVariants","JBrowse/Store/SeqFeature/GFF3":"JBrowse/View/Track/CanvasFeatures","JBrowse/Store/SeqFeature/BigBed":"JBrowse/View/Track/CanvasFeatures","JBrowse/Store/SeqFeature/GFF3Tabix":"JBrowse/View/Track/CanvasFeatures","JBrowse/Store/SeqFeature/BED":"JBrowse/View/Track/CanvasFeatures","JBrowse/Store/SeqFeature/BEDTabix":"JBrowse/View/Track/CanvasFeatures","JBrowse/Store/SeqFeature/GTF":"JBrowse/View/Track/CanvasFeatures","JBrowse/Store/SeqFeature/StaticChunked":"JBrowse/View/Track/Sequence","JBrowse/Store/SeqFeature/UnindexedFasta":"JBrowse/View/Track/Sequence","JBrowse/Store/SeqFeature/IndexedFasta":"JBrowse/View/Track/Sequence","JBrowse/Store/SeqFeature/TwoBit":"JBrowse/View/Track/Sequence"},knownTrackTypes:["JBrowse/View/Track/Alignments","JBrowse/View/Track/Alignments2","JBrowse/View/Track/FeatureCoverage","JBrowse/View/Track/SNPCoverage","JBrowse/View/Track/HTMLFeatures","JBrowse/View/Track/CanvasFeatures","JBrowse/View/Track/HTMLVariants","JBrowse/View/Track/CanvasVariants","JBrowse/View/Track/Wiggle/XYPlot","JBrowse/View/Track/Wiggle/Density","JBrowse/View/Track/Sequence"],trackTypeLabels:{}}),this._knownTrackTypes},openFileDialog:function(){this.fileDialog.show({openCallback:dojo.hitch(this,function(t){var e=t.trackConfs||[];e.length&&(array.forEach(e,function(t){var e=t.store;if(e&&"object"==(void 0===e?"undefined":_typeof(e))){delete t.store;var n=this.addStoreConfig(e.name,e);t.store=n}if((e=t.histograms&&t.histograms.store)&&"object"==(void 0===e?"undefined":_typeof(e))){delete t.histograms.store;n=this.addStoreConfig(e.name,e);t.histograms.store=n}},this),this.publish("/jbrowse/v1/v/tracks/new",e),"openImmediately"==t.trackDisposition&&this.publish("/jbrowse/v1/v/tracks/show",e))})})},addTracks:function(t){this._addTrackConfigs(t)},replaceTracks:function(t){this._replaceTrackConfigs(t)},deleteTracks:function(t){this._deleteTrackConfigs(t)},renderGlobalMenu:function(t,e,n){this.afterMilestone("initView",function(){var i=this.makeGlobalMenu(t);if(i){e=dojo.mixin({className:t,innerHTML:'<span class="icon"></span> '+(e.text||Util.ucFirst(t)),dropDown:i,id:"dropdownbutton_"+t},e||{});var o=new dijitDropDownButton(e);dojo.addClass(o.domNode,"menu"),n.appendChild(o.domNode)}},this)},makeGlobalMenu:function(t){var e=(this._globalMenuItems||{})[t]||[];if(!e.length)return null;var n=new dijitDropDownMenu({id:"dropdownmenu_"+t,leftClickToOpen:!0});return dojo.forEach(e,function(t){n.addChild(t)}),dojo.addClass(n.domNode,"jbrowse globalMenu"),dojo.addClass(n.domNode,t),n.startup(),n},addGlobalMenuItem:function(t,e){this._globalMenuItems||(this._globalMenuItems={}),this._globalMenuItems[t]||(this._globalMenuItems[t]=[]),this._globalMenuItems[t].push(e)},_initEventRouting:function(){var t=this;t.subscribe("/jbrowse/v1/v/store/new",function(e){array.forEach(e,function(e){var n=(e=lang.mixin({},e)).name;delete e.name,t.addStoreConfig(n,e)})}),t.subscribe("/jbrowse/v1/v/tracks/hide",function(e){t.publish("/jbrowse/v1/c/tracks/hide",e)}),t.subscribe("/jbrowse/v1/v/tracks/show",function(e){t.addRecentlyUsedTracks(dojo.map(e,function(t){return t.label})),t.publish("/jbrowse/v1/c/tracks/show",e)}),t.subscribe("/jbrowse/v1/v/tracks/new",function(e){t.addTracks(e),t.publish("/jbrowse/v1/c/tracks/new",e),t.publish("/jbrowse/v1/n/tracks/new",e)}),t.subscribe("/jbrowse/v1/v/tracks/replace",function(e){t.replaceTracks(e),t.publish("/jbrowse/v1/c/tracks/replace",e),t.publish("/jbrowse/v1/n/tracks/replace",e)}),t.subscribe("/jbrowse/v1/v/tracks/delete",function(e){t.deleteTracks(e),t.publish("/jbrowse/v1/c/tracks/delete",e),t.publish("/jbrowse/v1/n/tracks/delete",e)}),t.subscribe("/jbrowse/v1/v/tracks/pin",function(e){t.publish("/jbrowse/v1/c/tracks/pin",e),t.publish("/jbrowse/v1/n/tracks/pin",e)}),t.subscribe("/jbrowse/v1/v/tracks/unpin",function(e){t.publish("/jbrowse/v1/c/tracks/unpin",e),t.publish("/jbrowse/v1/n/tracks/unpin",e)})},reportUsageStats:function(){if(!this.config.suppressUsageStatistics){var t=this._calculateClientStats();this._reportGoogleUsageStats(t),this._reportCustomUsageStats(t)}},_reportGoogleUsageStats:function(t){var e=["UA-7115575-2"];if(this.config.googleAnalytics){var n=this.config.googleAnalytics.accounts;e&&!lang.isArray(n)&&(n=n.replace(/^\s*|\s*$/,"").split(/\s*,\s*/)),e.push.apply(e,n)}var i="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ ";i+="(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), ",i+="m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) ",i+="})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');",e.forEach(function(t,e){i+="UA-7115575-2"==t?"ga('create', '"+t+"', 'auto', 'jbrowseTracker');":"ga('create', '"+t+"', 'auto', 'customTracker"+e+"');"}),e.forEach(function(e,n){if("UA-7115575-2"==e){var o={};"tracks-count refSeqs-count refSeqs-avgLen ver loadTime electron plugins".split(/\s+/).forEach(function(e,n){o["dimension"+(n+1)]=t[e]}),o.metric1=Math.round(1e3*t.loadTime),i+="ga('jbrowseTracker.send', 'pageview',"+JSON.stringify(o)+");"}else i+="ga('customTracker"+n+".send', 'pageview');"});var o=document.createElement("script");o.innerHTML=i,document.getElementsByTagName("head")[0].appendChild(o)},_reportCustomUsageStats:function(t){var e="https";void 0!==this.config.clientReport&&void 0!==this.config.clientReport.protocol&&(e=this.config.clientReport.protocol);var n=e+"://jbrowse.org/analytics/clientReport?"+dojo.objectToQuery(t);dojo.create("img",{style:{display:"none"},src:n},document.body)},getStore:function(t,e){if(!e)throw"invalid arguments";var n=this._storeCache||{};this._storeCache=n;var i=n[t];if(i)return i.refCount++,void e(i.store);var o=this.config.stores[t];if(!o)return console.warn("store '"+t+"' not found"),void e(null);var r=o.type;if(!r)return console.warn("store "+t+" has no type defined"),void e(null);dojo.global.require([r],dojo.hitch(this,function(n){var i={};dojo.mixin(i,o),dojo.mixin(i,{config:o,browser:this,refSeq:this.refSeq});var r=new n(i);(void 0===i.storeCache||!1!==i.storeCache)&&(this._storeCache[t]={refCount:1,store:r}),e(r),e=void 0}))},uniqCounter:0,addStoreConfig:function(t,e){if(t=t||"addStore"+this.uniqCounter++,this.config.stores||(this.config.stores={}),this._storeCache||(this._storeCache={}),this.config.stores[t]||this._storeCache[t])throw"store "+t+" already exists!";return this.config.stores[t]=e,t},clearStores:function(){this._storeCache={}},releaseStore:function(t){var e=this._storeCache[t];e&&!--e.refCount&&delete this._storeCache[t]},_calculateClientStats:function(){var t=screen||window.screen,e=new Date,n={ver:this.version||"dev","refSeqs-count":this.refSeqOrder.length,"refSeqs-avgLen":this.refSeqOrder.length?dojof.reduce(dojo.map(this.refSeqOrder,function(t){var e=this.allRefs[t];return e?e.end-e.start:0},this),"+"):null,"tracks-count":this.config.tracks.length,plugins:dojof.keys(this.plugins).sort().join(","),"scn-h":t?t.height:null,"scn-w":t?t.width:null,"win-h":document.body.offsetHeight,"win-w":document.body.offsetWidth,"el-h":this.container.offsetHeight,"el-w":this.container.offsetWidth,t:e.getTime()/1e3,electron:Util.isElectron(),tzoffset:e.getTimezoneOffset(),loadTime:(e.getTime()-this.startTime)/1e3};return dojo.forEach(this.config.tracks,function(t){var e="track-types-"+t.type||"null";n[e]=(n[e]||0)+1}),n},publish:function(){return this.config.logMessages&&console.log(arguments),topic.publish.apply(topic,arguments)},subscribe:function(){this._uniqueSubscriptionId=this._uniqueSubscriptionId||0,this._subscription=this._subscription||{};var t=++this._uniqueSubscriptionId,e=topic.subscribe.apply(topic,arguments),n=this;return this._subscription[t]=e,function(t){return{remove:function(){delete n._subscription[t],e.remove()}}}(t)},onResize:function(){this.navbox&&(this.view.locationTrapHeight=dojo.marginBox(this.navbox).h)},getRecentlyUsedTracks:function(){return dojo.fromJson(this.cookie("recentTracks")||"[]")},addRecentlyUsedTracks:function(t){var e=Util.uniq(dojo.map(t,function(t){return{label:t,time:Math.round(new Date/1e3)}},this).concat(dojo.fromJson(this.cookie("recentTracks"))||[]),function(t){return t.label}).slice(0,this.config.maxRecentTracks||10);return this.cookie("recentTracks",e,{expires:365}),e},_milestoneFunction:function(t,e){var n=Array.prototype.slice.call(arguments,2),i=this._getDeferred(t);n.unshift(i);try{e.apply(this,n)}catch(t){console.error(t,t.stack),i.reject(t)}return i},_getDeferred:function(t){return this._deferred||(this._deferred={}),this._deferred[t]||(this._deferred[t]=function(){var t=new Deferred;return t.then(null,lang.hitch(this,"fatalError")),t}.call(this))},afterMilestone:function(t,e,n){return this._getDeferred(t).then(function(){try{e.call(n||this)}catch(t){console.error(""+t,t.stack,t)}})},passMilestone:function(t,e){return this._getDeferred(t).resolve(e)},reachedMilestone:function(t){return this._getDeferred(t).isResolved()},loadConfig:function(){return this._milestoneFunction("loadConfig",function(t){if(this.config.dataRoot&&"data"!==this.config.dataRoot&&!this.config.allowCrossOriginDataRoot){var e=url.parse(url.resolve(window.location.href,this.config.dataRoot));if(e.host){var n=url.parse(window.location.href);if(e.host!==n.host||e.protocol!==n.protocol)throw new Error("Invalid JBrowse dataRoot setting. For security, absolute URLs are not allowed. Set `allowCrossOriginDataRoot` to true to disable this security check.")}}new ConfigManager({bootConfig:this.config,defaults:this._configDefaults(),browser:this}).getFinalConfig().then(dojo.hitch(this,function(e){var n=this;this.config=e,this.config.documentDomain&&(document.domain=this.config.documentDomain);var i=e.tracks||[];delete e.tracks,this._addTrackConfigs(i),["show_tracklist","show_nav","show_overview","show_menu","show_fullviewlink","show_tracklabels","update_browser_title"].forEach(function(t){n.config[t]=Util.coerceBoolean(n.config[t])}),this.config.tracks||(this.config.tracks=[]),t.resolve({success:!0})}),t.reject)})},_addTrackConfigs:function(t){return this.config.tracks||(this.config.tracks=[]),this.trackConfigsByName||(this.trackConfigsByName={}),array.forEach(t,function(t){this.trackConfigsByName[t.label]=t,this.config.tracks.push(t)},this),t},_replaceTrackConfigs:function(t){this.trackConfigsByName||(this.trackConfigsByName={}),array.forEach(t,function(t){this.trackConfigsByName[t.label]||console.warn("track with label "+t.label+" does not exist yet. creating a new one."),this.trackConfigsByName[t.label]=dojo.mixin(this.trackConfigsByName[t.label]||{},t)},this)},_deleteTrackConfigs:function(t){this.config.tracks=array.filter(this.config.tracks||[],function(e){return!array.some(t,function(t){return t.label==e.label})}),array.forEach(t,function(t){this.trackConfigsByName[t.label]?delete this.trackConfigsByName[t.label]:console.warn("track "+t.label+" does not exist, cannot delete")},this)},_configDefaults:function(){return{tracks:[],containerID:"GenomeBrowser",dataRoot:"data",show_tracklist:!0,show_nav:!0,show_menu:!0,show_overview:!0,show_fullviewlink:!0,update_browser_title:!0,refSeqs:"{dataRoot}/seq/refSeqs.json",include:["jbrowse.conf","jbrowse_conf.json"],nameUrl:"{dataRoot}/names/root.json",datasets:{_DEFAULT_EXAMPLES:!0,volvox:{url:"?data=sample_data/json/volvox",name:"Volvox Example"},modencode:{url:"?data=sample_data/json/modencode",name:"MODEncode Example"},yeast:{url:"?data=sample_data/json/yeast",name:"Yeast Example"}},highlightSearchedRegions:!