').addClass('arrow').addClass(feedback.vertical).addClass(feedback.horizontal).appendTo(this);\n }\n },\n items: 'rect, .tooltip-item',\n show: false,\n hide: false,\n content: function content() {\n var title = $(this).attr('title');\n if (!title) return false;\n var parsedHTML = $.parseHTML(title);\n return parsedHTML;\n }\n });\n\n /**\n * Returns true / false if any modal is active.\n */\n $.modalActive = function () {\n var active = false;\n $('.modal').each(function () {\n var modal = $(this).data('bs.modal');\n if (modal) {\n active = modal.isShown;\n return !active;\n }\n });\n return active;\n };\n\n /**\n * Wiggle an element.\n *\n * Used for wiggling BLAST button.\n */\n $.fn.wiggle = function () {\n this.finish().effect('bounce', {\n direction: 'left',\n distance: 24,\n times: 4\n }, 250);\n };\n})(jQuery);","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport * as d3 from 'd3';\nimport _ from 'underscore';\nimport Grapher from 'grapher';\nimport * as Helpers from './visualisation_helpers';\n\n/**\n * Renders Kablammo visualization\n *\n * JSON received from server side is modified as JSON expected by kablammo's\n * graph.js. All the relevant information including a SVG container where\n * visual needs to be rendered, is delegated to graph.js. graph.js renders\n * kablammo visualization and has all event handlers for events performed on\n * the visual.\n *\n * Event handlers related to downloading and viewing of alignments and images\n * have been extracted from grapher.js and interface.js and directly included\n * here.\n */\nvar Graph = /*#__PURE__*/function () {\n function Graph($svgContainer, props) {\n _classCallCheck(this, Graph);\n this._zoom_scale_by = 1.4;\n this._padding_x = 12;\n this._padding_y = 50;\n this._canvas_height = $svgContainer.height();\n this._canvas_width = $svgContainer.width();\n this._results = Helpers.get_seq_type(props.algorithm);\n this._query_id = props.query.id;\n this._subject_id = props.hit.id;\n this._query_length = props.query.length;\n this._subject_length = props.hit.length;\n this._show_numbers = props.showHSPCrumbs;\n // this._hsps = this.toKablammo(props.hit.hsps, props.query);\n this._hsps = props.hit.hsps;\n this._maxBitScore = props.query.hits[0].hsps[0].bit_score;\n this.svgContainer_d3 = d3.select($svgContainer[0]);\n this._svg = {};\n this._svg.jq = $(this._svg.raw);\n this._scales = this._create_scales();\n this.use_complement_coords = false;\n this._axis_ticks = 10;\n this._initiate();\n this.bindHoverHandler($svgContainer);\n }\n return _createClass(Graph, [{\n key: \"bindHoverHandler\",\n value: function bindHoverHandler($svgContainer) {\n // Raise polygon on hover.\n $svgContainer.find('polygon').hover(function () {\n var $g = $(this).parent();\n $g.parent().append($g);\n });\n }\n }, {\n key: \"_initiate\",\n value: function _initiate() {\n this._svg.d3 = this.svgContainer_d3.insert('svg', ':first-child').attr('height', this._canvas_height).attr('width', this._canvas_width);\n this._svg.raw = this._svg.d3._groups[0][0];\n this._render_graph();\n }\n }, {\n key: \"_rotate_axis_labels\",\n value: function _rotate_axis_labels(text, text_anchor, dx, dy) {\n text.style('text-anchor', text_anchor).attr('x', dx).attr('y', dy)\n // When axis orientation is \"bottom\", d3 automataically applies a 0.71em\n // dy offset to labels. As Inkscape does not seem to properly interpret\n // such values, force them to be zero. When calling this function, then,\n // you must compensate by adding 0.71em worth of offset to the dy value\n // you provide.\n .attr('dx', 0).attr('dy', 0).attr('transform', 'rotate(-90)');\n }\n }, {\n key: \"_create_axis\",\n value: function _create_axis(scale, orientation, height, text_anchor, dx, dy, seq_type) {\n var formatter = Helpers.tick_formatter(scale, seq_type);\n var tvalues = scale.ticks();\n var axis;\n tvalues.pop();\n if (orientation === 'top') {\n axis = d3.axisTop(scale);\n } else {\n axis = d3.axisBottom(scale);\n }\n axis.ticks(this._axis_ticks).tickValues(tvalues.concat(scale.domain())).tickFormat(formatter);\n var container = this._svg.d3.append('g').attr('class', 'axis').attr('transform', 'translate(0,' + height + ')').call(axis);\n this._rotate_axis_labels(container.selectAll('text'), text_anchor, dx, dy);\n return container;\n }\n }, {\n key: \"_is_domain_within_orig\",\n value: function _is_domain_within_orig(original_domain, new_domain) {\n return original_domain[0] <= new_domain[0] && original_domain[1] >= new_domain[1];\n }\n }, {\n key: \"_zoom_scale\",\n value: function _zoom_scale(scale, original_domain, zoom_from, scale_by) {\n var l = scale.domain()[0];\n var r = scale.domain()[1];\n l = zoom_from - (zoom_from - l) / scale_by;\n r = zoom_from + (r - zoom_from) / scale_by;\n l = Math.round(l);\n r = Math.round(r);\n if (r - l < this._axis_ticks) return;\n var new_domain = [l, r];\n if (this._is_domain_within_orig(original_domain, new_domain)) scale.domain(new_domain);else scale.domain(original_domain);\n }\n }, {\n key: \"_pan_scale\",\n value: function _pan_scale(existing_scale, original_domain, delta) {\n var scale = (existing_scale.domain()[1] - existing_scale.domain()[0]) / (existing_scale.range()[1] - existing_scale.range()[0]);\n var scaled_delta = -delta * scale;\n var domain = existing_scale.domain();\n var l = domain[0] + scaled_delta;\n var r = domain[1] + scaled_delta;\n var new_domain = [l, r];\n if (this._is_domain_within_orig(original_domain, new_domain)) existing_scale.domain(new_domain);\n }\n }, {\n key: \"_render_polygons\",\n value: function _render_polygons() {\n var self = this;\n\n // Remove all existing child elements.\n this._svg.d3.selectAll('*').remove();\n this._polygons = this._svg.d3.selectAll('polygon').data(this._hsps.slice().reverse()).enter().append('g').attr('class', 'polygon');\n this._polygons.append('polygon').attr('class', 'hit').attr('fill', function (hsp) {\n return self.determine_colour(hsp.bit_score / self._maxBitScore);\n }).attr('points', function (hsp) {\n // We create query_x_points such that the 0th element will *always* be\n // on the left of the 1st element, regardless of whether the axis is\n // drawn normally (i.e., ltr) or reversed (i.e., rtl). We do the same\n // for subject_x_points. As our parsing code guarantees start < end, we\n // decide on this ordering based on the reading frame, because it\n // determines whether our axis will be reversed or not.\n var query_x_points = [self._scales.query.scale(hsp.qstart), self._scales.query.scale(hsp.qend)];\n var subject_x_points = [self._scales.subject.scale(hsp.sstart), self._scales.subject.scale(hsp.send)];\n\n // Axis will be rendered with 5' end on right and 3' end on left, so we\n // must reverse the order of vertices for the polygon we will render to\n // prevent the polygon from \"crossing over\" itself.\n if (!self.use_complement_coords) {\n if (hsp.qframe < 0) query_x_points.reverse();\n if (hsp.sframe < 0) subject_x_points.reverse();\n }\n var points = [[query_x_points[0], self._scales.query.height + 1], [subject_x_points[0], self._scales.subject.height - 1], [subject_x_points[1], self._scales.subject.height - 1], [query_x_points[1], self._scales.query.height + 1]];\n return points.map(function (point) {\n return point[0] + ',' + point[1];\n }).join(' ');\n });\n if (self._show_numbers) {\n this._polygons.append('text').attr('x', function (hsp) {\n var query_x_points = [self._scales.query.scale(hsp.qstart), self._scales.query.scale(hsp.qend)];\n var subject_x_points = [self._scales.subject.scale(hsp.sstart), self._scales.subject.scale(hsp.send)];\n var middle1 = (query_x_points[0] + subject_x_points[0]) * 0.5;\n var middle2 = (query_x_points[1] + subject_x_points[1]) * 0.5;\n return (middle2 + middle1) * 0.5;\n }).attr('y', function (hsp) {\n var a = self._scales.query.height;\n var b = self._scales.subject.height;\n var middle = (b - a) / 2;\n return a + middle + 2; // for font-height 10px\n }).text(function (hsp) {\n return Helpers.toLetters(hsp.number);\n });\n }\n }\n }, {\n key: \"_overlaps\",\n value: function _overlaps(s1, e1, s2, e2) {\n return Math.min(e1, e2) > Math.max(s1, s2);\n }\n }, {\n key: \"_rects_overlap\",\n value: function _rects_overlap(rect1, rect2, padding) {\n padding = padding || 0;\n return this._overlaps(rect1.left - padding, rect1.right + padding, rect2.left, rect2.right) && this._overlaps(rect1.top - padding, rect1.bottom + padding, rect2.top, rect2.bottom);\n }\n }, {\n key: \"_render_axes\",\n value: function _render_axes() {\n var query_axis = this._create_axis(this._scales.query.scale, 'top', this._scales.query.height, 'start', '9px', '2px', this._results.query_seq_type);\n var subject_axis = this._create_axis(this._scales.subject.scale, 'bottom', this._scales.subject.height, 'end', '-11px', '3px', this._results.subject_seq_type);\n }\n }, {\n key: \"_render_graph\",\n value: function _render_graph() {\n this._render_polygons();\n this._render_axes();\n }\n }, {\n key: \"_find_nearest_scale\",\n value: function _find_nearest_scale(point) {\n var nearest = null;\n var smallest_distance = Number.MAX_VALUE;\n var self = this;\n Object.keys(this._scales).forEach(function (scale_name) {\n var scale = self._scales[scale_name].scale;\n var scale_height = self._scales[scale_name].height;\n var delta = Math.abs(scale_height - point[1]);\n if (delta < smallest_distance) {\n nearest = scale;\n smallest_distance = delta;\n }\n });\n return nearest;\n }\n }, {\n key: \"_create_scales\",\n value: function _create_scales() {\n var query_range = [this._padding_x, this._canvas_width - this._padding_x];\n var subject_range = [this._padding_x, this._canvas_width - this._padding_x];\n\n // If we wish to show the HSPs relative to the original (input or DB)\n // sequence rather than its complement (i.e., use_complement_coords = false),\n // even when the HSPs lie on the complement, then we must display the axis\n // with its 5' end on the right and 3' end on the left. In this case, you can\n // imagine the invisible complementary strand (with its 5' end on left and 3'\n // end on right) floating above the rendered original strand, with the hits\n // actually falling on the complementary strand.\n //\n // If we show the HSPs relative to the complementary strand (i.e.,\n // use_complement_coords = true), then we *always* wish to show the axis with\n // its 5' end on the left and 3' end on the right.\n //\n // Regardless of whether this value is true or falase, the rendered polygons\n // will be precisely the same (meaning down to the pixel -- they will be\n // *identical*). Only the direction of the axis, and the coordinates of\n // points falling along it, change.\n if (!this.use_complement_coords) {\n if (this._hsps[0].qframe < 0) query_range.reverse();\n if (this._hsps[0].sframe < 0) subject_range.reverse();\n }\n var query_scale = d3.scaleLinear().domain([1, this._query_length]).range(query_range);\n var subject_scale = d3.scaleLinear().domain([1, this._subject_length]).range(subject_range);\n query_scale.original_domain = query_scale.domain();\n subject_scale.original_domain = subject_scale.domain();\n var query_height = this._padding_y;\n var subject_height = this._canvas_height - this._padding_y;\n var scales = {\n subject: {\n height: subject_height,\n scale: subject_scale\n },\n query: {\n height: query_height,\n scale: query_scale\n }\n };\n return scales;\n }\n }, {\n key: \"_rgba_to_rgb\",\n value: function _rgba_to_rgb(rgba, matte_rgb) {\n // Algorithm taken from http://stackoverflow.com/a/2049362/1691611.\n var normalize = function normalize(colour) {\n return colour.map(function (channel) {\n return channel / 255;\n });\n };\n var denormalize = function denormalize(colour) {\n return colour.map(function (channel) {\n return Math.round(Math.min(255, channel * 255));\n });\n };\n var norm = normalize(rgba.slice(0, 3));\n matte_rgb = normalize(matte_rgb);\n var alpha = rgba[3] / 255;\n var rgb = [alpha * norm[0] + (1 - alpha) * matte_rgb[0], alpha * norm[1] + (1 - alpha) * matte_rgb[1], alpha * norm[2] + (1 - alpha) * matte_rgb[2]];\n return denormalize(rgb);\n }\n\n /**\n * Determines colour of a hsp based on normalized bit-score.\n *\n * Taken from grapher.js\n */\n }, {\n key: \"determine_colour\",\n value: function determine_colour(level) {\n var graph_colour = {\n r: 199,\n g: 79,\n b: 20\n };\n var matte_colour = {\n r: 255,\n g: 255,\n b: 255\n };\n var min_opacity = 0.3;\n var opacity = (1 - min_opacity) * level + min_opacity;\n var rgb = this._rgba_to_rgb([graph_colour.r, graph_colour.g, graph_colour.b, 255 * opacity], [matte_colour.r, matte_colour.g, matte_colour.b]);\n return 'rgb(' + rgb.join(',') + ')';\n }\n }], [{\n key: \"canCollapse\",\n value: function canCollapse() {\n return true;\n }\n }, {\n key: \"name\",\n value: function name() {\n return 'Graphical overview of aligning region(s)';\n }\n }, {\n key: \"className\",\n value: function className() {\n return 'kablammo';\n }\n }, {\n key: \"graphId\",\n value: function graphId(props) {\n return 'kablammo_' + props.query.number + '_' + props.hit.number;\n }\n }, {\n key: \"dataName\",\n value: function dataName(props) {\n return \"Kablammo_query-\".concat(props.query.number, \"_\").concat(props.query.id, \"_\").concat(props.hit.id);\n }\n }]);\n}();\nvar Kablammo = Grapher(Graph);\nexport default Kablammo;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport * as d3 from 'd3';\nimport _ from 'underscore';\nimport Grapher from 'grapher';\nimport * as Helpers from './visualisation_helpers';\n\n/**\n * Renders Length Distribution of all hits per query\n */\nvar Graph = /*#__PURE__*/function () {\n function Graph($svg_container, props) {\n _classCallCheck(this, Graph);\n this.query = props.query;\n this._seq_type = Helpers.get_seq_type(props.algorithm);\n this.svg_container = $svg_container;\n if (props.algorithm == 'blastx') {\n this.query_length = this.query.length / 3;\n } else if (props.algorithm == 'tblastn') {\n this.query_length = this.query.length * 3;\n } else {\n this.query_length = this.query.length;\n }\n this._margin = {\n top: 30,\n right: 25,\n bottom: 55,\n left: 12.5\n };\n this.initiate($svg_container.width(), $svg_container.height());\n }\n return _createClass(Graph, [{\n key: \"initiate\",\n value: function initiate(width, height) {\n this._width = width - this._margin.left - this._margin.right;\n this._height = height - this._margin.top - this._margin.bottom;\n this.svg = d3.select(this.svg_container[0]).insert('svg', ':first-child').attr('width', this._width + this._margin.right + this._margin.left).attr('height', this._height + this._margin.top + this._margin.bottom).append('g').attr('transform', 'translate(' + this._margin.left + ',' + this._margin.top + ')');\n this.hit_lengths();\n this.define_scale_and_bins();\n this.update_data();\n this.draw();\n }\n }, {\n key: \"draw\",\n value: function draw() {\n this.draw_rectangles();\n this.draw_query_line();\n this.draw_axes();\n }\n }, {\n key: \"define_scale_and_bins\",\n value: function define_scale_and_bins() {\n this._scale_x = d3.scaleLinear().domain([0, d3.max([this.query_length, d3.max(this._data)]) * 1.01]).nice().range([0, this._width]);\n this._bins = d3.bin().domain(this._scale_x.domain()).thresholds(this._scale_x.ticks(50))(this._data);\n this._scale_y = d3.scaleLinear().domain([0, d3.max(this._bins, function (d) {\n return d.length;\n })]).range([this._height, 0]).nice();\n }\n }, {\n key: \"hit_lengths\",\n value: function hit_lengths() {\n this._data = _.map(this.query.hits, _.iteratee('length'));\n }\n }, {\n key: \"setupResponsiveness\",\n value: function setupResponsiveness() {\n var currentWidth = $(window).width();\n console.log('cureent ' + currentWidth);\n var debounced_draw = _.debounce(_.bind(function () {\n if (currentWidth != $(window).width()) {\n console.log('redraw initiated ' + this._height);\n this.draw();\n currentWidth = $(window).width();\n }\n }, this), 125);\n $(window).resize(debounced_draw);\n }\n }, {\n key: \"tick_formatter\",\n value: function tick_formatter(seq_type) {\n var ticks = this._scale_x.ticks();\n var prefix = d3.format('~s');\n var suffixes = {\n amino_acid: 'aa',\n nucleic_acid: 'bp'\n };\n return function (d) {\n if (d === 0) {\n return;\n }\n if (_.indexOf(ticks, d) >= 0) {\n if (suffixes[seq_type] == 'aa') {\n return \"\".concat(d, \" \").concat(suffixes[seq_type]);\n } else {\n return \"\".concat(prefix(d)).concat(suffixes[seq_type]).replace(/([a-zA-Z]+)/, ' $1');\n }\n } else {\n return;\n }\n };\n }\n }, {\n key: \"update_data\",\n value: function update_data() {\n var self = this;\n var data2 = [];\n this._bins.map(function (bin) {\n var inner_data = [];\n bin.reverse();\n var y0 = bin.length;\n bin.map(function (d, i) {\n var y1 = bin.length - (i + 1);\n var len_index = _.findIndex(self.query.hits, {\n length: d\n });\n var evalue = self.query.hits[len_index].hsps[0].evalue;\n var item = {\n value: d,\n id: self.query.hits[len_index].id,\n evalue: evalue,\n url: '#Query_' + self.query.number + '_hit_' + self.query.hits[len_index].number,\n y0: y0,\n y1: y0 += y1 - y0,\n color: Helpers.get_colors_for_evalue(evalue, self.query.hits)\n };\n inner_data.push(item);\n });\n var item = {\n data: inner_data,\n x: bin.x0,\n dx: bin.x1,\n length: bin.length\n };\n data2.push(item);\n });\n this._update_data = data2;\n }\n }, {\n key: \"draw_rectangles\",\n value: function draw_rectangles() {\n var self = this;\n var bar = this.svg.selectAll('.bar').data(this._update_data).enter().append('g').attr('class', 'g').attr('transform', function (d) {\n return 'translate(' + (self._scale_x(d.x) + self._margin.left) + ',0)';\n });\n bar.selectAll('rect').data(function (d) {\n return d.data;\n }).enter().append('a').attr('xlink:href', function (i) {\n return i.url;\n }).append('rect').attr('class', 'bar').attr('title', function (i) {\n return i.id + ' ' + '
E value: ' + Helpers.prettify_evalue(i.evalue) + '
Length: ' + i.value;\n }).attr('x', 1).attr('y', function (i) {\n return self._scale_y(i.y0);\n }).attr('width', self._scale_x(this._bins[1].x0) - self._scale_x(this._bins[0].x0) - 1).attr('height', function (i) {\n return self._scale_y(i.y1) - self._scale_y(i.y0);\n }).attr('fill', function (i) {\n return i.color;\n });\n }\n }, {\n key: \"draw_query_line\",\n value: function draw_query_line() {\n var query_line = this.svg.append('g').attr('class', 'query_line').attr('transform', 'translate(' + (this._margin.left + this._scale_x(this.query_length)) + ',0)');\n query_line.append('rect').attr('x', 1).attr('class', 'bar').attr('width', 4).attr('height', this._height).style('fill', '#c74f14');\n query_line.append('text').attr('dy', '0.75em').attr('y', -10).attr('x', 2).attr('text-anchor', 'start').text('Query').style('fill', '#000').attr('transform', 'rotate(-45)');\n }\n }, {\n key: \"draw_axes\",\n value: function draw_axes() {\n var space, len;\n len = this._scale_y.ticks().length;\n if (len >= 5) {\n space = 5;\n } else {\n space = len;\n }\n var formatter = this.tick_formatter(this._seq_type.subject_seq_type);\n var x_axis = d3.axisTop(this._scale_x).ticks(50).tickFormat(formatter);\n var y_axis = d3.axisLeft(this._scale_y).tickValues(this._scale_y.ticks(space)).tickSizeOuter(0).tickFormat(function (e) {\n if (Math.floor(e) != e) {\n return;\n }\n return e;\n });\n var ticks = this._scale_y.ticks();\n for (var i in ticks) {\n if (ticks[i] % 1 != 0) {\n y_axis.tickValues(d3.range(0, d3.max(this._bins, function (d) {\n return d.length;\n }) + 1));\n break;\n }\n }\n var self = this;\n var xContainer = this.svg.append('g').attr('class', 'axis axis--x').attr('transform', 'translate(' + this._margin.left + ',' + this._height + ')').call(x_axis);\n xContainer.selectAll('line').attr('y2', function (d) {\n var ticks = self._scale_x.ticks();\n if (_.indexOf(ticks, d) >= 0) {\n return 7;\n } else {\n return 4;\n }\n });\n xContainer.selectAll('text').style('text-anchor', 'end').attr('x', '-8px').attr('y', '3px').attr('dy', '0').attr('transform', 'rotate(-90)');\n this.svg.append('g').attr('class', 'axis axis--y').attr('transform', 'translate(' + this._margin.left + ',0)').call(y_axis);\n }\n }], [{\n key: \"canCollapse\",\n value: function canCollapse() {\n return true;\n }\n }, {\n key: \"name\",\n value: function name() {\n return 'Length distribution of matching hit sequences';\n }\n }, {\n key: \"className\",\n value: function className() {\n return 'length-distribution';\n }\n }, {\n key: \"graphId\",\n value: function graphId(props) {\n return 'length_' + props.query.number;\n }\n }, {\n key: \"dataName\",\n value: function dataName(props) {\n return 'length-distribution-' + props.query.id;\n }\n }]);\n}();\nvar LengthDistribution = Grapher(Graph);\nexport default LengthDistribution;","export default function asMailtoHref(querydb, program, numQueries, url, isOpenAccess) {\n var dbsArr = formatDatabases(querydb);\n var mailto = composeEmail(dbsArr, program, numQueries, url, isOpenAccess);\n return encodeEmail(mailto);\n}\nfunction formatDatabases(querydb) {\n return querydb ? querydb.slice(0, 15).map(function (db) {\n return ' ' + db.title;\n }) : \"\";\n}\nfunction composeEmail(dbsArr, program, numQueries, url, isOpenAccess) {\n var upperProgram = program.toUpperCase();\n var accessStatement = isOpenAccess ? '' : 'The link will work if you have access to that particular SequenceServer instance.';\n return \"mailto:?subject=SequenceServer \".concat(upperProgram, \" analysis results &body=Hello,\\n\\n Here is a link to my recent \").concat(upperProgram, \" analysis of \").concat(numQueries, \" sequences.\\n \").concat(url, \"\\n\\n The following databases were used (up to 15 are shown):\\n \").concat(dbsArr, \"\\n\\n \").concat(accessStatement, \"\\n\\n Thank you for using SequenceServer, and please remember to cite our paper.\\n\\n Best regards,\\n\\n https://sequenceserver.com\");\n}\nfunction encodeEmail(mailto) {\n return encodeURI(mailto).replace(/(%20){2,}/g, '');\n}","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nimport React from 'react';\nvar DownloadLinks = /*#__PURE__*/function (_React$Component) {\n function DownloadLinks() {\n _classCallCheck(this, DownloadLinks);\n return _callSuper(this, DownloadLinks, arguments);\n }\n _inherits(DownloadLinks, _React$Component);\n return _createClass(DownloadLinks, [{\n key: \"render\",\n value: function render() {}\n }]);\n}(React.Component);\nexport default DownloadLinks;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport Grapher from 'grapher';\nvar Graph = /*#__PURE__*/function () {\n function Graph() {\n _classCallCheck(this, Graph);\n }\n return _createClass(Graph, null, [{\n key: \"canCollapse\",\n value: function canCollapse() {\n return false;\n }\n }, {\n key: \"name\",\n value: function name() {\n return null;\n }\n }, {\n key: \"className\",\n value: function className() {\n return null;\n }\n }, {\n key: \"dataName\",\n value: function dataName(_props) {\n return null;\n }\n }, {\n key: \"graphId\",\n value: function graphId() {\n return null;\n }\n }]);\n}();\nexport default Grapher(Graph);","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar HitButtons = /*#__PURE__*/function () {\n function HitButtons(hit) {\n _classCallCheck(this, HitButtons);\n this.hit = hit;\n }\n return _createClass(HitButtons, [{\n key: \"buttons\",\n value: function buttons() {\n return [];\n }\n }]);\n}();\nexport default HitButtons;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport Histogram from 'histogram';\nimport chroma from 'chroma-js';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar ReportPlugins = /*#__PURE__*/function () {\n function ReportPlugins(parent) {\n _classCallCheck(this, ReportPlugins);\n this.parent = parent;\n }\n return _createClass(ReportPlugins, [{\n key: \"init\",\n value: function init(_callback) {}\n }, {\n key: \"queryResult\",\n value: function queryResult(_query) {\n return null;\n }\n }, {\n key: \"generateStats\",\n value: function generateStats() {\n return /*#__PURE__*/_jsx(Histogram, {});\n }\n }]);\n}();\nexport default ReportPlugins;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _readOnlyError(r) { throw new TypeError('\"' + r + '\" is read-only'); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nimport React, { Component, createRef } from 'react';\nimport _ from 'underscore';\nimport HitsOverview from './hits_overview';\nimport LengthDistribution from './length_distribution'; // length distribution of hits\nimport Utils from './utils';\nimport { fastqToFasta } from './fastq_to_fasta';\nimport CollapsePreferences from './collapse_preferences';\nimport './jquery_world';\n\n/**\n * Query component displays query defline, graphical overview, length\n * distribution, and hits table.\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport var ReportQuery = /*#__PURE__*/function (_Component) {\n function ReportQuery() {\n _classCallCheck(this, ReportQuery);\n return _callSuper(this, ReportQuery, arguments);\n }\n _inherits(ReportQuery, _Component);\n return _createClass(ReportQuery, [{\n key: \"shouldComponentUpdate\",\n value:\n // 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 }\n // Kind of public API //\n\n /**\n * Returns the id of query.\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 /**\n * Returns number of hits.\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 if (this.props.showQueryCrumbs) {\n meta = \"query \".concat(this.props.query.number, \". \").concat(meta);\n }\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"section-header border-b border-seqorange justify-between w-full flex flex-col sm:flex-row gap-4\",\n children: [/*#__PURE__*/_jsxs(\"h3\", {\n className: \"text-base cursor-pointer flex flex-col sm:flex-row items-start\",\n children: [/*#__PURE__*/_jsxs(\"strong\", {\n children: [\"Query=\", /*#__PURE__*/_jsx(\"span\", {\n className: \"ml-1\",\n children: this.props.query.id\n })]\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"ml-1\",\n children: this.props.query.title\n })]\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"label first-letter:capitalize text-sm text-right font-normal text-inherit pt-0 px-0\",\n children: meta\n })]\n });\n }\n }, {\n key: \"hitsListJSX\",\n value: function hitsListJSX() {\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"pt-0 px-0 pb-px\",\n children: [/*#__PURE__*/_jsx(HitsOverview, {\n query: this.props.query,\n program: this.props.program,\n collapsed: this.props.veryBig\n }, 'GO_' + this.props.query.number), /*#__PURE__*/_jsx(LengthDistribution, {\n query: this.props.query,\n algorithm: this.props.program\n }, 'LD_' + this.props.query.id), /*#__PURE__*/_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__*/_jsx(\"div\", {\n className: \"pt-0 px-0 pb-px\",\n children: /*#__PURE__*/_jsx(\"strong\", {\n children: \" ****** No BLAST hits found ****** \"\n })\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"resultn mt-1.5\",\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}(Component);\n\n/**\n * Query widget for Search component.\n */\nexport var SearchQueryWidget = /*#__PURE__*/function (_Component2) {\n function SearchQueryWidget(props) {\n var _this;\n _classCallCheck(this, SearchQueryWidget);\n _this = _callSuper(this, SearchQueryWidget, [props]);\n _this.state = {\n value: $('input#input_sequence').val() || ''\n };\n _this.value = _this.value.bind(_this);\n _this.clear = _this.clear.bind(_this);\n _this.focus = _this.focus.bind(_this);\n _this.isEmpty = _this.isEmpty.bind(_this);\n _this.textarea = _this.textarea.bind(_this);\n _this.controls = _this.controls.bind(_this);\n _this.handleInput = _this.handleInput.bind(_this);\n _this.hideShowButton = _this.hideShowButton.bind(_this);\n _this.indicateError = _this.indicateError.bind(_this);\n _this.indicateNormal = _this.indicateNormal.bind(_this);\n _this.type = _this.type.bind(_this);\n _this.guessSequenceType = _this.guessSequenceType.bind(_this);\n _this.preProcessSequence = _this.preProcessSequence.bind(_this);\n _this.notify = _this.notify.bind(_this);\n _this.textareaRef = /*#__PURE__*/createRef();\n _this.controlsRef = /*#__PURE__*/createRef();\n return _this;\n }\n\n // LIFECYCLE Methods\n _inherits(SearchQueryWidget, _Component2);\n return _createClass(SearchQueryWidget, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n $('body').click(function () {\n $('[data-notifications] [data-role=notification].active').hide('drop', {\n direction: 'up'\n }).removeClass('active');\n });\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n this.hideShowButton();\n this.preProcessSequence();\n this.props.onSequenceChanged(this.residuesCount());\n var type = this.type();\n if (!type || type !== this._type) {\n this._type = type;\n this.notify(type);\n this.props.onSequenceTypeChanged(type);\n }\n }\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 sequence 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 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 key: \"residuesCount\",\n value: function residuesCount() {\n var sequence = this.value();\n var lines = sequence.split('\\n');\n var residuesCount = lines.reduce(function (count, line) {\n if (!line.startsWith('>')) {\n return count + line.length;\n }\n return count;\n }, 0);\n return residuesCount;\n }\n\n /**\n * Clears textarea. Returns `this`.\n *\n * Clearing textarea also causes it to be focussed.\n */\n }, {\n key: \"clear\",\n value: function clear() {\n return this.value('').focus();\n }\n\n /**\n * Focuses textarea. Returns `this`.\n */\n }, {\n key: \"focus\",\n value: function focus() {\n this.textarea().focus();\n return this;\n }\n\n /**\n * Returns true if query is absent ('', undefined, null), false otherwise.\n */\n }, {\n key: \"isEmpty\",\n value: function isEmpty() {\n return !this.value();\n }\n\n // Internal helpers. //\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 /**\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 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 /**\n * Put red border around textarea.\n */\n }, {\n key: \"indicateError\",\n value: function indicateError() {\n this.textarea().parent().addClass('has-error');\n }\n\n /**\n * Put normal blue border around textarea.\n */\n }, {\n key: \"indicateNormal\",\n value: function indicateNormal() {\n this.textarea().parent().removeClass('has-error');\n }\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 key: \"type\",\n value: function type() {\n var sequence = this.value().trim();\n // FASTQ detected, but we don't know if conversion has succeeded yet\n // will notify separately if it does\n if (sequence.startsWith('@')) {\n return undefined;\n }\n var sequences = sequence.split(/>.*/);\n var type, tmp;\n for (var i = 0; i < sequences.length; i++) {\n tmp = this.guessSequenceType(sequences[i]);\n\n // could not guess the sequence type; try the next sequence\n if (!tmp) {\n continue;\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 return type;\n }\n }, {\n key: \"preProcessSequence\",\n value: function preProcessSequence() {\n var sequence = this.value();\n var updatedSequence = fastqToFasta(sequence);\n if (sequence !== updatedSequence) {\n this.value(updatedSequence);\n this.notify('fastq');\n }\n }\n\n /**\n * Guesses and returns the type of the given sequence (nucleotide,\n * protein).\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 sequence = sequence.replace(/[NX]/gi, ''); // ambiguous characters\n\n // can't determine the type of ultrashort queries\n if (sequence.length < 10) {\n return undefined;\n }\n\n // count the number of putative NA\n var putative_NA_count = 0;\n for (var i = 0; i < sequence.length; i++) {\n if (sequence[i].match(/[ACGTU]/i)) {\n putative_NA_count += 1;\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 this.indicateNormal();\n clearTimeout(this.notification_timeout);\n // $('[data-notifications] [data-role=notification].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 $('[data-notifications] [data-role=notification].active').hide('drop', {\n direction: 'up'\n }).removeClass('active');\n }, 5000);\n if (type === 'mixed') {\n this.indicateError();\n }\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"relative\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"sequence\",\n children: /*#__PURE__*/_jsx(\"textarea\", {\n id: \"sequence\",\n ref: this.textareaRef,\n className: \"block w-full p-4 text-gray-900 border border-gray-300 rounded-l-lg rounded-tr-lg bg-gray-50 text-sm font-mono min-h-52 resize-y\",\n name: \"sequence\",\n value: this.state.value,\n rows: \"6\",\n required: \"required\",\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__*/_jsx(\"div\", {\n className: \"hidden absolute top-2 right-2\",\n ref: this.controlsRef,\n children: /*#__PURE__*/_jsxs(\"button\", {\n type: \"button\",\n className: \"border border-gray-300 rounded bg-white hover:bg-gray-200\",\n id: \"btn-sequence-clear\",\n title: \"Clear query sequence(s).\",\n onClick: this.clear,\n children: [/*#__PURE__*/_jsx(\"span\", {\n id: \"sequence-file\"\n }), /*#__PURE__*/_jsx(\"i\", {\n className: \"fa fa-times w-6 h-6 p-1\"\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"sr-only\",\n children: \"Clear query sequence(s).\"\n })]\n })\n })]\n });\n }\n }]);\n}(Component);\n\n/**\n * Renders summary of all hits per query in a tabular form.\n */\nvar HitsTable = /*#__PURE__*/function (_Component3) {\n function HitsTable(props) {\n var _this2;\n _classCallCheck(this, HitsTable);\n _this2 = _callSuper(this, HitsTable, [props]);\n _this2.name = 'Hit sequences producing significant alignments';\n _this2.collapsePreferences = new CollapsePreferences(_this2);\n _this2.state = {\n collapsed: _this2.collapsePreferences.preferenceStoredAsCollapsed()\n };\n return _this2;\n }\n _inherits(HitsTable, _Component3);\n return _createClass(HitsTable, [{\n key: \"tableJSX\",\n value: function tableJSX() {\n var hasName = _.every(this.props.query.hits, function (hit) {\n return hit.sciname !== '';\n });\n\n // Width of sequence column is 55% when species name is not shown and\n // query coverage is.\n var seqwidth = 55;\n // If we are going to show species name, then reduce the width of\n // sequence column by the width of species column.\n if (hasName) seqwidth -= 15;\n // 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 if (this.props.imported_xml) seqwidth += 15;\n return /*#__PURE__*/_jsxs(\"table\", {\n className: \"table table-hover table-condensed tabular-view text-sm min-w-full mb-0\",\n children: [/*#__PURE__*/_jsx(\"thead\", {\n children: /*#__PURE__*/_jsxs(\"tr\", {\n className: \"text-neutral-500\",\n children: [/*#__PURE__*/_jsx(\"th\", {\n className: \"text-left font-normal\",\n children: \"#\"\n }), /*#__PURE__*/_jsx(\"th\", {\n style: {\n width: \"\".concat(seqwidth, \"%\")\n },\n className: \"text-left font-normal\",\n children: \"Similar sequences\"\n }), hasName && /*#__PURE__*/_jsx(\"th\", {\n className: \"text-left font-normal w-2/12\",\n children: \"Species\"\n }), !this.props.imported_xml && /*#__PURE__*/_jsx(\"th\", {\n className: \"text-right font-normal w-2/12\",\n children: \"Query coverage (%)\"\n }), /*#__PURE__*/_jsx(\"th\", {\n className: \"text-right font-normal w-1/12\",\n children: \"Total score\"\n }), /*#__PURE__*/_jsx(\"th\", {\n className: \"text-right font-normal w-1/12\",\n children: \"E value\"\n }), /*#__PURE__*/_jsx(\"th\", {\n className: \"text-right font-normal w-1/12\",\n children: \"Identity (%)\"\n })]\n })\n }), /*#__PURE__*/_jsx(\"tbody\", {\n children: _.map(this.props.query.hits, _.bind(function (hit) {\n return /*#__PURE__*/_jsxs(\"tr\", {\n children: [/*#__PURE__*/_jsx(\"td\", {\n className: \"text-left\",\n children: hit.number + '.'\n }), /*#__PURE__*/_jsx(\"td\", {\n children: /*#__PURE__*/_jsxs(\"a\", {\n href: '#Query_' + this.props.query.number + '_hit_' + hit.number,\n className: \"text-sm text-seqblue hover:text-seqorange cursor-pointer pe-1 line-clamp-1 tooltip-item\",\n title: \"\".concat(hit.id, \" \").concat(hit.title),\n children: [hit.id, \" \", hit.title]\n })\n }), hasName && /*#__PURE__*/_jsx(\"td\", {\n className: \"pe-1 line-clamp-1 tooltip-item\",\n title: hit.sciname,\n children: hit.sciname\n }), !this.props.imported_xml && /*#__PURE__*/_jsx(\"td\", {\n className: \"text-right\",\n children: hit.qcovs\n }), /*#__PURE__*/_jsx(\"td\", {\n className: \"pe-1 text-right\",\n children: hit.total_score\n }), /*#__PURE__*/_jsx(\"td\", {\n className: \"pe-1 text-right\",\n children: Utils.inExponential(hit.hsps[0].evalue)\n }), /*#__PURE__*/_jsx(\"td\", {\n className: \"pe-1 text-right\",\n children: Utils.inPercentage(hit.hsps[0].identity, hit.hsps[0].length)\n })]\n }, hit.number);\n }, this))\n })]\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"table-hit-overview\",\n children: [/*#__PURE__*/_jsxs(\"h4\", {\n className: \"caption text-sm\",\n onClick: function onClick() {\n return _this3.collapsePreferences.toggleCollapse();\n },\n children: [this.collapsePreferences.renderCollapseIcon(), /*#__PURE__*/_jsxs(\"span\", {\n children: [\" \", this.name]\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n id: 'Query_' + this.props.query.number + 'HT_' + this.props.query.number,\n className: \"overflow-auto md:overflow-hidden\",\n children: !this.state.collapsed && this.tableJSX()\n })]\n });\n }\n }]);\n}(Component);","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nimport './jquery_world'; // for custom $.tooltip function\nimport React, { Component } from 'react';\nimport Sidebar from './sidebar';\nimport AlignmentExporter from './alignment_exporter';\nimport ReportPlugins from 'report_plugins';\nimport RunSummary from './report/run_summary';\nimport GraphicalOverview from './report/graphical_overview';\nimport AlignmentResults from './report/alignment_results';\n\n/**\n * Renders entire report.\n *\n * Composed of Query and Sidebar components.\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nvar Report = /*#__PURE__*/function (_Component) {\n function Report(props) {\n var _this;\n _classCallCheck(this, Report);\n _this = _callSuper(this, Report, [props]);\n // Properties below are internal state used to render results in small\n // slices (see updateState).\n _this.state = {\n user_warning: null,\n download_links: [],\n search_id: '',\n seqserv_version: '',\n program: '',\n program_version: '',\n submitted_at: '',\n results: [],\n queries: [],\n querydb: [],\n params: [],\n stats: [],\n alignment_blob_url: '',\n allQueriesLoaded: false,\n cloud_sharing_enabled: false\n };\n _this.prepareAlignmentOfAllHits = _this.prepareAlignmentOfAllHits.bind(_this);\n _this.setStateFromJSON = _this.setStateFromJSON.bind(_this);\n _this.plugins = new ReportPlugins(_this);\n return _this;\n }\n\n /**\n * Fetch results.\n */\n _inherits(Report, _Component);\n return _createClass(Report, [{\n key: \"fetchResults\",\n value: function fetchResults() {\n var path = location.pathname + '.json' + location.search;\n this.pollPeriodically(path, this.setStateFromJSON, this.props.showErrorModal);\n }\n }, {\n key: \"pollPeriodically\",\n value: function pollPeriodically(path, callback, errCallback) {\n var intervals = [200, 400, 800, 1200, 2000, 3000, 5000];\n function poll() {\n fetch(path).then(function (response) {\n // Handle HTTP status codes\n if (!response.ok) throw response;\n return response.text().then(function (data) {\n if (data) {\n data = parseJSON(data);\n }\n ;\n return {\n status: response.status,\n data: data\n };\n });\n }).then(function (_ref) {\n var status = _ref.status,\n data = _ref.data;\n switch (status) {\n case 202:\n var interval;\n if (intervals.length === 1) {\n interval = intervals[0];\n } else {\n interval = intervals.shift();\n }\n setTimeout(poll, interval);\n break;\n case 200:\n callback(data);\n break;\n }\n })[\"catch\"](function (error) {\n if (error.text) {\n error.text().then(function (errData) {\n errData = parseJSON(errData);\n switch (error.status) {\n case 400:\n case 422:\n case 500:\n errCallback(errData);\n break;\n default:\n console.error(\"Unhandled error:\", error.status);\n }\n });\n } else {\n console.error(\"Network error:\", error);\n }\n });\n }\n function parseJSON(str) {\n var parsedJson = str;\n try {\n parsedJson = JSON.parse(str);\n } catch (e) {\n console.error(\"Error parsing JSON:\", e);\n }\n return parsedJson;\n }\n poll();\n }\n\n /**\n * Calls setState after any required modification to responseJSON.\n */\n }, {\n key: \"setStateFromJSON\",\n value: function setStateFromJSON(responseJSON) {\n this.lastTimeStamp = Date.now();\n // the callback prepares the download link for all alignments\n if (responseJSON.user_warning == 'LARGE_RESULT') {\n this.setState({\n user_warning: responseJSON.user_warning,\n download_links: responseJSON.download_links\n });\n } else {\n this.setState(responseJSON, this.prepareAlignmentOfAllHits);\n }\n }\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 key: \"componentDidMount\",\n value: function componentDidMount() {\n this.fetchResults();\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 /**\n * Called after all results have been rendered.\n */\n }, {\n key: \"componentFinishedUpdating\",\n value: function componentFinishedUpdating() {\n if (this.state.allQueriesLoaded) return;\n this.shouldShowIndex() && this.setupScrollSpy();\n this.setState({\n allQueriesLoaded: true\n });\n }\n\n /**\n * Returns loading message\n */\n }, {\n key: \"loadingJSX\",\n value: function loadingJSX() {\n return /*#__PURE__*/_jsx(\"div\", {\n className: \"grid grid-cols-6 gap-4\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"col-start-1 col-end-7 text-center pt-3\",\n children: [/*#__PURE__*/_jsxs(\"h1\", {\n className: \"mb-8 text-4xl\",\n children: [/*#__PURE__*/_jsx(\"i\", {\n className: \"fa fa-cog fa-spin\"\n }), \"\\xA0 BLAST-ing\"]\n }), /*#__PURE__*/_jsx(\"div\", {\n className: \"mb-5 w-full\",\n children: /*#__PURE__*/_jsx(\"p\", {\n className: \"m-auto w-full md:w-6/12 text-sm\",\n children: \"This can take some time depending on the size of your query and database(s). The page will update automatically when BLAST is done.\"\n })\n }), /*#__PURE__*/_jsx(\"p\", {\n className: \"mb-9 text-sm\",\n children: \"You can bookmark the page and come back to it later or share the link with someone.\"\n }), /*#__PURE__*/_jsx(\"p\", {\n className: \"text-sm\",\n children: process.env.targetEnv === 'cloud' && /*#__PURE__*/_jsx(\"b\", {\n children: \"If the job takes more than 10 minutes to complete, we will send you an email upon completion.\"\n })\n })]\n })\n });\n }\n\n /* eslint-disable */\n /**\n * Return results JSX.\n */\n }, {\n key: \"resultsJSX\",\n value: function resultsJSX() {\n var _this2 = this;\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"grid grid-cols-1 md:grid-cols-4 gap-4\",\n id: \"results\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"hidden md:col-span-1 md:block\",\n children: /*#__PURE__*/_jsx(Sidebar, {\n data: this.state,\n atLeastOneHit: this.atLeastOneHit(),\n shouldShowIndex: this.shouldShowIndex(),\n allQueriesLoaded: this.state.allQueriesLoaded,\n cloudSharingEnabled: this.state.cloud_sharing_enabled\n })\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"col-span-1 md:col-span-3\",\n children: [/*#__PURE__*/_jsx(RunSummary, {\n seqserv_version: this.state.seqserv_version,\n program_version: this.state.program_version,\n submitted_at: this.state.submitted_at,\n querydb: this.state.querydb,\n stats: this.state.stats,\n params: this.state.params\n }), /*#__PURE__*/_jsx(GraphicalOverview, {\n queries: this.state.queries,\n prorgam: this.state.program,\n plugins: this.plugins\n }), /*#__PURE__*/_jsx(AlignmentResults, _objectSpread({\n state: this.state,\n populate_hsp_array: this.populate_hsp_array.bind(this),\n componentFinishedUpdating: function componentFinishedUpdating(_) {\n return _this2.componentFinishedUpdating(_);\n },\n plugins: this.plugins\n }, this.props))]\n })]\n });\n }\n /* eslint-enable */\n }, {\n key: \"warningJSX\",\n value: function warningJSX() {\n return /*#__PURE__*/_jsx(\"div\", {\n className: \"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8\",\n children: /*#__PURE__*/_jsx(\"div\", {\n className: \"grid grid-cols-6 gap-4\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"col-start-1 col-end-7 text-center\",\n children: [/*#__PURE__*/_jsxs(\"h1\", {\n className: \"mb-4 text-4xl\",\n children: [/*#__PURE__*/_jsx(\"i\", {\n className: \"fa fa-exclamation-triangle\"\n }), \"\\xA0 Warning\"]\n }), /*#__PURE__*/_jsx(\"p\", {\n className: \"mb-2\",\n children: \"The BLAST result might be too large to load in the browser. If you have a powerful machine you can try loading the results anyway. Otherwise, you can download the results and view them locally.\"\n }), /*#__PURE__*/_jsx(\"p\", {\n className: \"mb-2\",\n children: this.state.download_links.map(function (link, index) {\n return /*#__PURE__*/_jsx(\"a\", {\n href: link.url,\n className: \"btn btn-secondary\",\n children: link.name\n }, 'download_link_' + index);\n })\n }), /*#__PURE__*/_jsx(\"p\", {\n children: /*#__PURE__*/_jsx(\"a\", {\n href: location.pathname + '?bypass_file_size_warning=true',\n className: \"py-2 px-3 border border-transparent rounded-md shadow-sm text-white bg-seqblue hover:bg-seqorange focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-seqorange\",\n children: \"View results in browser anyway\"\n })\n })]\n })\n })\n });\n }\n\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 key: \"isResultAvailable\",\n value: function isResultAvailable() {\n return this.state.queries.length >= 1;\n }\n\n /**\n * Indicates the response contains a warning message for the user\n * in which case we should not render the results and render the\n * warning instead.\n **/\n }, {\n key: \"isUserWarningPresent\",\n value: function isUserWarningPresent() {\n return this.state.user_warning;\n }\n\n /**\n * Returns true if we have at least one hit.\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 /**\n * Returns true if index should be shown in the sidebar. Index is shown\n * only for 2 and 8 queries.\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 /**\n * Prevents folding of hits during text-selection.\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-square-minus fa-square-plus');\n } else {\n // user wants to select\n $this.attr('data-toggle', '');\n }\n $this.off('mouseup mousemove', handler);\n });\n });\n }\n\n /* Handling the fa icon when Hit Table is collapsed */\n }, {\n key: \"toggleTable\",\n value: function toggleTable() {\n $('body').on('mousedown', '.resultn .caption[data-toggle=\"collapse\"]', function (event) {\n var $this = $(this);\n $this.on('mouseup mousemove', function handler(event) {\n $this.find('i').toggleClass('fa-square-minus fa-square-plus');\n $this.off('mouseup mousemove', handler);\n });\n });\n }\n\n /**\n * For the query in viewport, highlights corresponding entry in the index.\n */\n }, {\n key: \"setupScrollSpy\",\n value: function setupScrollSpy() {\n var sectionIds = $('a.side-nav');\n $(document).scroll(function () {\n sectionIds.each(function () {\n var container = $(this).attr('href');\n var containerOffset = $(container).offset().top;\n var containerHeight = $(container).outerHeight();\n var containerBottom = containerOffset + containerHeight;\n var scrollPosition = $(document).scrollTop();\n if (scrollPosition < containerBottom - 20 && scrollPosition >= containerOffset - 20) {\n $(this).addClass('active');\n } else {\n $(this).removeClass('active');\n }\n });\n });\n }\n }, {\n key: \"populate_hsp_array\",\n value: function populate_hsp_array(hit, query_id) {\n return hit.hsps.map(function (hsp) {\n return Object.assign(hsp, {\n hit_id: hit.id,\n query_id: query_id\n });\n });\n }\n }, {\n key: \"prepareAlignmentOfAllHits\",\n value: function prepareAlignmentOfAllHits() {\n var _this3 = this;\n // Get number of hits and array of all hsps.\n var num_hits = 0;\n var hsps_arr = [];\n if (!this.state.queries.length) {\n return;\n }\n this.state.queries.forEach(function (query) {\n return query.hits.forEach(function (hit) {\n num_hits++;\n hsps_arr = hsps_arr.concat(_this3.populate_hsp_array(hit, query.id));\n });\n });\n var aln_exporter = new AlignmentExporter();\n var file_name = \"alignment-\".concat(num_hits, \"_hits.txt\");\n var blob_url = aln_exporter.prepare_alignments_for_export(hsps_arr, file_name);\n $('.download-alignment-of-all').attr('href', blob_url).attr('download', file_name);\n return false;\n }\n }, {\n key: \"render\",\n value: function render() {\n if (this.isUserWarningPresent()) {\n return this.warningJSX();\n } else if (this.isResultAvailable()) {\n return this.resultsJSX();\n } else {\n return this.loadingJSX();\n }\n }\n }]);\n}(Component);\nexport default Report;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport ReportHeader from './report_header';\nimport Hits from '../hits';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nvar AlignmentResults = function AlignmentResults(props) {\n var renderContent = function renderContent() {\n return /*#__PURE__*/_jsxs(\"div\", {\n children: [props.state.results, /*#__PURE__*/_jsx(Hits, _objectSpread(_objectSpread({}, props), {}, {\n componentFinishedUpdating: function componentFinishedUpdating(_) {\n return props.componentFinishedUpdating(_);\n }\n }))]\n });\n };\n return /*#__PURE__*/_jsx(ReportHeader, {\n name: \"Alignment Results\",\n renderContent: renderContent\n });\n};\nexport default AlignmentResults;","import Circos from '../circos';\nimport ReportHeader from './report_header';\nimport { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nvar GraphicalOverview = function GraphicalOverview(_ref) {\n var queries = _ref.queries,\n program = _ref.program,\n plugins = _ref.plugins;\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 var atLeastTwoHits = function atLeastTwoHits() {\n var hitNum = 0;\n return queries.some(function (query) {\n hitNum += query.hits.length;\n return hitNum > 1;\n });\n };\n var renderContent = function renderContent() {\n if (!atLeastTwoHits()) return null;\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [/*#__PURE__*/_jsx(Circos, {\n queries: queries,\n program: program\n }), plugins.generateStats(queries)]\n });\n };\n return /*#__PURE__*/_jsx(ReportHeader, {\n name: \"Graphical Overview\",\n renderContent: renderContent,\n renderable: atLeastTwoHits()\n });\n};\nexport default GraphicalOverview;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nimport React, { useState } from 'react';\nimport CollapsePreferences from '../collapse_preferences';\nimport { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nvar ReportHeader = function ReportHeader(props) {\n var _useState = useState({\n collapsed: null\n }),\n _useState2 = _slicedToArray(_useState, 2),\n state = _useState2[0],\n setState = _useState2[1];\n var _useState3 = useState(props.renderable === undefined ? true : props.renderable),\n _useState4 = _slicedToArray(_useState3, 2),\n renderable = _useState4[0],\n _setRenderable = _useState4[1];\n var collapsePreferences = new CollapsePreferences({\n name: props.name,\n state: _objectSpread({}, state),\n setState: setState\n });\n if (state.collapsed === null) setState({\n collapsed: collapsePreferences.preferenceStoredAsCollapsed()\n });\n if (!renderable) return null;\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [/*#__PURE__*/_jsxs(\"h3\", {\n className: \"caption font-bold border-b-2 border-seqorange\",\n onClick: function onClick() {\n return collapsePreferences.toggleCollapse();\n },\n children: [collapsePreferences.renderCollapseIcon(), /*#__PURE__*/_jsxs(\"span\", {\n children: [\" \", props.name]\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n className: \"mx-1\",\n children: !state.collapsed && props.renderContent()\n })]\n });\n};\nexport default ReportHeader;","import ReportHeader from './report_header';\nimport _ from 'underscore';\nimport { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nvar RunSummary = function RunSummary(props) {\n var renderContent = function renderContent() {\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"overview mr-0 mb-0\",\n children: [/*#__PURE__*/_jsxs(\"p\", {\n className: \"m-0 text-sm\",\n children: [/*#__PURE__*/_jsxs(\"strong\", {\n children: [\"SequenceServer \", props.seqserv_version]\n }), \" using\", ' ', /*#__PURE__*/_jsx(\"strong\", {\n children: props.program_version\n }), props.submitted_at && \", query submitted on \".concat(props.submitted_at)]\n }), /*#__PURE__*/_jsxs(\"p\", {\n className: \"m-0 text-sm\",\n children: [/*#__PURE__*/_jsx(\"strong\", {\n children: \" Databases: \"\n }), props.querydb.map(function (db) {\n return db.title;\n }).join(', '), ' ', \"(\", props.stats.nsequences, \" sequences,\\xA0\", props.stats.ncharacters, \" characters)\"]\n }), /*#__PURE__*/_jsxs(\"p\", {\n className: \"m-0 text-sm\",\n children: [/*#__PURE__*/_jsx(\"strong\", {\n children: \"Parameters: \"\n }), ' ', _.map(props.params, function (val, key) {\n return key + ' ' + val;\n }).join(', ')]\n }), /*#__PURE__*/_jsxs(\"p\", {\n className: \"m-0 text-sm\",\n children: [\"Please cite:\", ' ', /*#__PURE__*/_jsx(\"a\", {\n href: \"https://doi.org/10.1093/molbev/msz185\",\n className: \"text-seqblue hover:text-seqorange\",\n children: \"https://doi.org/10.1093/molbev/msz185\"\n })]\n })]\n });\n };\n return /*#__PURE__*/_jsx(ReportHeader, {\n name: \"Run Summary\",\n renderContent: renderContent\n });\n};\nexport default RunSummary;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nimport $ from 'jquery';\nrequire = function e(t, n, r) {\n function s(o, u) {\n if (!n[o]) {\n if (!t[o]) {\n var a = typeof require == 'function' && require;\n if (!u && a) return a(o, !0);\n if (i) return i(o, !0);\n var f = new Error('Cannot find module \\'' + o + '\\'');\n throw f.code = 'MODULE_NOT_FOUND', f;\n }\n var l = n[o] = {\n exports: {}\n };\n t[o][0].call(l.exports, function (e) {\n var n = t[o][1][e];\n return s(n ? n : e);\n }, l, l.exports, e, t, n, r);\n }\n return n[o].exports;\n }\n var i = typeof require == 'function' && require;\n for (var o = 0; o < r.length; o++) s(r[o]);\n return s;\n}({\n 1: [function (require, module, exports) {\n // legacy!!\n $.browser = require('jquery-browser-plugin');\n\n /**\n * THIS FILE HAS BEEN MODIFIED FROM THE ORIGINAL\n * (https://github.com/ljgarcia/biojs-vis-sequence/blob/master/lib/index.js).\n *\n * Sequence component\n *\n * @class\n * @extends Biojs\n *\n * @author
John Gomez ,
Jose Villaveces \n * @version 1.0.0\n * @category 3\n *\n * @requires
jQuery Core 1.6.4 \n * @dependency \n *\n * @requires
jQuery UI 1.8.16 \n * @dependency \n *\n * @requires
Biojs.Tooltip \n * @dependency \n *\n * @param {Object} options An object with the options for Sequence component.\n *\n * @option {string} target\n * Identifier of the DIV tag where the component should be displayed.\n *\n * @option {string} sequence\n * The sequence to be displayed.\n *\n * @option {string} [id]\n * Sequence identifier if apply.\n *\n * @option {string} [format=\"FASTA\"]\n * The display format for the sequence representation.\n *\n * @option {Object[]} [highlights]\n * \t For highlighting multiple regions.\n *
\n * [\n * \t// Highlight aminoacids from 'start' to 'end' of the current strand using the specified 'color' (optional) and 'background' (optional).\n * \t{ start: <startVal1>, end: <endVal1> [, id:<idVal1>] [, color: <HTMLColor>] [, background: <HTMLColor>]},\n * \t//\n * \t// Any others highlights\n * \t...,\n * \t//\n * \t{ start: <startValN>, end: <endValN> [, id:<idValN>] [, color: <HTMLColor>] [, background: <HTMLColor>]}\n * ] \n *\n *
\n * highlights : [\n * \t\t{ start:30, end:42, color:\"white\", background:\"green\", id:\"spin1\" },\n *\t\t{ start:139, end:140 },\n *\t\t{ start:631, end:633, color:\"white\", background:\"blue\" }\n *\t]\n * \n *\n * @option {Object} [columns={size:40,spacedEach:10}]\n * \t Options for displaying the columns. Syntax: { size: <numCols>, spacedEach: <numCols>}\n *\n * @option {Object} [selection]\n * \t Positions for the current selected region. Syntax: { start: <startValue>, end: <endValue>}\n *\n * @option {Object[]} [annotations]\n * Set of overlapping annotations. Must be an array of objects following the syntax:\n * \t\t
\n * [\n * // An annotation:\n * { name: <name>,\n * html: <message>,\n * color: <color_code>,\n * regions: [{ start: <startVal1>, end: <endVal1> color: <HTMLColor>}, ...,{ start: <startValN>, end: <endValN>, color: <HTMLColor>}]\n * },\n *\n * // ...\n * // more annotations here\n * // ...\n * ]\n * \t\t \n * where:\n *
\n * name is the unique name for the annotation \n * html is the message (can be HTML) to be displayed in the tool tip. \n * color is the default HTML color code for all the regions. \n * regions array of objects defining the intervals which belongs to the annotation. \n * regions[i].start is the starting character for the i-th interval. \n * regions[i].end is the ending character for the i-th interval. \n * regions[i].color is an optional color for the i-th interval.\n * \n *\n * @option {Object} [formatOptions={title:true, footer:true}]\n * \t Options for displaying the title. by now just affecting the CODATA format.\n *
\n * \t\tformatOptions : {\n * \t\t\ttitle:false,\n * \t\t\tfooter:false\n * \t\t}\n * \n *\n * @example\n * var theSequence = \"METLCQRLNVCQDKILTHYENDSTDLRDHIDYWKHMRLECAIYYKAREMGFKHINHQVVPTLAVSKNKALQAIELQLTLETIYNSQYSNEKWTLQDVSLEVYLTAPTGCIKKHGYTVEVQFDGDICNTMHYTNWTHIYICEEAojs SVTVVEGQVDYYGLYYVHEGIRTYFVQFKDDAEKYSKNKVWEVHAGGQVILCPTSVFSSNEVSSPEIIRQHLANHPAATHTKAVALGTEETQTTIQRPRSEPDTGNPCHTTKLLHRDSVDSAPILTAFNSSHKGRINCNSNTTPIVHLKGDANTLKCLRYRFKKHCTLYTAVSSTWHWTGHNVKHKSAIVTLTYDSEWQRDQFLSQVKIPKTITVSTGFMSI\";\n * var mySequence = new Sequence({\n * \t\tsequence : theSequence,\n * \t\ttarget : \"YourOwnDivId\",\n * \t\tformat : 'CODATA',\n * \t\tid : 'P918283',\n * \t\tannotations: [\n * { name:\"CATH\",\n * \t \t\tcolor:\"#F0F020\",\n * \t \t\thtml: \"Using color code #F0F020 \",\n * \t \t\tregions: [{start: 122, end: 135}]\n * \t\t },\n * { name:\"TEST\",\n * html:\"<br> Example of <b>HTML</b>\",\n * color:\"green\",\n * regions: [\n * {start: 285, end: 292},\n * {start: 293, end: 314, color: \"#2E4988\"}]\n * }\n * ],\n * highlights : [\n * \t{ start:30, end:42, color:\"white\", background:\"green\", id:\"spin1\" },\n * \t{ start:139, end:140 },\n * \t{ start:631, end:633, color:\"white\", background:\"blue\" }\n * ]\n * });\n *\n */\n\n var Class = require('js-class');\n var EVT_ON_SELECTION_CHANGE = 'onSelectionChange';\n var EVT_ON_SELECTION_CHANGED = 'onSelectionChanged';\n var EVT_ON_ANNOTATION_CLICKED = 'onAnnotationClicked';\n global.Sequence = Class( /** @lends Sequence# */\n {\n constructor: function constructor(options) {\n var self = this;\n this.opt = jQuery.extend(this.opt, options);\n this._container = jQuery(this.opt.target);\n\n // legacy support (target id without '#')\n if (this._container.length == 0) {\n this._container = jQuery('#' + this.opt.target);\n }\n if (this._container.length == 0) {\n console.log('empty target container');\n }\n\n // legacy: copy target id\n this.opt.target = this._container[0].id;\n\n // Lazy initialization\n this._container.ready(function () {\n this._ready = false;\n self._initialize();\n });\n },\n /**\n * Default values for the options\n * @name Sequence-opt\n */\n opt: {\n sequence: '',\n id: '',\n target: '',\n format: 'FASTA',\n selection: {\n start: 0,\n end: 0\n },\n columns: {\n size: 35,\n spacedEach: 10\n },\n highlights: [],\n annotations: [],\n sequenceUrl: 'http://www.ebi.ac.uk/das-srv/uniprot/das/uniprot/sequence',\n // Styles\n selectionColor: 'Yellow',\n selectionFontColor: 'black',\n highlightFontColor: 'red',\n highlightBackgroundColor: 'white',\n fontColor: 'inherit',\n backgroundColor: 'inherit',\n width: undefined,\n height: undefined,\n formatSelectorVisible: true\n },\n /**\n * Array containing the supported event names\n * @name Sequence-eventTypes\n */\n eventTypes: [\n /**\n * @name Sequence#onSelectionChanged\n * @event\n * @param {function} actionPerformed An function which receives an {@link Biojs.Event} object as argument.\n * @eventData {Object} source The component which did triggered the event.\n * @eventData {string} type The name of the event.\n * @eventData {int} start A number indicating the start of the selection.\n * @eventData {int} end A number indicating the ending of selection.\n * @example\n * mySequence.onSelectionChanged(\n * function( objEvent ) {\n * alert(\"Selected: \" + objEvent.start + \", \" + objEvent.end );\n * }\n * );\n *\n * */\n 'onSelectionChanged',\n /**\n * @name Sequence#onSelectionChange\n * @event\n * @param {function} actionPerformed An function which receives an {@link Biojs.Event} object as argument.\n * @eventData {Object} source The component which did triggered the event.\n * @eventData {string} type The name of the event.\n * @eventData {int} start A number indicating the start of the selection.\n * @eventData {int} end A number indicating the ending of selection.\n * @example\n * mySequence.onSelectionChange(\n * function( objEvent ) {\n * alert(\"Selection in progress: \" + objEvent.start + \", \" + objEvent.end );\n * }\n * );\n *\n *\n * */\n 'onSelectionChange',\n /**\n * @name Sequence#onAnnotationClicked\n * @event\n * @param {function} actionPerformed An function which receives an {@link Biojs.Event} object as argument.\n * @eventData {Object} source The component which did triggered the event.\n * @eventData {string} type The name of the event.\n * @eventData {string} name The name of the selected annotation.\n * @eventData {int} pos A number indicating the position of the selected amino acid.\n * @example\n * mySequence.onAnnotationClicked(\n * function( objEvent ) {\n * alert(\"Clicked \" + objEvent.name + \" on position \" + objEvent.pos );\n * }\n * );\n *\n * */\n 'onAnnotationClicked'],\n getId: function getId() {\n return this.opt.id;\n },\n // internal members\n _headerDiv: null,\n _contentDiv: null,\n // Methods\n\n _initialize: function _initialize() {\n if (this.opt.width !== undefined) {\n this._container.width(this.opt.width);\n }\n if (this.opt.height !== undefined) {\n this._container.height(this.opt.height);\n }\n\n // DIV for the format selector\n this._buildFormatSelector();\n\n // DIV for the sequence\n this._contentDiv = jQuery('
').appendTo(this._container);\n\n // Initialize highlighting\n this._highlights = this.opt.highlights;\n\n // Initialize annotations\n this._annotations = this.opt.annotations;\n\n //Initialize tooltip\n var tooltip = 'sequenceTip' + this.opt.target;\n jQuery('
').appendTo('.fastan-content').addClass('absolute top-0 left-0').show();\n this.opt._tooltip = document.getElementById(tooltip);\n if (this.opt.sequence) {\n this._redraw();\n } else if (this.opt.id) {\n this._requestSequence(this.opt.id);\n } else {\n this.clearSequence('No sequence available', '../biojs/css/images/warning_icon.png');\n }\n this._ready = true;\n },\n /**\n * Shows the columns indicated by the indexes array.\n * @param {string} seq The sequence strand.\n * @param {string} [identifier] Sequence identifier.\n *\n * @example\n * mySequence.setSequence(\"P99999\");\n *\n */\n setSequence: function setSequence(seq, identifier) {\n if (seq.match(/^([A-N,R-Z][0-9][A-Z][A-Z, 0-9][A-Z, 0-9][0-9])|([O,P,Q][0-9][A-Z, 0-9][A-Z, 0-9][A-Z, 0-9][0-9])(\\.\\d+)?$/i)) {\n this._requestSequence(arguments[0]);\n } else {\n this.opt.sequence = seq;\n this.opt.id = identifier;\n this._highlights = [];\n this._highlightsCount = 0;\n this.opt.selection = {\n start: 0,\n end: 0\n };\n this._annotations = [];\n this._contentDiv.children().remove();\n this._redraw();\n }\n },\n _requestSequence: function _requestSequence(accession) {\n var self = this;\n console.log('Requesting sequence for: ' + accession);\n jQuery.ajax({\n url: self.opt.sequenceUrl,\n dataType: 'xml',\n data: {\n segment: accession\n }\n }).done(function (xml) {\n try {\n var sequenceNode = jQuery(xml).find('SEQUENCE:first');\n self.setSequence(sequenceNode.text(), sequenceNode.attr('id'), sequenceNode.attr('label'));\n } catch (e) {\n console.log('Error decoding response data: ' + e.message);\n self.clearSequence('No sequence available', '../biojs/css/images/warning_icon.png');\n }\n }).fail(function (jqXHR, textStatus, errorThrown) {\n console.log('Error requesting the sequence: ' + textStatus);\n self.clearSequence('Error requesting the sequence to the server ' + this.url, '../biojs/css/images/warning_icon.png');\n });\n },\n /**\n * Shows the columns indicated by the indexes array.\n * @param {string} [showMessage] Message to be showed.\n * @param {string} [icon] Icon to be showed a side of the message\n *\n * @example\n * mySequence.clearSequence(\"No sequence available\", \"../biojs/css/images/warning_icon.png\");\n *\n */\n clearSequence: function clearSequence(showMessage, icon) {\n var message = undefined;\n this.opt.sequence = '';\n this.opt.id = '';\n this._highlights = [];\n this._highlightsCount = 0;\n this.opt.selection = {\n start: 0,\n end: 0\n };\n this._annotations = [];\n this._contentDiv.children().remove();\n this._headerDiv.hide();\n if (undefined !== showMessage) {\n message = jQuery('
' + showMessage + '
').appendTo(this._contentDiv).addClass('message');\n if (undefined !== icon) {\n message.css({\n 'background': 'transparent url(\"' + icon + '\") no-repeat center left',\n 'padding-left': '20px'\n });\n }\n }\n },\n /**\n * Set the current selection in the sequence causing the event {@link Sequence#onSelectionChanged}\n *\n * @example\n * // set selection from the position 100 to 150\n * mySequence.setSelection(100, 150);\n *\n * @param {int} start The starting character of the selection.\n * @param {int} end The ending character of the selection\n */\n setSelection: function setSelection(start, end) {\n if (start > end) {\n var aux = end;\n end = start;\n start = aux;\n }\n if (start != this.opt.selection.start || end != this.opt.selection.end) {\n this._setSelection(start, end);\n this.trigger(EVT_ON_SELECTION_CHANGED, {\n 'start': start,\n 'end': end\n });\n }\n },\n _buildFormatSelector: function _buildFormatSelector() {\n var self = this;\n console.log('build format selector container', this._container);\n this._headerDiv = jQuery('
').appendTo(this._container);\n this._headerDiv.append('Format: ');\n this._formatSelector = jQuery('
' + 'FASTA ' + 'CODATA ' + 'PRIDE ' + 'RAW ').appendTo(self._headerDiv);\n this._formatSelector.change(function (e) {\n self.opt.format = jQuery(this).val();\n self._redraw();\n });\n this._formatSelector.val(self.opt.format);\n this.formatSelectorVisible(this.opt.formatSelectorVisible);\n },\n /**\n * Highlights a region using the font color defined in {Sequence#highlightFontColor} by default is red.\n *\n * @example\n * // highlight the characters within the position 100 to 150, included.\n * mySequence.addHighlight( { \"start\": 100, \"end\": 150, \"color\": \"white\", \"background\": \"red\", \"id\": \"aaa\" } );\n *\n * @param {Object} h The highlight defined as follows:\n *\n *\n * @return {int} representing the id of the highlight on the internal array. Returns -1 on failure\n */\n addHighlight: function addHighlight(h) {\n var id = '-1';\n var color = '';\n var background = '';\n var highlight = {};\n if (h instanceof Object && h.start <= h.end) {\n color = 'string' == typeof h.color ? h.color : this.opt.highlightFontColor;\n background = 'string' == typeof h.background ? h.background : this.opt.highlightBackgroundColor;\n id = 'string' == typeof h.id ? h.id : new Number(this._highlightsCount++).toString();\n highlight = {\n 'start': h.start,\n 'end': h.end,\n 'color': color,\n 'background': background,\n 'id': id\n };\n this._highlights.push(highlight);\n this._applyHighlight(highlight);\n this._restoreSelection(h.start, h.end);\n }\n return id;\n },\n /*\n * Function: Sequence._applyHighlight\n * Purpose: Apply the specified color and background to a region between 'start' and 'end'.\n * Returns: -\n * Inputs: highlight -> {Object} An object containing the fields start (int), end (int),\n * \t\t\t\t\t\tcolor (HTML color string) and background (HTML color string).\n */\n _applyHighlight: function _applyHighlight(highlight) {\n var zindex = 0,\n z = 0,\n o = 0;\n var seq = this._contentDiv.find('.sequence');\n for (var i = highlight.start - 1; i < highlight.end; i++) {\n zindex = jQuery(seq[i]).css('z-index');\n if (zindex == 'auto') {\n z = 1;\n o = 1;\n } else {\n z = 0;\n o = 0.5;\n }\n jQuery(seq[i]).css({\n 'color': highlight.color,\n 'background-color': highlight.background,\n 'z-index': z,\n 'opacity': o\n }).addClass('highlighted');\n }\n },\n /*\n * Function: Sequence._applyHighlights\n * Purpose: Apply the specified highlights.\n * Returns: -\n * Inputs: highlights -> {Object[]} An array containing the highlights to be applied.\n */\n _applyHighlights: function _applyHighlights(highlights) {\n for (var i in highlights) {\n this._applyHighlight(highlights[i]);\n }\n },\n /*\n * Function: Sequence._restoreHighlights\n * Purpose: Repaint the highlights in the specified region.\n * Returns: -\n * Inputs: start -> {int} Start of the region to be restored.\n * \t\t end -> {int} End of the region to be restored.\n */\n _restoreHighlights: function _restoreHighlights(start, end) {\n var h = this._highlights;\n // paint the region using default blank settings\n this._applyHighlight({\n 'start': start,\n 'end': end,\n 'color': this.opt.fontColor,\n 'background': this.opt.backgroundColor\n });\n // restore highlights in that region\n for (var i in h) {\n // interval intersects with highlight i ?\n if (!(h[i].start > end || h[i].end < start)) {\n a = h[i].start < start ? start : h[i].start;\n b = h[i].end > end ? end : h[i].end;\n this._applyHighlight({\n 'start': a,\n 'end': b,\n 'color': h[i].color,\n 'background': h[i].background\n });\n }\n }\n },\n /*\n * Function: Sequence._restoreSelection\n * Purpose: Repaint the current selection in the specified region.\n * \t\t\t It is used in the case of any highlight do overriding of the current selection.\n * Returns: -\n * Inputs: start -> {int} Start of the region to be restored.\n * \t\t end -> {int} End of the region to be restored.\n */\n _restoreSelection: function _restoreSelection(start, end) {\n var sel = this.opt.selection;\n // interval intersects with current selection ?\n // restore selection\n if (!(start > sel.end || end < sel.start)) {\n a = start < sel.start ? sel.start : start;\n b = end > sel.end ? sel.end : end;\n this._applyHighlight({\n 'start': a,\n 'end': b,\n 'color': this.opt.selectionFontColor,\n 'background': this.opt.selectionColor\n });\n }\n },\n /**\n * Remove a highlight.\n *\n * @example\n * // Clear the highlighted characters within the position 100 to 150, included.\n * mySequence.removeHighlight(\"spin1\");\n *\n * @param {string} id The id of the highlight on the internal array. This value is returned by method highlight.\n */\n removeHighlight: function removeHighlight(id) {\n var h = this._highlights;\n for (i in h) {\n if (h[i].id == id) {\n start = h[i].start;\n end = h[i].end;\n h.splice(i, 1);\n this._restoreHighlights(start, end);\n this._restoreSelection(start, end);\n break;\n }\n }\n },\n /**\n * Remove all the highlights of whole sequence.\n *\n * @example\n * mySequence.removeAllHighlights();\n */\n removeAllHighlights: function removeAllHighlights() {\n this._highlights = [];\n this._restoreHighlights(1, this.opt.sequence.length);\n this._restoreSelection(1, this.opt.sequence.length);\n },\n /**\n * Changes the current displaying format of the sequence.\n *\n * @example\n * // Set format to 'FASTA'.\n * mySequence.setFormat('FASTA');\n *\n * @param {string} format The format for the sequence to be displayed.\n */\n setFormat: function setFormat(format) {\n if (this.opt.format != format.toUpperCase()) {\n this.opt.format = format.toUpperCase();\n this._redraw();\n }\n var self = this;\n // Changes the option in the combo box\n this._headerDiv.find('option').each(function () {\n if (jQuery(this).val() == self.opt.format.toUpperCase()) {\n jQuery(this).attr('selected', 'selected');\n }\n });\n },\n /**\n * Changes the current number of columns in the displayed sequence.\n *\n * @example\n * // Set the number of columns to 70.\n * mySequence.setNumCols(70);\n *\n * @param {int} numCols The number of columns.\n */\n setNumCols: function setNumCols(numCols) {\n this.opt.columns.size = numCols;\n this._redraw();\n },\n /**\n * Set the visibility of the drop-down list of formats.\n *\n * @param {boolean} visible true: show; false: hide.\n */\n formatSelectorVisible: function formatSelectorVisible(visible) {\n if (visible) {\n this._headerDiv.show();\n } else {\n this._headerDiv.hide();\n }\n },\n /**\n * This is similar to a {Biojs.Protein3D#formatSelectorVisible} with the 'true' argument.\n *\n * @example\n * // Shows the format selector.\n * mySequence.showFormatSelector();\n *\n */\n showFormatSelector: function showFormatSelector() {\n this._headerDiv.show();\n },\n /**\n * This is similar to a {Biojs.Protein3D#formatSelectorVisible} with the 'false' argument.\n *\n * @example\n * // Hides the format selector.\n * mySequence.hideFormatSelector();\n *\n */\n hideFormatSelector: function hideFormatSelector() {\n this._headerDiv.hide();\n },\n /**\n * Hides the whole component.\n *\n */\n hide: function hide() {\n this._headerDiv.hide();\n this._contentDiv.hide();\n },\n /**\n * Shows the whole component.\n *\n */\n show: function show() {\n this._headerDiv.show();\n this._contentDiv.show();\n },\n /*\n * Function: Sequence._setSelection\n * Purpose: Update the current selection.\n * Returns: -\n * Inputs: start -> {int} Start of the region to be selected.\n * \t\t end -> {int} End of the region to be selected.\n */\n _setSelection: function _setSelection(start, end) {\n //alert(\"adsas\");\n\n var current = this.opt.selection;\n var change = {};\n\n // Which is the change on selection?\n if (current.start == start) {\n // forward?\n if (current.end < end) {\n change.start = current.end;\n change.end = end;\n } else {\n this._restoreHighlights(end + 1, current.end);\n }\n } else if (current.end == end) {\n // forward?\n if (current.start > start) {\n change.start = start;\n change.end = current.start;\n } else {\n this._restoreHighlights(current.start, start - 1);\n }\n } else {\n this._restoreHighlights(current.start, current.end);\n change.start = start;\n change.end = end;\n }\n current.start = start;\n current.end = end;\n },\n /*\n * Function: Sequence._repaintSelection\n * Purpose: Repaint the whole current selection.\n * Returns: -\n * Inputs: -\n */\n _repaintSelection: function _repaintSelection() {\n var s = this.opt.selection;\n this._setSelection(0, 0);\n this._setSelection(s.start, s.end);\n },\n /*\n * Function: Sequence._redraw\n * Purpose: Repaint the current sequence.\n * Returns: -\n * Inputs: -\n */\n _redraw: function _redraw() {\n var i = 0;\n var self = this;\n\n // Reset the content\n //this._contentDiv.text('');\n this._contentDiv.children().remove();\n\n // Rebuild the spans of the sequence\n // according to format\n if (this.opt.format == 'RAW') {\n this._drawRaw();\n } else if (this.opt.format == 'CODATA') {\n this._drawCodata();\n } else if (this.opt.format == 'FASTA') {\n this._drawFasta();\n } else {\n this.opt.format = 'PRIDE';\n this._drawPride();\n }\n\n // Restore the highlighted regions\n this._applyHighlights(this._highlights);\n this._repaintSelection();\n this._addSpanEvents();\n },\n /*\n * Function: Sequence._drawFasta\n * Purpose: Repaint the current sequence using FASTA format.\n * Returns: -\n * Inputs: -\n */\n _drawFasta: function _drawFasta() {\n var self = this;\n var a = this.opt.sequence.toUpperCase().split('');\n var pre = jQuery('
').appendTo(this._contentDiv);\n var i = 1;\n var arr = [];\n var str = '>' + this.opt.id + ' ' + a.length + ' bp
';\n\n /* Correct column size in case the sequence is as small peptide */\n var numCols = this.opt.columns.size;\n if (this.opt.sequence.length < this.opt.columns.size) {\n numCols = this.opt.sequence.length;\n }\n var opt = {\n numCols: numCols,\n numColsForSpace: 0\n };\n str += this._drawSequence(a, opt);\n pre.html(str);\n this._drawAnnotations(opt);\n },\n /*\n * Function: Sequence._drawCodata\n * Purpose: Repaint the current sequence using CODATA format.\n * Returns: -\n * Inputs: -\n */\n _drawCodata: function _drawCodata() {\n var seq = this.opt.sequence.toUpperCase().split('');\n\n // Add header.\n if (this.opt.formatOptions !== undefined) {\n if (this.opt.formatOptions.title !== undefined) {\n if (this.opt.formatOptions.title != false) {\n var header = $('
').addClass('header').appendTo(this._contentDiv);\n header.html('ENTRY ' + this.opt.id + '
SEQUENCE
');\n }\n }\n }\n\n /* Correct column size in case the sequence is as small peptide */\n var numCols = this.opt.columns.size;\n if (this.opt.sequence.length < this.opt.columns.size) {\n numCols = this.opt.sequence.length;\n }\n var opt = {\n numLeft: true,\n numLeftSize: 7,\n numLeftPad: ' ',\n numTop: true,\n numTopEach: 5,\n numCols: numCols,\n numColsForSpace: 0,\n spaceBetweenChars: true\n };\n this._drawSequence(seq, opt);\n\n // Add footer.\n if (this.opt.formatOptions !== undefined) {\n if (this.opt.formatOptions.footer !== undefined) {\n if (this.opt.formatOptions.footer != false) {\n var footer = $('
').addClass('footer').appendTo(this._contentDiv);\n footer.html('
///');\n }\n }\n }\n this._drawAnnotations(opt);\n },\n /*\n * Function: Sequence._drawAnnotations\n * Purpose: Paint the annotations on the sequence.\n * Returns: -\n * Inputs: settings -> {object}\n */\n _drawAnnotations: function _drawAnnotations(settings) {\n var self = this;\n var a = this.opt.sequence.toLowerCase().split('');\n var annotations = this._annotations;\n var leftSpaces = '';\n var row = '';\n var annot = '';\n\n // Index at the left?\n if (settings.numLeft) {\n leftSpaces += this._formatIndex(' ', settings.numLeftSize + 2, ' ');\n }\n for (var i = 0; i < a.length; i += settings.numCols) {\n row = '';\n for (var key in annotations) {\n annotations[key].id = this.getId() + '_' + key;\n annot = this._getHTMLRowAnnot(i + 1, annotations[key], settings);\n if (annot.length > 0) {\n row += '
';\n row += leftSpaces;\n row += annot;\n row += '
';\n }\n }\n var numCols = settings.numCols;\n var charRemaining = a.length - i;\n if (charRemaining < numCols) {\n numCols = charRemaining;\n }\n if (settings.numRight) {\n jQuery(row).insertAfter('div#' + self.opt.target + ' div pre span#numRight_' + this.getId() + '_' + (i + numCols));\n } else {\n jQuery(row).insertAfter('div#' + self.opt.target + ' div pre span#' + this.getId() + '_' + (i + numCols));\n }\n }\n\n // add tool tips and background' coloring effect\n jQuery(this._contentDiv).find('.annotation').each(function () {\n self._addToolTip(this, function () {\n return self._getAnnotationString(jQuery(this).attr('id'));\n });\n jQuery(this).mouseover(function (e) {\n jQuery('.annotation.' + jQuery(e.target).attr('id')).each(function () {\n jQuery(this).css('background-color', jQuery(this).attr('color'));\n });\n }).mouseout(function () {\n jQuery('.annotation').css('background-color', 'transparent');\n }).click(function (e) {\n var name = undefined;\n var id = jQuery(e.target).attr('id');\n for (var i = 0; i < self._annotations.length; i++) {\n if (self._annotations[i].id == id) {\n name = self._annotations[i].name;\n continue;\n }\n }\n self.trigger(EVT_ON_ANNOTATION_CLICKED, {\n 'name': name\n //\"pos\": parseInt( jQuery(e.target).attr(\"pos\") )\n });\n });\n });\n },\n /*\n * Function: Sequence._getAnnotationString\n * Purpose: Get the annotation text message for the tooltip\n * Returns: {string} Annotation text for the annotation\n * Inputs: id -> {int} index of the internal annotation array\n */\n _getAnnotationString: function _getAnnotationString(id) {\n var annotation = this._annotations[id.substr(id.indexOf('_') + 1)];\n return annotation.name + '
' + (annotation.html ? annotation.html : '');\n },\n /*\n * Function: Sequence._getHTMLRowAnnot\n * Purpose: Build an annotation\n * Returns: HTML of the annotation\n * Inputs: currentPos -> {int}\n * \t\t\t annotation -> {Object}\n * \t\t settings -> {Object}\n */\n _getHTMLRowAnnot: function _getHTMLRowAnnot(currentPos, annotation, settings) {\n var styleBegin = 'border-left:1px solid; border-bottom:1px solid; border-color:';\n var styleOn = 'border-bottom:1px solid; border-color:';\n var styleEnd = 'border-bottom:1px solid; border-right:1px solid; border-color:';\n var styleBeginAndEnd = 'border-left:1px solid; border-right:1px solid; border-bottom:1px solid; border-color:';\n var row = [];\n var end = currentPos + settings.numCols;\n var spaceBetweenChars = settings.spaceBetweenChars ? ' ' : '';\n var defaultColor = annotation.color;\n var id = annotation.id;\n for (var pos = currentPos; pos < end; pos++) {\n // regions\n for (var r in annotation.regions) {\n region = annotation.regions[r];\n spaceAfter = '';\n spaceAfter += pos % settings.numColsForSpace == 0 ? ' ' : '';\n spaceAfter += spaceBetweenChars;\n color = region.color ? region.color : defaultColor;\n data = 'class=\"annotation ' + id + '\" id=\"' + id + '\" color=\"' + color + '\" pos=\"' + pos + '\"';\n if (pos == region.start && pos == region.end) {\n row[pos] = '
';\n row[pos] += spaceAfter;\n row[pos] += ' ';\n } else if (pos == region.start) {\n row[pos] = '
';\n row[pos] += spaceAfter;\n row[pos] += ' ';\n } else if (pos == region.end) {\n row[pos] = '
';\n //row[pos] += spaceAfter;\n row[pos] += ' ';\n } else if (pos > region.start && pos < region.end) {\n row[pos] = '
';\n row[pos] += spaceAfter;\n row[pos] += ' ';\n } else if (!row[pos]) {\n row[pos] = ' ';\n row[pos] += spaceAfter;\n }\n }\n }\n var str = row.join('');\n return str.indexOf('span') == -1 ? '' : str;\n },\n /*\n * Function: Sequence._drawRaw\n * Purpose: Repaint the current sequence using RAW format.\n * Returns: -\n * Inputs: -\n */\n _drawRaw: function _drawRaw() {\n var self = this;\n var a = this.opt.sequence.toLowerCase().split('');\n var i = 0;\n var arr = [];\n var pre = jQuery('
').appendTo(this._contentDiv);\n\n /* Correct column size in case the sequence is as small peptide */\n var numCols = this.opt.columns.size;\n if (this.opt.sequence.length < this.opt.columns.size) {\n numCols = this.opt.sequence.length;\n }\n var opt = {\n numCols: numCols\n };\n pre.html(this._drawSequence(a, opt));\n this._drawAnnotations(opt);\n },\n /*\n * Function: Sequence._drawPride\n * Purpose: Repaint the current sequence using PRIDE format.\n * Returns: -\n * Inputs: -\n */\n _drawPride: function _drawPride() {\n var seq = this.opt.sequence.toUpperCase().split('');\n\n /* Correct column size in case the sequence is as small peptide */\n var numCols = this.opt.columns.size;\n if (this.opt.sequence.length < this.opt.columns.size) {\n numCols = this.opt.sequence.length;\n }\n var opt = {\n numLeft: true,\n numLeftSize: 5,\n numLeftPad: ' ',\n numRight: false,\n numRightSize: 5,\n numRightPad: '',\n numCols: numCols,\n numColsForSpace: this.opt.columns.spacedEach\n };\n this._drawSequence(seq, opt);\n this._drawAnnotations(opt);\n },\n /*\n * Function: Sequence._drawSequence\n * Purpose: Repaint the current sequence using CUSTOM format.\n * Returns: -\n * Inputs: a -> {char[]} a The sequence strand.\n * \t\t\t opt -> {Object} opt The CUSTOM format.\n */\n _drawSequence: function _drawSequence(a, opt) {\n var indL = '';\n var indT = '';\n var indR = '\\n';\n var str = '';\n\n // Index at top?\n if (opt.numTop) {\n indT += '
';\n var size = opt.spaceBetweenChars ? opt.numTopEach * 2 : opt.numTopEach;\n if (opt.numLeft) {\n indT += this._formatIndex(' ', opt.numLeftSize, ' ');\n }\n indT += this._formatIndex(' ', size, ' ');\n for (var x = opt.numTopEach; x < opt.numCols; x += opt.numTopEach) {\n indT += this._formatIndex(x, size, ' ', true);\n }\n indT += ' ';\n }\n\n // Index at the left?\n if (opt.numLeft) {\n indL += '
';\n indL += this._formatIndex(1, opt.numLeftSize, opt.numLeftPad);\n indL += ' ';\n indL += ' ';\n indL += '\\n';\n }\n var j = 1;\n for (var i = 1; i <= a.length; i++) {\n if (i % opt.numCols == 0) {\n str += '
' + a[i - 1] + ' ';\n if (opt.numRight) {\n indR += '
';\n indR += ' ';\n indR += this._formatIndex(i, opt.numRightSize, opt.numRightPad);\n indR += ' ';\n indR += '\\n';\n }\n str += '
';\n var aaRemaining = a.length - i;\n if (opt.numLeft && aaRemaining > 0) {\n indL += '
';\n indL += this._formatIndex(i + 1, opt.numLeftSize, opt.numLeftPad);\n indL += ' ';\n indL += ' ';\n indL += '\\n';\n }\n j = 1;\n } else {\n str += '
' + a[i - 1];\n str += ' ';\n j++;\n }\n }\n str += '
';\n if (jQuery.browser.msie) {\n str = '
' + str + ' ';\n }\n var ret = [];\n if (opt.numTop) {\n $('
').html(indT).addClass('indT').css({\n color: '#aaa'\n }).appendTo(this._contentDiv);\n }\n if (opt.numLeft) {\n $('
').html(indL).addClass('indL hidden sm:inline-block').appendTo(this._contentDiv);\n }\n $('
').html(str).addClass('seqF inline-block').appendTo(this._contentDiv);\n if (opt.numRight) {\n $('
').html(indR).addClass('indR').css({\n color: '#aaa',\n display: 'inline-block'\n }).appendTo(this._contentDiv);\n }\n return str;\n },\n /*\n * Function: Sequence._formatIndex\n * Purpose: Build the HTML corresponding to counting numbers (top, left, right) in the strand.\n * Returns: -\n * Inputs: number -> {int} The number\n * \t\t\t size -> {int} Number of bins to suit the number.\n * \t\t\t fillingChar -> {char} Character to be used for filling out blank bins.\n * \t\t\t alignLeft -> {bool} Tell if aligned to the left.\n */\n _formatIndex: function _formatIndex(number, size, fillingChar, alignLeft) {\n var str = number.toString();\n var filling = '';\n var padding = size - str.length;\n if (padding > 0) {\n while (padding-- > 0) {\n filling += '
' + fillingChar + ' ';\n }\n if (alignLeft) {\n str = number + filling;\n } else {\n str = filling + number;\n }\n }\n return str;\n },\n /*\n * Function: Sequence._addSpanEvents\n * Purpose: Add the event handlers to the strand.\n * Returns: -\n * Inputs: -\n */\n _addSpanEvents: function _addSpanEvents() {\n var self = this;\n var isMouseDown = false;\n var clickPos;\n var currentPos;\n self._contentDiv.find('.sequence').each(function () {\n // Register the starting position\n jQuery(this).mousedown(function () {\n var id = jQuery(this).attr('id');\n currentPos = parseInt(id.substr(id.indexOf('_') + 1));\n clickPos = currentPos;\n self._setSelection(clickPos, currentPos);\n isMouseDown = true;\n\n // Selection is happening, raise an event\n self.trigger(EVT_ON_SELECTION_CHANGE, {\n 'start': self.opt.selection.start,\n 'end': self.opt.selection.end\n });\n }).mouseover(function () {\n // Update selection\n // Show tooltip containing the position\n var id = jQuery(this).attr('id');\n currentPos = parseInt(id.substr(id.indexOf('_') + 1));\n if (isMouseDown) {\n if (currentPos > clickPos) {\n self._setSelection(clickPos, currentPos);\n } else {\n self._setSelection(currentPos, clickPos);\n }\n\n // Selection is happening, raise an event\n self.trigger(EVT_ON_SELECTION_CHANGE, {\n 'start': self.opt.selection.start,\n 'end': self.opt.selection.end\n });\n }\n }).mouseup(function () {\n isMouseDown = false;\n // Selection is done, raise an event\n self.trigger(EVT_ON_SELECTION_CHANGED, {\n 'start': self.opt.selection.start,\n 'end': self.opt.selection.end\n });\n });\n\n // Add a tooltip for this sequence base.\n self._addToolTip.call(self, this, function () {\n if (isMouseDown) {\n return '[' + self.opt.selection.start + ', ' + self.opt.selection.end + ']';\n } else {\n return currentPos;\n }\n });\n }).css('cursor', 'pointer');\n },\n /*\n * Function: Sequence._addTooltip\n * Purpose: Add a tooltip around the target DOM element provided as argument\n * Returns: -\n * Inputs: target -> {Element} DOM element wich is the targeted focus for the tooltip.\n * \t\t\t cbGetMessageFunction -> {function} A callback function wich returns the message to be displayed in the tip.\n */\n _addToolTip: function _addToolTip(target, cbGetMessageFunction) {\n var tipId = this.opt._tooltip;\n jQuery(target).mouseover(function (e) {\n var offset = jQuery(e.target).offset();\n var containerOffset = jQuery(e.target).closest('.seqF').offset();\n if (!jQuery(tipId).is(':visible')) {\n jQuery(tipId).css({\n 'background-color': '#000',\n 'padding': '3px 10px 3px 10px',\n 'top': offset.top - containerOffset.top + jQuery(e.target).height() + 15 + 'px',\n 'left': offset.left - containerOffset.left + jQuery(e.target).width() + 70 + 'px',\n 'color': '#fff',\n 'font-size': '12px',\n 'position': 'absolute'\n }).animate({\n opacity: '0.85'\n }, 10).html(cbGetMessageFunction.call(target)).show();\n }\n }).mouseout(function () {\n //Remove the appended tooltip template\n jQuery(tipId).hide();\n });\n },\n /**\n * Annotate a set of intervals provided in the argument.\n *\n * @example\n * // Annotations using regions with different colors.\n * mySequence.addAnnotation({\n * name:\"UNIPROT\",\n * html:\"<br> Example of <b>HTML</b>\",\n * color:\"green\",\n * regions: [\n * {start: 540, end: 560},\n * {start: 561, end:580, color: \"#FFA010\"},\n * {start: 581, end:590, color: \"red\"},\n * {start: 690, end:710}]\n * });\n *\n *\n * @param {Object} annotation The intervals belonging to the same annotation.\n * Syntax: { name: <value>, color: <HTMLColorCode>, html: <HTMLString>, regions: [{ start: <startVal1>, end: <endVal1>}, ..., { start: <startValN>, end: <endValN>}] }\n */\n addAnnotation: function addAnnotation(annotation) {\n this._annotations.push(annotation);\n this._redraw();\n },\n /**\n * Removes an annotation by means of its name.\n *\n * @example\n * // Remove the UNIPROT annotation.\n * mySequence.removeAnnotation('UNIPROT');\n *\n * @param {string} name The name of the annotation to be removed.\n *\n */\n removeAnnotation: function removeAnnotation(name) {\n for (var i = 0; i < this._annotations.length; i++) {\n if (name != this._annotations[i].name) {\n this._annotations.splice(i, 1);\n this._redraw();\n break;\n }\n }\n },\n /**\n * Removes all the current annotations.\n *\n * @example\n * mySequence.removeAllAnnotations();\n *\n */\n removeAllAnnotations: function removeAllAnnotations() {\n this._annotations = [];\n this._redraw();\n }\n });\n require('biojs-events').mixin(Sequence.prototype);\n }, {\n 'biojs-events': 2,\n 'jquery-browser-plugin': 20,\n 'js-class': 22\n }],\n 2: [function (require, module, exports) {\n var events = require('backbone-events-standalone');\n events.onAll = function (callback, context) {\n this.on('all', callback, context);\n return this;\n };\n\n // Mixin utility\n events.oldMixin = events.mixin;\n events.mixin = function (proto) {\n events.oldMixin(proto);\n // add custom onAll\n var exports = ['onAll'];\n for (var i = 0; i < exports.length; i++) {\n var name = exports[i];\n proto[name] = this[name];\n }\n return proto;\n };\n module.exports = events;\n }, {\n 'backbone-events-standalone': 4\n }],\n 3: [function (require, module, exports) {\n /**\n * Standalone extraction of Backbone.Events, no external dependency required.\n * Degrades nicely when Backone/underscore are already available in the current\n * global context.\n *\n * Note that docs suggest to use underscore's `_.extend()` method to add Events\n * support to some given object. A `mixin()` method has been added to the Events\n * prototype to avoid using underscore for that sole purpose:\n *\n * var myEventEmitter = BackboneEvents.mixin({});\n *\n * Or for a function constructor:\n *\n * function MyConstructor(){}\n * MyConstructor.prototype.foo = function(){}\n * BackboneEvents.mixin(MyConstructor.prototype);\n *\n * (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.\n * (c) 2013 Nicolas Perriault\n */\n /* global exports:true, define, module */\n (function () {\n var root = this,\n breaker = {},\n nativeForEach = Array.prototype.forEach,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n slice = Array.prototype.slice,\n idCounter = 0;\n\n // Returns a partial implementation matching the minimal API subset required\n // by Backbone.Events\n function miniscore() {\n return {\n keys: Object.keys || function (obj) {\n if (_typeof(obj) !== 'object' && typeof obj !== 'function' || obj === null) {\n throw new TypeError('keys() called on a non-object');\n }\n var key,\n keys = [];\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n keys[keys.length] = key;\n }\n }\n return keys;\n },\n uniqueId: function uniqueId(prefix) {\n var id = ++idCounter + '';\n return prefix ? prefix + id : id;\n },\n has: function has(obj, key) {\n return hasOwnProperty.call(obj, key);\n },\n each: function each(obj, iterator, context) {\n if (obj == null) return;\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n } else if (obj.length === +obj.length) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (iterator.call(context, obj[i], i, obj) === breaker) return;\n }\n } else {\n for (var key in obj) {\n if (this.has(obj, key)) {\n if (iterator.call(context, obj[key], key, obj) === breaker) return;\n }\n }\n }\n },\n once: function once(func) {\n var ran = false,\n memo;\n return function () {\n if (ran) return memo;\n ran = true;\n memo = func.apply(this, arguments);\n func = null;\n return memo;\n };\n }\n };\n }\n var _ = miniscore(),\n Events;\n\n // Backbone.Events\n // ---------------\n\n // A module that can be mixed in to *any object* in order to provide it with\n // custom events. You may bind with `on` or remove with `off` callback\n // functions to an event; `trigger`-ing an event fires all callbacks in\n // succession.\n //\n // var object = {};\n // _.extend(object, Backbone.Events);\n // object.on('expand', function(){ alert('expanded'); });\n // object.trigger('expand');\n //\n Events = {\n // Bind an event to a `callback` function. Passing `\"all\"` will bind\n // the callback to all events fired.\n on: function on(name, callback, context) {\n if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this;\n this._events || (this._events = {});\n var events = this._events[name] || (this._events[name] = []);\n events.push({\n callback: callback,\n context: context,\n ctx: context || this\n });\n return this;\n },\n // Bind an event to only be triggered a single time. After the first time\n // the callback is invoked, it will be removed.\n once: function once(name, callback, context) {\n if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this;\n var self = this;\n var once = _.once(function () {\n self.off(name, once);\n callback.apply(this, arguments);\n });\n once._callback = callback;\n return this.on(name, once, context);\n },\n // Remove one or many callbacks. If `context` is null, removes all\n // callbacks with that function. If `callback` is null, removes all\n // callbacks for the event. If `name` is null, removes all bound\n // callbacks for all events.\n off: function off(name, callback, context) {\n var retain, ev, events, names, i, l, j, k;\n if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;\n if (!name && !callback && !context) {\n this._events = {};\n return this;\n }\n names = name ? [name] : _.keys(this._events);\n for (i = 0, l = names.length; i < l; i++) {\n name = names[i];\n if (events = this._events[name]) {\n this._events[name] = retain = [];\n if (callback || context) {\n for (j = 0, k = events.length; j < k; j++) {\n ev = events[j];\n if (callback && callback !== ev.callback && callback !== ev.callback._callback || context && context !== ev.context) {\n retain.push(ev);\n }\n }\n }\n if (!retain.length) delete this._events[name];\n }\n }\n return this;\n },\n // Trigger one or many events, firing all bound callbacks. Callbacks are\n // passed the same arguments as `trigger` is, apart from the event name\n // (unless you're listening on `\"all\"`, which will cause your callback to\n // receive the true name of the event as the first argument).\n trigger: function trigger(name) {\n if (!this._events) return this;\n var args = slice.call(arguments, 1);\n if (!eventsApi(this, 'trigger', name, args)) return this;\n var events = this._events[name];\n var allEvents = this._events.all;\n if (events) triggerEvents(events, args);\n if (allEvents) triggerEvents(allEvents, arguments);\n return this;\n },\n // Tell this object to stop listening to either specific events ... or\n // to every object it's currently listening to.\n stopListening: function stopListening(obj, name, callback) {\n var listeners = this._listeners;\n if (!listeners) return this;\n var deleteListener = !name && !callback;\n if (_typeof(name) === 'object') callback = this;\n if (obj) (listeners = {})[obj._listenerId] = obj;\n for (var id in listeners) {\n listeners[id].off(name, callback, this);\n if (deleteListener) delete this._listeners[id];\n }\n return this;\n }\n };\n\n // Regular expression used to split event strings.\n var eventSplitter = /\\s+/;\n\n // Implement fancy features of the Events API such as multiple event\n // names `\"change blur\"` and jQuery-style event maps `{change: action}`\n // in terms of the existing API.\n var eventsApi = function eventsApi(obj, action, name, rest) {\n if (!name) return true;\n\n // Handle event maps.\n if (_typeof(name) === 'object') {\n for (var key in name) {\n obj[action].apply(obj, [key, name[key]].concat(rest));\n }\n return false;\n }\n\n // Handle space separated event names.\n if (eventSplitter.test(name)) {\n var names = name.split(eventSplitter);\n for (var i = 0, l = names.length; i < l; i++) {\n obj[action].apply(obj, [names[i]].concat(rest));\n }\n return false;\n }\n return true;\n };\n\n // A difficult-to-believe, but optimized internal dispatch function for\n // triggering events. Tries to keep the usual cases speedy (most internal\n // Backbone events have 3 arguments).\n var triggerEvents = function triggerEvents(events, args) {\n var ev,\n i = -1,\n l = events.length,\n a1 = args[0],\n a2 = args[1],\n a3 = args[2];\n switch (args.length) {\n case 0:\n while (++i < l) (ev = events[i]).callback.call(ev.ctx);\n return;\n case 1:\n while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1);\n return;\n case 2:\n while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2);\n return;\n case 3:\n while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3);\n return;\n default:\n while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args);\n }\n };\n var listenMethods = {\n listenTo: 'on',\n listenToOnce: 'once'\n };\n\n // Inversion-of-control versions of `on` and `once`. Tell *this* object to\n // listen to an event in another object ... keeping track of what it's\n // listening to.\n _.each(listenMethods, function (implementation, method) {\n Events[method] = function (obj, name, callback) {\n var listeners = this._listeners || (this._listeners = {});\n var id = obj._listenerId || (obj._listenerId = _.uniqueId('l'));\n listeners[id] = obj;\n if (_typeof(name) === 'object') callback = this;\n obj[implementation](name, callback, this);\n return this;\n };\n });\n\n // Aliases for backwards compatibility.\n Events.bind = Events.on;\n Events.unbind = Events.off;\n\n // Mixin utility\n Events.mixin = function (proto) {\n var exports = ['on', 'once', 'off', 'trigger', 'stopListening', 'listenTo', 'listenToOnce', 'bind', 'unbind'];\n _.each(exports, function (name) {\n proto[name] = this[name];\n }, this);\n return proto;\n };\n\n // Export Events as BackboneEvents depending on current context\n if (typeof define === 'function') {\n define(function () {\n return Events;\n });\n } else if (typeof exports !== 'undefined') {\n if (typeof module !== 'undefined' && module.exports) {\n exports = module.exports = Events;\n }\n exports.BackboneEvents = Events;\n } else {\n root.BackboneEvents = Events;\n }\n })(this);\n }, {}],\n 4: [function (require, module, exports) {\n module.exports = require('./backbone-events-standalone');\n }, {\n './backbone-events-standalone': 3\n }],\n 5: [function (require, module, exports) {\n // Generated by CoffeeScript 1.8.0\n var GenericReader, xhr;\n xhr = require('nets');\n module.exports = GenericReader = function () {\n function GenericReader() {}\n GenericReader.read = function (url, callback) {\n var onret;\n onret = function (_this) {\n return function (err, response, text) {\n return _this._onRetrieval(text, callback);\n };\n }(this);\n return xhr(url, onret);\n };\n GenericReader._onRetrieval = function (text, callback) {\n var rText;\n rText = this.parse(text);\n return callback(rText);\n };\n return GenericReader;\n }();\n }, {\n 'nets': 12\n }],\n 6: [function (require, module, exports) {\n // Generated by CoffeeScript 1.8.0\n var Fasta,\n GenericReader,\n Seq,\n Str,\n __hasProp = {}.hasOwnProperty,\n __extends = function __extends(child, parent) {\n for (var key in parent) {\n if (__hasProp.call(parent, key)) child[key] = parent[key];\n }\n function ctor() {\n this.constructor = child;\n }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n child.__super__ = parent.prototype;\n return child;\n };\n Str = require('./strings');\n GenericReader = require('./generic_reader');\n Seq = require('biojs-model').seq;\n module.exports = Fasta = function (_super) {\n __extends(Fasta, _super);\n function Fasta() {\n return Fasta.__super__.constructor.apply(this, arguments);\n }\n Fasta.parse = function (text) {\n var currentSeq, database, databaseID, identifiers, k, label, line, seqs, _i, _len;\n seqs = [];\n if (Object.prototype.toString.call(text) !== '[object Array]') {\n text = text.split('\\n');\n }\n for (_i = 0, _len = text.length; _i < _len; _i++) {\n line = text[_i];\n if (line[0] === '>' || line[0] === ';') {\n label = line.slice(1);\n currentSeq = new Seq('', label, seqs.length);\n seqs.push(currentSeq);\n if (Str.contains('|', line)) {\n identifiers = label.split('|');\n k = 1;\n while (k < identifiers.length) {\n database = identifiers[k];\n databaseID = identifiers[k + 1];\n currentSeq.meta[database] = databaseID;\n k += 2;\n }\n currentSeq.name = identifiers[identifiers.length - 1];\n }\n } else {\n currentSeq.seq += line;\n }\n }\n return seqs;\n };\n return Fasta;\n }(GenericReader);\n }, {\n './generic_reader': 5,\n './strings': 7,\n 'biojs-model': 10\n }],\n 7: [function (require, module, exports) {\n // Generated by CoffeeScript 1.8.0\n var strings;\n strings = {\n contains: function contains(text, search) {\n return ''.indexOf.call(text, search, 0) !== -1;\n }\n };\n module.exports = strings;\n }, {}],\n 8: [function (require, module, exports) {\n // Generated by CoffeeScript 1.8.0\n var Utils;\n Utils = {};\n Utils.splitNChars = function (txt, num) {\n var i, result, _i, _ref;\n result = [];\n for (i = _i = 0, _ref = txt.length - 1; num > 0 ? _i <= _ref : _i >= _ref; i = _i += num) {\n result.push(txt.substr(i, num));\n }\n return result;\n };\n module.exports = Utils;\n }, {}],\n 9: [function (require, module, exports) {\n // Generated by CoffeeScript 1.8.0\n var FastaExporter, Utils;\n Utils = require('./utils');\n module.exports = FastaExporter = function () {\n function FastaExporter() {}\n FastaExporter['export'] = function (seqs, access) {\n var seq, text, _i, _len;\n text = '';\n for (_i = 0, _len = seqs.length; _i < _len; _i++) {\n seq = seqs[_i];\n if (access != null) {\n seq = access(seq);\n }\n text += '>' + seq.name + '\\n';\n text += Utils.splitNChars(seq.seq, 80).join('\\n');\n text += '\\n';\n }\n return text;\n };\n return FastaExporter;\n }();\n }, {\n './utils': 8\n }],\n 10: [function (require, module, exports) {\n module.exports.seq = require('./seq');\n }, {\n './seq': 11\n }],\n 11: [function (require, module, exports) {\n module.exports = function (seq, name, id) {\n this.seq = seq;\n this.name = name;\n this.id = id;\n this.meta = {};\n };\n }, {}],\n 12: [function (require, module, exports) {\n var req = require('request');\n module.exports = Nets;\n function Nets(uri, opts, cb) {\n req(uri, opts, cb);\n }\n }, {\n 'request': 13\n }],\n 13: [function (require, module, exports) {\n var window = require('global/window');\n var once = require('once');\n var parseHeaders = require('parse-headers');\n var messages = {\n '0': 'Internal XMLHttpRequest Error',\n '4': '4xx Client Error',\n '5': '5xx Server Error'\n };\n var XHR = window.XMLHttpRequest || noop;\n var XDR = 'withCredentials' in new XHR() ? XHR : window.XDomainRequest;\n module.exports = createXHR;\n function createXHR(options, callback) {\n if (typeof options === 'string') {\n options = {\n uri: options\n };\n }\n options = options || {};\n callback = once(callback);\n var xhr = options.xhr || null;\n if (!xhr) {\n if (options.cors || options.useXDR) {\n xhr = new XDR();\n } else {\n xhr = new XHR();\n }\n }\n var uri = xhr.url = options.uri || options.url;\n var method = xhr.method = options.method || 'GET';\n var body = options.body || options.data;\n var headers = xhr.headers = options.headers || {};\n var sync = !!options.sync;\n var isJson = false;\n var key;\n var load = options.response ? loadResponse : loadXhr;\n if ('json' in options) {\n isJson = true;\n headers['Accept'] = 'application/json';\n if (method !== 'GET' && method !== 'HEAD') {\n headers['Content-Type'] = 'application/json';\n body = JSON.stringify(options.json);\n }\n }\n xhr.onreadystatechange = readystatechange;\n xhr.onload = load;\n xhr.onerror = error;\n // IE9 must have onprogress be set to a unique function.\n xhr.onprogress = function () {\n // IE must die\n };\n // hate IE\n xhr.ontimeout = noop;\n xhr.open(method, uri, !sync);\n //backward compatibility\n if (options.withCredentials || options.cors && options.withCredentials !== false) {\n xhr.withCredentials = true;\n }\n\n // Cannot set timeout with sync request\n if (!sync) {\n xhr.timeout = 'timeout' in options ? options.timeout : 5000;\n }\n if (xhr.setRequestHeader) {\n for (key in headers) {\n if (headers.hasOwnProperty(key)) {\n xhr.setRequestHeader(key, headers[key]);\n }\n }\n } else if (options.headers) {\n throw new Error('Headers cannot be set on an XDomainRequest object');\n }\n if ('responseType' in options) {\n xhr.responseType = options.responseType;\n }\n if ('beforeSend' in options && typeof options.beforeSend === 'function') {\n options.beforeSend(xhr);\n }\n xhr.send(body);\n return xhr;\n function readystatechange() {\n if (xhr.readyState === 4) {\n load();\n }\n }\n function getBody() {\n // Chrome with requestType=blob throws errors arround when even testing access to responseText\n var body = null;\n if (xhr.response) {\n body = xhr.response;\n } else if (xhr.responseType === 'text' || !xhr.responseType) {\n body = xhr.responseText || xhr.responseXML;\n }\n if (isJson) {\n try {\n body = JSON.parse(body);\n } catch (e) {}\n }\n return body;\n }\n function getStatusCode() {\n return xhr.status === 1223 ? 204 : xhr.status;\n }\n\n // if we're getting a none-ok statusCode, build & return an error\n function errorFromStatusCode(status, body) {\n var error = null;\n if (status === 0 || status >= 400 && status < 600) {\n var message = (typeof body === 'string' ? body : false) || messages[String(status).charAt(0)];\n error = new Error(message);\n error.statusCode = status;\n }\n return error;\n }\n\n // will load the data & process the response in a special response object\n function loadResponse() {\n var status = getStatusCode();\n var body = getBody();\n var error = errorFromStatusCode(status, body);\n var response = {\n body: body,\n statusCode: status,\n statusText: xhr.statusText,\n raw: xhr\n };\n if (xhr.getAllResponseHeaders) {\n //remember xhr can in fact be XDR for CORS in IE\n response.headers = parseHeaders(xhr.getAllResponseHeaders());\n } else {\n response.headers = {};\n }\n callback(error, response, response.body);\n }\n\n // will load the data and add some response properties to the source xhr\n // and then respond with that\n function loadXhr() {\n var status = getStatusCode();\n var error = errorFromStatusCode(status);\n xhr.status = xhr.statusCode = status;\n xhr.body = getBody();\n xhr.headers = parseHeaders(xhr.getAllResponseHeaders());\n callback(error, xhr, xhr.body);\n }\n function error(evt) {\n callback(evt, xhr);\n }\n }\n function noop() {}\n }, {\n 'global/window': 14,\n 'once': 15,\n 'parse-headers': 19\n }],\n 14: [function (require, module, exports) {\n (function (global) {\n if (typeof window !== 'undefined') {\n module.exports = window;\n } else if (typeof global !== 'undefined') {\n module.exports = global;\n } else if (typeof self !== 'undefined') {\n module.exports = self;\n } else {\n module.exports = {};\n }\n }).call(this, typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});\n }, {}],\n 15: [function (require, module, exports) {\n module.exports = once;\n once.proto = once(function () {\n Object.defineProperty(Function.prototype, 'once', {\n value: function value() {\n return once(this);\n },\n configurable: true\n });\n });\n function once(fn) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n return fn.apply(this, arguments);\n };\n }\n }, {}],\n 16: [function (require, module, exports) {\n var isFunction = require('is-function');\n module.exports = forEach;\n var toString = Object.prototype.toString;\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n function forEach(list, iterator, context) {\n if (!isFunction(iterator)) {\n throw new TypeError('iterator must be a function');\n }\n if (arguments.length < 3) {\n context = this;\n }\n if (toString.call(list) === '[object Array]') forEachArray(list, iterator, context);else if (typeof list === 'string') forEachString(list, iterator, context);else forEachObject(list, iterator, context);\n }\n function forEachArray(array, iterator, context) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (hasOwnProperty.call(array, i)) {\n iterator.call(context, array[i], i, array);\n }\n }\n }\n function forEachString(string, iterator, context) {\n for (var i = 0, len = string.length; i < len; i++) {\n // no such thing as a sparse string.\n iterator.call(context, string.charAt(i), i, string);\n }\n }\n function forEachObject(object, iterator, context) {\n for (var k in object) {\n if (hasOwnProperty.call(object, k)) {\n iterator.call(context, object[k], k, object);\n }\n }\n }\n }, {\n 'is-function': 17\n }],\n 17: [function (require, module, exports) {\n module.exports = isFunction;\n var toString = Object.prototype.toString;\n function isFunction(fn) {\n var string = toString.call(fn);\n return string === '[object Function]' || typeof fn === 'function' && string !== '[object RegExp]' || typeof window !== 'undefined' && (\n // IE8 and below\n fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt);\n }\n }, {}],\n 18: [function (require, module, exports) {\n exports = module.exports = trim;\n function trim(str) {\n return str.replace(/^\\s*|\\s*$/g, '');\n }\n exports.left = function (str) {\n return str.replace(/^\\s*/, '');\n };\n exports.right = function (str) {\n return str.replace(/\\s*$/, '');\n };\n }, {}],\n 19: [function (require, module, exports) {\n var trim = require('trim'),\n forEach = require('for-each'),\n isArray = function isArray(arg) {\n return Object.prototype.toString.call(arg) === '[object Array]';\n };\n module.exports = function (headers) {\n if (!headers) return {};\n var result = {};\n forEach(trim(headers).split('\\n'), function (row) {\n var index = row.indexOf(':'),\n key = trim(row.slice(0, index)).toLowerCase(),\n value = trim(row.slice(index + 1));\n if (typeof result[key] === 'undefined') {\n result[key] = value;\n } else if (isArray(result[key])) {\n result[key].push(value);\n } else {\n result[key] = [result[key], value];\n }\n });\n return result;\n };\n }, {\n 'for-each': 16,\n 'trim': 18\n }],\n 20: [function (require, module, exports) {\n module.exports = require('./jquery.browser');\n }, {\n './jquery.browser': 21\n }],\n 21: [function (require, module, exports) {\n /*!\n * jQuery Browser Plugin v0.0.6\n * https://github.com/gabceb/jquery-browser-plugin\n *\n * Original jquery-browser code Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors\n * http://jquery.org/license\n *\n * Modifications Copyright 2013 Gabriel Cebrian\n * https://github.com/gabceb\n *\n * Released under the MIT license\n *\n * Date: 2013-07-29T17:23:27-07:00\n */\n\n var matched, browser;\n var uaMatch = function uaMatch(ua) {\n ua = ua.toLowerCase();\n var match = /(opr)[\\/]([\\w.]+)/.exec(ua) || /(chrome)[ \\/]([\\w.]+)/.exec(ua) || /(version)[ \\/]([\\w.]+).*(safari)[ \\/]([\\w.]+)/.exec(ua) || /(webkit)[ \\/]([\\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \\/]([\\w.]+)/.exec(ua) || /(msie) ([\\w.]+)/.exec(ua) || ua.indexOf('trident') >= 0 && /(rv)(?::| )([\\w.]+)/.exec(ua) || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\\w.]+)|)/.exec(ua) || [];\n var platform_match = /(ipad)/.exec(ua) || /(iphone)/.exec(ua) || /(android)/.exec(ua) || /(windows phone)/.exec(ua) || /(win)/.exec(ua) || /(mac)/.exec(ua) || /(linux)/.exec(ua) || /(cros)/i.exec(ua) || [];\n return {\n browser: match[3] || match[1] || '',\n version: match[2] || '0',\n platform: platform_match[0] || ''\n };\n };\n matched = uaMatch(window.navigator.userAgent);\n browser = {};\n browser.uaMatch = uaMatch;\n if (matched.browser) {\n browser[matched.browser] = true;\n browser.version = matched.version;\n browser.versionNumber = parseInt(matched.version);\n }\n if (matched.platform) {\n browser[matched.platform] = true;\n }\n\n // These are all considered mobile platforms, meaning they run a mobile browser\n if (browser.android || browser.ipad || browser.iphone || browser['windows phone']) {\n browser.mobile = true;\n }\n\n // These are all considered desktop platforms, meaning they run a desktop browser\n if (browser.cros || browser.mac || browser.linux || browser.win) {\n browser.desktop = true;\n }\n\n // Chrome, Opera 15+ and Safari are webkit based browsers\n if (browser.chrome || browser.opr || browser.safari) {\n browser.webkit = true;\n }\n\n // IE11 has a new token so we will assign it msie to avoid breaking changes\n if (browser.rv) {\n var ie = 'msie';\n matched.browser = ie;\n browser[ie] = true;\n }\n\n // Opera 15+ are identified as opr\n if (browser.opr) {\n var opera = 'opera';\n matched.browser = opera;\n browser[opera] = true;\n }\n\n // Stock Android browsers are marked as Safari on Android.\n if (browser.safari && browser.android) {\n var android = 'android';\n matched.browser = android;\n browser[android] = true;\n }\n\n // Assign the name and platform variable\n browser.name = matched.browser;\n browser.platform = matched.platform;\n module.exports = browser;\n }, {}],\n 22: [function (require, module, exports) {\n (function (global) {\n /** @preserve http://github.com/easeway/js-class */\n\n // Class Definition using ECMA5 prototype chain\n\n function inherit(dest, src, noParent) {\n while (src && src !== Object.prototype) {\n Object.getOwnPropertyNames(src).forEach(function (name) {\n if (name != '.class' && !dest.hasOwnProperty(name)) {\n var desc = Object.getOwnPropertyDescriptor(src, name);\n Object.defineProperty(dest, name, desc);\n }\n });\n if (noParent) {\n break;\n }\n src = src.__proto__;\n }\n return dest;\n }\n var _Class = function Class(base, proto, options) {\n if (typeof base != 'function') {\n options = proto;\n proto = base;\n base = Object;\n }\n if (!proto) {\n proto = {};\n }\n if (!options) {\n options = {};\n }\n var meta = {\n name: options.name,\n base: base,\n \"implements\": []\n };\n var classProto = _Class.clone(proto);\n if (options[\"implements\"]) {\n (Array.isArray(options[\"implements\"]) ? options[\"implements\"] : [options[\"implements\"]]).forEach(function (implementedType) {\n if (typeof implementedType == 'function' && implementedType.prototype) {\n meta[\"implements\"].push(implementedType);\n _Class.extend(classProto, implementedType.prototype);\n }\n });\n }\n classProto.__proto__ = base.prototype;\n var theClass = function theClass() {\n if (typeof this.constructor == 'function') {\n this.constructor.apply(this, arguments);\n }\n };\n meta.type = theClass;\n theClass.prototype = classProto;\n Object.defineProperty(theClass, '.class.meta', {\n value: meta,\n enumerable: false,\n configurable: false,\n writable: false\n });\n Object.defineProperty(classProto, '.class', {\n value: theClass,\n enumerable: false,\n configurable: false,\n writable: false\n });\n if (options.statics) {\n _Class.extend(theClass, options.statics);\n }\n return theClass;\n };\n _Class.extend = inherit;\n _Class.clone = function (object) {\n return inherit({}, object);\n };\n function findType(meta, type) {\n while (meta) {\n if (meta.type.prototype === type.prototype) {\n return true;\n }\n for (var i in meta[\"implements\"]) {\n var implType = meta[\"implements\"][i];\n var implMeta = implType['.class.meta'];\n if (implMeta) {\n if (findType(implMeta, type)) {\n return true;\n }\n } else {\n for (var proto = implType.prototype; proto; proto = proto.__proto__) {\n if (proto === type.prototype) {\n return true;\n }\n }\n }\n }\n meta = meta.base ? meta.base['.class.meta'] : undefined;\n }\n return false;\n }\n var Checker = _Class({\n constructor: function constructor(object) {\n this.object = object;\n },\n typeOf: function typeOf(type) {\n if (this.object instanceof type) {\n return true;\n }\n var meta = _Class.typeInfo(this.object);\n return meta && findType(meta, type);\n }\n });\n\n // aliases\n Checker.prototype.a = Checker.prototype.typeOf;\n Checker.prototype.an = Checker.prototype.typeOf;\n _Class.is = function (object) {\n return new Checker(object);\n };\n _Class.typeInfo = function (object) {\n var theClass = object.__proto__['.class'];\n return theClass ? theClass['.class.meta'] : undefined;\n };\n _Class.VERSION = [0, 0, 2];\n if (module) {\n module.exports = _Class;\n } else {\n global.Class = _Class; // for browser\n }\n }).call(this, typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});\n }, {}],\n 'biojs-io-fasta': [function (require, module, exports) {\n // Generated by CoffeeScript 1.8.0\n module.exports.parse = require('./parser');\n module.exports.writer = require('./writer');\n }, {\n './parser': 6,\n './writer': 9\n }],\n 'biojs-vis-sequence': [function (require, module, exports) {\n module.exports = require('./lib/index');\n }, {\n './lib/index': 1\n }]\n}, {}, ['biojs-vis-sequence']);","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport \"./sequence\";\nimport React, { createRef } from \"react\";\nimport _ from \"underscore\";\n\n/**\n * Takes sequence accession as props, fetches the sequence from the server, and\n * displays it in a modal.\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nvar SequenceModal = /*#__PURE__*/function (_React$Component) {\n function SequenceModal(props) {\n var _this;\n _classCallCheck(this, SequenceModal);\n _this = _callSuper(this, SequenceModal, [props]);\n /**\n * Shows sequence viewer.\n */\n _defineProperty(_this, \"show\", function (url) {\n var _this$modalRef$curren;\n (_this$modalRef$curren = _this.modalRef.current) === null || _this$modalRef$curren === void 0 || _this$modalRef$curren.showModal();\n _this.setState({\n requestCompleted: false\n });\n _this.loadJSON(url);\n });\n /**\n * Hide sequence viewer.\n */\n _defineProperty(_this, \"hide\", function () {\n var _this$modalRef$curren2;\n (_this$modalRef$curren2 = _this.modalRef.current) === null || _this$modalRef$curren2 === void 0 || _this$modalRef$curren2.close();\n });\n _this.state = {\n error_msgs: [],\n sequences: [],\n requestCompleted: false,\n isModalVisible: false\n };\n _this.modalRef = /*#__PURE__*/createRef();\n return _this;\n }\n\n // Lifecycle methods. //\n _inherits(SequenceModal, _React$Component);\n return _createClass(SequenceModal, [{\n key: \"render\",\n value: function render() {\n var _this$state = this.state,\n isModalVisible = _this$state.isModalVisible,\n requestCompleted = _this$state.requestCompleted;\n return /*#__PURE__*/_jsx(\"div\", {\n className: \"relative sequence-viewer-wrap\",\n children: /*#__PURE__*/_jsx(\"dialog\", {\n ref: this.modalRef,\n className: \"sequence-viewer fixed p-4 w-full max-w-2xl bg-transparent focus:outline-none overflow-visible z-50\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"relative flex flex-col rounded-lg bg-white shadow\",\n children: [/*#__PURE__*/_jsxs(\"div\", {\n className: \"flex items-start justify-between rounded-t border-b p-5\",\n children: [/*#__PURE__*/_jsx(\"h3\", {\n className: \"text-xl font-medium text-gray-900\",\n children: \"View sequence\"\n }), /*#__PURE__*/_jsx(\"button\", {\n className: \"sequence-viewer-close ml-auto inline-flex items-center rounded-lg bg-transparent p-1.5 text-gray-400 hover:bg-gray-200\",\n onClick: this.hide,\n children: /*#__PURE__*/_jsx(\"i\", {\n className: \"fa-solid fa-xmark hover:text-black\"\n })\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n className: \"sequence-viewer-content max-h-[80vh] overflow-y-scroll\",\n children: requestCompleted && this.resultsJSX() || this.loadingJSX()\n })]\n })\n })\n });\n }\n }, {\n key: \"loadJSON\",\n value: (\n /**\n * Loads sequence using AJAX and updates modal state.\n */\n function () {\n var _loadJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {\n var response, data;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n _context.next = 3;\n return fetch(url);\n case 3:\n response = _context.sent;\n _context.next = 6;\n return response.json();\n case 6:\n data = _context.sent;\n this.setState({\n sequences: data.sequences,\n error_msgs: data.error_msgs,\n requestCompleted: true\n });\n _context.next = 15;\n break;\n case 10:\n _context.prev = 10;\n _context.t0 = _context[\"catch\"](0);\n console.log('Error fetching sequence:', _context.t0);\n this.hide();\n this.props.showErrorModal(_context.t0);\n case 15:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this, [[0, 10]]);\n }));\n function loadJSON(_x) {\n return _loadJSON.apply(this, arguments);\n }\n return loadJSON;\n }())\n }, {\n key: \"resultsJSX\",\n value: function resultsJSX() {\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"pt-2 px-6 pb-6 mt-2\",\n children: [this.state.error_msgs.map(function (error_msg, index) {\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"fastan\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"section-header border-b border-seqorange pl-px table mb-0 w-full pb-2\",\n children: /*#__PURE__*/_jsx(\"h4\", {\n className: \"text-sm table-cell\",\n children: error_msg[0]\n })\n }), /*#__PURE__*/_jsx(\"div\", {\n className: \"pt-0 px-0 pb-px\",\n children: /*#__PURE__*/_jsx(\"pre\", {\n className: \"m-0 p-0 rounded-none border-0 bg-inherit whitespace-pre-wrap break-keep\",\n children: error_msg[1]\n })\n })]\n }, \"error-message-\".concat(index));\n }), this.state.sequences.map(function (sequence, index) {\n return /*#__PURE__*/_jsx(SequenceViewer, {\n sequence: sequence\n }, \"sequence-viewer-\".concat(index));\n })]\n });\n }\n }, {\n key: \"loadingJSX\",\n value: function loadingJSX() {\n return /*#__PURE__*/_jsx(\"div\", {\n className: \"my-4 text-center\",\n children: /*#__PURE__*/_jsx(\"i\", {\n className: \"fa fa-spinner fa-3x fa-spin\"\n })\n });\n }\n }]);\n}(React.Component);\nexport { SequenceModal as default };\nvar SequenceViewer = /*#__PURE__*/function (_React$Component2) {\n function SequenceViewer() {\n _classCallCheck(this, SequenceViewer);\n return _callSuper(this, SequenceViewer, arguments);\n }\n _inherits(SequenceViewer, _React$Component2);\n return _createClass(SequenceViewer, [{\n key: \"render\",\n value: function render() {\n this.widgetID = this.widgetClass + \"-\" + new Date().getUTCMilliseconds();\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"fastan\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"section-header border-b border-seqorange pl-px table mb-0 w-full pb-2\",\n children: /*#__PURE__*/_jsxs(\"h4\", {\n className: \"text-sm table-cell\",\n children: [this.props.sequence.id, /*#__PURE__*/_jsxs(\"small\", {\n className: \"text-inherit\",\n children: [\"\\xA0 \", this.props.sequence.title]\n })]\n })\n }), /*#__PURE__*/_jsx(\"div\", {\n className: \"fastan-content relative pt-0 px-0 pb-px\",\n children: /*#__PURE__*/_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 setTimeout(function () {\n requestAnimationFrame(function () {\n widget.hideFormatSelector();\n }); // ensure React is done painting the DOM of the element before calling a function on it.\n });\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}(React.Component);","function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nimport { useState } from 'react';\nimport asMailtoHref from './mailto';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nvar ShareURLComponent = function ShareURLComponent(_ref) {\n var querydb = _ref.querydb,\n program = _ref.program,\n queryLength = _ref.queryLength,\n url = _ref.url;\n var _useState = useState(false),\n _useState2 = _slicedToArray(_useState, 2),\n copied = _useState2[0],\n setCopied = _useState2[1];\n var copyToClipboard = function copyToClipboard() {\n navigator.clipboard.writeText(url);\n setCopied(true);\n };\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"px-6 share-url-component\",\n children: [/*#__PURE__*/_jsx(\"input\", {\n className: \"w-full mb-3 pt-3\",\n name: \"shareableUrl\",\n type: \"text\",\n value: url,\n readOnly: true\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"py-4 flex justify-between items-center\",\n children: [/*#__PURE__*/_jsx(\"button\", {\n className: \"py-2 px-3 border border-transparent rounded-md shadow-sm text-white bg-seqblue hover:bg-seqorange focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-seqorange\",\n onClick: copyToClipboard,\n children: copied ? 'Copied!' : 'Copy to Clipboard'\n }), /*#__PURE__*/_jsx(\"a\", {\n href: asMailtoHref(querydb, program, queryLength, url, true),\n children: \"Share via email\"\n })]\n })]\n });\n};\nexport default ShareURLComponent;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nimport React, { Component } from 'react';\nimport _ from 'underscore';\nimport downloadFASTA from './download_fasta';\nimport asMailtoHref from './mailto';\nimport CloudShareModal from './cloud_share_modal';\nimport DownloadLinks from 'download_links';\n/**\n * checks whether code is being run by jest\n */\n// eslint-disable-next-line no-undef\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nvar isTestMode = function isTestMode() {\n return process.env.JEST_WORKER_ID !== undefined || process.env.NODE_ENV === 'test';\n};\n/**\n * Renders links for downloading hit information in different formats.\n * Renders links for navigating to each query.\n */\nvar _default = /*#__PURE__*/function (_Component) {\n function _default(props) {\n var _this;\n _classCallCheck(this, _default);\n _this = _callSuper(this, _default, [props]);\n _this.downloadFastaOfAll = _this.downloadFastaOfAll.bind(_this);\n _this.downloadFastaOfSelected = _this.downloadFastaOfSelected.bind(_this);\n _this.topPanelJSX = _this.topPanelJSX.bind(_this);\n _this.summaryString = _this.summaryString.bind(_this);\n _this.indexJSX = _this.indexJSX.bind(_this);\n _this.downloadsPanelJSX = _this.downloadsPanelJSX.bind(_this);\n _this.handleQueryIndexChange = _this.handleQueryIndexChange.bind(_this);\n _this.isElementInViewPort = _this.isElementInViewPort.bind(_this);\n _this.setVisibleQueryIndex = _this.setVisibleQueryIndex.bind(_this);\n _this.debounceScrolling = _this.debounceScrolling.bind(_this);\n _this.scrollListener = _this.scrollListener.bind(_this);\n _this.copyURL = _this.copyURL.bind(_this);\n _this.shareCloudInit = _this.shareCloudInit.bind(_this);\n _this.sharingPanelJSX = _this.sharingPanelJSX.bind(_this);\n _this.cloudShareModal = /*#__PURE__*/React.createRef();\n _this.timeout = null;\n _this.queryElems = [];\n _this.state = {\n queryIndex: 1\n };\n return _this;\n }\n _inherits(_default, _Component);\n return _createClass(_default, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n //keep track of the current queryIndex so it doesn't get lost on page reload\n var urlMatch = window.location.href.match(/#Query_(\\d+)/);\n if (urlMatch && urlMatch.length > 1) {\n var queryNumber = +urlMatch[1];\n var index = this.props.data.queries.findIndex(function (query) {\n return query.number === queryNumber;\n });\n this.setState({\n queryIndex: index + 1\n });\n }\n window.addEventListener('scroll', this.scrollListener);\n $('a[href^=\"#Query_\"]').on('click', this.animateAnchorElements);\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n window.removeEventListener('scroll', this.scrollListener);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (this.props.allQueriesLoaded && !prevProps.allQueriesLoaded) {\n /**\n * storing all query elements in this variable once they all become available so we don't have to fetch them all over again\n */\n this.queryElems = Array.from(document.querySelectorAll('.resultn'));\n }\n }\n\n /**\n * to avoid unnecessary computations, we debounce the scroll listener so it only fires after user has stopped scrolling for some milliseconds\n */\n }, {\n key: \"scrollListener\",\n value: function scrollListener() {\n this.debounceScrolling(this.setVisibleQueryIndex, 500);\n }\n }, {\n key: \"debounceScrolling\",\n value: function debounceScrolling(callback, timer) {\n if (this.timeout) {\n clearTimeout(this.timeout);\n }\n this.timeout = setTimeout(callback, timer);\n }\n\n /**\n * This method makes the page aware of what query is visible so that clicking previous / next button at any point\n * navigates to the proper query\n */\n }, {\n key: \"setVisibleQueryIndex\",\n value: function setVisibleQueryIndex() {\n var queryElems = this.queryElems.length ? this.queryElems : Array.from(document.querySelectorAll('.resultn'));\n var hits = Array.from(document.querySelectorAll('.hit[id^=Query_]'));\n // get the first visible element and marks it as the current query\n var topmostEl = queryElems.find(this.isElementInViewPort) || hits.find(this.isElementInViewPort);\n if (topmostEl) {\n var queryIndex = Number(topmostEl.id.match(/Query_(\\d+)/)[1]);\n var hash = \"#Query_\".concat(queryIndex);\n // if we can guarantee that the browser can handle change in url hash without the page jumping,\n // then we update the url hash after scroll. else, hash is only updated on click of next or prev button\n if (window.history.pushState) {\n window.history.pushState(null, null, hash);\n }\n this.setState({\n queryIndex: queryIndex\n });\n }\n }\n }, {\n key: \"animateAnchorElements\",\n value: function animateAnchorElements(e) {\n // allow normal behavior in test mode to prevent warnings or errors from jquery\n if (isTestMode()) return;\n e.preventDefault();\n $('html, body').animate({\n scrollTop: $(this.hash).offset().top\n }, 300);\n if (window.history.pushState) {\n window.history.pushState(null, null, this.hash);\n } else {\n window.location.hash = this.hash;\n }\n }\n }, {\n key: \"isElementInViewPort\",\n value: function isElementInViewPort(elem) {\n var _elem$getBoundingClie = elem.getBoundingClientRect(),\n top = _elem$getBoundingClie.top,\n left = _elem$getBoundingClie.left,\n right = _elem$getBoundingClie.right,\n bottom = _elem$getBoundingClie.bottom;\n return top >= 0 && left >= 0 && bottom <= (window.innerHeight || document.documentElement.clientHeight) && right <= (window.innerWidth || document.documentElement.clientWidth);\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 key: \"clearSession\",\n value: function clearSession() {\n sessionStorage.clear();\n }\n /**\n *\n * handle next and previous query button clicks\n */\n }, {\n key: \"handleQueryIndexChange\",\n value: function handleQueryIndexChange(nextQuery) {\n if (nextQuery < 1 || nextQuery > this.props.data.queries.length) return;\n var anchorEl = document.createElement('a');\n //indexing at [nextQuery - 1] because array is 0-indexed\n anchorEl.setAttribute('href', '#Query_' + this.props.data.queries[nextQuery - 1].number);\n anchorEl.setAttribute('hidden', true);\n document.body.appendChild(anchorEl);\n // add smooth scrolling animation with jquery\n $(anchorEl).on('click', this.animateAnchorElements);\n anchorEl.click();\n document.body.removeChild(anchorEl);\n this.setState({\n queryIndex: nextQuery\n });\n }\n /**\n * Event-handler for downloading fasta of all hits.\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 downloadFASTA(sequence_ids, database_ids);\n return false;\n }\n\n /**\n * Handles downloading fasta of selected hits.\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 if (sequence_ids.length === 0) {\n return false;\n }\n var database_ids = _.map(this.props.data.querydb, _.iteratee('id'));\n downloadFASTA(sequence_ids, database_ids);\n return false;\n }\n\n /**\n * Handles copying the URL into the user's clipboard. Modified from: https://stackoverflow.com/a/49618964/18117380\n * Hides the 'Copied!' tooltip after 3 seconds\n */\n }, {\n key: \"copyURL\",\n value: function copyURL() {\n var element = document.createElement('input');\n var url = window.location.href;\n document.body.appendChild(element);\n element.value = url;\n element.select();\n document.execCommand('copy');\n document.body.removeChild(element);\n var tooltip = document.getElementById('tooltip');\n tooltip.classList.remove('hidden');\n setTimeout(function () {\n tooltip.classList.add('hidden');\n }, 3000);\n }\n }, {\n key: \"shareCloudInit\",\n value: function shareCloudInit() {\n this.cloudShareModal.current.show();\n }\n }, {\n key: \"topPanelJSX\",\n value: function topPanelJSX() {\n var path = location.pathname.split('/');\n // Get job id.\n var job_id = path.pop();\n // Deriving rootURL this way is required for subURI deployments\n // - we cannot just send to '/'.\n var rootURL = path.join('/');\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"sidebar-top-panel\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"pl-px table mb-0 w-full\",\n children: /*#__PURE__*/_jsx(\"h4\", {\n className: \"text-sm font-bold mb-0 mt-0.5\",\n children: this.summaryString()\n })\n }), this.props.data.queries.length > 12 && this.queryIndexButtons(), /*#__PURE__*/_jsxs(\"div\", {\n children: [/*#__PURE__*/_jsxs(\"a\", {\n href: \"\".concat(rootURL, \"/?job_id=\").concat(job_id),\n className: \"text-sm text-seqblue hover:text-seqorange cursor-pointer\",\n children: [/*#__PURE__*/_jsx(\"i\", {\n className: \"fa fa-pencil\"\n }), \" Edit search\"]\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"text-seqorange px-1\",\n children: \"|\"\n }), /*#__PURE__*/_jsxs(\"a\", {\n href: \"\".concat(rootURL, \"/\"),\n onClick: this.clearSession,\n className: \"text-sm text-seqblue hover:text-seqorange cursor-pointer\",\n children: [/*#__PURE__*/_jsx(\"i\", {\n className: \"fa-regular fa-file\"\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: \"queryIndexButtons\",\n value: function queryIndexButtons() {\n var _this2 = this;\n var buttonStyle = {\n outline: 'none',\n border: 'none',\n background: 'none'\n };\n var buttonClasses = 'text-sm text-seqblue hover:text-seqorange hover:bg-gray-200';\n var handlePreviousBtnClick = function handlePreviousBtnClick() {\n return _this2.handleQueryIndexChange(_this2.state.queryIndex - 1);\n };\n var handleNextBtnClick = function handleNextBtnClick() {\n return _this2.handleQueryIndexChange(_this2.state.queryIndex + 1);\n };\n\n // eslint-disable-next-line no-unused-vars\n var NavButton = function NavButton(_ref) {\n var text = _ref.text,\n onClick = _ref.onClick;\n return /*#__PURE__*/_jsx(\"button\", {\n className: buttonClasses,\n onClick: onClick,\n style: buttonStyle,\n children: text\n });\n };\n return /*#__PURE__*/_jsxs(\"div\", {\n style: {\n display: 'flex',\n width: '100%',\n margin: '7px 0'\n },\n children: [this.state.queryIndex > 1 && /*#__PURE__*/_jsx(NavButton, {\n text: \"Previous Query\",\n onClick: handlePreviousBtnClick\n }), this.state.queryIndex > 1 && this.state.queryIndex < this.props.data.queries.length && /*#__PURE__*/_jsx(\"span\", {\n className: \"text-seqorange px-1\",\n children: \"|\"\n }), this.state.queryIndex < this.props.data.queries.length && /*#__PURE__*/_jsx(NavButton, {\n onClick: handleNextBtnClick,\n text: \"Next Query\"\n })]\n });\n }\n }, {\n key: \"indexJSX\",\n value: function indexJSX() {\n return /*#__PURE__*/_jsxs(\"ul\", {\n className: \"w-full\",\n children: [\" \", _.map(this.props.data.queries, function (query) {\n return /*#__PURE__*/_jsx(\"li\", {\n children: /*#__PURE__*/_jsx(\"a\", {\n className: \"side-nav text-sm text-seqblue hover:text-seqorange focus:text-seqorange active:text-seqorange cursor-pointer hover-bold line-clamp-1 mb-1.5\",\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__*/_jsxs(\"div\", {\n className: \"downloads\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"pl-px table mb-0 w-full\",\n children: /*#__PURE__*/_jsx(\"h4\", {\n className: \"text-sm font-bold mb-0 mt-2.5\",\n children: \"Download FASTA, XML, TSV\"\n })\n }), /*#__PURE__*/_jsxs(\"ul\", {\n children: [!(this.props.data.imported_xml || this.props.data.non_parse_seqids) && /*#__PURE__*/_jsx(\"li\", {\n className: \"hover:bg-gray-200 mb-1\",\n children: /*#__PURE__*/_jsx(\"a\", {\n href: \"#\",\n className: \"text-sm text-seqblue download-fasta-of-all hover:text-seqorange cursor-pointer py-0.5 px-0.5 \".concat(!this.props.atLeastOneHit && 'disabled'),\n onClick: this.props.atLeastOneHit ? this.downloadFastaOfAll : function (e) {\n return e.preventDefault();\n },\n children: \"FASTA of all hits\"\n })\n }), !(this.props.data.imported_xml || this.props.data.non_parse_seqids) && /*#__PURE__*/_jsx(\"li\", {\n className: \"mb-1\",\n children: /*#__PURE__*/_jsxs(\"a\", {\n href: \"#\",\n className: \"flex text-sm download-fasta-of-selected text-seqblue disabled py-0.5 px-0.5\",\n onClick: this.downloadFastaOfSelected,\n children: [\"FASTA of \", /*#__PURE__*/_jsx(\"span\", {\n className: \"font-bold px-0.5\"\n }), \" selected hit(s)\"]\n })\n }), /*#__PURE__*/_jsx(\"li\", {\n className: \"hover:bg-gray-200 mb-1\",\n children: /*#__PURE__*/_jsx(\"a\", {\n href: \"#\",\n className: \"text-sm text-seqblue download-alignment-of-all hover:text-seqorange cursor-pointer py-0.5 px-0.5 \".concat(!this.props.atLeastOneHit && 'disabled'),\n children: \"Alignment of all hits\"\n })\n }), /*#__PURE__*/_jsx(\"li\", {\n className: \"mb-1\",\n children: /*#__PURE__*/_jsxs(\"a\", {\n href: \"#\",\n className: \"flex text-sm download-alignment-of-selected text-seqblue disabled py-0.5 px-0.5\",\n children: [\"Alignment of \", /*#__PURE__*/_jsx(\"span\", {\n className: \"font-bold px-0.5\"\n }), \" selected hit(s)\"]\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/_jsx(\"li\", {\n className: \"hover:bg-gray-200 mb-1\",\n children: /*#__PURE__*/_jsx(\"a\", {\n href: 'download/' + this.props.data.search_id + '.std_tsv',\n children: /*#__PURE__*/_jsx(\"div\", {\n className: \"relative flex flex-col items-center group\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"flex items-center w-full\",\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"w-full text-sm text-seqblue hover:text-seqorange download cursor-pointer py-0.5 px-0.5\",\n children: \"Standard tabular report\"\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"absolute hidden left-full ml-2 items-center group-hover:flex tooltip-wrap\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"w-0 h-0 border-y-8 border-r-8 border-t-transparent border-b-transparent border-r-black -mr-px\"\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"relative z-10 p-2 side-tooltip-text leading-4 text-center text-white whitespace-no-wrap bg-black shadow-lg rounded-md\",\n children: \"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 })]\n })]\n })\n })\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/_jsx(\"li\", {\n className: \"hover:bg-gray-200 mb-1\",\n children: /*#__PURE__*/_jsx(\"a\", {\n href: 'download/' + this.props.data.search_id + '.full_tsv',\n children: /*#__PURE__*/_jsx(\"div\", {\n className: \"relative flex flex-col items-center group\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"flex items-center w-full\",\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"w-full text-sm text-seqblue hover:text-seqorange download cursor-pointer py-0.5 px-0.5\",\n children: \"Full tabular report\"\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"absolute hidden left-full ml-2 items-center group-hover:flex tooltip-wrap\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"w-0 h-0 border-y-8 border-r-8 border-t-transparent border-b-transparent border-r-black -mr-px\"\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"relative z-10 p-2 side-tooltip-text leading-4 text-center text-white whitespace-no-wrap bg-black shadow-lg rounded-md\",\n children: \"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 })]\n })]\n })\n })\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/_jsx(\"li\", {\n className: \"hover:bg-gray-200 mb-1\",\n children: /*#__PURE__*/_jsx(\"a\", {\n href: 'download/' + this.props.data.search_id + '.xml',\n children: /*#__PURE__*/_jsx(\"div\", {\n className: \"relative flex flex-col items-center group\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"flex items-center w-full\",\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"w-full text-sm text-seqblue hover:text-seqorange download cursor-pointer py-0.5 px-0.5\",\n children: \"Full XML report\"\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"absolute hidden left-full ml-2 items-center group-hover:flex tooltip-wrap\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"w-0 h-0 border-y-8 border-r-8 border-t-transparent border-b-transparent border-r-black -mr-px\"\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"relative z-10 p-2 side-tooltip-text leading-4 text-center text-white whitespace-no-wrap bg-black shadow-lg rounded-md\",\n children: \"Results in XML format.\"\n })]\n })]\n })\n })\n })\n }), !this.props.data.imported_xml && /*#__PURE__*/_jsx(\"li\", {\n className: \"hover:bg-gray-200 mb-1\",\n children: /*#__PURE__*/_jsx(\"a\", {\n href: 'download/' + this.props.data.search_id + '.pairwise',\n children: /*#__PURE__*/_jsx(\"div\", {\n className: \"relative flex flex-col items-center group\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"flex items-center w-full\",\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"w-full text-sm text-seqblue hover:text-seqorange download cursor-pointer py-0.5 px-0.5\",\n children: \"Full Text report\"\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"absolute hidden left-full ml-2 items-center group-hover:flex tooltip-wrap\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"w-0 h-0 border-y-8 border-r-8 border-t-transparent border-b-transparent border-r-black -mr-px\"\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"relative z-10 p-2 side-tooltip-text leading-4 text-center text-white whitespace-no-wrap bg-black shadow-lg rounded-md\",\n children: \"Results in text format.\"\n })]\n })]\n })\n })\n })\n }), /*#__PURE__*/_jsx(DownloadLinks, {\n imported_xml: this.props.data.imported_xml,\n search_id: this.props.data.search_id\n })]\n })]\n });\n }\n }, {\n key: \"sharingPanelJSX\",\n value: function sharingPanelJSX() {\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"sharing-panel\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"pl-px table mb-0 w-full\",\n children: /*#__PURE__*/_jsx(\"h4\", {\n className: \"text-sm font-bold mb-0 mt-2.5\",\n children: \"Share results\"\n })\n }), /*#__PURE__*/_jsxs(\"ul\", {\n children: [!this.props.cloudSharingEnabled && /*#__PURE__*/_jsx(\"li\", {\n className: \"hover:text-seqorange hover:bg-gray-200\",\n children: /*#__PURE__*/_jsx(\"a\", {\n id: \"copyURL\",\n className: \"flex text-sm text-seqblue hover:text-seqorange copy-URL cursor-pointer py-0.5 px-0.5 w-full\",\n onClick: this.copyURL,\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"relative flex gap-2 items-center group w-full\",\n children: [/*#__PURE__*/_jsx(\"i\", {\n className: \"fa fa-copy\"\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"flex items-center\",\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"w-full\",\n children: \"Copy URL to clipboard\"\n }), /*#__PURE__*/_jsx(\"div\", {\n id: \"tooltip\",\n className: \"absolute hidden left-full ml-2 items-center\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"flex items-center\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"w-0 h-0 border-y-8 border-r-8 border-t-transparent border-b-transparent border-r-black -mr-px\"\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"relative z-10 p-2 side-tooltip-text leading-4 text-center text-white whitespace-no-wrap bg-black shadow-lg rounded-md\",\n children: \"Copied!\"\n })]\n })\n })]\n })]\n })\n })\n }), !this.props.cloudSharingEnabled && /*#__PURE__*/_jsx(\"li\", {\n className: \"hover:text-seqorange hover:bg-gray-200\",\n children: /*#__PURE__*/_jsx(\"a\", {\n id: \"sendEmail\",\n className: \"flex text-sm text-seqblue hover:text-seqorange email-URL cursor-pointer py-0.5 px-0.5 w-full\",\n href: asMailtoHref(this.props.data.querydb, this.props.data.program, this.props.data.queries.length, window.location.href),\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"relative flex gap-2 items-center group w-full\",\n children: [/*#__PURE__*/_jsx(\"i\", {\n className: \"fa fa-envelope\"\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"flex items-center w-full\",\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"w-full\",\n children: \"Send by email\"\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"absolute hidden left-full ml-2 items-center group-hover:flex tooltip-wrap\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"w-0 h-0 border-y-8 border-r-8 border-t-transparent border-b-transparent border-r-black -mr-px\"\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"relative z-10 p-2 side-tooltip-text leading-4 text-center text-white whitespace-no-wrap bg-black shadow-lg rounded-md\",\n children: \"Send by email\"\n })]\n })]\n })]\n })\n })\n }), this.props.cloudSharingEnabled && /*#__PURE__*/_jsx(\"li\", {\n className: \"hover:text-seqorange hover:bg-gray-200\",\n children: /*#__PURE__*/_jsx(\"button\", {\n className: \"flex text-sm text-seqblue hover:text-seqorange cloud-Post cursor-pointer py-0.5 px-0.5 w-full\",\n onClick: this.shareCloudInit,\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"relative flex gap-2 items-center group w-full\",\n children: [/*#__PURE__*/_jsx(\"i\", {\n className: \"fa fa-cloud\"\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"flex items-center\",\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"w-full\",\n children: \"Share to cloud\"\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"absolute hidden left-full ml-2 items-center group-hover:flex tooltip-wrap\",\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"w-0 h-0 border-y-8 border-r-8 border-t-transparent border-b-transparent border-r-black -mr-px\"\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"relative z-10 p-2 side-tooltip-text leading-4 text-center text-white whitespace-no-wrap bg-black shadow-lg rounded-md\",\n children: \"Results in pairwise format Upload results to SequenceServer Cloud where it will become accessable to everyone who has a link.\"\n })]\n })]\n })]\n })\n })\n })]\n }), /*#__PURE__*/_jsx(CloudShareModal, {\n ref: this.cloudShareModal,\n querydb: this.props.data.querydb,\n program: this.props.data.program,\n queryLength: this.props.data.queries.length\n })]\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"sidebar sticky top-0\",\n children: [this.topPanelJSX(), this.downloadsPanelJSX(), this.sharingPanelJSX(), /*#__PURE__*/_jsx(\"div\", {\n className: \"referral-panel\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: \"pl-px table mb-0 w-full text-sm\",\n children: [/*#__PURE__*/_jsx(\"h4\", {\n className: \"font-bold mb-0 mt-2.5\",\n children: \"Recommend SequenceServer\"\n }), /*#__PURE__*/_jsx(\"p\", {\n children: /*#__PURE__*/_jsx(\"a\", {\n href: \"https://sequenceserver.com/referral-program\",\n target: \"_blank\",\n className: \"text-seqblue hover:text-seqorange\",\n children: \"Earn up to $400 per signup\"\n })\n })]\n })\n })]\n });\n }\n }]);\n}(Component);\nexport { _default as default };","/**\n * svgExporter.js\n *\n * Exports
as .svg or .png.\n *\n * Borrowed and modified from Kablammo which in turn is based on\n * https://github.com/NYTimes/svg-crowbar.\n *\n */\nimport * as Exporter from './exporter';\nimport * as d3 from 'd3';\n\n/**\n * Exports the given DOM node as a .svg file.\n */\nvar export_as_svg = function export_as_svg(svg, filename) {\n var blob = new Blob([serialize_svg(svg)], {\n type: 'text/xml'\n });\n filename = Exporter.sanitize_filename(filename) + '.svg';\n Exporter.download_blob(blob, filename);\n};\n\n/**\n * Exports the given DOM node as a .png file.\n */\nvar export_as_png = function export_as_png(svg, filename) {\n if (typeof window.navigator.msSaveOrOpenBlob !== 'undefined') {\n alert('Exporting PNG images is not supported in Internet Explorer. Please use Chrome or Firefox.');\n return;\n }\n var raster_scale_factor = 5;\n var canvas = document.getElementById('png-exporter');\n var $svg = $(svg);\n canvas.height = $svg.height() * raster_scale_factor;\n canvas.width = $svg.width() * raster_scale_factor;\n var img = new Image();\n img.onload = function () {\n var context = canvas.getContext('2d');\n context.drawImage(img, 0, 0, canvas.width, canvas.height);\n filename = Exporter.sanitize_filename(filename) + '.png';\n Exporter.download_url(canvas.toDataURL('image/png'), filename);\n };\n var svgString = serialize_svg(svg);\n var encodedSvg = encodeURIComponent(svgString).replace(/%([0-9A-F]{2})/gi, function (match, p1) {\n return String.fromCharCode('0x' + p1);\n });\n img.src = 'data:image/svg+xml;base64,' + window.btoa(encodedSvg);\n};\nvar serialize_svg = function serialize_svg(svg) {\n // Clone svg first so that none of our changes to affect the actual SVG.\n svg = svg.cloneNode(true);\n d3.select(svg).attr('version', '1.1').insert('defs', ':first-child').append('style').attr('class', 'exported-css').attr('type', 'text/css').node().textContent = get_styles();\n svg.removeAttribute('xmlns');\n svg.removeAttribute('xlink');\n svg.setAttributeNS(d3.namespaces.xmlns, 'xmlns', d3.namespaces.svg);\n svg.setAttributeNS(d3.namespaces.xmlns, 'xmlns:xlink', d3.namespaces.xlink);\n var source = new XMLSerializer().serializeToString(svg);\n var doctype = '';\n return doctype + source;\n};\nvar get_styles = function get_styles() {\n var styles = '';\n for (var i = 0; i < document.styleSheets.length; i++) {\n (function process_ss(ss) {\n // See if we can access ss.cssRules. Note that cssRules respects\n // same-origin policy, as per\n // https://code.google.com/p/chromium/issues/detail?id=49001#c10.\n try {\n // In IE and Chrome, if stylesheet originates from a different\n // domain, ss.cssRules simply won't exist. In Firefox, if\n // stylesheet originates from a different domain, trying\n // to access ss.cssRules will throw a SecurityError.\n // Hence, we must use // try/catch to detect this\n // condition in Firefox.\n if (!ss.cssRules) return;\n } catch (e) {\n // Rethrow exception if it's not a SecurityError.\n if (e.name !== 'SecurityError') throw e;\n return;\n }\n\n // Stylesheet should be included in SVG and has accessible cssRules, so\n // serialize rules into string.\n for (var i = 0; i < ss.cssRules.length; i++) {\n var rule = ss.cssRules[i];\n if (rule.type === CSSRule.IMPORT_RULE) {\n process_ss(rule.styleSheet);\n } else {\n // TODO: Illustrator will crash on descendant selectors. To\n // circumvent this, we should ignore such selectors.\n\n var selectorText = rule.selectorText;\n if (selectorText && selectorText.indexOf('svg') !== -1) styles += '\\n' + rule.cssText;\n }\n }\n })(document.styleSheets[i]);\n }\n return styles;\n};\nvar handle_click = function handle_click(export_callback) {\n return function () {\n var $svg = $(this).parents('.grapher').find('svg');\n export_callback($svg[0], $svg.attr('data-name'));\n return false;\n };\n};\nvar $body = $('body');\n$body.on('click', '.export-to-svg', handle_click(export_as_svg));\n$body.on('click', '.export-to-png', handle_click(export_as_png));","import React from 'react';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nvar Utils = {\n /***********************************\n * Formatters for hits & hsp table *\n ***********************************/\n\n // Formats an array of two elements as \"first (last)\".\n format_2_tuple: function format_2_tuple(tuple) {\n return tuple[0] + ' (' + tuple[tuple.length - 1] + ')';\n },\n /**\n * Returns fraction as percentage\n */\n inPercentage: function inPercentage(num, den) {\n var x = (num * 100.0 / den).toFixed(1);\n if (x % 1 == 0) {\n x = parseInt(x, 10);\n return \"\".concat(x, \"%\");\n } else {\n return \"\".concat(x, \"%\");\n }\n },\n /**\n * Returns fractional representation as String.\n */\n inFraction: function inFraction(num, den) {\n return num + '/' + den;\n },\n /**\n * Returns given Float as String formatted to two decimal places.\n */\n inTwoDecimal: function inTwoDecimal(num) {\n return num.toFixed(2);\n },\n /**\n * Returns zero if num is zero. Returns two decimal representation of num\n * if num is between [1..10). Returns num in scientific notation otherwise.\n */\n inExponential: function inExponential(num) {\n // Nothing to do if num is 0.\n if (num === 0) {\n return 0;\n }\n\n // Round to two decimal places if in the rane [1..10).\n if (num >= 1 && num < 10) {\n return this.inTwoDecimal(num);\n }\n\n // Return numbers in the range [0..1) and [10..Inf] in\n // scientific format.\n var exp = num.toExponential(2);\n var parts = exp.split('e');\n var base = parts[0];\n var power = parts[1];\n return /*#__PURE__*/_jsxs(\"span\", {\n children: [base, \"\\xD710\", /*#__PURE__*/_jsx(\"sup\", {\n children: power\n })]\n });\n }\n};\nexport default Utils;","import _ from 'underscore';\nimport * as d3 from 'd3';\nexport function get_colors_for_evalue(evalue, hits) {\n var colors = d3.scaleLog().domain([d3.min([1e-5, d3.min(hits.map(function (d) {\n if (parseFloat(d.evalue) === 0.0) return undefined;\n return d.evalue;\n }))]), d3.max(hits.map(function (d) {\n return d.evalue;\n }))]).range([0, 0.8]);\n var rgb = colors(evalue);\n return d3.hsl(20, 0.82, rgb);\n}\nexport function toLetters(num) {\n var mod = num % 26,\n pow = num / 26 | 0,\n out = mod ? String.fromCharCode(96 + mod) : (--pow, 'z');\n return pow ? toLetters(pow) + out : out;\n}\nexport function getPrefix(str) {\n if (str.length === 0) return '';\n var lastChar = str.charAt(str.length - 1);\n return /[a-zA-Z]/.test(lastChar) ? lastChar : '';\n}\n\n/**\n * Defines how ticks will be formatted.\n *\n * Examples: 200 aa, 2.4 kbp, 7.6 Mbp.\n *\n * Borrowed from Kablammo. Modified by Priyam based on https://github.com/mbostock/d3/issues/1722.\n */\nexport function tick_formatter(scale, seq_type) {\n var prefix = d3.format('~s');\n var suffixes = {\n amino_acid: 'aa',\n nucleic_acid: 'bp'\n };\n return function (d) {\n return \"\".concat(prefix(d)).concat(suffixes[seq_type]).replace(/([a-zA-Z]+)/, ' $1');\n };\n}\nexport function get_seq_type(algorithm) {\n var SEQ_TYPES = {\n blastn: {\n query_seq_type: 'nucleic_acid',\n subject_seq_type: 'nucleic_acid'\n },\n blastp: {\n query_seq_type: 'amino_acid',\n subject_seq_type: 'amino_acid'\n },\n blastx: {\n query_seq_type: 'nucleic_acid',\n subject_seq_type: 'amino_acid'\n },\n tblastx: {\n query_seq_type: 'nucleic_acid',\n subject_seq_type: 'nucleic_acid'\n },\n tblastn: {\n query_seq_type: 'amino_acid',\n subject_seq_type: 'nucleic_acid'\n }\n };\n return SEQ_TYPES[algorithm];\n}\nexport function prettify_evalue(evalue) {\n var matches = evalue.toString().split('e');\n var base = matches[0];\n var power = matches[1];\n if (power) {\n var s = parseFloat(base).toFixed(2);\n var element = '' + s + ' × 10' + power + ' ';\n return element;\n } else {\n if (!(base % 1 == 0)) return parseFloat(base).toFixed(2);else return base;\n }\n}","function _typeof(o){\"@babel/helpers - typeof\";return _typeof=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&\"function\"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?\"symbol\":typeof o;},_typeof(o);}/*! jQuery UI - v1.13.3 - 2024-04-26\n* https://jqueryui.com\n* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js\n* Copyright OpenJS Foundation and other contributors; Licensed MIT */(function(factory){\"use strict\";if(typeof define===\"function\"&&define.amd){// AMD. Register as an anonymous module.\ndefine([\"jquery\"],factory);}else{// Browser globals\nfactory(jQuery);}})(function($){\"use strict\";$.ui=$.ui||{};var version=$.ui.version=\"1.13.3\";/*!\n * jQuery UI Widget 1.13.3\n * https://jqueryui.com\n *\n * Copyright OpenJS Foundation and other contributors\n * Released under the MIT license.\n * https://jquery.org/license\n */ //>>label: Widget\n//>>group: Core\n//>>description: Provides a factory for creating stateful widgets with a common API.\n//>>docs: https://api.jqueryui.com/jQuery.widget/\n//>>demos: https://jqueryui.com/widget/\nvar widgetUuid=0;var widgetHasOwnProperty=Array.prototype.hasOwnProperty;var widgetSlice=Array.prototype.slice;$.cleanData=function(orig){return function(elems){var events,elem,i;for(i=0;(elem=elems[i])!=null;i++){// Only trigger remove when necessary to save time\nevents=$._data(elem,\"events\");if(events&&events.remove){$(elem).triggerHandler(\"remove\");}}orig(elems);};}($.cleanData);$.widget=function(name,base,prototype){var existingConstructor,constructor,basePrototype;// ProxiedPrototype allows the provided prototype to remain unmodified\n// so that it can be used as a mixin for multiple widgets (#8876)\nvar proxiedPrototype={};var namespace=name.split(\".\")[0];name=name.split(\".\")[1];var fullName=namespace+\"-\"+name;if(!prototype){prototype=base;base=$.Widget;}if(Array.isArray(prototype)){prototype=$.extend.apply(null,[{}].concat(prototype));}// Create selector for plugin\n$.expr.pseudos[fullName.toLowerCase()]=function(elem){return!!$.data(elem,fullName);};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){// Allow instantiation without \"new\" keyword\nif(!this||!this._createWidget){return new constructor(options,element);}// Allow instantiation without initializing for simple inheritance\n// must use \"new\" keyword (the code above always passes args)\nif(arguments.length){this._createWidget(options,element);}};// Extend with the existing constructor to carry over any static properties\n$.extend(constructor,existingConstructor,{version:prototype.version,// Copy the object used to create the prototype in case we need to\n// redefine the widget later\n_proto:$.extend({},prototype),// Track widgets that inherit from this widget in case this widget is\n// redefined after a widget inherits from it\n_childConstructors:[]});basePrototype=new base();// We need to make the options hash a property directly on the new instance\n// otherwise we'll modify the options hash on the prototype that we're\n// inheriting from\nbasePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,function(prop,value){if(typeof value!==\"function\"){proxiedPrototype[prop]=value;return;}proxiedPrototype[prop]=function(){function _super(){return base.prototype[prop].apply(this,arguments);}function _superApply(args){return base.prototype[prop].apply(this,args);}return function(){var __super=this._super;var __superApply=this._superApply;var returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue;};}();});constructor.prototype=$.widget.extend(basePrototype,{// TODO: remove support for widgetEventPrefix\n// always use the name + a colon as the prefix, e.g., draggable:start\n// don't prefix for widgets that aren't DOM-based\nwidgetEventPrefix:existingConstructor?basePrototype.widgetEventPrefix||name:name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});// If this widget is being redefined then we need to find all widgets that\n// are inheriting from it and redefine all of them so that they inherit from\n// the new version of this widget. We're essentially trying to replace one\n// level in the prototype chain.\nif(existingConstructor){$.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;// Redefine the child widget using the same prototype that was\n// originally used, but inherit from the new version of the base\n$.widget(childPrototype.namespace+\".\"+childPrototype.widgetName,constructor,child._proto);});// Remove the list of existing child constructors from the old constructor\n// so the old child constructors can be garbage collected\ndelete existingConstructor._childConstructors;}else{base._childConstructors.push(constructor);}$.widget.bridge(name,constructor);return constructor;};$.widget.extend=function(target){var input=widgetSlice.call(arguments,1);var inputIndex=0;var inputLength=input.length;var key;var value;for(;inputIndex\",options:{classes:{},disabled:false,// Callbacks\ncreate:null},_createWidget:function _createWidget(options,element){element=$(element||this.defaultElement||this)[0];this.element=$(element);this.uuid=widgetUuid++;this.eventNamespace=\".\"+this.widgetName+this.uuid;this.bindings=$();this.hoverable=$();this.focusable=$();this.classesElementLookup={};if(element!==this){$.data(element,this.widgetFullName,this);this._on(true,this.element,{remove:function remove(event){if(event.target===element){this.destroy();}}});this.document=$(element.style?// Element within the document\nelement.ownerDocument:// Element is window or document\nelement.document||element);this.window=$(this.document[0].defaultView||this.document[0].parentWindow);}this.options=$.widget.extend({},this.options,this._getCreateOptions(),options);this._create();if(this.options.disabled){this._setOptionDisabled(this.options.disabled);}this._trigger(\"create\",null,this._getCreateEventData());this._init();},_getCreateOptions:function _getCreateOptions(){return{};},_getCreateEventData:$.noop,_create:$.noop,_init:$.noop,destroy:function destroy(){var that=this;this._destroy();$.each(this.classesElementLookup,function(key,value){that._removeClass(value,key);});// We can probably remove the unbind calls in 2.0\n// all event bindings should go through this._on()\nthis.element.off(this.eventNamespace).removeData(this.widgetFullName);this.widget().off(this.eventNamespace).removeAttr(\"aria-disabled\");// Clean up events and states\nthis.bindings.off(this.eventNamespace);},_destroy:$.noop,widget:function widget(){return this.element;},option:function option(key,value){var options=key;var parts;var curOption;var i;if(arguments.length===0){// Don't return a reference to the internal hash\nreturn $.widget.extend({},this.options);}if(typeof key===\"string\"){// Handle nested keys, e.g., \"foo.bar\" => { foo: { bar: ___ } }\noptions={};parts=key.split(\".\");key=parts.shift();if(parts.length){curOption=options[key]=$.widget.extend({},this.options[key]);for(i=0;i >label: Position\n//>>group: Core\n//>>description: Positions elements relative to other elements.\n//>>docs: https://api.jqueryui.com/position/\n//>>demos: https://jqueryui.com/position/\n(function(){var cachedScrollbarWidth,max=Math.max,abs=Math.abs,rhorizontal=/left|center|right/,rvertical=/top|center|bottom/,roffset=/[\\+\\-]\\d+(\\.[\\d]+)?%?/,rposition=/^\\w+/,rpercent=/%$/,_position=$.fn.position;function getOffsets(offsets,width,height){return[parseFloat(offsets[0])*(rpercent.test(offsets[0])?width/100:1),parseFloat(offsets[1])*(rpercent.test(offsets[1])?height/100:1)];}function parseCss(element,property){return parseInt($.css(element,property),10)||0;}function isWindow(obj){return obj!=null&&obj===obj.window;}function getDimensions(elem){var raw=elem[0];if(raw.nodeType===9){return{width:elem.width(),height:elem.height(),offset:{top:0,left:0}};}if(isWindow(raw)){return{width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}};}if(raw.preventDefault){return{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}};}return{width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()};}$.position={scrollbarWidth:function scrollbarWidth(){if(cachedScrollbarWidth!==undefined){return cachedScrollbarWidth;}var w1,w2,div=$(\"\"),innerDiv=div.children()[0];$(\"body\").append(div);w1=innerDiv.offsetWidth;div.css(\"overflow\",\"scroll\");w2=innerDiv.offsetWidth;if(w1===w2){w2=div[0].clientWidth;}div.remove();return cachedScrollbarWidth=w1-w2;},getScrollInfo:function getScrollInfo(within){var overflowX=within.isWindow||within.isDocument?\"\":within.element.css(\"overflow-x\"),overflowY=within.isWindow||within.isDocument?\"\":within.element.css(\"overflow-y\"),hasOverflowX=overflowX===\"scroll\"||overflowX===\"auto\"&&within.width0?\"right\":\"center\",vertical:bottom<0?\"top\":top>0?\"bottom\":\"middle\"};if(targetWidthmax(abs(top),abs(bottom))){feedback.important=\"horizontal\";}else{feedback.important=\"vertical\";}options.using.call(this,props,feedback);};}elem.offset($.extend(position,{using:using}));});};$.ui.position={fit:{left:function left(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollLeft:within.offset.left,outerWidth=within.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset,newOverRight;// Element is wider than within\nif(data.collisionWidth>outerWidth){// Element is initially over the left side of within\nif(overLeft>0&&overRight<=0){newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset;position.left+=overLeft-newOverRight;// Element is initially over right side of within\n}else if(overRight>0&&overLeft<=0){position.left=withinOffset;// Element is initially over both left and right sides of within\n}else{if(overLeft>overRight){position.left=withinOffset+outerWidth-data.collisionWidth;}else{position.left=withinOffset;}}// Too far left -> align with left edge\n}else if(overLeft>0){position.left+=overLeft;// Too far right -> align with right edge\n}else if(overRight>0){position.left-=overRight;// Adjust based on position and margin\n}else{position.left=max(position.left-collisionPosLeft,position.left);}},top:function top(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollTop:within.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset,newOverBottom;// Element is taller than within\nif(data.collisionHeight>outerHeight){// Element is initially over the top of within\nif(overTop>0&&overBottom<=0){newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset;position.top+=overTop-newOverBottom;// Element is initially over bottom of within\n}else if(overBottom>0&&overTop<=0){position.top=withinOffset;// Element is initially over both top and bottom of within\n}else{if(overTop>overBottom){position.top=withinOffset+outerHeight-data.collisionHeight;}else{position.top=withinOffset;}}// Too far up -> align with top\n}else if(overTop>0){position.top+=overTop;// Too far down -> align with bottom edge\n}else if(overBottom>0){position.top-=overBottom;// Adjust based on position and margin\n}else{position.top=max(position.top-collisionPosTop,position.top);}}},flip:{left:function left(position,data){var within=data.within,withinOffset=within.offset.left+within.scrollLeft,outerWidth=within.width,offsetLeft=within.isWindow?within.scrollLeft:within.offset.left,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=collisionPosLeft-offsetLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft,myOffset=data.my[0]===\"left\"?-data.elemWidth:data.my[0]===\"right\"?data.elemWidth:0,atOffset=data.at[0]===\"left\"?data.targetWidth:data.at[0]===\"right\"?-data.targetWidth:0,offset=-2*data.offset[0],newOverRight,newOverLeft;if(overLeft<0){newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-withinOffset;if(newOverRight<0||newOverRight0){newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-offsetLeft;if(newOverLeft>0||abs(newOverLeft)0){newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-offsetTop;if(newOverTop>0||abs(newOverTop) >label: :data Selector\n//>>group: Core\n//>>description: Selects elements which have data stored under the specified key.\n//>>docs: https://api.jqueryui.com/data-selector/\nvar data=$.extend($.expr.pseudos,{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return!!$.data(elem,dataName);};}):// Support: jQuery <1.8\nfunction(elem,i,match){return!!$.data(elem,match[3]);}});/*!\n * jQuery UI Disable Selection 1.13.3\n * https://jqueryui.com\n *\n * Copyright OpenJS Foundation and other contributors\n * Released under the MIT license.\n * https://jquery.org/license\n */ //>>label: disableSelection\n//>>group: Core\n//>>description: Disable selection of text content within the set of matched elements.\n//>>docs: https://api.jqueryui.com/disableSelection/\n// This file is deprecated\nvar disableSelection=$.fn.extend({disableSelection:function(){var eventType=\"onselectstart\"in document.createElement(\"div\")?\"selectstart\":\"mousedown\";return function(){return this.on(eventType+\".ui-disableSelection\",function(event){event.preventDefault();});};}(),enableSelection:function enableSelection(){return this.off(\".ui-disableSelection\");}});// Create a local jQuery because jQuery Color relies on it and the\n// global may not exist with AMD and a custom build (#10199).\n// This module is a noop if used as a regular AMD module.\n// eslint-disable-next-line no-unused-vars\nvar jQuery=$;/*!\n * jQuery Color Animations v2.2.0\n * https://github.com/jquery/jquery-color\n *\n * Copyright OpenJS Foundation and other contributors\n * Released under the MIT license.\n * https://jquery.org/license\n *\n * Date: Sun May 10 09:02:36 2020 +0200\n */var stepHooks=\"backgroundColor borderBottomColor borderLeftColor borderRightColor \"+\"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor\",class2type={},toString=class2type.toString,// plusequals test for += 100 -= 100\nrplusequals=/^([\\-+])=\\s*(\\d+\\.?\\d*)/,// a set of RE's that can match strings and generate color tuples.\nstringParsers=[{re:/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(?:,\\s*(\\d?(?:\\.\\d+)?)\\s*)?\\)/,parse:function parse(execResult){return[execResult[1],execResult[2],execResult[3],execResult[4]];}},{re:/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)\\%\\s*,\\s*(\\d+(?:\\.\\d+)?)\\%\\s*,\\s*(\\d+(?:\\.\\d+)?)\\%\\s*(?:,\\s*(\\d?(?:\\.\\d+)?)\\s*)?\\)/,parse:function parse(execResult){return[execResult[1]*2.55,execResult[2]*2.55,execResult[3]*2.55,execResult[4]];}},{// this regex ignores A-F because it's compared against an already lowercased string\nre:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:function parse(execResult){return[parseInt(execResult[1],16),parseInt(execResult[2],16),parseInt(execResult[3],16),execResult[4]?(parseInt(execResult[4],16)/255).toFixed(2):1];}},{// this regex ignores A-F because it's compared against an already lowercased string\nre:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:function parse(execResult){return[parseInt(execResult[1]+execResult[1],16),parseInt(execResult[2]+execResult[2],16),parseInt(execResult[3]+execResult[3],16),execResult[4]?(parseInt(execResult[4]+execResult[4],16)/255).toFixed(2):1];}},{re:/hsla?\\(\\s*(\\d+(?:\\.\\d+)?)\\s*,\\s*(\\d+(?:\\.\\d+)?)\\%\\s*,\\s*(\\d+(?:\\.\\d+)?)\\%\\s*(?:,\\s*(\\d?(?:\\.\\d+)?)\\s*)?\\)/,space:\"hsla\",parse:function parse(execResult){return[execResult[1],execResult[2]/100,execResult[3]/100,execResult[4]];}}],// jQuery.Color( )\ncolor=jQuery.Color=function(color,green,blue,alpha){return new jQuery.Color.fn.parse(color,green,blue,alpha);},spaces={rgba:{props:{red:{idx:0,type:\"byte\"},green:{idx:1,type:\"byte\"},blue:{idx:2,type:\"byte\"}}},hsla:{props:{hue:{idx:0,type:\"degrees\"},saturation:{idx:1,type:\"percent\"},lightness:{idx:2,type:\"percent\"}}}},propTypes={\"byte\":{floor:true,max:255},\"percent\":{max:1},\"degrees\":{mod:360,floor:true}},support=color.support={},// element for support tests\nsupportElem=jQuery(\"\")[0],// colors = jQuery.Color.names\ncolors,// local aliases of functions called often\neach=jQuery.each;// determine rgba support immediately\nsupportElem.style.cssText=\"background-color:rgba(1,1,1,.5)\";support.rgba=supportElem.style.backgroundColor.indexOf(\"rgba\")>-1;// define cache name and alpha properties\n// for rgba and hsla spaces\neach(spaces,function(spaceName,space){space.cache=\"_\"+spaceName;space.props.alpha={idx:3,type:\"percent\",def:1};});// Populate the class2type map\njQuery.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"),function(_i,name){class2type[\"[object \"+name+\"]\"]=name.toLowerCase();});function getType(obj){if(obj==null){return obj+\"\";}return _typeof(obj)===\"object\"?class2type[toString.call(obj)]||\"object\":_typeof(obj);}function clamp(value,prop,allowEmpty){var type=propTypes[prop.type]||{};if(value==null){return allowEmpty||!prop.def?null:prop.def;}// ~~ is an short way of doing floor for positive numbers\nvalue=type.floor?~~value:parseFloat(value);// IE will pass in empty strings as value for alpha,\n// which will hit this case\nif(isNaN(value)){return prop.def;}if(type.mod){// we add mod before modding to make sure that negatives values\n// get converted properly: -10 -> 350\nreturn(value+type.mod)%type.mod;}// for now all property types without mod have min and max\nreturn Math.min(type.max,Math.max(0,value));}function stringParse(string){var inst=color(),rgba=inst._rgba=[];string=string.toLowerCase();each(stringParsers,function(_i,parser){var parsed,match=parser.re.exec(string),values=match&&parser.parse(match),spaceName=parser.space||\"rgba\";if(values){parsed=inst[spaceName](values);// if this was an rgba parse the assignment might happen twice\n// oh well....\ninst[spaces[spaceName].cache]=parsed[spaces[spaceName].cache];rgba=inst._rgba=parsed._rgba;// exit each( stringParsers ) here because we matched\nreturn false;}});// Found a stringParser that handled it\nif(rgba.length){// if this came from a parsed string, force \"transparent\" when alpha is 0\n// chrome, (and maybe others) return \"transparent\" as rgba(0,0,0,0)\nif(rgba.join()===\"0,0,0,0\"){jQuery.extend(rgba,colors.transparent);}return inst;}// named colors\nreturn colors[string];}color.fn=jQuery.extend(color.prototype,{parse:function parse(red,green,blue,alpha){if(red===undefined){this._rgba=[null,null,null,null];return this;}if(red.jquery||red.nodeType){red=jQuery(red).css(green);green=undefined;}var inst=this,type=getType(red),rgba=this._rgba=[];// more than 1 argument specified - assume ( red, green, blue, alpha )\nif(green!==undefined){red=[red,green,blue,alpha];type=\"array\";}if(type===\"string\"){return this.parse(stringParse(red)||colors._default);}if(type===\"array\"){each(spaces.rgba.props,function(_key,prop){rgba[prop.idx]=clamp(red[prop.idx],prop);});return this;}if(type===\"object\"){if(red instanceof color){each(spaces,function(_spaceName,space){if(red[space.cache]){inst[space.cache]=red[space.cache].slice();}});}else{each(spaces,function(_spaceName,space){var cache=space.cache;each(space.props,function(key,prop){// if the cache doesn't exist, and we know how to convert\nif(!inst[cache]&&space.to){// if the value was null, we don't need to copy it\n// if the key was alpha, we don't need to copy it either\nif(key===\"alpha\"||red[key]==null){return;}inst[cache]=space.to(inst._rgba);}// this is the only case where we allow nulls for ALL properties.\n// call clamp with alwaysAllowEmpty\ninst[cache][prop.idx]=clamp(red[key],prop,true);});// everything defined but alpha?\nif(inst[cache]&&jQuery.inArray(null,inst[cache].slice(0,3))<0){// use the default of 1\nif(inst[cache][3]==null){inst[cache][3]=1;}if(space.from){inst._rgba=space.from(inst[cache]);}}});}return this;}},is:function is(compare){var is=color(compare),same=true,inst=this;each(spaces,function(_,space){var localCache,isCache=is[space.cache];if(isCache){localCache=inst[space.cache]||space.to&&space.to(inst._rgba)||[];each(space.props,function(_,prop){if(isCache[prop.idx]!=null){same=isCache[prop.idx]===localCache[prop.idx];return same;}});}return same;});return same;},_space:function _space(){var used=[],inst=this;each(spaces,function(spaceName,space){if(inst[space.cache]){used.push(spaceName);}});return used.pop();},transition:function transition(other,distance){var end=color(other),spaceName=end._space(),space=spaces[spaceName],startColor=this.alpha()===0?color(\"transparent\"):this,start=startColor[space.cache]||space.to(startColor._rgba),result=start.slice();end=end[space.cache];each(space.props,function(_key,prop){var index=prop.idx,startValue=start[index],endValue=end[index],type=propTypes[prop.type]||{};// if null, don't override start value\nif(endValue===null){return;}// if null - use end\nif(startValue===null){result[index]=endValue;}else{if(type.mod){if(endValue-startValue>type.mod/2){startValue+=type.mod;}else if(startValue-endValue>type.mod/2){startValue-=type.mod;}}result[index]=clamp((endValue-startValue)*distance+startValue,prop);}});return this[spaceName](result);},blend:function blend(opaque){// if we are already opaque - return ourself\nif(this._rgba[3]===1){return this;}var rgb=this._rgba.slice(),a=rgb.pop(),blend=color(opaque)._rgba;return color(jQuery.map(rgb,function(v,i){return(1-a)*blend[i]+a*v;}));},toRgbaString:function toRgbaString(){var prefix=\"rgba(\",rgba=jQuery.map(this._rgba,function(v,i){if(v!=null){return v;}return i>2?1:0;});if(rgba[3]===1){rgba.pop();prefix=\"rgb(\";}return prefix+rgba.join()+\")\";},toHslaString:function toHslaString(){var prefix=\"hsla(\",hsla=jQuery.map(this.hsla(),function(v,i){if(v==null){v=i>2?1:0;}// catch 1 and 2\nif(i&&i<3){v=Math.round(v*100)+\"%\";}return v;});if(hsla[3]===1){hsla.pop();prefix=\"hsl(\";}return prefix+hsla.join()+\")\";},toHexString:function toHexString(includeAlpha){var rgba=this._rgba.slice(),alpha=rgba.pop();if(includeAlpha){rgba.push(~~(alpha*255));}return\"#\"+jQuery.map(rgba,function(v){// default to 0 when nulls exist\nv=(v||0).toString(16);return v.length===1?\"0\"+v:v;}).join(\"\");},toString:function toString(){return this._rgba[3]===0?\"transparent\":this.toRgbaString();}});color.fn.parse.prototype=color.fn;// hsla conversions adapted from:\n// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021\nfunction hue2rgb(p,q,h){h=(h+1)%1;if(h*6<1){return p+(q-p)*h*6;}if(h*2<1){return q;}if(h*3<2){return p+(q-p)*(2/3-h)*6;}return p;}spaces.hsla.to=function(rgba){if(rgba[0]==null||rgba[1]==null||rgba[2]==null){return[null,null,null,rgba[3]];}var r=rgba[0]/255,g=rgba[1]/255,b=rgba[2]/255,a=rgba[3],max=Math.max(r,g,b),min=Math.min(r,g,b),diff=max-min,add=max+min,l=add*0.5,h,s;if(min===max){h=0;}else if(r===max){h=60*(g-b)/diff+360;}else if(g===max){h=60*(b-r)/diff+120;}else{h=60*(r-g)/diff+240;}// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%\n// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)\nif(diff===0){s=0;}else if(l<=0.5){s=diff/add;}else{s=diff/(2-add);}return[Math.round(h)%360,s,l,a==null?1:a];};spaces.hsla.from=function(hsla){if(hsla[0]==null||hsla[1]==null||hsla[2]==null){return[null,null,null,hsla[3]];}var h=hsla[0]/360,s=hsla[1],l=hsla[2],a=hsla[3],q=l<=0.5?l*(1+s):l+s-l*s,p=2*l-q;return[Math.round(hue2rgb(p,q,h+1/3)*255),Math.round(hue2rgb(p,q,h)*255),Math.round(hue2rgb(p,q,h-1/3)*255),a];};each(spaces,function(spaceName,space){var props=space.props,cache=space.cache,to=space.to,from=space.from;// makes rgba() and hsla()\ncolor.fn[spaceName]=function(value){// generate a cache for this space if it doesn't exist\nif(to&&!this[cache]){this[cache]=to(this._rgba);}if(value===undefined){return this[cache].slice();}var ret,type=getType(value),arr=type===\"array\"||type===\"object\"?value:arguments,local=this[cache].slice();each(props,function(key,prop){var val=arr[type===\"object\"?key:prop.idx];if(val==null){val=local[prop.idx];}local[prop.idx]=clamp(val,prop);});if(from){ret=color(from(local));ret[cache]=local;return ret;}else{return color(local);}};// makes red() green() blue() alpha() hue() saturation() lightness()\neach(props,function(key,prop){// alpha is included in more than one space\nif(color.fn[key]){return;}color.fn[key]=function(value){var local,cur,match,fn,vtype=getType(value);if(key===\"alpha\"){fn=this._hsla?\"hsla\":\"rgba\";}else{fn=spaceName;}local=this[fn]();cur=local[prop.idx];if(vtype===\"undefined\"){return cur;}if(vtype===\"function\"){value=value.call(this,cur);vtype=getType(value);}if(value==null&&prop.empty){return this;}if(vtype===\"string\"){match=rplusequals.exec(value);if(match){value=cur+parseFloat(match[2])*(match[1]===\"+\"?1:-1);}}local[prop.idx]=value;return this[fn](local);};});});// add cssHook and .fx.step function for each named hook.\n// accept a space separated string of properties\ncolor.hook=function(hook){var hooks=hook.split(\" \");each(hooks,function(_i,hook){jQuery.cssHooks[hook]={set:function set(elem,value){var parsed,curElem,backgroundColor=\"\";if(value!==\"transparent\"&&(getType(value)!==\"string\"||(parsed=stringParse(value)))){value=color(parsed||value);if(!support.rgba&&value._rgba[3]!==1){curElem=hook===\"backgroundColor\"?elem.parentNode:elem;while((backgroundColor===\"\"||backgroundColor===\"transparent\")&&curElem&&curElem.style){try{backgroundColor=jQuery.css(curElem,\"backgroundColor\");curElem=curElem.parentNode;}catch(e){}}value=value.blend(backgroundColor&&backgroundColor!==\"transparent\"?backgroundColor:\"_default\");}value=value.toRgbaString();}try{elem.style[hook]=value;}catch(e){// wrapped to prevent IE from throwing errors on \"invalid\" values like 'auto' or 'inherit'\n}}};jQuery.fx.step[hook]=function(fx){if(!fx.colorInit){fx.start=color(fx.elem,hook);fx.end=color(fx.end);fx.colorInit=true;}jQuery.cssHooks[hook].set(fx.elem,fx.start.transition(fx.end,fx.pos));};});};color.hook(stepHooks);jQuery.cssHooks.borderColor={expand:function expand(value){var expanded={};each([\"Top\",\"Right\",\"Bottom\",\"Left\"],function(_i,part){expanded[\"border\"+part+\"Color\"]=value;});return expanded;}};// Basic color names only.\n// Usage of any of the other color names requires adding yourself or including\n// jquery.color.svg-names.js.\ncolors=jQuery.Color.names={// 4.1. Basic color keywords\naqua:\"#00ffff\",black:\"#000000\",blue:\"#0000ff\",fuchsia:\"#ff00ff\",gray:\"#808080\",green:\"#008000\",lime:\"#00ff00\",maroon:\"#800000\",navy:\"#000080\",olive:\"#808000\",purple:\"#800080\",red:\"#ff0000\",silver:\"#c0c0c0\",teal:\"#008080\",white:\"#ffffff\",yellow:\"#ffff00\",// 4.2.3. \"transparent\" color keyword\ntransparent:[null,null,null,0],_default:\"#ffffff\"};/*!\n * jQuery UI Effects 1.13.3\n * https://jqueryui.com\n *\n * Copyright OpenJS Foundation and other contributors\n * Released under the MIT license.\n * https://jquery.org/license\n */ //>>label: Effects Core\n//>>group: Effects\n/* eslint-disable max-len */ //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.\n/* eslint-enable max-len */ //>>docs: https://api.jqueryui.com/category/effects-core/\n//>>demos: https://jqueryui.com/effect/\nvar dataSpace=\"ui-effects-\",dataSpaceStyle=\"ui-effects-style\",dataSpaceAnimated=\"ui-effects-animated\";$.effects={effect:{}};/******************************************************************************/ /****************************** CLASS ANIMATIONS ******************************/ /******************************************************************************/(function(){var classAnimationActions=[\"add\",\"remove\",\"toggle\"],shorthandStyles={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};$.each([\"borderLeftStyle\",\"borderRightStyle\",\"borderBottomStyle\",\"borderTopStyle\"],function(_,prop){$.fx.step[prop]=function(fx){if(fx.end!==\"none\"&&!fx.setAttr||fx.pos===1&&!fx.setAttr){jQuery.style(fx.elem,prop,fx.end);fx.setAttr=true;}};});function camelCase(string){return string.replace(/-([\\da-z])/gi,function(all,letter){return letter.toUpperCase();});}function getElementStyles(elem){var key,len,style=elem.ownerDocument.defaultView?elem.ownerDocument.defaultView.getComputedStyle(elem,null):elem.currentStyle,styles={};if(style&&style.length&&style[0]&&style[style[0]]){len=style.length;while(len--){key=style[len];if(typeof style[key]===\"string\"){styles[camelCase(key)]=style[key];}}// Support: Opera, IE <9\n}else{for(key in style){if(typeof style[key]===\"string\"){styles[key]=style[key];}}}return styles;}function styleDifference(oldStyle,newStyle){var diff={},name,value;for(name in newStyle){value=newStyle[name];if(oldStyle[name]!==value){if(!shorthandStyles[name]){if($.fx.step[name]||!isNaN(parseFloat(value))){diff[name]=value;}}}}return diff;}// Support: jQuery <1.8\nif(!$.fn.addBack){$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector));};}$.effects.animateClass=function(value,duration,easing,callback){var o=$.speed(duration,easing,callback);return this.queue(function(){var animated=$(this),baseClass=animated.attr(\"class\")||\"\",applyClassChange,allAnimations=o.children?animated.find(\"*\").addBack():animated;// Map the animated objects to store the original styles.\nallAnimations=allAnimations.map(function(){var el=$(this);return{el:el,start:getElementStyles(this)};});// Apply class change\napplyClassChange=function applyClassChange(){$.each(classAnimationActions,function(i,action){if(value[action]){animated[action+\"Class\"](value[action]);}});};applyClassChange();// Map all animated objects again - calculate new styles and diff\nallAnimations=allAnimations.map(function(){this.end=getElementStyles(this.el[0]);this.diff=styleDifference(this.start,this.end);return this;});// Apply original class\nanimated.attr(\"class\",baseClass);// Map all animated objects again - this time collecting a promise\nallAnimations=allAnimations.map(function(){var styleInfo=this,dfd=$.Deferred(),opts=$.extend({},o,{queue:false,complete:function complete(){dfd.resolve(styleInfo);}});this.el.animate(this.diff,opts);return dfd.promise();});// Once all animations have completed:\n$.when.apply($,allAnimations.get()).done(function(){// Set the final class\napplyClassChange();// For each animated element,\n// clear all css properties that were animated\n$.each(arguments,function(){var el=this.el;$.each(this.diff,function(key){el.css(key,\"\");});});// This is guarnteed to be there if you use jQuery.speed()\n// it also handles dequeuing the next anim...\no.complete.call(animated[0]);});});};$.fn.extend({addClass:function(orig){return function(classNames,speed,easing,callback){return speed?$.effects.animateClass.call(this,{add:classNames},speed,easing,callback):orig.apply(this,arguments);};}($.fn.addClass),removeClass:function(orig){return function(classNames,speed,easing,callback){return arguments.length>1?$.effects.animateClass.call(this,{remove:classNames},speed,easing,callback):orig.apply(this,arguments);};}($.fn.removeClass),toggleClass:function(orig){return function(classNames,force,speed,easing,callback){if(typeof force===\"boolean\"||force===undefined){if(!speed){// Without speed parameter\nreturn orig.apply(this,arguments);}else{return $.effects.animateClass.call(this,force?{add:classNames}:{remove:classNames},speed,easing,callback);}}else{// Without force parameter\nreturn $.effects.animateClass.call(this,{toggle:classNames},force,speed,easing);}};}($.fn.toggleClass),switchClass:function switchClass(remove,add,speed,easing,callback){return $.effects.animateClass.call(this,{add:add,remove:remove},speed,easing,callback);}});})();/******************************************************************************/ /*********************************** EFFECTS **********************************/ /******************************************************************************/(function(){if($.expr&&$.expr.pseudos&&$.expr.pseudos.animated){$.expr.pseudos.animated=function(orig){return function(elem){return!!$(elem).data(dataSpaceAnimated)||orig(elem);};}($.expr.pseudos.animated);}if($.uiBackCompat!==false){$.extend($.effects,{// Saves a set of properties in a data storage\nsave:function save(element,set){var i=0,length=set.length;for(;i
\").addClass(\"ui-effects-wrapper\").css({fontSize:\"100%\",background:\"transparent\",border:\"none\",margin:0,padding:0}),// Store the size in case width/height are defined in % - Fixes #5245\nsize={width:element.width(),height:element.height()},active=document.activeElement;// Support: Firefox\n// Firefox incorrectly exposes anonymous content\n// https://bugzilla.mozilla.org/show_bug.cgi?id=561664\ntry{// eslint-disable-next-line no-unused-expressions\nactive.id;}catch(e){active=document.body;}element.wrap(wrapper);// Fixes #7595 - Elements lose focus when wrapped.\nif(element[0]===active||$.contains(element[0],active)){$(active).trigger(\"focus\");}// Hotfix for jQuery 1.4 since some change in wrap() seems to actually\n// lose the reference to the wrapped element\nwrapper=element.parent();// Transfer positioning properties to the wrapper\nif(element.css(\"position\")===\"static\"){wrapper.css({position:\"relative\"});element.css({position:\"relative\"});}else{$.extend(props,{position:element.css(\"position\"),zIndex:element.css(\"z-index\")});$.each([\"top\",\"left\",\"bottom\",\"right\"],function(i,pos){props[pos]=element.css(pos);if(isNaN(parseInt(props[pos],10))){props[pos]=\"auto\";}});element.css({position:\"relative\",top:0,left:0,right:\"auto\",bottom:\"auto\"});}element.css(size);return wrapper.css(props).show();},removeWrapper:function removeWrapper(element){var active=document.activeElement;if(element.parent().is(\".ui-effects-wrapper\")){element.parent().replaceWith(element);// Fixes #7595 - Elements lose focus when wrapped.\nif(element[0]===active||$.contains(element[0],active)){$(active).trigger(\"focus\");}}return element;}});}$.extend($.effects,{version:\"1.13.3\",define:function define(name,mode,effect){if(!effect){effect=mode;mode=\"effect\";}$.effects.effect[name]=effect;$.effects.effect[name].mode=mode;return effect;},scaledDimensions:function scaledDimensions(element,percent,direction){if(percent===0){return{height:0,width:0,outerHeight:0,outerWidth:0};}var x=direction!==\"horizontal\"?(percent||100)/100:1,y=direction!==\"vertical\"?(percent||100)/100:1;return{height:element.height()*y,width:element.width()*x,outerHeight:element.outerHeight()*y,outerWidth:element.outerWidth()*x};},clipToBox:function clipToBox(animation){return{width:animation.clip.right-animation.clip.left,height:animation.clip.bottom-animation.clip.top,left:animation.clip.left,top:animation.clip.top};},// Injects recently queued functions to be first in line (after \"inprogress\")\nunshift:function unshift(element,queueLength,count){var queue=element.queue();if(queueLength>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queueLength,count)));}element.dequeue();},saveStyle:function saveStyle(element){element.data(dataSpaceStyle,element[0].style.cssText);},restoreStyle:function restoreStyle(element){element[0].style.cssText=element.data(dataSpaceStyle)||\"\";element.removeData(dataSpaceStyle);},mode:function mode(element,_mode){var hidden=element.is(\":hidden\");if(_mode===\"toggle\"){_mode=hidden?\"show\":\"hide\";}if(hidden?_mode===\"hide\":_mode===\"show\"){_mode=\"none\";}return _mode;},// Translates a [top,left] array into a baseline value\ngetBaseline:function getBaseline(origin,original){var y,x;switch(origin[0]){case\"top\":y=0;break;case\"middle\":y=0.5;break;case\"bottom\":y=1;break;default:y=origin[0]/original.height;}switch(origin[1]){case\"left\":x=0;break;case\"center\":x=0.5;break;case\"right\":x=1;break;default:x=origin[1]/original.width;}return{x:x,y:y};},// Creates a placeholder element so that the original element can be made absolute\ncreatePlaceholder:function createPlaceholder(element){var placeholder,cssPosition=element.css(\"position\"),position=element.position();// Lock in margins first to account for form elements, which\n// will change margin if you explicitly set height\n// see: https://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380\n// Support: Safari\nelement.css({marginTop:element.css(\"marginTop\"),marginBottom:element.css(\"marginBottom\"),marginLeft:element.css(\"marginLeft\"),marginRight:element.css(\"marginRight\")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight());if(/^(static|relative)/.test(cssPosition)){cssPosition=\"absolute\";placeholder=$(\"<\"+element[0].nodeName+\">\").insertAfter(element).css({// Convert inline to inline block to account for inline elements\n// that turn to inline block based on content (like img)\ndisplay:/^(inline|ruby)/.test(element.css(\"display\"))?\"inline-block\":\"block\",visibility:\"hidden\",// Margins need to be set to account for margin collapse\nmarginTop:element.css(\"marginTop\"),marginBottom:element.css(\"marginBottom\"),marginLeft:element.css(\"marginLeft\"),marginRight:element.css(\"marginRight\"),\"float\":element.css(\"float\")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight()).addClass(\"ui-effects-placeholder\");element.data(dataSpace+\"placeholder\",placeholder);}element.css({position:cssPosition,left:position.left,top:position.top});return placeholder;},removePlaceholder:function removePlaceholder(element){var dataKey=dataSpace+\"placeholder\",placeholder=element.data(dataKey);if(placeholder){placeholder.remove();element.removeData(dataKey);}},// Removes a placeholder if it exists and restores\n// properties that were modified during placeholder creation\ncleanUp:function cleanUp(element){$.effects.restoreStyle(element);$.effects.removePlaceholder(element);},setTransition:function setTransition(element,list,factor,value){value=value||{};$.each(list,function(i,x){var unit=element.cssUnit(x);if(unit[0]>0){value[x]=unit[0]*factor+unit[1];}});return value;}});// Return an effect options object for the given parameters:\nfunction _normalizeArguments(effect,options,speed,callback){// Allow passing all options as the first parameter\nif($.isPlainObject(effect)){options=effect;effect=effect.effect;}// Convert to an object\neffect={effect:effect};// Catch (effect, null, ...)\nif(options==null){options={};}// Catch (effect, callback)\nif(typeof options===\"function\"){callback=options;speed=null;options={};}// Catch (effect, speed, ?)\nif(typeof options===\"number\"||$.fx.speeds[options]){callback=speed;speed=options;options={};}// Catch (effect, options, callback)\nif(typeof speed===\"function\"){callback=speed;speed=null;}// Add options to effect\nif(options){$.extend(effect,options);}speed=speed||options.duration;effect.duration=$.fx.off?0:typeof speed===\"number\"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete=callback||options.complete;return effect;}function standardAnimationOption(option){// Valid standard speeds (nothing, number, named speed)\nif(!option||typeof option===\"number\"||$.fx.speeds[option]){return true;}// Invalid strings - treat as \"normal\" speed\nif(typeof option===\"string\"&&!$.effects.effect[option]){return true;}// Complete callback\nif(typeof option===\"function\"){return true;}// Options hash (but not naming an effect)\nif(_typeof(option)===\"object\"&&!option.effect){return true;}// Didn't match any standard API\nreturn false;}$.fn.extend({effect:function effect(/* effect, options, speed, callback */){var args=_normalizeArguments.apply(this,arguments),effectMethod=$.effects.effect[args.effect],defaultMode=effectMethod.mode,queue=args.queue,queueName=queue||\"fx\",complete=args.complete,mode=args.mode,modes=[],prefilter=function prefilter(next){var el=$(this),normalizedMode=$.effects.mode(el,mode)||defaultMode;// Sentinel for duck-punching the :animated pseudo-selector\nel.data(dataSpaceAnimated,true);// Save effect mode for later use,\n// we can't just call $.effects.mode again later,\n// as the .show() below destroys the initial state\nmodes.push(normalizedMode);// See $.uiBackCompat inside of run() for removal of defaultMode in 1.14\nif(defaultMode&&(normalizedMode===\"show\"||normalizedMode===defaultMode&&normalizedMode===\"hide\")){el.show();}if(!defaultMode||normalizedMode!==\"none\"){$.effects.saveStyle(el);}if(typeof next===\"function\"){next();}};if($.fx.off||!effectMethod){// Delegate to the original method (e.g., .show()) if possible\nif(mode){return this[mode](args.duration,complete);}else{return this.each(function(){if(complete){complete.call(this);}});}}function run(next){var elem=$(this);function cleanup(){elem.removeData(dataSpaceAnimated);$.effects.cleanUp(elem);if(args.mode===\"hide\"){elem.hide();}done();}function done(){if(typeof complete===\"function\"){complete.call(elem[0]);}if(typeof next===\"function\"){next();}}// Override mode option on a per element basis,\n// as toggle can be either show or hide depending on element state\nargs.mode=modes.shift();if($.uiBackCompat!==false&&!defaultMode){if(elem.is(\":hidden\")?mode===\"hide\":mode===\"show\"){// Call the core method to track \"olddisplay\" properly\nelem[mode]();done();}else{effectMethod.call(elem[0],args,done);}}else{if(args.mode===\"none\"){// Call the core method to track \"olddisplay\" properly\nelem[mode]();done();}else{effectMethod.call(elem[0],args,cleanup);}}}// Run prefilter on all elements first to ensure that\n// any showing or hiding happens before placeholder creation,\n// which ensures that any layout changes are correctly captured.\nreturn queue===false?this.each(prefilter).each(run):this.queue(queueName,prefilter).queue(queueName,run);},show:function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments);}else{var args=_normalizeArguments.apply(this,arguments);args.mode=\"show\";return this.effect.call(this,args);}};}($.fn.show),hide:function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments);}else{var args=_normalizeArguments.apply(this,arguments);args.mode=\"hide\";return this.effect.call(this,args);}};}($.fn.hide),toggle:function(orig){return function(option){if(standardAnimationOption(option)||typeof option===\"boolean\"){return orig.apply(this,arguments);}else{var args=_normalizeArguments.apply(this,arguments);args.mode=\"toggle\";return this.effect.call(this,args);}};}($.fn.toggle),cssUnit:function cssUnit(key){var style=this.css(key),val=[];$.each([\"em\",\"px\",\"%\",\"pt\"],function(i,unit){if(style.indexOf(unit)>0){val=[parseFloat(style),unit];}});return val;},cssClip:function cssClip(clipObj){if(clipObj){return this.css(\"clip\",\"rect(\"+clipObj.top+\"px \"+clipObj.right+\"px \"+clipObj.bottom+\"px \"+clipObj.left+\"px)\");}return parseClip(this.css(\"clip\"),this);},transfer:function transfer(options,done){var element=$(this),target=$(options.to),targetFixed=target.css(\"position\")===\"fixed\",body=$(\"body\"),fixTop=targetFixed?body.scrollTop():0,fixLeft=targetFixed?body.scrollLeft():0,endPosition=target.offset(),animation={top:endPosition.top-fixTop,left:endPosition.left-fixLeft,height:target.innerHeight(),width:target.innerWidth()},startPosition=element.offset(),transfer=$(\"