@teselagen/ove 0.7.7 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -17962,25 +17962,16 @@ var getIntrinsic = /* @__PURE__ */ __name(function GetIntrinsic(name2, allowMiss
17962
17962
  return value;
17963
17963
  }, "GetIntrinsic");
17964
17964
  var callBind$3 = { exports: {} };
17965
- var esDefineProperty;
17966
- var hasRequiredEsDefineProperty;
17967
- function requireEsDefineProperty() {
17968
- if (hasRequiredEsDefineProperty)
17969
- return esDefineProperty;
17970
- hasRequiredEsDefineProperty = 1;
17971
- var GetIntrinsic3 = getIntrinsic;
17972
- var $defineProperty2 = GetIntrinsic3("%Object.defineProperty%", true) || false;
17973
- if ($defineProperty2) {
17974
- try {
17975
- $defineProperty2({}, "a", { value: 1 });
17976
- } catch (e2) {
17977
- $defineProperty2 = false;
17978
- }
17965
+ var GetIntrinsic$4 = getIntrinsic;
17966
+ var $defineProperty$2 = GetIntrinsic$4("%Object.defineProperty%", true) || false;
17967
+ if ($defineProperty$2) {
17968
+ try {
17969
+ $defineProperty$2({}, "a", { value: 1 });
17970
+ } catch (e2) {
17971
+ $defineProperty$2 = false;
17979
17972
  }
17980
- esDefineProperty = $defineProperty2;
17981
- return esDefineProperty;
17982
17973
  }
17983
- __name(requireEsDefineProperty, "requireEsDefineProperty");
17974
+ var esDefineProperty = $defineProperty$2;
17984
17975
  var GetIntrinsic$3 = getIntrinsic;
17985
17976
  var $gOPD$1 = GetIntrinsic$3("%Object.getOwnPropertyDescriptor%", true);
17986
17977
  if ($gOPD$1) {
@@ -17991,7 +17982,7 @@ if ($gOPD$1) {
17991
17982
  }
17992
17983
  }
17993
17984
  var gopd$1 = $gOPD$1;
17994
- var $defineProperty$1 = requireEsDefineProperty();
17985
+ var $defineProperty$1 = esDefineProperty;
17995
17986
  var $SyntaxError = syntax;
17996
17987
  var $TypeError$4 = type$1;
17997
17988
  var gopd = gopd$1;
@@ -18032,7 +18023,7 @@ var defineDataProperty$1 = /* @__PURE__ */ __name(function defineDataProperty(ob
18032
18023
  throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
18033
18024
  }
18034
18025
  }, "defineDataProperty");
18035
- var $defineProperty = requireEsDefineProperty();
18026
+ var $defineProperty = esDefineProperty;
18036
18027
  var hasPropertyDescriptors = /* @__PURE__ */ __name(function hasPropertyDescriptors2() {
18037
18028
  return !!$defineProperty;
18038
18029
  }, "hasPropertyDescriptors");
@@ -18101,7 +18092,7 @@ var setFunctionLength = /* @__PURE__ */ __name(function setFunctionLength2(fn4,
18101
18092
  var $apply = GetIntrinsic3("%Function.prototype.apply%");
18102
18093
  var $call = GetIntrinsic3("%Function.prototype.call%");
18103
18094
  var $reflectApply = GetIntrinsic3("%Reflect.apply%", true) || bind3.call($call, $apply);
18104
- var $defineProperty2 = requireEsDefineProperty();
18095
+ var $defineProperty2 = esDefineProperty;
18105
18096
  var $max = GetIntrinsic3("%Math.max%");
18106
18097
  module2.exports = /* @__PURE__ */ __name(function callBind2(originalFunction) {
18107
18098
  if (typeof originalFunction !== "function") {
@@ -116270,21 +116261,20 @@ var pluralize$1 = { exports: {} };
116270
116261
  })(pluralize$1);
116271
116262
  var pluralizeExports = pluralize$1.exports;
116272
116263
  const pluralize = /* @__PURE__ */ getDefaultExportFromCjs(pluralizeExports);
116273
- function Caret$2(props) {
116274
- const {
116275
- charWidth: charWidth2,
116276
- row,
116277
- sequenceLength,
116278
- caretPosition: caretPosition2,
116279
- isProtein: isProtein2,
116280
- onClick,
116281
- isDraggable,
116282
- leftMargin = 0,
116283
- onRightClick,
116284
- style: style2,
116285
- selectionMessage,
116286
- className = ""
116287
- } = props;
116264
+ function Caret$2({
116265
+ charWidth: charWidth2,
116266
+ row,
116267
+ sequenceLength,
116268
+ caretPosition: caretPosition2,
116269
+ isProtein: isProtein2,
116270
+ onClick,
116271
+ isDraggable,
116272
+ leftMargin = 0,
116273
+ onRightClick,
116274
+ style: style2,
116275
+ selectionMessage,
116276
+ className = ""
116277
+ }) {
116288
116278
  if (row.start <= caretPosition2 && row.end + 1 >= caretPosition2 || row.end === sequenceLength - 1 && row.end < caretPosition2) {
116289
116279
  const cursorEl = /* @__PURE__ */ React$2.createElement(
116290
116280
  "div",
@@ -119834,7 +119824,7 @@ const annotationsToCompute = {
119834
119824
  hasYOffset: true
119835
119825
  }
119836
119826
  };
119837
- const estimateRowHeight = /* @__PURE__ */ __name((props) => {
119827
+ const _estimateRowHeight = /* @__PURE__ */ __name((props) => {
119838
119828
  let {
119839
119829
  index: index2,
119840
119830
  cache: cache2,
@@ -119892,7 +119882,7 @@ const estimateRowHeight = /* @__PURE__ */ __name((props) => {
119892
119882
  }
119893
119883
  cache2[index2] = totalHeight;
119894
119884
  return totalHeight;
119895
- }, "estimateRowHeight");
119885
+ }, "_estimateRowHeight");
119896
119886
  function getHeights(heightKey, props) {
119897
119887
  const annotationHeight = !heightKey ? 0 : props[heightKey + "Height"] || (rowHeights[heightKey] || {}).height || 0;
119898
119888
  const marginHeight = (props[heightKey + "MarginTop"] || (rowHeights[heightKey] || {}).marginTop || 0) + (props[heightKey + "MarginBottom"] || (rowHeights[heightKey] || {}).marginBottom || 0);
@@ -121173,7 +121163,7 @@ function showFileDialog({ multiple = false, onSelect }) {
121173
121163
  }
121174
121164
  __name(showFileDialog, "showFileDialog");
121175
121165
  const name = "@teselagen/ove";
121176
- const version = "0.7.6";
121166
+ const version = "0.7.7";
121177
121167
  const main = "./src/index.js";
121178
121168
  const type = "module";
121179
121169
  const exports$1 = {
@@ -139431,7 +139421,7 @@ const __RowView = class __RowView extends React$2.Component {
139431
139421
  //this function gives a fairly rough height estimate for the rows so that the ReactList can give a good guess of how much space to leave for scrolling and where to jump to in the sequence
139432
139422
  __publicField(this, "estimateRowHeight", /* @__PURE__ */ __name((index2, cache2) => {
139433
139423
  const { annotationVisibility: annotationVisibility2, annotationLabelVisibility: annotationLabelVisibility2, sequenceData: sequenceData2 } = this.props;
139434
- return estimateRowHeight({
139424
+ return _estimateRowHeight({
139435
139425
  index: index2,
139436
139426
  cache: cache2,
139437
139427
  chromatogramData: sequenceData2.chromatogramData,
@@ -144072,21 +144062,125 @@ try {
144072
144062
  e2
144073
144063
  );
144074
144064
  }
144075
- const _AlignmentView = class _AlignmentView extends React$2.Component {
144076
- constructor(props) {
144077
- super(props);
144078
- __publicField(this, "bindOutsideChangeHelper", {});
144079
- __publicField(this, "getMaxLength", /* @__PURE__ */ __name(() => {
144080
- const { alignmentTracks } = this.props;
144081
- const { sequenceData: sequenceData2 = { sequence: "" }, alignmentData } = alignmentTracks[0];
144082
- const data = alignmentData || sequenceData2;
144083
- return data.noSequence ? data.size : data.sequence.length;
144084
- }, "getMaxLength"));
144085
- __publicField(this, "handleAlignmentCopy", /* @__PURE__ */ __name((event) => {
144065
+ const AlignmentView = /* @__PURE__ */ __name((props) => {
144066
+ const {
144067
+ alignmentType,
144068
+ alignmentRunUpdate: alignmentRunUpdate2,
144069
+ alignmentName: _alignmentName,
144070
+ caretPosition: caretPosition2,
144071
+ handleAlignmentSave,
144072
+ id: id2,
144073
+ isFullyZoomedOut,
144074
+ scrollPercentageToJumpTo,
144075
+ selectionLayer: selectionLayer2,
144076
+ sequenceData: sequenceData2,
144077
+ sequenceLength,
144078
+ shouldAutosave,
144079
+ store: store2,
144080
+ height: height2,
144081
+ minimapLaneHeight,
144082
+ minimapLaneSpacing,
144083
+ isInPairwiseOverviewView,
144084
+ noVisibilityOptions,
144085
+ updateAlignmentSortOrder,
144086
+ alignmentSortOrder,
144087
+ handleBackButtonClicked,
144088
+ allowTrimming,
144089
+ additionalSelectionLayerRightClickedOptions,
144090
+ selectionLayerRightClicked,
144091
+ additionalTopEl,
144092
+ additionalTopLeftEl,
144093
+ handleAlignmentRename,
144094
+ stateTrackingId,
144095
+ style: style2,
144096
+ unmappedSeqs
144097
+ } = props;
144098
+ const _a2 = props, {
144099
+ alignmentId,
144100
+ alignmentTrackIndex,
144101
+ alignmentTracks = [],
144102
+ alignmentVisibilityToolOptions,
144103
+ allowTrackNameEdit,
144104
+ allowTrackRearrange,
144105
+ currentPairwiseAlignmentIndex,
144106
+ handleSelectTrack,
144107
+ hasTemplate,
144108
+ isPairwise,
144109
+ linearViewOptions,
144110
+ noClickDragHandlers,
144111
+ pairwiseAlignments,
144112
+ pairwiseOverviewAlignmentTracks,
144113
+ upsertAlignmentRun: upsertAlignmentRun2
144114
+ } = _a2, rest = __objRest(_a2, [
144115
+ "alignmentId",
144116
+ "alignmentTrackIndex",
144117
+ "alignmentTracks",
144118
+ "alignmentVisibilityToolOptions",
144119
+ "allowTrackNameEdit",
144120
+ "allowTrackRearrange",
144121
+ "currentPairwiseAlignmentIndex",
144122
+ "handleSelectTrack",
144123
+ "hasTemplate",
144124
+ "isPairwise",
144125
+ "linearViewOptions",
144126
+ "noClickDragHandlers",
144127
+ "pairwiseAlignments",
144128
+ "pairwiseOverviewAlignmentTracks",
144129
+ "upsertAlignmentRun"
144130
+ ]);
144131
+ const [width, setWidth] = React$2.useState(0);
144132
+ const [nameDivWidth, setNameDivWidth] = React$2.useState(140);
144133
+ const [charWidthInLinearView, _setCharWidthInLinearView] = React$2.useState(
144134
+ charWidthInLinearViewDefault
144135
+ );
144136
+ const [alignmentName, setAlignmentName] = React$2.useState(_alignmentName);
144137
+ const [isTrackDragging, setIsTrackDragging] = React$2.useState(false);
144138
+ const [saveMessage, setSaveMessage] = React$2.useState();
144139
+ const [saveMessageLoading, setSaveMessageLoading] = React$2.useState(false);
144140
+ const [tempTrimBefore, setTempTrimBefore] = React$2.useState({});
144141
+ const [tempTrimAfter, setTempTrimAfter] = React$2.useState({});
144142
+ const [tempTrimmingCaret, setTempTrimmingCaret] = React$2.useState({});
144143
+ const bindOutsideChangeHelper = React$2.useRef({});
144144
+ const alignmentHolder = React$2.useRef(null);
144145
+ const alignmentHolderTop = React$2.useRef(null);
144146
+ const veTracksAndAlignmentHolder = React$2.useRef(null);
144147
+ const InfiniteScroller = React$2.useRef(null);
144148
+ const oldAlignmentHolderScrollTop = React$2.useRef(0);
144149
+ const blockScroll = React$2.useRef(false);
144150
+ const isZooming = React$2.useRef(false);
144151
+ const rowData = React$2.useRef({});
144152
+ const latestMouseY = React$2.useRef();
144153
+ const easyStore2 = React$2.useRef(
144154
+ store$1({
144155
+ selectionLayer: { start: -1, end: -1 },
144156
+ caretPosition: -1,
144157
+ percentScrolled: 0,
144158
+ viewportWidth: 400,
144159
+ verticalVisibleRange: { start: 0, end: 0 }
144160
+ })
144161
+ );
144162
+ const getAllAlignmentsFastaText = React$2.useCallback(() => {
144163
+ const selectionLayer22 = store2.getState().VectorEditor.__allEditorsOptions.alignments[id2].selectionLayer || {};
144164
+ const seqDataOfAllTracksToCopy = [];
144165
+ alignmentTracks.forEach((track2) => {
144166
+ const seqDataToCopy = getSequenceDataBetweenRange(
144167
+ track2.alignmentData,
144168
+ selectionLayer22
144169
+ ).sequence;
144170
+ seqDataOfAllTracksToCopy.push(
144171
+ `>${track2.alignmentData.name}\r
144172
+ ${seqDataToCopy}\r
144173
+ `
144174
+ );
144175
+ });
144176
+ return seqDataOfAllTracksToCopy.join("");
144177
+ }, [alignmentTracks, id2, store2]);
144178
+ React$2.useEffect(() => {
144179
+ const handleAlignmentCopy = /* @__PURE__ */ __name((event) => {
144086
144180
  if (event.key === "c" && !event.shiftKey && (event.metaKey === true || event.ctrlKey === true)) {
144087
144181
  const input = document.createElement("textarea");
144088
144182
  document.body.appendChild(input);
144089
- const seqDataToCopy = this.getAllAlignmentsFastaText();
144183
+ const seqDataToCopy = getAllAlignmentsFastaText();
144090
144184
  input.value = seqDataToCopy;
144091
144185
  input.select();
144092
144186
  const copySuccess = document.execCommand("copy");
@@ -144098,1319 +144192,688 @@ const _AlignmentView = class _AlignmentView extends React$2.Component {
144098
144192
  document.body.removeChild(input);
144099
144193
  event.preventDefault();
144100
144194
  }
144101
- }, "handleAlignmentCopy"));
144102
- __publicField(this, "getAllAlignmentsFastaText", /* @__PURE__ */ __name(() => {
144103
- const selectionLayer2 = this.props.store.getState().VectorEditor.__allEditorsOptions.alignments[this.props.id].selectionLayer || {};
144104
- const { alignmentTracks } = this.props;
144105
- const seqDataOfAllTracksToCopy = [];
144106
- alignmentTracks.forEach((track2) => {
144107
- const seqDataToCopy = getSequenceDataBetweenRange(
144108
- track2.alignmentData,
144109
- selectionLayer2
144110
- ).sequence;
144111
- seqDataOfAllTracksToCopy.push(
144112
- `>${track2.alignmentData.name}\r
144113
- ${seqDataToCopy}\r
144114
- `
144115
- );
144116
- });
144117
- return seqDataOfAllTracksToCopy.join("");
144118
- }, "getAllAlignmentsFastaText"));
144119
- __publicField(this, "state", {
144120
- alignmentName: this.props.alignmentName,
144121
- isTrackDragging: false,
144122
- charWidthInLinearView: charWidthInLinearViewDefault,
144123
- scrollAlignmentView: false,
144124
- width: 0,
144125
- nameDivWidth: 140
144126
- });
144127
- __publicField(this, "easyStore", store$1({
144128
- selectionLayer: { start: -1, end: -1 },
144129
- caretPosition: -1,
144130
- percentScrolled: 0,
144131
- viewportWidth: 400,
144132
- verticalVisibleRange: { start: 0, end: 0 }
144133
- }));
144134
- __publicField(this, "getMinCharWidth", /* @__PURE__ */ __name((noNameDiv) => {
144195
+ }, "handleAlignmentCopy");
144196
+ document.addEventListener("keydown", handleAlignmentCopy);
144197
+ return () => {
144198
+ document.removeEventListener("keydown", handleAlignmentCopy);
144199
+ };
144200
+ }, [getAllAlignmentsFastaText]);
144201
+ const scrollAlignmentToPercent = /* @__PURE__ */ __name((scrollPercentage) => {
144202
+ const scrollPercentageToUse = Math.min(Math.max(scrollPercentage, 0), 1);
144203
+ easyStore2.current.percentScrolled = scrollPercentageToUse;
144204
+ alignmentHolder.current.scrollLeft = scrollPercentageToUse * (alignmentHolder.current.scrollWidth - alignmentHolder.current.clientWidth);
144205
+ if (alignmentHolderTop.current) {
144206
+ alignmentHolderTop.current.scrollLeft = scrollPercentageToUse * (alignmentHolderTop.current.scrollWidth - alignmentHolderTop.current.clientWidth);
144207
+ }
144208
+ }, "scrollAlignmentToPercent");
144209
+ React$2.useEffect(() => {
144210
+ window.scrollAlignmentToPercent = scrollAlignmentToPercent;
144211
+ if (window.Cypress)
144212
+ window.Cypress.scrollAlignmentToPercent = scrollAlignmentToPercent;
144213
+ return () => {
144214
+ delete window.scrollAlignmentToPercent;
144215
+ if (window.Cypress)
144216
+ delete window.Cypress.scrollAlignmentToPercent;
144217
+ };
144218
+ }, []);
144219
+ const maxLength = React$2.useMemo(() => {
144220
+ const { sequenceData: sequenceData22 = { sequence: "" }, alignmentData } = alignmentTracks[0];
144221
+ const data = alignmentData || sequenceData22;
144222
+ return data.noSequence ? data.size : data.sequence.length;
144223
+ }, [alignmentTracks]);
144224
+ const getSequenceLength = React$2.useCallback(() => {
144225
+ var _a3, _b2, _c;
144226
+ return ((_c = (_b2 = (_a3 = alignmentTracks == null ? void 0 : alignmentTracks[0]) == null ? void 0 : _a3.alignmentData) == null ? void 0 : _b2.sequence) == null ? void 0 : _c.length) || 1;
144227
+ }, [alignmentTracks]);
144228
+ const getMinCharWidth = React$2.useCallback(
144229
+ (noNameDiv) => {
144135
144230
  const toReturn = Math.min(
144136
- Math.max(
144137
- this.state.width - (noNameDiv ? 0 : this.state.nameDivWidth) - 5,
144138
- 1
144139
- ) / this.getSequenceLength(),
144231
+ Math.max(width - (noNameDiv ? 0 : nameDivWidth) - 5, 1) / getSequenceLength(),
144140
144232
  10
144141
144233
  );
144142
144234
  if (isNaN(toReturn))
144143
144235
  return 10;
144144
144236
  return toReturn;
144145
- }, "getMinCharWidth"));
144146
- __publicField(this, "getSequenceLength", /* @__PURE__ */ __name(() => {
144147
- const { alignmentTracks: [template] = [] } = this.props;
144148
- return template.alignmentData.sequence.length || 1;
144149
- }, "getSequenceLength"));
144150
- __publicField(this, "annotationClicked", /* @__PURE__ */ __name(({
144151
- event,
144152
- annotation,
144153
- gapsBefore = 0,
144154
- gapsInside = 0
144155
- }) => {
144156
- event.preventDefault && event.preventDefault();
144157
- event.stopPropagation && event.stopPropagation();
144158
- this.updateSelectionOrCaret(event.shiftKey, __spreadProps(__spreadValues({}, annotation), {
144159
- start: annotation.start + gapsBefore,
144160
- end: annotation.end + gapsBefore + gapsInside
144161
- }));
144162
- }, "annotationClicked"));
144163
- __publicField(this, "updateSelectionOrCaret", /* @__PURE__ */ __name((shiftHeld, newRangeOrCaret, { forceReduxUpdate } = {}) => {
144164
- const sequenceLength = this.getSequenceLength();
144165
- updateSelectionOrCaret({
144166
- doNotWrapOrigin: true,
144167
- shiftHeld,
144168
- sequenceLength,
144169
- newRangeOrCaret,
144170
- caretPosition: this.easyStore.caretPosition,
144171
- selectionLayer: this.easyStore.selectionLayer,
144172
- selectionLayerUpdate: forceReduxUpdate ? this.forceReduxSelectionLayerUpdate : this.selectionLayerUpdate,
144173
- caretPositionUpdate: this.caretPositionUpdate
144174
- });
144175
- }, "updateSelectionOrCaret"));
144176
- __publicField(this, "caretPositionUpdate", /* @__PURE__ */ __name((position2) => {
144177
- const { caretPosition: caretPosition2 = -1, alignmentId } = this.props;
144178
- if (caretPosition2 === position2) {
144237
+ },
144238
+ [getSequenceLength, nameDivWidth, width]
144239
+ );
144240
+ const charWidth2 = React$2.useMemo(() => {
144241
+ if (isFullyZoomedOut) {
144242
+ return getMinCharWidth();
144243
+ } else {
144244
+ return Math.max(getMinCharWidth(), charWidthInLinearView);
144245
+ }
144246
+ }, [charWidthInLinearView, getMinCharWidth, isFullyZoomedOut]);
144247
+ const debouncedAlignmentRunUpdate = debounce$1(alignmentRunUpdate2, 1e3);
144248
+ const caretPositionUpdate2 = React$2.useCallback(
144249
+ (position2) => {
144250
+ if ((caretPosition2 || -1) === position2) {
144179
144251
  return;
144180
144252
  }
144181
- this.easyStore.caretPosition = position2;
144182
- this.easyStore.selectionLayer = { start: -1, end: -1 };
144183
- this.debouncedAlignmentRunUpdate({
144253
+ easyStore2.current.caretPosition = position2;
144254
+ easyStore2.current.selectionLayer = { start: -1, end: -1 };
144255
+ debouncedAlignmentRunUpdate({
144184
144256
  alignmentId,
144185
144257
  selectionLayer: { start: -1, end: -1 },
144186
144258
  caretPosition: position2
144187
144259
  });
144188
- }, "caretPositionUpdate"));
144189
- __publicField(this, "debouncedAlignmentRunUpdate", debounce$1(this.props.alignmentRunUpdate, 1e3));
144190
- __publicField(this, "forceReduxSelectionLayerUpdate", /* @__PURE__ */ __name((newSelection) => {
144191
- this.selectionLayerUpdate(newSelection, { forceReduxUpdate: true });
144192
- }, "forceReduxSelectionLayerUpdate"));
144193
- __publicField(this, "selectionLayerUpdate", /* @__PURE__ */ __name((newSelection, { forceReduxUpdate } = {}) => {
144194
- const { selectionLayer: selectionLayer2 = { start: -1, end: -1 }, alignmentId } = this.props;
144260
+ },
144261
+ [alignmentId, caretPosition2, debouncedAlignmentRunUpdate]
144262
+ );
144263
+ const selectionLayerUpdate2 = React$2.useCallback(
144264
+ (newSelection, { forceReduxUpdate } = {}) => {
144265
+ const usableSelectionLayer = selectionLayer2 || { start: -1, end: -1 };
144195
144266
  if (!newSelection)
144196
144267
  return;
144197
144268
  const { start: start2, end: end2 } = newSelection;
144198
- if (selectionLayer2.start === start2 && selectionLayer2.end === end2) {
144269
+ if (usableSelectionLayer.start === start2 && usableSelectionLayer.end === end2) {
144199
144270
  return;
144200
144271
  }
144201
- this.easyStore.caretPosition = -1;
144202
- this.easyStore.selectionLayer = newSelection;
144203
- (forceReduxUpdate ? this.props.alignmentRunUpdate : this.debouncedAlignmentRunUpdate)({
144272
+ easyStore2.current.caretPosition = -1;
144273
+ easyStore2.current.selectionLayer = newSelection;
144274
+ (forceReduxUpdate ? alignmentRunUpdate2 : debouncedAlignmentRunUpdate)({
144204
144275
  alignmentId,
144205
144276
  selectionLayer: newSelection,
144206
144277
  caretPosition: -1
144207
144278
  });
144208
- }, "selectionLayerUpdate"));
144209
- __publicField(this, "getCharWidthInLinearView", /* @__PURE__ */ __name(() => {
144210
- if (this.props.isFullyZoomedOut) {
144211
- return this.getMinCharWidth();
144212
- } else {
144213
- return Math.max(this.getMinCharWidth(), this.state.charWidthInLinearView);
144214
- }
144215
- }, "getCharWidthInLinearView"));
144216
- __publicField(this, "getNumBpsShownInLinearView", /* @__PURE__ */ __name(() => {
144217
- const toReturn = (this.state.width - this.state.nameDivWidth) / this.getCharWidthInLinearView();
144218
- return toReturn || 0;
144219
- }, "getNumBpsShownInLinearView"));
144220
- __publicField(this, "setVerticalScrollRange", throttle$1(() => {
144221
- if (this && this.InfiniteScroller && this.InfiniteScroller.getFractionalVisibleRange && this.easyStore) {
144222
- let [start2, end2] = this.InfiniteScroller.getFractionalVisibleRange();
144223
- if (this.props.hasTemplate) {
144224
- end2 = end2 + 1;
144225
- }
144226
- if (this.easyStore.verticalVisibleRange.start !== start2 || this.easyStore.verticalVisibleRange.end !== end2)
144227
- this.easyStore.verticalVisibleRange = { start: start2, end: end2 };
144228
- }
144229
- }, 100));
144230
- __publicField(this, "handleScroll", /* @__PURE__ */ __name(() => {
144231
- if (this.alignmentHolder.scrollTop !== this.oldAlignmentHolderScrollTop) {
144232
- setTimeout(() => {
144233
- this.setVerticalScrollRange();
144234
- this.oldAlignmentHolderScrollTop = this.alignmentHolder.scrollTop;
144235
- }, 100);
144236
- }
144237
- if (this.blockScroll) {
144238
- return;
144239
- }
144240
- const scrollPercentage = this.alignmentHolder.scrollLeft / (this.alignmentHolder.scrollWidth - this.alignmentHolder.clientWidth);
144241
- this.easyStore.percentScrolled = scrollPercentage || 0;
144242
- if (!this.isZooming) {
144243
- this.easyStore.percentScrolledPreZoom = this.easyStore.percentScrolled;
144244
- }
144245
- if (this.alignmentHolderTop) {
144246
- this.alignmentHolderTop.scrollLeft = this.alignmentHolder.scrollLeft;
144247
- }
144248
- updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144249
- }, "handleScroll"));
144250
- __publicField(this, "handleTopScroll", /* @__PURE__ */ __name(() => {
144251
- this.alignmentHolder.scrollLeft = this.alignmentHolderTop.scrollLeft;
144252
- }, "handleTopScroll"));
144253
- /**
144254
- * Responsible for handling resizing the highlighted region of the minimap
144255
- * @param {*} newSliderSize
144256
- * @param {*} newPercent
144257
- */
144258
- __publicField(this, "onMinimapSizeAdjust", /* @__PURE__ */ __name((newSliderSize, newPercent) => {
144259
- const percentageOfSpace = newSliderSize / this.state.width;
144260
- const seqLength = this.getSequenceLength();
144261
- const numBpsInView = seqLength * percentageOfSpace;
144262
- const newCharWidth = (this.state.width - this.state.nameDivWidth) / numBpsInView;
144263
- this.blockScroll = true;
144264
- this.setCharWidthInLinearView({ charWidthInLinearView: newCharWidth });
144265
- setTimeout(() => {
144266
- this.scrollAlignmentToPercent(newPercent);
144267
- this.blockScroll = false;
144268
- updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144269
- });
144270
- }, "onMinimapSizeAdjust"));
144271
- __publicField(this, "setCharWidthInLinearView", /* @__PURE__ */ __name(({ charWidthInLinearView }) => {
144272
- window.localStorage.setItem(
144273
- "charWidthInLinearViewDefault",
144274
- charWidthInLinearView
144275
- );
144276
- this.setState({ charWidthInLinearView });
144277
- charWidthInLinearViewDefault = JSON.parse(
144278
- window.localStorage.getItem("charWidthInLinearViewDefault")
144279
- );
144280
- }, "setCharWidthInLinearView"));
144281
- __publicField(this, "scrollToCaret", /* @__PURE__ */ __name(() => {
144282
- let el = window.document.querySelector(".veCaret:not(.zoomSelection)");
144283
- if (!el) {
144284
- el = window.document.querySelector(".veCaret");
144285
- }
144286
- if (!el) {
144287
- return;
144288
- }
144289
- el.scrollIntoView({ inline: "center", block: "nearest" });
144290
- }, "scrollToCaret"));
144291
- __publicField(this, "scrollAlignmentToPercent", /* @__PURE__ */ __name((scrollPercentage) => {
144292
- const scrollPercentageToUse = Math.min(Math.max(scrollPercentage, 0), 1);
144293
- this.easyStore.percentScrolled = scrollPercentageToUse;
144294
- this.alignmentHolder.scrollLeft = scrollPercentageToUse * (this.alignmentHolder.scrollWidth - this.alignmentHolder.clientWidth);
144295
- if (this.alignmentHolderTop) {
144296
- this.alignmentHolderTop.scrollLeft = scrollPercentageToUse * (this.alignmentHolderTop.scrollWidth - this.alignmentHolderTop.clientWidth);
144297
- }
144298
- }, "scrollAlignmentToPercent"));
144299
- __publicField(this, "scrollYToTrack", /* @__PURE__ */ __name((trackIndex) => {
144300
- this.InfiniteScroller.scrollTo(trackIndex);
144301
- }, "scrollYToTrack"));
144302
- __publicField(this, "estimateRowHeight", /* @__PURE__ */ __name((index2, cache2) => {
144303
- const { alignmentVisibilityToolOptions, alignmentTracks } = this.props;
144304
- const track2 = alignmentTracks[index2];
144305
- if (!track2)
144306
- return 100;
144307
- const { sequenceData: sequenceData2 } = track2;
144308
- this.rowData = prepareRowData(sequenceData2, sequenceData2.sequence.length);
144309
- return estimateRowHeight({
144310
- index: index2,
144311
- cache: cache2,
144312
- // clearCache: this.clearCache,
144313
- row: this.rowData[index2],
144314
- annotationVisibility: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
144315
- annotationLabelVisibility: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility
144316
- });
144317
- }, "estimateRowHeight"));
144318
- __publicField(this, "getMaxLinearViewWidth", /* @__PURE__ */ __name(() => {
144319
- let maxWidth = 0;
144320
- const charWidthInLinearView = this.getCharWidthInLinearView();
144321
- forEach$4(this.props.alignmentTracks, (t2) => {
144322
- const w2 = (t2.alignmentData || t2.sequenceData).sequence.length;
144323
- if (w2 > maxWidth)
144324
- maxWidth = w2;
144279
+ },
144280
+ [
144281
+ alignmentId,
144282
+ alignmentRunUpdate2,
144283
+ debouncedAlignmentRunUpdate,
144284
+ selectionLayer2
144285
+ ]
144286
+ );
144287
+ const updateSelectionOrCaret$1 = React$2.useCallback(
144288
+ (shiftHeld, newRangeOrCaret, { forceReduxUpdate } = {}) => {
144289
+ const forceReduxSelectionLayerUpdate = /* @__PURE__ */ __name((newSelection) => {
144290
+ selectionLayerUpdate2(newSelection, { forceReduxUpdate: true });
144291
+ }, "forceReduxSelectionLayerUpdate");
144292
+ const sequenceLength2 = getSequenceLength();
144293
+ updateSelectionOrCaret({
144294
+ doNotWrapOrigin: true,
144295
+ shiftHeld,
144296
+ sequenceLength: sequenceLength2,
144297
+ newRangeOrCaret,
144298
+ caretPosition: easyStore2.current.caretPosition,
144299
+ selectionLayer: easyStore2.current.selectionLayer,
144300
+ selectionLayerUpdate: forceReduxUpdate ? forceReduxSelectionLayerUpdate : selectionLayerUpdate2,
144301
+ caretPositionUpdate: caretPositionUpdate2
144325
144302
  });
144326
- return maxWidth * charWidthInLinearView;
144327
- }, "getMaxLinearViewWidth"));
144328
- __publicField(this, "renderItem", /* @__PURE__ */ __name((_i, key, isTemplate, cloneProps) => {
144329
- const charWidthInLinearView = this.getCharWidthInLinearView();
144330
- const _a2 = this.props, {
144331
- alignmentTrackIndex,
144332
- pairwiseAlignments,
144333
- currentPairwiseAlignmentIndex,
144334
- pairwiseOverviewAlignmentTracks,
144335
- alignmentTracks = [],
144336
- upsertAlignmentRun: upsertAlignmentRun2,
144337
- alignmentId,
144338
- noClickDragHandlers,
144339
- handleSelectTrack,
144340
- allowTrackRearrange,
144341
- isPairwise,
144342
- linearViewOptions,
144343
- alignmentVisibilityToolOptions,
144344
- hasTemplate,
144345
- allowTrackNameEdit
144346
- } = _a2, rest = __objRest(_a2, [
144347
- "alignmentTrackIndex",
144348
- "pairwiseAlignments",
144349
- "currentPairwiseAlignmentIndex",
144350
- "pairwiseOverviewAlignmentTracks",
144351
- "alignmentTracks",
144352
- "upsertAlignmentRun",
144353
- "alignmentId",
144354
- "noClickDragHandlers",
144355
- "handleSelectTrack",
144356
- "allowTrackRearrange",
144357
- "isPairwise",
144358
- "linearViewOptions",
144359
- "alignmentVisibilityToolOptions",
144360
- "hasTemplate",
144361
- "allowTrackNameEdit"
144362
- ]);
144363
- const isDragDisabled = !allowTrackRearrange || isPairwise;
144364
- let i;
144365
- if (isTemplate) {
144366
- i = _i;
144367
- } else if (hasTemplate) {
144368
- i = _i + 1;
144303
+ },
144304
+ [caretPositionUpdate2, getSequenceLength, selectionLayerUpdate2]
144305
+ );
144306
+ const getNearestCursorPositionToMouseEvent2 = React$2.useCallback(
144307
+ (_2, event, callback2) => {
144308
+ let nearestCaretPos = 0;
144309
+ const rowDomNode = veTracksAndAlignmentHolder.current;
144310
+ const boundingRowRect = rowDomNode.getBoundingClientRect();
144311
+ if (getClientX(event) - boundingRowRect.left - nameDivWidth < 0) {
144312
+ nearestCaretPos = 0;
144369
144313
  } else {
144370
- i = _i;
144371
- }
144372
- const track2 = alignmentTracks[i];
144373
- if (!track2)
144374
- return null;
144375
- const {
144376
- sequenceData: sequenceData2,
144377
- alignmentData,
144378
- isReversed,
144379
- wasTrimmed,
144380
- additionalSelectionLayers,
144381
- chromatogramData
144382
- // mismatches
144383
- } = track2;
144384
- const seqLen = this.getMaxLength();
144385
- const trimmedRangesToDisplay = getTrimmedRangesToDisplay({
144386
- seqLen,
144387
- trimmedRange: alignmentData == null ? void 0 : alignmentData.trimmedRange
144388
- });
144389
- const linearViewWidth = (alignmentData || sequenceData2).sequence.length * charWidthInLinearView;
144390
- const name2 = sequenceData2.name || sequenceData2.id;
144391
- const tickSpacing = massageTickSpacing(
144392
- Math.ceil(120 / charWidthInLinearView)
144393
- );
144394
- const { compactNames } = alignmentVisibilityToolOptions.alignmentAnnotationVisibility;
144395
- const selectionLayer2 = [
144396
- this.state[`tempTrimBefore${i}`] || trimmedRangesToDisplay[0],
144397
- this.state[`tempTrimAfter${i}`] || trimmedRangesToDisplay[1]
144398
- ].filter((i2) => i2).map((i2) => __spreadProps(__spreadValues({}, i2), {
144399
- hideCarets: true,
144400
- ignoreGaps: true,
144401
- className: "tg-trimmed-region",
144402
- color: "gray"
144403
- }));
144404
- const innerRenderItem = /* @__PURE__ */ __name((provided = {}, snapshot) => {
144405
- var _a3;
144406
- return /* @__PURE__ */ React$2.createElement(
144407
- "div",
144408
- __spreadProps(__spreadValues({
144409
- ref: provided == null ? void 0 : provided.innerRef
144410
- }, provided == null ? void 0 : provided.draggableProps), {
144411
- className: classNames("alignmentViewTrackContainer", {
144412
- isDragDisabled
144413
- }),
144414
- "data-alignment-track-index": i,
144415
- style: __spreadValues(__spreadValues({
144416
- boxShadow: isTemplate ? "red 0px -1px 0px 0px inset, red 0px 1px 0px 0px inset" : "0px -1px 0px 0px inset",
144417
- display: "flex"
144418
- }, (_a3 = provided == null ? void 0 : provided.draggableProps) == null ? void 0 : _a3.style), (snapshot == null ? void 0 : snapshot.isDragging) && { left: unset }),
144419
- key: i
144420
- }),
144421
- /* @__PURE__ */ React$2.createElement(
144422
- "div",
144423
- {
144424
- className: "alignmentTrackName",
144425
- style: {
144426
- position: "sticky",
144427
- left: 0,
144428
- zIndex: 10,
144429
- borderBottom: `1px solid ${isTemplate ? "red" : "lightgray"}`,
144430
- borderRight: `1px solid ${isTemplate ? "red" : "lightgray"}`,
144431
- width: this.state.nameDivWidth - 3,
144432
- padding: 2,
144433
- marginRight: 3,
144434
- paddingBottom: 0,
144435
- minWidth: this.state.nameDivWidth - 3,
144436
- overflow: "hidden",
144437
- scrollbarWidth: "none",
144438
- whiteSpace: "nowrap"
144439
- },
144440
- "data-title": name2,
144441
- key: i
144442
- },
144443
- /* @__PURE__ */ React$2.createElement(
144444
- "div",
144445
- __spreadProps(__spreadValues({}, provided == null ? void 0 : provided.dragHandleProps), {
144446
- style: __spreadProps(__spreadValues({}, compactNames && {
144447
- display: "flex",
144448
- alignItems: "flex-start"
144449
- }), {
144450
- cursor: !isPairwise && allowTrackRearrange && !isTemplate ? "move" : ""
144451
- })
144452
- }),
144453
- /* @__PURE__ */ React$2.createElement(
144454
- "div",
144455
- {
144456
- className: "alignmentTrackNameDiv",
144457
- style: __spreadValues({
144458
- background: "#3FA6DA",
144459
- display: "inline-block",
144460
- color: "white",
144461
- borderRadius: 5,
144462
- paddingRight: 5
144463
- }, compactNames && {
144464
- marginRight: 5
144465
- })
144466
- },
144467
- allowTrackNameEdit && /* @__PURE__ */ React$2.createElement(
144468
- core.Button,
144469
- {
144470
- onClick: () => {
144471
- showDialog({
144472
- ModalComponent: EditTrackNameDialog,
144473
- props: {
144474
- initialValues: {
144475
- name: name2
144476
- },
144477
- updateName: ({ newName }) => {
144478
- updateTrackHelper({
144479
- currentPairwiseAlignmentIndex,
144480
- pairwiseAlignments,
144481
- upsertAlignmentRun: upsertAlignmentRun2,
144482
- alignmentId,
144483
- alignmentTracks,
144484
- alignmentTrackIndex: i,
144485
- update: { name: newName }
144486
- });
144487
- }
144488
- }
144489
- });
144490
- },
144491
- small: true,
144492
- "data-tip": "Edit Track Name",
144493
- className: "edit-track-name-btn",
144494
- icon: /* @__PURE__ */ React$2.createElement(core.Icon, { size: 12, color: "lightgrey", icon: "edit" }),
144495
- minimal: true
144496
- }
144497
- ),
144498
- sequenceData2.seqLink && /* @__PURE__ */ React$2.createElement(
144499
- core.AnchorButton,
144500
- {
144501
- href: sequenceData2.seqLink,
144502
- "data-tip": sequenceData2.seqLinkTooltip,
144503
- target: "_blank",
144504
- small: true,
144505
- icon: /* @__PURE__ */ React$2.createElement(core.Icon, { size: 12, color: "white", icon: "document-open" }),
144506
- minimal: true
144507
- }
144508
- ),
144509
- name2
144510
- ),
144511
- /* @__PURE__ */ React$2.createElement("div", { style: { fontSize: 10, marginTop: 2, marginBottom: 2 } }, isReversed && /* @__PURE__ */ React$2.createElement(
144512
- "span",
144513
- {
144514
- style: {
144515
- backgroundColor: isReversed ? "#E76A6E" : "#4C90F0",
144516
- padding: 2,
144517
- paddingLeft: 4,
144518
- color: "white",
144519
- marginRight: 2,
144520
- borderRadius: "5px"
144521
- },
144522
- "data-tip": isReversed ? "The alignment algorithm matched the reverse complement of this input sequence" : "The original sequence was NOT reversed complemented by the alignment algorithm"
144523
- },
144524
- isReversed ? "REV" : "FWD",
144525
- " "
144526
- ), wasTrimmed && /* @__PURE__ */ React$2.createElement(
144527
- "span",
144528
- {
144529
- style: {
144530
- backgroundColor: "#13C9BA",
144531
- padding: 2,
144532
- paddingLeft: 4,
144533
- color: "white",
144534
- marginRight: 2,
144535
- borderRadius: "5px"
144536
- },
144537
- "data-tip": "This sequence was trimmed and resubmitted for alignment"
144538
- },
144539
- "TRIMMED"
144540
- ), sequenceData2.sequence.length, " bps")
144541
- ),
144542
- /* @__PURE__ */ React$2.createElement(
144543
- HorizontalPanelDragHandle,
144544
- {
144545
- onDrag: ({ dx }) => {
144546
- this.setState({
144547
- nameDivWidth: Math.min(
144548
- this.state.nameDivWidth - dx,
144549
- this.state.width - 20
144550
- )
144551
- });
144552
- }
144553
- }
144554
- )
144555
- ),
144556
- handleSelectTrack && !isTemplate && /* @__PURE__ */ React$2.createElement(
144557
- "div",
144558
- {
144559
- onClick: () => {
144560
- handleSelectTrack(i);
144561
- },
144562
- style: {
144563
- position: "absolute",
144564
- opacity: 0,
144565
- height: "100%",
144566
- left: this.state.nameDivWidth,
144567
- width: linearViewWidth,
144568
- fontWeight: "bolder",
144569
- cursor: "pointer",
144570
- padding: 5,
144571
- textAlign: "center",
144572
- zIndex: 400
144573
- },
144574
- className: "alignmentViewSelectTrackPopover veWhiteBackground"
144575
- },
144576
- "Inspect track"
144577
- ),
144578
- /* @__PURE__ */ React$2.createElement(
144579
- NonReduxEnhancedLinearView,
144580
- __spreadValues({}, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
144581
- caretPosition: this.state[`tempTrimmingCaret${i}`] || -1,
144582
- selectionLayer: selectionLayer2,
144583
- isInAlignment: true,
144584
- // : { start: -1, end: -1 },
144585
- annotationVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
144586
- linearViewAnnotationLabelVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility,
144587
- marginWith: 0,
144588
- orfClicked: this.annotationClicked,
144589
- primerClicked: this.annotationClicked,
144590
- translationClicked: this.annotationClicked,
144591
- cutsiteClicked: this.annotationClicked,
144592
- translationDoubleClicked: this.annotationClicked,
144593
- deletionLayerClicked: this.annotationClicked,
144594
- replacementLayerClicked: this.annotationClicked,
144595
- featureClicked: this.annotationClicked,
144596
- partClicked: this.annotationClicked,
144597
- searchLayerClicked: this.annotationClicked,
144598
- editorDragStarted: noop$7,
144599
- //override these since we're defining the handlers above
144600
- editorDragStopped: noop$7,
144601
- //override these since we're defining the handlers above
144602
- editorDragged: noop$7,
144603
- //override these since we're defining the handlers above
144604
- hideName: true,
144605
- sequenceData: sequenceData2,
144606
- // sequenceDataWithRefSeqCdsFeatures,
144607
- tickSpacing,
144608
- allowSeqDataOverride: true,
144609
- //override the sequence data stored in redux so we can track the caret position/selection layer in redux but not have to update the redux editor
144610
- editorName: `${isTemplate ? "template_" : ""}alignmentView${i}`,
144611
- alignmentData,
144612
- chromatogramData,
144613
- height: "100%",
144614
- vectorInteractionWrapperStyle: {
144615
- overflowY: "hidden"
144616
- },
144617
- withZoomLinearView: false,
144618
- marginWidth: 0,
144619
- linearViewCharWidth: charWidthInLinearView,
144620
- ignoreGapsOnHighlight: true
144621
- }), linearViewOptions && (isFunction$7(linearViewOptions) ? linearViewOptions({
144622
- index: i,
144623
- isTemplate,
144624
- alignmentVisibilityToolOptions,
144625
- sequenceData: sequenceData2,
144626
- alignmentData,
144627
- chromatogramData
144628
- }) : linearViewOptions)), {
144629
- additionalSelectionLayers,
144630
- dimensions: {
144631
- width: linearViewWidth
144632
- },
144633
- width: linearViewWidth,
144634
- paddingBottom: 5,
144635
- scrollDataPassed: this.easyStore
144636
- }))
144637
- )
144314
+ const clickXPositionRelativeToRowContainer = getClientX(event) - boundingRowRect.left - nameDivWidth;
144315
+ const numberOfBPsInFromRowStart = Math.floor(
144316
+ (clickXPositionRelativeToRowContainer + charWidth2 / 2) / charWidth2
144638
144317
  );
144639
- }, "innerRenderItem");
144640
- if (isTemplate)
144641
- return innerRenderItem();
144642
- if (cloneProps)
144643
- return innerRenderItem(cloneProps.provided, cloneProps.snapshot);
144644
- const idToUse = alignmentData.id || sequenceData2.id || i + "_index_id";
144645
- return /* @__PURE__ */ React$2.createElement(
144646
- PublicDraggable,
144647
- {
144648
- key: idToUse.toString(),
144649
- index: i,
144650
- isDragDisabled,
144651
- draggableId: idToUse.toString()
144652
- },
144653
- innerRenderItem
144654
- );
144655
- }, "renderItem"));
144656
- __publicField(this, "handleResize", throttle$1(([e2]) => {
144657
- this.easyStore.viewportWidth = e2.contentRect.width - this.state.nameDivWidth || 400;
144658
- this.setState({ width: e2.contentRect.width });
144659
- }, 200));
144660
- __publicField(this, "removeMinimapHighlightForMouseLeave", /* @__PURE__ */ __name(() => {
144661
- const minimapLaneEl = document.querySelector(`.minimapLane.lane-hovered`);
144662
- if (!minimapLaneEl)
144663
- return;
144664
- minimapLaneEl.classList.remove("lane-hovered");
144665
- }, "removeMinimapHighlightForMouseLeave"));
144666
- __publicField(this, "updateMinimapHighlightForMouseMove", /* @__PURE__ */ __name((event) => {
144667
- this.latestMouseY = getClientY(event);
144668
- this.updateMinimapHighlight();
144669
- }, "updateMinimapHighlightForMouseMove"));
144670
- __publicField(this, "updateMinimapHighlight", /* @__PURE__ */ __name(() => {
144671
- const rows = document.querySelectorAll(`.alignmentViewTrackContainer`);
144672
- const rowsLength = document.querySelectorAll(`.minimapLane`).length;
144673
- if (rowsLength <= 4) {
144674
- return;
144675
- }
144676
- some(rows, (rowDomNode) => {
144677
- const boundingRowRect = rowDomNode.getBoundingClientRect();
144678
- if (this.latestMouseY > boundingRowRect.top && this.latestMouseY < boundingRowRect.top + boundingRowRect.height) {
144679
- const prevMinimapLaneEl = document.querySelector(
144680
- `.minimapLane.lane-hovered`
144681
- );
144682
- if (prevMinimapLaneEl) {
144683
- prevMinimapLaneEl.classList.remove("lane-hovered");
144684
- }
144685
- const i = Number(rowDomNode.getAttribute("data-alignment-track-index"));
144686
- const minimapLaneEl = document.querySelector(
144687
- `.minimapLane:nth-child(${i + 1})`
144688
- );
144689
- if (!minimapLaneEl)
144690
- return;
144691
- minimapLaneEl.classList.add("lane-hovered");
144692
- return true;
144318
+ nearestCaretPos = numberOfBPsInFromRowStart + 0;
144319
+ if (nearestCaretPos > maxLength + 1) {
144320
+ nearestCaretPos = maxLength + 1;
144693
144321
  }
144694
- });
144695
- }, "updateMinimapHighlight"));
144696
- __publicField(this, "onTrackDragStart", /* @__PURE__ */ __name(() => {
144697
- this.setState({ isTrackDragging: true });
144698
- }, "onTrackDragStart"));
144699
- __publicField(this, "onTrackDragEnd", /* @__PURE__ */ __name(({ destination, source }) => {
144700
- this.setState({ isTrackDragging: false });
144701
- if (!destination) {
144702
- return;
144703
144322
  }
144704
- const { upsertAlignmentRun: upsertAlignmentRun2, alignmentId, alignmentTracks } = this.props;
144705
- upsertAlignmentRun2({
144706
- id: alignmentId,
144707
- alignmentTracks: array_move(
144708
- alignmentTracks,
144709
- source.index,
144710
- destination.index
144323
+ if (sequenceData2 == null ? void 0 : sequenceData2.isProtein) {
144324
+ nearestCaretPos = Math.round(nearestCaretPos / 3) * 3;
144325
+ }
144326
+ if (sequenceLength === 0)
144327
+ nearestCaretPos = 0;
144328
+ const callbackVals = {
144329
+ updateSelectionOrCaret: updateSelectionOrCaret$1,
144330
+ nearestCaretPos,
144331
+ sequenceLength: getSequenceLength(),
144332
+ caretPosition: easyStore2.current.caretPosition,
144333
+ selectionLayer: easyStore2.current.selectionLayer,
144334
+ easyStore: easyStore2.current,
144335
+ caretPositionUpdate: caretPositionUpdate2,
144336
+ selectionLayerUpdate: selectionLayerUpdate2,
144337
+ event,
144338
+ doNotWrapOrigin: true,
144339
+ shiftHeld: event.shiftKey,
144340
+ // caretGrabbed: event.target.className === "cursor",
144341
+ selectionStartGrabbed: event.target.classList.contains(
144342
+ draggableClassnames.selectionStart
144343
+ ),
144344
+ selectionEndGrabbed: event.target.classList.contains(
144345
+ draggableClassnames.selectionEnd
144711
144346
  )
144347
+ };
144348
+ callback2(callbackVals);
144349
+ },
144350
+ [
144351
+ caretPositionUpdate2,
144352
+ charWidth2,
144353
+ getSequenceLength,
144354
+ maxLength,
144355
+ nameDivWidth,
144356
+ selectionLayerUpdate2,
144357
+ sequenceData2 == null ? void 0 : sequenceData2.isProtein,
144358
+ sequenceLength,
144359
+ updateSelectionOrCaret$1
144360
+ ]
144361
+ );
144362
+ React$2.useEffect(() => {
144363
+ const updateAlignmentSelection = /* @__PURE__ */ __name((newRangeOrCaret) => {
144364
+ updateSelectionOrCaret$1(false, newRangeOrCaret, {
144365
+ forceReduxUpdate: true
144712
144366
  });
144713
- }, "onTrackDragEnd"));
144714
- window.scrollAlignmentToPercent = this.scrollAlignmentToPercent;
144367
+ }, "updateAlignmentSelection");
144368
+ window.updateAlignmentSelection = updateAlignmentSelection;
144715
144369
  if (window.Cypress)
144716
- window.Cypress.scrollAlignmentToPercent = this.scrollAlignmentToPercent;
144717
- this.onShortcutCopy = document.addEventListener(
144718
- "keydown",
144719
- this.handleAlignmentCopy
144720
- );
144721
- }
144722
- getNearestCursorPositionToMouseEvent(rowData, event, callback2) {
144723
- this.charWidth = this.getCharWidthInLinearView();
144724
- let nearestCaretPos = 0;
144725
- const rowDomNode = this.veTracksAndAlignmentHolder;
144726
- const boundingRowRect = rowDomNode.getBoundingClientRect();
144727
- const maxEnd = this.getMaxLength();
144728
- if (getClientX(event) - boundingRowRect.left - this.state.nameDivWidth < 0) {
144729
- nearestCaretPos = 0;
144730
- } else {
144731
- const clickXPositionRelativeToRowContainer = getClientX(event) - boundingRowRect.left - this.state.nameDivWidth;
144732
- const numberOfBPsInFromRowStart = Math.floor(
144733
- (clickXPositionRelativeToRowContainer + this.charWidth / 2) / this.charWidth
144734
- );
144735
- nearestCaretPos = numberOfBPsInFromRowStart + 0;
144736
- if (nearestCaretPos > maxEnd + 1) {
144737
- nearestCaretPos = maxEnd + 1;
144370
+ window.Cypress.updateAlignmentSelection = updateAlignmentSelection;
144371
+ return () => {
144372
+ delete window.updateAlignmentSelection;
144373
+ if (window.Cypress) {
144374
+ delete window.Cypress.updateAlignmentSelection;
144738
144375
  }
144739
- }
144740
- if (this.props.sequenceData && this.props.sequenceData.isProtein) {
144741
- nearestCaretPos = Math.round(nearestCaretPos / 3) * 3;
144742
- }
144743
- if (this.props.sequenceLength === 0)
144744
- nearestCaretPos = 0;
144745
- const callbackVals = {
144746
- updateSelectionOrCaret: this.updateSelectionOrCaret,
144747
- nearestCaretPos,
144748
- sequenceLength: this.getSequenceLength(),
144749
- caretPosition: this.easyStore.caretPosition,
144750
- selectionLayer: this.easyStore.selectionLayer,
144751
- easyStore: this.easyStore,
144752
- caretPositionUpdate: this.caretPositionUpdate,
144753
- selectionLayerUpdate: this.selectionLayerUpdate,
144754
- event,
144755
- doNotWrapOrigin: true,
144756
- shiftHeld: event.shiftKey,
144757
- // caretGrabbed: event.target.className === "cursor",
144758
- selectionStartGrabbed: event.target.classList.contains(
144759
- draggableClassnames.selectionStart
144760
- ),
144761
- selectionEndGrabbed: event.target.classList.contains(
144762
- draggableClassnames.selectionEnd
144763
- )
144764
144376
  };
144765
- callback2(callbackVals);
144766
- }
144767
- componentWillUnmount() {
144768
- if (window.Cypress) {
144769
- delete window.scrollAlignmentToPercent;
144770
- delete window.Cypress.scrollAlignmentToPercent;
144771
- delete window.updateAlignmentSelection;
144772
- delete window.Cypress.updateAlignmentSelection;
144773
- }
144774
- this.onShortcutCopy && document.removeEventListener("keydown", this.handleAlignmentCopy);
144775
- }
144776
- componentDidUpdate(prevProps) {
144777
- return __async(this, null, function* () {
144778
- if (prevProps.scrollPercentageToJumpTo !== this.props.scrollPercentageToJumpTo && this.props.scrollPercentageToJumpTo !== void 0) {
144779
- this.scrollAlignmentToPercent(this.props.scrollPercentageToJumpTo);
144377
+ }, [updateSelectionOrCaret$1]);
144378
+ const setVerticalScrollRange = throttle$1(() => {
144379
+ if (InfiniteScroller.current && InfiniteScroller.current.getFractionalVisibleRange && easyStore2.current) {
144380
+ let [start2, end2] = InfiniteScroller.current.getFractionalVisibleRange();
144381
+ if (hasTemplate) {
144382
+ end2 = end2 + 1;
144780
144383
  }
144781
- if (this.props.shouldAutosave && prevProps && prevProps.stateTrackingId && this.props.stateTrackingId !== prevProps.stateTrackingId) {
144782
- this.setState({ saveMessage: "Alignment Saving.." });
144783
- this.setState({ saveMessageLoading: true });
144384
+ if (easyStore2.current.verticalVisibleRange.start !== start2 || easyStore2.current.verticalVisibleRange.end !== end2)
144385
+ easyStore2.current.verticalVisibleRange = { start: start2, end: end2 };
144386
+ }
144387
+ }, 100);
144388
+ React$2.useEffect(() => {
144389
+ setTimeout(() => {
144390
+ updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144391
+ }, 0);
144392
+ setTimeout(() => {
144393
+ setVerticalScrollRange();
144394
+ }, 500);
144395
+ });
144396
+ React$2.useEffect(() => {
144397
+ if (scrollPercentageToJumpTo !== void 0) {
144398
+ scrollAlignmentToPercent(scrollPercentageToJumpTo);
144399
+ }
144400
+ }, [scrollPercentageToJumpTo]);
144401
+ React$2.useEffect(() => {
144402
+ const saveAlignment = /* @__PURE__ */ __name(() => __async(exports, null, function* () {
144403
+ if (shouldAutosave && stateTrackingId) {
144404
+ setSaveMessage("Alignment Saving..");
144405
+ setSaveMessageLoading(true);
144784
144406
  let cleanedTracks;
144785
- if (this.props.pairwiseAlignments) {
144786
- cleanedTracks = this.props.pairwiseAlignments.map(cleanTracks);
144407
+ if (pairwiseAlignments) {
144408
+ cleanedTracks = pairwiseAlignments.map(cleanTracks);
144787
144409
  } else {
144788
- cleanedTracks = cleanTracks(this.props.alignmentTracks);
144410
+ cleanedTracks = cleanTracks(alignmentTracks);
144789
144411
  }
144790
- yield this.props.handleAlignmentSave(cleanedTracks, this.props);
144791
- this.setState({ saveMessage: "Alignment Saved" });
144792
- this.setState({ saveMessageLoading: false });
144412
+ yield handleAlignmentSave(cleanedTracks);
144413
+ setSaveMessage("Alignment Saved");
144414
+ setSaveMessageLoading(false);
144793
144415
  setTimeout(() => {
144794
- this.setState({ saveMessage: void 0 });
144795
- this.setState({ saveMessageLoading: false });
144416
+ setSaveMessage(void 0);
144417
+ setSaveMessageLoading(false);
144796
144418
  }, 5e3);
144797
144419
  }
144798
- });
144799
- }
144800
- componentDidMount() {
144801
- const updateAlignmentSelection = /* @__PURE__ */ __name((newRangeOrCaret) => {
144802
- this.updateSelectionOrCaret(false, newRangeOrCaret, {
144803
- forceReduxUpdate: true
144804
- });
144805
- }, "updateAlignmentSelection");
144806
- window.updateAlignmentSelection = updateAlignmentSelection;
144807
- if (window.Cypress)
144808
- window.Cypress.updateAlignmentSelection = updateAlignmentSelection;
144420
+ }), "saveAlignment");
144421
+ saveAlignment();
144422
+ }, [
144423
+ alignmentTracks,
144424
+ handleAlignmentSave,
144425
+ pairwiseAlignments,
144426
+ shouldAutosave,
144427
+ stateTrackingId
144428
+ ]);
144429
+ const annotationClicked = /* @__PURE__ */ __name(({
144430
+ event,
144431
+ annotation,
144432
+ gapsBefore = 0,
144433
+ gapsInside = 0
144434
+ }) => {
144435
+ event.preventDefault && event.preventDefault();
144436
+ event.stopPropagation && event.stopPropagation();
144437
+ updateSelectionOrCaret$1(event.shiftKey, __spreadProps(__spreadValues({}, annotation), {
144438
+ start: annotation.start + gapsBefore,
144439
+ end: annotation.end + gapsBefore + gapsInside
144440
+ }));
144441
+ }, "annotationClicked");
144442
+ const getNumBpsShownInLinearView = /* @__PURE__ */ __name(() => {
144443
+ const toReturn = (width - nameDivWidth) / charWidth2;
144444
+ return toReturn || 0;
144445
+ }, "getNumBpsShownInLinearView");
144446
+ const handleScroll = /* @__PURE__ */ __name(() => {
144447
+ if (alignmentHolder.current.scrollTop !== oldAlignmentHolderScrollTop.current) {
144448
+ setTimeout(() => {
144449
+ setVerticalScrollRange();
144450
+ oldAlignmentHolderScrollTop.current = alignmentHolder.current.scrollTop;
144451
+ }, 100);
144452
+ }
144453
+ if (blockScroll.current) {
144454
+ return;
144455
+ }
144456
+ const scrollPercentage = alignmentHolder.current.scrollLeft / (alignmentHolder.current.scrollWidth - alignmentHolder.current.clientWidth);
144457
+ easyStore2.current.percentScrolled = scrollPercentage || 0;
144458
+ if (!isZooming.current) {
144459
+ easyStore2.current.percentScrolledPreZoom = easyStore2.current.percentScrolled;
144460
+ }
144461
+ if (alignmentHolderTop.current) {
144462
+ alignmentHolderTop.current.scrollLeft = alignmentHolder.current.scrollLeft;
144463
+ }
144464
+ updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144465
+ }, "handleScroll");
144466
+ const handleTopScroll = /* @__PURE__ */ __name(() => {
144467
+ alignmentHolder.current.scrollLeft = alignmentHolderTop.current.scrollLeft;
144468
+ }, "handleTopScroll");
144469
+ const onMinimapSizeAdjust = /* @__PURE__ */ __name((newSliderSize, newPercent) => {
144470
+ const percentageOfSpace = newSliderSize / width;
144471
+ const seqLength = getSequenceLength();
144472
+ const numBpsInView = seqLength * percentageOfSpace;
144473
+ const newCharWidth = (width - nameDivWidth) / numBpsInView;
144474
+ blockScroll.current = true;
144475
+ setCharWidthInLinearView({ charWidthInLinearView: newCharWidth });
144809
144476
  setTimeout(() => {
144477
+ scrollAlignmentToPercent(newPercent);
144478
+ blockScroll.current = false;
144810
144479
  updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144811
- }, 0);
144812
- setTimeout(() => {
144813
- this.setVerticalScrollRange();
144814
- }, 500);
144815
- }
144816
- render() {
144817
- const charWidthInLinearView = this.getCharWidthInLinearView();
144818
- const {
144819
- alignmentTracks = [],
144820
- height: height2,
144821
- minimapLaneHeight,
144822
- minimapLaneSpacing,
144823
- isInPairwiseOverviewView,
144824
- isPairwise,
144825
- currentPairwiseAlignmentIndex,
144826
- hasTemplate,
144827
- noVisibilityOptions,
144828
- updateAlignmentSortOrder,
144829
- alignmentSortOrder,
144830
- handleBackButtonClicked,
144831
- noClickDragHandlers,
144832
- upsertAlignmentRun: upsertAlignmentRun2,
144833
- alignmentId,
144834
- allowTrimming,
144835
- additionalSelectionLayerRightClickedOptions,
144836
- selectionLayerRightClicked,
144837
- additionalTopEl,
144838
- additionalTopLeftEl,
144839
- handleAlignmentRename,
144840
- alignmentVisibilityToolOptions
144841
- } = this.props;
144842
- const sequenceLength = this.getMaxLength();
144843
- if (!alignmentTracks || !alignmentTracks[0] || !alignmentTracks[0].alignmentData) {
144844
- console.error("corrupted data!", this.props);
144845
- return "corrupted data!";
144846
- }
144847
- const getTrackVis = /* @__PURE__ */ __name((alignmentTracks2, isTemplate, allTracks) => {
144848
- const rowData = {};
144849
- const innerTrackVis = /* @__PURE__ */ __name((drop_provided, drop_snapshot) => {
144850
- return /* @__PURE__ */ React$2.createElement(
144851
- "div",
144852
- {
144853
- className: "alignmentTracks ",
144854
- style: {
144855
- overflowY: "auto",
144856
- display: "flex",
144857
- zIndex: 10
144858
- }
144859
- },
144860
- /* @__PURE__ */ React$2.createElement(
144861
- "div",
144862
- {
144863
- style: {
144864
- overflowX: "auto",
144865
- width: this.state.width
144866
- },
144867
- ref: (ref2) => {
144868
- this[isTemplate ? "alignmentHolderTop" : "alignmentHolder"] = ref2;
144869
- },
144870
- onContextMenu: (e2) => {
144871
- if (!allowTrimming || isTargetWithinEl(e2, ".alignmentTrackName")) {
144872
- return;
144873
- }
144874
- this.getTrackTrimmingOptions({
144875
- e: e2,
144876
- allTracks,
144877
- upsertAlignmentRun: upsertAlignmentRun2,
144878
- alignmentId,
144879
- currentPairwiseAlignmentIndex
144880
- });
144881
- },
144882
- onMouseLeave: this.removeMinimapHighlightForMouseLeave,
144883
- onMouseMove: this.updateMinimapHighlightForMouseMove,
144884
- dataname: "scrollGroup",
144885
- className: "alignmentHolder",
144886
- onScroll: isTemplate ? this.handleTopScroll : this.handleScroll
144887
- },
144888
- /* @__PURE__ */ React$2.createElement(
144889
- ReactDraggable,
144890
- {
144891
- disabled: this.state.isTrackDragging,
144892
- bounds: { top: 0, left: 0, right: 0, bottom: 0 },
144893
- onDrag: noClickDragHandlers ? noop$7 : (event) => {
144894
- if (this.state.isTrackDragging)
144895
- return;
144896
- this.getNearestCursorPositionToMouseEvent(
144897
- rowData,
144898
- event,
144899
- editorDragged
144900
- );
144901
- },
144902
- onStart: noClickDragHandlers ? noop$7 : (event) => {
144903
- if (isTargetWithinEl(event, ".alignmentTrackName")) {
144904
- return this.setState({ isTrackDragging: true });
144905
- }
144906
- if (this.state.isTrackDragging)
144907
- return;
144908
- this.getNearestCursorPositionToMouseEvent(
144909
- rowData,
144910
- event,
144911
- editorDragStarted
144912
- );
144913
- },
144914
- onStop: noClickDragHandlers ? noop$7 : (...args) => {
144915
- setTimeout(() => {
144916
- this.setState({ isTrackDragging: false });
144917
- }, 0);
144918
- editorDragStopped(...args);
144919
- }
144920
- },
144921
- /* @__PURE__ */ React$2.createElement(
144922
- "div",
144923
- {
144924
- ref: (ref2) => this.veTracksAndAlignmentHolder = ref2,
144925
- className: classNames("veTracksAndAlignmentHolder", {
144926
- isTrackDragging: this.state.isTrackDragging
144927
- }),
144928
- onClick: noClickDragHandlers ? noop$7 : (event) => {
144929
- if (this.state.isTrackDragging)
144930
- return;
144931
- if (isTargetWithinEl(event, ".alignmentTrackName")) {
144932
- return;
144933
- }
144934
- this.getNearestCursorPositionToMouseEvent(
144935
- rowData,
144936
- event,
144937
- editorClicked
144938
- );
144939
- }
144940
- },
144941
- /* @__PURE__ */ React$2.createElement(
144942
- PerformantSelectionLayer,
144943
- {
144944
- leftMargin: this.state.nameDivWidth,
144945
- className: "veAlignmentSelectionLayer",
144946
- isDraggable: true,
144947
- selectionLayerRightClicked: selectionLayerRightClicked ? (...args) => {
144948
- selectionLayerRightClicked(...args, this.props);
144949
- } : (...args) => {
144950
- const { event } = args[0];
144951
- const track2 = getTrackFromEvent(event, allTracks);
144952
- const alignmentData = track2.alignmentData;
144953
- const { name: name2 } = alignmentData;
144954
- const copySpecificAlignmentFasta = /* @__PURE__ */ __name(() => __async(this, null, function* () {
144955
- const { selectionLayer: selectionLayer2 } = this.props.store.getState().VectorEditor.__allEditorsOptions.alignments[this.props.id] || {};
144956
- const seqDataToCopy = getSequenceDataBetweenRange(
144957
- alignmentData,
144958
- selectionLayer2
144959
- ).sequence;
144960
- const seqDataToCopyAsFasta = `>${name2}\r
144961
- ${seqDataToCopy}\r
144962
- `;
144963
- yield navigator.clipboard.writeText(
144964
- seqDataToCopyAsFasta
144965
- );
144966
- }), "copySpecificAlignmentFasta");
144967
- const copySpecificAlignment = /* @__PURE__ */ __name(() => __async(this, null, function* () {
144968
- const { selectionLayer: selectionLayer2 } = this.props.store.getState().VectorEditor.__allEditorsOptions.alignments[this.props.id] || {};
144969
- const seqDataToCopy = getSequenceDataBetweenRange(
144970
- alignmentData,
144971
- selectionLayer2
144972
- ).sequence;
144973
- yield navigator.clipboard.writeText(
144974
- seqDataToCopy
144975
- );
144976
- }), "copySpecificAlignment");
144977
- const getAllAlignmentsFastaText = /* @__PURE__ */ __name(() => __async(this, null, function* () {
144978
- yield navigator.clipboard.writeText(
144979
- this.getAllAlignmentsFastaText()
144980
- );
144981
- }), "getAllAlignmentsFastaText");
144982
- showContextMenu(
144983
- [
144984
- ...additionalSelectionLayerRightClickedOptions ? additionalSelectionLayerRightClickedOptions(
144985
- ...args,
144986
- this.props
144987
- ) : [],
144988
- {
144989
- text: "Copy Selection of All Alignments as Fasta",
144990
- className: "copyAllAlignmentsFastaClipboardHelper",
144991
- hotkey: "cmd+c",
144992
- onClick: () => {
144993
- getAllAlignmentsFastaText();
144994
- window.toastr.success("Selection Copied");
144995
- }
144996
- },
144997
- {
144998
- text: `Copy Selection of ${name2} as Fasta`,
144999
- className: "copySpecificAlignmentFastaClipboardHelper",
145000
- onClick: () => {
145001
- copySpecificAlignmentFasta();
145002
- window.toastr.success(
145003
- "Selection Copied As Fasta"
145004
- );
145005
- }
145006
- },
145007
- {
145008
- text: `Copy Selection of ${name2}`,
145009
- className: "copySpecificAlignmentAsPlainClipboardHelper",
145010
- onClick: () => {
145011
- copySpecificAlignment();
145012
- window.toastr.success("Selection Copied");
145013
- }
145014
- }
145015
- ],
145016
- void 0,
145017
- event
145018
- );
145019
- },
145020
- easyStore: this.easyStore,
145021
- sequenceLength,
145022
- charWidth: this.getCharWidthInLinearView(),
145023
- row: { start: 0, end: sequenceLength - 1 }
145024
- }
145025
- ),
145026
- /* @__PURE__ */ React$2.createElement(
145027
- PerformantCaret,
145028
- {
145029
- leftMargin: this.state.nameDivWidth,
145030
- className: "veAlignmentSelectionLayer",
145031
- isDraggable: true,
145032
- sequenceLength,
145033
- charWidth: this.getCharWidthInLinearView(),
145034
- row: { start: 0, end: sequenceLength - 1 },
145035
- easyStore: this.easyStore
145036
- }
145037
- ),
145038
- isTemplate ? this.renderItem(0, 0, isTemplate) : /* @__PURE__ */ React$2.createElement(
145039
- ReactList,
145040
- {
145041
- ref: (c2) => {
145042
- this.InfiniteScroller = c2;
145043
- const domNode = ReactDOM$1.findDOMNode(c2);
145044
- if (domNode instanceof HTMLElement) {
145045
- drop_provided.innerRef(domNode);
145046
- }
145047
- },
145048
- type: "variable",
145049
- itemSizeEstimator: this.estimateRowHeight,
145050
- itemRenderer: this.renderItem,
145051
- length: alignmentTracks2.length + (drop_snapshot.isUsingPlaceholder ? 1 : 0)
145052
- }
145053
- )
145054
- )
145055
- )
145056
- )
145057
- );
145058
- }, "innerTrackVis");
145059
- if (isTemplate)
145060
- return innerTrackVis();
145061
- else
145062
- return /* @__PURE__ */ React$2.createElement(
145063
- ConnectedDroppable$1,
145064
- {
145065
- mode: "virtual",
145066
- renderClone: (provided, snapshot, { source: { index: index2 } }) => {
145067
- return this.renderItem(index2, index2, false, {
145068
- provided,
145069
- snapshot
145070
- });
145071
- },
145072
- direction: "vertical",
145073
- droppableId: "droppable" + isTemplate ? "_no_drop" : ""
145074
- },
145075
- innerTrackVis
145076
- );
145077
- }, "getTrackVis");
145078
- const [firstTrack, ...otherTracks] = alignmentTracks;
145079
- const totalWidthOfMinimap = this.state.width;
145080
- const totalWidthInAlignmentView = 14 * this.getSequenceLength();
145081
- const minSliderSize = Math.min(
145082
- totalWidthOfMinimap * (totalWidthOfMinimap / totalWidthInAlignmentView),
145083
- totalWidthOfMinimap
144480
+ });
144481
+ }, "onMinimapSizeAdjust");
144482
+ const setCharWidthInLinearView = /* @__PURE__ */ __name(({ charWidthInLinearView: charWidthInLinearView2 }) => {
144483
+ window.localStorage.setItem(
144484
+ "charWidthInLinearViewDefault",
144485
+ charWidthInLinearView2
145084
144486
  );
145085
- const viewportHeight = Math.max(
145086
- document.documentElement.clientHeight,
145087
- window.innerHeight || 0
144487
+ _setCharWidthInLinearView(charWidthInLinearView2);
144488
+ charWidthInLinearViewDefault = JSON.parse(
144489
+ window.localStorage.getItem("charWidthInLinearViewDefault")
145088
144490
  );
145089
- const pinchHandler = {
145090
- onPinch: ({ delta: [d2] }) => {
145091
- this.bindOutsideChangeHelper.triggerChange(({ value, changeValue }) => {
145092
- if (d2 > 0) {
145093
- if (value > 8) {
145094
- changeValue(value + 0.4);
145095
- } else {
145096
- changeValue(value + 0.2);
145097
- }
145098
- } else if (d2 < 0) {
145099
- if (value > 8) {
145100
- changeValue(value - 0.4);
145101
- } else {
145102
- changeValue(value - 0.2);
145103
- }
145104
- }
145105
- });
145106
- updateLabelsForInViewFeatures();
145107
- }
145108
- };
145109
- return /* @__PURE__ */ React$2.createElement(PinchHelper, __spreadValues({}, pinchHandler), /* @__PURE__ */ React$2.createElement(core.ResizeSensor, { onResize: this.handleResize }, /* @__PURE__ */ React$2.createElement(
145110
- "div",
145111
- {
145112
- style: __spreadValues({
145113
- height: height2 || (isPairwise ? "auto" : viewportHeight * 0.88),
145114
- display: "flex",
145115
- flexDirection: "column",
145116
- justifyContent: "space-between",
145117
- position: "relative",
145118
- overflowY: "auto"
145119
- }, this.props.style),
145120
- className: "alignmentView"
145121
- },
145122
- /* @__PURE__ */ React$2.createElement(
145123
- DragDropContext,
145124
- {
145125
- onDragStart: this.onTrackDragStart,
145126
- onDragEnd: this.onTrackDragEnd
145127
- },
144491
+ }, "setCharWidthInLinearView");
144492
+ const scrollToCaret2 = /* @__PURE__ */ __name(() => {
144493
+ let el = window.document.querySelector(".veCaret:not(.zoomSelection)");
144494
+ if (!el) {
144495
+ el = window.document.querySelector(".veCaret");
144496
+ }
144497
+ if (!el) {
144498
+ return;
144499
+ }
144500
+ el.scrollIntoView({ inline: "center", block: "nearest" });
144501
+ }, "scrollToCaret");
144502
+ const scrollYToTrack = /* @__PURE__ */ __name((trackIndex) => {
144503
+ InfiniteScroller.current.scrollTo(trackIndex);
144504
+ }, "scrollYToTrack");
144505
+ const estimateRowHeight = /* @__PURE__ */ __name((index2, cache2) => {
144506
+ const track2 = alignmentTracks[index2];
144507
+ if (!track2)
144508
+ return 100;
144509
+ const { sequenceData: sequenceData22 } = track2;
144510
+ rowData.current = prepareRowData(
144511
+ sequenceData22,
144512
+ sequenceData22.sequence.length
144513
+ );
144514
+ return _estimateRowHeight({
144515
+ index: index2,
144516
+ cache: cache2,
144517
+ row: rowData.current[index2],
144518
+ annotationVisibility: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
144519
+ annotationLabelVisibility: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility
144520
+ });
144521
+ }, "estimateRowHeight");
144522
+ const renderItem = /* @__PURE__ */ __name((_i, key, isTemplate, cloneProps) => {
144523
+ const isDragDisabled = !allowTrackRearrange || isPairwise;
144524
+ let i;
144525
+ if (isTemplate) {
144526
+ i = _i;
144527
+ } else if (hasTemplate) {
144528
+ i = _i + 1;
144529
+ } else {
144530
+ i = _i;
144531
+ }
144532
+ const track2 = alignmentTracks == null ? void 0 : alignmentTracks[i];
144533
+ if (!track2)
144534
+ return null;
144535
+ const {
144536
+ sequenceData: sequenceData22,
144537
+ alignmentData,
144538
+ isReversed,
144539
+ wasTrimmed,
144540
+ additionalSelectionLayers,
144541
+ chromatogramData
144542
+ // mismatches
144543
+ } = track2;
144544
+ const seqLen = maxLength;
144545
+ const trimmedRangesToDisplay = getTrimmedRangesToDisplay({
144546
+ seqLen,
144547
+ trimmedRange: alignmentData == null ? void 0 : alignmentData.trimmedRange
144548
+ });
144549
+ const linearViewWidth = (alignmentData || sequenceData22).sequence.length * charWidth2;
144550
+ const name2 = sequenceData22.name || sequenceData22.id;
144551
+ const tickSpacing = massageTickSpacing(Math.ceil(120 / charWidth2));
144552
+ const { compactNames } = alignmentVisibilityToolOptions.alignmentAnnotationVisibility;
144553
+ const selectionLayer22 = [
144554
+ tempTrimBefore[i] || trimmedRangesToDisplay[0],
144555
+ tempTrimAfter[i] || trimmedRangesToDisplay[1]
144556
+ ].filter((i2) => i2).map((i2) => __spreadProps(__spreadValues({}, i2), {
144557
+ hideCarets: true,
144558
+ ignoreGaps: true,
144559
+ className: "tg-trimmed-region",
144560
+ color: "gray"
144561
+ }));
144562
+ const innerRenderItem = /* @__PURE__ */ __name((provided = {}, snapshot) => {
144563
+ var _a3;
144564
+ return /* @__PURE__ */ React$2.createElement(
144565
+ "div",
144566
+ __spreadProps(__spreadValues({
144567
+ ref: provided == null ? void 0 : provided.innerRef
144568
+ }, provided == null ? void 0 : provided.draggableProps), {
144569
+ className: classNames("alignmentViewTrackContainer", {
144570
+ isDragDisabled
144571
+ }),
144572
+ "data-alignment-track-index": i,
144573
+ style: __spreadValues(__spreadValues({
144574
+ boxShadow: isTemplate ? "red 0px -1px 0px 0px inset, red 0px 1px 0px 0px inset" : "0px -1px 0px 0px inset",
144575
+ display: "flex"
144576
+ }, (_a3 = provided == null ? void 0 : provided.draggableProps) == null ? void 0 : _a3.style), (snapshot == null ? void 0 : snapshot.isDragging) && { left: unset }),
144577
+ key: i
144578
+ }),
145128
144579
  /* @__PURE__ */ React$2.createElement(
145129
144580
  "div",
145130
144581
  {
144582
+ className: "alignmentTrackName",
145131
144583
  style: {
145132
- display: "flex",
145133
- flexDirection: "column",
145134
- position: "relative",
145135
- overflowY: "auto"
144584
+ position: "sticky",
144585
+ left: 0,
144586
+ zIndex: 10,
144587
+ borderBottom: `1px solid ${isTemplate ? "red" : "lightgray"}`,
144588
+ borderRight: `1px solid ${isTemplate ? "red" : "lightgray"}`,
144589
+ width: nameDivWidth - 3,
144590
+ padding: 2,
144591
+ marginRight: 3,
144592
+ paddingBottom: 0,
144593
+ minWidth: nameDivWidth - 3,
144594
+ overflow: "hidden",
144595
+ scrollbarWidth: "none",
144596
+ whiteSpace: "nowrap"
145136
144597
  },
145137
- className: "alignmentView-top-container"
144598
+ "data-title": name2,
144599
+ key: i
145138
144600
  },
145139
144601
  /* @__PURE__ */ React$2.createElement(
145140
144602
  "div",
145141
- {
145142
- style: {
145143
- paddingTop: "3px",
145144
- paddingBottom: "5px",
145145
- borderBottom: "1px solid",
144603
+ __spreadProps(__spreadValues({}, provided == null ? void 0 : provided.dragHandleProps), {
144604
+ style: __spreadProps(__spreadValues({}, compactNames && {
145146
144605
  display: "flex",
145147
- minHeight: "32px",
145148
- width: "100%",
145149
- flexWrap: "nowrap",
145150
- flexDirection: "row",
145151
- flex: "0 0 auto"
145152
- },
145153
- className: "ve-alignment-top-bar"
145154
- },
145155
- additionalTopLeftEl,
145156
- handleBackButtonClicked && /* @__PURE__ */ React$2.createElement(core.Tooltip, { content: "Back to Pairwise Alignment Overview" }, /* @__PURE__ */ React$2.createElement(
145157
- core.Button,
145158
- {
145159
- icon: "arrow-left",
145160
- onClick: () => {
145161
- handleBackButtonClicked();
145162
- this.caretPositionUpdate(-1);
145163
- },
145164
- small: true,
145165
- intent: core.Intent.PRIMARY,
145166
- minimal: true,
145167
- style: { marginRight: 10 },
145168
- className: "alignmentViewBackButton"
145169
- }
145170
- )),
145171
- /* @__PURE__ */ React$2.createElement("div", { style: { display: "flex" } }, /* @__PURE__ */ React$2.createElement(
145172
- core.EditableText,
145173
- {
145174
- disabled: !handleAlignmentRename,
145175
- onChange: (v2) => {
145176
- this.setState({
145177
- alignmentName: v2
145178
- });
145179
- },
145180
- maxLength: 399,
145181
- value: this.state.alignmentName,
145182
- onConfirm: (v2) => __async(this, null, function* () {
145183
- if (!v2) {
145184
- this.setState({
145185
- alignmentName: this.props.alignmentName
145186
- });
145187
- return;
145188
- }
145189
- if (v2 === this.props.alignmentName) {
145190
- return;
145191
- }
145192
- this.setState({ saveMessage: "Alignment Renaming.." });
145193
- this.setState({ saveMessageLoading: true });
145194
- yield handleAlignmentRename(v2, this.props);
145195
- this.setState({ saveMessage: "Rename Successful" });
145196
- this.setState({ saveMessageLoading: false });
145197
- setTimeout(() => {
145198
- this.setState({ saveMessage: void 0 });
145199
- this.setState({ saveMessageLoading: false });
145200
- }, 5e3);
145201
- }),
145202
- selectAllOnFocus: true,
145203
- className: "veAlignmentName"
145204
- }
145205
- ), "   ", /* @__PURE__ */ React$2.createElement(
144606
+ alignItems: "flex-start"
144607
+ }), {
144608
+ cursor: !isPairwise && allowTrackRearrange && !isTemplate ? "move" : ""
144609
+ })
144610
+ }),
144611
+ /* @__PURE__ */ React$2.createElement(
145206
144612
  "div",
145207
144613
  {
145208
- className: "veAlignmentType",
145209
- style: {
145210
- paddingTop: "3px",
145211
- fontSize: "14px",
145212
- color: "grey",
145213
- maxWidth: "300px",
145214
- overflow: "hidden",
145215
- textOverflow: "ellipsis",
145216
- whiteSpace: "nowrap"
145217
- },
145218
- "data-title": this.props.alignmentType || "Unknown Alignment Type"
144614
+ className: "alignmentTrackNameDiv",
144615
+ style: __spreadValues({
144616
+ background: "#3FA6DA",
144617
+ display: "inline-block",
144618
+ color: "white",
144619
+ borderRadius: 5,
144620
+ paddingRight: 5
144621
+ }, compactNames && {
144622
+ marginRight: 5
144623
+ })
145219
144624
  },
145220
- this.props.alignmentType || "Unknown Alignment Type"
145221
- )),
145222
- this.props.unmappedSeqs && /* @__PURE__ */ React$2.createElement(
145223
- InfoHelper,
145224
- {
145225
- size: 20,
145226
- content: /* @__PURE__ */ React$2.createElement("div", null, "This alignment had sequences that did not map to the template sequence:", this.props.unmappedSeqs.map(
145227
- ({ sequenceData: sequenceData2 }, i) => /* @__PURE__ */ React$2.createElement("div", { key: i }, sequenceData2.name)
145228
- )),
145229
- intent: "warning",
145230
- icon: "warning-sign"
145231
- }
145232
- ),
145233
- !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
145234
- UncontrolledSliderWithPlusMinusBtns,
145235
- {
145236
- noWraparound: true,
145237
- bindOutsideChangeHelper: this.bindOutsideChangeHelper,
145238
- onClick: () => {
145239
- setTimeout(this.scrollToCaret, 0);
145240
- },
145241
- minCharWidth: this.getMinCharWidth(),
145242
- onChange: (zoomLvl) => __async(this, null, function* () {
145243
- this.isZooming = true;
145244
- setTimeout(() => {
145245
- this.isZooming = false;
145246
- }, 10);
145247
- const minCharWidth = this.getMinCharWidth();
145248
- const scaleFactor = Math.pow(12 / minCharWidth, 1 / 10);
145249
- const newCharWidth = minCharWidth * Math.pow(scaleFactor, zoomLvl);
145250
- yield this.setCharWidthInLinearView({
145251
- charWidthInLinearView: newCharWidth
145252
- });
145253
- yield this.scrollToCaret();
145254
- yield updateLabelsForInViewFeatures({
145255
- rectElement: ".alignmentHolder"
145256
- });
145257
- }),
145258
- coerceInitialValue,
145259
- title: "Adjust Zoom Level",
145260
- style: { paddingTop: "4px", width: 100 },
145261
- className: "veZoomAlignmentSlider ove-slider",
145262
- labelRenderer: false,
145263
- initialValue: charWidthInLinearView,
145264
- stepSize: 0.05,
145265
- max: 10,
145266
- min: 0,
145267
- clickStepSize: 0.5
145268
- }
145269
- ),
145270
- !noVisibilityOptions && !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
145271
- AlignmentVisibilityTool,
145272
- __spreadValues({
145273
- currentPairwiseAlignmentIndex
145274
- }, alignmentVisibilityToolOptions)
145275
- ),
145276
- updateAlignmentSortOrder && !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
145277
- core.Popover,
145278
- {
145279
- minimal: true,
145280
- content: /* @__PURE__ */ React$2.createElement(core.Menu, null, /* @__PURE__ */ React$2.createElement(
145281
- core.MenuItem,
145282
- {
145283
- active: true,
145284
- onClick: () => {
145285
- updateAlignmentSortOrder("Position");
145286
- },
145287
- text: "Position"
145288
- }
145289
- ), /* @__PURE__ */ React$2.createElement(
145290
- core.MenuItem,
145291
- {
145292
- active: alignmentSortOrder,
145293
- onClick: () => {
145294
- updateAlignmentSortOrder("Alphabetical");
145295
- },
145296
- text: "Alphabetical"
145297
- }
145298
- )),
145299
- target: /* @__PURE__ */ React$2.createElement(
145300
- core.Button,
145301
- {
145302
- small: true,
145303
- text: "Sort Order",
145304
- rightIcon: "caret-down",
145305
- icon: "sort"
145306
- }
145307
- )
145308
- }
144625
+ allowTrackNameEdit && /* @__PURE__ */ React$2.createElement(
144626
+ core.Button,
144627
+ {
144628
+ onClick: () => {
144629
+ showDialog({
144630
+ ModalComponent: EditTrackNameDialog,
144631
+ props: {
144632
+ initialValues: {
144633
+ name: name2
144634
+ },
144635
+ updateName: ({ newName }) => {
144636
+ updateTrackHelper({
144637
+ currentPairwiseAlignmentIndex,
144638
+ pairwiseAlignments,
144639
+ upsertAlignmentRun: upsertAlignmentRun2,
144640
+ alignmentId,
144641
+ alignmentTracks: alignmentTracks || [],
144642
+ alignmentTrackIndex: i,
144643
+ update: { name: newName }
144644
+ });
144645
+ }
144646
+ }
144647
+ });
144648
+ },
144649
+ small: true,
144650
+ "data-tip": "Edit Track Name",
144651
+ className: "edit-track-name-btn",
144652
+ icon: /* @__PURE__ */ React$2.createElement(core.Icon, { size: 12, color: "lightgrey", icon: "edit" }),
144653
+ minimal: true
144654
+ }
144655
+ ),
144656
+ sequenceData22.seqLink && /* @__PURE__ */ React$2.createElement(
144657
+ core.AnchorButton,
144658
+ {
144659
+ href: sequenceData22.seqLink,
144660
+ "data-tip": sequenceData22.seqLinkTooltip,
144661
+ target: "_blank",
144662
+ small: true,
144663
+ icon: /* @__PURE__ */ React$2.createElement(core.Icon, { size: 12, color: "white", icon: "document-open" }),
144664
+ minimal: true
144665
+ }
144666
+ ),
144667
+ name2
145309
144668
  ),
145310
- additionalTopEl,
145311
- this.state.saveMessage && /* @__PURE__ */ React$2.createElement(
145312
- "div",
144669
+ /* @__PURE__ */ React$2.createElement("div", { style: { fontSize: 10, marginTop: 2, marginBottom: 2 } }, isReversed && /* @__PURE__ */ React$2.createElement(
144670
+ "span",
145313
144671
  {
145314
- className: "ove-menu-toast",
145315
144672
  style: {
145316
- display: "flex",
145317
- alignItems: "center",
145318
- marginLeft: "auto",
145319
- marginRight: 10
145320
- }
144673
+ backgroundColor: isReversed ? "#E76A6E" : "#4C90F0",
144674
+ padding: 2,
144675
+ paddingLeft: 4,
144676
+ color: "white",
144677
+ marginRight: 2,
144678
+ borderRadius: "5px"
144679
+ },
144680
+ "data-tip": isReversed ? "The alignment algorithm matched the reverse complement of this input sequence" : "The original sequence was NOT reversed complemented by the alignment algorithm"
145321
144681
  },
145322
- this.state.saveMessageLoading ? /* @__PURE__ */ React$2.createElement("div", null, /* @__PURE__ */ React$2.createElement(core.Spinner, { size: 15 })) : /* @__PURE__ */ React$2.createElement(core.Icon, { icon: "tick-circle", intent: "success" }),
145323
- " ",
145324
- " ",
145325
- this.state.saveMessage
145326
- )
145327
- ),
145328
- hasTemplate ? /* @__PURE__ */ React$2.createElement(React$2.Fragment, null, /* @__PURE__ */ React$2.createElement("div", { className: "alignmentTrackFixedToTop" }, getTrackVis([firstTrack], true, alignmentTracks)), getTrackVis(otherTracks, false, alignmentTracks)) : getTrackVis(alignmentTracks, false, alignmentTracks)
145329
- )
145330
- ),
145331
- !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
145332
- "div",
145333
- {
145334
- className: "alignmentViewBottomBar",
145335
- style: {
145336
- // flexGrow: 1,
145337
- // minHeight: "-webkit-min-content", //https://stackoverflow.com/questions/28029736/how-to-prevent-a-flex-item-from-shrinking-smaller-than-its-content
145338
- maxHeight: 210,
145339
- marginTop: 4,
145340
- paddingTop: 4,
145341
- borderTop: "1px solid lightgrey",
145342
- display: "flex"
145343
- }
145344
- },
145345
- /* @__PURE__ */ React$2.createElement(
145346
- Minimap,
145347
- __spreadProps(__spreadValues({}, {
145348
- selectionLayerComp: /* @__PURE__ */ React$2.createElement(React$2.Fragment, null, /* @__PURE__ */ React$2.createElement(
145349
- PerformantSelectionLayer,
145350
- {
145351
- is: true,
145352
- hideCarets: true,
145353
- className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
145354
- easyStore: this.easyStore,
145355
- sequenceLength,
145356
- charWidth: this.getMinCharWidth(true),
145357
- row: { start: 0, end: sequenceLength - 1 }
145358
- }
145359
- ), /* @__PURE__ */ React$2.createElement(
145360
- PerformantCaret,
144682
+ isReversed ? "REV" : "FWD",
144683
+ " "
144684
+ ), wasTrimmed && /* @__PURE__ */ React$2.createElement(
144685
+ "span",
145361
144686
  {
145362
144687
  style: {
145363
- opacity: 0.2
144688
+ backgroundColor: "#13C9BA",
144689
+ padding: 2,
144690
+ paddingLeft: 4,
144691
+ color: "white",
144692
+ marginRight: 2,
144693
+ borderRadius: "5px"
145364
144694
  },
145365
- className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
145366
- sequenceLength,
145367
- charWidth: this.getMinCharWidth(true),
145368
- row: { start: 0, end: sequenceLength - 1 },
145369
- easyStore: this.easyStore
144695
+ "data-tip": "This sequence was trimmed and resubmitted for alignment"
144696
+ },
144697
+ "TRIMMED"
144698
+ ), sequenceData22.sequence.length, " bps")
144699
+ ),
144700
+ /* @__PURE__ */ React$2.createElement(
144701
+ HorizontalPanelDragHandle,
144702
+ {
144703
+ onDrag: ({ dx }) => {
144704
+ setNameDivWidth(Math.min(nameDivWidth - dx, width - 20));
145370
144705
  }
145371
- )),
145372
- alignmentTracks,
144706
+ }
144707
+ )
144708
+ ),
144709
+ handleSelectTrack && !isTemplate && /* @__PURE__ */ React$2.createElement(
144710
+ "div",
144711
+ {
144712
+ onClick: () => {
144713
+ handleSelectTrack(i);
144714
+ },
144715
+ style: {
144716
+ position: "absolute",
144717
+ opacity: 0,
144718
+ height: "100%",
144719
+ left: nameDivWidth,
144720
+ width: linearViewWidth,
144721
+ fontWeight: "bolder",
144722
+ cursor: "pointer",
144723
+ padding: 5,
144724
+ textAlign: "center",
144725
+ zIndex: 400
144726
+ },
144727
+ className: "alignmentViewSelectTrackPopover veWhiteBackground"
144728
+ },
144729
+ "Inspect track"
144730
+ ),
144731
+ /* @__PURE__ */ React$2.createElement(
144732
+ NonReduxEnhancedLinearView,
144733
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
144734
+ caretPosition: tempTrimmingCaret[i] || -1,
144735
+ selectionLayer: selectionLayer22,
144736
+ isInAlignment: true,
144737
+ annotationVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
144738
+ linearViewAnnotationLabelVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility,
144739
+ marginWith: 0,
144740
+ orfClicked: annotationClicked,
144741
+ primerClicked: annotationClicked,
144742
+ translationClicked: annotationClicked,
144743
+ cutsiteClicked: annotationClicked,
144744
+ translationDoubleClicked: annotationClicked,
144745
+ deletionLayerClicked: annotationClicked,
144746
+ replacementLayerClicked: annotationClicked,
144747
+ featureClicked: annotationClicked,
144748
+ partClicked: annotationClicked,
144749
+ searchLayerClicked: annotationClicked,
144750
+ editorDragStarted: noop$7,
144751
+ editorDragStopped: noop$7,
144752
+ editorDragged: noop$7,
144753
+ hideName: true,
144754
+ sequenceData: sequenceData22,
144755
+ tickSpacing,
144756
+ allowSeqDataOverride: true,
144757
+ editorName: `${isTemplate ? "template_" : ""}alignmentView${i}`,
144758
+ alignmentData,
144759
+ chromatogramData,
144760
+ height: "100%",
144761
+ vectorInteractionWrapperStyle: {
144762
+ overflowY: "hidden"
144763
+ },
144764
+ withZoomLinearView: false,
144765
+ marginWidth: 0,
144766
+ linearViewCharWidth: charWidth2,
144767
+ ignoreGapsOnHighlight: true
144768
+ }), linearViewOptions && (isFunction$7(linearViewOptions) ? linearViewOptions({
144769
+ index: i,
144770
+ isTemplate,
144771
+ alignmentVisibilityToolOptions,
144772
+ sequenceData: sequenceData22,
144773
+ alignmentData,
144774
+ chromatogramData
144775
+ }) : linearViewOptions)), {
144776
+ additionalSelectionLayers,
145373
144777
  dimensions: {
145374
- width: Math.max(this.state.width, 10) || 10
144778
+ width: linearViewWidth
145375
144779
  },
145376
- nameDivOffsetPercent: 0,
145377
- // this.state.nameDivWidth / this.getMaxLinearViewWidth(),
145378
- scrollYToTrack: this.scrollYToTrack,
145379
- onSizeAdjust: this.onMinimapSizeAdjust,
145380
- minSliderSize,
145381
- laneHeight: minimapLaneHeight || (alignmentTracks.length > 5 ? 10 : 17),
145382
- laneSpacing: minimapLaneSpacing || (alignmentTracks.length > 5 ? 2 : 1),
145383
- easyStore: this.easyStore,
145384
- numBpsShownInLinearView: this.getNumBpsShownInLinearView(),
145385
- scrollAlignmentView: this.state.scrollAlignmentView
145386
- }), {
145387
- onMinimapScrollX: this.scrollAlignmentToPercent
144780
+ width: linearViewWidth,
144781
+ paddingBottom: 5,
144782
+ scrollDataPassed: easyStore2.current
145388
144783
  })
145389
144784
  )
145390
- ),
145391
- /* @__PURE__ */ React$2.createElement(
145392
- GlobalDialog,
145393
- null
144785
+ );
144786
+ }, "innerRenderItem");
144787
+ if (isTemplate)
144788
+ return innerRenderItem();
144789
+ if (cloneProps)
144790
+ return innerRenderItem(cloneProps.provided, cloneProps.snapshot);
144791
+ const idToUse = alignmentData.id || sequenceData22.id || i + "_index_id";
144792
+ return /* @__PURE__ */ React$2.createElement(
144793
+ PublicDraggable,
144794
+ {
144795
+ key: idToUse.toString(),
144796
+ index: i,
144797
+ isDragDisabled,
144798
+ draggableId: idToUse.toString()
144799
+ },
144800
+ innerRenderItem
144801
+ );
144802
+ }, "renderItem");
144803
+ const handleResize = throttle$1(([e2]) => {
144804
+ easyStore2.current.viewportWidth = e2.contentRect.width - nameDivWidth || 400;
144805
+ setWidth(e2.contentRect.width);
144806
+ }, 200);
144807
+ const removeMinimapHighlightForMouseLeave = /* @__PURE__ */ __name(() => {
144808
+ const minimapLaneEl = document.querySelector(`.minimapLane.lane-hovered`);
144809
+ if (!minimapLaneEl)
144810
+ return;
144811
+ minimapLaneEl.classList.remove("lane-hovered");
144812
+ }, "removeMinimapHighlightForMouseLeave");
144813
+ const updateMinimapHighlightForMouseMove = /* @__PURE__ */ __name((event) => {
144814
+ latestMouseY.current = getClientY(event);
144815
+ updateMinimapHighlight();
144816
+ }, "updateMinimapHighlightForMouseMove");
144817
+ const updateMinimapHighlight = /* @__PURE__ */ __name(() => {
144818
+ const rows = document.querySelectorAll(`.alignmentViewTrackContainer`);
144819
+ const rowsLength = document.querySelectorAll(`.minimapLane`).length;
144820
+ if (rowsLength <= 4) {
144821
+ return;
144822
+ }
144823
+ some(rows, (rowDomNode) => {
144824
+ const boundingRowRect = rowDomNode.getBoundingClientRect();
144825
+ if (latestMouseY.current > boundingRowRect.top && latestMouseY.current < boundingRowRect.top + boundingRowRect.height) {
144826
+ const prevMinimapLaneEl = document.querySelector(
144827
+ `.minimapLane.lane-hovered`
144828
+ );
144829
+ if (prevMinimapLaneEl) {
144830
+ prevMinimapLaneEl.classList.remove("lane-hovered");
144831
+ }
144832
+ const i = Number(rowDomNode.getAttribute("data-alignment-track-index"));
144833
+ const minimapLaneEl = document.querySelector(
144834
+ `.minimapLane:nth-child(${i + 1})`
144835
+ );
144836
+ if (!minimapLaneEl)
144837
+ return;
144838
+ minimapLaneEl.classList.add("lane-hovered");
144839
+ return true;
144840
+ }
144841
+ });
144842
+ }, "updateMinimapHighlight");
144843
+ const onTrackDragStart = /* @__PURE__ */ __name(() => {
144844
+ setIsTrackDragging(true);
144845
+ }, "onTrackDragStart");
144846
+ const onTrackDragEnd = /* @__PURE__ */ __name(({ destination, source }) => {
144847
+ setIsTrackDragging(false);
144848
+ if (!destination) {
144849
+ return;
144850
+ }
144851
+ upsertAlignmentRun2({
144852
+ id: alignmentId,
144853
+ alignmentTracks: array_move(
144854
+ alignmentTracks,
144855
+ source.index,
144856
+ destination.index
145394
144857
  )
145395
- )));
145396
- }
145397
- getTrackTrimmingOptions({
144858
+ });
144859
+ }, "onTrackDragEnd");
144860
+ const getTrackTrimmingOptions = /* @__PURE__ */ __name(({
145398
144861
  e: e2,
145399
144862
  allTracks,
145400
- upsertAlignmentRun: upsertAlignmentRun2,
145401
- currentPairwiseAlignmentIndex,
145402
- alignmentId
145403
- }) {
144863
+ upsertAlignmentRun: upsertAlignmentRun22,
144864
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
144865
+ alignmentId: alignmentId2
144866
+ }) => {
145404
144867
  const track2 = getTrackFromEvent(e2, allTracks);
145405
- this.getNearestCursorPositionToMouseEvent(
145406
- this.rowData,
144868
+ getNearestCursorPositionToMouseEvent2(
144869
+ rowData.current,
145407
144870
  e2,
145408
144871
  ({ nearestCaretPos }) => {
145409
- var _a2, _b2, _c, _d;
145410
- this.setState({
145411
- [`tempTrimmingCaret${track2.index}`]: nearestCaretPos
145412
- });
145413
- const afterDisabled = nearestCaretPos <= ((_a2 = track2.alignmentData.trimmedRange) == null ? void 0 : _a2.start);
144872
+ var _a3, _b2, _c, _d;
144873
+ setTempTrimmingCaret((prev) => __spreadProps(__spreadValues({}, prev), {
144874
+ [track2.index]: nearestCaretPos
144875
+ }));
144876
+ const afterDisabled = nearestCaretPos <= ((_a3 = track2.alignmentData.trimmedRange) == null ? void 0 : _a3.start);
145414
144877
  const beforeDisabled = nearestCaretPos > ((_b2 = track2.alignmentData.trimmedRange) == null ? void 0 : _b2.end);
145415
144878
  showContextMenu(
145416
144879
  [
@@ -145431,28 +144894,25 @@ ${seqDataToCopy}\r
145431
144894
  text: "Ignore Before",
145432
144895
  disabled: beforeDisabled,
145433
144896
  icon: "drawer-left-filled",
145434
- onMouseOver: () => !beforeDisabled && this.setState({
145435
- [`tempTrimBefore${track2.index}`]: {
145436
- start: 0,
145437
- end: nearestCaretPos - 1
145438
- }
145439
- }),
145440
- onMouseLeave: () => this.setState({
145441
- [`tempTrimBefore${track2.index}`]: void 0
145442
- }),
144897
+ onMouseOver: () => !beforeDisabled && setTempTrimBefore((prev) => __spreadProps(__spreadValues({}, prev), {
144898
+ [track2.index]: { start: 0, end: nearestCaretPos - 1 }
144899
+ })),
144900
+ onMouseLeave: () => setTempTrimBefore((prev) => __spreadProps(__spreadValues({}, prev), {
144901
+ [track2.index]: void 0
144902
+ })),
145443
144903
  onClick: () => {
145444
- var _a3;
144904
+ var _a4;
145445
144905
  updateTrackHelper({
145446
- currentPairwiseAlignmentIndex,
145447
- upsertAlignmentRun: upsertAlignmentRun2,
145448
- alignmentId,
144906
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
144907
+ upsertAlignmentRun: upsertAlignmentRun22,
144908
+ alignmentId: alignmentId2,
145449
144909
  alignmentTracks: allTracks,
145450
144910
  alignmentTrackIndex: track2.index,
145451
144911
  hasBeenTrimmed: true,
145452
144912
  update: {
145453
144913
  trimmedRange: {
145454
144914
  start: nearestCaretPos,
145455
- end: ((_a3 = track2.alignmentData.trimmedRange) == null ? void 0 : _a3.end) || this.getMaxLength() - 1
144915
+ end: ((_a4 = track2.alignmentData.trimmedRange) == null ? void 0 : _a4.end) || maxLength - 1
145456
144916
  }
145457
144917
  }
145458
144918
  });
@@ -145462,27 +144922,24 @@ ${seqDataToCopy}\r
145462
144922
  text: "Ignore After",
145463
144923
  disabled: afterDisabled,
145464
144924
  icon: "drawer-right-filled",
145465
- onMouseOver: () => !afterDisabled && this.setState({
145466
- [`tempTrimAfter${track2.index}`]: {
145467
- start: nearestCaretPos,
145468
- end: this.getMaxLength() - 1
145469
- }
145470
- }),
145471
- onMouseLeave: () => this.setState({
145472
- [`tempTrimAfter${track2.index}`]: void 0
145473
- }),
144925
+ onMouseOver: () => !afterDisabled && setTempTrimAfter((prev) => __spreadProps(__spreadValues({}, prev), {
144926
+ [track2.index]: { start: nearestCaretPos, end: maxLength - 1 }
144927
+ })),
144928
+ onMouseLeave: () => setTempTrimAfter((prev) => __spreadProps(__spreadValues({}, prev), {
144929
+ [track2.index]: void 0
144930
+ })),
145474
144931
  onClick: () => {
145475
- var _a3;
144932
+ var _a4;
145476
144933
  updateTrackHelper({
145477
- currentPairwiseAlignmentIndex,
145478
- upsertAlignmentRun: upsertAlignmentRun2,
145479
- alignmentId,
144934
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
144935
+ upsertAlignmentRun: upsertAlignmentRun22,
144936
+ alignmentId: alignmentId2,
145480
144937
  alignmentTracks: allTracks,
145481
144938
  alignmentTrackIndex: track2.index,
145482
144939
  hasBeenTrimmed: true,
145483
144940
  update: {
145484
144941
  trimmedRange: {
145485
- start: ((_a3 = track2.alignmentData.trimmedRange) == null ? void 0 : _a3.start) || 0,
144942
+ start: ((_a4 = track2.alignmentData.trimmedRange) == null ? void 0 : _a4.start) || 0,
145486
144943
  end: nearestCaretPos - 1
145487
144944
  }
145488
144945
  }
@@ -145498,9 +144955,9 @@ ${seqDataToCopy}\r
145498
144955
  icon: "trash",
145499
144956
  onClick: () => {
145500
144957
  updateTrackHelper({
145501
- currentPairwiseAlignmentIndex,
145502
- upsertAlignmentRun: upsertAlignmentRun2,
145503
- alignmentId,
144958
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
144959
+ upsertAlignmentRun: upsertAlignmentRun22,
144960
+ alignmentId: alignmentId2,
145504
144961
  alignmentTracks: allTracks,
145505
144962
  alignmentTrackIndex: track2.index,
145506
144963
  hasBeenTrimmed: false,
@@ -145514,19 +144971,562 @@ ${seqDataToCopy}\r
145514
144971
  void 0,
145515
144972
  e2,
145516
144973
  () => {
145517
- this.setState({
145518
- [`tempTrimmingCaret${track2.index}`]: void 0
145519
- });
144974
+ setTempTrimAfter((prev) => __spreadProps(__spreadValues({}, prev), { [track2.index]: void 0 }));
145520
144975
  }
145521
144976
  );
145522
144977
  }
145523
144978
  );
145524
144979
  e2.preventDefault();
145525
144980
  e2.stopPropagation();
144981
+ }, "getTrackTrimmingOptions");
144982
+ if (!alignmentTracks || !alignmentTracks[0] || !alignmentTracks[0].alignmentData) {
144983
+ console.error("corrupted data!", props);
144984
+ return "corrupted data!";
145526
144985
  }
145527
- };
145528
- __name(_AlignmentView, "AlignmentView");
145529
- let AlignmentView = _AlignmentView;
144986
+ const getTrackVis = /* @__PURE__ */ __name((alignmentTracks2, isTemplate, allTracks) => {
144987
+ const rowData2 = {};
144988
+ const innerTrackVis = /* @__PURE__ */ __name((drop_provided, drop_snapshot) => {
144989
+ return /* @__PURE__ */ React$2.createElement(
144990
+ "div",
144991
+ {
144992
+ className: "alignmentTracks ",
144993
+ style: {
144994
+ overflowY: "auto",
144995
+ display: "flex",
144996
+ zIndex: 10
144997
+ }
144998
+ },
144999
+ /* @__PURE__ */ React$2.createElement(
145000
+ "div",
145001
+ {
145002
+ style: { overflowX: "auto", width },
145003
+ ref: (ref2) => {
145004
+ if (isTemplate) {
145005
+ alignmentHolderTop.current = ref2;
145006
+ } else {
145007
+ alignmentHolder.current = ref2;
145008
+ }
145009
+ },
145010
+ onContextMenu: (e2) => {
145011
+ if (!allowTrimming || isTargetWithinEl(e2, ".alignmentTrackName")) {
145012
+ return;
145013
+ }
145014
+ getTrackTrimmingOptions({
145015
+ e: e2,
145016
+ allTracks,
145017
+ upsertAlignmentRun: upsertAlignmentRun2,
145018
+ alignmentId,
145019
+ currentPairwiseAlignmentIndex
145020
+ });
145021
+ },
145022
+ onMouseLeave: removeMinimapHighlightForMouseLeave,
145023
+ onMouseMove: updateMinimapHighlightForMouseMove,
145024
+ dataname: "scrollGroup",
145025
+ className: "alignmentHolder",
145026
+ onScroll: isTemplate ? handleTopScroll : handleScroll
145027
+ },
145028
+ /* @__PURE__ */ React$2.createElement(
145029
+ ReactDraggable,
145030
+ {
145031
+ disabled: isTrackDragging,
145032
+ bounds: { top: 0, left: 0, right: 0, bottom: 0 },
145033
+ onDrag: noClickDragHandlers ? noop$7 : (event) => {
145034
+ if (isTrackDragging)
145035
+ return;
145036
+ getNearestCursorPositionToMouseEvent2(
145037
+ rowData2,
145038
+ event,
145039
+ editorDragged
145040
+ );
145041
+ },
145042
+ onStart: noClickDragHandlers ? noop$7 : (event) => {
145043
+ if (isTargetWithinEl(event, ".alignmentTrackName")) {
145044
+ setIsTrackDragging(true);
145045
+ return;
145046
+ }
145047
+ if (isTrackDragging)
145048
+ return;
145049
+ getNearestCursorPositionToMouseEvent2(
145050
+ rowData2,
145051
+ event,
145052
+ editorDragStarted
145053
+ );
145054
+ },
145055
+ onStop: noClickDragHandlers ? noop$7 : (...args) => {
145056
+ setTimeout(() => {
145057
+ setIsTrackDragging(false);
145058
+ }, 0);
145059
+ editorDragStopped(...args);
145060
+ }
145061
+ },
145062
+ /* @__PURE__ */ React$2.createElement(
145063
+ "div",
145064
+ {
145065
+ ref: veTracksAndAlignmentHolder,
145066
+ className: classNames("veTracksAndAlignmentHolder", {
145067
+ isTrackDragging
145068
+ }),
145069
+ onClick: noClickDragHandlers ? noop$7 : (event) => {
145070
+ if (isTrackDragging)
145071
+ return;
145072
+ if (isTargetWithinEl(event, ".alignmentTrackName")) {
145073
+ return;
145074
+ }
145075
+ getNearestCursorPositionToMouseEvent2(
145076
+ rowData2,
145077
+ event,
145078
+ editorClicked
145079
+ );
145080
+ }
145081
+ },
145082
+ /* @__PURE__ */ React$2.createElement(
145083
+ PerformantSelectionLayer,
145084
+ {
145085
+ leftMargin: nameDivWidth,
145086
+ className: "veAlignmentSelectionLayer",
145087
+ isDraggable: true,
145088
+ selectionLayerRightClicked: selectionLayerRightClicked ? (...args) => {
145089
+ selectionLayerRightClicked(...args, props);
145090
+ } : (...args) => {
145091
+ const { event } = args[0];
145092
+ const track2 = getTrackFromEvent(event, allTracks);
145093
+ const alignmentData = track2.alignmentData;
145094
+ const { name: name2 } = alignmentData;
145095
+ const copySpecificAlignmentFasta = /* @__PURE__ */ __name(() => __async(exports, null, function* () {
145096
+ const { selectionLayer: selectionLayer22 } = store2.getState().VectorEditor.__allEditorsOptions.alignments[id2] || {};
145097
+ const seqDataToCopy = getSequenceDataBetweenRange(
145098
+ alignmentData,
145099
+ selectionLayer22
145100
+ ).sequence;
145101
+ const seqDataToCopyAsFasta = `>${name2}\r
145102
+ ${seqDataToCopy}\r
145103
+ `;
145104
+ yield navigator.clipboard.writeText(
145105
+ seqDataToCopyAsFasta
145106
+ );
145107
+ }), "copySpecificAlignmentFasta");
145108
+ const copySpecificAlignment = /* @__PURE__ */ __name(() => __async(exports, null, function* () {
145109
+ const { selectionLayer: selectionLayer22 } = store2.getState().VectorEditor.__allEditorsOptions.alignments[id2] || {};
145110
+ const seqDataToCopy = getSequenceDataBetweenRange(
145111
+ alignmentData,
145112
+ selectionLayer22
145113
+ ).sequence;
145114
+ yield navigator.clipboard.writeText(seqDataToCopy);
145115
+ }), "copySpecificAlignment");
145116
+ const getAllAlignmentsFastaText2 = /* @__PURE__ */ __name(() => __async(exports, null, function* () {
145117
+ yield navigator.clipboard.writeText(
145118
+ getAllAlignmentsFastaText2()
145119
+ );
145120
+ }), "getAllAlignmentsFastaText2");
145121
+ showContextMenu(
145122
+ [
145123
+ ...additionalSelectionLayerRightClickedOptions ? additionalSelectionLayerRightClickedOptions(
145124
+ ...args,
145125
+ props
145126
+ ) : [],
145127
+ {
145128
+ text: "Copy Selection of All Alignments as Fasta",
145129
+ className: "copyAllAlignmentsFastaClipboardHelper",
145130
+ hotkey: "cmd+c",
145131
+ onClick: () => {
145132
+ getAllAlignmentsFastaText2();
145133
+ window.toastr.success("Selection Copied");
145134
+ }
145135
+ },
145136
+ {
145137
+ text: `Copy Selection of ${name2} as Fasta`,
145138
+ className: "copySpecificAlignmentFastaClipboardHelper",
145139
+ onClick: () => {
145140
+ copySpecificAlignmentFasta();
145141
+ window.toastr.success(
145142
+ "Selection Copied As Fasta"
145143
+ );
145144
+ }
145145
+ },
145146
+ {
145147
+ text: `Copy Selection of ${name2}`,
145148
+ className: "copySpecificAlignmentAsPlainClipboardHelper",
145149
+ onClick: () => {
145150
+ copySpecificAlignment();
145151
+ window.toastr.success("Selection Copied");
145152
+ }
145153
+ }
145154
+ ],
145155
+ void 0,
145156
+ event
145157
+ );
145158
+ },
145159
+ easyStore: easyStore2.current,
145160
+ sequenceLength: maxLength,
145161
+ charWidth: charWidth2,
145162
+ row: { start: 0, end: maxLength - 1 }
145163
+ }
145164
+ ),
145165
+ /* @__PURE__ */ React$2.createElement(
145166
+ PerformantCaret,
145167
+ {
145168
+ leftMargin: nameDivWidth,
145169
+ className: "veAlignmentSelectionLayer",
145170
+ isDraggable: true,
145171
+ sequenceLength: maxLength,
145172
+ charWidth: charWidth2,
145173
+ row: { start: 0, end: maxLength - 1 },
145174
+ easyStore: easyStore2.current
145175
+ }
145176
+ ),
145177
+ isTemplate ? renderItem(0, 0, isTemplate) : /* @__PURE__ */ React$2.createElement(
145178
+ ReactList,
145179
+ {
145180
+ ref: (c2) => {
145181
+ InfiniteScroller.current = c2;
145182
+ const domNode = ReactDOM$1.findDOMNode(c2);
145183
+ if (domNode instanceof HTMLElement) {
145184
+ drop_provided.innerRef(domNode);
145185
+ }
145186
+ },
145187
+ type: "variable",
145188
+ itemSizeEstimator: estimateRowHeight,
145189
+ itemRenderer: renderItem,
145190
+ length: alignmentTracks2.length + (drop_snapshot.isUsingPlaceholder ? 1 : 0)
145191
+ }
145192
+ )
145193
+ )
145194
+ )
145195
+ )
145196
+ );
145197
+ }, "innerTrackVis");
145198
+ if (isTemplate)
145199
+ return innerTrackVis();
145200
+ else
145201
+ return /* @__PURE__ */ React$2.createElement(
145202
+ ConnectedDroppable$1,
145203
+ {
145204
+ mode: "virtual",
145205
+ renderClone: (provided, snapshot, { source: { index: index2 } }) => {
145206
+ return renderItem(index2, index2, false, {
145207
+ provided,
145208
+ snapshot
145209
+ });
145210
+ },
145211
+ direction: "vertical",
145212
+ droppableId: "droppable" + isTemplate ? "_no_drop" : ""
145213
+ },
145214
+ innerTrackVis
145215
+ );
145216
+ }, "getTrackVis");
145217
+ const [firstTrack, ...otherTracks] = alignmentTracks;
145218
+ const totalWidthOfMinimap = width;
145219
+ const totalWidthInAlignmentView = 14 * getSequenceLength();
145220
+ const minSliderSize = Math.min(
145221
+ totalWidthOfMinimap * (totalWidthOfMinimap / totalWidthInAlignmentView),
145222
+ totalWidthOfMinimap
145223
+ );
145224
+ const viewportHeight = Math.max(
145225
+ document.documentElement.clientHeight,
145226
+ window.innerHeight || 0
145227
+ );
145228
+ const pinchHandler = {
145229
+ onPinch: ({ delta: [d2] }) => {
145230
+ bindOutsideChangeHelper.current.triggerChange(
145231
+ ({ value, changeValue }) => {
145232
+ if (d2 > 0) {
145233
+ if (value > 8) {
145234
+ changeValue(value + 0.4);
145235
+ } else {
145236
+ changeValue(value + 0.2);
145237
+ }
145238
+ } else if (d2 < 0) {
145239
+ if (value > 8) {
145240
+ changeValue(value - 0.4);
145241
+ } else {
145242
+ changeValue(value - 0.2);
145243
+ }
145244
+ }
145245
+ }
145246
+ );
145247
+ updateLabelsForInViewFeatures();
145248
+ }
145249
+ };
145250
+ return /* @__PURE__ */ React$2.createElement(PinchHelper, __spreadValues({}, pinchHandler), /* @__PURE__ */ React$2.createElement(core.ResizeSensor, { onResize: handleResize }, /* @__PURE__ */ React$2.createElement(
145251
+ "div",
145252
+ {
145253
+ style: __spreadValues({
145254
+ height: height2 || (isPairwise ? "auto" : viewportHeight * 0.88),
145255
+ display: "flex",
145256
+ flexDirection: "column",
145257
+ justifyContent: "space-between",
145258
+ position: "relative",
145259
+ overflowY: "auto"
145260
+ }, style2),
145261
+ className: "alignmentView"
145262
+ },
145263
+ /* @__PURE__ */ React$2.createElement(
145264
+ DragDropContext,
145265
+ {
145266
+ onDragStart: onTrackDragStart,
145267
+ onDragEnd: onTrackDragEnd
145268
+ },
145269
+ /* @__PURE__ */ React$2.createElement(
145270
+ "div",
145271
+ {
145272
+ style: {
145273
+ display: "flex",
145274
+ flexDirection: "column",
145275
+ position: "relative",
145276
+ overflowY: "auto"
145277
+ },
145278
+ className: "alignmentView-top-container"
145279
+ },
145280
+ /* @__PURE__ */ React$2.createElement(
145281
+ "div",
145282
+ {
145283
+ style: {
145284
+ paddingTop: "3px",
145285
+ paddingBottom: "5px",
145286
+ borderBottom: "1px solid",
145287
+ display: "flex",
145288
+ minHeight: "32px",
145289
+ width: "100%",
145290
+ flexWrap: "nowrap",
145291
+ flexDirection: "row",
145292
+ flex: "0 0 auto"
145293
+ },
145294
+ className: "ve-alignment-top-bar"
145295
+ },
145296
+ additionalTopLeftEl,
145297
+ handleBackButtonClicked && /* @__PURE__ */ React$2.createElement(core.Tooltip, { content: "Back to Pairwise Alignment Overview" }, /* @__PURE__ */ React$2.createElement(
145298
+ core.Button,
145299
+ {
145300
+ icon: "arrow-left",
145301
+ onClick: () => {
145302
+ handleBackButtonClicked();
145303
+ caretPositionUpdate2(-1);
145304
+ },
145305
+ small: true,
145306
+ intent: core.Intent.PRIMARY,
145307
+ minimal: true,
145308
+ style: { marginRight: 10 },
145309
+ className: "alignmentViewBackButton"
145310
+ }
145311
+ )),
145312
+ /* @__PURE__ */ React$2.createElement("div", { style: { display: "flex" } }, /* @__PURE__ */ React$2.createElement(
145313
+ core.EditableText,
145314
+ {
145315
+ disabled: !handleAlignmentRename,
145316
+ onChange: (v2) => {
145317
+ setAlignmentName(v2);
145318
+ },
145319
+ maxLength: 399,
145320
+ value: alignmentName,
145321
+ onConfirm: (v2) => __async(exports, null, function* () {
145322
+ if (!v2) {
145323
+ setAlignmentName(_alignmentName);
145324
+ return;
145325
+ }
145326
+ if (v2 === _alignmentName) {
145327
+ return;
145328
+ }
145329
+ setSaveMessage("Alignment Renaming..");
145330
+ setSaveMessageLoading(true);
145331
+ yield handleAlignmentRename(v2, props);
145332
+ setSaveMessage("Rename Successful");
145333
+ setSaveMessageLoading(false);
145334
+ setTimeout(() => {
145335
+ setSaveMessage(void 0);
145336
+ setSaveMessageLoading(false);
145337
+ }, 5e3);
145338
+ }),
145339
+ selectAllOnFocus: true,
145340
+ className: "veAlignmentName"
145341
+ }
145342
+ ), "   ", /* @__PURE__ */ React$2.createElement(
145343
+ "div",
145344
+ {
145345
+ className: "veAlignmentType",
145346
+ style: {
145347
+ paddingTop: "3px",
145348
+ fontSize: "14px",
145349
+ color: "grey",
145350
+ maxWidth: "300px",
145351
+ overflow: "hidden",
145352
+ textOverflow: "ellipsis",
145353
+ whiteSpace: "nowrap"
145354
+ },
145355
+ "data-title": alignmentType || "Unknown Alignment Type"
145356
+ },
145357
+ alignmentType || "Unknown Alignment Type"
145358
+ )),
145359
+ unmappedSeqs && /* @__PURE__ */ React$2.createElement(
145360
+ InfoHelper,
145361
+ {
145362
+ size: 20,
145363
+ content: /* @__PURE__ */ React$2.createElement("div", null, "This alignment had sequences that did not map to the template sequence:", unmappedSeqs.map(({ sequenceData: sequenceData22 }, i) => /* @__PURE__ */ React$2.createElement("div", { key: i }, sequenceData22.name))),
145364
+ intent: "warning",
145365
+ icon: "warning-sign"
145366
+ }
145367
+ ),
145368
+ !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
145369
+ UncontrolledSliderWithPlusMinusBtns,
145370
+ {
145371
+ noWraparound: true,
145372
+ bindOutsideChangeHelper: bindOutsideChangeHelper.current,
145373
+ onClick: () => {
145374
+ setTimeout(scrollToCaret2, 0);
145375
+ },
145376
+ minCharWidth: getMinCharWidth(),
145377
+ onChange: (zoomLvl) => __async(exports, null, function* () {
145378
+ isZooming.current = true;
145379
+ setTimeout(() => {
145380
+ isZooming.current = false;
145381
+ }, 10);
145382
+ const minCharWidth = getMinCharWidth();
145383
+ const scaleFactor = Math.pow(12 / minCharWidth, 1 / 10);
145384
+ const newCharWidth = minCharWidth * Math.pow(scaleFactor, zoomLvl);
145385
+ yield setCharWidthInLinearView({
145386
+ charWidthInLinearView: newCharWidth
145387
+ });
145388
+ yield scrollToCaret2();
145389
+ yield updateLabelsForInViewFeatures({
145390
+ rectElement: ".alignmentHolder"
145391
+ });
145392
+ }),
145393
+ coerceInitialValue,
145394
+ title: "Adjust Zoom Level",
145395
+ style: { paddingTop: "4px", width: 100 },
145396
+ className: "veZoomAlignmentSlider ove-slider",
145397
+ labelRenderer: false,
145398
+ initialValue: charWidth2,
145399
+ stepSize: 0.05,
145400
+ max: 10,
145401
+ min: 0,
145402
+ clickStepSize: 0.5
145403
+ }
145404
+ ),
145405
+ !noVisibilityOptions && !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
145406
+ AlignmentVisibilityTool,
145407
+ __spreadValues({
145408
+ currentPairwiseAlignmentIndex
145409
+ }, alignmentVisibilityToolOptions)
145410
+ ),
145411
+ updateAlignmentSortOrder && !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
145412
+ core.Popover,
145413
+ {
145414
+ minimal: true,
145415
+ content: /* @__PURE__ */ React$2.createElement(core.Menu, null, /* @__PURE__ */ React$2.createElement(
145416
+ core.MenuItem,
145417
+ {
145418
+ active: true,
145419
+ onClick: () => {
145420
+ updateAlignmentSortOrder("Position");
145421
+ },
145422
+ text: "Position"
145423
+ }
145424
+ ), /* @__PURE__ */ React$2.createElement(
145425
+ core.MenuItem,
145426
+ {
145427
+ active: alignmentSortOrder,
145428
+ onClick: () => {
145429
+ updateAlignmentSortOrder("Alphabetical");
145430
+ },
145431
+ text: "Alphabetical"
145432
+ }
145433
+ )),
145434
+ target: /* @__PURE__ */ React$2.createElement(
145435
+ core.Button,
145436
+ {
145437
+ small: true,
145438
+ text: "Sort Order",
145439
+ rightIcon: "caret-down",
145440
+ icon: "sort"
145441
+ }
145442
+ )
145443
+ }
145444
+ ),
145445
+ additionalTopEl,
145446
+ saveMessage && /* @__PURE__ */ React$2.createElement(
145447
+ "div",
145448
+ {
145449
+ className: "ove-menu-toast",
145450
+ style: {
145451
+ display: "flex",
145452
+ alignItems: "center",
145453
+ marginLeft: "auto",
145454
+ marginRight: 10
145455
+ }
145456
+ },
145457
+ saveMessageLoading ? /* @__PURE__ */ React$2.createElement("div", null, /* @__PURE__ */ React$2.createElement(core.Spinner, { size: 15 })) : /* @__PURE__ */ React$2.createElement(core.Icon, { icon: "tick-circle", intent: "success" }),
145458
+ " ",
145459
+ " ",
145460
+ saveMessage
145461
+ )
145462
+ ),
145463
+ hasTemplate ? /* @__PURE__ */ React$2.createElement(React$2.Fragment, null, /* @__PURE__ */ React$2.createElement("div", { className: "alignmentTrackFixedToTop" }, getTrackVis([firstTrack], true, alignmentTracks)), getTrackVis(otherTracks, false, alignmentTracks)) : getTrackVis(alignmentTracks, false, alignmentTracks)
145464
+ )
145465
+ ),
145466
+ !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
145467
+ "div",
145468
+ {
145469
+ className: "alignmentViewBottomBar",
145470
+ style: {
145471
+ // flexGrow: 1,
145472
+ // minHeight: "-webkit-min-content", //https://stackoverflow.com/questions/28029736/how-to-prevent-a-flex-item-from-shrinking-smaller-than-its-content
145473
+ maxHeight: 210,
145474
+ marginTop: 4,
145475
+ paddingTop: 4,
145476
+ borderTop: "1px solid lightgrey",
145477
+ display: "flex"
145478
+ }
145479
+ },
145480
+ /* @__PURE__ */ React$2.createElement(
145481
+ Minimap,
145482
+ {
145483
+ selectionLayerComp: /* @__PURE__ */ React$2.createElement(React$2.Fragment, null, /* @__PURE__ */ React$2.createElement(
145484
+ PerformantSelectionLayer,
145485
+ {
145486
+ is: true,
145487
+ hideCarets: true,
145488
+ className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
145489
+ easyStore: easyStore2.current,
145490
+ sequenceLength: maxLength,
145491
+ charWidth: getMinCharWidth(true),
145492
+ row: { start: 0, end: maxLength - 1 }
145493
+ }
145494
+ ), /* @__PURE__ */ React$2.createElement(
145495
+ PerformantCaret,
145496
+ {
145497
+ style: {
145498
+ opacity: 0.2
145499
+ },
145500
+ className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
145501
+ sequenceLength: maxLength,
145502
+ charWidth: getMinCharWidth(true),
145503
+ row: { start: 0, end: maxLength - 1 },
145504
+ easyStore: easyStore2.current
145505
+ }
145506
+ )),
145507
+ alignmentTracks,
145508
+ dimensions: {
145509
+ width: Math.max(width, 10) || 10
145510
+ },
145511
+ nameDivOffsetPercent: 0,
145512
+ scrollYToTrack,
145513
+ onSizeAdjust: onMinimapSizeAdjust,
145514
+ minSliderSize,
145515
+ laneHeight: minimapLaneHeight || (alignmentTracks.length > 5 ? 10 : 17),
145516
+ laneSpacing: minimapLaneSpacing || (alignmentTracks.length > 5 ? 2 : 1),
145517
+ easyStore: easyStore2.current,
145518
+ numBpsShownInLinearView: getNumBpsShownInLinearView(),
145519
+ scrollAlignmentView: false,
145520
+ onMinimapScrollX: scrollAlignmentToPercent
145521
+ }
145522
+ )
145523
+ ),
145524
+ /* @__PURE__ */ React$2.createElement(
145525
+ GlobalDialog,
145526
+ null
145527
+ )
145528
+ )));
145529
+ }, "AlignmentView");
145530
145530
  const AlignmentView$1 = compose(
145531
145531
  withStore,
145532
145532
  withEditorProps,