From c8d89bea6f3a38f912e7dc261ae7bc46382678c0 Mon Sep 17 00:00:00 2001
From: Emmanuel
- ABCDEFGHIJKLMNOPQRSTUVWXYZ +-
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ +-
{/* Required by Grapher for SVG and PNG download */}
@@ -85,6 +85,10 @@ class Report extends Component {
constructor(props) {
super(props);
this.fetchResults();
+ this.getDatabaseListString = this.getDatabaseListString.bind(this);
+ this.toggleShowDatabases = this.toggleShowDatabases.bind(this);
+ this.renderToggleDatabasesList = this.renderToggleDatabasesList.bind(this);
+ this.maxDatabasesStringLength = 200;
// Properties below are internal state used to render results in small
// slices (see updateState).
@@ -104,6 +108,8 @@ class Report extends Component {
querydb: [],
params: [],
stats: [],
+ databasesList: '',
+ showMore: false
};
}
/**
@@ -116,23 +122,23 @@ class Report extends Component {
function poll() {
$.getJSON(location.pathname + '.json').complete(function (jqXHR) {
switch (jqXHR.status) {
- case 202:
- var interval;
- if (intervals.length === 1) {
- interval = intervals[0];
- } else {
- interval = intervals.shift();
- }
- setTimeout(poll, interval);
- break;
- case 200:
- component.setStateFromJSON(jqXHR.responseJSON);
- break;
- case 404:
- case 400:
- case 500:
- component.props.showErrorModal(jqXHR.responseJSON);
- break;
+ case 202:
+ var interval;
+ if (intervals.length === 1) {
+ interval = intervals[0];
+ } else {
+ interval = intervals.shift();
+ }
+ setTimeout(poll, interval);
+ break;
+ case 200:
+ component.setStateFromJSON(jqXHR.responseJSON);
+ break;
+ case 404:
+ case 400:
+ case 500:
+ component.props.showErrorModal(jqXHR.responseJSON);
+ break;
}
});
}
@@ -153,8 +159,8 @@ class Report extends Component {
* bound to the window, document, or body.
*/
componentDidMount() {
- // This sets up an event handler which enables users to select text from
- // hit header without collapsing the hit.
+ // This sets up an event handler which enables users to select text from
+ // hit header without collapsing the hit.
this.preventCollapseOnSelection();
this.toggleTable();
}
@@ -165,8 +171,11 @@ class Report extends Component {
* and circos would have been rendered at this point. At this stage we kick
* start iteratively adding 1 HSP to the page every 25 milli-seconds.
*/
- componentDidUpdate() {
- // Log to console how long the last update take?
+ componentDidUpdate(props, state) {
+ if (this.getDatabaseListString() !== this.getDatabaseListString(state.querydb)) {
+ this.setState({ databasesList: this.getDatabaseListString().substring(0, this.maxDatabasesStringLength) + '...' });
+ }
+ // Log to console how long the last update take?
console.log((Date.now() - this.lastTimeStamp) / 1000);
// Lock sidebar in its position on the first update.
@@ -242,11 +251,11 @@ class Report extends Component {
- This can take some time depending on the size of your query and
- database(s). The page will update automatically when BLAST is done.
+ This can take some time depending on the size of your query and
+ database(s). The page will update automatically when BLAST is done.
- You can bookmark the page and come back to it later or share the
- link with someone.
+ You can bookmark the page and come back to it later or share the
+ link with someone.
Databases: - {this.state.querydb - .map((db) => { - return db.title; - }) - .join(', ')}{' '} - ({this.state.stats.nsequences} sequences, + {this.getDatabaseListString().length <= this.maxDatabasesStringLength ? this.getDatabaseListString() : this.renderToggleDatabasesList()}{' '} + ({this.state.stats.nsequences} sequences, {this.state.stats.ncharacters} characters)
@@ -368,9 +386,9 @@ class Report extends Component { }).join(', ')}
- Please cite:{' '} + Please cite:{' '} - https://doi.org/10.1093/molbev/msz185 + https://doi.org/10.1093/molbev/msz185
diff --git a/public/sequenceserver-report.min.js b/public/sequenceserver-report.min.js index 02f514d20..3d9941ce2 100644 --- a/public/sequenceserver-report.min.js +++ b/public/sequenceserver-report.min.js @@ -49,7 +49,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__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 */ ErrorModal)\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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n/**\n * Takes errorData object with title, message, and more_info keys as props. The\n * component displays a bootstrap modal when mounted. errorData.title is used\n * to set modal title. errorData.message is inserted as HTML text in modal\n * body. And errorData.more_info is shown using a pre tag in modal body.\n *\n * The displayed modal dialog cannot be dismissed.\n * The user must close the tab or press back button to go back to search form.\n */\n\n\n\n\nvar ErrorModal = /*#__PURE__*/function (_React$Component) {\n _inherits(ErrorModal, _React$Component);\n\n var _super = _createSuper(ErrorModal);\n\n function ErrorModal(props) {\n var _this;\n\n _classCallCheck(this, ErrorModal);\n\n _this = _super.call(this, props);\n _this.state = {\n errorData: {}\n };\n _this.modal = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n return _this;\n } // HTML for Bootstrap modal.\n\n\n _createClass(ErrorModal, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n id: \"error\",\n ref: this.modal,\n className: \"modal fade\",\n \"data-keyboard\": \"false\",\n \"data-backdrop\": \"static\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"modal-dialog modal-lg\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"div\", {\n className: \"modal-content\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"modal-header\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"h3\", {\n children: this.state.errorData.title\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"div\", {\n className: \"modal-body\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"p\", {\n dangerouslySetInnerHTML: {\n __html: this.state.errorData.message\n }\n }), this.state.errorData.more_info && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"pre\", {\n className: \"pre-scrollable\",\n children: this.state.errorData.more_info\n })]\n })]\n })\n })\n });\n }\n /**\n * Shows error viewer.\n */\n\n }, {\n key: \"show\",\n value: function show(errorData, beforeShow) {\n var _this2 = this;\n\n this.setState({\n errorData: errorData\n }); // Caller can specify an amount of time to wait for before showing the\n // modal. This is helpful if the caller wants to finish some work\n // before showing error modal.\n\n setTimeout(function () {\n $(_this2.modal.current).modal('show');\n }, beforeShow || 0);\n }\n }]);\n\n return ErrorModal;\n}((react__WEBPACK_IMPORTED_MODULE_0___default().Component));\n\n\n\n//# sourceURL=webpack://SequenceServer/./public/js/error_modal.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ ErrorModal)\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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n/**\n * Takes errorData object with title, message, and more_info keys as props. The\n * component displays a bootstrap modal when mounted. errorData.title is used\n * to set modal title. errorData.message is inserted as HTML text in modal\n * body. And errorData.more_info is shown using a pre tag in modal body.\n *\n * The displayed modal dialog cannot be dismissed.\n * The user must close the tab or press back button to go back to search form.\n */\n\n\n\n\nvar ErrorModal = /*#__PURE__*/function (_React$Component) {\n _inherits(ErrorModal, _React$Component);\n\n var _super = _createSuper(ErrorModal);\n\n function ErrorModal(props) {\n var _this;\n\n _classCallCheck(this, ErrorModal);\n\n _this = _super.call(this, props);\n _this.state = {\n errorData: {}\n };\n _this.modal = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n return _this;\n } // HTML for Bootstrap modal.\n\n\n _createClass(ErrorModal, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n id: \"error\",\n ref: this.modal,\n className: \"modal fade\",\n \"data-keyboard\": \"false\",\n \"data-backdrop\": \"static\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"modal-dialog modal-lg\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"div\", {\n className: \"modal-content\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"modal-header\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"h3\", {\n children: this.state.errorData.title\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"div\", {\n className: \"modal-body\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"p\", {\n dangerouslySetInnerHTML: {\n __html: this.state.errorData.message\n }\n }), this.state.errorData.more_info && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"pre\", {\n className: \"pre-scrollable\",\n children: this.state.errorData.more_info\n })]\n })]\n })\n })\n });\n }\n /**\n * Shows error viewer.\n */\n\n }, {\n key: \"show\",\n value: function show(errorData, beforeShow) {\n var _this2 = this;\n\n this.setState({\n errorData: errorData\n }); // Caller can specify an amount of time to wait for before showing the\n // modal. This is helpful if the caller wants to finish some work\n // before showing error modal.\n\n setTimeout(function () {\n $(_this2.modal.current).modal('show');\n }, beforeShow || 0);\n }\n }]);\n\n return ErrorModal;\n}((react__WEBPACK_IMPORTED_MODULE_0___default().Component));\n\n\n\n//# sourceURL=webpack://SequenceServer/./public/js/error_modal.js?"); /***/ }), @@ -71,7 +71,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__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 react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n // create handlers for SVG and PNG download buttons\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\n\n\nvar Graphers = {}; // 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.\n\nfunction Grapher(Graph) {\n return /*#__PURE__*/function (_React$Component) {\n _inherits(_class, _React$Component);\n\n var _super = _createSuper(_class);\n\n function _class(props) {\n var _this;\n\n _classCallCheck(this, _class);\n\n _this = _super.call(this, props);\n _this.state = {\n collapsed: _this.props.collapsed\n };\n _this.svgContainerRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createRef)();\n return _this;\n }\n\n _createClass(_class, [{\n key: \"collapseId\",\n value: function collapseId() {\n return Graph.collapseId(this.props);\n }\n }, {\n key: \"render\",\n value: function render() {\n var cssClasses = Graph.className() + \" grapher\";\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n ref: \"grapher\",\n className: cssClasses,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"grapher-header\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"h4\", {\n className: \"caption\",\n \"data-toggle\": \"collapse\",\n \"data-target\": \"#\" + this.collapseId(),\n children: [this.state.collapsed ? this.plusIcon() : this.minusIcon(), \"\\xA0\", Graph.name()]\n }), !this.state.collapsed && this.graphLinksJSX()]\n }), this.svgContainerJSX()]\n });\n }\n }, {\n key: \"minusIcon\",\n value: function minusIcon() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.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_3__.jsx)(\"i\", {\n className: \"fa fa-plus-square-o\"\n });\n }\n }, {\n key: \"graphLinksJSX\",\n value: function graphLinksJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"hit-links graph-links\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link export-to-svg\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"i\", {\n className: \"fa fa-download\"\n }), \" SVG\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"span\", {\n className: \"line\",\n children: \"|\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link export-to-png\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.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_3__.jsx)(\"div\", {\n ref: this.svgContainerRef,\n id: this.collapseId(),\n className: cssClasses\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n Graphers[this.collapseId()] = this; // Draw visualisation for the first time. Visualisations are\n // redrawn when browser window is resized.\n\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; // Draw if uncollapsed.\n\n if (this.state.collapsed) {\n return;\n }\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\n return _class;\n }((react__WEBPACK_IMPORTED_MODULE_1___default().Component));\n} // Redraw if window resized.\n\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)); // Swap-icon and toggle .graph-links on collapse.\n\n$(\"body\").on(\"hidden.bs.collapse\", \".collapse\", function () {\n var component = Graphers[$(this).attr(\"id\")];\n\n if (component) {\n component.setState({\n collapsed: true\n });\n }\n});\n$(\"body\").on(\"shown.bs.collapse\", \".collapse\", function () {\n var component = Graphers[$(this).attr(\"id\")];\n\n if (component) {\n component.setState({\n collapsed: false\n });\n }\n});\n\n//# sourceURL=webpack://SequenceServer/./public/js/grapher.js?"); +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 react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n // create handlers for SVG and PNG download buttons\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\n\n\nvar Graphers = {}; // 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.\n\nfunction Grapher(Graph) {\n return /*#__PURE__*/function (_React$Component) {\n _inherits(_class, _React$Component);\n\n var _super = _createSuper(_class);\n\n function _class(props) {\n var _this;\n\n _classCallCheck(this, _class);\n\n _this = _super.call(this, props);\n _this.state = {\n collapsed: _this.props.collapsed\n };\n _this.svgContainerRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createRef)();\n return _this;\n }\n\n _createClass(_class, [{\n key: \"collapseId\",\n value: function collapseId() {\n return Graph.collapseId(this.props);\n }\n }, {\n key: \"render\",\n value: function render() {\n var cssClasses = Graph.className() + \" grapher\";\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n ref: \"grapher\",\n className: cssClasses,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"grapher-header\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"h4\", {\n className: \"caption\",\n \"data-toggle\": \"collapse\",\n \"data-target\": \"#\" + this.collapseId(),\n children: [this.state.collapsed ? this.plusIcon() : this.minusIcon(), \"\\xA0\", Graph.name()]\n }), !this.state.collapsed && this.graphLinksJSX()]\n }), this.svgContainerJSX()]\n });\n }\n }, {\n key: \"minusIcon\",\n value: function minusIcon() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.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_3__.jsx)(\"i\", {\n className: \"fa fa-plus-square-o\"\n });\n }\n }, {\n key: \"graphLinksJSX\",\n value: function graphLinksJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"hit-links graph-links\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link export-to-svg\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"i\", {\n className: \"fa fa-download\"\n }), \" SVG\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"span\", {\n className: \"line\",\n children: \"|\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link export-to-png\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.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_3__.jsx)(\"div\", {\n ref: this.svgContainerRef,\n id: this.collapseId(),\n className: cssClasses\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n Graphers[this.collapseId()] = this; // Draw visualisation for the first time. Visualisations are\n // redrawn when browser window is resized.\n\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; // Draw if uncollapsed.\n\n if (this.state.collapsed) {\n return;\n }\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\n return _class;\n }((react__WEBPACK_IMPORTED_MODULE_1___default().Component));\n} // Redraw if window resized.\n\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)); // Swap-icon and toggle .graph-links on collapse.\n\n$(\"body\").on(\"hidden.bs.collapse\", \".collapse\", function () {\n var component = Graphers[$(this).attr(\"id\")];\n\n if (component) {\n component.setState({\n collapsed: true\n });\n }\n});\n$(\"body\").on(\"shown.bs.collapse\", \".collapse\", function () {\n var component = Graphers[$(this).attr(\"id\")];\n\n if (component) {\n component.setState({\n collapsed: false\n });\n }\n});\n\n//# sourceURL=webpack://SequenceServer/./public/js/grapher.js?"); /***/ }), @@ -82,7 +82,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__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 _kablammo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kablammo */ \"./public/js/kablammo.js\");\n/* harmony import */ var _download_fasta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./download_fasta */ \"./public/js/download_fasta.js\");\n/* harmony import */ var _alignment_exporter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./alignment_exporter */ \"./public/js/alignment_exporter.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n // to download textual alignment\n\n/**\n * Component for each hit. Receives props from Report. Has no state.\n */\n\n\n\n\nvar _default = /*#__PURE__*/function (_Component) {\n _inherits(_default, _Component);\n\n var _super = _createSuper(_default);\n\n function _default(props) {\n var _this;\n\n _classCallCheck(this, _default);\n\n _this = _super.call(this, props);\n _this.accession = _this.accession.bind(_assertThisInitialized(_this));\n _this.sequenceID = _this.sequenceID.bind(_assertThisInitialized(_this));\n _this.hitLength = _this.hitLength.bind(_assertThisInitialized(_this));\n _this.numHSPs = _this.numHSPs.bind(_assertThisInitialized(_this));\n _this.domID = _this.domID.bind(_assertThisInitialized(_this));\n _this.databaseIDs = _this.databaseIDs.bind(_assertThisInitialized(_this));\n _this.showSequenceViewer = _this.showSequenceViewer.bind(_assertThisInitialized(_this));\n _this.viewSequenceLink = _this.viewSequenceLink.bind(_assertThisInitialized(_this));\n _this.downloadFASTA = _this.downloadFASTA.bind(_assertThisInitialized(_this));\n _this.downloadAlignment = _this.downloadAlignment.bind(_assertThisInitialized(_this));\n _this.headerJSX = _this.headerJSX.bind(_assertThisInitialized(_this));\n _this.contentJSX = _this.contentJSX.bind(_assertThisInitialized(_this));\n _this.hitLinks = _this.hitLinks.bind(_assertThisInitialized(_this));\n _this.viewSequenceButton = _this.viewSequenceButton.bind(_assertThisInitialized(_this));\n _this.downloadFASTAButton = _this.downloadFASTAButton.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n _createClass(_default, [{\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate() {\n return !this.props.hit;\n }\n /**\n * Returns accession number of the hit sequence.\n */\n\n }, {\n key: \"accession\",\n value: function accession() {\n return this.props.hit.accession;\n }\n /**\n * Returns id of the hit sequence.\n */\n\n }, {\n key: \"sequenceID\",\n value: function sequenceID() {\n return this.props.hit.id;\n }\n /**\n * Returns length of the hit sequence.\n */\n\n }, {\n key: \"hitLength\",\n value: function hitLength() {\n return this.props.hit.length;\n }\n }, {\n key: \"numHSPs\",\n value: function numHSPs() {\n return this.props.hit.hsps.length;\n } // Internal helpers. //\n\n /**\n * Returns id that will be used for the DOM node corresponding to the hit.\n */\n\n }, {\n key: \"domID\",\n value: function domID() {\n return 'Query_' + this.props.query.number + '_hit_' + this.props.hit.number;\n }\n }, {\n key: \"databaseIDs\",\n value: function databaseIDs() {\n return underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.querydb, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].iteratee('id'));\n }\n }, {\n key: \"showSequenceViewer\",\n value: function showSequenceViewer() {\n this.props.showSequenceModal(this.viewSequenceLink());\n }\n }, {\n key: \"viewSequenceLink\",\n value: function viewSequenceLink() {\n var sequenceIDs = encodeURIComponent(this.sequenceID());\n var databaseIDs = encodeURIComponent(this.databaseIDs());\n return \"get_sequence/?sequence_ids=\".concat(sequenceIDs, \"&database_ids=\").concat(databaseIDs);\n }\n }, {\n key: \"downloadFASTA\",\n value: function downloadFASTA(event) {\n var sequenceIDs = [this.sequenceID()];\n\n (0,_download_fasta__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(sequenceIDs, this.databaseIDs());\n } // Event-handler for exporting alignments.\n // Calls relevant method on AlignmentExporter defined in alignment_exporter.js.\n\n }, {\n key: \"downloadAlignment\",\n value: function downloadAlignment(event) {\n var hsps = underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.hit.hsps, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function (hsp) {\n hsp.query_id = this.props.query.id;\n hsp.hit_id = this.props.hit.id;\n return hsp;\n }, this));\n\n var aln_exporter = new _alignment_exporter__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n aln_exporter.export_alignments(hsps, this.props.query.id + '_' + this.props.hit.id);\n }\n }, {\n key: \"headerJSX\",\n value: function headerJSX() {\n var meta = \"length: \".concat(this.hitLength().toLocaleString());\n\n if (this.props.showQueryCrumbs && this.props.showHitCrumbs) {\n // Multiper queries, multiple hits\n meta = \"hit \".concat(this.props.hit.number, \" of query \").concat(this.props.query.number, \", \") + meta;\n } else if (this.props.showQueryCrumbs && !this.props.showHitCrumbs) {\n // Multiple queries, single hit\n meta = \"the only hit of query \".concat(this.props.query.number, \", \") + meta;\n } else if (!this.props.showQueryCrumbs && this.props.showHitCrumbs) {\n // Single query, multiple hits\n meta = \"hit \".concat(this.props.hit.number, \", \") + meta;\n }\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"section-header\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"h4\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa fa-minus-square-o\"\n }), \"\\xA0\", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"strong\", {\n children: this.props.hit.id\n }), \"\\xA0\", this.props.hit.title]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n className: \"label label-reset pos-label\",\n children: meta\n })]\n });\n }\n }, {\n key: \"contentJSX\",\n value: function contentJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"section-content\",\n \"data-parent-hit\": this.domID(),\n children: [this.hitLinks(), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_kablammo__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n query: this.props.query,\n hit: this.props.hit,\n algorithm: this.props.algorithm,\n showHSPCrumbs: this.numHSPs() > 1 && this.numHSPs() < 27,\n collapsed: this.props.veryBig\n }, 'kablammo' + this.props.query.id)]\n });\n }\n }, {\n key: \"hitLinks\",\n value: function hitLinks() {\n var _this2 = this;\n\n var btns = [];\n\n if (!(this.props.imported_xml || this.props.non_parse_seqids)) {\n btns = btns.concat([this.viewSequenceButton(), this.downloadFASTAButton()]);\n }\n\n btns.push(this.downloadAlignmentButton());\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"hit-links\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"label\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"input\", {\n type: \"checkbox\",\n id: this.domID() + '_checkbox',\n value: this.sequenceID(),\n onChange: function () {\n this.props.selectHit(this.domID() + '_checkbox');\n }.bind(this),\n \"data-target\": '#' + this.domID()\n }), \" Select\"]\n }), btns.map(function (btn, index) {\n return [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n className: \"line\",\n children: \"|\"\n }, \"btn-\".concat(index)), _this2.button(Object.assign(btn, {\n key: index\n }))];\n }), this.props.hit.links.map(function (link, index) {\n return [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n className: \"line\",\n children: \"|\"\n }, \"link-\".concat(index)), _this2.a(link, index)];\n })]\n });\n } // Return JSX for view sequence button.\n\n }, {\n key: \"viewSequenceButton\",\n value: function viewSequenceButton() {\n var _this3 = this;\n\n if (this.hitLength() > 10000) {\n return {\n text: 'Sequence',\n icon: 'fa-eye',\n className: 'view-sequence',\n title: 'Sequence too long'\n };\n } else {\n return {\n text: 'Sequence',\n icon: 'fa-eye',\n className: 'view-sequence',\n onClick: function onClick() {\n return _this3.showSequenceViewer();\n }\n };\n }\n }\n }, {\n key: \"downloadFASTAButton\",\n value: function downloadFASTAButton() {\n var _this4 = this;\n\n return {\n text: 'FASTA',\n icon: 'fa-download',\n className: 'download-fa',\n onClick: function onClick() {\n return _this4.downloadFASTA();\n }\n };\n }\n }, {\n key: \"downloadAlignmentButton\",\n value: function downloadAlignmentButton() {\n var _this5 = this;\n\n return {\n text: 'Alignment',\n icon: 'fa-download',\n className: 'download-aln',\n onClick: function onClick() {\n return _this5.downloadAlignment();\n }\n };\n }\n }, {\n key: \"button\",\n value: function button(_ref) {\n var text = _ref.text,\n icon = _ref.icon,\n title = _ref.title,\n className = _ref.className,\n onClick = _ref.onClick,\n key = _ref.key;\n\n if (onClick) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"button\", {\n className: \"btn-link \".concat(className),\n title: title,\n onClick: onClick,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa \".concat(icon)\n }), \" \", text]\n }, key);\n } else {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"button\", {\n className: \"btn-link view-sequence disabled\",\n title: title,\n disabled: true,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa \".concat(icon)\n }), \" \", text]\n }, key);\n }\n }\n /**\n * Render URL for sequence-viewer.\n */\n\n }, {\n key: \"a\",\n value: function a(link, key) {\n if (!link.title || !link.url) return;\n var className = 'btn btn-link';\n if (link[\"class\"]) className = \"\".concat(className, \" \").concat(link[\"class\"]);\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"a\", {\n href: link.url,\n className: className,\n target: \"_blank\",\n children: [link.icon && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: 'fa ' + link.icon\n }), ' ' + link.title + ' ']\n }, \"\".concat(link.url, \"-\").concat(key));\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"hit\",\n id: this.domID(),\n \"data-hit-def\": this.props.hit.id,\n \"data-hit-len\": this.props.hit.length,\n \"data-hit-evalue\": this.props.hit.evalue,\n children: [this.headerJSX(), \" \", this.contentJSX()]\n });\n }\n }]);\n\n return _default;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n\n\n//# sourceURL=webpack://SequenceServer/./public/js/hit.js?"); +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 _kablammo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kablammo */ \"./public/js/kablammo.js\");\n/* harmony import */ var _download_fasta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./download_fasta */ \"./public/js/download_fasta.js\");\n/* harmony import */ var _alignment_exporter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./alignment_exporter */ \"./public/js/alignment_exporter.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n // to download textual alignment\n\n/**\n * Component for each hit. Receives props from Report. Has no state.\n */\n\n\n\n\nvar _default = /*#__PURE__*/function (_Component) {\n _inherits(_default, _Component);\n\n var _super = _createSuper(_default);\n\n function _default(props) {\n var _this;\n\n _classCallCheck(this, _default);\n\n _this = _super.call(this, props);\n _this.accession = _this.accession.bind(_assertThisInitialized(_this));\n _this.sequenceID = _this.sequenceID.bind(_assertThisInitialized(_this));\n _this.hitLength = _this.hitLength.bind(_assertThisInitialized(_this));\n _this.numHSPs = _this.numHSPs.bind(_assertThisInitialized(_this));\n _this.domID = _this.domID.bind(_assertThisInitialized(_this));\n _this.databaseIDs = _this.databaseIDs.bind(_assertThisInitialized(_this));\n _this.showSequenceViewer = _this.showSequenceViewer.bind(_assertThisInitialized(_this));\n _this.viewSequenceLink = _this.viewSequenceLink.bind(_assertThisInitialized(_this));\n _this.downloadFASTA = _this.downloadFASTA.bind(_assertThisInitialized(_this));\n _this.downloadAlignment = _this.downloadAlignment.bind(_assertThisInitialized(_this));\n _this.headerJSX = _this.headerJSX.bind(_assertThisInitialized(_this));\n _this.contentJSX = _this.contentJSX.bind(_assertThisInitialized(_this));\n _this.hitLinks = _this.hitLinks.bind(_assertThisInitialized(_this));\n _this.viewSequenceButton = _this.viewSequenceButton.bind(_assertThisInitialized(_this));\n _this.downloadFASTAButton = _this.downloadFASTAButton.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n _createClass(_default, [{\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate() {\n return !this.props.hit;\n }\n /**\n * Returns accession number of the hit sequence.\n */\n\n }, {\n key: \"accession\",\n value: function accession() {\n return this.props.hit.accession;\n }\n /**\n * Returns id of the hit sequence.\n */\n\n }, {\n key: \"sequenceID\",\n value: function sequenceID() {\n return this.props.hit.id;\n }\n /**\n * Returns length of the hit sequence.\n */\n\n }, {\n key: \"hitLength\",\n value: function hitLength() {\n return this.props.hit.length;\n }\n }, {\n key: \"numHSPs\",\n value: function numHSPs() {\n return this.props.hit.hsps.length;\n } // Internal helpers. //\n\n /**\n * Returns id that will be used for the DOM node corresponding to the hit.\n */\n\n }, {\n key: \"domID\",\n value: function domID() {\n return 'Query_' + this.props.query.number + '_hit_' + this.props.hit.number;\n }\n }, {\n key: \"databaseIDs\",\n value: function databaseIDs() {\n return underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.querydb, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].iteratee('id'));\n }\n }, {\n key: \"showSequenceViewer\",\n value: function showSequenceViewer() {\n this.props.showSequenceModal(this.viewSequenceLink());\n }\n }, {\n key: \"viewSequenceLink\",\n value: function viewSequenceLink() {\n var sequenceIDs = encodeURIComponent(this.sequenceID());\n var databaseIDs = encodeURIComponent(this.databaseIDs());\n return \"get_sequence/?sequence_ids=\".concat(sequenceIDs, \"&database_ids=\").concat(databaseIDs);\n }\n }, {\n key: \"downloadFASTA\",\n value: function downloadFASTA(event) {\n var sequenceIDs = [this.sequenceID()];\n\n (0,_download_fasta__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(sequenceIDs, this.databaseIDs());\n } // Event-handler for exporting alignments.\n // Calls relevant method on AlignmentExporter defined in alignment_exporter.js.\n\n }, {\n key: \"downloadAlignment\",\n value: function downloadAlignment(event) {\n var hsps = underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.hit.hsps, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function (hsp) {\n hsp.query_id = this.props.query.id;\n hsp.hit_id = this.props.hit.id;\n return hsp;\n }, this));\n\n var aln_exporter = new _alignment_exporter__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n aln_exporter.export_alignments(hsps, this.props.query.id + '_' + this.props.hit.id);\n }\n }, {\n key: \"headerJSX\",\n value: function headerJSX() {\n var meta = \"length: \".concat(this.hitLength().toLocaleString());\n\n if (this.props.showQueryCrumbs && this.props.showHitCrumbs) {\n // Multiper queries, multiple hits\n meta = \"hit \".concat(this.props.hit.number, \" of query \").concat(this.props.query.number, \", \") + meta;\n } else if (this.props.showQueryCrumbs && !this.props.showHitCrumbs) {\n // Multiple queries, single hit\n meta = \"the only hit of query \".concat(this.props.query.number, \", \") + meta;\n } else if (!this.props.showQueryCrumbs && this.props.showHitCrumbs) {\n // Single query, multiple hits\n meta = \"hit \".concat(this.props.hit.number, \", \") + meta;\n }\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"section-header\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"h4\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa fa-minus-square-o\"\n }), \"\\xA0\", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"strong\", {\n children: this.props.hit.id\n }), \"\\xA0\", this.props.hit.title]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n className: \"label label-reset pos-label\",\n children: meta\n })]\n });\n }\n }, {\n key: \"contentJSX\",\n value: function contentJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"section-content\",\n \"data-parent-hit\": this.domID(),\n children: [this.hitLinks(), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_kablammo__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n query: this.props.query,\n hit: this.props.hit,\n algorithm: this.props.algorithm,\n showHSPCrumbs: this.numHSPs() > 1 && this.numHSPs() < 27,\n collapsed: this.props.veryBig\n }, 'kablammo' + this.props.query.id)]\n });\n }\n }, {\n key: \"hitLinks\",\n value: function hitLinks() {\n var _this2 = this;\n\n var btns = [];\n\n if (!(this.props.imported_xml || this.props.non_parse_seqids)) {\n btns = btns.concat([this.viewSequenceButton(), this.downloadFASTAButton()]);\n }\n\n btns.push(this.downloadAlignmentButton());\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"hit-links\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"label\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"input\", {\n type: \"checkbox\",\n id: this.domID() + '_checkbox',\n value: this.sequenceID(),\n onChange: function () {\n this.props.selectHit(this.domID() + '_checkbox');\n }.bind(this),\n \"data-target\": '#' + this.domID()\n }), \" Select\"]\n }), btns.map(function (btn, index) {\n return [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n className: \"line\",\n children: \"|\"\n }, \"btn-\".concat(index)), _this2.button(Object.assign(btn, {\n key: index\n }))];\n }), this.props.hit.links.map(function (link, index) {\n return [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n className: \"line\",\n children: \"|\"\n }, \"link-\".concat(index)), _this2.a(link, index)];\n })]\n });\n } // Return JSX for view sequence button.\n\n }, {\n key: \"viewSequenceButton\",\n value: function viewSequenceButton() {\n var _this3 = this;\n\n if (this.hitLength() > 10000) {\n return {\n text: 'Sequence',\n icon: 'fa-eye',\n className: 'view-sequence',\n title: 'Sequence too long'\n };\n } else {\n return {\n text: 'Sequence',\n icon: 'fa-eye',\n className: 'view-sequence',\n onClick: function onClick() {\n return _this3.showSequenceViewer();\n }\n };\n }\n }\n }, {\n key: \"downloadFASTAButton\",\n value: function downloadFASTAButton() {\n var _this4 = this;\n\n return {\n text: 'FASTA',\n icon: 'fa-download',\n className: 'download-fa',\n onClick: function onClick() {\n return _this4.downloadFASTA();\n }\n };\n }\n }, {\n key: \"downloadAlignmentButton\",\n value: function downloadAlignmentButton() {\n var _this5 = this;\n\n return {\n text: 'Alignment',\n icon: 'fa-download',\n className: 'download-aln',\n onClick: function onClick() {\n return _this5.downloadAlignment();\n }\n };\n }\n }, {\n key: \"button\",\n value: function button(_ref) {\n var text = _ref.text,\n icon = _ref.icon,\n title = _ref.title,\n className = _ref.className,\n onClick = _ref.onClick,\n key = _ref.key;\n\n if (onClick) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"button\", {\n className: \"btn-link \".concat(className),\n title: title,\n onClick: onClick,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa \".concat(icon)\n }), \" \", text]\n }, key);\n } else {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"button\", {\n className: \"btn-link view-sequence disabled\",\n title: title,\n disabled: true,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa \".concat(icon)\n }), \" \", text]\n }, key);\n }\n }\n /**\n * Render URL for sequence-viewer.\n */\n\n }, {\n key: \"a\",\n value: function a(link, key) {\n if (!link.title || !link.url) return;\n var className = 'btn btn-link';\n if (link[\"class\"]) className = \"\".concat(className, \" \").concat(link[\"class\"]);\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"a\", {\n href: link.url,\n className: className,\n target: \"_blank\",\n children: [link.icon && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: 'fa ' + link.icon\n }), ' ' + link.title + ' ']\n }, \"\".concat(link.url, \"-\").concat(key));\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"hit\",\n id: this.domID(),\n \"data-hit-def\": this.props.hit.id,\n \"data-hit-len\": this.props.hit.length,\n \"data-hit-evalue\": this.props.hit.evalue,\n children: [this.headerJSX(), \" \", this.contentJSX()]\n });\n }\n }]);\n\n return _default;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n\n\n//# sourceURL=webpack://SequenceServer/./public/js/hit.js?"); /***/ }), @@ -104,7 +104,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__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 */ HSP)\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 _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ \"./public/js/utils.js\");\n/* harmony import */ var _visualisation_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./visualisation_helpers */ \"./public/js/visualisation_helpers.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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\nvar HSPComponents = {};\n/**\n * Alignment viewer.\n */\n\nvar HSP = /*#__PURE__*/function (_React$Component) {\n _inherits(HSP, _React$Component);\n\n var _super = _createSuper(HSP);\n\n function HSP(props) {\n var _this;\n\n _classCallCheck(this, HSP);\n\n _this = _super.call(this, props);\n _this.hsp = props.hsp;\n _this.hspRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n return _this;\n }\n\n _createClass(HSP, [{\n key: \"domID\",\n value: function domID() {\n return \"Query_\" + this.props.query.number + \"_hit_\" + this.props.hit.number + \"_\" + this.props.hsp.number;\n }\n }, {\n key: \"hitDOM_ID\",\n value: function hitDOM_ID() {\n return \"Query_\" + this.props.query.number + \"_hit_\" + this.props.hit.number;\n } // Renders pretty formatted alignment.\n\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"hsp\",\n id: this.domID(),\n ref: this.hspRef,\n \"data-parent-hit\": this.hitDOM_ID(),\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"pre\", {\n className: \"pre-reset hsp-stats\",\n children: [this.props.showHSPNumbers && \"\".concat(_visualisation_helpers__WEBPACK_IMPORTED_MODULE_3__.toLetters(this.hsp.number), \". \"), this.hspStats().map(function (s, i) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n children: s\n }, i);\n })]\n }), this.hspLines()]\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n HSPComponents[this.domID()] = this;\n this.draw();\n }\n }, {\n key: \"draw\",\n value: function draw() {\n var charWidth = this.props.getCharacterWidth();\n var containerWidth = $(this.hspRef.current).width();\n this.chars = Math.floor((containerWidth - 4) / charWidth);\n this.forceUpdate();\n } // See Query.shouldComponentUpdate. The same applies for hsp.\n\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate() {\n return !this.props.hsp;\n }\n /**\n * Returns an array of span elements or plain strings (React automatically\n * adds span tag around strings). This array is passed as it is to JSX to be\n * rendered just above the pairwise alignment (see render method).\n *\n * We cannot return a string from this method otherwise we wouldn't be able\n * to use JSX elements to format text (like, superscript).\n */\n\n }, {\n key: \"hspStats\",\n value: function hspStats() {\n // An array to hold text or span elements that make up the line.\n var line = []; // Bit score and total score.\n\n line.push(\"Score: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inTwoDecimal(this.hsp.bit_score), \" (\").concat(this.hsp.score, \"), \")); // E value\n\n line.push(\"E value: \");\n line.push(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inExponential(this.hsp.evalue));\n line.push(\", \"); // Identity\n\n line.push([\"Identity: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inFraction(this.hsp.identity, this.hsp.length), \" (\").concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inPercentage(this.hsp.identity, this.hsp.length), \"), \")]); // Positives (for protein alignment).\n\n if (this.props.algorithm === \"blastp\" || this.props.algorithm === \"blastx\" || this.props.algorithm === \"tblastn\" || this.props.algorithm === \"tblastx\") {\n line.push(\"Positives: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inFraction(this.hsp.positives, this.hsp.length), \" (\").concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inPercentage(this.hsp.positives, this.hsp.length), \"), \"));\n } // Gaps\n\n\n line.push(\"Gaps: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inFraction(this.hsp.gaps, this.hsp.length), \" (\").concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inPercentage(this.hsp.gaps, this.hsp.length), \")\")); // Query coverage\n //line.push(`Query coverage: ${this.hsp.qcovhsp}%, `)\n\n switch (this.props.algorithm) {\n case \"tblastx\":\n line.push(\", Frame: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inFraction(this.hsp.qframe, this.hsp.sframe)));\n break;\n\n case \"blastn\":\n line.push(\", Strand: \".concat(this.hsp.qframe > 0 ? \"+\" : \"-\", \" / \").concat(this.hsp.sframe > 0 ? \"+\" : \"-\"));\n break;\n\n case \"blastx\":\n line.push(\", Query Frame: \".concat(this.hsp.qframe));\n break;\n\n case \"tblastn\":\n line.push(\", Hit Frame: \".concat(this.hsp.sframe));\n break;\n }\n\n return line;\n }\n /**\n * Returns array of pre tags containing the three query, middle, and subject\n * lines that together comprise one 'rendered line' of HSP.\n */\n\n }, {\n key: \"hspLines\",\n value: function hspLines() {\n // Space reserved for showing coordinates\n var width = this.width(); // Number of residues we can draw per line is the total number of\n // characters we can have in a line minus space required to show left\n // and right coordinates minus 10 characters reserved for displaying\n // the words Query, Subject and three blank spaces per line.\n\n var chars = this.chars - 2 * width - 10; // Number of lines of pairwise-alignment (i.e., each line consists of 3\n // lines). We draw as many pre tags.\n\n var lines = Math.ceil(this.hsp.length / chars);\n var pp = [];\n var nqseq = this.nqseq();\n var nsseq = this.nsseq();\n\n for (var i = 1; i <= lines; i++) {\n var seq_start_index = chars * (i - 1);\n var seq_stop_index = seq_start_index + chars;\n var lqstart = nqseq;\n var lqseq = this.hsp.qseq.slice(seq_start_index, seq_stop_index);\n var lqend = nqseq + (lqseq.length - lqseq.split(\"-\").length) * this.qframe_unit() * this.qframe_sign();\n nqseq = lqend + this.qframe_unit() * this.qframe_sign();\n var lmseq = this.hsp.midline.slice(seq_start_index, seq_stop_index);\n var lsstart = nsseq;\n var lsseq = this.hsp.sseq.slice(seq_start_index, seq_stop_index);\n var lsend = nsseq + (lsseq.length - lsseq.split(\"-\").length) * this.sframe_unit() * this.sframe_sign();\n nsseq = lsend + this.sframe_unit() * this.sframe_sign();\n pp.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"pre\", {\n className: \"pre-reset hsp-lines\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \"Query \".concat(this.formatCoords(lqstart, width), \" \")\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n children: lqseq\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \" \".concat(lqend)\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"br\", {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \"\".concat(this.formatCoords(\"\", width + 8), \" \")\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n children: lmseq\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"br\", {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \"Subject \".concat(this.formatCoords(lsstart, width), \" \")\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n children: lsseq\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \" \".concat(lsend)\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"br\", {})]\n }, this.hsp.number + \",\" + i));\n }\n\n return pp;\n } // Width of the coordinate part of hsp lines. Essentially the length of\n // the largest coordinate.\n\n }, {\n key: \"width\",\n value: function width() {\n return underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].max(underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map([this.hsp.qstart, this.hsp.qend, this.hsp.sstart, this.hsp.send], function (n) {\n return n.toString().length;\n }));\n } // Alignment start coordinate for query sequence.\n //\n // This will be qstart or qend depending on the direction in which the\n // (translated) query sequence aligned.\n\n }, {\n key: \"nqseq\",\n value: function nqseq() {\n switch (this.props.algorithm) {\n case \"blastp\":\n case \"blastx\":\n case \"tblastn\":\n case \"tblastx\":\n return this.hsp.qframe >= 0 ? this.hsp.qstart : this.hsp.qend;\n\n case \"blastn\":\n // BLASTN is a bit weird in that, no matter which direction the query\n // sequence aligned in, qstart is taken as alignment start coordinate\n // for query.\n return this.hsp.qstart;\n }\n } // Alignment start coordinate for subject sequence.\n //\n // This will be sstart or send depending on the direction in which the\n // (translated) subject sequence aligned.\n\n }, {\n key: \"nsseq\",\n value: function nsseq() {\n switch (this.props.algorithm) {\n case \"blastp\":\n case \"blastx\":\n case \"tblastn\":\n case \"tblastx\":\n return this.hsp.sframe >= 0 ? this.hsp.sstart : this.hsp.send;\n\n case \"blastn\":\n // BLASTN is a bit weird in that, no matter which direction the\n // subject sequence aligned in, sstart is taken as alignment\n // start coordinate for subject.\n return this.hsp.sstart;\n }\n } // Jump in query coordinate.\n //\n // Roughly,\n //\n // qend = qstart + n * qframe_unit\n //\n // This will be 1 or 3 depending on whether the query sequence was\n // translated or not.\n\n }, {\n key: \"qframe_unit\",\n value: function qframe_unit() {\n switch (this.props.algorithm) {\n case \"blastp\":\n case \"blastn\":\n case \"tblastn\":\n return 1;\n\n case \"blastx\": // _Translated_ nucleotide query against protein database.\n\n case \"tblastx\":\n // _Translated_ nucleotide query against translated\n // nucleotide database.\n return 3;\n }\n } // Jump in subject coordinate.\n //\n // Roughly,\n //\n // send = sstart + n * sframe_unit\n //\n // This will be 1 or 3 depending on whether the subject sequence was\n // translated or not.\n\n }, {\n key: \"sframe_unit\",\n value: function sframe_unit() {\n switch (this.props.algorithm) {\n case \"blastp\":\n case \"blastx\":\n case \"blastn\":\n return 1;\n\n case \"tblastn\":\n // Protein query against _translated_ nucleotide database.\n return 3;\n\n case \"tblastx\":\n // Translated nucleotide query against _translated_\n // nucleotide database.\n return 3;\n }\n } // If we should add or subtract qframe_unit from qstart to arrive at qend.\n //\n // Roughly,\n //\n // qend = qstart + (qframe_sign) * n * qframe_unit\n //\n // This will be +1 or -1, depending on the direction in which the\n // (translated) query sequence aligned.\n\n }, {\n key: \"qframe_sign\",\n value: function qframe_sign() {\n return this.hsp.qframe >= 0 ? 1 : -1;\n } // If we should add or subtract sframe_unit from sstart to arrive at send.\n //\n // Roughly,\n //\n // send = sstart + (sframe_sign) * n * sframe_unit\n //\n // This will be +1 or -1, depending on the direction in which the\n // (translated) subject sequence aligned.\n\n }, {\n key: \"sframe_sign\",\n value: function sframe_sign() {\n return this.hsp.sframe >= 0 ? 1 : -1;\n }\n /**\n * Pad given coord with ' ' till its length == width. Returns undefined if\n * width is not supplied.\n */\n\n }, {\n key: \"formatCoords\",\n value: function formatCoords(coord, width) {\n if (width) {\n var padding = width - coord.toString().length;\n return Array(padding + 1).join(\" \").concat([coord]);\n }\n }\n }, {\n key: \"spanCoords\",\n value: function spanCoords(text) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: text\n });\n }\n }]);\n\n return HSP;\n}((react__WEBPACK_IMPORTED_MODULE_0___default().Component)); // Redraw if window resized.\n\n\n\n$(window).resize(underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].debounce(function () {\n underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].each(HSPComponents, function (comp) {\n comp.draw();\n });\n}, 100));\n\n//# sourceURL=webpack://SequenceServer/./public/js/hsp.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ HSP)\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 _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ \"./public/js/utils.js\");\n/* harmony import */ var _visualisation_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./visualisation_helpers */ \"./public/js/visualisation_helpers.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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\nvar HSPComponents = {};\n/**\n * Alignment viewer.\n */\n\nvar HSP = /*#__PURE__*/function (_React$Component) {\n _inherits(HSP, _React$Component);\n\n var _super = _createSuper(HSP);\n\n function HSP(props) {\n var _this;\n\n _classCallCheck(this, HSP);\n\n _this = _super.call(this, props);\n _this.hsp = props.hsp;\n _this.hspRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n return _this;\n }\n\n _createClass(HSP, [{\n key: \"domID\",\n value: function domID() {\n return \"Query_\" + this.props.query.number + \"_hit_\" + this.props.hit.number + \"_\" + this.props.hsp.number;\n }\n }, {\n key: \"hitDOM_ID\",\n value: function hitDOM_ID() {\n return \"Query_\" + this.props.query.number + \"_hit_\" + this.props.hit.number;\n } // Renders pretty formatted alignment.\n\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"hsp\",\n id: this.domID(),\n ref: this.hspRef,\n \"data-parent-hit\": this.hitDOM_ID(),\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"pre\", {\n className: \"pre-reset hsp-stats\",\n children: [this.props.showHSPNumbers && \"\".concat(_visualisation_helpers__WEBPACK_IMPORTED_MODULE_3__.toLetters(this.hsp.number), \". \"), this.hspStats().map(function (s, i) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n children: s\n }, i);\n })]\n }), this.hspLines()]\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n HSPComponents[this.domID()] = this;\n this.draw();\n }\n }, {\n key: \"draw\",\n value: function draw() {\n var charWidth = this.props.getCharacterWidth();\n var containerWidth = $(this.hspRef.current).width();\n this.chars = Math.floor((containerWidth - 4) / charWidth);\n this.forceUpdate();\n } // See Query.shouldComponentUpdate. The same applies for hsp.\n\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate() {\n return !this.props.hsp;\n }\n /**\n * Returns an array of span elements or plain strings (React automatically\n * adds span tag around strings). This array is passed as it is to JSX to be\n * rendered just above the pairwise alignment (see render method).\n *\n * We cannot return a string from this method otherwise we wouldn't be able\n * to use JSX elements to format text (like, superscript).\n */\n\n }, {\n key: \"hspStats\",\n value: function hspStats() {\n // An array to hold text or span elements that make up the line.\n var line = []; // Bit score and total score.\n\n line.push(\"Score: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inTwoDecimal(this.hsp.bit_score), \" (\").concat(this.hsp.score, \"), \")); // E value\n\n line.push(\"E value: \");\n line.push(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inExponential(this.hsp.evalue));\n line.push(\", \"); // Identity\n\n line.push([\"Identity: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inFraction(this.hsp.identity, this.hsp.length), \" (\").concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inPercentage(this.hsp.identity, this.hsp.length), \"), \")]); // Positives (for protein alignment).\n\n if (this.props.algorithm === \"blastp\" || this.props.algorithm === \"blastx\" || this.props.algorithm === \"tblastn\" || this.props.algorithm === \"tblastx\") {\n line.push(\"Positives: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inFraction(this.hsp.positives, this.hsp.length), \" (\").concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inPercentage(this.hsp.positives, this.hsp.length), \"), \"));\n } // Gaps\n\n\n line.push(\"Gaps: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inFraction(this.hsp.gaps, this.hsp.length), \" (\").concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inPercentage(this.hsp.gaps, this.hsp.length), \")\")); // Query coverage\n //line.push(`Query coverage: ${this.hsp.qcovhsp}%, `)\n\n switch (this.props.algorithm) {\n case \"tblastx\":\n line.push(\", Frame: \".concat(_utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].inFraction(this.hsp.qframe, this.hsp.sframe)));\n break;\n\n case \"blastn\":\n line.push(\", Strand: \".concat(this.hsp.qframe > 0 ? \"+\" : \"-\", \" / \").concat(this.hsp.sframe > 0 ? \"+\" : \"-\"));\n break;\n\n case \"blastx\":\n line.push(\", Query Frame: \".concat(this.hsp.qframe));\n break;\n\n case \"tblastn\":\n line.push(\", Hit Frame: \".concat(this.hsp.sframe));\n break;\n }\n\n return line;\n }\n /**\n * Returns array of pre tags containing the three query, middle, and subject\n * lines that together comprise one 'rendered line' of HSP.\n */\n\n }, {\n key: \"hspLines\",\n value: function hspLines() {\n // Space reserved for showing coordinates\n var width = this.width(); // Number of residues we can draw per line is the total number of\n // characters we can have in a line minus space required to show left\n // and right coordinates minus 10 characters reserved for displaying\n // the words Query, Subject and three blank spaces per line.\n\n var chars = this.chars - 2 * width - 10; // Number of lines of pairwise-alignment (i.e., each line consists of 3\n // lines). We draw as many pre tags.\n\n var lines = Math.ceil(this.hsp.length / chars);\n var pp = [];\n var nqseq = this.nqseq();\n var nsseq = this.nsseq();\n\n for (var i = 1; i <= lines; i++) {\n var seq_start_index = chars * (i - 1);\n var seq_stop_index = seq_start_index + chars;\n var lqstart = nqseq;\n var lqseq = this.hsp.qseq.slice(seq_start_index, seq_stop_index);\n var lqend = nqseq + (lqseq.length - lqseq.split(\"-\").length) * this.qframe_unit() * this.qframe_sign();\n nqseq = lqend + this.qframe_unit() * this.qframe_sign();\n var lmseq = this.hsp.midline.slice(seq_start_index, seq_stop_index);\n var lsstart = nsseq;\n var lsseq = this.hsp.sseq.slice(seq_start_index, seq_stop_index);\n var lsend = nsseq + (lsseq.length - lsseq.split(\"-\").length) * this.sframe_unit() * this.sframe_sign();\n nsseq = lsend + this.sframe_unit() * this.sframe_sign();\n pp.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"pre\", {\n className: \"pre-reset hsp-lines\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \"Query \".concat(this.formatCoords(lqstart, width), \" \")\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n children: lqseq\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \" \".concat(lqend)\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"br\", {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \"\".concat(this.formatCoords(\"\", width + 8), \" \")\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n children: lmseq\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"br\", {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \"Subject \".concat(this.formatCoords(lsstart, width), \" \")\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n children: lsseq\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: \" \".concat(lsend)\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"br\", {})]\n }, this.hsp.number + \",\" + i));\n }\n\n return pp;\n } // Width of the coordinate part of hsp lines. Essentially the length of\n // the largest coordinate.\n\n }, {\n key: \"width\",\n value: function width() {\n return underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].max(underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map([this.hsp.qstart, this.hsp.qend, this.hsp.sstart, this.hsp.send], function (n) {\n return n.toString().length;\n }));\n } // Alignment start coordinate for query sequence.\n //\n // This will be qstart or qend depending on the direction in which the\n // (translated) query sequence aligned.\n\n }, {\n key: \"nqseq\",\n value: function nqseq() {\n switch (this.props.algorithm) {\n case \"blastp\":\n case \"blastx\":\n case \"tblastn\":\n case \"tblastx\":\n return this.hsp.qframe >= 0 ? this.hsp.qstart : this.hsp.qend;\n\n case \"blastn\":\n // BLASTN is a bit weird in that, no matter which direction the query\n // sequence aligned in, qstart is taken as alignment start coordinate\n // for query.\n return this.hsp.qstart;\n }\n } // Alignment start coordinate for subject sequence.\n //\n // This will be sstart or send depending on the direction in which the\n // (translated) subject sequence aligned.\n\n }, {\n key: \"nsseq\",\n value: function nsseq() {\n switch (this.props.algorithm) {\n case \"blastp\":\n case \"blastx\":\n case \"tblastn\":\n case \"tblastx\":\n return this.hsp.sframe >= 0 ? this.hsp.sstart : this.hsp.send;\n\n case \"blastn\":\n // BLASTN is a bit weird in that, no matter which direction the\n // subject sequence aligned in, sstart is taken as alignment\n // start coordinate for subject.\n return this.hsp.sstart;\n }\n } // Jump in query coordinate.\n //\n // Roughly,\n //\n // qend = qstart + n * qframe_unit\n //\n // This will be 1 or 3 depending on whether the query sequence was\n // translated or not.\n\n }, {\n key: \"qframe_unit\",\n value: function qframe_unit() {\n switch (this.props.algorithm) {\n case \"blastp\":\n case \"blastn\":\n case \"tblastn\":\n return 1;\n\n case \"blastx\": // _Translated_ nucleotide query against protein database.\n\n case \"tblastx\":\n // _Translated_ nucleotide query against translated\n // nucleotide database.\n return 3;\n }\n } // Jump in subject coordinate.\n //\n // Roughly,\n //\n // send = sstart + n * sframe_unit\n //\n // This will be 1 or 3 depending on whether the subject sequence was\n // translated or not.\n\n }, {\n key: \"sframe_unit\",\n value: function sframe_unit() {\n switch (this.props.algorithm) {\n case \"blastp\":\n case \"blastx\":\n case \"blastn\":\n return 1;\n\n case \"tblastn\":\n // Protein query against _translated_ nucleotide database.\n return 3;\n\n case \"tblastx\":\n // Translated nucleotide query against _translated_\n // nucleotide database.\n return 3;\n }\n } // If we should add or subtract qframe_unit from qstart to arrive at qend.\n //\n // Roughly,\n //\n // qend = qstart + (qframe_sign) * n * qframe_unit\n //\n // This will be +1 or -1, depending on the direction in which the\n // (translated) query sequence aligned.\n\n }, {\n key: \"qframe_sign\",\n value: function qframe_sign() {\n return this.hsp.qframe >= 0 ? 1 : -1;\n } // If we should add or subtract sframe_unit from sstart to arrive at send.\n //\n // Roughly,\n //\n // send = sstart + (sframe_sign) * n * sframe_unit\n //\n // This will be +1 or -1, depending on the direction in which the\n // (translated) subject sequence aligned.\n\n }, {\n key: \"sframe_sign\",\n value: function sframe_sign() {\n return this.hsp.sframe >= 0 ? 1 : -1;\n }\n /**\n * Pad given coord with ' ' till its length == width. Returns undefined if\n * width is not supplied.\n */\n\n }, {\n key: \"formatCoords\",\n value: function formatCoords(coord, width) {\n if (width) {\n var padding = width - coord.toString().length;\n return Array(padding + 1).join(\" \").concat([coord]);\n }\n }\n }, {\n key: \"spanCoords\",\n value: function spanCoords(text) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"hsp-coords\",\n children: text\n });\n }\n }]);\n\n return HSP;\n}((react__WEBPACK_IMPORTED_MODULE_0___default().Component)); // Redraw if window resized.\n\n\n\n$(window).resize(underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].debounce(function () {\n underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].each(HSPComponents, function (comp) {\n comp.draw();\n });\n}, 100));\n\n//# sourceURL=webpack://SequenceServer/./public/js/hsp.js?"); /***/ }), @@ -148,7 +148,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__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 */ \"ReportQuery\": () => (/* binding */ ReportQuery),\n/* harmony export */ \"SearchQueryWidget\": () => (/* binding */ SearchQueryWidget)\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 _hits_overview__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hits_overview */ \"./public/js/hits_overview.js\");\n/* harmony import */ var _length_distribution__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./length_distribution */ \"./public/js/length_distribution.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ \"./public/js/utils.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n // length distribution of hits\n\n\n/**\n * Query component displays query defline, graphical overview, length\n * distribution, and hits table.\n */\n\n\n\nvar ReportQuery = /*#__PURE__*/function (_Component) {\n _inherits(ReportQuery, _Component);\n\n var _super = _createSuper(ReportQuery);\n\n function ReportQuery() {\n _classCallCheck(this, ReportQuery);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(ReportQuery, [{\n key: \"shouldComponentUpdate\",\n value: // Each update cycle will cause all previous queries to be re-rendered.\n // We avoid that by implementing shouldComponentUpdate life-cycle hook.\n // The trick is to simply check if the components has recieved props\n // before.\n function shouldComponentUpdate() {\n // If the component has received props before, query property will\n // be set on it. If it is, we return false so that the component\n // is not re-rendered. If the query property is not set, we return\n // true: this must be the first time react is trying to render the\n // component.\n return !this.props.query;\n } // Kind of public API //\n\n /**\n * Returns the id of query.\n */\n\n }, {\n key: \"domID\",\n value: function domID() {\n return 'Query_' + this.props.query.number;\n }\n }, {\n key: \"queryLength\",\n value: function queryLength() {\n return this.props.query.length;\n }\n /**\n * Returns number of hits.\n */\n\n }, {\n key: \"numhits\",\n value: function numhits() {\n return this.props.query.hits.length;\n }\n }, {\n key: \"headerJSX\",\n value: function headerJSX() {\n var meta = \"length: \".concat(this.queryLength().toLocaleString());\n\n if (this.props.showQueryCrumbs) {\n meta = \"query \".concat(this.props.query.number, \", \") + meta;\n }\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"section-header\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"h3\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"strong\", {\n children: [\"Query=\\xA0\", this.props.query.id]\n }), \"\\xA0\", this.props.query.title]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n className: \"label label-reset pos-label\",\n children: meta\n })]\n });\n }\n }, {\n key: \"hitsListJSX\",\n value: function hitsListJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"section-content\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_hits_overview__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n query: this.props.query,\n program: this.props.program,\n collapsed: this.props.veryBig\n }, 'GO_' + this.props.query.number), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_length_distribution__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n query: this.props.query,\n algorithm: this.props.program,\n collapsed: \"true\"\n }, 'LD_' + this.props.query.id), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(HitsTable, {\n query: this.props.query,\n imported_xml: this.props.imported_xml\n }, 'HT_' + this.props.query.number)]\n });\n }\n }, {\n key: \"noHitsJSX\",\n value: function noHitsJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"div\", {\n className: \"section-content\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"strong\", {\n children: \" ****** No hits found ****** \"\n })\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"resultn\",\n id: this.domID(),\n \"data-query-len\": this.props.query.length,\n \"data-algorithm\": this.props.program,\n children: [this.headerJSX(), this.numhits() && this.hitsListJSX() || this.noHitsJSX()]\n });\n }\n }]);\n\n return ReportQuery;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n/**\n * Query widget for Search component.\n */\n\nvar SearchQueryWidget = /*#__PURE__*/function (_Component2) {\n _inherits(SearchQueryWidget, _Component2);\n\n var _super2 = _createSuper(SearchQueryWidget);\n\n function SearchQueryWidget(props) {\n var _this;\n\n _classCallCheck(this, SearchQueryWidget);\n\n _this = _super2.call(this, props);\n _this.state = {\n value: $('input#input_sequence').val() || ''\n };\n _this.value = _this.value.bind(_assertThisInitialized(_this));\n _this.clear = _this.clear.bind(_assertThisInitialized(_this));\n _this.focus = _this.focus.bind(_assertThisInitialized(_this));\n _this.isEmpty = _this.isEmpty.bind(_assertThisInitialized(_this));\n _this.textarea = _this.textarea.bind(_assertThisInitialized(_this));\n _this.controls = _this.controls.bind(_assertThisInitialized(_this));\n _this.handleInput = _this.handleInput.bind(_assertThisInitialized(_this));\n _this.hideShowButton = _this.hideShowButton.bind(_assertThisInitialized(_this));\n _this.indicateError = _this.indicateError.bind(_assertThisInitialized(_this));\n _this.indicateNormal = _this.indicateNormal.bind(_assertThisInitialized(_this));\n _this.type = _this.type.bind(_assertThisInitialized(_this));\n _this.guessSequenceType = _this.guessSequenceType.bind(_assertThisInitialized(_this));\n _this.notify = _this.notify.bind(_assertThisInitialized(_this));\n _this.textareaRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n _this.controlsRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n return _this;\n } // LIFECYCLE Methods\n\n\n _createClass(SearchQueryWidget, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n $('body').click(function () {\n $('.notifications .active').hide('drop', {\n direction: 'up'\n }).removeClass('active');\n });\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n this.hideShowButton();\n var type = this.type();\n\n if (!type || type !== this._type) {\n this._type = type;\n this.notify(type);\n this.props.onSequenceTypeChanged(type);\n }\n } // Kind of public API. //\n\n /**\n * Returns query sequence if no argument is provided (or null or undefined\n * is provided as argument). Otherwise, sets query sequenced to the given\n * value and returns `this`.\n *\n * Default/initial state of query sequence is an empty string. Caller must\n * explicitly provide empty string as argument to \"reset\" query sequence.\n */\n\n }, {\n key: \"value\",\n value: function value(val) {\n if (val == null) {\n // i.e., val is null or undefined\n return this.state.value;\n } else {\n this.setState({\n value: val\n });\n return this;\n }\n }\n /**\n * Clears textarea. Returns `this`.\n *\n * Clearing textarea also causes it to be focussed.\n */\n\n }, {\n key: \"clear\",\n value: function clear() {\n return this.value('').focus();\n }\n /**\n * Focuses textarea. Returns `this`.\n */\n\n }, {\n key: \"focus\",\n value: function focus() {\n this.textarea().focus();\n return this;\n }\n /**\n * Returns true if query is absent ('', undefined, null), false otherwise.\n */\n\n }, {\n key: \"isEmpty\",\n value: function isEmpty() {\n return !this.value();\n } // Internal helpers. //\n\n }, {\n key: \"textarea\",\n value: function textarea() {\n return $(this.textareaRef.current);\n }\n }, {\n key: \"controls\",\n value: function controls() {\n return $(this.controlsRef.current);\n }\n }, {\n key: \"handleInput\",\n value: function handleInput(evt) {\n this.value(evt.target.value);\n }\n /**\n * Hides or shows 'clear sequence' button.\n *\n * Rendering the 'clear sequence' button takes into account presence or\n * absence of a scrollbar.\n *\n * Called by `componentDidUpdate`.\n */\n\n }, {\n key: \"hideShowButton\",\n value: function hideShowButton() {\n if (!this.isEmpty()) {\n // Calculation below is based on -\n // http://chris-spittles.co.uk/jquery-calculate-scrollbar-width/\n // FIXME: can reflow be avoided here?\n var textareaNode = this.textarea()[0];\n var sequenceControlsRight = textareaNode.offsetWidth - textareaNode.clientWidth;\n this.controls().css('right', sequenceControlsRight + 17);\n this.controls().removeClass('hidden');\n } else {\n // FIXME: what are lines 1, 2, & 3 doing here?\n this.textarea().parent().removeClass('has-error');\n this.$sequenceFile = $('#sequence-file');\n this.$sequenceFile.empty();\n this.controls().addClass('hidden');\n }\n }\n /**\n * Put red border around textarea.\n */\n\n }, {\n key: \"indicateError\",\n value: function indicateError() {\n this.textarea().parent().addClass('has-error');\n }\n /**\n * Put normal blue border around textarea.\n */\n\n }, {\n key: \"indicateNormal\",\n value: function indicateNormal() {\n this.textarea().parent().removeClass('has-error');\n }\n /**\n * Returns type of the query sequence (nucleotide, protein, mixed).\n *\n * Query widget supports executing a callback when the query type changes.\n * Components interested in query type should register a callback instead\n * of directly calling this method.\n */\n\n }, {\n key: \"type\",\n value: function type() {\n var sequences = this.value().split(/>.*/);\n var type, tmp;\n\n for (var i = 0; i < sequences.length; i++) {\n tmp = this.guessSequenceType(sequences[i]); // could not guess the sequence type; try the next sequence\n\n if (!tmp) {\n continue;\n }\n\n if (!type) {\n // successfully guessed the type of atleast one sequence\n type = tmp;\n } else if (tmp !== type) {\n // user has mixed different type of sequences\n return 'mixed';\n }\n }\n\n return type;\n }\n /**\n * Guesses and returns the type of the given sequence (nucleotide,\n * protein).\n */\n\n }, {\n key: \"guessSequenceType\",\n value: function guessSequenceType(sequence) {\n // remove 'noisy' characters\n sequence = sequence.replace(/[^A-Z]/gi, ''); // non-letter characters\n\n sequence = sequence.replace(/[NX]/gi, ''); // ambiguous characters\n // can't determine the type of ultrashort queries\n\n if (sequence.length < 10) {\n return undefined;\n } // count the number of putative NA\n\n\n var putative_NA_count = 0;\n\n for (var i = 0; i < sequence.length; i++) {\n if (sequence[i].match(/[ACGTU]/i)) {\n putative_NA_count += 1;\n }\n }\n\n var threshold = 0.9 * sequence.length;\n return putative_NA_count > threshold ? 'nucleotide' : 'protein';\n }\n }, {\n key: \"notify\",\n value: function notify(type) {\n clearTimeout(this.notification_timeout);\n this.indicateNormal();\n $('.notifications .active').hide().removeClass('active');\n\n if (type) {\n $('#' + type + '-sequence-notification').show('drop', {\n direction: 'up'\n }).addClass('active');\n this.notification_timeout = setTimeout(function () {\n $('.notifications .active').hide('drop', {\n direction: 'up'\n }).removeClass('active');\n }, 5000);\n\n if (type === 'mixed') {\n this.indicateError();\n }\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"col-md-12\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"div\", {\n className: \"sequence\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"textarea\", {\n id: \"sequence\",\n ref: this.textareaRef,\n className: \"form-control text-monospace\",\n name: \"sequence\",\n value: this.state.value,\n placeholder: \"Paste query sequence(s) or drag file containing query sequence(s) in FASTA format here ...\",\n spellCheck: \"false\",\n autoFocus: true,\n onChange: this.handleInput\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"div\", {\n className: \"hidden\",\n style: {\n position: 'absolute',\n top: '4px',\n right: '19px'\n },\n ref: this.controlsRef,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"button\", {\n type: \"button\",\n className: \"btn btn-sm btn-default\",\n id: \"btn-sequence-clear\",\n title: \"Clear query sequence(s).\",\n onClick: this.clear,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n id: \"sequence-file\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa fa-times\"\n })]\n })\n })]\n });\n }\n }]);\n\n return SearchQueryWidget;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n/**\n * Renders summary of all hits per query in a tabular form.\n */\n\nvar HitsTable = /*#__PURE__*/function (_Component3) {\n _inherits(HitsTable, _Component3);\n\n var _super3 = _createSuper(HitsTable);\n\n function HitsTable(props) {\n _classCallCheck(this, HitsTable);\n\n return _super3.call(this, props);\n }\n\n _createClass(HitsTable, [{\n key: \"render\",\n value: function render() {\n var hasName = underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].every(this.props.query.hits, function (hit) {\n return hit.sciname !== '';\n }); // Width of sequence column is 55% when species name is not shown and\n // query coverage is.\n\n\n var seqwidth = 55; // If we are going to show species name, then reduce the width of\n // sequence column by the width of species column.\n\n if (hasName) seqwidth -= 15; // If we are not going to show query coverage (i.e. for imported XML),\n // then increase the width of sequence column by the width of coverage\n // column.\n\n if (this.props.imported_xml) seqwidth += 15;\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"table-hit-overview\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"h4\", {\n className: \"caption\",\n \"data-toggle\": \"collapse\",\n \"data-target\": '#Query_' + this.props.query.number + 'HT_' + this.props.query.number,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa fa-minus-square-o\"\n }), \"\\xA0\", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n children: \"Sequences producing significant alignments\"\n })]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"div\", {\n className: \"collapsed in\",\n id: 'Query_' + this.props.query.number + 'HT_' + this.props.query.number,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"table\", {\n className: \"table table-hover table-condensed tabular-view \",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"thead\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"tr\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n className: \"text-left\",\n children: \"#\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"\".concat(seqwidth, \"%\"),\n children: \"Similar sequences\"\n }), hasName && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"15%\",\n className: \"text-left\",\n children: \"Species\"\n }), !this.props.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"15%\",\n className: \"text-right\",\n children: \"Query coverage (%)\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"10%\",\n className: \"text-right\",\n children: \"Total score\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"10%\",\n className: \"text-right\",\n children: \"E value\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"10%\",\n className: \"text-right\",\n children: \"Identity (%)\"\n })]\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"tbody\", {\n children: underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.query.hits, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function (hit) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"tr\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-left\",\n children: hit.number + '.'\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"nowrap-ellipsis\",\n title: \"\".concat(hit.id, \" \").concat(hit.title),\n \"data-toggle\": \"tooltip\",\n \"data-placement\": \"left\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"a\", {\n href: '#Query_' + this.props.query.number + '_hit_' + hit.number,\n className: \"btn-link\",\n children: [hit.id, \" \", hit.title]\n })\n }), hasName && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"nowrap-ellipsis\",\n title: hit.sciname,\n \"data-toggle\": \"tooltip\",\n \"data-placement\": \"top\",\n children: hit.sciname\n }), !this.props.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-right\",\n children: hit.qcovs\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-right\",\n children: hit.total_score\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-right\",\n children: _utils__WEBPACK_IMPORTED_MODULE_4__[\"default\"].inExponential(hit.hsps[0].evalue)\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-right\",\n children: _utils__WEBPACK_IMPORTED_MODULE_4__[\"default\"].inPercentage(hit.hsps[0].identity, hit.hsps[0].length)\n })]\n }, hit.number);\n }, this))\n })]\n })\n })]\n });\n }\n }]);\n\n return HitsTable;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n//# sourceURL=webpack://SequenceServer/./public/js/query.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ReportQuery\": () => (/* binding */ ReportQuery),\n/* harmony export */ \"SearchQueryWidget\": () => (/* binding */ SearchQueryWidget)\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 _hits_overview__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hits_overview */ \"./public/js/hits_overview.js\");\n/* harmony import */ var _length_distribution__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./length_distribution */ \"./public/js/length_distribution.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ \"./public/js/utils.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n // length distribution of hits\n\n\n/**\n * Query component displays query defline, graphical overview, length\n * distribution, and hits table.\n */\n\n\n\nvar ReportQuery = /*#__PURE__*/function (_Component) {\n _inherits(ReportQuery, _Component);\n\n var _super = _createSuper(ReportQuery);\n\n function ReportQuery() {\n _classCallCheck(this, ReportQuery);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(ReportQuery, [{\n key: \"shouldComponentUpdate\",\n value: // Each update cycle will cause all previous queries to be re-rendered.\n // We avoid that by implementing shouldComponentUpdate life-cycle hook.\n // The trick is to simply check if the components has recieved props\n // before.\n function shouldComponentUpdate() {\n // If the component has received props before, query property will\n // be set on it. If it is, we return false so that the component\n // is not re-rendered. If the query property is not set, we return\n // true: this must be the first time react is trying to render the\n // component.\n return !this.props.query;\n } // Kind of public API //\n\n /**\n * Returns the id of query.\n */\n\n }, {\n key: \"domID\",\n value: function domID() {\n return 'Query_' + this.props.query.number;\n }\n }, {\n key: \"queryLength\",\n value: function queryLength() {\n return this.props.query.length;\n }\n /**\n * Returns number of hits.\n */\n\n }, {\n key: \"numhits\",\n value: function numhits() {\n return this.props.query.hits.length;\n }\n }, {\n key: \"headerJSX\",\n value: function headerJSX() {\n var meta = \"length: \".concat(this.queryLength().toLocaleString());\n\n if (this.props.showQueryCrumbs) {\n meta = \"query \".concat(this.props.query.number, \", \") + meta;\n }\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"section-header\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"h3\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"strong\", {\n children: [\"Query=\\xA0\", this.props.query.id]\n }), \"\\xA0\", this.props.query.title]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n className: \"label label-reset pos-label\",\n children: meta\n })]\n });\n }\n }, {\n key: \"hitsListJSX\",\n value: function hitsListJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"section-content\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_hits_overview__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n query: this.props.query,\n program: this.props.program,\n collapsed: this.props.veryBig\n }, 'GO_' + this.props.query.number), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_length_distribution__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n query: this.props.query,\n algorithm: this.props.program,\n collapsed: \"true\"\n }, 'LD_' + this.props.query.id), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(HitsTable, {\n query: this.props.query,\n imported_xml: this.props.imported_xml\n }, 'HT_' + this.props.query.number)]\n });\n }\n }, {\n key: \"noHitsJSX\",\n value: function noHitsJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"div\", {\n className: \"section-content\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"strong\", {\n children: \" ****** No hits found ****** \"\n })\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"resultn\",\n id: this.domID(),\n \"data-query-len\": this.props.query.length,\n \"data-algorithm\": this.props.program,\n children: [this.headerJSX(), this.numhits() && this.hitsListJSX() || this.noHitsJSX()]\n });\n }\n }]);\n\n return ReportQuery;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n/**\n * Query widget for Search component.\n */\n\nvar SearchQueryWidget = /*#__PURE__*/function (_Component2) {\n _inherits(SearchQueryWidget, _Component2);\n\n var _super2 = _createSuper(SearchQueryWidget);\n\n function SearchQueryWidget(props) {\n var _this;\n\n _classCallCheck(this, SearchQueryWidget);\n\n _this = _super2.call(this, props);\n _this.state = {\n value: $('input#input_sequence').val() || ''\n };\n _this.value = _this.value.bind(_assertThisInitialized(_this));\n _this.clear = _this.clear.bind(_assertThisInitialized(_this));\n _this.focus = _this.focus.bind(_assertThisInitialized(_this));\n _this.isEmpty = _this.isEmpty.bind(_assertThisInitialized(_this));\n _this.textarea = _this.textarea.bind(_assertThisInitialized(_this));\n _this.controls = _this.controls.bind(_assertThisInitialized(_this));\n _this.handleInput = _this.handleInput.bind(_assertThisInitialized(_this));\n _this.hideShowButton = _this.hideShowButton.bind(_assertThisInitialized(_this));\n _this.indicateError = _this.indicateError.bind(_assertThisInitialized(_this));\n _this.indicateNormal = _this.indicateNormal.bind(_assertThisInitialized(_this));\n _this.type = _this.type.bind(_assertThisInitialized(_this));\n _this.guessSequenceType = _this.guessSequenceType.bind(_assertThisInitialized(_this));\n _this.notify = _this.notify.bind(_assertThisInitialized(_this));\n _this.textareaRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n _this.controlsRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n return _this;\n } // LIFECYCLE Methods\n\n\n _createClass(SearchQueryWidget, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n $('body').click(function () {\n $('.notifications .active').hide('drop', {\n direction: 'up'\n }).removeClass('active');\n });\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n this.hideShowButton();\n var type = this.type();\n\n if (!type || type !== this._type) {\n this._type = type;\n this.notify(type);\n this.props.onSequenceTypeChanged(type);\n }\n } // Kind of public API. //\n\n /**\n * Returns query sequence if no argument is provided (or null or undefined\n * is provided as argument). Otherwise, sets query sequenced to the given\n * value and returns `this`.\n *\n * Default/initial state of query sequence is an empty string. Caller must\n * explicitly provide empty string as argument to \"reset\" query sequence.\n */\n\n }, {\n key: \"value\",\n value: function value(val) {\n if (val == null) {\n // i.e., val is null or undefined\n return this.state.value;\n } else {\n this.setState({\n value: val\n });\n return this;\n }\n }\n /**\n * Clears textarea. Returns `this`.\n *\n * Clearing textarea also causes it to be focussed.\n */\n\n }, {\n key: \"clear\",\n value: function clear() {\n return this.value('').focus();\n }\n /**\n * Focuses textarea. Returns `this`.\n */\n\n }, {\n key: \"focus\",\n value: function focus() {\n this.textarea().focus();\n return this;\n }\n /**\n * Returns true if query is absent ('', undefined, null), false otherwise.\n */\n\n }, {\n key: \"isEmpty\",\n value: function isEmpty() {\n return !this.value();\n } // Internal helpers. //\n\n }, {\n key: \"textarea\",\n value: function textarea() {\n return $(this.textareaRef.current);\n }\n }, {\n key: \"controls\",\n value: function controls() {\n return $(this.controlsRef.current);\n }\n }, {\n key: \"handleInput\",\n value: function handleInput(evt) {\n this.value(evt.target.value);\n }\n /**\n * Hides or shows 'clear sequence' button.\n *\n * Rendering the 'clear sequence' button takes into account presence or\n * absence of a scrollbar.\n *\n * Called by `componentDidUpdate`.\n */\n\n }, {\n key: \"hideShowButton\",\n value: function hideShowButton() {\n if (!this.isEmpty()) {\n // Calculation below is based on -\n // http://chris-spittles.co.uk/jquery-calculate-scrollbar-width/\n // FIXME: can reflow be avoided here?\n var textareaNode = this.textarea()[0];\n var sequenceControlsRight = textareaNode.offsetWidth - textareaNode.clientWidth;\n this.controls().css('right', sequenceControlsRight + 17);\n this.controls().removeClass('hidden');\n } else {\n // FIXME: what are lines 1, 2, & 3 doing here?\n this.textarea().parent().removeClass('has-error');\n this.$sequenceFile = $('#sequence-file');\n this.$sequenceFile.empty();\n this.controls().addClass('hidden');\n }\n }\n /**\n * Put red border around textarea.\n */\n\n }, {\n key: \"indicateError\",\n value: function indicateError() {\n this.textarea().parent().addClass('has-error');\n }\n /**\n * Put normal blue border around textarea.\n */\n\n }, {\n key: \"indicateNormal\",\n value: function indicateNormal() {\n this.textarea().parent().removeClass('has-error');\n }\n /**\n * Returns type of the query sequence (nucleotide, protein, mixed).\n *\n * Query widget supports executing a callback when the query type changes.\n * Components interested in query type should register a callback instead\n * of directly calling this method.\n */\n\n }, {\n key: \"type\",\n value: function type() {\n var sequences = this.value().split(/>.*/);\n var type, tmp;\n\n for (var i = 0; i < sequences.length; i++) {\n tmp = this.guessSequenceType(sequences[i]); // could not guess the sequence type; try the next sequence\n\n if (!tmp) {\n continue;\n }\n\n if (!type) {\n // successfully guessed the type of atleast one sequence\n type = tmp;\n } else if (tmp !== type) {\n // user has mixed different type of sequences\n return 'mixed';\n }\n }\n\n return type;\n }\n /**\n * Guesses and returns the type of the given sequence (nucleotide,\n * protein).\n */\n\n }, {\n key: \"guessSequenceType\",\n value: function guessSequenceType(sequence) {\n // remove 'noisy' characters\n sequence = sequence.replace(/[^A-Z]/gi, ''); // non-letter characters\n\n sequence = sequence.replace(/[NX]/gi, ''); // ambiguous characters\n // can't determine the type of ultrashort queries\n\n if (sequence.length < 10) {\n return undefined;\n } // count the number of putative NA\n\n\n var putative_NA_count = 0;\n\n for (var i = 0; i < sequence.length; i++) {\n if (sequence[i].match(/[ACGTU]/i)) {\n putative_NA_count += 1;\n }\n }\n\n var threshold = 0.9 * sequence.length;\n return putative_NA_count > threshold ? 'nucleotide' : 'protein';\n }\n }, {\n key: \"notify\",\n value: function notify(type) {\n clearTimeout(this.notification_timeout);\n this.indicateNormal();\n $('.notifications .active').hide().removeClass('active');\n\n if (type) {\n $('#' + type + '-sequence-notification').show('drop', {\n direction: 'up'\n }).addClass('active');\n this.notification_timeout = setTimeout(function () {\n $('.notifications .active').hide('drop', {\n direction: 'up'\n }).removeClass('active');\n }, 5000);\n\n if (type === 'mixed') {\n this.indicateError();\n }\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"col-md-12\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"div\", {\n className: \"sequence\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"textarea\", {\n id: \"sequence\",\n ref: this.textareaRef,\n className: \"form-control text-monospace\",\n name: \"sequence\",\n value: this.state.value,\n placeholder: \"Paste query sequence(s) or drag file containing query sequence(s) in FASTA format here ...\",\n spellCheck: \"false\",\n autoFocus: true,\n onChange: this.handleInput\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"div\", {\n className: \"hidden\",\n style: {\n position: 'absolute',\n top: '4px',\n right: '19px'\n },\n ref: this.controlsRef,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"button\", {\n type: \"button\",\n className: \"btn btn-sm btn-default\",\n id: \"btn-sequence-clear\",\n title: \"Clear query sequence(s).\",\n onClick: this.clear,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n id: \"sequence-file\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa fa-times\"\n })]\n })\n })]\n });\n }\n }]);\n\n return SearchQueryWidget;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n/**\n * Renders summary of all hits per query in a tabular form.\n */\n\nvar HitsTable = /*#__PURE__*/function (_Component3) {\n _inherits(HitsTable, _Component3);\n\n var _super3 = _createSuper(HitsTable);\n\n function HitsTable(props) {\n _classCallCheck(this, HitsTable);\n\n return _super3.call(this, props);\n }\n\n _createClass(HitsTable, [{\n key: \"render\",\n value: function render() {\n var hasName = underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].every(this.props.query.hits, function (hit) {\n return hit.sciname !== '';\n }); // Width of sequence column is 55% when species name is not shown and\n // query coverage is.\n\n\n var seqwidth = 55; // If we are going to show species name, then reduce the width of\n // sequence column by the width of species column.\n\n if (hasName) seqwidth -= 15; // If we are not going to show query coverage (i.e. for imported XML),\n // then increase the width of sequence column by the width of coverage\n // column.\n\n if (this.props.imported_xml) seqwidth += 15;\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"div\", {\n className: \"table-hit-overview\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"h4\", {\n className: \"caption\",\n \"data-toggle\": \"collapse\",\n \"data-target\": '#Query_' + this.props.query.number + 'HT_' + this.props.query.number,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"i\", {\n className: \"fa fa-minus-square-o\"\n }), \"\\xA0\", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"span\", {\n children: \"Sequences producing significant alignments\"\n })]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"div\", {\n className: \"collapsed in\",\n id: 'Query_' + this.props.query.number + 'HT_' + this.props.query.number,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"table\", {\n className: \"table table-hover table-condensed tabular-view \",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"thead\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"tr\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n className: \"text-left\",\n children: \"#\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"\".concat(seqwidth, \"%\"),\n children: \"Similar sequences\"\n }), hasName && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"15%\",\n className: \"text-left\",\n children: \"Species\"\n }), !this.props.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"15%\",\n className: \"text-right\",\n children: \"Query coverage (%)\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"10%\",\n className: \"text-right\",\n children: \"Total score\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"10%\",\n className: \"text-right\",\n children: \"E value\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"th\", {\n width: \"10%\",\n className: \"text-right\",\n children: \"Identity (%)\"\n })]\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"tbody\", {\n children: underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.query.hits, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function (hit) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"tr\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-left\",\n children: hit.number + '.'\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"nowrap-ellipsis\",\n title: \"\".concat(hit.id, \" \").concat(hit.title),\n \"data-toggle\": \"tooltip\",\n \"data-placement\": \"left\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(\"a\", {\n href: '#Query_' + this.props.query.number + '_hit_' + hit.number,\n className: \"btn-link\",\n children: [hit.id, \" \", hit.title]\n })\n }), hasName && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"nowrap-ellipsis\",\n title: hit.sciname,\n \"data-toggle\": \"tooltip\",\n \"data-placement\": \"top\",\n children: hit.sciname\n }), !this.props.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-right\",\n children: hit.qcovs\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-right\",\n children: hit.total_score\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-right\",\n children: _utils__WEBPACK_IMPORTED_MODULE_4__[\"default\"].inExponential(hit.hsps[0].evalue)\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(\"td\", {\n className: \"text-right\",\n children: _utils__WEBPACK_IMPORTED_MODULE_4__[\"default\"].inPercentage(hit.hsps[0].identity, hit.hsps[0].length)\n })]\n }, hit.number);\n }, this))\n })]\n })\n })]\n });\n }\n }]);\n\n return HitsTable;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n//# sourceURL=webpack://SequenceServer/./public/js/query.js?"); /***/ }), @@ -159,7 +159,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _jquery_world__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jquery_world */ \"./public/js/jquery_world.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 react_dom_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom/client */ \"./node_modules/react-dom/client.js\");\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var _sidebar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sidebar */ \"./public/js/sidebar.js\");\n/* harmony import */ var _circos__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./circos */ \"./public/js/circos.js\");\n/* harmony import */ var _query__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./query */ \"./public/js/query.js\");\n/* harmony import */ var _hit__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./hit */ \"./public/js/hit.js\");\n/* harmony import */ var _hsp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./hsp */ \"./public/js/hsp.js\");\n/* harmony import */ var _sequence_modal__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./sequence_modal */ \"./public/js/sequence_modal.js\");\n/* harmony import */ var _error_modal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./error_modal */ \"./public/js/error_modal.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __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); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n // for custom $.tooltip function\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Base component of report page. This component is later rendered into page's\n * '#view' element.\n */\n\n\n\n\nvar Page = /*#__PURE__*/function (_Component) {\n _inherits(Page, _Component);\n\n var _super = _createSuper(Page);\n\n function Page(props) {\n var _this;\n\n _classCallCheck(this, Page);\n\n _this = _super.call(this, props);\n _this.showSequenceModal = _this.showSequenceModal.bind(_assertThisInitialized(_this));\n _this.showErrorModal = _this.showErrorModal.bind(_assertThisInitialized(_this));\n _this.getCharacterWidth = _this.getCharacterWidth.bind(_assertThisInitialized(_this));\n _this.hspChars = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createRef)();\n return _this;\n }\n\n _createClass(Page, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var job_id = location.pathname.split('/').pop();\n sessionStorage.setItem('job_id', job_id);\n }\n }, {\n key: \"showSequenceModal\",\n value: function showSequenceModal(url) {\n this.refs.sequenceModal.show(url);\n }\n }, {\n key: \"showErrorModal\",\n value: function showErrorModal(errorData, beforeShow) {\n this.refs.errorModal.show(errorData, beforeShow);\n }\n }, {\n key: \"getCharacterWidth\",\n value: function getCharacterWidth() {\n if (!this.characterWidth) {\n var $hspChars = $(this.hspChars.current);\n this.characterWidth = $hspChars.width() / 29;\n }\n\n return this.characterWidth;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"div\", {\n className: \"container\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(Report, {\n showSequenceModal: function showSequenceModal(_) {\n return _this2.showSequenceModal(_);\n },\n getCharacterWidth: function getCharacterWidth() {\n return _this2.getCharacterWidth();\n },\n showErrorModal: function showErrorModal() {\n return _this2.showErrorModal.apply(_this2, arguments);\n }\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"pre\", {\n className: \"pre-reset hsp-lines\",\n ref: this.hspChars,\n hidden: true,\n children: \"ABCDEFGHIJKLMNOPQRSTUVWXYZ +-\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"canvas\", {\n id: \"png-exporter\",\n hidden: true\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_sequence_modal__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n ref: \"sequenceModal\",\n showErrorModal: function showErrorModal() {\n return _this2.showErrorModal.apply(_this2, arguments);\n }\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_error_modal__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n ref: \"errorModal\"\n })]\n });\n }\n }]);\n\n return Page;\n}(react__WEBPACK_IMPORTED_MODULE_1__.Component);\n/**\n * Renders entire report.\n *\n * Composed of Query and Sidebar components.\n */\n\n\nvar Report = /*#__PURE__*/function (_Component2) {\n _inherits(Report, _Component2);\n\n var _super2 = _createSuper(Report);\n\n function Report(props) {\n var _this3;\n\n _classCallCheck(this, Report);\n\n _this3 = _super2.call(this, props);\n\n _this3.fetchResults(); // Properties below are internal state used to render results in small\n // slices (see updateState).\n\n\n _this3.numUpdates = 0;\n _this3.nextQuery = 0;\n _this3.nextHit = 0;\n _this3.nextHSP = 0;\n _this3.maxHSPs = 3; // max HSPs to render in a cycle\n\n _this3.state = {\n search_id: '',\n seqserv_version: '',\n program: '',\n program_version: '',\n submitted_at: '',\n queries: [],\n results: [],\n querydb: [],\n params: [],\n stats: []\n };\n return _this3;\n }\n /**\n * Fetch results.\n */\n\n\n _createClass(Report, [{\n key: \"fetchResults\",\n value: function fetchResults() {\n var intervals = [200, 400, 800, 1200, 2000, 3000, 5000];\n var component = this;\n\n function poll() {\n $.getJSON(location.pathname + '.json').complete(function (jqXHR) {\n switch (jqXHR.status) {\n case 202:\n var interval;\n\n if (intervals.length === 1) {\n interval = intervals[0];\n } else {\n interval = intervals.shift();\n }\n\n setTimeout(poll, interval);\n break;\n\n case 200:\n component.setStateFromJSON(jqXHR.responseJSON);\n break;\n\n case 404:\n case 400:\n case 500:\n component.props.showErrorModal(jqXHR.responseJSON);\n break;\n }\n });\n }\n\n poll();\n }\n /**\n * Calls setState after any required modification to responseJSON.\n */\n\n }, {\n key: \"setStateFromJSON\",\n value: function setStateFromJSON(responseJSON) {\n this.lastTimeStamp = Date.now();\n this.setState(responseJSON);\n }\n /**\n * Called as soon as the page has loaded and the user sees the loading spinner.\n * We use this opportunity to setup services that make use of delegated events\n * bound to the window, document, or body.\n */\n\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n // This sets up an event handler which enables users to select text from\n // hit header without collapsing the hit.\n this.preventCollapseOnSelection();\n this.toggleTable();\n }\n /**\n * Called for the first time after as BLAST results have been retrieved from\n * the server and added to this.state by fetchResults. Only summary overview\n * and circos would have been rendered at this point. At this stage we kick\n * start iteratively adding 1 HSP to the page every 25 milli-seconds.\n */\n\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n var _this4 = this;\n\n // Log to console how long the last update take?\n console.log((Date.now() - this.lastTimeStamp) / 1000); // Lock sidebar in its position on the first update.\n\n if (this.nextQuery == 0 && this.nextHit == 0 && this.nextHSP == 0) {\n this.affixSidebar();\n } // Queue next update if we have not rendered all results yet.\n\n\n if (this.nextQuery < this.state.queries.length) {\n // setTimeout is used to clear call stack and space out\n // the updates giving the browser a chance to respond\n // to user interactions.\n setTimeout(function () {\n return _this4.updateState();\n }, 25);\n } else {\n this.componentFinishedUpdating();\n }\n }\n /**\n * Push next slice of results to React for rendering.\n */\n\n }, {\n key: \"updateState\",\n value: function updateState() {\n var results = [];\n var numHSPsProcessed = 0;\n\n while (this.nextQuery < this.state.queries.length) {\n var query = this.state.queries[this.nextQuery]; // We may see a query multiple times during rendering because only\n // 3 hsps or are rendered in each cycle, but we want to create the\n // corresponding Query component only the first time we see it.\n\n if (this.nextHit == 0 && this.nextHSP == 0) {\n results.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_query__WEBPACK_IMPORTED_MODULE_6__.ReportQuery, {\n query: query,\n program: this.state.program,\n querydb: this.state.querydb,\n showQueryCrumbs: this.state.queries.length > 1,\n non_parse_seqids: this.state.non_parse_seqids,\n imported_xml: this.state.imported_xml,\n veryBig: this.state.veryBig\n }, 'Query_' + query.number));\n }\n\n while (this.nextHit < query.hits.length) {\n var hit = query.hits[this.nextHit]; // We may see a hit multiple times during rendering because only\n // 10 hsps are rendered in each cycle, but we want to create the\n // corresponding Hit component only the first time we see it.\n\n if (this.nextHSP == 0) {\n results.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_hit__WEBPACK_IMPORTED_MODULE_7__[\"default\"], _objectSpread({\n query: query,\n hit: hit,\n algorithm: this.state.program,\n querydb: this.state.querydb,\n selectHit: this.selectHit,\n imported_xml: this.state.imported_xml,\n non_parse_seqids: this.state.non_parse_seqids,\n showQueryCrumbs: this.state.queries.length > 1,\n showHitCrumbs: query.hits.length > 1,\n veryBig: this.state.veryBig\n }, this.props), 'Query_' + query.number + '_Hit_' + hit.number));\n }\n\n while (this.nextHSP < hit.hsps.length) {\n // Get nextHSP and increment the counter.\n var hsp = hit.hsps[this.nextHSP++];\n results.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_hsp__WEBPACK_IMPORTED_MODULE_8__[\"default\"], _objectSpread({\n query: query,\n hit: hit,\n hsp: hsp,\n algorithm: this.state.program,\n showHSPNumbers: hit.hsps.length > 1\n }, this.props), 'Query_' + query.number + '_Hit_' + hit.number + '_HSP_' + hsp.number));\n numHSPsProcessed++;\n if (numHSPsProcessed == this.maxHSPs) break;\n } // Are we here because we have iterated over all hsps of a hit,\n // or because of the break clause in the inner loop?\n\n\n if (this.nextHSP == hit.hsps.length) {\n this.nextHit = this.nextHit + 1;\n this.nextHSP = 0;\n }\n\n if (numHSPsProcessed == this.maxHSPs) break;\n } // Are we here because we have iterated over all hits of a query,\n // or because of the break clause in the inner loop?\n\n\n if (this.nextHit == query.hits.length) {\n this.nextQuery = this.nextQuery + 1;\n this.nextHit = 0;\n }\n\n if (numHSPsProcessed == this.maxHSPs) break;\n } // Push the components to react for rendering.\n\n\n this.numUpdates++;\n this.lastTimeStamp = Date.now();\n this.setState({\n results: this.state.results.concat(results),\n veryBig: this.numUpdates >= 250\n });\n }\n /**\n * Called after all results have been rendered.\n */\n\n }, {\n key: \"componentFinishedUpdating\",\n value: function componentFinishedUpdating() {\n this.shouldShowIndex() && this.setupScrollSpy();\n }\n /**\n * Returns loading message\n */\n\n }, {\n key: \"loadingJSX\",\n value: function loadingJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"div\", {\n className: \"row\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n className: \"col-md-6 col-md-offset-3 text-center\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"h1\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"i\", {\n className: \"fa fa-cog fa-spin\"\n }), \"\\xA0 BLAST-ing\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"br\", {}), \"This can take some time depending on the size of your query and database(s). The page will update automatically when BLAST is done.\", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"br\", {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"br\", {}), \"You can bookmark the page and come back to it later or share the link with someone.\"]\n })]\n })\n });\n }\n /**\n * Return results JSX.\n */\n\n }, {\n key: \"resultsJSX\",\n value: function resultsJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n className: \"row\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"div\", {\n className: \"col-md-3 hidden-sm hidden-xs\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_sidebar__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n data: this.state,\n atLeastOneHit: this.atLeastOneHit(),\n shouldShowIndex: this.shouldShowIndex()\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n className: \"col-md-9\",\n children: [this.overviewJSX(), this.circosJSX(), this.state.results]\n })]\n });\n }\n /**\n * Renders report overview.\n */\n\n }, {\n key: \"overviewJSX\",\n value: function overviewJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n className: \"overview\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"strong\", {\n children: [\"SequenceServer \", this.state.seqserv_version]\n }), \" using\", ' ', /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"strong\", {\n children: this.state.program_version\n }), this.state.submitted_at && \", query submitted on \".concat(this.state.submitted_at)]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"strong\", {\n children: \" Databases: \"\n }), this.state.querydb.map(function (db) {\n return db.title;\n }).join(', '), ' ', \"(\", this.state.stats.nsequences, \" sequences,\\xA0\", this.state.stats.ncharacters, \" characters)\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"strong\", {\n children: \"Parameters: \"\n }), ' ', underscore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].map(this.state.params, function (val, key) {\n return key + ' ' + val;\n }).join(', ')]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [\"Please cite:\", ' ', /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"a\", {\n href: \"https://doi.org/10.1093/molbev/msz185\",\n children: \"https://doi.org/10.1093/molbev/msz185\"\n })]\n })]\n });\n }\n /**\n * Return JSX for circos if we have at least one hit.\n */\n\n }, {\n key: \"circosJSX\",\n value: function circosJSX() {\n return this.atLeastTwoHits() ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_circos__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n queries: this.state.queries,\n program: this.state.program,\n collapsed: \"true\"\n }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"span\", {});\n } // Controller //\n\n /**\n * Returns true if results have been fetched.\n *\n * A holding message is shown till results are fetched.\n */\n\n }, {\n key: \"isResultAvailable\",\n value: function isResultAvailable() {\n return this.state.queries.length >= 1;\n }\n /**\n * Returns true if we have at least one hit.\n */\n\n }, {\n key: \"atLeastOneHit\",\n value: function atLeastOneHit() {\n return this.state.queries.some(function (query) {\n return query.hits.length > 0;\n });\n }\n /**\n * Does the report have at least two hits? This is used to determine\n * whether Circos should be enabled or not.\n */\n\n }, {\n key: \"atLeastTwoHits\",\n value: function atLeastTwoHits() {\n var hit_num = 0;\n return this.state.queries.some(function (query) {\n hit_num += query.hits.length;\n return hit_num > 1;\n });\n }\n /**\n * Returns true if index should be shown in the sidebar. Index is shown\n * only for 2 and 8 queries.\n */\n\n }, {\n key: \"shouldShowIndex\",\n value: function shouldShowIndex() {\n var num_queries = this.state.queries.length;\n return num_queries >= 2 && num_queries <= 12;\n }\n /**\n * Prevents folding of hits during text-selection.\n */\n\n }, {\n key: \"preventCollapseOnSelection\",\n value: function preventCollapseOnSelection() {\n $('body').on('mousedown', '.hit > .section-header > h4', function (event) {\n var $this = $(this);\n $this.on('mouseup mousemove', function handler(event) {\n if (event.type === 'mouseup') {\n // user wants to toggle\n var hitID = $this.parents('.hit').attr('id');\n $(\"div[data-parent-hit=\".concat(hitID, \"]\")).toggle();\n $this.find('i').toggleClass('fa-minus-square-o fa-plus-square-o');\n } else {\n // user wants to select\n $this.attr('data-toggle', '');\n }\n\n $this.off('mouseup mousemove', handler);\n });\n });\n }\n /* Handling the fa icon when Hit Table is collapsed */\n\n }, {\n key: \"toggleTable\",\n value: function toggleTable() {\n $('body').on('mousedown', '.resultn > .section-content > .table-hit-overview > .caption', function (event) {\n var $this = $(this);\n $this.on('mouseup mousemove', function handler(event) {\n $this.find('i').toggleClass('fa-minus-square-o fa-plus-square-o');\n $this.off('mouseup mousemove', handler);\n });\n });\n }\n /**\n * Affixes the sidebar.\n */\n\n }, {\n key: \"affixSidebar\",\n value: function affixSidebar() {\n var $sidebar = $('.sidebar');\n var sidebarOffset = $sidebar.offset();\n\n if (sidebarOffset) {\n $sidebar.affix({\n offset: {\n top: sidebarOffset.top\n }\n });\n }\n }\n /**\n * For the query in viewport, highlights corresponding entry in the index.\n */\n\n }, {\n key: \"setupScrollSpy\",\n value: function setupScrollSpy() {\n $('body').scrollspy({\n target: '.sidebar'\n });\n }\n /**\n * Event-handler when hit is selected\n * Adds glow to hit component.\n * Updates number of Fasta that can be downloaded\n */\n\n }, {\n key: \"selectHit\",\n value: function selectHit(id) {\n var checkbox = $('#' + id);\n var num_checked = $('.hit-links :checkbox:checked').length;\n\n if (!checkbox || !checkbox.val()) {\n return;\n }\n\n var $hit = $(checkbox.data('target')); // Highlight selected hit and enable 'Download FASTA/Alignment of\n // selected' links.\n\n if (checkbox.is(':checked')) {\n $hit.addClass('glow');\n $hit.next('.hsp').addClass('glow');\n $('.download-fasta-of-selected').enable();\n $('.download-alignment-of-selected').enable();\n } else {\n $hit.removeClass('glow');\n $hit.next('.hsp').removeClass('glow');\n }\n\n var $a = $('.download-fasta-of-selected');\n var $b = $('.download-alignment-of-selected');\n\n if (num_checked >= 1) {\n $a.find('.text-bold').html(num_checked);\n $b.find('.text-bold').html(num_checked);\n }\n\n if (num_checked == 0) {\n $a.addClass('disabled').find('.text-bold').html('');\n $b.addClass('disabled').find('.text-bold').html('');\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return this.isResultAvailable() ? this.resultsJSX() : this.loadingJSX();\n }\n }]);\n\n return Report;\n}(react__WEBPACK_IMPORTED_MODULE_1__.Component);\n\nvar root = (0,react_dom_client__WEBPACK_IMPORTED_MODULE_2__.createRoot)(document.getElementById('view'));\nroot.render( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(Page, {}));\n\n//# sourceURL=webpack://SequenceServer/./public/js/report.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _jquery_world__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jquery_world */ \"./public/js/jquery_world.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 react_dom_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom/client */ \"./node_modules/react-dom/client.js\");\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var _sidebar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sidebar */ \"./public/js/sidebar.js\");\n/* harmony import */ var _circos__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./circos */ \"./public/js/circos.js\");\n/* harmony import */ var _query__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./query */ \"./public/js/query.js\");\n/* harmony import */ var _hit__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./hit */ \"./public/js/hit.js\");\n/* harmony import */ var _hsp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./hsp */ \"./public/js/hsp.js\");\n/* harmony import */ var _sequence_modal__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./sequence_modal */ \"./public/js/sequence_modal.js\");\n/* harmony import */ var _error_modal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./error_modal */ \"./public/js/error_modal.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __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); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n // for custom $.tooltip function\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Base component of report page. This component is later rendered into page's\n * '#view' element.\n */\n\n\n\n\nvar Page = /*#__PURE__*/function (_Component) {\n _inherits(Page, _Component);\n\n var _super = _createSuper(Page);\n\n function Page(props) {\n var _this;\n\n _classCallCheck(this, Page);\n\n _this = _super.call(this, props);\n _this.showSequenceModal = _this.showSequenceModal.bind(_assertThisInitialized(_this));\n _this.showErrorModal = _this.showErrorModal.bind(_assertThisInitialized(_this));\n _this.getCharacterWidth = _this.getCharacterWidth.bind(_assertThisInitialized(_this));\n _this.hspChars = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createRef)();\n return _this;\n }\n\n _createClass(Page, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var job_id = location.pathname.split('/').pop();\n sessionStorage.setItem('job_id', job_id);\n }\n }, {\n key: \"showSequenceModal\",\n value: function showSequenceModal(url) {\n this.refs.sequenceModal.show(url);\n }\n }, {\n key: \"showErrorModal\",\n value: function showErrorModal(errorData, beforeShow) {\n this.refs.errorModal.show(errorData, beforeShow);\n }\n }, {\n key: \"getCharacterWidth\",\n value: function getCharacterWidth() {\n if (!this.characterWidth) {\n var $hspChars = $(this.hspChars.current);\n this.characterWidth = $hspChars.width() / 29;\n }\n\n return this.characterWidth;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"div\", {\n className: \"container\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(Report, {\n showSequenceModal: function showSequenceModal(_) {\n return _this2.showSequenceModal(_);\n },\n getCharacterWidth: function getCharacterWidth() {\n return _this2.getCharacterWidth();\n },\n showErrorModal: function showErrorModal() {\n return _this2.showErrorModal.apply(_this2, arguments);\n }\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"pre\", {\n className: \"pre-reset hsp-lines\",\n ref: this.hspChars,\n hidden: true,\n children: \"ABCDEFGHIJKLMNOPQRSTUVWXYZ +-\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"canvas\", {\n id: \"png-exporter\",\n hidden: true\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_sequence_modal__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n ref: \"sequenceModal\",\n showErrorModal: function showErrorModal() {\n return _this2.showErrorModal.apply(_this2, arguments);\n }\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_error_modal__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n ref: \"errorModal\"\n })]\n });\n }\n }]);\n\n return Page;\n}(react__WEBPACK_IMPORTED_MODULE_1__.Component);\n/**\n * Renders entire report.\n *\n * Composed of Query and Sidebar components.\n */\n\n\nvar Report = /*#__PURE__*/function (_Component2) {\n _inherits(Report, _Component2);\n\n var _super2 = _createSuper(Report);\n\n function Report(props) {\n var _this3;\n\n _classCallCheck(this, Report);\n\n _this3 = _super2.call(this, props);\n\n _this3.fetchResults();\n\n _this3.getDatabaseListString = _this3.getDatabaseListString.bind(_assertThisInitialized(_this3));\n _this3.toggleShowDatabases = _this3.toggleShowDatabases.bind(_assertThisInitialized(_this3));\n _this3.renderToggleDatabasesList = _this3.renderToggleDatabasesList.bind(_assertThisInitialized(_this3));\n _this3.maxDatabasesStringLength = 200; // Properties below are internal state used to render results in small\n // slices (see updateState).\n\n _this3.numUpdates = 0;\n _this3.nextQuery = 0;\n _this3.nextHit = 0;\n _this3.nextHSP = 0;\n _this3.maxHSPs = 3; // max HSPs to render in a cycle\n\n _this3.state = {\n search_id: '',\n seqserv_version: '',\n program: '',\n program_version: '',\n submitted_at: '',\n queries: [],\n results: [],\n querydb: [],\n params: [],\n stats: [],\n databasesList: '',\n showMore: false\n };\n return _this3;\n }\n /**\n * Fetch results.\n */\n\n\n _createClass(Report, [{\n key: \"fetchResults\",\n value: function fetchResults() {\n var intervals = [200, 400, 800, 1200, 2000, 3000, 5000];\n var component = this;\n\n function poll() {\n $.getJSON(location.pathname + '.json').complete(function (jqXHR) {\n switch (jqXHR.status) {\n case 202:\n var interval;\n\n if (intervals.length === 1) {\n interval = intervals[0];\n } else {\n interval = intervals.shift();\n }\n\n setTimeout(poll, interval);\n break;\n\n case 200:\n component.setStateFromJSON(jqXHR.responseJSON);\n break;\n\n case 404:\n case 400:\n case 500:\n component.props.showErrorModal(jqXHR.responseJSON);\n break;\n }\n });\n }\n\n poll();\n }\n /**\n * Calls setState after any required modification to responseJSON.\n */\n\n }, {\n key: \"setStateFromJSON\",\n value: function setStateFromJSON(responseJSON) {\n this.lastTimeStamp = Date.now();\n this.setState(responseJSON);\n }\n /**\n * Called as soon as the page has loaded and the user sees the loading spinner.\n * We use this opportunity to setup services that make use of delegated events\n * bound to the window, document, or body.\n */\n\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n // This sets up an event handler which enables users to select text from\n // hit header without collapsing the hit.\n this.preventCollapseOnSelection();\n this.toggleTable();\n }\n /**\n * Called for the first time after as BLAST results have been retrieved from\n * the server and added to this.state by fetchResults. Only summary overview\n * and circos would have been rendered at this point. At this stage we kick\n * start iteratively adding 1 HSP to the page every 25 milli-seconds.\n */\n\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(props, state) {\n var _this4 = this;\n\n if (this.getDatabaseListString() !== this.getDatabaseListString(state.querydb)) {\n this.setState({\n databasesList: this.getDatabaseListString().substring(0, this.maxDatabasesStringLength) + '...'\n });\n } // Log to console how long the last update take?\n\n\n console.log((Date.now() - this.lastTimeStamp) / 1000); // Lock sidebar in its position on the first update.\n\n if (this.nextQuery == 0 && this.nextHit == 0 && this.nextHSP == 0) {\n this.affixSidebar();\n } // Queue next update if we have not rendered all results yet.\n\n\n if (this.nextQuery < this.state.queries.length) {\n // setTimeout is used to clear call stack and space out\n // the updates giving the browser a chance to respond\n // to user interactions.\n setTimeout(function () {\n return _this4.updateState();\n }, 25);\n } else {\n this.componentFinishedUpdating();\n }\n }\n /**\n * Push next slice of results to React for rendering.\n */\n\n }, {\n key: \"updateState\",\n value: function updateState() {\n var results = [];\n var numHSPsProcessed = 0;\n\n while (this.nextQuery < this.state.queries.length) {\n var query = this.state.queries[this.nextQuery]; // We may see a query multiple times during rendering because only\n // 3 hsps or are rendered in each cycle, but we want to create the\n // corresponding Query component only the first time we see it.\n\n if (this.nextHit == 0 && this.nextHSP == 0) {\n results.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_query__WEBPACK_IMPORTED_MODULE_6__.ReportQuery, {\n query: query,\n program: this.state.program,\n querydb: this.state.querydb,\n showQueryCrumbs: this.state.queries.length > 1,\n non_parse_seqids: this.state.non_parse_seqids,\n imported_xml: this.state.imported_xml,\n veryBig: this.state.veryBig\n }, 'Query_' + query.number));\n }\n\n while (this.nextHit < query.hits.length) {\n var hit = query.hits[this.nextHit]; // We may see a hit multiple times during rendering because only\n // 10 hsps are rendered in each cycle, but we want to create the\n // corresponding Hit component only the first time we see it.\n\n if (this.nextHSP == 0) {\n results.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_hit__WEBPACK_IMPORTED_MODULE_7__[\"default\"], _objectSpread({\n query: query,\n hit: hit,\n algorithm: this.state.program,\n querydb: this.state.querydb,\n selectHit: this.selectHit,\n imported_xml: this.state.imported_xml,\n non_parse_seqids: this.state.non_parse_seqids,\n showQueryCrumbs: this.state.queries.length > 1,\n showHitCrumbs: query.hits.length > 1,\n veryBig: this.state.veryBig\n }, this.props), 'Query_' + query.number + '_Hit_' + hit.number));\n }\n\n while (this.nextHSP < hit.hsps.length) {\n // Get nextHSP and increment the counter.\n var hsp = hit.hsps[this.nextHSP++];\n results.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_hsp__WEBPACK_IMPORTED_MODULE_8__[\"default\"], _objectSpread({\n query: query,\n hit: hit,\n hsp: hsp,\n algorithm: this.state.program,\n showHSPNumbers: hit.hsps.length > 1\n }, this.props), 'Query_' + query.number + '_Hit_' + hit.number + '_HSP_' + hsp.number));\n numHSPsProcessed++;\n if (numHSPsProcessed == this.maxHSPs) break;\n } // Are we here because we have iterated over all hsps of a hit,\n // or because of the break clause in the inner loop?\n\n\n if (this.nextHSP == hit.hsps.length) {\n this.nextHit = this.nextHit + 1;\n this.nextHSP = 0;\n }\n\n if (numHSPsProcessed == this.maxHSPs) break;\n } // Are we here because we have iterated over all hits of a query,\n // or because of the break clause in the inner loop?\n\n\n if (this.nextHit == query.hits.length) {\n this.nextQuery = this.nextQuery + 1;\n this.nextHit = 0;\n }\n\n if (numHSPsProcessed == this.maxHSPs) break;\n } // Push the components to react for rendering.\n\n\n this.numUpdates++;\n this.lastTimeStamp = Date.now();\n this.setState({\n results: this.state.results.concat(results),\n veryBig: this.numUpdates >= 250\n });\n }\n /**\n * Called after all results have been rendered.\n */\n\n }, {\n key: \"componentFinishedUpdating\",\n value: function componentFinishedUpdating() {\n this.shouldShowIndex() && this.setupScrollSpy();\n }\n /**\n * Returns loading message\n */\n\n }, {\n key: \"loadingJSX\",\n value: function loadingJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"div\", {\n className: \"row\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n className: \"col-md-6 col-md-offset-3 text-center\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"h1\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"i\", {\n className: \"fa fa-cog fa-spin\"\n }), \"\\xA0 BLAST-ing\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"br\", {}), \"This can take some time depending on the size of your query and database(s). The page will update automatically when BLAST is done.\", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"br\", {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"br\", {}), \"You can bookmark the page and come back to it later or share the link with someone.\"]\n })]\n })\n });\n }\n /**\n * Return results JSX.\n */\n\n }, {\n key: \"resultsJSX\",\n value: function resultsJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n className: \"row\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"div\", {\n className: \"col-md-3 hidden-sm hidden-xs\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_sidebar__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n data: this.state,\n atLeastOneHit: this.atLeastOneHit(),\n shouldShowIndex: this.shouldShowIndex()\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n className: \"col-md-9\",\n children: [this.overviewJSX(), this.circosJSX(), this.state.results]\n })]\n });\n }\n }, {\n key: \"getDatabaseListString\",\n value: function getDatabaseListString() {\n var querydb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.state.querydb;\n return querydb.map(function (db) {\n return db.title;\n }).join(', ');\n }\n }, {\n key: \"toggleShowDatabases\",\n value: function toggleShowDatabases() {\n var databases = this.state.showMore ? \"\".concat(this.getDatabaseListString().substring(0, this.maxDatabasesStringLength), \"...\") : \"\".concat(this.getDatabaseListString());\n this.setState({\n databasesList: databases,\n showMore: !this.state.showMore\n });\n }\n }, {\n key: \"renderToggleDatabasesList\",\n value: function renderToggleDatabasesList() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"span\", {\n onClick: this.toggleShowDatabases,\n children: [this.state.databasesList, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"span\", {\n style: {\n cursor: 'pointer'\n },\n className: \"btn-link hover-bold\",\n children: [\"\\xA0\\xA0\", this.state.showMore ? 'Show Less' : 'Show More']\n })]\n });\n }\n /**\n * Renders report overview.\n */\n\n }, {\n key: \"overviewJSX\",\n value: function overviewJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"div\", {\n className: \"overview\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"strong\", {\n children: [\"SequenceServer \", this.state.seqserv_version]\n }), \" using\", ' ', /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"strong\", {\n children: this.state.program_version\n }), this.state.submitted_at && \", query submitted on \".concat(this.state.submitted_at)]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"strong\", {\n children: \" Databases: \"\n }), this.getDatabaseListString().length <= this.maxDatabasesStringLength ? this.getDatabaseListString() : this.renderToggleDatabasesList(), ' ', \"(\", this.state.stats.nsequences, \" sequences,\\xA0\", this.state.stats.ncharacters, \" characters)\"]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"strong\", {\n children: \"Parameters: \"\n }), ' ', underscore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].map(this.state.params, function (val, key) {\n return key + ' ' + val;\n }).join(', ')]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(\"p\", {\n children: [\"Please cite:\", ' ', /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"a\", {\n href: \"https://doi.org/10.1093/molbev/msz185\",\n children: \"https://doi.org/10.1093/molbev/msz185\"\n })]\n })]\n });\n }\n /**\n * Return JSX for circos if we have at least one hit.\n */\n\n }, {\n key: \"circosJSX\",\n value: function circosJSX() {\n return this.atLeastTwoHits() ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_circos__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n queries: this.state.queries,\n program: this.state.program,\n collapsed: \"true\"\n }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(\"span\", {});\n } // Controller //\n\n /**\n * Returns true if results have been fetched.\n *\n * A holding message is shown till results are fetched.\n */\n\n }, {\n key: \"isResultAvailable\",\n value: function isResultAvailable() {\n return this.state.queries.length >= 1;\n }\n /**\n * Returns true if we have at least one hit.\n */\n\n }, {\n key: \"atLeastOneHit\",\n value: function atLeastOneHit() {\n return this.state.queries.some(function (query) {\n return query.hits.length > 0;\n });\n }\n /**\n * Does the report have at least two hits? This is used to determine\n * whether Circos should be enabled or not.\n */\n\n }, {\n key: \"atLeastTwoHits\",\n value: function atLeastTwoHits() {\n var hit_num = 0;\n return this.state.queries.some(function (query) {\n hit_num += query.hits.length;\n return hit_num > 1;\n });\n }\n /**\n * Returns true if index should be shown in the sidebar. Index is shown\n * only for 2 and 8 queries.\n */\n\n }, {\n key: \"shouldShowIndex\",\n value: function shouldShowIndex() {\n var num_queries = this.state.queries.length;\n return num_queries >= 2 && num_queries <= 12;\n }\n /**\n * Prevents folding of hits during text-selection.\n */\n\n }, {\n key: \"preventCollapseOnSelection\",\n value: function preventCollapseOnSelection() {\n $('body').on('mousedown', '.hit > .section-header > h4', function (event) {\n var $this = $(this);\n $this.on('mouseup mousemove', function handler(event) {\n if (event.type === 'mouseup') {\n // user wants to toggle\n var hitID = $this.parents('.hit').attr('id');\n $(\"div[data-parent-hit=\".concat(hitID, \"]\")).toggle();\n $this.find('i').toggleClass('fa-minus-square-o fa-plus-square-o');\n } else {\n // user wants to select\n $this.attr('data-toggle', '');\n }\n\n $this.off('mouseup mousemove', handler);\n });\n });\n }\n /* Handling the fa icon when Hit Table is collapsed */\n\n }, {\n key: \"toggleTable\",\n value: function toggleTable() {\n $('body').on('mousedown', '.resultn > .section-content > .table-hit-overview > .caption', function (event) {\n var $this = $(this);\n $this.on('mouseup mousemove', function handler(event) {\n $this.find('i').toggleClass('fa-minus-square-o fa-plus-square-o');\n $this.off('mouseup mousemove', handler);\n });\n });\n }\n /**\n * Affixes the sidebar.\n */\n\n }, {\n key: \"affixSidebar\",\n value: function affixSidebar() {\n var $sidebar = $('.sidebar');\n var sidebarOffset = $sidebar.offset();\n\n if (sidebarOffset) {\n $sidebar.affix({\n offset: {\n top: sidebarOffset.top\n }\n });\n }\n }\n /**\n * For the query in viewport, highlights corresponding entry in the index.\n */\n\n }, {\n key: \"setupScrollSpy\",\n value: function setupScrollSpy() {\n $('body').scrollspy({\n target: '.sidebar'\n });\n }\n /**\n * Event-handler when hit is selected\n * Adds glow to hit component.\n * Updates number of Fasta that can be downloaded\n */\n\n }, {\n key: \"selectHit\",\n value: function selectHit(id) {\n var checkbox = $('#' + id);\n var num_checked = $('.hit-links :checkbox:checked').length;\n\n if (!checkbox || !checkbox.val()) {\n return;\n }\n\n var $hit = $(checkbox.data('target')); // Highlight selected hit and enable 'Download FASTA/Alignment of\n // selected' links.\n\n if (checkbox.is(':checked')) {\n $hit.addClass('glow');\n $hit.next('.hsp').addClass('glow');\n $('.download-fasta-of-selected').enable();\n $('.download-alignment-of-selected').enable();\n } else {\n $hit.removeClass('glow');\n $hit.next('.hsp').removeClass('glow');\n }\n\n var $a = $('.download-fasta-of-selected');\n var $b = $('.download-alignment-of-selected');\n\n if (num_checked >= 1) {\n $a.find('.text-bold').html(num_checked);\n $b.find('.text-bold').html(num_checked);\n }\n\n if (num_checked == 0) {\n $a.addClass('disabled').find('.text-bold').html('');\n $b.addClass('disabled').find('.text-bold').html('');\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return this.isResultAvailable() ? this.resultsJSX() : this.loadingJSX();\n }\n }]);\n\n return Report;\n}(react__WEBPACK_IMPORTED_MODULE_1__.Component);\n\nvar root = (0,react_dom_client__WEBPACK_IMPORTED_MODULE_2__.createRoot)(document.getElementById('view'));\nroot.render( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(Page, {}));\n\n//# sourceURL=webpack://SequenceServer/./public/js/report.js?"); /***/ }), @@ -181,7 +181,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var jque /***/ ((__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 */ SequenceModal)\n/* harmony export */ });\n/* harmony import */ var _sequence__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sequence */ \"./public/js/sequence.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 underscore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n/**\n * Takes sequence accession as props, fetches the sequence from the server, and\n * displays it in a modal.\n */\n\n\n\n\nvar SequenceModal = /*#__PURE__*/function (_React$Component) {\n _inherits(SequenceModal, _React$Component);\n\n var _super = _createSuper(SequenceModal);\n\n function SequenceModal(props) {\n var _this;\n\n _classCallCheck(this, SequenceModal);\n\n _this = _super.call(this, props);\n _this.state = {\n error_msgs: [],\n sequences: [],\n requestCompleted: false\n };\n _this.modalRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createRef)();\n return _this;\n } // Lifecycle methods. //\n\n\n _createClass(SequenceModal, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"modal sequence-viewer\",\n ref: this.modalRef,\n tabIndex: \"-1\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"modal-dialog\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"modal-content\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"modal-header\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"h3\", {\n children: \"View sequence\"\n })\n }), this.state.requestCompleted && this.resultsJSX() || this.loadingJSX()]\n })\n })\n });\n }\n /*\n * Returns jQuery reference to the main modal container.\n */\n\n }, {\n key: \"modal\",\n value: function modal() {\n return $(this.modalRef.current);\n }\n /**\n * Shows sequence viewer.\n */\n\n }, {\n key: \"show\",\n value: function show(url) {\n var _this2 = this;\n\n this.setState({\n requestCompleted: false\n }, function () {\n _this2.modal().modal(\"show\");\n\n _this2.loadJSON(url);\n });\n }\n /**\n * Hide sequence viewer.\n */\n\n }, {\n key: \"hide\",\n value: function hide() {\n this.modal().modal(\"hide\");\n }\n /**\n * Loads sequence using AJAX and updates modal state.\n */\n\n }, {\n key: \"loadJSON\",\n value: function loadJSON(url) {\n var _this3 = this;\n\n // Fetch sequence and update state.\n $.getJSON(url).done(underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].bind(function (response) {\n this.setState({\n sequences: response.sequences,\n error_msgs: response.error_msgs,\n requestCompleted: true\n });\n }, this)).fail(function (jqXHR, status, error) {\n _this3.hide();\n\n _this3.props.showErrorModal(jqXHR.responseJSON);\n });\n }\n }, {\n key: \"resultsJSX\",\n value: function resultsJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"modal-body\",\n children: [underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].map(this.state.error_msgs, underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].bind(function (error_msg) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"fastan\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"section-header\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"h4\", {\n children: error_msg[0]\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"section-content\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"pre\", {\n className: \"pre-reset\",\n children: error_msg[1]\n })\n })]\n });\n }, this)), underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].map(this.state.sequences, underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].bind(function (sequence) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(SequenceViewer, {\n sequence: sequence\n });\n }, this))]\n });\n }\n }, {\n key: \"loadingJSX\",\n value: function loadingJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"modal-body text-center\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"i\", {\n className: \"fa fa-spinner fa-3x fa-spin\"\n })\n });\n }\n }]);\n\n return SequenceModal;\n}((react__WEBPACK_IMPORTED_MODULE_1___default().Component));\n\n\n\nvar SequenceViewer = /*#__PURE__*/function (_React$Component2) {\n _inherits(SequenceViewer, _React$Component2);\n\n var _super2 = _createSuper(SequenceViewer);\n\n function SequenceViewer() {\n _classCallCheck(this, SequenceViewer);\n\n return _super2.apply(this, arguments);\n }\n\n _createClass(SequenceViewer, [{\n key: \"render\",\n value: function render() {\n this.widgetID = this.widgetClass + \"-\" + new Date().getUTCMilliseconds();\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"fastan\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"section-header\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"h4\", {\n children: [this.props.sequence.id, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"small\", {\n children: [\"\\xA0 \", this.props.sequence.title]\n })]\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"section-content\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: this.widgetClass,\n id: this.widgetID\n })\n })]\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n // attach BioJS sequence viewer\n var widget = new Sequence({\n sequence: this.props.sequence.value,\n target: this.widgetID,\n format: \"PRIDE\",\n columns: {\n size: 40,\n spacedEach: 0\n },\n formatOptions: {\n title: false,\n footer: false\n }\n });\n widget.hideFormatSelector();\n }\n }], [{\n key: \"widgetClass\",\n value:\n /**\n * The CSS class name that will be assigned to the widget container. ID\n * assigned to the widget container is derived from the same.\n */\n function widgetClass() {\n return \"biojs-vis-sequence\";\n }\n }]);\n\n return SequenceViewer;\n}((react__WEBPACK_IMPORTED_MODULE_1___default().Component));\n\n//# sourceURL=webpack://SequenceServer/./public/js/sequence_modal.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ SequenceModal)\n/* harmony export */ });\n/* harmony import */ var _sequence__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sequence */ \"./public/js/sequence.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 underscore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n/**\n * Takes sequence accession as props, fetches the sequence from the server, and\n * displays it in a modal.\n */\n\n\n\n\nvar SequenceModal = /*#__PURE__*/function (_React$Component) {\n _inherits(SequenceModal, _React$Component);\n\n var _super = _createSuper(SequenceModal);\n\n function SequenceModal(props) {\n var _this;\n\n _classCallCheck(this, SequenceModal);\n\n _this = _super.call(this, props);\n _this.state = {\n error_msgs: [],\n sequences: [],\n requestCompleted: false\n };\n _this.modalRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createRef)();\n return _this;\n } // Lifecycle methods. //\n\n\n _createClass(SequenceModal, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"modal sequence-viewer\",\n ref: this.modalRef,\n tabIndex: \"-1\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"modal-dialog\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"modal-content\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"modal-header\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"h3\", {\n children: \"View sequence\"\n })\n }), this.state.requestCompleted && this.resultsJSX() || this.loadingJSX()]\n })\n })\n });\n }\n /*\n * Returns jQuery reference to the main modal container.\n */\n\n }, {\n key: \"modal\",\n value: function modal() {\n return $(this.modalRef.current);\n }\n /**\n * Shows sequence viewer.\n */\n\n }, {\n key: \"show\",\n value: function show(url) {\n var _this2 = this;\n\n this.setState({\n requestCompleted: false\n }, function () {\n _this2.modal().modal(\"show\");\n\n _this2.loadJSON(url);\n });\n }\n /**\n * Hide sequence viewer.\n */\n\n }, {\n key: \"hide\",\n value: function hide() {\n this.modal().modal(\"hide\");\n }\n /**\n * Loads sequence using AJAX and updates modal state.\n */\n\n }, {\n key: \"loadJSON\",\n value: function loadJSON(url) {\n var _this3 = this;\n\n // Fetch sequence and update state.\n $.getJSON(url).done(underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].bind(function (response) {\n this.setState({\n sequences: response.sequences,\n error_msgs: response.error_msgs,\n requestCompleted: true\n });\n }, this)).fail(function (jqXHR, status, error) {\n _this3.hide();\n\n _this3.props.showErrorModal(jqXHR.responseJSON);\n });\n }\n }, {\n key: \"resultsJSX\",\n value: function resultsJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"modal-body\",\n children: [underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].map(this.state.error_msgs, underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].bind(function (error_msg) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"fastan\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"section-header\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"h4\", {\n children: error_msg[0]\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"section-content\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"pre\", {\n className: \"pre-reset\",\n children: error_msg[1]\n })\n })]\n });\n }, this)), underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].map(this.state.sequences, underscore__WEBPACK_IMPORTED_MODULE_2__[\"default\"].bind(function (sequence) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(SequenceViewer, {\n sequence: sequence\n });\n }, this))]\n });\n }\n }, {\n key: \"loadingJSX\",\n value: function loadingJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"modal-body text-center\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"i\", {\n className: \"fa fa-spinner fa-3x fa-spin\"\n })\n });\n }\n }]);\n\n return SequenceModal;\n}((react__WEBPACK_IMPORTED_MODULE_1___default().Component));\n\n\n\nvar SequenceViewer = /*#__PURE__*/function (_React$Component2) {\n _inherits(SequenceViewer, _React$Component2);\n\n var _super2 = _createSuper(SequenceViewer);\n\n function SequenceViewer() {\n _classCallCheck(this, SequenceViewer);\n\n return _super2.apply(this, arguments);\n }\n\n _createClass(SequenceViewer, [{\n key: \"render\",\n value: function render() {\n this.widgetID = this.widgetClass + \"-\" + new Date().getUTCMilliseconds();\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: \"fastan\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"section-header\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"h4\", {\n children: [this.props.sequence.id, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"small\", {\n children: [\"\\xA0 \", this.props.sequence.title]\n })]\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: \"section-content\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: this.widgetClass,\n id: this.widgetID\n })\n })]\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n // attach BioJS sequence viewer\n var widget = new Sequence({\n sequence: this.props.sequence.value,\n target: this.widgetID,\n format: \"PRIDE\",\n columns: {\n size: 40,\n spacedEach: 0\n },\n formatOptions: {\n title: false,\n footer: false\n }\n });\n widget.hideFormatSelector();\n }\n }], [{\n key: \"widgetClass\",\n value:\n /**\n * The CSS class name that will be assigned to the widget container. ID\n * assigned to the widget container is derived from the same.\n */\n function widgetClass() {\n return \"biojs-vis-sequence\";\n }\n }]);\n\n return SequenceViewer;\n}((react__WEBPACK_IMPORTED_MODULE_1___default().Component));\n\n//# sourceURL=webpack://SequenceServer/./public/js/sequence_modal.js?"); /***/ }), @@ -192,7 +192,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__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 _download_fasta__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./download_fasta */ \"./public/js/download_fasta.js\");\n/* harmony import */ var _alignment_exporter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./alignment_exporter */ \"./public/js/alignment_exporter.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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n // to download textual alignment\n\n/**\n * Renders links for downloading hit information in different formats.\n * Renders links for navigating to each query.\n */\n\n\n\n\nvar _default = /*#__PURE__*/function (_Component) {\n _inherits(_default, _Component);\n\n var _super = _createSuper(_default);\n\n function _default(props) {\n var _this;\n\n _classCallCheck(this, _default);\n\n _this = _super.call(this, props);\n _this.downloadFastaOfAll = _this.downloadFastaOfAll.bind(_assertThisInitialized(_this));\n _this.downloadFastaOfSelected = _this.downloadFastaOfSelected.bind(_assertThisInitialized(_this));\n _this.downloadAlignmentOfAll = _this.downloadAlignmentOfAll.bind(_assertThisInitialized(_this));\n _this.downloadAlignmentOfSelected = _this.downloadAlignmentOfSelected.bind(_assertThisInitialized(_this));\n _this.topPanelJSX = _this.topPanelJSX.bind(_assertThisInitialized(_this));\n _this.summaryString = _this.summaryString.bind(_assertThisInitialized(_this));\n _this.indexJSX = _this.indexJSX.bind(_assertThisInitialized(_this));\n _this.downloadsPanelJSX = _this.downloadsPanelJSX.bind(_assertThisInitialized(_this));\n return _this;\n }\n /**\n * Clear sessionStorage - useful to initiate a new search in the same tab.\n * Passing sessionStorage.clear directly as onclick callback didn't work\n * (on macOS Chrome).\n */\n\n\n _createClass(_default, [{\n key: \"clearSession\",\n value: function clearSession() {\n sessionStorage.clear();\n }\n /**\n * Event-handler for downloading fasta of all hits.\n */\n\n }, {\n key: \"downloadFastaOfAll\",\n value: function downloadFastaOfAll() {\n var sequence_ids = [];\n this.props.data.queries.forEach(function (query) {\n return query.hits.forEach(function (hit) {\n return sequence_ids.push(hit.id);\n });\n });\n var database_ids = this.props.data.querydb.map(function (querydb) {\n return querydb.id;\n });\n (0,_download_fasta__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(sequence_ids, database_ids);\n return false;\n }\n /**\n * Handles downloading fasta of selected hits.\n */\n\n }, {\n key: \"downloadFastaOfSelected\",\n value: function downloadFastaOfSelected() {\n var sequence_ids = $('.hit-links :checkbox:checked').map(function () {\n return this.value;\n }).get();\n\n var database_ids = underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.data.querydb, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].iteratee('id'));\n\n (0,_download_fasta__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(sequence_ids, database_ids);\n return false;\n }\n }, {\n key: \"downloadAlignmentOfAll\",\n value: function downloadAlignmentOfAll() {\n // Get number of hits and array of all hsps.\n var num_hits = 0;\n var hsps_arr = [];\n this.props.data.queries.forEach(function (query) {\n return query.hits.forEach(function (hit) {\n num_hits++;\n hit.hsps.forEach(function (hsp) {\n hsp.query_id = query.id;\n hsp.hit_id = hit.id;\n hsps_arr.push(hsp);\n });\n });\n });\n var aln_exporter = new _alignment_exporter__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n var file_name = \"alignment-\".concat(num_hits, \"_hits\");\n aln_exporter.export_alignments(hsps_arr, file_name);\n return false;\n }\n }, {\n key: \"downloadAlignmentOfSelected\",\n value: function downloadAlignmentOfSelected() {\n var sequence_ids = $('.hit-links :checkbox:checked').map(function () {\n return this.value;\n }).get();\n var hsps_arr = [];\n var aln_exporter = new _alignment_exporter__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n console.log('check ' + sequence_ids.toString());\n\n underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].each(this.props.data.queries, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function (query) {\n underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].each(query.hits, function (hit) {\n if (underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].indexOf(sequence_ids, hit.id) != -1) {\n underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].each(hit.hsps, function (hsp) {\n hsp.hit_id = hit.id;\n hsp.query_id = query.id;\n hsps_arr.push(hsp);\n });\n }\n });\n }, this));\n\n aln_exporter.export_alignments(hsps_arr, 'alignment-' + sequence_ids.length + '_hits');\n return false;\n }\n }, {\n key: \"topPanelJSX\",\n value: function topPanelJSX() {\n var path = location.pathname.split('/'); // Get job id.\n\n var job_id = path.pop(); // Deriving rootURL this way is required for subURI deployments\n // - we cannot just send to '/'.\n\n var rootURL = path.join('/');\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"sidebar-top-panel\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: \"section-header-sidebar\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"h4\", {\n children: this.summaryString()\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"a\", {\n href: \"\".concat(rootURL, \"/?job_id=\").concat(job_id),\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"i\", {\n className: \"fa fa-pencil\"\n }), \" Edit search\"]\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: \"\".concat(rootURL, \"/\"),\n onClick: this.clearSession,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"i\", {\n className: \"fa fa-file-o\"\n }), \" New search\"]\n })]\n }), this.props.shouldShowIndex && this.indexJSX()]\n });\n }\n }, {\n key: \"summaryString\",\n value: function summaryString() {\n var program = this.props.data.program;\n var numqueries = this.props.data.queries.length;\n var numquerydb = this.props.data.querydb.length;\n return program.toUpperCase() + ': ' + numqueries + ' ' + (numqueries > 1 ? 'queries' : 'query') + ', ' + numquerydb + ' ' + (numquerydb > 1 ? 'databases' : 'database');\n }\n }, {\n key: \"indexJSX\",\n value: function indexJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"ul\", {\n className: \"nav hover-reset active-bold\",\n children: [\" \", underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.data.queries, function (query) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n className: \"btn-link nowrap-ellipsis hover-bold\",\n title: 'Query= ' + query.id + ' ' + query.title,\n href: '#Query_' + query.number,\n children: 'Query= ' + query.id\n })\n }, 'Side_bar_' + query.id);\n })]\n });\n }\n }, {\n key: \"downloadsPanelJSX\",\n value: function downloadsPanelJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"downloads\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: \"section-header-sidebar\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"h4\", {\n children: \"Download FASTA, XML, TSV\"\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"ul\", {\n className: \"nav\",\n children: [!(this.props.data.imported_xml || this.props.data.non_parse_seqids) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n href: \"#\",\n className: \"btn-link download-fasta-of-all \".concat(!this.props.atLeastOneHit && 'disabled'),\n onClick: this.downloadFastaOfAll,\n children: \"FASTA of all hits\"\n })\n }), !(this.props.data.imported_xml || this.props.data.non_parse_seqids) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link download-fasta-of-selected disabled\",\n onClick: this.downloadFastaOfSelected,\n children: [\"FASTA of \", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"text-bold\"\n }), \" selected hit(s)\"]\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n href: \"#\",\n className: \"btn-link download-alignment-of-all \".concat(!this.props.atLeastOneHit && 'disabled'),\n onClick: this.downloadAlignmentOfAll,\n children: \"Alignment of all hits\"\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link download-alignment-of-selected disabled\",\n onClick: this.downloadAlignmentOfSelected,\n children: [\"Alignment of \", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"text-bold\"\n }), \" selected hit(s)\"]\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n className: \"btn-link download\",\n \"data-toggle\": \"tooltip\",\n title: \"15 columns: query and subject ID; scientific name, alignment length, mismatches, gaps, identity, start and end coordinates, e value, bitscore, query coverage per subject and per HSP.\",\n href: 'download/' + this.props.data.search_id + '.std_tsv',\n children: \"Standard tabular report\"\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n className: \"btn-link download\",\n \"data-toggle\": \"tooltip\",\n title: \"44 columns: query and subject ID, GI, accessions, and length; alignment details; taxonomy details of subject sequence(s) and query coverage per subject and per HSP.\",\n href: 'download/' + this.props.data.search_id + '.full_tsv',\n children: \"Full tabular report\"\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n className: \"btn-link download\",\n \"data-toggle\": \"tooltip\",\n title: \"Results in XML format.\",\n href: 'download/' + this.props.data.search_id + '.xml',\n children: \"Full XML report\"\n })\n })]\n })]\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"sidebar\",\n children: [this.topPanelJSX(), this.downloadsPanelJSX()]\n });\n }\n }]);\n\n return _default;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n\n\n//# sourceURL=webpack://SequenceServer/./public/js/sidebar.js?"); +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 _download_fasta__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./download_fasta */ \"./public/js/download_fasta.js\");\n/* harmony import */ var _alignment_exporter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./alignment_exporter */ \"./public/js/alignment_exporter.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); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\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); } }\n\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\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); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\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); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n // to download textual alignment\n\n/**\n * Renders links for downloading hit information in different formats.\n * Renders links for navigating to each query.\n */\n\n\n\n\nvar _default = /*#__PURE__*/function (_Component) {\n _inherits(_default, _Component);\n\n var _super = _createSuper(_default);\n\n function _default(props) {\n var _this;\n\n _classCallCheck(this, _default);\n\n _this = _super.call(this, props);\n _this.downloadFastaOfAll = _this.downloadFastaOfAll.bind(_assertThisInitialized(_this));\n _this.downloadFastaOfSelected = _this.downloadFastaOfSelected.bind(_assertThisInitialized(_this));\n _this.downloadAlignmentOfAll = _this.downloadAlignmentOfAll.bind(_assertThisInitialized(_this));\n _this.downloadAlignmentOfSelected = _this.downloadAlignmentOfSelected.bind(_assertThisInitialized(_this));\n _this.topPanelJSX = _this.topPanelJSX.bind(_assertThisInitialized(_this));\n _this.summaryString = _this.summaryString.bind(_assertThisInitialized(_this));\n _this.indexJSX = _this.indexJSX.bind(_assertThisInitialized(_this));\n _this.downloadsPanelJSX = _this.downloadsPanelJSX.bind(_assertThisInitialized(_this));\n return _this;\n }\n /**\n * Clear sessionStorage - useful to initiate a new search in the same tab.\n * Passing sessionStorage.clear directly as onclick callback didn't work\n * (on macOS Chrome).\n */\n\n\n _createClass(_default, [{\n key: \"clearSession\",\n value: function clearSession() {\n sessionStorage.clear();\n }\n /**\n * Event-handler for downloading fasta of all hits.\n */\n\n }, {\n key: \"downloadFastaOfAll\",\n value: function downloadFastaOfAll() {\n var sequence_ids = [];\n this.props.data.queries.forEach(function (query) {\n return query.hits.forEach(function (hit) {\n return sequence_ids.push(hit.id);\n });\n });\n var database_ids = this.props.data.querydb.map(function (querydb) {\n return querydb.id;\n });\n (0,_download_fasta__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(sequence_ids, database_ids);\n return false;\n }\n /**\n * Handles downloading fasta of selected hits.\n */\n\n }, {\n key: \"downloadFastaOfSelected\",\n value: function downloadFastaOfSelected() {\n var sequence_ids = $('.hit-links :checkbox:checked').map(function () {\n return this.value;\n }).get();\n\n var database_ids = underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.data.querydb, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].iteratee('id'));\n\n (0,_download_fasta__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(sequence_ids, database_ids);\n return false;\n }\n }, {\n key: \"downloadAlignmentOfAll\",\n value: function downloadAlignmentOfAll() {\n // Get number of hits and array of all hsps.\n var num_hits = 0;\n var hsps_arr = [];\n this.props.data.queries.forEach(function (query) {\n return query.hits.forEach(function (hit) {\n num_hits++;\n hit.hsps.forEach(function (hsp) {\n hsp.query_id = query.id;\n hsp.hit_id = hit.id;\n hsps_arr.push(hsp);\n });\n });\n });\n var aln_exporter = new _alignment_exporter__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n var file_name = \"alignment-\".concat(num_hits, \"_hits\");\n aln_exporter.export_alignments(hsps_arr, file_name);\n return false;\n }\n }, {\n key: \"downloadAlignmentOfSelected\",\n value: function downloadAlignmentOfSelected() {\n var sequence_ids = $('.hit-links :checkbox:checked').map(function () {\n return this.value;\n }).get();\n var hsps_arr = [];\n var aln_exporter = new _alignment_exporter__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n console.log('check ' + sequence_ids.toString());\n\n underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].each(this.props.data.queries, underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].bind(function (query) {\n underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].each(query.hits, function (hit) {\n if (underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].indexOf(sequence_ids, hit.id) != -1) {\n underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].each(hit.hsps, function (hsp) {\n hsp.hit_id = hit.id;\n hsp.query_id = query.id;\n hsps_arr.push(hsp);\n });\n }\n });\n }, this));\n\n aln_exporter.export_alignments(hsps_arr, 'alignment-' + sequence_ids.length + '_hits');\n return false;\n }\n }, {\n key: \"topPanelJSX\",\n value: function topPanelJSX() {\n var path = location.pathname.split('/'); // Get job id.\n\n var job_id = path.pop(); // Deriving rootURL this way is required for subURI deployments\n // - we cannot just send to '/'.\n\n var rootURL = path.join('/');\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"sidebar-top-panel\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: \"section-header-sidebar\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"h4\", {\n children: this.summaryString()\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"a\", {\n href: \"\".concat(rootURL, \"/?job_id=\").concat(job_id),\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"i\", {\n className: \"fa fa-pencil\"\n }), \" Edit search\"]\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: \"\".concat(rootURL, \"/\"),\n onClick: this.clearSession,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"i\", {\n className: \"fa fa-file-o\"\n }), \" New search\"]\n })]\n }), this.props.shouldShowIndex && this.indexJSX()]\n });\n }\n }, {\n key: \"summaryString\",\n value: function summaryString() {\n var program = this.props.data.program;\n var numqueries = this.props.data.queries.length;\n var numquerydb = this.props.data.querydb.length;\n return program.toUpperCase() + ': ' + numqueries + ' ' + (numqueries > 1 ? 'queries' : 'query') + ', ' + numquerydb + ' ' + (numquerydb > 1 ? 'databases' : 'database');\n }\n }, {\n key: \"indexJSX\",\n value: function indexJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"ul\", {\n className: \"nav hover-reset active-bold\",\n children: [\" \", underscore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].map(this.props.data.queries, function (query) {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n className: \"btn-link nowrap-ellipsis hover-bold\",\n title: 'Query= ' + query.id + ' ' + query.title,\n href: '#Query_' + query.number,\n children: 'Query= ' + query.id\n })\n }, 'Side_bar_' + query.id);\n })]\n });\n }\n }, {\n key: \"downloadsPanelJSX\",\n value: function downloadsPanelJSX() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"downloads\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: \"section-header-sidebar\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"h4\", {\n children: \"Download FASTA, XML, TSV\"\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"ul\", {\n className: \"nav\",\n children: [!(this.props.data.imported_xml || this.props.data.non_parse_seqids) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n href: \"#\",\n className: \"btn-link download-fasta-of-all \".concat(!this.props.atLeastOneHit && 'disabled'),\n onClick: this.downloadFastaOfAll,\n children: \"FASTA of all hits\"\n })\n }), !(this.props.data.imported_xml || this.props.data.non_parse_seqids) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link download-fasta-of-selected disabled\",\n onClick: this.downloadFastaOfSelected,\n children: [\"FASTA of \", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"text-bold\"\n }), \" selected hit(s)\"]\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n href: \"#\",\n className: \"btn-link download-alignment-of-all \".concat(!this.props.atLeastOneHit && 'disabled'),\n onClick: this.downloadAlignmentOfAll,\n children: \"Alignment of all hits\"\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"a\", {\n href: \"#\",\n className: \"btn-link download-alignment-of-selected disabled\",\n onClick: this.downloadAlignmentOfSelected,\n children: [\"Alignment of \", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: \"text-bold\"\n }), \" selected hit(s)\"]\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n className: \"btn-link download\",\n \"data-toggle\": \"tooltip\",\n title: \"15 columns: query and subject ID; scientific name, alignment length, mismatches, gaps, identity, start and end coordinates, e value, bitscore, query coverage per subject and per HSP.\",\n href: 'download/' + this.props.data.search_id + '.std_tsv',\n children: \"Standard tabular report\"\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n className: \"btn-link download\",\n \"data-toggle\": \"tooltip\",\n title: \"44 columns: query and subject ID, GI, accessions, and length; alignment details; taxonomy details of subject sequence(s) and query coverage per subject and per HSP.\",\n href: 'download/' + this.props.data.search_id + '.full_tsv',\n children: \"Full tabular report\"\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", {\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"a\", {\n className: \"btn-link download\",\n \"data-toggle\": \"tooltip\",\n title: \"Results in XML format.\",\n href: 'download/' + this.props.data.search_id + '.xml',\n children: \"Full XML report\"\n })\n })]\n })]\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: \"sidebar\",\n children: [this.topPanelJSX(), this.downloadsPanelJSX()]\n });\n }\n }]);\n\n return _default;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n\n\n//# sourceURL=webpack://SequenceServer/./public/js/sidebar.js?"); /***/ }), @@ -395,7 +395,7 @@ eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;!functio \********************************************/ /***/ (function(module, exports) { -eval("var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n * jQuery JavaScript Library v2.2.4\n * http://jquery.com/\n *\n * Includes Sizzle.js\n * http://sizzlejs.com/\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: 2016-05-20T17:23Z\n */\n\n(function( global, factory ) {\n\n\tif ( true && typeof module.exports === \"object\" ) {\n\t\t// For CommonJS and CommonJS-like environments where a proper `window`\n\t\t// is present, execute the factory and get jQuery.\n\t\t// For environments that do not have a `window` with a `document`\n\t\t// (such as Node.js), expose a factory as module.exports.\n\t\t// This accentuates the need for the creation of a real `window`.\n\t\t// e.g. var jQuery = require(\"jquery\")(window);\n\t\t// See ticket #14549 for more info.\n\t\tmodule.exports = global.document ?\n\t\t\tfactory( global, true ) :\n\t\t\tfunction( w ) {\n\t\t\t\tif ( !w.document ) {\n\t\t\t\t\tthrow new Error( \"jQuery requires a window with a document\" );\n\t\t\t\t}\n\t\t\t\treturn factory( w );\n\t\t\t};\n\t} else {\n\t\tfactory( global );\n\t}\n\n// Pass this if window is not defined yet\n}(typeof window !== \"undefined\" ? window : this, function( window, noGlobal ) {\n\n// Support: Firefox 18+\n// Can't be in strict mode, several libs including ASP.NET trace\n// the stack via arguments.caller.callee and Firefox dies if\n// you try to trace through \"use strict\" call chains. (#13335)\n//\"use strict\";\nvar arr = [];\n\nvar document = window.document;\n\nvar slice = arr.slice;\n\nvar concat = arr.concat;\n\nvar push = arr.push;\n\nvar indexOf = arr.indexOf;\n\nvar class2type = {};\n\nvar toString = class2type.toString;\n\nvar hasOwn = class2type.hasOwnProperty;\n\nvar support = {};\n\n\n\nvar\n\tversion = \"2.2.4\",\n\n\t// Define a local copy of jQuery\n\tjQuery = function( selector, context ) {\n\n\t\t// The jQuery object is actually just the init constructor 'enhanced'\n\t\t// Need init if jQuery is called (just allow error to be thrown if not included)\n\t\treturn new jQuery.fn.init( selector, context );\n\t},\n\n\t// Support: Android<4.1\n\t// Make sure we trim BOM and NBSP\n\trtrim = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,\n\n\t// Matches dashed string for camelizing\n\trmsPrefix = /^-ms-/,\n\trdashAlpha = /-([\\da-z])/gi,\n\n\t// Used by jQuery.camelCase as callback to replace()\n\tfcamelCase = function( all, letter ) {\n\t\treturn letter.toUpperCase();\n\t};\n\njQuery.fn = jQuery.prototype = {\n\n\t// The current version of jQuery being used\n\tjquery: version,\n\n\tconstructor: jQuery,\n\n\t// Start with an empty selector\n\tselector: \"\",\n\n\t// The default length of a jQuery object is 0\n\tlength: 0,\n\n\ttoArray: function() {\n\t\treturn slice.call( this );\n\t},\n\n\t// Get the Nth element in the matched element set OR\n\t// Get the whole matched element set as a clean array\n\tget: function( num ) {\n\t\treturn num != null ?\n\n\t\t\t// Return just the one element from the set\n\t\t\t( num < 0 ? this[ num + this.length ] : this[ num ] ) :\n\n\t\t\t// Return all the elements in a clean array\n\t\t\tslice.call( this );\n\t},\n\n\t// Take an array of elements and push it onto the stack\n\t// (returning the new matched element set)\n\tpushStack: function( elems ) {\n\n\t\t// Build a new jQuery matched element set\n\t\tvar ret = jQuery.merge( this.constructor(), elems );\n\n\t\t// Add the old object onto the stack (as a reference)\n\t\tret.prevObject = this;\n\t\tret.context = this.context;\n\n\t\t// Return the newly-formed element set\n\t\treturn ret;\n\t},\n\n\t// Execute a callback for every element in the matched set.\n\teach: function( callback ) {\n\t\treturn jQuery.each( this, callback );\n\t},\n\n\tmap: function( callback ) {\n\t\treturn this.pushStack( jQuery.map( this, function( elem, i ) {\n\t\t\treturn callback.call( elem, i, elem );\n\t\t} ) );\n\t},\n\n\tslice: function() {\n\t\treturn this.pushStack( slice.apply( this, arguments ) );\n\t},\n\n\tfirst: function() {\n\t\treturn this.eq( 0 );\n\t},\n\n\tlast: function() {\n\t\treturn this.eq( -1 );\n\t},\n\n\teq: function( i ) {\n\t\tvar len = this.length,\n\t\t\tj = +i + ( i < 0 ? len : 0 );\n\t\treturn this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );\n\t},\n\n\tend: function() {\n\t\treturn this.prevObject || this.constructor();\n\t},\n\n\t// For internal use only.\n\t// Behaves like an Array's method, not like a jQuery method.\n\tpush: push,\n\tsort: arr.sort,\n\tsplice: arr.splice\n};\n\njQuery.extend = jQuery.fn.extend = function() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\t\ttarget = arguments[ 0 ] || {},\n\t\ti = 1,\n\t\tlength = arguments.length,\n\t\tdeep = false;\n\n\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;\n\n\t\t// Skip the boolean and the target\n\t\ttarget = arguments[ i ] || {};\n\t\ti++;\n\t}\n\n\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !jQuery.isFunction( target ) ) {\n\t\ttarget = {};\n\t}\n\n\t// Extend jQuery itself if only one argument is passed\n\tif ( i === length ) {\n\t\ttarget = this;\n\t\ti--;\n\t}\n\n\tfor ( ; i < length; i++ ) {\n\n\t\t// Only deal with non-null/undefined values\n\t\tif ( ( options = arguments[ i ] ) != null ) {\n\n\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tsrc = target[ name ];\n\t\t\t\tcopy = options[ name ];\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif ( target === copy ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject( copy ) ||\n\t\t\t\t\t( copyIsArray = jQuery.isArray( copy ) ) ) ) {\n\n\t\t\t\t\tif ( copyIsArray ) {\n\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\tclone = src && jQuery.isArray( src ) ? src : [];\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src && jQuery.isPlainObject( src ) ? src : {};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\n\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\njQuery.extend( {\n\n\t// Unique for each copy of jQuery on the page\n\texpando: \"jQuery\" + ( version + Math.random() ).replace( /\\D/g, \"\" ),\n\n\t// Assume jQuery is ready without the ready module\n\tisReady: true,\n\n\terror: function( msg ) {\n\t\tthrow new Error( msg );\n\t},\n\n\tnoop: function() {},\n\n\tisFunction: function( obj ) {\n\t\treturn jQuery.type( obj ) === \"function\";\n\t},\n\n\tisArray: Array.isArray,\n\n\tisWindow: function( obj ) {\n\t\treturn obj != null && obj === obj.window;\n\t},\n\n\tisNumeric: function( obj ) {\n\n\t\t// parseFloat NaNs numeric-cast false positives (null|true|false|\"\")\n\t\t// ...but misinterprets leading-number strings, particularly hex literals (\"0x...\")\n\t\t// subtraction forces infinities to NaN\n\t\t// adding 1 corrects loss of precision from parseFloat (#15100)\n\t\tvar realStringObj = obj && obj.toString();\n\t\treturn !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;\n\t},\n\n\tisPlainObject: function( obj ) {\n\t\tvar key;\n\n\t\t// Not plain objects:\n\t\t// - Any object or value whose internal [[Class]] property is not \"[object Object]\"\n\t\t// - DOM nodes\n\t\t// - window\n\t\tif ( jQuery.type( obj ) !== \"object\" || obj.nodeType || jQuery.isWindow( obj ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Not own constructor property must be Object\n\t\tif ( obj.constructor &&\n\t\t\t\t!hasOwn.call( obj, \"constructor\" ) &&\n\t\t\t\t!hasOwn.call( obj.constructor.prototype || {}, \"isPrototypeOf\" ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Own properties are enumerated firstly, so to speed up,\n\t\t// if last one is own, then all properties are own\n\t\tfor ( key in obj ) {}\n\n\t\treturn key === undefined || hasOwn.call( obj, key );\n\t},\n\n\tisEmptyObject: function( obj ) {\n\t\tvar name;\n\t\tfor ( name in obj ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\n\ttype: function( obj ) {\n\t\tif ( obj == null ) {\n\t\t\treturn obj + \"\";\n\t\t}\n\n\t\t// Support: Android<4.0, iOS<6 (functionish RegExp)\n\t\treturn typeof obj === \"object\" || typeof obj === \"function\" ?\n\t\t\tclass2type[ toString.call( obj ) ] || \"object\" :\n\t\t\ttypeof obj;\n\t},\n\n\t// Evaluates a script in a global context\n\tglobalEval: function( code ) {\n\t\tvar script,\n\t\t\tindirect = eval;\n\n\t\tcode = jQuery.trim( code );\n\n\t\tif ( code ) {\n\n\t\t\t// If the code includes a valid, prologue position\n\t\t\t// strict mode pragma, execute code by injecting a\n\t\t\t// script tag into the document.\n\t\t\tif ( code.indexOf( \"use strict\" ) === 1 ) {\n\t\t\t\tscript = document.createElement( \"script\" );\n\t\t\t\tscript.text = code;\n\t\t\t\tdocument.head.appendChild( script ).parentNode.removeChild( script );\n\t\t\t} else {\n\n\t\t\t\t// Otherwise, avoid the DOM node creation, insertion\n\t\t\t\t// and removal by using an indirect global eval\n\n\t\t\t\tindirect( code );\n\t\t\t}\n\t\t}\n\t},\n\n\t// Convert dashed to camelCase; used by the css and data modules\n\t// Support: IE9-11+\n\t// Microsoft forgot to hump their vendor prefix (#9572)\n\tcamelCase: function( string ) {\n\t\treturn string.replace( rmsPrefix, \"ms-\" ).replace( rdashAlpha, fcamelCase );\n\t},\n\n\tnodeName: function( elem, name ) {\n\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n\t},\n\n\teach: function( obj, callback ) {\n\t\tvar length, i = 0;\n\n\t\tif ( isArrayLike( obj ) ) {\n\t\t\tlength = obj.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i in obj ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn obj;\n\t},\n\n\t// Support: Android<4.1\n\ttrim: function( text ) {\n\t\treturn text == null ?\n\t\t\t\"\" :\n\t\t\t( text + \"\" ).replace( rtrim, \"\" );\n\t},\n\n\t// results is for internal usage only\n\tmakeArray: function( arr, results ) {\n\t\tvar ret = results || [];\n\n\t\tif ( arr != null ) {\n\t\t\tif ( isArrayLike( Object( arr ) ) ) {\n\t\t\t\tjQuery.merge( ret,\n\t\t\t\t\ttypeof arr === \"string\" ?\n\t\t\t\t\t[ arr ] : arr\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tpush.call( ret, arr );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tinArray: function( elem, arr, i ) {\n\t\treturn arr == null ? -1 : indexOf.call( arr, elem, i );\n\t},\n\n\tmerge: function( first, second ) {\n\t\tvar len = +second.length,\n\t\t\tj = 0,\n\t\t\ti = first.length;\n\n\t\tfor ( ; j < len; j++ ) {\n\t\t\tfirst[ i++ ] = second[ j ];\n\t\t}\n\n\t\tfirst.length = i;\n\n\t\treturn first;\n\t},\n\n\tgrep: function( elems, callback, invert ) {\n\t\tvar callbackInverse,\n\t\t\tmatches = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length,\n\t\t\tcallbackExpect = !invert;\n\n\t\t// Go through the array, only saving the items\n\t\t// that pass the validator function\n\t\tfor ( ; i < length; i++ ) {\n\t\t\tcallbackInverse = !callback( elems[ i ], i );\n\t\t\tif ( callbackInverse !== callbackExpect ) {\n\t\t\t\tmatches.push( elems[ i ] );\n\t\t\t}\n\t\t}\n\n\t\treturn matches;\n\t},\n\n\t// arg is for internal usage only\n\tmap: function( elems, callback, arg ) {\n\t\tvar length, value,\n\t\t\ti = 0,\n\t\t\tret = [];\n\n\t\t// Go through the array, translating each of the items to their new values\n\t\tif ( isArrayLike( elems ) ) {\n\t\t\tlength = elems.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Go through every key on the object,\n\t\t} else {\n\t\t\tfor ( i in elems ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Flatten any nested arrays\n\t\treturn concat.apply( [], ret );\n\t},\n\n\t// A global GUID counter for objects\n\tguid: 1,\n\n\t// Bind a function to a context, optionally partially applying any\n\t// arguments.\n\tproxy: function( fn, context ) {\n\t\tvar tmp, args, proxy;\n\n\t\tif ( typeof context === \"string\" ) {\n\t\t\ttmp = fn[ context ];\n\t\t\tcontext = fn;\n\t\t\tfn = tmp;\n\t\t}\n\n\t\t// Quick check to determine if target is callable, in the spec\n\t\t// this throws a TypeError, but we will just return undefined.\n\t\tif ( !jQuery.isFunction( fn ) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Simulated bind\n\t\targs = slice.call( arguments, 2 );\n\t\tproxy = function() {\n\t\t\treturn fn.apply( context || this, args.concat( slice.call( arguments ) ) );\n\t\t};\n\n\t\t// Set the guid of unique handler to the same of original handler, so it can be removed\n\t\tproxy.guid = fn.guid = fn.guid || jQuery.guid++;\n\n\t\treturn proxy;\n\t},\n\n\tnow: Date.now,\n\n\t// jQuery.support is not used in Core but other projects attach their\n\t// properties to it so it needs to exist.\n\tsupport: support\n} );\n\n// JSHint would error on this code due to the Symbol not being defined in ES5.\n// Defining this global in .jshintrc would create a danger of using the global\n// unguarded in another place, it seems safer to just disable JSHint for these\n// three lines.\n/* jshint ignore: start */\nif ( typeof Symbol === \"function\" ) {\n\tjQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];\n}\n/* jshint ignore: end */\n\n// Populate the class2type map\njQuery.each( \"Boolean Number String Function Array Date RegExp Object Error Symbol\".split( \" \" ),\nfunction( i, name ) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n} );\n\nfunction isArrayLike( obj ) {\n\n\t// Support: iOS 8.2 (not reproducible in simulator)\n\t// `in` check used to prevent JIT error (gh-2145)\n\t// hasOwn isn't used here due to false negatives\n\t// regarding Nodelist length in IE\n\tvar length = !!obj && \"length\" in obj && obj.length,\n\t\ttype = jQuery.type( obj );\n\n\tif ( type === \"function\" || jQuery.isWindow( obj ) ) {\n\t\treturn false;\n\t}\n\n\treturn type === \"array\" || length === 0 ||\n\t\ttypeof length === \"number\" && length > 0 && ( length - 1 ) in obj;\n}\nvar Sizzle =\n/*!\n * Sizzle CSS Selector Engine v2.2.1\n * http://sizzlejs.com/\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: 2015-10-17\n */\n(function( window ) {\n\nvar i,\n\tsupport,\n\tExpr,\n\tgetText,\n\tisXML,\n\ttokenize,\n\tcompile,\n\tselect,\n\toutermostContext,\n\tsortInput,\n\thasDuplicate,\n\n\t// Local document vars\n\tsetDocument,\n\tdocument,\n\tdocElem,\n\tdocumentIsHTML,\n\trbuggyQSA,\n\trbuggyMatches,\n\tmatches,\n\tcontains,\n\n\t// Instance-specific data\n\texpando = \"sizzle\" + 1 * new Date(),\n\tpreferredDoc = window.document,\n\tdirruns = 0,\n\tdone = 0,\n\tclassCache = createCache(),\n\ttokenCache = createCache(),\n\tcompilerCache = createCache(),\n\tsortOrder = function( a, b ) {\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t}\n\t\treturn 0;\n\t},\n\n\t// General-purpose constants\n\tMAX_NEGATIVE = 1 << 31,\n\n\t// Instance methods\n\thasOwn = ({}).hasOwnProperty,\n\tarr = [],\n\tpop = arr.pop,\n\tpush_native = arr.push,\n\tpush = arr.push,\n\tslice = arr.slice,\n\t// Use a stripped-down indexOf as it's faster than native\n\t// http://jsperf.com/thor-indexof-vs-for/5\n\tindexOf = function( list, elem ) {\n\t\tvar i = 0,\n\t\t\tlen = list.length;\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( list[i] === elem ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t},\n\n\tbooleans = \"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",\n\n\t// Regular expressions\n\n\t// http://www.w3.org/TR/css3-selectors/#whitespace\n\twhitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",\n\n\t// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier\n\tidentifier = \"(?:\\\\\\\\.|[\\\\w-]|[^\\\\x00-\\\\xa0])+\",\n\n\t// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors\n\tattributes = \"\\\\[\" + whitespace + \"*(\" + identifier + \")(?:\" + whitespace +\n\t\t// Operator (capture 2)\n\t\t\"*([*^$|!~]?=)\" + whitespace +\n\t\t// \"Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]\"\n\t\t\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\" + identifier + \"))|)\" + whitespace +\n\t\t\"*\\\\]\",\n\n\tpseudos = \":(\" + identifier + \")(?:\\\\((\" +\n\t\t// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:\n\t\t// 1. quoted (capture 3; capture 4 or capture 5)\n\t\t\"('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|\" +\n\t\t// 2. simple (capture 6)\n\t\t\"((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes + \")*)|\" +\n\t\t// 3. anything else (capture 2)\n\t\t\".*\" +\n\t\t\")\\\\)|)\",\n\n\t// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n\trwhitespace = new RegExp( whitespace + \"+\", \"g\" ),\n\trtrim = new RegExp( \"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\" ),\n\n\trcomma = new RegExp( \"^\" + whitespace + \"*,\" + whitespace + \"*\" ),\n\trcombinators = new RegExp( \"^\" + whitespace + \"*([>+~]|\" + whitespace + \")\" + whitespace + \"*\" ),\n\n\trattributeQuotes = new RegExp( \"=\" + whitespace + \"*([^\\\\]'\\\"]*?)\" + whitespace + \"*\\\\]\", \"g\" ),\n\n\trpseudo = new RegExp( pseudos ),\n\tridentifier = new RegExp( \"^\" + identifier + \"$\" ),\n\n\tmatchExpr = {\n\t\t\"ID\": new RegExp( \"^#(\" + identifier + \")\" ),\n\t\t\"CLASS\": new RegExp( \"^\\\\.(\" + identifier + \")\" ),\n\t\t\"TAG\": new RegExp( \"^(\" + identifier + \"|[*])\" ),\n\t\t\"ATTR\": new RegExp( \"^\" + attributes ),\n\t\t\"PSEUDO\": new RegExp( \"^\" + pseudos ),\n\t\t\"CHILD\": new RegExp( \"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" + whitespace +\n\t\t\t\"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace +\n\t\t\t\"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\" ),\n\t\t\"bool\": new RegExp( \"^(?:\" + booleans + \")$\", \"i\" ),\n\t\t// For use in libraries implementing .is()\n\t\t// We use this for POS matching in `select`\n\t\t\"needsContext\": new RegExp( \"^\" + whitespace + \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" +\n\t\t\twhitespace + \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\" )\n\t},\n\n\trinputs = /^(?:input|select|textarea|button)$/i,\n\trheader = /^h\\d$/i,\n\n\trnative = /^[^{]+\\{\\s*\\[native \\w/,\n\n\t// Easily-parseable/retrievable ID or TAG or CLASS selectors\n\trquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,\n\n\trsibling = /[+~]/,\n\trescape = /'|\\\\/g,\n\n\t// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n\trunescape = new RegExp( \"\\\\\\\\([\\\\da-f]{1,6}\" + whitespace + \"?|(\" + whitespace + \")|.)\", \"ig\" ),\n\tfunescape = function( _, escaped, escapedWhitespace ) {\n\t\tvar high = \"0x\" + escaped - 0x10000;\n\t\t// NaN means non-codepoint\n\t\t// Support: Firefox<24\n\t\t// Workaround erroneous numeric interpretation of +\"0x\"\n\t\treturn high !== high || escapedWhitespace ?\n\t\t\tescaped :\n\t\t\thigh < 0 ?\n\t\t\t\t// BMP codepoint\n\t\t\t\tString.fromCharCode( high + 0x10000 ) :\n\t\t\t\t// Supplemental Plane codepoint (surrogate pair)\n\t\t\t\tString.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );\n\t},\n\n\t// Used for iframes\n\t// See setDocument()\n\t// Removing the function wrapper causes a \"Permission Denied\"\n\t// error in IE\n\tunloadHandler = function() {\n\t\tsetDocument();\n\t};\n\n// Optimize for push.apply( _, NodeList )\ntry {\n\tpush.apply(\n\t\t(arr = slice.call( preferredDoc.childNodes )),\n\t\tpreferredDoc.childNodes\n\t);\n\t// Support: Android<4.0\n\t// Detect silently failing push.apply\n\tarr[ preferredDoc.childNodes.length ].nodeType;\n} catch ( e ) {\n\tpush = { apply: arr.length ?\n\n\t\t// Leverage slice if possible\n\t\tfunction( target, els ) {\n\t\t\tpush_native.apply( target, slice.call(els) );\n\t\t} :\n\n\t\t// Support: IE<9\n\t\t// Otherwise append directly\n\t\tfunction( target, els ) {\n\t\t\tvar j = target.length,\n\t\t\t\ti = 0;\n\t\t\t// Can't trust NodeList.length\n\t\t\twhile ( (target[j++] = els[i++]) ) {}\n\t\t\ttarget.length = j - 1;\n\t\t}\n\t};\n}\n\nfunction Sizzle( selector, context, results, seed ) {\n\tvar m, i, elem, nid, nidselect, match, groups, newSelector,\n\t\tnewContext = context && context.ownerDocument,\n\n\t\t// nodeType defaults to 9, since context defaults to document\n\t\tnodeType = context ? context.nodeType : 9;\n\n\tresults = results || [];\n\n\t// Return early from calls with invalid selector or context\n\tif ( typeof selector !== \"string\" || !selector ||\n\t\tnodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {\n\n\t\treturn results;\n\t}\n\n\t// Try to shortcut find operations (as opposed to filters) in HTML documents\n\tif ( !seed ) {\n\n\t\tif ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {\n\t\t\tsetDocument( context );\n\t\t}\n\t\tcontext = context || document;\n\n\t\tif ( documentIsHTML ) {\n\n\t\t\t// If the selector is sufficiently simple, try using a \"get*By*\" DOM method\n\t\t\t// (excepting DocumentFragment context, where the methods don't exist)\n\t\t\tif ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {\n\n\t\t\t\t// ID selector\n\t\t\t\tif ( (m = match[1]) ) {\n\n\t\t\t\t\t// Document context\n\t\t\t\t\tif ( nodeType === 9 ) {\n\t\t\t\t\t\tif ( (elem = context.getElementById( m )) ) {\n\n\t\t\t\t\t\t\t// Support: IE, Opera, Webkit\n\t\t\t\t\t\t\t// TODO: identify versions\n\t\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\t\tif ( elem.id === m ) {\n\t\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// Element context\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// Support: IE, Opera, Webkit\n\t\t\t\t\t\t// TODO: identify versions\n\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\tif ( newContext && (elem = newContext.getElementById( m )) &&\n\t\t\t\t\t\t\tcontains( context, elem ) &&\n\t\t\t\t\t\t\telem.id === m ) {\n\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t// Type selector\n\t\t\t\t} else if ( match[2] ) {\n\t\t\t\t\tpush.apply( results, context.getElementsByTagName( selector ) );\n\t\t\t\t\treturn results;\n\n\t\t\t\t// Class selector\n\t\t\t\t} else if ( (m = match[3]) && support.getElementsByClassName &&\n\t\t\t\t\tcontext.getElementsByClassName ) {\n\n\t\t\t\t\tpush.apply( results, context.getElementsByClassName( m ) );\n\t\t\t\t\treturn results;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Take advantage of querySelectorAll\n\t\t\tif ( support.qsa &&\n\t\t\t\t!compilerCache[ selector + \" \" ] &&\n\t\t\t\t(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {\n\n\t\t\t\tif ( nodeType !== 1 ) {\n\t\t\t\t\tnewContext = context;\n\t\t\t\t\tnewSelector = selector;\n\n\t\t\t\t// qSA looks outside Element context, which is not what we want\n\t\t\t\t// Thanks to Andrew Dupont for this workaround technique\n\t\t\t\t// Support: IE <=8\n\t\t\t\t// Exclude object elements\n\t\t\t\t} else if ( context.nodeName.toLowerCase() !== \"object\" ) {\n\n\t\t\t\t\t// Capture the context ID, setting it first if necessary\n\t\t\t\t\tif ( (nid = context.getAttribute( \"id\" )) ) {\n\t\t\t\t\t\tnid = nid.replace( rescape, \"\\\\$&\" );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.setAttribute( \"id\", (nid = expando) );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prefix every selector in the list\n\t\t\t\t\tgroups = tokenize( selector );\n\t\t\t\t\ti = groups.length;\n\t\t\t\t\tnidselect = ridentifier.test( nid ) ? \"#\" + nid : \"[id='\" + nid + \"']\";\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tgroups[i] = nidselect + \" \" + toSelector( groups[i] );\n\t\t\t\t\t}\n\t\t\t\t\tnewSelector = groups.join( \",\" );\n\n\t\t\t\t\t// Expand context for sibling selectors\n\t\t\t\t\tnewContext = rsibling.test( selector ) && testContext( context.parentNode ) ||\n\t\t\t\t\t\tcontext;\n\t\t\t\t}\n\n\t\t\t\tif ( newSelector ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tpush.apply( results,\n\t\t\t\t\t\t\tnewContext.querySelectorAll( newSelector )\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t} catch ( qsaError ) {\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif ( nid === expando ) {\n\t\t\t\t\t\t\tcontext.removeAttribute( \"id\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// All others\n\treturn select( selector.replace( rtrim, \"$1\" ), context, results, seed );\n}\n\n/**\n * Create key-value caches of limited size\n * @returns {function(string, object)} Returns the Object data after storing it on itself with\n *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n *\tdeleting the oldest entry\n */\nfunction createCache() {\n\tvar keys = [];\n\n\tfunction cache( key, value ) {\n\t\t// Use (key + \" \") to avoid collision with native prototype properties (see Issue #157)\n\t\tif ( keys.push( key + \" \" ) > Expr.cacheLength ) {\n\t\t\t// Only keep the most recent entries\n\t\t\tdelete cache[ keys.shift() ];\n\t\t}\n\t\treturn (cache[ key + \" \" ] = value);\n\t}\n\treturn cache;\n}\n\n/**\n * Mark a function for special use by Sizzle\n * @param {Function} fn The function to mark\n */\nfunction markFunction( fn ) {\n\tfn[ expando ] = true;\n\treturn fn;\n}\n\n/**\n * Support testing using an element\n * @param {Function} fn Passed the created div and expects a boolean result\n */\nfunction assert( fn ) {\n\tvar div = document.createElement(\"div\");\n\n\ttry {\n\t\treturn !!fn( div );\n\t} catch (e) {\n\t\treturn false;\n\t} finally {\n\t\t// Remove from its parent by default\n\t\tif ( div.parentNode ) {\n\t\t\tdiv.parentNode.removeChild( div );\n\t\t}\n\t\t// release memory in IE\n\t\tdiv = null;\n\t}\n}\n\n/**\n * Adds the same handler for all of the specified attrs\n * @param {String} attrs Pipe-separated list of attributes\n * @param {Function} handler The method that will be applied\n */\nfunction addHandle( attrs, handler ) {\n\tvar arr = attrs.split(\"|\"),\n\t\ti = arr.length;\n\n\twhile ( i-- ) {\n\t\tExpr.attrHandle[ arr[i] ] = handler;\n\t}\n}\n\n/**\n * Checks document order of two siblings\n * @param {Element} a\n * @param {Element} b\n * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b\n */\nfunction siblingCheck( a, b ) {\n\tvar cur = b && a,\n\t\tdiff = cur && a.nodeType === 1 && b.nodeType === 1 &&\n\t\t\t( ~b.sourceIndex || MAX_NEGATIVE ) -\n\t\t\t( ~a.sourceIndex || MAX_NEGATIVE );\n\n\t// Use IE sourceIndex if available on both nodes\n\tif ( diff ) {\n\t\treturn diff;\n\t}\n\n\t// Check if b follows a\n\tif ( cur ) {\n\t\twhile ( (cur = cur.nextSibling) ) {\n\t\t\tif ( cur === b ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn a ? 1 : -1;\n}\n\n/**\n * Returns a function to use in pseudos for input types\n * @param {String} type\n */\nfunction createInputPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn name === \"input\" && elem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for buttons\n * @param {String} type\n */\nfunction createButtonPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn (name === \"input\" || name === \"button\") && elem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for positionals\n * @param {Function} fn\n */\nfunction createPositionalPseudo( fn ) {\n\treturn markFunction(function( argument ) {\n\t\targument = +argument;\n\t\treturn markFunction(function( seed, matches ) {\n\t\t\tvar j,\n\t\t\t\tmatchIndexes = fn( [], seed.length, argument ),\n\t\t\t\ti = matchIndexes.length;\n\n\t\t\t// Match elements found at the specified indexes\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( seed[ (j = matchIndexes[i]) ] ) {\n\t\t\t\t\tseed[j] = !(matches[j] = seed[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Checks a node for validity as a Sizzle context\n * @param {Element|Object=} context\n * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value\n */\nfunction testContext( context ) {\n\treturn context && typeof context.getElementsByTagName !== \"undefined\" && context;\n}\n\n// Expose support vars for convenience\nsupport = Sizzle.support = {};\n\n/**\n * Detects XML nodes\n * @param {Element|Object} elem An element or a document\n * @returns {Boolean} True iff elem is a non-HTML XML node\n */\nisXML = Sizzle.isXML = function( elem ) {\n\t// documentElement is verified for cases where it doesn't yet exist\n\t// (such as loading iframes in IE - #4833)\n\tvar documentElement = elem && (elem.ownerDocument || elem).documentElement;\n\treturn documentElement ? documentElement.nodeName !== \"HTML\" : false;\n};\n\n/**\n * Sets document-related variables once based on the current document\n * @param {Element|Object} [doc] An element or document object to use to set the document\n * @returns {Object} Returns the current document\n */\nsetDocument = Sizzle.setDocument = function( node ) {\n\tvar hasCompare, parent,\n\t\tdoc = node ? node.ownerDocument || node : preferredDoc;\n\n\t// Return early if doc is invalid or already selected\n\tif ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {\n\t\treturn document;\n\t}\n\n\t// Update global variables\n\tdocument = doc;\n\tdocElem = document.documentElement;\n\tdocumentIsHTML = !isXML( document );\n\n\t// Support: IE 9-11, Edge\n\t// Accessing iframe documents after unload throws \"permission denied\" errors (jQuery #13936)\n\tif ( (parent = document.defaultView) && parent.top !== parent ) {\n\t\t// Support: IE 11\n\t\tif ( parent.addEventListener ) {\n\t\t\tparent.addEventListener( \"unload\", unloadHandler, false );\n\n\t\t// Support: IE 9 - 10 only\n\t\t} else if ( parent.attachEvent ) {\n\t\t\tparent.attachEvent( \"onunload\", unloadHandler );\n\t\t}\n\t}\n\n\t/* Attributes\n\t---------------------------------------------------------------------- */\n\n\t// Support: IE<8\n\t// Verify that getAttribute really returns attributes and not properties\n\t// (excepting IE8 booleans)\n\tsupport.attributes = assert(function( div ) {\n\t\tdiv.className = \"i\";\n\t\treturn !div.getAttribute(\"className\");\n\t});\n\n\t/* getElement(s)By*\n\t---------------------------------------------------------------------- */\n\n\t// Check if getElementsByTagName(\"*\") returns only elements\n\tsupport.getElementsByTagName = assert(function( div ) {\n\t\tdiv.appendChild( document.createComment(\"\") );\n\t\treturn !div.getElementsByTagName(\"*\").length;\n\t});\n\n\t// Support: IE<9\n\tsupport.getElementsByClassName = rnative.test( document.getElementsByClassName );\n\n\t// Support: IE<10\n\t// Check if getElementById returns elements by name\n\t// The broken getElementById methods don't pick up programatically-set names,\n\t// so use a roundabout getElementsByName test\n\tsupport.getById = assert(function( div ) {\n\t\tdocElem.appendChild( div ).id = expando;\n\t\treturn !document.getElementsByName || !document.getElementsByName( expando ).length;\n\t});\n\n\t// ID find and filter\n\tif ( support.getById ) {\n\t\tExpr.find[\"ID\"] = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== \"undefined\" && documentIsHTML ) {\n\t\t\t\tvar m = context.getElementById( id );\n\t\t\t\treturn m ? [ m ] : [];\n\t\t\t}\n\t\t};\n\t\tExpr.filter[\"ID\"] = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn elem.getAttribute(\"id\") === attrId;\n\t\t\t};\n\t\t};\n\t} else {\n\t\t// Support: IE6/7\n\t\t// getElementById is not reliable as a find shortcut\n\t\tdelete Expr.find[\"ID\"];\n\n\t\tExpr.filter[\"ID\"] = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\tvar node = typeof elem.getAttributeNode !== \"undefined\" &&\n\t\t\t\t\telem.getAttributeNode(\"id\");\n\t\t\t\treturn node && node.value === attrId;\n\t\t\t};\n\t\t};\n\t}\n\n\t// Tag\n\tExpr.find[\"TAG\"] = support.getElementsByTagName ?\n\t\tfunction( tag, context ) {\n\t\t\tif ( typeof context.getElementsByTagName !== \"undefined\" ) {\n\t\t\t\treturn context.getElementsByTagName( tag );\n\n\t\t\t// DocumentFragment nodes don't have gEBTN\n\t\t\t} else if ( support.qsa ) {\n\t\t\t\treturn context.querySelectorAll( tag );\n\t\t\t}\n\t\t} :\n\n\t\tfunction( tag, context ) {\n\t\t\tvar elem,\n\t\t\t\ttmp = [],\n\t\t\t\ti = 0,\n\t\t\t\t// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too\n\t\t\t\tresults = context.getElementsByTagName( tag );\n\n\t\t\t// Filter out possible comments\n\t\t\tif ( tag === \"*\" ) {\n\t\t\t\twhile ( (elem = results[i++]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\ttmp.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t\treturn results;\n\t\t};\n\n\t// Class\n\tExpr.find[\"CLASS\"] = support.getElementsByClassName && function( className, context ) {\n\t\tif ( typeof context.getElementsByClassName !== \"undefined\" && documentIsHTML ) {\n\t\t\treturn context.getElementsByClassName( className );\n\t\t}\n\t};\n\n\t/* QSA/matchesSelector\n\t---------------------------------------------------------------------- */\n\n\t// QSA and matchesSelector support\n\n\t// matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n\trbuggyMatches = [];\n\n\t// qSa(:focus) reports false when true (Chrome 21)\n\t// We allow this because of a bug in IE8/9 that throws an error\n\t// whenever `document.activeElement` is accessed on an iframe\n\t// So, we allow :focus to pass through QSA all the time to avoid the IE error\n\t// See http://bugs.jquery.com/ticket/13378\n\trbuggyQSA = [];\n\n\tif ( (support.qsa = rnative.test( document.querySelectorAll )) ) {\n\t\t// Build QSA regex\n\t\t// Regex strategy adopted from Diego Perini\n\t\tassert(function( div ) {\n\t\t\t// Select is set to empty string on purpose\n\t\t\t// This is to test IE's treatment of not explicitly\n\t\t\t// setting a boolean content attribute,\n\t\t\t// since its presence should be enough\n\t\t\t// http://bugs.jquery.com/ticket/12359\n\t\t\tdocElem.appendChild( div ).innerHTML = \"\" +\n\t\t\t\t\"\";\n\n\t\t\t// Support: IE8, Opera 11-12.16\n\t\t\t// Nothing should be selected when empty strings follow ^= or $= or *=\n\t\t\t// The test attribute must be unknown in Opera but \"safe\" for WinRT\n\t\t\t// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section\n\t\t\tif ( div.querySelectorAll(\"[msallowcapture^='']\").length ) {\n\t\t\t\trbuggyQSA.push( \"[*^$]=\" + whitespace + \"*(?:''|\\\"\\\")\" );\n\t\t\t}\n\n\t\t\t// Support: IE8\n\t\t\t// Boolean attributes and \"value\" are not treated correctly\n\t\t\tif ( !div.querySelectorAll(\"[selected]\").length ) {\n\t\t\t\trbuggyQSA.push( \"\\\\[\" + whitespace + \"*(?:value|\" + booleans + \")\" );\n\t\t\t}\n\n\t\t\t// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+\n\t\t\tif ( !div.querySelectorAll( \"[id~=\" + expando + \"-]\" ).length ) {\n\t\t\t\trbuggyQSA.push(\"~=\");\n\t\t\t}\n\n\t\t\t// Webkit/Opera - :checked should return selected option elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( !div.querySelectorAll(\":checked\").length ) {\n\t\t\t\trbuggyQSA.push(\":checked\");\n\t\t\t}\n\n\t\t\t// Support: Safari 8+, iOS 8+\n\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=136851\n\t\t\t// In-page `selector#id sibing-combinator selector` fails\n\t\t\tif ( !div.querySelectorAll( \"a#\" + expando + \"+*\" ).length ) {\n\t\t\t\trbuggyQSA.push(\".#.+[+~]\");\n\t\t\t}\n\t\t});\n\n\t\tassert(function( div ) {\n\t\t\t// Support: Windows 8 Native Apps\n\t\t\t// The type and name attributes are restricted during .innerHTML assignment\n\t\t\tvar input = document.createElement(\"input\");\n\t\t\tinput.setAttribute( \"type\", \"hidden\" );\n\t\t\tdiv.appendChild( input ).setAttribute( \"name\", \"D\" );\n\n\t\t\t// Support: IE8\n\t\t\t// Enforce case-sensitivity of name attribute\n\t\t\tif ( div.querySelectorAll(\"[name=d]\").length ) {\n\t\t\t\trbuggyQSA.push( \"name\" + whitespace + \"*[*^$|!~]?=\" );\n\t\t\t}\n\n\t\t\t// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( !div.querySelectorAll(\":enabled\").length ) {\n\t\t\t\trbuggyQSA.push( \":enabled\", \":disabled\" );\n\t\t\t}\n\n\t\t\t// Opera 10-11 does not throw on post-comma invalid pseudos\n\t\t\tdiv.querySelectorAll(\"*,:x\");\n\t\t\trbuggyQSA.push(\",.*:\");\n\t\t});\n\t}\n\n\tif ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||\n\t\tdocElem.webkitMatchesSelector ||\n\t\tdocElem.mozMatchesSelector ||\n\t\tdocElem.oMatchesSelector ||\n\t\tdocElem.msMatchesSelector) )) ) {\n\n\t\tassert(function( div ) {\n\t\t\t// Check to see if it's possible to do matchesSelector\n\t\t\t// on a disconnected node (IE 9)\n\t\t\tsupport.disconnectedMatch = matches.call( div, \"div\" );\n\n\t\t\t// This should fail with an exception\n\t\t\t// Gecko does not error, returns false instead\n\t\t\tmatches.call( div, \"[s!='']:x\" );\n\t\t\trbuggyMatches.push( \"!=\", pseudos );\n\t\t});\n\t}\n\n\trbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join(\"|\") );\n\trbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join(\"|\") );\n\n\t/* Contains\n\t---------------------------------------------------------------------- */\n\thasCompare = rnative.test( docElem.compareDocumentPosition );\n\n\t// Element contains another\n\t// Purposefully self-exclusive\n\t// As in, an element does not contain itself\n\tcontains = hasCompare || rnative.test( docElem.contains ) ?\n\t\tfunction( a, b ) {\n\t\t\tvar adown = a.nodeType === 9 ? a.documentElement : a,\n\t\t\t\tbup = b && b.parentNode;\n\t\t\treturn a === bup || !!( bup && bup.nodeType === 1 && (\n\t\t\t\tadown.contains ?\n\t\t\t\t\tadown.contains( bup ) :\n\t\t\t\t\ta.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16\n\t\t\t));\n\t\t} :\n\t\tfunction( a, b ) {\n\t\t\tif ( b ) {\n\t\t\t\twhile ( (b = b.parentNode) ) {\n\t\t\t\t\tif ( b === a ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\n\t/* Sorting\n\t---------------------------------------------------------------------- */\n\n\t// Document order sorting\n\tsortOrder = hasCompare ?\n\tfunction( a, b ) {\n\n\t\t// Flag for duplicate removal\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\t// Sort on method existence if only one input has compareDocumentPosition\n\t\tvar compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n\t\tif ( compare ) {\n\t\t\treturn compare;\n\t\t}\n\n\t\t// Calculate position if both inputs belong to the same document\n\t\tcompare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?\n\t\t\ta.compareDocumentPosition( b ) :\n\n\t\t\t// Otherwise we know they are disconnected\n\t\t\t1;\n\n\t\t// Disconnected nodes\n\t\tif ( compare & 1 ||\n\t\t\t(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {\n\n\t\t\t// Choose the first element that is related to our preferred document\n\t\t\tif ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\t// Maintain original order\n\t\t\treturn sortInput ?\n\t\t\t\t( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :\n\t\t\t\t0;\n\t\t}\n\n\t\treturn compare & 4 ? -1 : 1;\n\t} :\n\tfunction( a, b ) {\n\t\t// Exit early if the nodes are identical\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\taup = a.parentNode,\n\t\t\tbup = b.parentNode,\n\t\t\tap = [ a ],\n\t\t\tbp = [ b ];\n\n\t\t// Parentless nodes are either documents or disconnected\n\t\tif ( !aup || !bup ) {\n\t\t\treturn a === document ? -1 :\n\t\t\t\tb === document ? 1 :\n\t\t\t\taup ? -1 :\n\t\t\t\tbup ? 1 :\n\t\t\t\tsortInput ?\n\t\t\t\t( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :\n\t\t\t\t0;\n\n\t\t// If the nodes are siblings, we can do a quick check\n\t\t} else if ( aup === bup ) {\n\t\t\treturn siblingCheck( a, b );\n\t\t}\n\n\t\t// Otherwise we need full lists of their ancestors for comparison\n\t\tcur = a;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tap.unshift( cur );\n\t\t}\n\t\tcur = b;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tbp.unshift( cur );\n\t\t}\n\n\t\t// Walk down the tree looking for a discrepancy\n\t\twhile ( ap[i] === bp[i] ) {\n\t\t\ti++;\n\t\t}\n\n\t\treturn i ?\n\t\t\t// Do a sibling check if the nodes have a common ancestor\n\t\t\tsiblingCheck( ap[i], bp[i] ) :\n\n\t\t\t// Otherwise nodes in our document sort first\n\t\t\tap[i] === preferredDoc ? -1 :\n\t\t\tbp[i] === preferredDoc ? 1 :\n\t\t\t0;\n\t};\n\n\treturn document;\n};\n\nSizzle.matches = function( expr, elements ) {\n\treturn Sizzle( expr, null, null, elements );\n};\n\nSizzle.matchesSelector = function( elem, expr ) {\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\t// Make sure that attribute selectors are quoted\n\texpr = expr.replace( rattributeQuotes, \"='$1']\" );\n\n\tif ( support.matchesSelector && documentIsHTML &&\n\t\t!compilerCache[ expr + \" \" ] &&\n\t\t( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&\n\t\t( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {\n\n\t\ttry {\n\t\t\tvar ret = matches.call( elem, expr );\n\n\t\t\t// IE 9's matchesSelector returns false on disconnected nodes\n\t\t\tif ( ret || support.disconnectedMatch ||\n\t\t\t\t\t// As well, disconnected nodes are said to be in a document\n\t\t\t\t\t// fragment in IE 9\n\t\t\t\t\telem.document && elem.document.nodeType !== 11 ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t} catch (e) {}\n\t}\n\n\treturn Sizzle( expr, document, null, [ elem ] ).length > 0;\n};\n\nSizzle.contains = function( context, elem ) {\n\t// Set document vars if needed\n\tif ( ( context.ownerDocument || context ) !== document ) {\n\t\tsetDocument( context );\n\t}\n\treturn contains( context, elem );\n};\n\nSizzle.attr = function( elem, name ) {\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\tvar fn = Expr.attrHandle[ name.toLowerCase() ],\n\t\t// Don't get fooled by Object.prototype properties (jQuery #13807)\n\t\tval = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?\n\t\t\tfn( elem, name, !documentIsHTML ) :\n\t\t\tundefined;\n\n\treturn val !== undefined ?\n\t\tval :\n\t\tsupport.attributes || !documentIsHTML ?\n\t\t\telem.getAttribute( name ) :\n\t\t\t(val = elem.getAttributeNode(name)) && val.specified ?\n\t\t\t\tval.value :\n\t\t\t\tnull;\n};\n\nSizzle.error = function( msg ) {\n\tthrow new Error( \"Syntax error, unrecognized expression: \" + msg );\n};\n\n/**\n * Document sorting and removing duplicates\n * @param {ArrayLike} results\n */\nSizzle.uniqueSort = function( results ) {\n\tvar elem,\n\t\tduplicates = [],\n\t\tj = 0,\n\t\ti = 0;\n\n\t// Unless we *know* we can detect duplicates, assume their presence\n\thasDuplicate = !support.detectDuplicates;\n\tsortInput = !support.sortStable && results.slice( 0 );\n\tresults.sort( sortOrder );\n\n\tif ( hasDuplicate ) {\n\t\twhile ( (elem = results[i++]) ) {\n\t\t\tif ( elem === results[ i ] ) {\n\t\t\t\tj = duplicates.push( i );\n\t\t\t}\n\t\t}\n\t\twhile ( j-- ) {\n\t\t\tresults.splice( duplicates[ j ], 1 );\n\t\t}\n\t}\n\n\t// Clear input after sorting to release objects\n\t// See https://github.com/jquery/sizzle/pull/225\n\tsortInput = null;\n\n\treturn results;\n};\n\n/**\n * Utility function for retrieving the text value of an array of DOM nodes\n * @param {Array|Element} elem\n */\ngetText = Sizzle.getText = function( elem ) {\n\tvar node,\n\t\tret = \"\",\n\t\ti = 0,\n\t\tnodeType = elem.nodeType;\n\n\tif ( !nodeType ) {\n\t\t// If no nodeType, this is expected to be an array\n\t\twhile ( (node = elem[i++]) ) {\n\t\t\t// Do not traverse comment nodes\n\t\t\tret += getText( node );\n\t\t}\n\t} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\n\t\t// Use textContent for elements\n\t\t// innerText usage removed for consistency of new lines (jQuery #11153)\n\t\tif ( typeof elem.textContent === \"string\" ) {\n\t\t\treturn elem.textContent;\n\t\t} else {\n\t\t\t// Traverse its children\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tret += getText( elem );\n\t\t\t}\n\t\t}\n\t} else if ( nodeType === 3 || nodeType === 4 ) {\n\t\treturn elem.nodeValue;\n\t}\n\t// Do not include comment or processing instruction nodes\n\n\treturn ret;\n};\n\nExpr = Sizzle.selectors = {\n\n\t// Can be adjusted by the user\n\tcacheLength: 50,\n\n\tcreatePseudo: markFunction,\n\n\tmatch: matchExpr,\n\n\tattrHandle: {},\n\n\tfind: {},\n\n\trelative: {\n\t\t\">\": { dir: \"parentNode\", first: true },\n\t\t\" \": { dir: \"parentNode\" },\n\t\t\"+\": { dir: \"previousSibling\", first: true },\n\t\t\"~\": { dir: \"previousSibling\" }\n\t},\n\n\tpreFilter: {\n\t\t\"ATTR\": function( match ) {\n\t\t\tmatch[1] = match[1].replace( runescape, funescape );\n\n\t\t\t// Move the given value to match[3] whether quoted or unquoted\n\t\t\tmatch[3] = ( match[3] || match[4] || match[5] || \"\" ).replace( runescape, funescape );\n\n\t\t\tif ( match[2] === \"~=\" ) {\n\t\t\t\tmatch[3] = \" \" + match[3] + \" \";\n\t\t\t}\n\n\t\t\treturn match.slice( 0, 4 );\n\t\t},\n\n\t\t\"CHILD\": function( match ) {\n\t\t\t/* matches from matchExpr[\"CHILD\"]\n\t\t\t\t1 type (only|nth|...)\n\t\t\t\t2 what (child|of-type)\n\t\t\t\t3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n\t\t\t\t4 xn-component of xn+y argument ([+-]?\\d*n|)\n\t\t\t\t5 sign of xn-component\n\t\t\t\t6 x of xn-component\n\t\t\t\t7 sign of y-component\n\t\t\t\t8 y of y-component\n\t\t\t*/\n\t\t\tmatch[1] = match[1].toLowerCase();\n\n\t\t\tif ( match[1].slice( 0, 3 ) === \"nth\" ) {\n\t\t\t\t// nth-* requires argument\n\t\t\t\tif ( !match[3] ) {\n\t\t\t\t\tSizzle.error( match[0] );\n\t\t\t\t}\n\n\t\t\t\t// numeric x and y parameters for Expr.filter.CHILD\n\t\t\t\t// remember that false/true cast respectively to 0/1\n\t\t\t\tmatch[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === \"even\" || match[3] === \"odd\" ) );\n\t\t\t\tmatch[5] = +( ( match[7] + match[8] ) || match[3] === \"odd\" );\n\n\t\t\t// other types prohibit arguments\n\t\t\t} else if ( match[3] ) {\n\t\t\t\tSizzle.error( match[0] );\n\t\t\t}\n\n\t\t\treturn match;\n\t\t},\n\n\t\t\"PSEUDO\": function( match ) {\n\t\t\tvar excess,\n\t\t\t\tunquoted = !match[6] && match[2];\n\n\t\t\tif ( matchExpr[\"CHILD\"].test( match[0] ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Accept quoted arguments as-is\n\t\t\tif ( match[3] ) {\n\t\t\t\tmatch[2] = match[4] || match[5] || \"\";\n\n\t\t\t// Strip excess characters from unquoted arguments\n\t\t\t} else if ( unquoted && rpseudo.test( unquoted ) &&\n\t\t\t\t// Get excess from tokenize (recursively)\n\t\t\t\t(excess = tokenize( unquoted, true )) &&\n\t\t\t\t// advance to the next closing parenthesis\n\t\t\t\t(excess = unquoted.indexOf( \")\", unquoted.length - excess ) - unquoted.length) ) {\n\n\t\t\t\t// excess is a negative index\n\t\t\t\tmatch[0] = match[0].slice( 0, excess );\n\t\t\t\tmatch[2] = unquoted.slice( 0, excess );\n\t\t\t}\n\n\t\t\t// Return only captures needed by the pseudo filter method (type and argument)\n\t\t\treturn match.slice( 0, 3 );\n\t\t}\n\t},\n\n\tfilter: {\n\n\t\t\"TAG\": function( nodeNameSelector ) {\n\t\t\tvar nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn nodeNameSelector === \"*\" ?\n\t\t\t\tfunction() { return true; } :\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n\t\t\t\t};\n\t\t},\n\n\t\t\"CLASS\": function( className ) {\n\t\t\tvar pattern = classCache[ className + \" \" ];\n\n\t\t\treturn pattern ||\n\t\t\t\t(pattern = new RegExp( \"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\" )) &&\n\t\t\t\tclassCache( className, function( elem ) {\n\t\t\t\t\treturn pattern.test( typeof elem.className === \"string\" && elem.className || typeof elem.getAttribute !== \"undefined\" && elem.getAttribute(\"class\") || \"\" );\n\t\t\t\t});\n\t\t},\n\n\t\t\"ATTR\": function( name, operator, check ) {\n\t\t\treturn function( elem ) {\n\t\t\t\tvar result = Sizzle.attr( elem, name );\n\n\t\t\t\tif ( result == null ) {\n\t\t\t\t\treturn operator === \"!=\";\n\t\t\t\t}\n\t\t\t\tif ( !operator ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tresult += \"\";\n\n\t\t\t\treturn operator === \"=\" ? result === check :\n\t\t\t\t\toperator === \"!=\" ? result !== check :\n\t\t\t\t\toperator === \"^=\" ? check && result.indexOf( check ) === 0 :\n\t\t\t\t\toperator === \"*=\" ? check && result.indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"$=\" ? check && result.slice( -check.length ) === check :\n\t\t\t\t\toperator === \"~=\" ? ( \" \" + result.replace( rwhitespace, \" \" ) + \" \" ).indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"|=\" ? result === check || result.slice( 0, check.length + 1 ) === check + \"-\" :\n\t\t\t\t\tfalse;\n\t\t\t};\n\t\t},\n\n\t\t\"CHILD\": function( type, what, argument, first, last ) {\n\t\t\tvar simple = type.slice( 0, 3 ) !== \"nth\",\n\t\t\t\tforward = type.slice( -4 ) !== \"last\",\n\t\t\t\tofType = what === \"of-type\";\n\n\t\t\treturn first === 1 && last === 0 ?\n\n\t\t\t\t// Shortcut for :nth-*(n)\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn !!elem.parentNode;\n\t\t\t\t} :\n\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tvar cache, uniqueCache, outerCache, node, nodeIndex, start,\n\t\t\t\t\t\tdir = simple !== forward ? \"nextSibling\" : \"previousSibling\",\n\t\t\t\t\t\tparent = elem.parentNode,\n\t\t\t\t\t\tname = ofType && elem.nodeName.toLowerCase(),\n\t\t\t\t\t\tuseCache = !xml && !ofType,\n\t\t\t\t\t\tdiff = false;\n\n\t\t\t\t\tif ( parent ) {\n\n\t\t\t\t\t\t// :(first|last|only)-(child|of-type)\n\t\t\t\t\t\tif ( simple ) {\n\t\t\t\t\t\t\twhile ( dir ) {\n\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\twhile ( (node = node[ dir ]) ) {\n\t\t\t\t\t\t\t\t\tif ( ofType ?\n\t\t\t\t\t\t\t\t\t\tnode.nodeName.toLowerCase() === name :\n\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) {\n\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Reverse direction for :only-* (if we haven't yet done so)\n\t\t\t\t\t\t\t\tstart = dir = type === \"only\" && !start && \"nextSibling\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart = [ forward ? parent.firstChild : parent.lastChild ];\n\n\t\t\t\t\t\t// non-xml :nth-child(...) stores cache data on `parent`\n\t\t\t\t\t\tif ( forward && useCache ) {\n\n\t\t\t\t\t\t\t// Seek `elem` from a previously-cached index\n\n\t\t\t\t\t\t\t// ...in a gzip-friendly way\n\t\t\t\t\t\t\tnode = parent;\n\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\n\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\n\t\t\t\t\t\t\tcache = uniqueCache[ type ] || [];\n\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\tdiff = nodeIndex && cache[ 2 ];\n\t\t\t\t\t\t\tnode = nodeIndex && parent.childNodes[ nodeIndex ];\n\n\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\n\t\t\t\t\t\t\t\t// Fallback to seeking `elem` from the start\n\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\t// When found, cache indexes on `parent` and break\n\t\t\t\t\t\t\t\tif ( node.nodeType === 1 && ++diff && node === elem ) {\n\t\t\t\t\t\t\t\t\tuniqueCache[ type ] = [ dirruns, nodeIndex, diff ];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Use previously-cached element index if available\n\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t// ...in a gzip-friendly way\n\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\n\t\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\n\t\t\t\t\t\t\t\tcache = uniqueCache[ type ] || [];\n\t\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\t\tdiff = nodeIndex;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// xml :nth-child(...)\n\t\t\t\t\t\t\t// or :nth-last-child(...) or :nth(-last)?-of-type(...)\n\t\t\t\t\t\t\tif ( diff === false ) {\n\t\t\t\t\t\t\t\t// Use the same loop as above to seek `elem` from the start\n\t\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\t\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\t\tif ( ( ofType ?\n\t\t\t\t\t\t\t\t\t\tnode.nodeName.toLowerCase() === name :\n\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) &&\n\t\t\t\t\t\t\t\t\t\t++diff ) {\n\n\t\t\t\t\t\t\t\t\t\t// Cache the index of each encountered element\n\t\t\t\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\n\t\t\t\t\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\n\t\t\t\t\t\t\t\t\t\t\tuniqueCache[ type ] = [ dirruns, diff ];\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tif ( node === elem ) {\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Incorporate the offset, then check against cycle size\n\t\t\t\t\t\tdiff -= last;\n\t\t\t\t\t\treturn diff === first || ( diff % first === 0 && diff / first >= 0 );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t},\n\n\t\t\"PSEUDO\": function( pseudo, argument ) {\n\t\t\t// pseudo-class names are case-insensitive\n\t\t\t// http://www.w3.org/TR/selectors/#pseudo-classes\n\t\t\t// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n\t\t\t// Remember that setFilters inherits from pseudos\n\t\t\tvar args,\n\t\t\t\tfn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\n\t\t\t\t\tSizzle.error( \"unsupported pseudo: \" + pseudo );\n\n\t\t\t// The user may use createPseudo to indicate that\n\t\t\t// arguments are needed to create the filter function\n\t\t\t// just as Sizzle does\n\t\t\tif ( fn[ expando ] ) {\n\t\t\t\treturn fn( argument );\n\t\t\t}\n\n\t\t\t// But maintain support for old signatures\n\t\t\tif ( fn.length > 1 ) {\n\t\t\t\targs = [ pseudo, pseudo, \"\", argument ];\n\t\t\t\treturn Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\n\t\t\t\t\tmarkFunction(function( seed, matches ) {\n\t\t\t\t\t\tvar idx,\n\t\t\t\t\t\t\tmatched = fn( seed, argument ),\n\t\t\t\t\t\t\ti = matched.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tidx = indexOf( seed, matched[i] );\n\t\t\t\t\t\t\tseed[ idx ] = !( matches[ idx ] = matched[i] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}) :\n\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\treturn fn( elem, 0, args );\n\t\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn fn;\n\t\t}\n\t},\n\n\tpseudos: {\n\t\t// Potentially complex pseudos\n\t\t\"not\": markFunction(function( selector ) {\n\t\t\t// Trim the selector passed to compile\n\t\t\t// to avoid treating leading and trailing\n\t\t\t// spaces as combinators\n\t\t\tvar input = [],\n\t\t\t\tresults = [],\n\t\t\t\tmatcher = compile( selector.replace( rtrim, \"$1\" ) );\n\n\t\t\treturn matcher[ expando ] ?\n\t\t\t\tmarkFunction(function( seed, matches, context, xml ) {\n\t\t\t\t\tvar elem,\n\t\t\t\t\t\tunmatched = matcher( seed, null, xml, [] ),\n\t\t\t\t\t\ti = seed.length;\n\n\t\t\t\t\t// Match elements unmatched by `matcher`\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = unmatched[i]) ) {\n\t\t\t\t\t\t\tseed[i] = !(matches[i] = elem);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}) :\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tinput[0] = elem;\n\t\t\t\t\tmatcher( input, null, xml, results );\n\t\t\t\t\t// Don't keep the element (issue #299)\n\t\t\t\t\tinput[0] = null;\n\t\t\t\t\treturn !results.pop();\n\t\t\t\t};\n\t\t}),\n\n\t\t\"has\": markFunction(function( selector ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn Sizzle( selector, elem ).length > 0;\n\t\t\t};\n\t\t}),\n\n\t\t\"contains\": markFunction(function( text ) {\n\t\t\ttext = text.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;\n\t\t\t};\n\t\t}),\n\n\t\t// \"Whether an element is represented by a :lang() selector\n\t\t// is based solely on the element's language value\n\t\t// being equal to the identifier C,\n\t\t// or beginning with the identifier C immediately followed by \"-\".\n\t\t// The matching of C against the element's language value is performed case-insensitively.\n\t\t// The identifier C does not have to be a valid language name.\"\n\t\t// http://www.w3.org/TR/selectors/#lang-pseudo\n\t\t\"lang\": markFunction( function( lang ) {\n\t\t\t// lang value must be a valid identifier\n\t\t\tif ( !ridentifier.test(lang || \"\") ) {\n\t\t\t\tSizzle.error( \"unsupported lang: \" + lang );\n\t\t\t}\n\t\t\tlang = lang.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn function( elem ) {\n\t\t\t\tvar elemLang;\n\t\t\t\tdo {\n\t\t\t\t\tif ( (elemLang = documentIsHTML ?\n\t\t\t\t\t\telem.lang :\n\t\t\t\t\t\telem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\")) ) {\n\n\t\t\t\t\t\telemLang = elemLang.toLowerCase();\n\t\t\t\t\t\treturn elemLang === lang || elemLang.indexOf( lang + \"-\" ) === 0;\n\t\t\t\t\t}\n\t\t\t\t} while ( (elem = elem.parentNode) && elem.nodeType === 1 );\n\t\t\t\treturn false;\n\t\t\t};\n\t\t}),\n\n\t\t// Miscellaneous\n\t\t\"target\": function( elem ) {\n\t\t\tvar hash = window.location && window.location.hash;\n\t\t\treturn hash && hash.slice( 1 ) === elem.id;\n\t\t},\n\n\t\t\"root\": function( elem ) {\n\t\t\treturn elem === docElem;\n\t\t},\n\n\t\t\"focus\": function( elem ) {\n\t\t\treturn elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n\t\t},\n\n\t\t// Boolean properties\n\t\t\"enabled\": function( elem ) {\n\t\t\treturn elem.disabled === false;\n\t\t},\n\n\t\t\"disabled\": function( elem ) {\n\t\t\treturn elem.disabled === true;\n\t\t},\n\n\t\t\"checked\": function( elem ) {\n\t\t\t// In CSS3, :checked should return both checked and selected elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\tvar nodeName = elem.nodeName.toLowerCase();\n\t\t\treturn (nodeName === \"input\" && !!elem.checked) || (nodeName === \"option\" && !!elem.selected);\n\t\t},\n\n\t\t\"selected\": function( elem ) {\n\t\t\t// Accessing this property makes selected-by-default\n\t\t\t// options in Safari work properly\n\t\t\tif ( elem.parentNode ) {\n\t\t\t\telem.parentNode.selectedIndex;\n\t\t\t}\n\n\t\t\treturn elem.selected === true;\n\t\t},\n\n\t\t// Contents\n\t\t\"empty\": function( elem ) {\n\t\t\t// http://www.w3.org/TR/selectors/#empty-pseudo\n\t\t\t// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),\n\t\t\t// but not by others (comment: 8; processing instruction: 7; etc.)\n\t\t\t// nodeType < 6 works because attributes (2) do not appear as children\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tif ( elem.nodeType < 6 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\t\"parent\": function( elem ) {\n\t\t\treturn !Expr.pseudos[\"empty\"]( elem );\n\t\t},\n\n\t\t// Element/input types\n\t\t\"header\": function( elem ) {\n\t\t\treturn rheader.test( elem.nodeName );\n\t\t},\n\n\t\t\"input\": function( elem ) {\n\t\t\treturn rinputs.test( elem.nodeName );\n\t\t},\n\n\t\t\"button\": function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn name === \"input\" && elem.type === \"button\" || name === \"button\";\n\t\t},\n\n\t\t\"text\": function( elem ) {\n\t\t\tvar attr;\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" &&\n\t\t\t\telem.type === \"text\" &&\n\n\t\t\t\t// Support: IE<8\n\t\t\t\t// New HTML5 attribute values (e.g., \"search\") appear with elem.type === \"text\"\n\t\t\t\t( (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === \"text\" );\n\t\t},\n\n\t\t// Position-in-collection\n\t\t\"first\": createPositionalPseudo(function() {\n\t\t\treturn [ 0 ];\n\t\t}),\n\n\t\t\"last\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\treturn [ length - 1 ];\n\t\t}),\n\n\t\t\"eq\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\treturn [ argument < 0 ? argument + length : argument ];\n\t\t}),\n\n\t\t\"even\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"odd\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 1;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"lt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; --i >= 0; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"gt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; ++i < length; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t})\n\t}\n};\n\nExpr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n\n// Add button/input type pseudos\nfor ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {\n\tExpr.pseudos[ i ] = createInputPseudo( i );\n}\nfor ( i in { submit: true, reset: true } ) {\n\tExpr.pseudos[ i ] = createButtonPseudo( i );\n}\n\n// Easy API for creating new setFilters\nfunction setFilters() {}\nsetFilters.prototype = Expr.filters = Expr.pseudos;\nExpr.setFilters = new setFilters();\n\ntokenize = Sizzle.tokenize = function( selector, parseOnly ) {\n\tvar matched, match, tokens, type,\n\t\tsoFar, groups, preFilters,\n\t\tcached = tokenCache[ selector + \" \" ];\n\n\tif ( cached ) {\n\t\treturn parseOnly ? 0 : cached.slice( 0 );\n\t}\n\n\tsoFar = selector;\n\tgroups = [];\n\tpreFilters = Expr.preFilter;\n\n\twhile ( soFar ) {\n\n\t\t// Comma and first run\n\t\tif ( !matched || (match = rcomma.exec( soFar )) ) {\n\t\t\tif ( match ) {\n\t\t\t\t// Don't consume trailing commas as valid\n\t\t\t\tsoFar = soFar.slice( match[0].length ) || soFar;\n\t\t\t}\n\t\t\tgroups.push( (tokens = []) );\n\t\t}\n\n\t\tmatched = false;\n\n\t\t// Combinators\n\t\tif ( (match = rcombinators.exec( soFar )) ) {\n\t\t\tmatched = match.shift();\n\t\t\ttokens.push({\n\t\t\t\tvalue: matched,\n\t\t\t\t// Cast descendant combinators to space\n\t\t\t\ttype: match[0].replace( rtrim, \" \" )\n\t\t\t});\n\t\t\tsoFar = soFar.slice( matched.length );\n\t\t}\n\n\t\t// Filters\n\t\tfor ( type in Expr.filter ) {\n\t\t\tif ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||\n\t\t\t\t(match = preFilters[ type ]( match ))) ) {\n\t\t\t\tmatched = match.shift();\n\t\t\t\ttokens.push({\n\t\t\t\t\tvalue: matched,\n\t\t\t\t\ttype: type,\n\t\t\t\t\tmatches: match\n\t\t\t\t});\n\t\t\t\tsoFar = soFar.slice( matched.length );\n\t\t\t}\n\t\t}\n\n\t\tif ( !matched ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Return the length of the invalid excess\n\t// if we're just parsing\n\t// Otherwise, throw an error or return tokens\n\treturn parseOnly ?\n\t\tsoFar.length :\n\t\tsoFar ?\n\t\t\tSizzle.error( selector ) :\n\t\t\t// Cache the tokens\n\t\t\ttokenCache( selector, groups ).slice( 0 );\n};\n\nfunction toSelector( tokens ) {\n\tvar i = 0,\n\t\tlen = tokens.length,\n\t\tselector = \"\";\n\tfor ( ; i < len; i++ ) {\n\t\tselector += tokens[i].value;\n\t}\n\treturn selector;\n}\n\nfunction addCombinator( matcher, combinator, base ) {\n\tvar dir = combinator.dir,\n\t\tcheckNonElements = base && dir === \"parentNode\",\n\t\tdoneName = done++;\n\n\treturn combinator.first ?\n\t\t// Check against closest ancestor/preceding element\n\t\tfunction( elem, context, xml ) {\n\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\treturn matcher( elem, context, xml );\n\t\t\t\t}\n\t\t\t}\n\t\t} :\n\n\t\t// Check against all ancestor/preceding elements\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar oldCache, uniqueCache, outerCache,\n\t\t\t\tnewCache = [ dirruns, doneName ];\n\n\t\t\t// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching\n\t\t\tif ( xml ) {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\touterCache = elem[ expando ] || (elem[ expando ] = {});\n\n\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\tuniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});\n\n\t\t\t\t\t\tif ( (oldCache = uniqueCache[ dir ]) &&\n\t\t\t\t\t\t\toldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {\n\n\t\t\t\t\t\t\t// Assign to newCache so results back-propagate to previous elements\n\t\t\t\t\t\t\treturn (newCache[ 2 ] = oldCache[ 2 ]);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Reuse newcache so results back-propagate to previous elements\n\t\t\t\t\t\t\tuniqueCache[ dir ] = newCache;\n\n\t\t\t\t\t\t\t// A match means we're done; a fail means we have to keep checking\n\t\t\t\t\t\t\tif ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n}\n\nfunction elementMatcher( matchers ) {\n\treturn matchers.length > 1 ?\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar i = matchers.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( !matchers[i]( elem, context, xml ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} :\n\t\tmatchers[0];\n}\n\nfunction multipleContexts( selector, contexts, results ) {\n\tvar i = 0,\n\t\tlen = contexts.length;\n\tfor ( ; i < len; i++ ) {\n\t\tSizzle( selector, contexts[i], results );\n\t}\n\treturn results;\n}\n\nfunction condense( unmatched, map, filter, context, xml ) {\n\tvar elem,\n\t\tnewUnmatched = [],\n\t\ti = 0,\n\t\tlen = unmatched.length,\n\t\tmapped = map != null;\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (elem = unmatched[i]) ) {\n\t\t\tif ( !filter || filter( elem, context, xml ) ) {\n\t\t\t\tnewUnmatched.push( elem );\n\t\t\t\tif ( mapped ) {\n\t\t\t\t\tmap.push( i );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn newUnmatched;\n}\n\nfunction setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\n\tif ( postFilter && !postFilter[ expando ] ) {\n\t\tpostFilter = setMatcher( postFilter );\n\t}\n\tif ( postFinder && !postFinder[ expando ] ) {\n\t\tpostFinder = setMatcher( postFinder, postSelector );\n\t}\n\treturn markFunction(function( seed, results, context, xml ) {\n\t\tvar temp, i, elem,\n\t\t\tpreMap = [],\n\t\t\tpostMap = [],\n\t\t\tpreexisting = results.length,\n\n\t\t\t// Get initial elements from seed or context\n\t\t\telems = seed || multipleContexts( selector || \"*\", context.nodeType ? [ context ] : context, [] ),\n\n\t\t\t// Prefilter to get matcher input, preserving a map for seed-results synchronization\n\t\t\tmatcherIn = preFilter && ( seed || !selector ) ?\n\t\t\t\tcondense( elems, preMap, preFilter, context, xml ) :\n\t\t\t\telems,\n\n\t\t\tmatcherOut = matcher ?\n\t\t\t\t// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n\t\t\t\tpostFinder || ( seed ? preFilter : preexisting || postFilter ) ?\n\n\t\t\t\t\t// ...intermediate processing is necessary\n\t\t\t\t\t[] :\n\n\t\t\t\t\t// ...otherwise use results directly\n\t\t\t\t\tresults :\n\t\t\t\tmatcherIn;\n\n\t\t// Find primary matches\n\t\tif ( matcher ) {\n\t\t\tmatcher( matcherIn, matcherOut, context, xml );\n\t\t}\n\n\t\t// Apply postFilter\n\t\tif ( postFilter ) {\n\t\t\ttemp = condense( matcherOut, postMap );\n\t\t\tpostFilter( temp, [], context, xml );\n\n\t\t\t// Un-match failing elements by moving them back to matcherIn\n\t\t\ti = temp.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( (elem = temp[i]) ) {\n\t\t\t\t\tmatcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( seed ) {\n\t\t\tif ( postFinder || preFilter ) {\n\t\t\t\tif ( postFinder ) {\n\t\t\t\t\t// Get the final matcherOut by condensing this intermediate into postFinder contexts\n\t\t\t\t\ttemp = [];\n\t\t\t\t\ti = matcherOut.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = matcherOut[i]) ) {\n\t\t\t\t\t\t\t// Restore matcherIn since elem is not yet a final match\n\t\t\t\t\t\t\ttemp.push( (matcherIn[i] = elem) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tpostFinder( null, (matcherOut = []), temp, xml );\n\t\t\t\t}\n\n\t\t\t\t// Move matched elements from seed to results to keep them synchronized\n\t\t\t\ti = matcherOut.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( (elem = matcherOut[i]) &&\n\t\t\t\t\t\t(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {\n\n\t\t\t\t\t\tseed[temp] = !(results[temp] = elem);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Add elements to results, through postFinder if defined\n\t\t} else {\n\t\t\tmatcherOut = condense(\n\t\t\t\tmatcherOut === results ?\n\t\t\t\t\tmatcherOut.splice( preexisting, matcherOut.length ) :\n\t\t\t\t\tmatcherOut\n\t\t\t);\n\t\t\tif ( postFinder ) {\n\t\t\t\tpostFinder( null, results, matcherOut, xml );\n\t\t\t} else {\n\t\t\t\tpush.apply( results, matcherOut );\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction matcherFromTokens( tokens ) {\n\tvar checkContext, matcher, j,\n\t\tlen = tokens.length,\n\t\tleadingRelative = Expr.relative[ tokens[0].type ],\n\t\timplicitRelative = leadingRelative || Expr.relative[\" \"],\n\t\ti = leadingRelative ? 1 : 0,\n\n\t\t// The foundational matcher ensures that elements are reachable from top-level context(s)\n\t\tmatchContext = addCombinator( function( elem ) {\n\t\t\treturn elem === checkContext;\n\t\t}, implicitRelative, true ),\n\t\tmatchAnyContext = addCombinator( function( elem ) {\n\t\t\treturn indexOf( checkContext, elem ) > -1;\n\t\t}, implicitRelative, true ),\n\t\tmatchers = [ function( elem, context, xml ) {\n\t\t\tvar ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (\n\t\t\t\t(checkContext = context).nodeType ?\n\t\t\t\t\tmatchContext( elem, context, xml ) :\n\t\t\t\t\tmatchAnyContext( elem, context, xml ) );\n\t\t\t// Avoid hanging onto element (issue #299)\n\t\t\tcheckContext = null;\n\t\t\treturn ret;\n\t\t} ];\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (matcher = Expr.relative[ tokens[i].type ]) ) {\n\t\t\tmatchers = [ addCombinator(elementMatcher( matchers ), matcher) ];\n\t\t} else {\n\t\t\tmatcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );\n\n\t\t\t// Return special upon seeing a positional matcher\n\t\t\tif ( matcher[ expando ] ) {\n\t\t\t\t// Find the next relative operator (if any) for proper handling\n\t\t\t\tj = ++i;\n\t\t\t\tfor ( ; j < len; j++ ) {\n\t\t\t\t\tif ( Expr.relative[ tokens[j].type ] ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn setMatcher(\n\t\t\t\t\ti > 1 && elementMatcher( matchers ),\n\t\t\t\t\ti > 1 && toSelector(\n\t\t\t\t\t\t// If the preceding token was a descendant combinator, insert an implicit any-element `*`\n\t\t\t\t\t\ttokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === \" \" ? \"*\" : \"\" })\n\t\t\t\t\t).replace( rtrim, \"$1\" ),\n\t\t\t\t\tmatcher,\n\t\t\t\t\ti < j && matcherFromTokens( tokens.slice( i, j ) ),\n\t\t\t\t\tj < len && matcherFromTokens( (tokens = tokens.slice( j )) ),\n\t\t\t\t\tj < len && toSelector( tokens )\n\t\t\t\t);\n\t\t\t}\n\t\t\tmatchers.push( matcher );\n\t\t}\n\t}\n\n\treturn elementMatcher( matchers );\n}\n\nfunction matcherFromGroupMatchers( elementMatchers, setMatchers ) {\n\tvar bySet = setMatchers.length > 0,\n\t\tbyElement = elementMatchers.length > 0,\n\t\tsuperMatcher = function( seed, context, xml, results, outermost ) {\n\t\t\tvar elem, j, matcher,\n\t\t\t\tmatchedCount = 0,\n\t\t\t\ti = \"0\",\n\t\t\t\tunmatched = seed && [],\n\t\t\t\tsetMatched = [],\n\t\t\t\tcontextBackup = outermostContext,\n\t\t\t\t// We must always have either seed elements or outermost context\n\t\t\t\telems = seed || byElement && Expr.find[\"TAG\"]( \"*\", outermost ),\n\t\t\t\t// Use integer dirruns iff this is the outermost matcher\n\t\t\t\tdirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),\n\t\t\t\tlen = elems.length;\n\n\t\t\tif ( outermost ) {\n\t\t\t\toutermostContext = context === document || context || outermost;\n\t\t\t}\n\n\t\t\t// Add elements passing elementMatchers directly to results\n\t\t\t// Support: IE<9, Safari\n\t\t\t// Tolerate NodeList properties (IE: \"length\"; Safari: