@teselagen/ove 0.7.29 → 0.7.30-beta.1

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
@@ -16010,6 +16010,7 @@ var itemSizeEstimator = /* @__PURE__ */ __name(function itemSizeEstimator2() {
16010
16010
  return 41.36;
16011
16011
  }, "itemSizeEstimator");
16012
16012
  var ReactTableDefaults = defaultProps$1;
16013
+ var VIRTUALIZE_CUTOFF_LENGTH = 200;
16013
16014
  var ReactTable = function(_Methods) {
16014
16015
  _inherits$8(ReactTable2, _Methods);
16015
16016
  function ReactTable2(props) {
@@ -16595,7 +16596,7 @@ var ReactTable = function(_Methods) {
16595
16596
  minWidth: rowMinWidth + "px"
16596
16597
  })
16597
16598
  }, tBodyProps.rest),
16598
- pageRows.length < 200 ? pageRows.map(function(d2, i) {
16599
+ _this2.props.noVirtual || pageRows.length < VIRTUALIZE_CUTOFF_LENGTH ? pageRows.map(function(d2, i) {
16599
16600
  return makePageRow(d2, i);
16600
16601
  }) : React.createElement(ReactList, {
16601
16602
  type: "variable",
@@ -16699,7 +16700,7 @@ const getIdOrCodeOrIndex = /* @__PURE__ */ __name((record, rowIndex) => {
16699
16700
  const getSelectedRowsFromEntities = /* @__PURE__ */ __name((entities, idMap) => {
16700
16701
  if (!idMap) return [];
16701
16702
  return entities.reduce((acc, entity, i) => {
16702
- return idMap[getIdOrCodeOrIndex(entity, i)] ? acc.concat(i) : acc;
16703
+ return idMap[getIdOrCodeOrIndex(entity, i)] ? acc.concat([i]) : acc;
16703
16704
  }, []);
16704
16705
  }, "getSelectedRowsFromEntities");
16705
16706
  const removeCleanRows = /* @__PURE__ */ __name((entities, cellValidation) => {
@@ -16818,9 +16819,9 @@ const stripNumberAtEnd = /* @__PURE__ */ __name((str) => {
16818
16819
  var _a2;
16819
16820
  return (_a2 = str == null ? void 0 : str.replace) == null ? void 0 : _a2.call(str, getNumberStrAtEnd(str), "");
16820
16821
  }, "stripNumberAtEnd");
16821
- const getAllRows = /* @__PURE__ */ __name((e) => {
16822
- const el = e.target.querySelector(".data-table-container") ? e.target.querySelector(".data-table-container") : e.target.closest(".data-table-container");
16823
- const allRowEls = el.querySelectorAll(".rt-tr");
16822
+ const getAllRows = /* @__PURE__ */ __name((tableRef) => {
16823
+ var _a2, _b2;
16824
+ const allRowEls = (_b2 = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b2.querySelectorAll(".rt-tr");
16824
16825
  if (!allRowEls || !allRowEls.length) {
16825
16826
  return;
16826
16827
  }
@@ -17087,14 +17088,14 @@ const handleCopyRows = /* @__PURE__ */ __name((rowElsToCopy, { specificColumn, o
17087
17088
  handleCopyHelper(textToCopy, jsonToCopy, onFinishMsg || "Row Copied");
17088
17089
  }
17089
17090
  }, "handleCopyRows");
17090
- const handleCopyColumn = /* @__PURE__ */ __name((e, cellWrapper, selectedRecords) => {
17091
+ const handleCopyColumn = /* @__PURE__ */ __name((tableRef, cellWrapper, selectedRecords) => {
17091
17092
  const specificColumn = cellWrapper.getAttribute("data-test");
17092
- let rowElsToCopy = getAllRows(e);
17093
+ let rowElsToCopy = getAllRows(tableRef);
17093
17094
  if (!rowElsToCopy) return;
17094
17095
  if (selectedRecords) {
17095
- const ids2 = selectedRecords.map((e2) => {
17096
+ const ids2 = selectedRecords.map((e) => {
17096
17097
  var _a2;
17097
- return (_a2 = getIdOrCodeOrIndex(e2)) == null ? void 0 : _a2.toString();
17098
+ return (_a2 = getIdOrCodeOrIndex(e)) == null ? void 0 : _a2.toString();
17098
17099
  });
17099
17100
  rowElsToCopy = Array.from(rowElsToCopy).filter((rowEl) => {
17100
17101
  var _a2;
@@ -17127,9 +17128,9 @@ const isBottomRightCornerOfRectangle = /* @__PURE__ */ __name(({
17127
17128
  const isBottomRight = i === lastRowIndex && cellIndex === lastCellIndex;
17128
17129
  return isBottomRight;
17129
17130
  }, "isBottomRightCornerOfRectangle");
17130
- const handleCopyTable = /* @__PURE__ */ __name((e, opts2) => {
17131
+ const handleCopyTable = /* @__PURE__ */ __name((tableRef, opts2) => {
17131
17132
  try {
17132
- const allRowEls = getAllRows(e);
17133
+ const allRowEls = getAllRows(tableRef);
17133
17134
  if (!allRowEls) return;
17134
17135
  handleCopyRows(allRowEls, __spreadProps(__spreadValues({}, opts2), {
17135
17136
  onFinishMsg: "Table Copied"
@@ -17166,13 +17167,15 @@ const useTableEntities = /* @__PURE__ */ __name((tableFormName) => {
17166
17167
  },
17167
17168
  [dispatch, tableFormName]
17168
17169
  );
17169
- const { allOrderedEntities, selectedEntities } = reactRedux.useSelector((state2) => {
17170
- var _a2, _b2, _c, _d, _e, _f;
17171
- return {
17172
- allOrderedEntities: (_c = (_b2 = (_a2 = state2.form) == null ? void 0 : _a2[tableFormName]) == null ? void 0 : _b2.values) == null ? void 0 : _c.allOrderedEntities,
17173
- selectedEntities: (_f = (_e = (_d = state2.form) == null ? void 0 : _d[tableFormName]) == null ? void 0 : _e.values) == null ? void 0 : _f.reduxFormSelectedEntityIdMap
17174
- };
17175
- });
17170
+ const { allOrderedEntities, selectedEntities } = reactRedux.useSelector(
17171
+ (state2) => {
17172
+ var _a2, _b2, _c, _d, _e, _f;
17173
+ return {
17174
+ allOrderedEntities: (_c = (_b2 = (_a2 = state2.form) == null ? void 0 : _a2[tableFormName]) == null ? void 0 : _b2.values) == null ? void 0 : _c.allOrderedEntities,
17175
+ selectedEntities: (_f = (_e = (_d = state2.form) == null ? void 0 : _d[tableFormName]) == null ? void 0 : _e.values) == null ? void 0 : _f.reduxFormSelectedEntityIdMap
17176
+ };
17177
+ }
17178
+ );
17176
17179
  return { selectTableEntities, allOrderedEntities, selectedEntities };
17177
17180
  }, "useTableEntities");
17178
17181
  const useDeepEqualMemo = /* @__PURE__ */ __name((value) => {
@@ -36957,7 +36960,7 @@ const multiViewColumn = __spreadProps(__spreadValues({}, viewColumn), {
36957
36960
  ));
36958
36961
  }, "render")
36959
36962
  });
36960
- function convertSchema(schema2) {
36963
+ const convertSchema = /* @__PURE__ */ __name((schema2) => {
36961
36964
  let schemaToUse = schema2;
36962
36965
  if (!schemaToUse.fields && Array.isArray(schema2)) {
36963
36966
  schemaToUse = {
@@ -36966,35 +36969,26 @@ function convertSchema(schema2) {
36966
36969
  }
36967
36970
  schemaToUse = __spreadValues({}, schemaToUse);
36968
36971
  schemaToUse.fields = schemaToUse.fields.map((field, i) => {
36969
- let fieldToUse = field;
36970
36972
  if (typeof field === "string") {
36971
- fieldToUse = {
36973
+ return {
36972
36974
  displayName: startCase(camelCase(field)),
36973
36975
  path: field,
36974
36976
  type: "string"
36975
36977
  };
36976
- } else if (!field.type) {
36977
- fieldToUse = __spreadProps(__spreadValues({}, field), {
36978
- type: "string"
36979
- });
36980
- }
36981
- if (!fieldToUse.displayName) {
36982
- fieldToUse = __spreadProps(__spreadValues({}, fieldToUse), {
36983
- displayName: startCase(camelCase(fieldToUse.path))
36984
- });
36985
- }
36986
- if (!fieldToUse.path) {
36987
- fieldToUse = __spreadProps(__spreadValues({}, fieldToUse), {
36988
- filterDisabled: true,
36989
- sortDisabled: true,
36990
- path: "fake-path" + i
36991
- });
36978
+ } else {
36979
+ const fieldToUse = __spreadValues({}, field);
36980
+ fieldToUse.type = fieldToUse.type || "string";
36981
+ fieldToUse.displayName = fieldToUse.displayName || startCase(camelCase(fieldToUse.path || ""));
36982
+ if (!fieldToUse.path) {
36983
+ fieldToUse.filterDisabled = true;
36984
+ fieldToUse.sortDisabled = true;
36985
+ fieldToUse.path = "fake-path" + i;
36986
+ }
36987
+ return fieldToUse;
36992
36988
  }
36993
- return fieldToUse;
36994
36989
  });
36995
36990
  return schemaToUse;
36996
- }
36997
- __name(convertSchema, "convertSchema");
36991
+ }, "convertSchema");
36998
36992
  const TableFormTrackerContext = React.createContext({
36999
36993
  formNames: [],
37000
36994
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -56029,6 +56023,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
56029
56023
  );
56030
56024
  const tableRef = React.useRef();
56031
56025
  const alreadySelected = React.useRef(false);
56026
+ const [noVirtual, setNoVirtual] = React.useState(false);
56032
56027
  const [onlyShowRowsWErrors, setOnlyShowRowsWErrors] = React.useState(false);
56033
56028
  const [entitiesUndoRedoStack, setEntitiesUndoRedoStack] = React.useState({
56034
56029
  currentVersion: 0
@@ -56870,76 +56865,94 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
56870
56865
  updateEntitiesHelper,
56871
56866
  updateValidation
56872
56867
  ]);
56873
- const handleCopySelectedCells = React.useCallback(
56874
- (e) => {
56875
- if (isEmpty$1(selectedCells)) return;
56876
- const pathToIndex = getFieldPathToIndex(schema2);
56877
- const entityIdToEntity = getEntityIdToEntity(entities);
56878
- const selectionGrid = [];
56879
- let firstRowIndex;
56880
- let firstCellIndex;
56881
- Object.keys(selectedCells).forEach((key) => {
56882
- const [rowId, path2] = key.split(":");
56883
- const eInfo = entityIdToEntity[rowId];
56884
- if (eInfo) {
56885
- if (firstRowIndex === void 0 || eInfo.i < firstRowIndex) {
56886
- firstRowIndex = eInfo.i;
56887
- }
56888
- if (!selectionGrid[eInfo.i]) {
56889
- selectionGrid[eInfo.i] = [];
56890
- }
56891
- const cellIndex = pathToIndex[path2];
56892
- if (firstCellIndex === void 0 || cellIndex < firstCellIndex) {
56893
- firstCellIndex = cellIndex;
56894
- }
56895
- selectionGrid[eInfo.i][cellIndex] = true;
56896
- }
56897
- });
56898
- if (firstRowIndex === void 0) return;
56899
- const allRows = getAllRows(e);
56900
- let fullCellText = "";
56901
- const fullJson = [];
56902
- times(selectionGrid.length, (i) => {
56903
- const row = selectionGrid[i];
56904
- if (fullCellText) {
56905
- fullCellText += "\n";
56868
+ const waitUntilAllRowsAreRendered = React.useCallback(() => {
56869
+ return new Promise((resolve) => {
56870
+ const interval = setInterval(() => {
56871
+ var _a3, _b2;
56872
+ const allRowEls = (_b2 = (_a3 = tableRef.current) == null ? void 0 : _a3.tableRef) == null ? void 0 : _b2.querySelectorAll(".rt-tr-group");
56873
+ if ((allRowEls == null ? void 0 : allRowEls.length) === entities.length) {
56874
+ clearInterval(interval);
56875
+ resolve();
56906
56876
  }
56907
- if (!row) {
56908
- return;
56909
- } else {
56910
- const jsonRow = [];
56911
- let [rowCopyText, json] = getRowCopyText(allRows[i + 1]);
56912
- rowCopyText = rowCopyText.split(" ");
56913
- times(row.length, (i2) => {
56914
- const cell = row[i2];
56915
- if (cell) {
56916
- fullCellText += rowCopyText[i2];
56917
- jsonRow.push(json[i2]);
56918
- }
56919
- if (i2 !== row.length - 1 && i2 >= firstCellIndex)
56920
- fullCellText += " ";
56921
- });
56922
- fullJson.push(jsonRow);
56877
+ }, 50);
56878
+ });
56879
+ }, []);
56880
+ const handleCopySelectedCells = React.useCallback(() => __async(exports, null, function* () {
56881
+ if (isEmpty$1(selectedCells)) return;
56882
+ if (entities.length > VIRTUALIZE_CUTOFF_LENGTH) {
56883
+ setNoVirtual(true);
56884
+ yield waitUntilAllRowsAreRendered();
56885
+ }
56886
+ const pathToIndex = getFieldPathToIndex(schema2);
56887
+ const entityIdToEntity = getEntityIdToEntity(entities);
56888
+ const selectionGrid = [];
56889
+ let firstRowIndex;
56890
+ let firstCellIndex;
56891
+ Object.keys(selectedCells).forEach((key) => {
56892
+ const [rowId, path2] = key.split(":");
56893
+ const eInfo = entityIdToEntity[rowId];
56894
+ if (eInfo) {
56895
+ if (firstRowIndex === void 0 || eInfo.i < firstRowIndex) {
56896
+ firstRowIndex = eInfo.i;
56897
+ }
56898
+ if (!selectionGrid[eInfo.i]) {
56899
+ selectionGrid[eInfo.i] = [];
56900
+ }
56901
+ const cellIndex = pathToIndex[path2];
56902
+ if (firstCellIndex === void 0 || cellIndex < firstCellIndex) {
56903
+ firstCellIndex = cellIndex;
56923
56904
  }
56924
- });
56925
- if (!fullCellText) return window.toastr.warning("No text to copy");
56926
- handleCopyHelper(fullCellText, fullJson, "Selected cells copied");
56927
- },
56928
- [entities, selectedCells, schema2]
56929
- );
56905
+ selectionGrid[eInfo.i][cellIndex] = true;
56906
+ }
56907
+ });
56908
+ if (firstRowIndex === void 0) return;
56909
+ const allRows = getAllRows(tableRef);
56910
+ let fullCellText = "";
56911
+ const fullJson = [];
56912
+ times(selectionGrid.length, (i) => {
56913
+ const row = selectionGrid[i];
56914
+ if (fullCellText) {
56915
+ fullCellText += "\n";
56916
+ }
56917
+ if (!row) {
56918
+ return;
56919
+ } else {
56920
+ const jsonRow = [];
56921
+ let [rowCopyText, json] = getRowCopyText(allRows[i + 1]);
56922
+ rowCopyText = rowCopyText.split(" ");
56923
+ times(row.length, (i2) => {
56924
+ const cell = row[i2];
56925
+ if (cell) {
56926
+ fullCellText += rowCopyText[i2];
56927
+ jsonRow.push(json[i2]);
56928
+ }
56929
+ if (i2 !== row.length - 1 && i2 >= firstCellIndex) fullCellText += " ";
56930
+ });
56931
+ fullJson.push(jsonRow);
56932
+ }
56933
+ });
56934
+ if (!fullCellText) return window.toastr.warning("No text to copy");
56935
+ handleCopyHelper(fullCellText, fullJson, "Selected cells copied");
56936
+ setNoVirtual(false);
56937
+ }), [entities, selectedCells, schema2, waitUntilAllRowsAreRendered]);
56930
56938
  const handleCopySelectedRows = React.useCallback(
56931
- (selectedRecords, e) => {
56932
- const idToIndex = entities.reduce((acc, e2, i) => {
56933
- acc[e2.id || e2.code] = i;
56939
+ (selectedRecords) => __async(exports, null, function* () {
56940
+ if (entities.length > VIRTUALIZE_CUTOFF_LENGTH) {
56941
+ setNoVirtual(true);
56942
+ yield waitUntilAllRowsAreRendered();
56943
+ }
56944
+ const idToIndex = entities.reduce((acc, e, i) => {
56945
+ acc[e.id || e.code] = i;
56934
56946
  return acc;
56935
56947
  }, {});
56936
56948
  const rowNumbersToCopy = selectedRecords.map((rec) => idToIndex[rec.id || rec.code] + 1).sort();
56937
56949
  if (!rowNumbersToCopy.length) return;
56938
56950
  rowNumbersToCopy.unshift(0);
56939
56951
  try {
56940
- const allRowEls = getAllRows(e);
56952
+ const allRowEls = getAllRows(tableRef);
56941
56953
  if (!allRowEls) return;
56942
56954
  const rowEls = rowNumbersToCopy.map((i) => allRowEls[i]);
56955
+ if (window.Cypress) window.Cypress.__copiedRowsLength = rowEls.length;
56943
56956
  handleCopyRows(rowEls, {
56944
56957
  onFinishMsg: "Selected rows copied"
56945
56958
  });
@@ -56947,8 +56960,9 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
56947
56960
  console.error(`error:`, error);
56948
56961
  window.toastr.error("Error copying rows.");
56949
56962
  }
56950
- },
56951
- [entities]
56963
+ setNoVirtual(false);
56964
+ }),
56965
+ [entities, waitUntilAllRowsAreRendered]
56952
56966
  );
56953
56967
  const handleCopyHotkey = React.useCallback(
56954
56968
  (e) => {
@@ -57715,7 +57729,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
57715
57729
  {
57716
57730
  key: "copyColumn",
57717
57731
  onClick: /* @__PURE__ */ __name(() => {
57718
- handleCopyColumn(e, cellWrapper);
57732
+ handleCopyColumn(tableRef, cellWrapper);
57719
57733
  }, "onClick"),
57720
57734
  text: "Column"
57721
57735
  }
@@ -57728,7 +57742,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
57728
57742
  {
57729
57743
  key: "copyColumnSelected",
57730
57744
  onClick: /* @__PURE__ */ __name(() => {
57731
- handleCopyColumn(e, cellWrapper, selectedRecords);
57745
+ handleCopyColumn(tableRef, cellWrapper, selectedRecords);
57732
57746
  }, "onClick"),
57733
57747
  text: "Column (Selected)"
57734
57748
  }
@@ -57771,7 +57785,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
57771
57785
  {
57772
57786
  key: "copyFullTableRows",
57773
57787
  onClick: /* @__PURE__ */ __name(() => {
57774
- handleCopyTable(e);
57788
+ handleCopyTable(tableRef);
57775
57789
  }, "onClick"),
57776
57790
  text: "Table"
57777
57791
  }
@@ -58308,6 +58322,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
58308
58322
  __spreadValues({
58309
58323
  data: filteredEnts,
58310
58324
  ref: tableRef,
58325
+ noVirtual,
58311
58326
  className: classNames({
58312
58327
  isCellEditable,
58313
58328
  "tg-table-loading": isLoading,
@@ -58375,7 +58390,8 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
58375
58390
  resizePersist,
58376
58391
  resized,
58377
58392
  rowsToShow,
58378
- style2
58393
+ style2,
58394
+ noVirtual
58379
58395
  ]
58380
58396
  );
58381
58397
  return /* @__PURE__ */ React.createElement("div", { tabIndex: "1", onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, /* @__PURE__ */ React.createElement(
@@ -58658,8 +58674,8 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
58658
58674
  ), /* @__PURE__ */ React.createElement(
58659
58675
  core.Button,
58660
58676
  {
58661
- onClick: /* @__PURE__ */ __name((e) => {
58662
- handleCopyTable(e, { isDownload: true });
58677
+ onClick: /* @__PURE__ */ __name(() => {
58678
+ handleCopyTable(tableRef, { isDownload: true });
58663
58679
  }, "onClick"),
58664
58680
  "data-tip": "Download Table as CSV",
58665
58681
  minimal: true,
@@ -77006,6 +77022,7 @@ const updateAmbiguousOrLiteral = createMetaAction(
77006
77022
  "updateAmbiguousOrLiteral"
77007
77023
  );
77008
77024
  const updateDnaOrAA = createMetaAction("updateDnaOrAA");
77025
+ const updateMismatchesAllowed = createMetaAction("updateMismatchesAllowed");
77009
77026
  const updateMatchNumber = createMetaAction("updateMatchNumber");
77010
77027
  const findTool = createMergedDefaultStateReducer(
77011
77028
  {
@@ -77037,6 +77054,12 @@ const findTool = createMergedDefaultStateReducer(
77037
77054
  dnaOrAA: payload
77038
77055
  });
77039
77056
  },
77057
+ [updateMismatchesAllowed]: (state2, payload) => {
77058
+ return __spreadProps(__spreadValues({}, state2), {
77059
+ matchNumber: 0,
77060
+ mismatchesAllowed: payload
77061
+ });
77062
+ },
77040
77063
  [updateSearchText]: (state2, payload) => {
77041
77064
  return __spreadProps(__spreadValues({}, state2), {
77042
77065
  matchNumber: 0,
@@ -77056,6 +77079,7 @@ const findTool = createMergedDefaultStateReducer(
77056
77079
  dnaOrAA: "DNA",
77057
77080
  ambiguousOrLiteral: "LITERAL",
77058
77081
  highlightAll: false,
77082
+ mismatchesAllowed: 0,
77059
77083
  matchNumber: 0
77060
77084
  }
77061
77085
  );
@@ -77068,6 +77092,7 @@ const findTool$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
77068
77092
  updateAmbiguousOrLiteral,
77069
77093
  updateDnaOrAA,
77070
77094
  updateMatchNumber,
77095
+ updateMismatchesAllowed,
77071
77096
  updateSearchText
77072
77097
  }, Symbol.toStringTag, { value: "Module" }));
77073
77098
  const openToolbarItemUpdate = createMetaAction("openToolbarItemUpdate");
@@ -83903,6 +83928,36 @@ function addSizeIdName(frag, sequenceLength) {
83903
83928
  });
83904
83929
  }
83905
83930
  __name(addSizeIdName, "addSizeIdName");
83931
+ function findApproxMatches(searchSeq, targetSeq, maxMismatches, circular2 = false) {
83932
+ const matches = [];
83933
+ const lenA = searchSeq.length;
83934
+ const lenB = targetSeq.length;
83935
+ const targetSeqExtended = circular2 ? targetSeq + targetSeq.slice(0, lenA - 1) : targetSeq;
83936
+ const limit = circular2 ? lenB : lenB - lenA + 1;
83937
+ for (let i = 0; i < limit; i++) {
83938
+ const window2 = targetSeqExtended.slice(i, i + lenA);
83939
+ let mismatchCount = 0;
83940
+ const mismatchPositions = [];
83941
+ for (let j2 = 0; j2 < lenA; j2++) {
83942
+ if (searchSeq[j2] !== window2[j2]) {
83943
+ mismatchPositions.push(j2);
83944
+ mismatchCount++;
83945
+ if (mismatchCount > maxMismatches) break;
83946
+ }
83947
+ }
83948
+ if (mismatchCount <= maxMismatches) {
83949
+ matches.push({
83950
+ index: i,
83951
+ match: window2,
83952
+ mismatchPositions,
83953
+ numMismatches: mismatchPositions.length
83954
+ // Keep for backwards compatibility
83955
+ });
83956
+ }
83957
+ }
83958
+ return matches;
83959
+ }
83960
+ __name(findApproxMatches, "findApproxMatches");
83906
83961
  var spliceString$1;
83907
83962
  var hasRequiredSpliceString;
83908
83963
  function requireSpliceString() {
@@ -106321,7 +106376,7 @@ function translationsRawSelector(sequenceData2) {
106321
106376
  }
106322
106377
  __name(translationsRawSelector, "translationsRawSelector");
106323
106378
  const translationsRawSelector$1 = createSelector(sequenceDataSelector, translationsRawSelector);
106324
- function searchLayersSelector(sequence2, isCircular, isOpen, searchString, ambiguousOrLiteral, dnaOrAA, isProtein2, proteinSequence) {
106379
+ function searchLayersSelector(sequence2, isCircular, isOpen, searchString, ambiguousOrLiteral, dnaOrAA, isProtein2, proteinSequence, mismatchesAllowed) {
106325
106380
  if (!searchString || !isOpen) {
106326
106381
  return [];
106327
106382
  }
@@ -106349,6 +106404,26 @@ function searchLayersSelector(sequence2, isCircular, isOpen, searchString, ambig
106349
106404
  });
106350
106405
  });
106351
106406
  }
106407
+ if (dnaOrAA === "DNA" && ambiguousOrLiteral === "LITERAL" && mismatchesAllowed > 0) {
106408
+ const approxMatches = findApproxMatches(
106409
+ searchString,
106410
+ sequence2,
106411
+ mismatchesAllowed,
106412
+ isCircular
106413
+ );
106414
+ const matches2 = approxMatches.map((match) => ({
106415
+ start: match.index,
106416
+ end: match.index + match.match.length - 1,
106417
+ matchedString: match.match,
106418
+ mismatchPositions: match.mismatchPositions,
106419
+ numMismatches: match.numMismatches,
106420
+ isSearchLayer: true,
106421
+ forward: true
106422
+ })).sort((a2, b3) => a2.start - b3.start);
106423
+ return matches2.map((match) => __spreadProps(__spreadValues({}, match), {
106424
+ className: "veSearchLayer"
106425
+ }));
106426
+ }
106352
106427
  const matches = findSequenceMatches(sequence2, searchString, {
106353
106428
  isCircular,
106354
106429
  isAmbiguous: ambiguousOrLiteral === "AMBIGUOUS",
@@ -106373,6 +106448,7 @@ const searchLayersSelector$1 = createSelector(
106373
106448
  (state2) => state2.findTool && state2.findTool.dnaOrAA,
106374
106449
  (state2) => state2.sequenceData.isProtein,
106375
106450
  (state2) => state2.sequenceData.proteinSequence,
106451
+ (state2) => state2.findTool && state2.findTool.mismatchesAllowed,
106376
106452
  searchLayersSelector
106377
106453
  );
106378
106454
  const translationSearchMatchesSelector = createSelector(
@@ -117377,26 +117453,49 @@ function SelectionLayer$2(props) {
117377
117453
  )
117378
117454
  ];
117379
117455
  }
117380
- return [
117381
- /* @__PURE__ */ React.createElement(
117456
+ const selectionElement = /* @__PURE__ */ React.createElement(
117457
+ "div",
117458
+ {
117459
+ onClick: _onClick,
117460
+ title: selectionMessage,
117461
+ onContextMenu: onSelectionContextMenu,
117462
+ key,
117463
+ className: classNameToPass + " veSelectionLayer veRowViewSelectionLayer notCaret " + (isTrueStart ? " isTrueStart " : "") + (isTrueEnd ? " isTrueEnd " : ""),
117464
+ style: __spreadProps(__spreadValues({
117465
+ width,
117466
+ left: leftMargin + xStart
117467
+ }, style2), {
117468
+ background: color2 || topLevelColor,
117469
+ height
117470
+ })
117471
+ }
117472
+ );
117473
+ let mismatchElements = [];
117474
+ if (selectionLayer2.mismatchPositions && selectionLayer2.mismatchPositions.length > 0) {
117475
+ const relativeToOverlap = selectionLayer2.mismatchPositions.filter((pos) => {
117476
+ const absPos = pos + selectionLayer2.start;
117477
+ return absPos >= overlap.start && absPos <= overlap.end;
117478
+ }).map((pos) => {
117479
+ return pos - (overlap.start - selectionLayer2.start);
117480
+ });
117481
+ mismatchElements = relativeToOverlap.map((pos, i) => /* @__PURE__ */ React.createElement(
117382
117482
  "div",
117383
117483
  {
117384
- onClick: _onClick,
117385
- title: selectionMessage,
117386
- onContextMenu: onSelectionContextMenu,
117387
- key,
117388
- className: classNameToPass + " veSelectionLayer veRowViewSelectionLayer notCaret " + (isTrueStart ? " isTrueStart " : "") + (isTrueEnd ? " isTrueEnd " : ""),
117389
- style: __spreadProps(__spreadValues({
117390
- width,
117391
- left: leftMargin + xStart
117392
- }, style2), {
117393
- background: color2 || topLevelColor,
117394
- height
117395
- })
117484
+ key: `${key}-mismatch-${i}`,
117485
+ className: "veSelectionLayer veMismatchLayer notCaret",
117486
+ style: {
117487
+ width: charWidth2,
117488
+ left: leftMargin + xStart + pos * charWidth2,
117489
+ top: 0,
117490
+ height: height || "100%",
117491
+ background: "red",
117492
+ position: "absolute",
117493
+ opacity: 0.5
117494
+ }
117396
117495
  }
117397
- ),
117398
- ...caretSvgs
117399
- ];
117496
+ ));
117497
+ }
117498
+ return [selectionElement, ...mismatchElements, ...caretSvgs];
117400
117499
  });
117401
117500
  } else {
117402
117501
  return null;
@@ -122269,7 +122368,7 @@ function showFileDialog({ multiple = false, onSelect }) {
122269
122368
  input.click();
122270
122369
  }
122271
122370
  __name(showFileDialog, "showFileDialog");
122272
- const version = "0.7.28";
122371
+ const version = "0.7.29";
122273
122372
  const packageJson = {
122274
122373
  version
122275
122374
  };
@@ -149095,6 +149194,7 @@ const _FindBar = class _FindBar extends React.Component {
149095
149194
  annotationVisibilityShow: annotationVisibilityShow2,
149096
149195
  updateAmbiguousOrLiteral: updateAmbiguousOrLiteral2,
149097
149196
  updateDnaOrAA: updateDnaOrAA2,
149197
+ updateMismatchesAllowed: updateMismatchesAllowed2,
149098
149198
  updateMatchNumber: _updateMatchNumber,
149099
149199
  selectionLayerUpdate: selectionLayerUpdate2,
149100
149200
  annotationSearchMatches,
@@ -149107,6 +149207,7 @@ const _FindBar = class _FindBar extends React.Component {
149107
149207
  ambiguousOrLiteral,
149108
149208
  matchesTotal = 0,
149109
149209
  matchNumber = 0,
149210
+ mismatchesAllowed = 0,
149110
149211
  isInline
149111
149212
  } = findTool2;
149112
149213
  const updateMatchNumber2 = /* @__PURE__ */ __name((...args) => {
@@ -149146,6 +149247,30 @@ const _FindBar = class _FindBar extends React.Component {
149146
149247
  }, "onChange")
149147
149248
  }
149148
149249
  ), /* @__PURE__ */ React.createElement(InfoHelper, { style: { marginLeft: 10 } }, /* @__PURE__ */ React.createElement("div", null, "Ambiguous substitutions:", /* @__PURE__ */ React.createElement("div", { style: { display: "flex", fontSize: 12 } }, /* @__PURE__ */ React.createElement("div", { style: { marginRight: 20 } }, /* @__PURE__ */ React.createElement("div", { style: { fontSize: 14, marginBottom: 4, marginTop: 5 } }, "DNA:"), /* @__PURE__ */ React.createElement("div", null, "M: AC"), /* @__PURE__ */ React.createElement("div", null, "R: AG"), /* @__PURE__ */ React.createElement("div", null, "W: AT"), /* @__PURE__ */ React.createElement("div", null, "S: CG"), /* @__PURE__ */ React.createElement("div", null, "Y: CT"), /* @__PURE__ */ React.createElement("div", null, "K: GT"), /* @__PURE__ */ React.createElement("div", null, "V: ACG"), /* @__PURE__ */ React.createElement("div", null, "H: ACT"), /* @__PURE__ */ React.createElement("div", null, "D: AGT"), /* @__PURE__ */ React.createElement("div", null, "B: CGT"), /* @__PURE__ */ React.createElement("div", null, "X: GATC"), /* @__PURE__ */ React.createElement("div", null, "N: GATC"), /* @__PURE__ */ React.createElement("div", null, "*: any")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { style: { fontSize: 14, marginBottom: 4, marginTop: 5 } }, "AA:"), /* @__PURE__ */ React.createElement("div", null, "B: ND"), /* @__PURE__ */ React.createElement("div", null, "J: IL"), /* @__PURE__ */ React.createElement("div", null, "X: ACDEFGHIKLMNPQRSTVWY"), /* @__PURE__ */ React.createElement("div", null, "Z: QE"), /* @__PURE__ */ React.createElement("div", null, "*: any")))))),
149250
+ /* @__PURE__ */ React.createElement(
149251
+ "div",
149252
+ {
149253
+ key: "mismatchesAllowed",
149254
+ style: { marginTop: "8px", display: "flex", alignItems: "center" }
149255
+ },
149256
+ /* @__PURE__ */ React.createElement("label", { style: { marginRight: "8px" } }, "Mismatches Allowed:"),
149257
+ /* @__PURE__ */ React.createElement(
149258
+ core.NumericInput,
149259
+ {
149260
+ min: 0,
149261
+ max: 10,
149262
+ className: "tg-mismatches-allowed-input",
149263
+ style: { width: "60px" },
149264
+ value: mismatchesAllowed,
149265
+ disabled: dnaOrAA !== "DNA" || ambiguousOrLiteral !== "LITERAL",
149266
+ onValueChange: /* @__PURE__ */ __name((value) => {
149267
+ const newValue = Math.max(0, parseInt(value, 10) || 0);
149268
+ updateMismatchesAllowed2(newValue);
149269
+ }, "onValueChange")
149270
+ }
149271
+ ),
149272
+ /* @__PURE__ */ React.createElement(InfoHelper, { style: { marginLeft: 10 } }, /* @__PURE__ */ React.createElement("div", null, "Number of mismatches allowed when searching DNA sequences with literal matching.", /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("br", null), "Higher values may slow down search performance."))
149273
+ ),
149149
149274
  /* @__PURE__ */ React.createElement(
149150
149275
  core.Switch,
149151
149276
  {