/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./public/js/collapse_preferences.js": /*!*******************************************!*\ !*** ./public/js/collapse_preferences.js ***! \*******************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ CollapsePreferences)\n/* harmony export */ });\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar CollapsePreferences = /*#__PURE__*/function () {\n function CollapsePreferences(component) {\n _classCallCheck(this, CollapsePreferences);\n this.component = component;\n this.collapsePreferences = JSON.parse(localStorage.getItem('collapsePreferences')) || [];\n }\n return _createClass(CollapsePreferences, [{\n key: \"toggleCollapse\",\n value: function toggleCollapse() {\n var _this = this;\n var currentlyCollapsed = this.component.state.collapsed;\n this.component.setState({\n collapsed: !currentlyCollapsed\n });\n var collapsePreferences = JSON.parse(localStorage.getItem('collapsePreferences')) || [];\n if (currentlyCollapsed) {\n localStorage.setItem('collapsePreferences', JSON.stringify(collapsePreferences.filter(function (name) {\n return name !== _this.component.name;\n })));\n } else {\n var uniqueCollapsePreferences = _toConsumableArray(new Set(collapsePreferences.concat([this.component.name])));\n localStorage.setItem('collapsePreferences', JSON.stringify(uniqueCollapsePreferences));\n }\n }\n }, {\n key: \"preferenceStoredAsCollapsed\",\n value: function preferenceStoredAsCollapsed() {\n return this.collapsePreferences.includes(this.component.name);\n }\n }, {\n key: \"renderCollapseIcon\",\n value: function renderCollapseIcon() {\n return this.component.state.collapsed ? this.plusIcon() : this.minusIcon();\n }\n }, {\n key: \"minusIcon\",\n value: function minusIcon() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", {\n className: \"fa fa-minus-square-o\"\n });\n }\n }, {\n key: \"plusIcon\",\n value: function plusIcon() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", {\n className: \"fa fa-plus-square-o\"\n });\n }\n }]);\n}();\n\n\n//# sourceURL=webpack://SequenceServer/./public/js/collapse_preferences.js?"); /***/ }), /***/ "./public/js/databases.js": /*!********************************!*\ !*** ./public/js/databases.js ***! \********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Databases: () => (/* binding */ Databases)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(_this, derived, args) {\n function isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (e) {\n return false;\n }\n }\n derived = _getPrototypeOf(derived);\n return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));\n}\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n\nvar Databases = /*#__PURE__*/function (_Component) {\n function Databases(props) {\n var _this2;\n _classCallCheck(this, Databases);\n _this2 = _callSuper(this, Databases, [props]);\n _this2.state = {\n type: '',\n currentlySelectedDatabases: []\n };\n _this2.preSelectedDbs = _this2.props.preSelectedDbs;\n _this2.databases = _this2.databases.bind(_this2);\n _this2.nselected = _this2.nselected.bind(_this2);\n _this2.categories = _this2.categories.bind(_this2);\n _this2.handleToggle = _this2.handleToggle.bind(_this2);\n _this2.renderDatabases = _this2.renderDatabases.bind(_this2);\n _this2.renderDatabase = _this2.renderDatabase.bind(_this2);\n return _this2;\n }\n _inherits(Databases, _Component);\n return _createClass(Databases, [{\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(_prevProps, prevState) {\n // If there's only one database, select it.\n if (this.databases() && this.databases().length === 1 && this.state.currentlySelectedDatabases.length === 0) {\n this.setState({\n currentlySelectedDatabases: this.databases()\n });\n }\n if (this.preSelectedDbs && this.preSelectedDbs.length !== 0) {\n this.setState({\n currentlySelectedDatabases: this.preSelectedDbs\n });\n this.preSelectedDbs = null;\n }\n var type = this.state.currentlySelectedDatabases[0] ? this.state.currentlySelectedDatabases[0].type : '';\n if (type != this.state.type) {\n this.setState({\n type: type\n });\n this.props.onDatabaseTypeChanged(type);\n }\n if (prevState.currentlySelectedDatabases !== this.state.currentlySelectedDatabases) {\n // Call the prop function with the new state\n this.props.onDatabaseSelectionChanged(this.state.currentlySelectedDatabases);\n }\n }\n }, {\n key: \"databases\",\n value: function databases(category) {\n var databases = this.props.databases;\n if (category) {\n databases = underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].select(databases, function (database) {\n return database.type === category;\n });\n }\n return underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].sortBy(databases, 'title');\n }\n }, {\n key: \"nselected\",\n value: function nselected() {\n return this.state.currentlySelectedDatabases.length;\n }\n }, {\n key: \"categories\",\n value: function categories() {\n return underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].uniq(underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.databases, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].iteratee('type'))).sort();\n }\n }, {\n key: \"handleToggle\",\n value: function handleToggle(toggleState, type) {\n switch (toggleState) {\n case '[Select all]':\n this.setState({\n currentlySelectedDatabases: this.databases(type)\n });\n break;\n case '[Deselect all]':\n this.setState({\n currentlySelectedDatabases: []\n });\n break;\n }\n }\n }, {\n key: \"renderDatabases\",\n value: function renderDatabases(category) {\n // Panel name and column width.\n var panelTitle = category[0].toUpperCase() + category.substring(1).toLowerCase() + ' databases';\n var columnClass = this.categories().length === 1 ? 'col-span-2' : '';\n\n // Toggle button.\n var toggleState = '[Select all]';\n var toggleClass = 'px-2 text-sm';\n var toggleShown = this.databases(category).length > 1;\n var toggleDisabled = this.state.type && this.state.type !== category;\n if (toggleShown && toggleDisabled) {\n toggleClass += ' text-gray-400';\n } else {\n toggleClass += ' text-seqblue';\n }\n if (!toggleShown) toggleClass += ' hidden';\n if (this.nselected() === this.databases(category).length) {\n toggleState = '[Deselect all]';\n }\n\n // JSX.\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"div\", {\n className: columnClass,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(\"div\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(\"div\", {\n className: \"border-b border-seqorange mb-2\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"h4\", {\n style: {\n display: 'inline'\n },\n className: \"font-medium\",\n children: panelTitle\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"button\", {\n type: \"button\",\n className: toggleClass,\n disabled: toggleDisabled,\n onClick: function () {\n this.handleToggle(toggleState, category);\n }.bind(this),\n children: toggleState\n })]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"ul\", {\n className: 'databases ' + category,\n children: underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.databases(category), underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function (database, index) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"li\", {\n children: this.renderDatabase(database)\n }, 'DB_' + category + index);\n }, this))\n })]\n })\n }, 'DB_' + category);\n }\n }, {\n key: \"handleDatabaseSelectionClick\",\n value: function handleDatabaseSelectionClick(database) {\n var isSelected = this.state.currentlySelectedDatabases.some(function (db) {\n return db.id === database.id;\n });\n if (isSelected) {\n this.setState(function (prevState) {\n return {\n currentlySelectedDatabases: prevState.currentlySelectedDatabases.filter(function (db) {\n return db.id !== database.id;\n })\n };\n });\n } else {\n this.setState(function (prevState) {\n return {\n currentlySelectedDatabases: [].concat(_toConsumableArray(prevState.currentlySelectedDatabases), [database])\n };\n });\n }\n }\n }, {\n key: \"renderDatabase\",\n value: function renderDatabase(database) {\n var isDisabled = this.state.type && this.state.type !== database.type;\n var isChecked = this.state.currentlySelectedDatabases.some(function (db) {\n return db.id === database.id;\n });\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(\"label\", {\n className: isDisabled && 'database text-gray-400' || 'database text-seqblue',\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"input\", {\n type: \"checkbox\",\n name: \"databases[]\",\n value: database.id,\n \"data-type\": database.type,\n disabled: isDisabled,\n checked: isChecked,\n onChange: underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function () {\n this.handleDatabaseSelectionClick(database);\n }, this)\n }), ' ' + (database.title || database.name)]\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"div\", {\n className: \"my-6 grid md:grid-cols-2 gap-4\",\n children: underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.categories(), this.renderDatabases)\n });\n }\n }]);\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n//# sourceURL=webpack://SequenceServer/./public/js/databases.js?"); /***/ }), /***/ "./public/js/databases_tree.js": /*!*************************************!*\ !*** ./public/js/databases_tree.js ***! \*************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ _default)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var jstree__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! jstree */ \"./node_modules/jstree/dist/jstree.js\");\n/* harmony import */ var jstree__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(jstree__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _databases__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./databases */ \"./public/js/databases.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* provided dependency */ var $ = __webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(_this, derived, args) {\n function isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (e) {\n return false;\n }\n }\n derived = _getPrototypeOf(derived);\n return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));\n}\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n\n\n\nvar _default = /*#__PURE__*/function (_Databases) {\n function _default(props) {\n var _this2;\n _classCallCheck(this, _default);\n _this2 = _callSuper(this, _default, [props]);\n _this2.handleLoadTree = _this2.handleLoadTree.bind(_this2);\n _this2.renderDatabases = _this2.renderDatabases.bind(_this2);\n _this2.renderDatabaseSearch = _this2.renderDatabaseSearch.bind(_this2);\n _this2.renderDatabaseTree = _this2.renderDatabaseTree.bind(_this2);\n return _this2;\n }\n _inherits(_default, _Databases);\n return _createClass(_default, [{\n key: \"handleLoadTree\",\n value: function handleLoadTree(category) {\n var tree_id = '#' + category + '_database_tree';\n // hack that is needed to sync the selected tree db with the hidden main db\n window.jstree_node_change_timeout = null;\n\n // when a tree database gets selected\n $(tree_id).on('select_node.jstree deselect_node.jstree', function (e, data) {\n if (window.jstree_node_change_timeout) {\n clearTimeout(window.jstree_node_change_timeout);\n window.jstree_node_change_timeout = null;\n }\n window.jstree_node_change_timeout = setTimeout(function () {\n // uncheck all input\n $('div#database_list input[type=\"checkbox\"]:checked').click();\n setTimeout(function () {\n // get all selected tree dbs. Also includes folders. Therefore, the id must have a length of 32\n // this id is used to find the corresponding element from the hidden main form\n var selected = $(tree_id).jstree('get_selected').filter(function (selected) {\n return selected.length == 32;\n });\n $.each(selected, function (index, value) {\n // select hidden element to trigger original sequenceserver behavior, like blast algorithm, ...\n $('input[value=\"' + value + '\"]').click();\n });\n }, 100);\n }, 100);\n });\n $(tree_id).jstree({\n 'core': {\n 'data': this.props.tree[category]\n },\n 'plugins': ['checkbox', 'search', 'sort'],\n 'checkbox': {\n 'keep_selected_style': false\n }\n });\n }\n }, {\n key: \"handleTreeSearch\",\n value: function handleTreeSearch(category, tree_id, search_id) {\n var search_for = $('#' + search_id).val();\n $('#' + tree_id).jstree(true).search(search_for);\n }\n }, {\n key: \"renderDatabases\",\n value: function renderDatabases(category) {\n // Panel name and column width.\n var panelTitle = category[0].toUpperCase() + category.substring(1).toLowerCase() + ' databases';\n var columnClass = this.categories().length === 1 ? 'col-md-12' : 'col-md-6';\n\n // Toggle button.\n var toggleState = '[Select all]';\n var toggleClass = 'btn-link';\n var toggleShown = this.databases(category).length > 1;\n var toggleDisabled = this.state.type && this.state.type !== category;\n if (toggleShown && toggleDisabled) toggleClass += ' disabled';\n if (!toggleShown) toggleClass += ' hidden';\n if (this.nselected() === this.databases(category).length) {\n toggleState = '[Deselect all]';\n }\n\n // JSX.\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: columnClass,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"panel panel-default\",\n id: \"database_list\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"panel-heading\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"h4\", {\n style: {\n display: 'inline'\n },\n children: panelTitle\n }), \" \\xA0\\xA0\", this.renderDatabaseSearch(category), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"button\", {\n type: \"button\",\n className: toggleClass,\n disabled: toggleDisabled,\n style: {\n display: 'none'\n },\n onClick: function () {\n this.handleToggle(toggleState, category);\n }.bind(this),\n children: toggleState\n })]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"ul\", {\n className: 'list-group databases ' + category,\n style: {\n display: 'none'\n },\n children: underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.databases(category), underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function (database, index) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n className: \"list-group-item\",\n children: this.renderDatabase(database)\n }, 'DB_' + category + index);\n }, this))\n })]\n }), this.renderDatabaseTree(category), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"link\", {\n rel: \"stylesheet\",\n media: \"screen,print\",\n type: \"text/css\",\n href: \"vendor/github/vakata/jstree@3.3.8/dist/themes/default/style.min.css\"\n })]\n }, 'DB_' + category);\n }\n }, {\n key: \"renderDatabaseSearch\",\n value: function renderDatabaseSearch(category) {\n var tree_id = category + '_database_tree';\n var search_id = tree_id + '_search';\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"input\", {\n type: \"text\",\n id: search_id,\n className: \"border rounded px-1\",\n placeholder: \"Search...\",\n onKeyUp: underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function () {\n this.handleTreeSearch(category, tree_id, search_id);\n }, this)\n });\n }\n }, {\n key: \"renderDatabaseTree\",\n value: function renderDatabaseTree(category) {\n var tree_id = category + '_database_tree';\n var data = this.props.tree[category];\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n id: tree_id,\n className: 'jstree_div',\n onClick: underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function () {\n this.handleLoadTree(category);\n }, this)\n });\n }\n }]);\n}(_databases__WEBPACK_IMPORTED_MODULE_3__.Databases);\n\n\n//# sourceURL=webpack://SequenceServer/./public/js/databases_tree.js?"); /***/ }), /***/ "./public/js/dnd.js": /*!**************************!*\ !*** ./public/js/dnd.js ***! \**************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DnD: () => (/* binding */ DnD)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* provided dependency */ var $ = __webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(_this, derived, args) {\n function isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (e) {\n return false;\n }\n }\n derived = _getPrototypeOf(derived);\n return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));\n}\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n/**\n * Drag n drop widget.\n */\n\nvar DnD = /*#__PURE__*/function (_Component) {\n function DnD(props) {\n var _this2;\n _classCallCheck(this, DnD);\n _this2 = _callSuper(this, DnD, [props]);\n _this2.state = {\n query: null\n };\n return _this2;\n }\n _inherits(DnD, _Component);\n return _createClass(DnD, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var self = this;\n var FASTA_FORMAT = /^>/;\n $(document).ready(function () {\n var tgtMarker = $('.dnd-overlay');\n var dndError = function dndError(id) {\n $('.dnd-error').hide();\n $('#' + id + '-notification').show();\n tgtMarker.effect('fade', 2500);\n };\n $(document).on('dragenter', function (evt) {\n // Do not activate DnD if a modal is active.\n if ($.modalActive()) return;\n\n // Based on http://stackoverflow.com/a/8494918/1205465.\n // Contrary to what the above link says, the snippet below can't\n // distinguish directories from files. We handle that on drop.\n var dt = evt.originalEvent.dataTransfer;\n var isFile = dt.types && (dt.types.indexOf &&\n // Chrome and Safari\n dt.types.indexOf('Files') != -1 || dt.types.contains &&\n // Firefox\n dt.types.contains('application/x-moz-file'));\n if (!isFile) {\n return;\n }\n $('.dnd-error').hide();\n tgtMarker.stop(true, true);\n tgtMarker.show();\n dt.effectAllowed = 'copy';\n if (self.state.query.isEmpty()) {\n $('.dnd-overlay-overwrite').hide();\n $('.dnd-overlay-drop').show('drop', {\n direction: 'down'\n }, 'fast');\n } else {\n $('.dnd-overlay-drop').hide();\n $('.dnd-overlay-overwrite').show('drop', {\n direction: 'down'\n }, 'fast');\n }\n }).on('dragleave', '.dnd-overlay', function (evt) {\n tgtMarker.hide();\n $('.dnd-overlay-drop').hide();\n $('.dnd-overlay-overwrite').hide();\n }).on('dragover', '.dnd-overlay', function (evt) {\n evt.originalEvent.dataTransfer.dropEffect = 'copy';\n evt.preventDefault();\n }).on('drop', '.dnd-overlay', function (evt) {\n evt.preventDefault();\n evt.stopPropagation();\n var indicator = $('#sequence-file');\n self.state.query.focus();\n var files = evt.originalEvent.dataTransfer.files;\n if (files.length > 1) {\n dndError('dnd-multi');\n return;\n }\n var file = files[0];\n if (file.size > 250 * 1048576) {\n dndError('dnd-large-file');\n return;\n }\n var reader = new FileReader();\n reader.onload = function (e) {\n var content = e.target.result;\n if (FASTA_FORMAT.test(content)) {\n indicator.text(file.name + ' ');\n self.state.query.value(content);\n tgtMarker.hide();\n } else {\n // apparently not FASTA\n dndError('dnd-format');\n }\n };\n reader.onerror = function (e) {\n // Couldn't read. Means dropped stuff wasn't FASTA file.\n dndError('dnd-format');\n };\n reader.readAsText(file);\n });\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"dnd-overlay absolute left-0 top-0 w-full h-full bg-gray-200 bg-opacity-75 z-40\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"div\", {\n className: \"flex flex-col space-y-4 h-full items-center justify-center dnd-overlay-container text-2xl\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"p\", {\n className: \"dnd-overlay-drop flex items-center space-x-4\",\n style: {\n display: 'none'\n },\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"i\", {\n className: \"fa fa-2x fa-file\"\n }), \"Drop query sequence file here\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"p\", {\n className: \"dnd-overlay-overwrite flex items-center space-x-4\",\n style: {\n display: 'none'\n },\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"i\", {\n className: \"fa fa-2x fa-file\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"span\", {\n className: \"text-red-800\",\n children: \"Overwrite\"\n }), \"&nbps;query sequence file\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"div\", {\n className: \"dnd-errors text-red-800\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"dnd-error row\",\n id: \"dnd-multi-notification\",\n style: {\n display: 'none'\n },\n children: \"One file at a time please.\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"dnd-error row\",\n id: \"dnd-large-file-notification\",\n style: {\n display: 'none'\n },\n children: \"Too big a file. Can only do less than 250 MB. >_<\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"dnd-error row\",\n id: \"dnd-format-notification\",\n style: {\n display: 'none'\n },\n children: \"Only FASTA files please.\"\n })]\n })]\n })\n });\n }\n }]);\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n//# sourceURL=webpack://SequenceServer/./public/js/dnd.js?"); /***/ }), /***/ "./public/js/exporter.js": /*!*******************************!*\ !*** ./public/js/exporter.js ***! \*******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ download_blob: () => (/* binding */ download_blob),\n/* harmony export */ download_url: () => (/* binding */ download_url),\n/* harmony export */ generate_blob_url: () => (/* binding */ generate_blob_url),\n/* harmony export */ sanitize_filename: () => (/* binding */ sanitize_filename)\n/* harmony export */ });\nfunction download_url(url, filename) {\n var a = d3.select('body').append('a').attr('download', filename).style('display', 'none').attr('href', url);\n a.node().click();\n setTimeout(function () {\n a.remove();\n }, 100);\n}\nfunction generate_blob_url(blob) {\n var url = window.URL.createObjectURL(blob);\n return url;\n}\nfunction download_blob(blob, filename) {\n if (typeof window.navigator.msSaveOrOpenBlob !== 'undefined') {\n window.navigator.msSaveOrOpenBlob(blob, filename);\n } else {\n download_url(generate_blob_url(blob), filename);\n }\n}\nfunction sanitize_filename(str) {\n var san = str.replace(/[^a-zA-Z0-9=_\\-]/g, '_');\n // Replace runs of underscores with single one.\n san = san.replace(/_{2,}/g, '_');\n // Remove any leading or trailing underscores.\n san = san.replace(/^_/, '').replace(/_$/, '');\n return san;\n}\n\n//# sourceURL=webpack://SequenceServer/./public/js/exporter.js?"); /***/ }), /***/ "./public/js/fastq_to_fasta.js": /*!*************************************!*\ !*** ./public/js/fastq_to_fasta.js ***! \*************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fastqToFasta: () => (/* binding */ fastqToFasta)\n/* harmony export */ });\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nvar convertChunk = function convertChunk(fastqChunk) {\n fastqChunk[0] = '>' + fastqChunk[0].substring(1);\n return fastqChunk.slice(0, 2);\n};\nvar isValidFastq = function isValidFastq(fastqChunk) {\n if (fastqChunk.length !== 4) {\n return false;\n }\n return fastqChunk[0][0] === '@' && fastqChunk[2][0] === '+' && fastqChunk[1].length === fastqChunk[3].length;\n};\nvar fastqToFasta = function fastqToFasta(sequence) {\n var trimmedSequence = sequence.trim();\n // return unmodified if sequence does not look like fastq\n if (!trimmedSequence.startsWith('@')) {\n return sequence;\n }\n var sequenceLines = trimmedSequence.split('\\n');\n var fastaChunks = [];\n for (var i = 0; i < sequenceLines.length; i += 4) {\n var fastqChunk = sequenceLines.slice(i, i + 4);\n if (isValidFastq(fastqChunk)) {\n fastaChunks.push.apply(fastaChunks, _toConsumableArray(convertChunk(fastqChunk)));\n } else {\n // return unmodified sequence if it does not look like valid fastq\n return sequence;\n }\n }\n return fastaChunks.join('\\n');\n};\n\n//# sourceURL=webpack://SequenceServer/./public/js/fastq_to_fasta.js?"); /***/ }), /***/ "./public/js/form.js": /*!***************************!*\ !*** ./public/js/form.js ***! \***************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Form: () => (/* binding */ Form)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _search_button__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./search_button */ \"./public/js/search_button.js\");\n/* harmony import */ var _query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./query */ \"./public/js/query.js\");\n/* harmony import */ var _databases_tree__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./databases_tree */ \"./public/js/databases_tree.js\");\n/* harmony import */ var _databases__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./databases */ \"./public/js/databases.js\");\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var options__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! options */ \"./public/js/null_plugins/options.js\");\n/* harmony import */ var query_stats__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! query_stats */ \"./public/js/null_plugins/query_stats.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* provided dependency */ var $ = __webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(_this, derived, args) {\n function isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (e) {\n return false;\n }\n }\n derived = _getPrototypeOf(derived);\n return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));\n}\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n\n\n\n\n\n\n\n/**\n * Search form.\n *\n * Top level component that initialises and holds all other components, and\n * facilitates communication between them.\n */\n\nvar Form = /*#__PURE__*/function (_Component) {\n function Form(props) {\n var _this2;\n _classCallCheck(this, Form);\n _this2 = _callSuper(this, Form, [props]);\n _this2.state = {\n databases: [],\n preSelectedDbs: [],\n currentlySelectedDbs: [],\n preDefinedOpts: {},\n tree: {},\n residuesInQuerySequence: 0,\n blastMethod: ''\n };\n _this2.useTreeWidget = _this2.useTreeWidget.bind(_this2);\n _this2.determineBlastMethods = _this2.determineBlastMethods.bind(_this2);\n _this2.handleSequenceTypeChanged = _this2.handleSequenceTypeChanged.bind(_this2);\n _this2.handleSequenceChanged = _this2.handleSequenceChanged.bind(_this2);\n _this2.handleDatabaseTypeChanged = _this2.handleDatabaseTypeChanged.bind(_this2);\n _this2.handleDatabaseSelectionChanged = _this2.handleDatabaseSelectionChanged.bind(_this2);\n _this2.handleAlgoChanged = _this2.handleAlgoChanged.bind(_this2);\n _this2.handleFormSubmission = _this2.handleFormSubmission.bind(_this2);\n _this2.formRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n _this2.setButtonState = _this2.setButtonState.bind(_this2);\n return _this2;\n }\n _inherits(Form, _Component);\n return _createClass(Form, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n /**\n * Fetch data to initialise the search interface from the server. These\n * include list of databases to search against, advanced options to\n * apply when an algorithm is selected, and a query sequence that\n * the user may want to search in the databases.\n */\n var search = location.search.split(/\\?|&/).filter(Boolean);\n var job_id = sessionStorage.getItem('job_id');\n if (job_id) {\n search.unshift(\"job_id=\".concat(job_id));\n }\n $.getJSON(\"searchdata.json?\".concat(search.join('&')), function (data) {\n /* Update form state (i.e., list of databases and predefined\n * advanced options.\n */\n this.setState({\n tree: data['tree'],\n databases: data['database'],\n preSelectedDbs: data['preSelectedDbs'],\n preDefinedOpts: data['options'],\n blastTaskMap: data['blastTaskMap']\n });\n\n /* Pre-populate the form with server sent query sequences\n * (if any).\n */\n if (data['query']) {\n this.refs.query.value(data['query']);\n }\n setTimeout(function () {\n $('.jstree_div').click();\n }, 1000);\n }.bind(this));\n\n /* Enable submitting form on Cmd+Enter */\n $(document).on('keydown', function (e) {\n var $button = $('#method');\n if (!$button.is(':disabled') && e.ctrlKey && e.key === 'Enter') {\n $button.trigger('click');\n }\n });\n\n // show overlay to create visual feedback on button click\n $('#method').on('click', function () {\n $('#overlay').css('display', 'block');\n });\n }\n }, {\n key: \"useTreeWidget\",\n value: function useTreeWidget() {\n return !underscore__WEBPACK_IMPORTED_MODULE_5__[\"default\"].isEmpty(this.state.tree);\n }\n }, {\n key: \"handleFormSubmission\",\n value: function handleFormSubmission(evt) {\n evt.preventDefault();\n var form = this.formRef.current;\n var formData = new FormData(form);\n formData.append('method', this.refs.button.state.methods[0]);\n fetch(window.location.href, {\n method: 'POST',\n body: formData\n }).then(function (res) {\n //remove overlay when form is submitted\n $('#overlay').css('display', 'none');\n // redirect\n if (res.redirected && res.url) {\n // setTimeout is needed here as a workaround because safari doesnt allow async calling of window.open\n // so setTimeout makes the method get called on the main thread.\n setTimeout(function () {\n window.open(res.url, $('#toggleNewTab').is(':checked') ? '_blank' : '_self');\n }, 0);\n }\n });\n }\n }, {\n key: \"determineBlastMethods\",\n value: function determineBlastMethods() {\n var database_type = this.databaseType;\n var sequence_type = this.sequenceType;\n if (this.refs.query.isEmpty()) {\n return [];\n }\n\n //database type is always known\n switch (database_type) {\n case 'protein':\n switch (sequence_type) {\n case undefined:\n return ['blastp', 'blastx'];\n case 'protein':\n return ['blastp'];\n case 'nucleotide':\n return ['blastx'];\n }\n break;\n case 'nucleotide':\n switch (sequence_type) {\n case undefined:\n return ['tblastn', 'blastn', 'tblastx'];\n case 'protein':\n return ['tblastn'];\n case 'nucleotide':\n return ['blastn', 'tblastx'];\n }\n break;\n }\n return [];\n }\n }, {\n key: \"handleSequenceChanged\",\n value: function handleSequenceChanged(residuesInQuerySequence) {\n if (residuesInQuerySequence !== this.state.residuesInQuerySequence) this.setState({\n residuesInQuerySequence: residuesInQuerySequence\n });\n }\n }, {\n key: \"handleSequenceTypeChanged\",\n value: function handleSequenceTypeChanged(type) {\n this.sequenceType = type;\n this.setButtonState();\n }\n }, {\n key: \"handleDatabaseTypeChanged\",\n value: function handleDatabaseTypeChanged(type) {\n this.databaseType = type;\n this.setButtonState();\n }\n }, {\n key: \"setButtonState\",\n value: function setButtonState() {\n this.refs.button.setState({\n hasQuery: !this.refs.query.isEmpty(),\n hasDatabases: !!this.databaseType,\n methods: this.determineBlastMethods()\n });\n }\n }, {\n key: \"handleDatabaseSelectionChanged\",\n value: function handleDatabaseSelectionChanged(selectedDbs) {\n if (!underscore__WEBPACK_IMPORTED_MODULE_5__[\"default\"].isEqual(selectedDbs, this.state.currentlySelectedDbs)) this.setState({\n currentlySelectedDbs: selectedDbs\n });\n }\n }, {\n key: \"handleAlgoChanged\",\n value: function handleAlgoChanged(algo) {\n if (algo in this.state.preDefinedOpts) {\n this.setState({\n blastMethod: algo\n });\n } else {\n this.setState({\n blastMethod: ''\n });\n }\n }\n }, {\n key: \"residuesInSelectedDbs\",\n value: function residuesInSelectedDbs() {\n return this.state.currentlySelectedDbs.reduce(function (sum, db) {\n return sum + parseInt(db.ncharacters, 10);\n }, 0);\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(\"div\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n id: \"overlay\",\n style: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100vw',\n height: '100vw',\n background: 'rgba(0, 0, 0, 0.2)',\n display: 'none',\n zIndex: 99\n }\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(\"div\", {\n className: \"fixed top-0 left-0 w-full max-h-8 px-8\",\n \"data-notifications\": true,\n id: \"notifications\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(FastqNotification, {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(NucleotideNotification, {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(ProteinNotification, {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(MixedNotification, {})]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(\"form\", {\n id: \"blast\",\n ref: this.formRef,\n onSubmit: this.handleFormSubmission,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(\"div\", {\n className: \"px-4\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_query__WEBPACK_IMPORTED_MODULE_2__.SearchQueryWidget, {\n ref: \"query\",\n onSequenceTypeChanged: this.handleSequenceTypeChanged,\n onSequenceChanged: this.handleSequenceChanged\n }), this.useTreeWidget() ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_databases_tree__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n ref: \"databases\",\n databases: this.state.databases,\n tree: this.state.tree,\n preSelectedDbs: this.state.preSelectedDbs,\n onDatabaseTypeChanged: this.handleDatabaseTypeChanged,\n onDatabaseSelectionChanged: this.handleDatabaseSelectionChanged\n }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_databases__WEBPACK_IMPORTED_MODULE_4__.Databases, {\n ref: \"databases\",\n databases: this.state.databases,\n preSelectedDbs: this.state.preSelectedDbs,\n onDatabaseTypeChanged: this.handleDatabaseTypeChanged,\n onDatabaseSelectionChanged: this.handleDatabaseSelectionChanged\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(options__WEBPACK_IMPORTED_MODULE_6__.Options, {\n blastMethod: this.state.blastMethod,\n predefinedOptions: this.state.preDefinedOpts[this.state.blastMethod] || {},\n blastTasks: (this.state.blastTaskMap || {})[this.state.blastMethod]\n })]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n className: \"py-6\"\n }), \" \", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(\"div\", {\n className: \"pb-4 pt-2 px-4 sticky bottom-0 md:flex flex-row md:space-x-4 items-center justify-end bg-gradient-to-t to-gray-100/90 from-white/90\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(query_stats__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n residuesInQuerySequence: this.state.residuesInQuerySequence,\n numberOfDatabasesSelected: this.state.currentlySelectedDbs.length,\n residuesInSelectedDbs: this.residuesInSelectedDbs(),\n currentBlastMethod: this.state.blastMethod\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(\"label\", {\n className: \"block my-4 md:my-2\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"input\", {\n type: \"checkbox\",\n id: \"toggleNewTab\"\n }), \" Open results in new tab\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_search_button__WEBPACK_IMPORTED_MODULE_1__.SearchButton, {\n ref: \"button\",\n onAlgoChanged: this.handleAlgoChanged\n })]\n })]\n })]\n });\n }\n }]);\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\nvar ProteinNotification = /*#__PURE__*/function (_Component2) {\n function ProteinNotification() {\n _classCallCheck(this, ProteinNotification);\n return _callSuper(this, ProteinNotification, arguments);\n }\n _inherits(ProteinNotification, _Component2);\n return _createClass(ProteinNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n \"data-role\": \"notification\",\n id: \"protein-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n className: \"bg-blue-100 border rounded border-blue-800 px-4 py-2 my-2\",\n children: \"Detected: amino-acid sequence(s).\"\n })\n });\n }\n }]);\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\nvar NucleotideNotification = /*#__PURE__*/function (_Component3) {\n function NucleotideNotification() {\n _classCallCheck(this, NucleotideNotification);\n return _callSuper(this, NucleotideNotification, arguments);\n }\n _inherits(NucleotideNotification, _Component3);\n return _createClass(NucleotideNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n \"data-role\": \"notification\",\n id: \"nucleotide-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n className: \"bg-blue-100 border rounded border-blue-800 px-4 py-2 my-2\",\n children: \"Detected: nucleotide sequence(s).\"\n })\n });\n }\n }]);\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\nvar FastqNotification = /*#__PURE__*/function (_Component4) {\n function FastqNotification() {\n _classCallCheck(this, FastqNotification);\n return _callSuper(this, FastqNotification, arguments);\n }\n _inherits(FastqNotification, _Component4);\n return _createClass(FastqNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n \"data-role\": \"notification\",\n id: \"fastq-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n className: \"bg-blue-100 border rounded border-blue-800 px-4 py-2 my-2\",\n children: \"Detected FASTQ and automatically converted to FASTA.\"\n })\n });\n }\n }]);\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\nvar MixedNotification = /*#__PURE__*/function (_Component5) {\n function MixedNotification() {\n _classCallCheck(this, MixedNotification);\n return _callSuper(this, MixedNotification, arguments);\n }\n _inherits(MixedNotification, _Component5);\n return _createClass(MixedNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n \"data-role\": \"notification\",\n id: \"mixed-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n className: \"alert-danger col-md-10 col-md-offset-1\",\n children: \"Error: mixed nucleotide and amino-acid sequences detected.\"\n })\n });\n }\n }]);\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n//# sourceURL=webpack://SequenceServer/./public/js/form.js?"); /***/ }), /***/ "./public/js/grapher.js": /*!******************************!*\ !*** ./public/js/grapher.js ***! \******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Grapher)\n/* harmony export */ });\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _svgExporter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./svgExporter */ \"./public/js/svgExporter.js\");\n/* harmony import */ var _collapse_preferences__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./collapse_preferences */ \"./public/js/collapse_preferences.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* provided dependency */ var $ = __webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(_this, derived, args) {\n function isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (e) {\n return false;\n }\n }\n derived = _getPrototypeOf(derived);\n return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));\n}\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n // create handlers for SVG and PNG download buttons\n\n\n// Each instance of Grapher is added to this object once the component has been\n// mounted. This is so that grapher can be iterated over and redrawn on window\n// resize event.\n\nvar Graphers = {};\n\n// Grapher is a function that takes a Graph class and returns a React component.\n// This React component provides HTML boilerplate to add heading, to make the\n// graphs collapsible, to redraw graphs when window is resized, and SVG and PNG\n// export buttons and functionality.\nfunction Grapher(Graph) {\n return /*#__PURE__*/function (_React$Component) {\n function _class(props) {\n var _this2;\n _classCallCheck(this, _class);\n _this2 = _callSuper(this, _class, [props]);\n _this2.name = Graph.name();\n _this2.collapsePreferences = new _collapse_preferences__WEBPACK_IMPORTED_MODULE_3__[\"default\"](_this2);\n var isCollapsed = _this2.collapsePreferences.preferenceStoredAsCollapsed();\n _this2.state = {\n collapsed: Graph.canCollapse() && (_this2.props.collapsed || isCollapsed)\n };\n _this2.svgContainerRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createRef)();\n return _this2;\n }\n _inherits(_class, _React$Component);\n return _createClass(_class, [{\n key: \"graphId\",\n value: function graphId() {\n return Graph.graphId(this.props);\n }\n }, {\n key: \"render\",\n value: function render() {\n // Do not render when Graph.name() is null\n if (Graph.name() === null) {\n return null;\n } else {\n var cssClasses = Graph.className() + ' grapher';\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n ref: \"grapher\",\n className: cssClasses,\n children: [this.header(), this.svgContainerJSX()]\n });\n }\n }\n }, {\n key: \"header\",\n value: function header() {\n var _this3 = this;\n if (Graph.canCollapse()) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"grapher-header\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"h4\", {\n className: \"caption\",\n onClick: function onClick() {\n return _this3.collapsePreferences.toggleCollapse();\n },\n children: [this.collapsePreferences.renderCollapseIcon(), \"\\xA0\", Graph.name()]\n }), !this.state.collapsed && this.graphLinksJSX()]\n });\n } else {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: \"grapher-header\",\n children: !this.state.collapsed && this.graphLinksJSX()\n });\n }\n }\n }, {\n key: \"graphLinksJSX\",\n value: function graphLinksJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"hit-links graph-links\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link export-to-svg\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"i\", {\n className: \"fa fa-download\"\n }), \" SVG\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"line\",\n children: \"|\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link export-to-png\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"i\", {\n className: \"fa fa-download\"\n }), \" PNG\"]\n })]\n });\n }\n }, {\n key: \"svgContainerJSX\",\n value: function svgContainerJSX() {\n var cssClasses = Graph.className() + ' svg-container collapse';\n if (!this.state.collapsed) cssClasses += ' in';\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n ref: this.svgContainerRef,\n id: this.graphId(),\n className: cssClasses\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n Graphers[this.graphId()] = this;\n\n // Draw visualisation for the first time. Visualisations are\n // redrawn when browser window is resized.\n this.draw();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n // Re-draw visualisation when the component change state.\n this.draw();\n }\n }, {\n key: \"svgContainer\",\n value: function svgContainer() {\n return $(this.svgContainerRef.current);\n }\n }, {\n key: \"draw\",\n value: function draw() {\n // Clean slate.\n this.svgContainer().empty();\n this.graph = null;\n\n // Draw if uncollapsed.\n if (this.state.collapsed) {\n return;\n }\n this.graph = new Graph(this.svgContainer(), this.props);\n this.svgContainer().find('svg').attr('data-name', Graph.dataName(this.props));\n }\n }]);\n }((react__WEBPACK_IMPORTED_MODULE_1___default().Component));\n}\n\n// Redraw if window resized.\n$(window).resize(underscore__WEBPACK_IMPORTED_MODULE_0__[\"default\"].debounce(function () {\n underscore__WEBPACK_IMPORTED_MODULE_0__[\"default\"].each(Graphers, function (grapher) {\n grapher.draw();\n });\n}, 125));\n\n//# sourceURL=webpack://SequenceServer/./public/js/grapher.js?"); /***/ }), /***/ "./public/js/hits_overview.js": /*!************************************!*\ !*** ./public/js/hits_overview.js ***! \************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ \"./node_modules/d3/d3.js\");\n/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var grapher__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! grapher */ \"./public/js/grapher.js\");\n/* harmony import */ var _visualisation_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./visualisation_helpers */ \"./public/js/visualisation_helpers.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ \"./public/js/utils.js\");\n/* provided dependency */ var $ = __webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n\n\n\n\nvar Graph = /*#__PURE__*/function () {\n function Graph($svgContainer, props) {\n _classCallCheck(this, Graph);\n this.svg_container = $svgContainer;\n var $queryDiv = $svgContainer.parents('.resultn');\n var hits = this.extractData(props.query.hits, props.query.number);\n this.graphIt($queryDiv, $svgContainer, 0, 20, null, hits);\n }\n return _createClass(Graph, [{\n key: \"extractData\",\n value: function extractData(query_hits, number) {\n var hits = [];\n query_hits.map(function (hit) {\n var _hsps = [];\n var hsps = hit.hsps;\n underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].each(hsps, function (hsp) {\n var _hsp = {};\n _hsp.hspEvalue = hsp.evalue;\n _hsp.hspStart = hsp.qstart;\n _hsp.hspEnd = hsp.qend;\n _hsp.hspFrame = hsp.sframe;\n _hsp.hspId = 'Query_' + number + '_hit_' + hit.number + '_hsp_' + hsp.number;\n _hsp.hspIdentity = hsp.identity;\n _hsp.hspGaps = hsp.gaps;\n _hsp.hspPositives = hsp.positives;\n _hsp.hspLength = hsp.length;\n _hsps.push(_hsp);\n });\n _hsps.hitId = hit.id;\n _hsps.hitDef = 'Query_' + number + '_hit_' + hit.number;\n _hsps.hitEvalue = hit.hsps[0].evalue;\n hits.push(_hsps);\n });\n return hits;\n }\n }, {\n key: \"setupTooltip\",\n value: function setupTooltip() {\n this.svg_container.find('[data-toggle=\"tooltip\"]').tooltip({\n 'placement': 'top',\n 'container': 'body',\n 'html': 'true',\n 'delay': 0,\n 'white-space': 'nowrap'\n });\n }\n }, {\n key: \"setupClick\",\n value: function setupClick($graphDiv) {\n $('a', $graphDiv).click(function (evt) {\n evt.preventDefault();\n evt.stopPropagation();\n window.location.hash = $(this).attr('href');\n });\n }\n }, {\n key: \"graphControls\",\n value: function graphControls($queryDiv, $graphDiv, isInit, opts, hits) {\n var MIN_HITS_TO_SHOW = 20;\n var totalHits, shownHits, lessButton, moreButton;\n var countHits = function countHits() {\n totalHits = hits.length;\n shownHits = $queryDiv.find('.ghit > g').length;\n };\n var setupButtons = function setupButtons($queryDiv, $graphDiv) {\n $graphDiv.append($('