"use strict";

exports.__esModule = true;
exports["default"] = getXStartAndWidthOfRangeWrtRow;
var _rangeUtils = require("@teselagen/range-utils");
var _lodash = require("lodash");
function getXStartAndWidthOfRangeWrtRow(_ref) {
  var range = _ref.range,
    row = _ref.row,
    charWidth = _ref.charWidth,
    sequenceLength = _ref.sequenceLength,
    _ref$gapsBefore = _ref.gapsBefore,
    gapsBefore = _ref$gapsBefore === void 0 ? 0 : _ref$gapsBefore,
    _ref$gapsInside = _ref.gapsInside,
    gapsInside = _ref$gapsInside === void 0 ? 0 : _ref$gapsInside;
  var xStart = ((!(0, _lodash.isNumber)(gapsBefore) ? 0 : gapsBefore) + (0, _rangeUtils.normalizePositionByRangeLength)(range.start - row.start, sequenceLength)) * charWidth;
  var obj = {
    xStart: xStart,
    width: (gapsInside + (0, _rangeUtils.normalizePositionByRangeLength)(range.end + 1 - range.start, sequenceLength + 1)) * charWidth
  };
  return obj;
}
module.exports = exports.default;