ketcher-react 3.8.0-rc.1 → 3.8.0-rc.3

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/dist/cjs/index.js CHANGED
@@ -3850,7 +3850,7 @@ var zoom = {
3850
3850
 
3851
3851
  var openHelpLink = function openHelpLink() {
3852
3852
  var _window$open;
3853
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.8.0-rc.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3853
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.8.0-rc.3\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3854
3854
  };
3855
3855
  var help = {
3856
3856
  help: {
@@ -24331,8 +24331,9 @@ var HoverIcon = function () {
24331
24331
  }, {
24332
24332
  key: "isOverLoader",
24333
24333
  value: function isOverLoader(event) {
24334
+ var _target$classList;
24334
24335
  var target = (event === null || event === void 0 ? void 0 : event.relatedTarget) || event.target;
24335
- return target === null || target === void 0 ? void 0 : target.classList.contains('loading-spinner');
24336
+ return target === null || target === void 0 || (_target$classList = target.classList) === null || _target$classList === void 0 ? void 0 : _target$classList.contains('loading-spinner');
24336
24337
  }
24337
24338
  }, {
24338
24339
  key: "onMouseMove",
@@ -25406,9 +25407,20 @@ var Editor$3 = function () {
25406
25407
  var selectionInvalid = selection.atoms.some(function (atomId) {
25407
25408
  var atom = _this.render.ctab.molecule.atoms.get(atomId);
25408
25409
  assert_1(atom);
25409
- return atom.sgs.size > 0 || atom.attachmentPoints !== null || atom.rglabel !== null && atom.neighbors.length > 1 || _this.render.ctab.molecule.rgroups.some(function (rgroup) {
25410
+ var sgs = atom.sgs,
25411
+ attachmentPoints = atom.attachmentPoints,
25412
+ rglabel = atom.rglabel,
25413
+ neighbors = atom.neighbors,
25414
+ label = atom.label;
25415
+ var belongsToSGroup = sgs.size > 0;
25416
+ var isAttachmentPoint = attachmentPoints !== null;
25417
+ var isNonTerminalRGroupLabel = rglabel !== null && neighbors.length > 1;
25418
+ var hasMultipleRGroupLabel = rglabel !== null && !ketcherCore.isSingleRGroupAttachmentPoint(Number(rglabel));
25419
+ var belongsToRGroup = _this.render.ctab.molecule.rgroups.some(function (rgroup) {
25410
25420
  return rgroup.frags.has(atom.fragment);
25411
- }) || ketcherCore.genericsList.includes(atom.label);
25421
+ });
25422
+ var isExtendedTableAtom = ketcherCore.genericsList.includes(label);
25423
+ return belongsToSGroup || isAttachmentPoint || isNonTerminalRGroupLabel || hasMultipleRGroupLabel || belongsToRGroup || isExtendedTableAtom;
25412
25424
  });
25413
25425
  if (selectionInvalid) {
25414
25426
  return false;
@@ -25437,11 +25449,24 @@ var Editor$3 = function () {
25437
25449
  potentialLeavingAtoms.push(bond.begin);
25438
25450
  }
25439
25451
  });
25452
+ selectionAtoms.forEach(function (selectionAtomId) {
25453
+ var selectionAtom = currentStruct.atoms.get(selectionAtomId);
25454
+ assert_1(selectionAtom);
25455
+ if (selectionAtom.neighbors.length === 1 && !_.isNumber(selectionAtom.rglabel)) {
25456
+ potentialLeavingAtoms.push(selectionAtomId);
25457
+ }
25458
+ });
25440
25459
  var totalPotentialLeavingAtoms = terminalRGroupAtoms.length + potentialLeavingAtoms.length;
25441
25460
  if (totalPotentialLeavingAtoms > 8) {
25442
25461
  return false;
25443
25462
  }
25444
- this.terminalRGroupAtoms = terminalRGroupAtoms;
25463
+ this.terminalRGroupAtoms = terminalRGroupAtoms.map(function (atomId) {
25464
+ var atom = currentStruct.atoms.get(atomId);
25465
+ assert_1(atom);
25466
+ assert_1(atom.rglabel);
25467
+ var attachmentPointLabel = ketcherCore.getAttachmentPointLabelWithBinaryShift(Number(atom.rglabel));
25468
+ return [atomId, attachmentPointLabel];
25469
+ });
25445
25470
  this.potentialLeavingAtoms = potentialLeavingAtoms;
25446
25471
  return terminalRGroupAtoms.length > 0 || potentialLeavingAtoms.length > 0;
25447
25472
  }
@@ -25466,47 +25491,102 @@ var Editor$3 = function () {
25466
25491
  _this2.selectedToOriginalAtomsIdMap.set(i, atomId);
25467
25492
  });
25468
25493
  var assignedAttachmentPoints = new Map();
25469
- var potentialAttachmentPoints = new Map();
25470
- this.terminalRGroupAtoms.forEach(function (atomId, i) {
25494
+ var sideTerminalSGroupAtoms = this.terminalRGroupAtoms.filter(function (_ref) {
25495
+ var _ref2 = _slicedToArray__default["default"](_ref, 2),
25496
+ attachmentPointLabel = _ref2[1];
25497
+ return attachmentPointLabel !== ketcherCore.AttachmentPointName.R1 && attachmentPointLabel !== ketcherCore.AttachmentPointName.R2;
25498
+ });
25499
+ var sideAttachmentPointsNames = [];
25500
+ for (var i = 0; i < sideTerminalSGroupAtoms.length; i++) {
25501
+ var attachmentPointNumber = i + 3;
25502
+ if (attachmentPointNumber > 8) {
25503
+ break;
25504
+ }
25505
+ sideAttachmentPointsNames = sideAttachmentPointsNames.concat(ketcherCore.getAttachmentPointLabel(attachmentPointNumber));
25506
+ }
25507
+ var terminalRGroupAtomsSortedByLabel = _toConsumableArray__default["default"](this.terminalRGroupAtoms).sort(function (_ref3, _ref4) {
25508
+ var _ref5 = _slicedToArray__default["default"](_ref3, 2),
25509
+ labelA = _ref5[1];
25510
+ var _ref6 = _slicedToArray__default["default"](_ref4, 2),
25511
+ labelB = _ref6[1];
25512
+ var labelANumber = ketcherCore.getAttachmentPointNumberFromLabel(labelA);
25513
+ var labelBNumber = ketcherCore.getAttachmentPointNumberFromLabel(labelB);
25514
+ return labelANumber - labelBNumber;
25515
+ });
25516
+ terminalRGroupAtomsSortedByLabel.forEach(function (_ref7) {
25471
25517
  var _selectedStruct$halfB;
25518
+ var _ref8 = _slicedToArray__default["default"](_ref7, 2),
25519
+ atomId = _ref8[0],
25520
+ attachmentPointLabel = _ref8[1];
25472
25521
  var selectedStructLeavingAtomId = originalToSelectedAtomsIdMap.get(atomId);
25473
25522
  assert_1(selectedStructLeavingAtomId !== undefined);
25474
25523
  var selectedStructLeavingAtom = selectedStruct.atoms.get(selectedStructLeavingAtomId);
25475
25524
  assert_1(selectedStructLeavingAtom);
25525
+ assert_1(selectedStructLeavingAtom.rglabel);
25526
+ var attachmentPointName;
25527
+ if (attachmentPointLabel === ketcherCore.AttachmentPointName.R1 || attachmentPointLabel === ketcherCore.AttachmentPointName.R2 || sideAttachmentPointsNames.includes(attachmentPointLabel)) {
25528
+ attachmentPointName = attachmentPointLabel;
25529
+ } else {
25530
+ var assignedAttachmentPointNames = Array.from(assignedAttachmentPoints.keys());
25531
+ attachmentPointName = ketcherCore.getNextFreeAttachmentPoint(assignedAttachmentPointNames, assignedAttachmentPointNames.length < sideAttachmentPointsNames.length);
25532
+ }
25476
25533
  selectedStructLeavingAtom.rglabel = null;
25477
- selectedStructLeavingAtom.label = 'H';
25534
+ selectedStructLeavingAtom.label = ketcherCore.AtomLabel.H;
25478
25535
  var neighborHalfBondId = selectedStructLeavingAtom.neighbors[0];
25479
25536
  var selectedStructAttachmentAtomId = (_selectedStruct$halfB = selectedStruct.halfBonds.get(neighborHalfBondId)) === null || _selectedStruct$halfB === void 0 ? void 0 : _selectedStruct$halfB.end;
25480
- var attachmentPointName = ketcherCore.getAttachmentPointLabel(i + 1);
25481
25537
  assert_1(selectedStructAttachmentAtomId !== undefined);
25482
25538
  assignedAttachmentPoints.set(attachmentPointName, [selectedStructAttachmentAtomId, selectedStructLeavingAtomId]);
25483
25539
  });
25540
+ var selectedPotentialLeavingAtoms = new Map();
25484
25541
  this.potentialLeavingAtoms.forEach(function (atomId) {
25485
- var _selectedStruct$atoms, _selectedStruct$atoms2, _currentStruct$halfBo;
25542
+ var _selectedStruct$atoms, _selectedStruct$atoms2;
25486
25543
  var leavingAtom = currentStruct.atoms.get(atomId);
25487
25544
  assert_1(leavingAtom);
25488
- var selectedStructLeavingAtom = leavingAtom.clone();
25545
+ var attachmentAtomId = -1;
25546
+ leavingAtom.neighbors.forEach(function (halfBondId) {
25547
+ var _selection$atoms3;
25548
+ var halfBond = currentStruct.halfBonds.get(halfBondId);
25549
+ assert_1(halfBond !== undefined);
25550
+ if ((_selection$atoms3 = selection.atoms) !== null && _selection$atoms3 !== void 0 && _selection$atoms3.includes(halfBond.end)) {
25551
+ attachmentAtomId = halfBond.end;
25552
+ }
25553
+ });
25554
+ if (attachmentAtomId === -1) {
25555
+ return;
25556
+ }
25557
+ var originalLeavingAtomId = originalToSelectedAtomsIdMap.get(atomId);
25558
+ var isLeavingAtomSelected = _.isNumber(originalLeavingAtomId);
25559
+ if (isLeavingAtomSelected) {
25560
+ var originalAttachmentAtomId = originalToSelectedAtomsIdMap.get(attachmentAtomId);
25561
+ if (!_.isNumber(originalAttachmentAtomId)) {
25562
+ return;
25563
+ }
25564
+ selectedPotentialLeavingAtoms.set(originalAttachmentAtomId, originalLeavingAtomId);
25565
+ return;
25566
+ }
25567
+ var selectedStructLeavingAtom = new ketcherCore.Atom({
25568
+ label: ketcherCore.AtomLabel.H,
25569
+ pp: leavingAtom.pp
25570
+ });
25489
25571
  selectedStructLeavingAtom.fragment = (_selectedStruct$atoms = (_selectedStruct$atoms2 = selectedStruct.atoms.get(0)) === null || _selectedStruct$atoms2 === void 0 ? void 0 : _selectedStruct$atoms2.fragment) !== null && _selectedStruct$atoms !== void 0 ? _selectedStruct$atoms : 0;
25490
25572
  var selectedStructLeavingAtomId = selectedStruct.atoms.add(selectedStructLeavingAtom);
25491
25573
  _this2.selectedToOriginalAtomsIdMap.set(selectedStructLeavingAtomId, atomId);
25492
- var neighborHalfBondId = leavingAtom === null || leavingAtom === void 0 ? void 0 : leavingAtom.neighbors[0];
25493
- assert_1(neighborHalfBondId !== undefined);
25494
- var attachmentAtomId = (_currentStruct$halfBo = currentStruct.halfBonds.get(neighborHalfBondId)) === null || _currentStruct$halfBo === void 0 ? void 0 : _currentStruct$halfBo.end;
25495
- assert_1(attachmentAtomId !== undefined);
25496
25574
  var selectedStructAttachmentAtomId = originalToSelectedAtomsIdMap.get(attachmentAtomId);
25497
25575
  assert_1(selectedStructAttachmentAtomId !== undefined);
25576
+ _this2.selectedToOriginalAtomsIdMap.set(selectedStructAttachmentAtomId, attachmentAtomId);
25498
25577
  var newBond = new ketcherCore.Bond({
25499
25578
  type: ketcherCore.Bond.PATTERN.TYPE.SINGLE,
25500
25579
  begin: selectedStructAttachmentAtomId,
25501
25580
  end: selectedStructLeavingAtomId
25502
25581
  });
25503
25582
  selectedStruct.bonds.add(newBond);
25504
- potentialAttachmentPoints.set(selectedStructAttachmentAtomId, selectedStructLeavingAtomId);
25505
- _this2.selectedToOriginalAtomsIdMap.set(selectedStructAttachmentAtomId, attachmentAtomId);
25583
+ var assignedAttachmentPointNames = Array.from(assignedAttachmentPoints.keys());
25584
+ var attachmentPointName = ketcherCore.getNextFreeAttachmentPoint(assignedAttachmentPointNames, assignedAttachmentPointNames.length < sideAttachmentPointsNames.length);
25585
+ assignedAttachmentPoints.set(attachmentPointName, [selectedStructAttachmentAtomId, selectedStructLeavingAtomId]);
25506
25586
  });
25507
25587
  this.monomerCreationState = {
25508
25588
  assignedAttachmentPoints: assignedAttachmentPoints,
25509
- potentialAttachmentPoints: potentialAttachmentPoints
25589
+ potentialAttachmentPoints: selectedPotentialLeavingAtoms
25510
25590
  };
25511
25591
  this.originalStruct = currentStruct;
25512
25592
  this.struct(selectedStruct);
@@ -25543,8 +25623,6 @@ var Editor$3 = function () {
25543
25623
  leavingAtomId = _atomPairForLeavingGr2[1];
25544
25624
  var leavingAtom = this.render.ctab.molecule.atoms.get(leavingAtomId);
25545
25625
  assert_1(leavingAtom);
25546
- leavingAtom.label = 'H';
25547
- this.render.ctab.molecule.calcImplicitHydrogen(leavingAtomId);
25548
25626
  var attachmentPointName = ketcherCore.getNextFreeAttachmentPoint(Array.from(this.monomerCreationState.assignedAttachmentPoints.keys()));
25549
25627
  this.monomerCreationState.assignedAttachmentPoints.set(attachmentPointName, atomPairForLeavingGroup);
25550
25628
  this.monomerCreationState.potentialAttachmentPoints["delete"](attachmentAtomId);
@@ -25564,8 +25642,8 @@ var Editor$3 = function () {
25564
25642
  }, {
25565
25643
  key: "saveNewMonomer",
25566
25644
  value: function saveNewMonomer(data) {
25567
- var _this$originalSelecti,
25568
- _this3 = this;
25645
+ var _this3 = this,
25646
+ _this$originalSelecti;
25569
25647
  if (!this.monomerCreationState) {
25570
25648
  throw new Error('Monomer creation wizard is not active, cannot save new monomer');
25571
25649
  }
@@ -25576,10 +25654,10 @@ var Editor$3 = function () {
25576
25654
  type = data.type,
25577
25655
  naturalAnalogue = data.naturalAnalogue;
25578
25656
  var attachmentPoints = [];
25579
- this.monomerCreationState.assignedAttachmentPoints.forEach(function (_ref, attachmentPointName) {
25580
- var _ref2 = _slicedToArray__default["default"](_ref, 2),
25581
- attachmentAtomId = _ref2[0],
25582
- leavingAtomId = _ref2[1];
25657
+ this.monomerCreationState.assignedAttachmentPoints.forEach(function (_ref9, attachmentPointName) {
25658
+ var _ref10 = _slicedToArray__default["default"](_ref9, 2),
25659
+ attachmentAtomId = _ref10[0],
25660
+ leavingAtomId = _ref10[1];
25583
25661
  var attachmentPoint = {
25584
25662
  attachmentAtom: attachmentAtomId,
25585
25663
  leavingGroup: {
@@ -25618,6 +25696,20 @@ var Editor$3 = function () {
25618
25696
  Monomer = _monomerFactory2[0];
25619
25697
  var monomerPosition = new ketcherCore.Vec2((this.selectionBBox.min.x + this.selectionBBox.max.x) / 2, (this.selectionBBox.min.y + this.selectionBBox.max.y) / 2);
25620
25698
  var monomer = new Monomer(monomerItem, monomerPosition);
25699
+ var finalAttachmentPoints = this.monomerCreationState.assignedAttachmentPoints;
25700
+ finalAttachmentPoints.forEach(function (atomPair) {
25701
+ var _atomPair2 = _slicedToArray__default["default"](atomPair, 2),
25702
+ leavingAtomId = _atomPair2[1];
25703
+ var leavingAtom = _this3.struct().atoms.get(leavingAtomId);
25704
+ assert_1(leavingAtom);
25705
+ var originalLeavingAtomId = _this3.selectedToOriginalAtomsIdMap.get(leavingAtomId);
25706
+ assert_1(_.isNumber(originalLeavingAtomId));
25707
+ var originalLeavingAtom = _this3.originalStruct.atoms.get(originalLeavingAtomId);
25708
+ assert_1(originalLeavingAtom);
25709
+ originalLeavingAtom.rglabel = null;
25710
+ originalLeavingAtom.label = leavingAtom.label;
25711
+ _this3.originalStruct.calcImplicitHydrogen(originalLeavingAtomId);
25712
+ });
25621
25713
  this.closeMonomerCreationWizard();
25622
25714
  (_this$originalSelecti = this.originalSelection.atoms) === null || _this$originalSelecti === void 0 || _this$originalSelecti.forEach(function (atomId) {
25623
25715
  var atom = _this3.render.ctab.molecule.atoms.get(atomId);
@@ -25626,9 +25718,19 @@ var Editor$3 = function () {
25626
25718
  }
25627
25719
  });
25628
25720
  var sGroupAttachmentPoints = ketcherCore.MacromoleculesConverter.convertMonomerAttachmentPointsToSGroupAttachmentPoints(monomer, this.selectedToOriginalAtomsIdMap);
25721
+ sGroupAttachmentPoints.forEach(function (ap) {
25722
+ _this3.render.ctab.molecule.bonds.forEach(function (bond) {
25723
+ var _this3$originalSelect, _this3$originalSelect2;
25724
+ if ((bond.begin === ap.atomId || bond.end === ap.atomId) && (!((_this3$originalSelect = _this3.originalSelection.atoms) !== null && _this3$originalSelect !== void 0 && _this3$originalSelect.includes(bond.begin)) || !((_this3$originalSelect2 = _this3.originalSelection.atoms) !== null && _this3$originalSelect2 !== void 0 && _this3$originalSelect2.includes(bond.end)))) {
25725
+ bond.beginSuperatomAttachmentPointNumber = ap.attachmentPointNumber;
25726
+ }
25727
+ });
25728
+ });
25629
25729
  var action = ketcherCore.fromSgroupAddition(this.render.ctab, ketcherCore.SGroup.TYPES.SUP, this.originalSelection.atoms, {
25630
25730
  expanded: true
25631
25731
  }, this.render.ctab.molecule.sgroups.newId(), sGroupAttachmentPoints, monomer.position, true, monomer.monomerItem.props.MonomerName, null, monomer);
25732
+ this.render.ctab.molecule.clearFragments();
25733
+ this.render.ctab.molecule.markFragments();
25632
25734
  this.update(action);
25633
25735
  var templateRoot = monomerTemplate.root,
25634
25736
  templateData = _objectWithoutProperties__default["default"](monomerTemplate, _excluded$p);
@@ -25677,6 +25779,21 @@ var Editor$3 = function () {
25677
25779
  this.monomerCreationState = Object.assign({}, this.monomerCreationState);
25678
25780
  this.render.update(true);
25679
25781
  }
25782
+ }, {
25783
+ key: "cleanupCloseAttachmentPointEditPopup",
25784
+ value: function cleanupCloseAttachmentPointEditPopup() {
25785
+ assert_1(this.monomerCreationState);
25786
+ this.monomerCreationState.clickedAttachmentPoint = null;
25787
+ this.render.update(true);
25788
+ }
25789
+ }, {
25790
+ key: "setProblematicAttachmentPoints",
25791
+ value: function setProblematicAttachmentPoints(problematicPoints) {
25792
+ assert_1(this.monomerCreationState);
25793
+ this.monomerCreationState.problematicAttachmentPoints = problematicPoints;
25794
+ this.monomerCreationState = Object.assign({}, this.monomerCreationState);
25795
+ this.render.update(true);
25796
+ }
25680
25797
  }, {
25681
25798
  key: "selection",
25682
25799
  value: function selection(ci) {
@@ -26096,10 +26213,10 @@ function domEventSetup(editor, clientArea) {
26096
26213
  eventName: 'mouseover',
26097
26214
  toolEventHandler: 'mouseover'
26098
26215
  }];
26099
- trackedDomEvents.forEach(function (_ref3) {
26100
- var target = _ref3.target,
26101
- eventName = _ref3.eventName,
26102
- toolEventHandler = _ref3.toolEventHandler;
26216
+ trackedDomEvents.forEach(function (_ref11) {
26217
+ var target = _ref11.target,
26218
+ eventName = _ref11.eventName,
26219
+ toolEventHandler = _ref11.toolEventHandler;
26103
26220
  editor.event[eventName] = new subscription.DOMSubscription();
26104
26221
  var subs = editor.event[eventName];
26105
26222
  target.addEventListener(eventName, function () {
@@ -26473,7 +26590,7 @@ var useMakeLeavingGroupAtomMenuItem = function useMakeLeavingGroupAtomMenuItem(_
26473
26590
  var attachmentPointName = Array.from(assignedAttachmentPoints.keys()).find(function (key) {
26474
26591
  var atomsPair = assignedAttachmentPoints.get(key);
26475
26592
  assert_1(atomsPair);
26476
- return atomsPair.includes(selectedAtomId);
26593
+ return atomsPair[1] === selectedAtomId;
26477
26594
  });
26478
26595
  var isAtomAssignedAttachmentPoint = Boolean(attachmentPointName);
26479
26596
  if (!isAtomPotentialAttachmentPoint && !isAtomAssignedAttachmentPoint) {
@@ -26504,20 +26621,22 @@ var useMakeLeavingGroupAtomMenuItem = function useMakeLeavingGroupAtomMenuItem(_
26504
26621
  };
26505
26622
  return isAtomAssignedAttachmentPoint ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
26506
26623
  children: [jsxRuntime.jsxs(reactContexify.Item, {
26624
+ "data-testid": "edit-connection-point",
26625
+ onClick: handleEditClick,
26507
26626
  children: [jsxRuntime.jsx(Icon, {
26508
26627
  name: "editMenu",
26509
- className: styles$m.icon,
26510
- onClick: handleEditClick
26628
+ className: styles$m.icon
26511
26629
  }), "Edit connection point"]
26512
26630
  }), jsxRuntime.jsxs(reactContexify.Item, {
26631
+ "data-testid": "remove-assignment",
26632
+ onClick: handleRemoveClick,
26513
26633
  children: [jsxRuntime.jsx(Icon, {
26514
26634
  name: "deleteMenu",
26515
- className: styles$m.icon,
26516
- onClick: handleRemoveClick
26635
+ className: styles$m.icon
26517
26636
  }), "Remove assignment"]
26518
26637
  })]
26519
26638
  }) : jsxRuntime.jsxs(reactContexify.Item, _objectSpread$S(_objectSpread$S({}, props), {}, {
26520
- "data-testid": "Assign as a leaving group",
26639
+ "data-testid": "assign-as-a-leaving-group",
26521
26640
  onClick: handleMakeLeavingGroupAtomClick,
26522
26641
  disabled: attachmentPointsLimitReached,
26523
26642
  children: [jsxRuntime.jsx(Icon, {
@@ -28618,20 +28737,23 @@ var attachmentPointNameOptions = Array.from({
28618
28737
  };
28619
28738
  });
28620
28739
  var attachmentPointAtomOptions = [{
28621
- value: 'H',
28740
+ value: ketcherCore.AtomLabel.H,
28622
28741
  label: 'H'
28623
28742
  }, {
28624
- value: 'O',
28743
+ value: ketcherCore.AtomLabel.O,
28625
28744
  label: 'OH'
28626
28745
  }, {
28627
- value: 'N',
28746
+ value: ketcherCore.AtomLabel.N,
28628
28747
  label: 'NH2'
28629
28748
  }, {
28630
- value: 'Cl',
28749
+ value: ketcherCore.AtomLabel.Cl,
28631
28750
  label: 'Cl'
28632
28751
  }, {
28633
- value: 'F',
28752
+ value: ketcherCore.AtomLabel.F,
28634
28753
  label: 'F'
28754
+ }, {
28755
+ value: ketcherCore.AtomLabel.C,
28756
+ label: 'CH3'
28635
28757
  }];
28636
28758
  var AttachmentPointEditPopup = function AttachmentPointEditPopup(_ref) {
28637
28759
  var data = _ref.data,
@@ -28723,7 +28845,8 @@ var styles$f = {"attachmentPoint":"AttachmentPoint-module_attachmentPoint__6KD5K
28723
28845
 
28724
28846
  var AttachmentPoint = function AttachmentPoint(_ref) {
28725
28847
  var name = _ref.name,
28726
- atomLabel = _ref.atomLabel;
28848
+ atomLabel = _ref.atomLabel,
28849
+ implicitH = _ref.implicitH;
28727
28850
  return jsxRuntime.jsx("div", {
28728
28851
  className: styles$f.attachmentPoint,
28729
28852
  children: jsxRuntime.jsxs("p", {
@@ -28731,7 +28854,13 @@ var AttachmentPoint = function AttachmentPoint(_ref) {
28731
28854
  children: [jsxRuntime.jsx("span", {
28732
28855
  className: styles$f.attachmentPointIndex,
28733
28856
  children: name
28734
- }), "\xA0(", atomLabel, ")"]
28857
+ }), "\xA0", jsxRuntime.jsxs("span", {
28858
+ children: ["(", implicitH > 1 && jsxRuntime.jsxs(jsxRuntime.Fragment, {
28859
+ children: ["H", jsxRuntime.jsx("sub", {
28860
+ children: implicitH
28861
+ })]
28862
+ }), atomLabel, ")"]
28863
+ })]
28735
28864
  })
28736
28865
  });
28737
28866
  };
@@ -28858,31 +28987,50 @@ var validateInputs = function validateInputs(values) {
28858
28987
  };
28859
28988
  var validateAttachmentPoints = function validateAttachmentPoints(attachmentPoints) {
28860
28989
  var notifications = new Map();
28990
+ var problematicAttachmentPoints = new Set();
28861
28991
  if (attachmentPoints.length === 0) {
28862
28992
  notifications.set('noAttachmentPoints', {
28863
28993
  type: 'error',
28864
28994
  message: NotificationMessages.noAttachmentPoints
28865
28995
  });
28866
- return notifications;
28996
+ return {
28997
+ notifications: notifications,
28998
+ problematicAttachmentPoints: problematicAttachmentPoints
28999
+ };
28867
29000
  }
28868
- var attachmentPointNumbers = attachmentPoints.map(ketcherCore.getAttachmentPointNumberFromLabel);
28869
- attachmentPointNumbers.sort(function (a, b) {
28870
- return a - b;
29001
+ var sideAttachmentPoints = attachmentPoints.filter(function (attachmentPointName) {
29002
+ var pointNumber = ketcherCore.getAttachmentPointNumberFromLabel(attachmentPointName);
29003
+ return pointNumber > 2;
28871
29004
  });
28872
- var startingIndex = 0;
28873
- while (attachmentPointNumbers[startingIndex] <= 2) {
28874
- startingIndex++;
29005
+ if (sideAttachmentPoints.length === 0) {
29006
+ return {
29007
+ notifications: notifications,
29008
+ problematicAttachmentPoints: problematicAttachmentPoints
29009
+ };
28875
29010
  }
28876
- for (var i = startingIndex; i < attachmentPointNumbers.length; i++) {
28877
- if (attachmentPointNumbers[i] - attachmentPointNumbers[i - 1] > 1) {
28878
- notifications.set('incorrectAttachmentPointsOrder', {
28879
- type: 'error',
28880
- message: NotificationMessages.incorrectAttachmentPointsOrder
28881
- });
28882
- break;
29011
+ var expectedSequence = [];
29012
+ for (var i = 3; i < 3 + sideAttachmentPoints.length; i++) {
29013
+ expectedSequence.push(i);
29014
+ }
29015
+ var actualNumbers = sideAttachmentPoints.map(ketcherCore.getAttachmentPointNumberFromLabel).sort(function (a, b) {
29016
+ return a - b;
29017
+ });
29018
+ actualNumbers.forEach(function (actualNumber) {
29019
+ if (!expectedSequence.includes(actualNumber)) {
29020
+ var problematicPointName = ketcherCore.getAttachmentPointLabel(actualNumber);
29021
+ problematicAttachmentPoints.add(problematicPointName);
28883
29022
  }
29023
+ });
29024
+ if (problematicAttachmentPoints.size > 0) {
29025
+ notifications.set('incorrectAttachmentPointsOrder', {
29026
+ type: 'error',
29027
+ message: NotificationMessages.incorrectAttachmentPointsOrder
29028
+ });
28884
29029
  }
28885
- return notifications;
29030
+ return {
29031
+ notifications: notifications,
29032
+ problematicAttachmentPoints: problematicAttachmentPoints
29033
+ };
28886
29034
  };
28887
29035
  var MonomerCreationWizard = function MonomerCreationWizard() {
28888
29036
  var _useAppContext = useAppContext(),
@@ -28979,6 +29127,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
28979
29127
  };
28980
29128
  var handleAttachmentPointEditPopupClose = function handleAttachmentPointEditPopupClose() {
28981
29129
  setAttachmentPointEditPopupData(null);
29130
+ editor.cleanupCloseAttachmentPointEditPopup();
28982
29131
  };
28983
29132
  var handleDiscard = function handleDiscard() {
28984
29133
  editor.closeMonomerCreationWizard();
@@ -29003,12 +29152,15 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
29003
29152
  return;
29004
29153
  }
29005
29154
  assert_1(editor.monomerCreationState);
29006
- var attachmentPointsNotifications = validateAttachmentPoints(Array.from(editor.monomerCreationState.assignedAttachmentPoints.keys()));
29155
+ var _validateAttachmentPo = validateAttachmentPoints(Array.from(editor.monomerCreationState.assignedAttachmentPoints.keys())),
29156
+ attachmentPointsNotifications = _validateAttachmentPo.notifications,
29157
+ problematicAttachmentPoints = _validateAttachmentPo.problematicAttachmentPoints;
29007
29158
  if (attachmentPointsNotifications.size > 0) {
29008
29159
  wizardStateDispatch({
29009
29160
  type: 'SetNotifications',
29010
29161
  notifications: attachmentPointsNotifications
29011
29162
  });
29163
+ editor.setProblematicAttachmentPoints(problematicAttachmentPoints);
29012
29164
  return;
29013
29165
  }
29014
29166
  editor.saveNewMonomer({
@@ -29018,6 +29170,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
29018
29170
  naturalAnalogue: naturalAnalogue
29019
29171
  });
29020
29172
  resetWizard();
29173
+ editor.setProblematicAttachmentPoints(new Set());
29021
29174
  };
29022
29175
  var monomerCreationState = reactRedux.useSelector(editorMonomerCreationStateSelector);
29023
29176
  if (!monomerCreationState) {
@@ -29033,12 +29186,14 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
29033
29186
  if (!atom) {
29034
29187
  return {
29035
29188
  name: attachmentPointName,
29036
- atomLabel: 'H'
29189
+ atomLabel: 'H',
29190
+ implicitH: 0
29037
29191
  };
29038
29192
  }
29039
29193
  return {
29040
29194
  name: attachmentPointName,
29041
- atomLabel: atom.label
29195
+ atomLabel: atom.label,
29196
+ implicitH: atom.implicitH
29042
29197
  };
29043
29198
  });
29044
29199
  var ketcherEditorRootElement = document.querySelector(KETCHER_ROOT_NODE_CSS_SELECTOR);
@@ -29138,10 +29293,12 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
29138
29293
  className: styles$l.attachmentPoints,
29139
29294
  children: attachmentPointsData.map(function (_ref5) {
29140
29295
  var name = _ref5.name,
29141
- atomLabel = _ref5.atomLabel;
29296
+ atomLabel = _ref5.atomLabel,
29297
+ implicitH = _ref5.implicitH;
29142
29298
  return jsxRuntime.jsx(AttachmentPoint, {
29143
29299
  name: name,
29144
- atomLabel: atomLabel
29300
+ atomLabel: atomLabel,
29301
+ implicitH: implicitH
29145
29302
  }, name);
29146
29303
  })
29147
29304
  })]
@@ -37152,8 +37309,8 @@ var KetcherBuilder = function () {
37152
37309
  cleanup = initApp(prevKetcherId, ketcherId, element, appRoot, staticResourcesUrl, {
37153
37310
  buttons: buttons || {},
37154
37311
  errorHandler: errorHandler || null,
37155
- version: "3.8.0-rc.1" ,
37156
- buildDate: "2025-09-03T08:19:34" ,
37312
+ version: "3.8.0-rc.3" ,
37313
+ buildDate: "2025-09-16T18:11:14" ,
37157
37314
  buildNumber: '',
37158
37315
  customButtons: customButtons || []
37159
37316
  }, structService, resolve, togglerComponent);
@@ -37448,7 +37605,7 @@ var ModeControl = function ModeControl(_ref3) {
37448
37605
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
37449
37606
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
37450
37607
  var MacromoleculesEditorComponent = React.lazy(function () {
37451
- return Promise.resolve().then(function () { return require('./index.modern-e42372a4.js'); });
37608
+ return Promise.resolve().then(function () { return require('./index.modern-38b83c77.js'); });
37452
37609
  });
37453
37610
  var Editor = function Editor(props) {
37454
37611
  var _useState = React.useState(false),