microboard-temp 0.4.59 → 0.4.61

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.
@@ -801,8 +801,8 @@ class BoardCommand {
801
801
  switch (operation.method) {
802
802
  case "bringToFront": {
803
803
  for (const id in operation.prevZIndex) {
804
- const item2 = this.board.items.getById(id);
805
- if (!item2) {
804
+ const item = this.board.items.getById(id);
805
+ if (!item) {
806
806
  delete operation.prevZIndex.id;
807
807
  }
808
808
  }
@@ -814,8 +814,8 @@ class BoardCommand {
814
814
  }
815
815
  case "sendToBack": {
816
816
  for (const id in operation.prevZIndex) {
817
- const item2 = this.board.items.getById(id);
818
- if (!item2) {
817
+ const item = this.board.items.getById(id);
818
+ if (!item) {
819
819
  delete operation.prevZIndex.id;
820
820
  }
821
821
  }
@@ -829,11 +829,11 @@ class BoardCommand {
829
829
  case "moveSecondBeforeFirst":
830
830
  case "moveToZIndex": {
831
831
  const items = this.board.items;
832
- const item2 = items.getById(operation.item);
833
- if (!item2) {
832
+ const item = items.getById(operation.item);
833
+ if (!item) {
834
834
  throw new Error("Get reverse board operation. Item not found");
835
835
  }
836
- const zIndex = this.board.getZIndex(item2);
836
+ const zIndex = this.board.getZIndex(item);
837
837
  return {
838
838
  class: "Board",
839
839
  method: "moveToZIndex",
@@ -843,8 +843,8 @@ class BoardCommand {
843
843
  }
844
844
  case "moveManyToZIndex": {
845
845
  for (const id in operation.item) {
846
- const item2 = this.board.items.getById(id);
847
- if (!item2) {
846
+ const item = this.board.items.getById(id);
847
+ if (!item) {
848
848
  delete operation.item.id;
849
849
  }
850
850
  }
@@ -861,15 +861,15 @@ class BoardCommand {
861
861
  const items = this.board.items;
862
862
  const reverse = [];
863
863
  for (const itemId of operation.item) {
864
- const item2 = items.getById(itemId);
865
- if (!item2) {
864
+ const item = items.getById(itemId);
865
+ if (!item) {
866
866
  throw new Error("Get reverse board operation. Item not found");
867
867
  }
868
868
  reverse.push({
869
869
  class: "Board",
870
870
  method: "add",
871
871
  item: itemId,
872
- data: item2.serialize()
872
+ data: item.serialize()
873
873
  });
874
874
  }
875
875
  return reverse;
@@ -892,32 +892,32 @@ class BoardCommand {
892
892
  const items = this.board.items;
893
893
  const reverse = [];
894
894
  for (const itemId of operation.item) {
895
- const item2 = items.getById(itemId);
896
- if (!item2 || item2.itemType !== "Group") {
895
+ const item = items.getById(itemId);
896
+ if (!item || item.itemType !== "Group") {
897
897
  throw new Error("Get reverse board operation. Item not found");
898
898
  }
899
899
  reverse.push({
900
900
  class: "Board",
901
901
  method: "addLockedGroup",
902
902
  item: itemId,
903
- data: item2.serialize()
903
+ data: item.serialize()
904
904
  });
905
905
  }
906
906
  return reverse;
907
907
  }
908
908
  case "duplicate":
909
909
  case "paste": {
910
- const item2 = [];
910
+ const item = [];
911
911
  const map = operation.itemsMap;
912
912
  for (const key in map) {
913
913
  if (map.hasOwnProperty(key)) {
914
- item2.push(key);
914
+ item.push(key);
915
915
  }
916
916
  }
917
917
  return {
918
918
  class: "Board",
919
919
  method: "remove",
920
- item: item2
920
+ item
921
921
  };
922
922
  }
923
923
  }
@@ -7235,11 +7235,11 @@ class SubjectOperation {
7235
7235
  }
7236
7236
 
7237
7237
  // src/Items/ItemsCommandUtils.ts
7238
- function mapItemsByOperation(item2, getCallback) {
7239
- const items = Array.isArray(item2) ? item2 : [item2];
7240
- return items.map((item3) => {
7241
- const operation = getCallback(item3);
7242
- return { item: item3, operation };
7238
+ function mapItemsByOperation(item, getCallback) {
7239
+ const items = Array.isArray(item) ? item : [item];
7240
+ return items.map((item2) => {
7241
+ const operation = getCallback(item2);
7242
+ return { item: item2, operation };
7243
7243
  });
7244
7244
  }
7245
7245
 
@@ -7264,8 +7264,8 @@ class TransformationCommand {
7264
7264
  }
7265
7265
  }
7266
7266
  revert() {
7267
- this.reverse.forEach(({ item: item2, operation }) => {
7268
- item2.apply(operation);
7267
+ this.reverse.forEach(({ item, operation }) => {
7268
+ item.apply(operation);
7269
7269
  });
7270
7270
  }
7271
7271
  getReverse() {
@@ -8007,8 +8007,8 @@ class Path {
8007
8007
  }
8008
8008
  getIntersectionPoints(segment) {
8009
8009
  let intersections = [];
8010
- for (const item2 of this.segments) {
8011
- intersections = intersections.concat(item2.getIntersectionPoints(segment));
8010
+ for (const item of this.segments) {
8011
+ intersections = intersections.concat(item.getIntersectionPoints(segment));
8012
8012
  }
8013
8013
  return intersections;
8014
8014
  }
@@ -8073,8 +8073,8 @@ class Path {
8073
8073
  }
8074
8074
  isOpenEnclosedOrCrossedBy(rectangle) {
8075
8075
  let is = false;
8076
- for (const item2 of this.segments) {
8077
- is = is || item2.isEnclosedOrCrossedBy(rectangle);
8076
+ for (const item of this.segments) {
8077
+ is = is || item.isEnclosedOrCrossedBy(rectangle);
8078
8078
  }
8079
8079
  return is;
8080
8080
  }
@@ -8487,8 +8487,8 @@ class ConnectorCommand {
8487
8487
  }
8488
8488
  }
8489
8489
  revert() {
8490
- for (const { item: item2, operation } of this.reverse) {
8491
- item2.apply(operation);
8490
+ for (const { item, operation } of this.reverse) {
8491
+ item.apply(operation);
8492
8492
  }
8493
8493
  }
8494
8494
  getReverse() {
@@ -8645,11 +8645,11 @@ class SessionStorage {
8645
8645
  }
8646
8646
  get(key) {
8647
8647
  const boardId = this.getBoardId() || "";
8648
- const item2 = _sessionStorage.getItem(boardId + "_" + key);
8649
- if (!item2) {
8648
+ const item = _sessionStorage.getItem(boardId + "_" + key);
8649
+ if (!item) {
8650
8650
  return;
8651
8651
  }
8652
- return JSON.parse(item2);
8652
+ return JSON.parse(item);
8653
8653
  }
8654
8654
  remove(key) {
8655
8655
  const boardId = this.getBoardId() || "";
@@ -9429,8 +9429,8 @@ class LinkToCommand {
9429
9429
  }
9430
9430
  }
9431
9431
  revert() {
9432
- this.reverse.forEach(({ item: item2, operation }) => {
9433
- item2.apply(operation);
9432
+ this.reverse.forEach(({ item, operation }) => {
9433
+ item.apply(operation);
9434
9434
  });
9435
9435
  }
9436
9436
  getReverse() {
@@ -10727,9 +10727,9 @@ function handleSplitListItem(editor) {
10727
10727
  import_slate5.Transforms.insertNodes(editor, {
10728
10728
  type: listType,
10729
10729
  listLevel: listNode.listLevel || 0,
10730
- children: itemsAfter.map((item2) => ({
10730
+ children: itemsAfter.map((item) => ({
10731
10731
  type: "list_item",
10732
- children: item2.children
10732
+ children: item.children
10733
10733
  }))
10734
10734
  }, { at: newListPath });
10735
10735
  }
@@ -12706,10 +12706,10 @@ function initializeDocument(effects) {
12706
12706
  return start;
12707
12707
  function start(code) {
12708
12708
  if (continued < stack.length) {
12709
- const item2 = stack[continued];
12710
- self2.containerState = item2[1];
12711
- ok(item2[0].continuation, "expected `continuation` to be defined on container construct");
12712
- return effects.attempt(item2[0].continuation, documentContinue, checkNewContainers)(code);
12709
+ const item = stack[continued];
12710
+ self2.containerState = item[1];
12711
+ ok(item[0].continuation, "expected `continuation` to be defined on container construct");
12712
+ return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
12713
12713
  }
12714
12714
  return checkNewContainers(code);
12715
12715
  }
@@ -13685,17 +13685,17 @@ class SpliceBuffer {
13685
13685
  this.setCursor(Number.POSITIVE_INFINITY);
13686
13686
  return this.left.pop();
13687
13687
  }
13688
- push(item2) {
13688
+ push(item) {
13689
13689
  this.setCursor(Number.POSITIVE_INFINITY);
13690
- this.left.push(item2);
13690
+ this.left.push(item);
13691
13691
  }
13692
13692
  pushMany(items) {
13693
13693
  this.setCursor(Number.POSITIVE_INFINITY);
13694
13694
  chunkedPush(this.left, items);
13695
13695
  }
13696
- unshift(item2) {
13696
+ unshift(item) {
13697
13697
  this.setCursor(0);
13698
- this.right.push(item2);
13698
+ this.right.push(item);
13699
13699
  }
13700
13700
  unshiftMany(items) {
13701
13701
  this.setCursor(0);
@@ -15726,8 +15726,8 @@ function initializeFactory(field) {
15726
15726
  if (list2) {
15727
15727
  ok(Array.isArray(list2), "expected `disable.null` to be populated");
15728
15728
  while (++index2 < list2.length) {
15729
- const item2 = list2[index2];
15730
- if (!item2.previous || item2.previous.call(self2, self2.previous)) {
15729
+ const item = list2[index2];
15730
+ if (!item.previous || item.previous.call(self2, self2.previous)) {
15731
15731
  return true;
15732
15732
  }
15733
15733
  }
@@ -16558,14 +16558,14 @@ function compiler(options) {
16558
16558
  length++;
16559
16559
  }
16560
16560
  if (event[1].type === types.listItemPrefix) {
16561
- const item2 = {
16561
+ const item = {
16562
16562
  type: "listItem",
16563
16563
  _spread: false,
16564
16564
  start: Object.assign({}, event[1].start),
16565
16565
  end: undefined
16566
16566
  };
16567
- listItem2 = item2;
16568
- events.splice(index2, 0, ["enter", item2, event[2]]);
16567
+ listItem2 = item;
16568
+ events.splice(index2, 0, ["enter", item, event[2]]);
16569
16569
  index2++;
16570
16570
  length++;
16571
16571
  firstBlankLineIndex = undefined;
@@ -17363,14 +17363,14 @@ class MarkdownProcessor {
17363
17363
  if (err || !file) {
17364
17364
  throw err;
17365
17365
  }
17366
- const nodes = file.result.map((item2) => {
17366
+ const nodes = file.result.map((item) => {
17367
17367
  setNodeStyles({
17368
- node: item2,
17368
+ node: item,
17369
17369
  editor: this.editor,
17370
17370
  horisontalAlignment: "left",
17371
- isPaddingTopNeeded: item2.type !== "code_block"
17371
+ isPaddingTopNeeded: item.type !== "code_block"
17372
17372
  });
17373
- return item2;
17373
+ return item;
17374
17374
  });
17375
17375
  if (isNewParagraphNeeded) {
17376
17376
  nodes.push(createParagraphNode("", this.editor));
@@ -18348,8 +18348,8 @@ class ShapeCommand {
18348
18348
  }
18349
18349
  }
18350
18350
  revert() {
18351
- for (const { item: item2, operation } of this.reverse) {
18352
- item2.apply(operation);
18351
+ for (const { item, operation } of this.reverse) {
18352
+ item.apply(operation);
18353
18353
  }
18354
18354
  }
18355
18355
  getReverse() {
@@ -18431,8 +18431,8 @@ class RichTextCommand {
18431
18431
  }
18432
18432
  }
18433
18433
  revert() {
18434
- for (const { item: item2, operation } of this.reverse) {
18435
- const richText = this.board.items.getById(item2);
18434
+ for (const { item, operation } of this.reverse) {
18435
+ const richText = this.board.items.getById(item);
18436
18436
  if (!richText) {
18437
18437
  continue;
18438
18438
  }
@@ -18451,12 +18451,12 @@ class RichTextCommand {
18451
18451
  case "setSelectionFontColor":
18452
18452
  case "setSelectionBlockType":
18453
18453
  const inverseOps = this.operation.ops.map((op) => import_slate34.Operation.inverse(op)).reverse();
18454
- return items.map((item2) => {
18454
+ return items.map((item) => {
18455
18455
  const operation = {
18456
18456
  ...this.operation,
18457
18457
  ops: inverseOps
18458
18458
  };
18459
- return { item: item2, operation };
18459
+ return { item, operation };
18460
18460
  });
18461
18461
  case "setFontColor":
18462
18462
  return items.map((id) => ({
@@ -18548,13 +18548,13 @@ class RichTextGroupCommand {
18548
18548
  this.reverseOps = this.getReverse();
18549
18549
  }
18550
18550
  apply() {
18551
- for (const { item: item2, operation } of this.forwardOps) {
18552
- item2.applyCommand(operation);
18551
+ for (const { item, operation } of this.forwardOps) {
18552
+ item.applyCommand(operation);
18553
18553
  }
18554
18554
  }
18555
18555
  revert() {
18556
- for (const { item: item2, operation } of this.reverseOps) {
18557
- item2.applyCommand(operation);
18556
+ for (const { item, operation } of this.reverseOps) {
18557
+ item.applyCommand(operation);
18558
18558
  }
18559
18559
  }
18560
18560
  getForward() {
@@ -18669,8 +18669,8 @@ class DrawingCommand {
18669
18669
  item;
18670
18670
  operation;
18671
18671
  reverse;
18672
- constructor(item2, operation) {
18673
- this.item = item2;
18672
+ constructor(item, operation) {
18673
+ this.item = item;
18674
18674
  this.operation = operation;
18675
18675
  this.reverse = this.getReverse();
18676
18676
  }
@@ -18679,52 +18679,52 @@ class DrawingCommand {
18679
18679
  return this;
18680
18680
  }
18681
18681
  apply() {
18682
- for (const item2 of this.item) {
18683
- item2.apply(this.operation);
18682
+ for (const item of this.item) {
18683
+ item.apply(this.operation);
18684
18684
  }
18685
18685
  }
18686
18686
  revert() {
18687
- for (const { item: item2, operation } of this.reverse) {
18688
- item2.apply(operation);
18687
+ for (const { item, operation } of this.reverse) {
18688
+ item.apply(operation);
18689
18689
  }
18690
18690
  }
18691
18691
  getReverse() {
18692
18692
  const reverse = [];
18693
- for (const item2 of this.item) {
18694
- reverse.push({ item: item2, operation: this.getReverseOperation(item2) });
18693
+ for (const item of this.item) {
18694
+ reverse.push({ item, operation: this.getReverseOperation(item) });
18695
18695
  }
18696
18696
  return reverse;
18697
18697
  }
18698
- getReverseOperation(item2) {
18698
+ getReverseOperation(item) {
18699
18699
  switch (this.operation.method) {
18700
18700
  case "setStrokeColor":
18701
18701
  return {
18702
18702
  class: "Drawing",
18703
18703
  method: "setStrokeColor",
18704
- item: [item2.getId()],
18705
- color: item2.getStrokeColor()
18704
+ item: [item.getId()],
18705
+ color: item.getStrokeColor()
18706
18706
  };
18707
18707
  case "setStrokeWidth":
18708
18708
  return {
18709
18709
  class: "Drawing",
18710
18710
  method: "setStrokeWidth",
18711
- item: [item2.getId()],
18711
+ item: [item.getId()],
18712
18712
  width: this.operation.prevWidth,
18713
- prevWidth: item2.getStrokeWidth()
18713
+ prevWidth: item.getStrokeWidth()
18714
18714
  };
18715
18715
  case "setStrokeOpacity":
18716
18716
  return {
18717
18717
  class: "Drawing",
18718
18718
  method: "setStrokeOpacity",
18719
- item: [item2.getId()],
18720
- opacity: item2.getStrokeOpacity()
18719
+ item: [item.getId()],
18720
+ opacity: item.getStrokeOpacity()
18721
18721
  };
18722
18722
  case "setStrokeStyle":
18723
18723
  return {
18724
18724
  class: "Drawing",
18725
18725
  method: "setStrokeStyle",
18726
- item: [item2.getId()],
18727
- style: item2.getBorderStyle()
18726
+ item: [item.getId()],
18727
+ style: item.getBorderStyle()
18728
18728
  };
18729
18729
  }
18730
18730
  }
@@ -18746,8 +18746,8 @@ class StickerCommand {
18746
18746
  }
18747
18747
  }
18748
18748
  revert() {
18749
- for (const { item: item2, operation } of this.reverse) {
18750
- item2.apply(operation);
18749
+ for (const { item, operation } of this.reverse) {
18750
+ item.apply(operation);
18751
18751
  }
18752
18752
  }
18753
18753
  getReverse() {
@@ -18779,8 +18779,8 @@ class FrameCommand {
18779
18779
  }
18780
18780
  }
18781
18781
  revert() {
18782
- for (const { item: item2, operation } of this.reverse) {
18783
- item2.apply(operation);
18782
+ for (const { item, operation } of this.reverse) {
18783
+ item.apply(operation);
18784
18784
  }
18785
18785
  }
18786
18786
  getReverse() {
@@ -18822,21 +18822,23 @@ class FrameCommand {
18822
18822
  };
18823
18823
  });
18824
18824
  default:
18825
- const op = this.operation;
18826
- let newData = {};
18827
- if (op.prevData) {
18828
- newData = { ...op.prevData };
18829
- } else {
18830
- Object.keys(op.newData).forEach((key) => {
18831
- if (item[key]) {
18832
- newData[key] = item[key];
18833
- }
18834
- });
18835
- }
18836
- return {
18837
- ...op,
18838
- newData
18839
- };
18825
+ return mapItemsByOperation(frame, (item) => {
18826
+ const op = this.operation;
18827
+ let newData = {};
18828
+ if (op.prevData) {
18829
+ newData = { ...op.prevData };
18830
+ } else {
18831
+ Object.keys(op.newData).forEach((key) => {
18832
+ if (item[key]) {
18833
+ newData[key] = item[key];
18834
+ }
18835
+ });
18836
+ }
18837
+ return {
18838
+ ...op,
18839
+ newData
18840
+ };
18841
+ });
18840
18842
  }
18841
18843
  }
18842
18844
  }
@@ -18857,8 +18859,8 @@ class CommentCommand {
18857
18859
  }
18858
18860
  }
18859
18861
  revert() {
18860
- this.reverse.forEach(({ item: item2, operation }) => {
18861
- item2.apply(operation);
18862
+ this.reverse.forEach(({ item, operation }) => {
18863
+ item.apply(operation);
18862
18864
  });
18863
18865
  }
18864
18866
  getReverse() {
@@ -19320,8 +19322,8 @@ class GroupCommand {
19320
19322
  }
19321
19323
  }
19322
19324
  revert() {
19323
- for (const { item: item2, operation } of this.reverse) {
19324
- item2.apply(operation);
19325
+ for (const { item, operation } of this.reverse) {
19326
+ item.apply(operation);
19325
19327
  }
19326
19328
  }
19327
19329
  getReverse() {
@@ -19374,8 +19376,8 @@ class PlaceholderCommand {
19374
19376
  }
19375
19377
  }
19376
19378
  revert() {
19377
- for (const { item: item2, operation } of this.reverse) {
19378
- item2.apply(operation);
19379
+ for (const { item, operation } of this.reverse) {
19380
+ item.apply(operation);
19379
19381
  }
19380
19382
  }
19381
19383
  getReverse() {
@@ -19469,34 +19471,51 @@ class BaseCommand {
19469
19471
  return this;
19470
19472
  }
19471
19473
  apply() {
19472
- for (const item2 of this.items) {
19473
- item2.apply(this.operation);
19474
+ for (const item of this.items) {
19475
+ item.apply(this.operation);
19474
19476
  }
19475
19477
  }
19476
19478
  revert() {
19477
- for (const { item: item2, operation } of this.reverse) {
19478
- item2.apply(operation);
19479
+ for (const { item, operation } of this.reverse) {
19480
+ item.apply(operation);
19479
19481
  }
19480
19482
  }
19481
19483
  getReverse() {
19482
19484
  const items = this.items;
19483
- return mapItemsByOperation(items, (item2) => {
19484
- const op = this.operation;
19485
- let newData = {};
19486
- if (op.prevData) {
19487
- newData = { ...op.prevData };
19488
- } else {
19489
- Object.keys(op.newData).forEach((key) => {
19490
- if (item2[key]) {
19491
- newData[key] = item2[key];
19485
+ switch (this.operation.method) {
19486
+ case "addChildren":
19487
+ return mapItemsByOperation(items, (item) => {
19488
+ return {
19489
+ ...this.operation,
19490
+ newData: { childIds: item.getChildrenIds() }
19491
+ };
19492
+ });
19493
+ case "removeChildren":
19494
+ return mapItemsByOperation(items, (item) => {
19495
+ return {
19496
+ ...this.operation,
19497
+ newData: { childIds: item.getChildrenIds() }
19498
+ };
19499
+ });
19500
+ default:
19501
+ return mapItemsByOperation(items, (item) => {
19502
+ const op = this.operation;
19503
+ let newData = {};
19504
+ if (op.prevData) {
19505
+ newData = { ...op.prevData };
19506
+ } else {
19507
+ Object.keys(op.newData).forEach((key) => {
19508
+ if (item[key]) {
19509
+ newData[key] = item[key];
19510
+ }
19511
+ });
19492
19512
  }
19513
+ return {
19514
+ ...op,
19515
+ newData
19516
+ };
19493
19517
  });
19494
- }
19495
- return {
19496
- ...op,
19497
- newData
19498
- };
19499
- });
19518
+ }
19500
19519
  }
19501
19520
  }
19502
19521
  var itemCommandFactories = {
@@ -19516,37 +19535,37 @@ var itemCommandFactories = {
19516
19535
  LinkTo: createLinkToCommand
19517
19536
  };
19518
19537
  function createConnectorCommand(items, operation) {
19519
- return new ConnectorCommand(items.filter((item2) => item2.itemType === "Connector"), operation);
19538
+ return new ConnectorCommand(items.filter((item) => item.itemType === "Connector"), operation);
19520
19539
  }
19521
19540
  function createShapeCommand(items, operation) {
19522
- return new ShapeCommand(items.filter((item2) => item2.itemType === "Shape"), operation);
19541
+ return new ShapeCommand(items.filter((item) => item.itemType === "Shape"), operation);
19523
19542
  }
19524
19543
  function createDrawingCommand(items, operation) {
19525
- return new DrawingCommand(items.filter((item2) => item2.itemType === "Drawing"), operation);
19544
+ return new DrawingCommand(items.filter((item) => item.itemType === "Drawing"), operation);
19526
19545
  }
19527
19546
  function createCommentCommand(items, operation) {
19528
- return new CommentCommand(items.filter((item2) => item2.itemType === "Comment"), operation);
19547
+ return new CommentCommand(items.filter((item) => item.itemType === "Comment"), operation);
19529
19548
  }
19530
19549
  function createStickerCommand(items, operation) {
19531
- return new StickerCommand(items.filter((item2) => item2.itemType === "Sticker"), operation);
19550
+ return new StickerCommand(items.filter((item) => item.itemType === "Sticker"), operation);
19532
19551
  }
19533
19552
  function createFrameCommand(items, operation) {
19534
- return new FrameCommand(items.filter((item2) => item2.itemType === "Frame"), operation);
19553
+ return new FrameCommand(items.filter((item) => item.itemType === "Frame"), operation);
19535
19554
  }
19536
19555
  function createPlaceholderCommand(items, operation) {
19537
- return new PlaceholderCommand(items.filter((item2) => item2.itemType === "Placeholder"), operation);
19556
+ return new PlaceholderCommand(items.filter((item) => item.itemType === "Placeholder"), operation);
19538
19557
  }
19539
19558
  function createGroupCommand(items, operation) {
19540
- return new GroupCommand(items.filter((item2) => item2.itemType === "Group"), operation);
19559
+ return new GroupCommand(items.filter((item) => item.itemType === "Group"), operation);
19541
19560
  }
19542
19561
  function createImageCommand(items, operation) {
19543
- return new ImageCommand(items.filter((item2) => item2.itemType === "Image"), operation);
19562
+ return new ImageCommand(items.filter((item) => item.itemType === "Image"), operation);
19544
19563
  }
19545
19564
  function createVideoCommand(items, operation) {
19546
- return new VideoCommand(items.filter((item2) => item2.itemType === "Video"), operation);
19565
+ return new VideoCommand(items.filter((item) => item.itemType === "Video"), operation);
19547
19566
  }
19548
19567
  function createAudioCommand(items, operation) {
19549
- return new AudioCommand(items.filter((item2) => item2.itemType === "Audio"), operation);
19568
+ return new AudioCommand(items.filter((item) => item.itemType === "Audio"), operation);
19550
19569
  }
19551
19570
  function createRichTextCommand(items, operation, board) {
19552
19571
  if (!board) {
@@ -19554,8 +19573,8 @@ function createRichTextCommand(items, operation, board) {
19554
19573
  }
19555
19574
  if (operation.method === "groupEdit") {
19556
19575
  const texts = [];
19557
- for (const { item: item2 } of operation.itemsOps) {
19558
- const found = board.items.findById(item2);
19576
+ for (const { item } of operation.itemsOps) {
19577
+ const found = board.items.findById(item);
19559
19578
  const text3 = found?.getRichText();
19560
19579
  if (text3) {
19561
19580
  texts.push(text3);
@@ -19563,14 +19582,14 @@ function createRichTextCommand(items, operation, board) {
19563
19582
  }
19564
19583
  return new RichTextGroupCommand(texts, operation);
19565
19584
  } else {
19566
- return new RichTextCommand(board, items.map((item2) => item2.getId()), operation);
19585
+ return new RichTextCommand(board, items.map((item) => item.getId()), operation);
19567
19586
  }
19568
19587
  }
19569
19588
  function createTransformationCommand(items, operation) {
19570
- return new TransformationCommand(items.map((item2) => item2.transformation), operation);
19589
+ return new TransformationCommand(items.map((item) => item.transformation), operation);
19571
19590
  }
19572
19591
  function createLinkToCommand(items, operation) {
19573
- return new LinkToCommand(items.map((item2) => item2.linkTo), operation);
19592
+ return new LinkToCommand(items.map((item) => item.linkTo), operation);
19574
19593
  }
19575
19594
  function createCommand(board, operation) {
19576
19595
  try {
@@ -19588,13 +19607,13 @@ function createCommand(board, operation) {
19588
19607
  default: {
19589
19608
  const itemType = operation.class;
19590
19609
  const itemIdList = "item" in operation ? Array.isArray(operation.item) ? operation.item : [operation.item] : ("items" in operation) ? Object.keys(operation.items) : operation.itemsOps.map((itemOp) => itemOp.item);
19591
- const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item2) => {
19592
- if (typeof item2 === "string") {
19593
- console.warn(`Item with ID ${item2} not found for operation ${operation.class}.${operation.method}`);
19610
+ const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item) => {
19611
+ if (typeof item === "string") {
19612
+ console.warn(`Item with ID ${item} not found for operation ${operation.class}.${operation.method}`);
19594
19613
  return false;
19595
19614
  }
19596
- if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item2.itemType !== operation.class) {
19597
- console.warn(`Item with ID ${item2} is not of operation type: ${itemType}.`);
19615
+ if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item.itemType !== operation.class) {
19616
+ console.warn(`Item with ID ${item} is not of operation type: ${itemType}.`);
19598
19617
  return false;
19599
19618
  }
19600
19619
  return true;
@@ -19895,20 +19914,20 @@ class RBush {
19895
19914
  }
19896
19915
  return this;
19897
19916
  }
19898
- insert(item2) {
19899
- if (item2)
19900
- this._insert(item2, this.data.height - 1);
19917
+ insert(item) {
19918
+ if (item)
19919
+ this._insert(item, this.data.height - 1);
19901
19920
  return this;
19902
19921
  }
19903
19922
  clear() {
19904
19923
  this.data = createNode([]);
19905
19924
  return this;
19906
19925
  }
19907
- remove(item2, equalsFn) {
19908
- if (!item2)
19926
+ remove(item, equalsFn) {
19927
+ if (!item)
19909
19928
  return this;
19910
19929
  let node2 = this.data;
19911
- const bbox = this.toBBox(item2);
19930
+ const bbox = this.toBBox(item);
19912
19931
  const path2 = [];
19913
19932
  const indexes = [];
19914
19933
  let i, parent, goingUp;
@@ -19920,7 +19939,7 @@ class RBush {
19920
19939
  goingUp = true;
19921
19940
  }
19922
19941
  if (node2.leaf) {
19923
- const index2 = findItem(item2, node2.children, equalsFn);
19942
+ const index2 = findItem(item, node2.children, equalsFn);
19924
19943
  if (index2 !== -1) {
19925
19944
  node2.children.splice(index2, 1);
19926
19945
  path2.push(node2);
@@ -19943,8 +19962,8 @@ class RBush {
19943
19962
  }
19944
19963
  return this;
19945
19964
  }
19946
- toBBox(item2) {
19947
- return item2;
19965
+ toBBox(item) {
19966
+ return item;
19948
19967
  }
19949
19968
  compareMinX(a, b) {
19950
19969
  return a.minX - b.minX;
@@ -20027,11 +20046,11 @@ class RBush {
20027
20046
  }
20028
20047
  return node2;
20029
20048
  }
20030
- _insert(item2, level, isNode) {
20031
- const bbox = isNode ? item2 : this.toBBox(item2);
20049
+ _insert(item, level, isNode) {
20050
+ const bbox = isNode ? item : this.toBBox(item);
20032
20051
  const insertPath = [];
20033
20052
  const node2 = this._chooseSubtree(bbox, this.data, level, insertPath);
20034
- node2.children.push(item2);
20053
+ node2.children.push(item);
20035
20054
  extend2(node2, bbox);
20036
20055
  while (level >= 0) {
20037
20056
  if (insertPath[level].children.length > this._maxEntries) {
@@ -20130,11 +20149,11 @@ class RBush {
20130
20149
  }
20131
20150
  }
20132
20151
  }
20133
- function findItem(item2, items, equalsFn) {
20152
+ function findItem(item, items, equalsFn) {
20134
20153
  if (!equalsFn)
20135
- return items.indexOf(item2);
20154
+ return items.indexOf(item);
20136
20155
  for (let i = 0;i < items.length; i++) {
20137
- if (equalsFn(item2, items[i]))
20156
+ if (equalsFn(item, items[i]))
20138
20157
  return i;
20139
20158
  }
20140
20159
  return -1;
@@ -20225,8 +20244,8 @@ class TinyQueue {
20225
20244
  this._down(i);
20226
20245
  }
20227
20246
  }
20228
- push(item2) {
20229
- this.data.push(item2);
20247
+ push(item) {
20248
+ this.data.push(item);
20230
20249
  this.length++;
20231
20250
  this._up(this.length - 1);
20232
20251
  }
@@ -20247,21 +20266,21 @@ class TinyQueue {
20247
20266
  }
20248
20267
  _up(pos) {
20249
20268
  const { data, compare } = this;
20250
- const item2 = data[pos];
20269
+ const item = data[pos];
20251
20270
  while (pos > 0) {
20252
20271
  const parent = pos - 1 >> 1;
20253
20272
  const current = data[parent];
20254
- if (compare(item2, current) >= 0)
20273
+ if (compare(item, current) >= 0)
20255
20274
  break;
20256
20275
  data[pos] = current;
20257
20276
  pos = parent;
20258
20277
  }
20259
- data[pos] = item2;
20278
+ data[pos] = item;
20260
20279
  }
20261
20280
  _down(pos) {
20262
20281
  const { data, compare } = this;
20263
20282
  const halfLength = this.length >> 1;
20264
- const item2 = data[pos];
20283
+ const item = data[pos];
20265
20284
  while (pos < halfLength) {
20266
20285
  let left = (pos << 1) + 1;
20267
20286
  let best = data[left];
@@ -20270,12 +20289,12 @@ class TinyQueue {
20270
20289
  left = right;
20271
20290
  best = data[right];
20272
20291
  }
20273
- if (compare(best, item2) >= 0)
20292
+ if (compare(best, item) >= 0)
20274
20293
  break;
20275
20294
  data[pos] = best;
20276
20295
  pos = left;
20277
20296
  }
20278
- data[pos] = item2;
20297
+ data[pos] = item;
20279
20298
  }
20280
20299
  }
20281
20300
  function defaultCompare2(a, b) {
@@ -20363,10 +20382,10 @@ class RTreeIndex {
20363
20382
  return container ? container.item : undefined;
20364
20383
  }
20365
20384
  remove(id) {
20366
- const item2 = this.map.get(id);
20367
- if (item2) {
20385
+ const item = this.map.get(id);
20386
+ if (item) {
20368
20387
  this.map.delete(id);
20369
- this.tree.remove(item2);
20388
+ this.tree.remove(item);
20370
20389
  }
20371
20390
  }
20372
20391
  list() {
@@ -20438,11 +20457,11 @@ class Container extends Mbr {
20438
20457
  item;
20439
20458
  layer;
20440
20459
  zIndex;
20441
- constructor(id, item2, layer, zIndex) {
20442
- const rect = item2.getMbrWithChildren();
20460
+ constructor(id, item, layer, zIndex) {
20461
+ const rect = item.getMbrWithChildren();
20443
20462
  super(rect.left, rect.top, rect.right, rect.bottom);
20444
20463
  this.id = id;
20445
- this.item = item2;
20464
+ this.item = item;
20446
20465
  this.layer = layer;
20447
20466
  this.zIndex = zIndex;
20448
20467
  }
@@ -20459,7 +20478,7 @@ class LayeredIndex {
20459
20478
  this.getZIndex = this.getZIndex.bind(this);
20460
20479
  this.layers.newOnTop();
20461
20480
  }
20462
- isT(item2) {
20481
+ isT(item) {
20463
20482
  return true;
20464
20483
  }
20465
20484
  findById(id) {
@@ -20523,8 +20542,8 @@ class LayeredIndex {
20523
20542
  }
20524
20543
  getContainersFromItems(items) {
20525
20544
  const containers = [];
20526
- for (const item2 of items) {
20527
- const container = this.map.get(item2.getId());
20545
+ for (const item of items) {
20546
+ const container = this.map.get(item.getId());
20528
20547
  if (container) {
20529
20548
  containers.push(container);
20530
20549
  }
@@ -20601,9 +20620,9 @@ class LayeredIndex {
20601
20620
  }
20602
20621
  }
20603
20622
  }
20604
- insert(item2) {
20605
- const toInsert = new Container(item2.getId(), item2, 0, this.getZIndex(item2));
20606
- const bounds = item2.getMbrWithChildren();
20623
+ insert(item) {
20624
+ const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
20625
+ const bounds = item.getMbrWithChildren();
20607
20626
  const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
20608
20627
  if (inBounds.length === 0) {
20609
20628
  return this.insertContainer(toInsert);
@@ -20670,20 +20689,20 @@ class LayeredIndex {
20670
20689
  }
20671
20690
  }
20672
20691
  }
20673
- change(item2) {
20674
- const id = item2.getId();
20692
+ change(item) {
20693
+ const id = item.getId();
20675
20694
  const container = this.map.get(id);
20676
20695
  if (container) {
20677
20696
  const layer = this.layers.get(container.layer);
20678
20697
  if (layer) {
20679
20698
  layer.remove(id);
20680
20699
  this.map.delete(id);
20681
- this.insert(item2);
20700
+ this.insert(item);
20682
20701
  }
20683
20702
  }
20684
20703
  }
20685
- remove(item2) {
20686
- const id = item2.getId();
20704
+ remove(item) {
20705
+ const id = item.getId();
20687
20706
  const container = this.map.get(id);
20688
20707
  if (container) {
20689
20708
  const layer = this.layers.get(container.layer);
@@ -20709,13 +20728,13 @@ class LayeredIndex {
20709
20728
  return items;
20710
20729
  }
20711
20730
  batchInsert(items) {
20712
- for (const item2 of items) {
20713
- this.insert(item2);
20731
+ for (const item of items) {
20732
+ this.insert(item);
20714
20733
  }
20715
20734
  }
20716
20735
  batchChange(items) {
20717
- for (const item2 of items) {
20718
- this.change(item2);
20736
+ for (const item of items) {
20737
+ this.change(item);
20719
20738
  }
20720
20739
  }
20721
20740
  }
@@ -20724,8 +20743,8 @@ class LayeredIndex {
20724
20743
  class SpatialIndex {
20725
20744
  subject = new Subject;
20726
20745
  itemsArray = [];
20727
- itemsIndex = new LayeredIndex((item2) => {
20728
- return this.itemsArray.indexOf(item2);
20746
+ itemsIndex = new LayeredIndex((item) => {
20747
+ return this.itemsArray.indexOf(item);
20729
20748
  });
20730
20749
  Mbr = new Mbr;
20731
20750
  items;
@@ -20734,79 +20753,79 @@ class SpatialIndex {
20734
20753
  }
20735
20754
  clear() {
20736
20755
  this.itemsArray = [];
20737
- this.itemsIndex = new LayeredIndex((item2) => {
20738
- return this.itemsArray.indexOf(item2);
20756
+ this.itemsIndex = new LayeredIndex((item) => {
20757
+ return this.itemsArray.indexOf(item);
20739
20758
  });
20740
20759
  this.Mbr = new Mbr;
20741
20760
  }
20742
- insert(item2) {
20743
- this.itemsArray.push(item2);
20744
- this.itemsIndex.insert(item2);
20761
+ insert(item) {
20762
+ this.itemsArray.push(item);
20763
+ this.itemsIndex.insert(item);
20745
20764
  if (conf.isNode()) {
20746
20765
  return;
20747
20766
  }
20748
20767
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20749
- this.Mbr = item2.getMbr().copy();
20768
+ this.Mbr = item.getMbr().copy();
20750
20769
  } else {
20751
- this.Mbr.combine([item2.getMbr()]);
20770
+ this.Mbr.combine([item.getMbr()]);
20752
20771
  }
20753
- item2.subject.subscribe(this.change);
20772
+ item.subject.subscribe(this.change);
20754
20773
  this.subject.publish(this.items);
20755
20774
  }
20756
- change = (item2) => {
20757
- this.itemsIndex.change(item2);
20775
+ change = (item) => {
20776
+ this.itemsIndex.change(item);
20758
20777
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20759
- this.Mbr = item2.getMbrWithChildren().copy();
20778
+ this.Mbr = item.getMbrWithChildren().copy();
20760
20779
  } else {
20761
- this.Mbr.combine([item2.getMbrWithChildren()]);
20780
+ this.Mbr.combine([item.getMbrWithChildren()]);
20762
20781
  }
20763
20782
  this.subject.publish(this.items);
20764
20783
  };
20765
- remove(item2) {
20766
- if ("index" in item2 && item2.index) {
20767
- item2.removeChildItems(item2.index.list());
20784
+ remove(item) {
20785
+ if ("index" in item && item.index) {
20786
+ item.removeChildItems(item.index.list());
20768
20787
  }
20769
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
20770
- this.itemsIndex.remove(item2);
20788
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
20789
+ this.itemsIndex.remove(item);
20771
20790
  this.Mbr = new Mbr;
20772
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbrWithChildren()]));
20791
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbrWithChildren()]));
20773
20792
  this.subject.publish(this.items);
20774
20793
  }
20775
20794
  copy() {
20776
- return this.getItemsWithIncludedChildren(this.itemsArray).map((item2) => ({
20777
- ...item2.serialize(true),
20778
- id: item2.getId()
20795
+ return this.getItemsWithIncludedChildren(this.itemsArray).map((item) => ({
20796
+ ...item.serialize(true),
20797
+ id: item.getId()
20779
20798
  }));
20780
20799
  }
20781
20800
  getItemsWithIncludedChildren(items) {
20782
- return items.flatMap((item2) => {
20783
- if ("index" in item2 && item2.index) {
20784
- return [item2, ...item2.index.list()];
20801
+ return items.flatMap((item) => {
20802
+ if ("index" in item && item.index) {
20803
+ return [item, ...item.index.list()];
20785
20804
  }
20786
- return item2;
20805
+ return item;
20787
20806
  });
20788
20807
  }
20789
- getItemChildren(item2) {
20790
- if ("index" in item2 && item2.index) {
20791
- return item2.index.list();
20808
+ getItemChildren(item) {
20809
+ if ("index" in item && item.index) {
20810
+ return item.index.list();
20792
20811
  }
20793
20812
  return [];
20794
20813
  }
20795
- getItemParent(item2) {
20796
- if (item2.parent === "Board") {
20814
+ getItemParent(item) {
20815
+ if (item.parent === "Board") {
20797
20816
  return;
20798
20817
  }
20799
- return this.getById(item2.parent);
20818
+ return this.getById(item.parent);
20800
20819
  }
20801
- moveToZIndex(item2, zIndex) {
20802
- const index2 = this.itemsArray.indexOf(item2);
20820
+ moveToZIndex(item, zIndex) {
20821
+ const index2 = this.itemsArray.indexOf(item);
20803
20822
  this.itemsArray.splice(index2, 1);
20804
- this.itemsArray.splice(zIndex, 0, item2);
20805
- this.change(item2);
20823
+ this.itemsArray.splice(zIndex, 0, item);
20824
+ this.change(item);
20806
20825
  this.subject.publish(this.items);
20807
20826
  }
20808
20827
  moveManyToZIndex(itemsRecord) {
20809
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
20828
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
20810
20829
  const zIndex = Object.values(itemsRecord);
20811
20830
  for (let i = 0;i < zIndex.length; i++) {
20812
20831
  const index2 = zIndex[i];
@@ -20814,39 +20833,39 @@ class SpatialIndex {
20814
20833
  }
20815
20834
  this.itemsArray.forEach(this.change.bind(this));
20816
20835
  }
20817
- sendToBack(item2, shouldPublish = true) {
20818
- const index2 = this.itemsArray.indexOf(item2);
20836
+ sendToBack(item, shouldPublish = true) {
20837
+ const index2 = this.itemsArray.indexOf(item);
20819
20838
  this.itemsArray.splice(index2, 1);
20820
- this.itemsArray.unshift(item2);
20821
- this.itemsIndex.change(item2);
20839
+ this.itemsArray.unshift(item);
20840
+ this.itemsIndex.change(item);
20822
20841
  if (shouldPublish) {
20823
20842
  this.subject.publish(this.items);
20824
20843
  }
20825
20844
  }
20826
20845
  sendManyToBack(items) {
20827
20846
  const newItems = [...items];
20828
- this.itemsArray.forEach((item2) => {
20829
- if (!items.includes(item2)) {
20830
- newItems.push(item2);
20847
+ this.itemsArray.forEach((item) => {
20848
+ if (!items.includes(item)) {
20849
+ newItems.push(item);
20831
20850
  }
20832
20851
  });
20833
20852
  this.itemsArray = newItems;
20834
20853
  this.itemsArray.forEach(this.change.bind(this));
20835
20854
  }
20836
- bringToFront(item2, shouldPublish = true) {
20837
- const index2 = this.itemsArray.indexOf(item2);
20855
+ bringToFront(item, shouldPublish = true) {
20856
+ const index2 = this.itemsArray.indexOf(item);
20838
20857
  this.itemsArray.splice(index2, 1);
20839
- this.itemsArray.push(item2);
20840
- this.itemsIndex.change(item2);
20858
+ this.itemsArray.push(item);
20859
+ this.itemsIndex.change(item);
20841
20860
  if (shouldPublish) {
20842
20861
  this.subject.publish(this.items);
20843
20862
  }
20844
20863
  }
20845
20864
  bringManyToFront(items) {
20846
20865
  const newItems = [];
20847
- this.itemsArray.forEach((item2) => {
20848
- if (!items.includes(item2)) {
20849
- newItems.push(item2);
20866
+ this.itemsArray.forEach((item) => {
20867
+ if (!items.includes(item)) {
20868
+ newItems.push(item);
20850
20869
  }
20851
20870
  });
20852
20871
  newItems.push(...items);
@@ -20872,9 +20891,9 @@ class SpatialIndex {
20872
20891
  this.subject.publish(this.items);
20873
20892
  }
20874
20893
  getById(id) {
20875
- const item2 = this.getItemsWithIncludedChildren(this.itemsArray).find((item3) => item3.getId() === id);
20876
- if (item2) {
20877
- return item2;
20894
+ const item = this.getItemsWithIncludedChildren(this.itemsArray).find((item2) => item2.getId() === id);
20895
+ if (item) {
20896
+ return item;
20878
20897
  }
20879
20898
  }
20880
20899
  findById(id) {
@@ -20884,10 +20903,10 @@ class SpatialIndex {
20884
20903
  const mbr = new Mbr(left, top, right, bottom);
20885
20904
  const items = this.itemsIndex.getEnclosed(mbr);
20886
20905
  const children = [];
20887
- const clearItems = items.filter((item2) => {
20888
- if ("index" in item2 && item2.index) {
20889
- children.push(...item2.index.getEnclosed(left, top, right, bottom));
20890
- if (!item2.getMbr().isEnclosedBy(mbr)) {
20906
+ const clearItems = items.filter((item) => {
20907
+ if ("index" in item && item.index) {
20908
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
20909
+ if (!item.getMbr().isEnclosedBy(mbr)) {
20891
20910
  return false;
20892
20911
  }
20893
20912
  }
@@ -20899,10 +20918,10 @@ class SpatialIndex {
20899
20918
  const mbr = new Mbr(left, top, right, bottom);
20900
20919
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
20901
20920
  const children = [];
20902
- const clearItems = items.filter((item2) => {
20903
- if ("index" in item2 && item2.index) {
20904
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20905
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
20921
+ const clearItems = items.filter((item) => {
20922
+ if ("index" in item && item.index) {
20923
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20924
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20906
20925
  return false;
20907
20926
  }
20908
20927
  }
@@ -20913,10 +20932,10 @@ class SpatialIndex {
20913
20932
  getUnderPoint(point3, tolerance = 5) {
20914
20933
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
20915
20934
  const children = [];
20916
- const clearItems = items.filter((item2) => {
20917
- if ("index" in item2 && item2.index) {
20918
- children.push(...item2.index.getUnderPoint(point3, tolerance));
20919
- if (!item2.getMbr().isUnderPoint(point3)) {
20935
+ const clearItems = items.filter((item) => {
20936
+ if ("index" in item && item.index) {
20937
+ children.push(...item.index.getUnderPoint(point3, tolerance));
20938
+ if (!item.getMbr().isUnderPoint(point3)) {
20920
20939
  return false;
20921
20940
  }
20922
20941
  }
@@ -20928,10 +20947,10 @@ class SpatialIndex {
20928
20947
  const mbr = new Mbr(left, top, right, bottom);
20929
20948
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
20930
20949
  const children = [];
20931
- const clearItems = items.filter((item2) => {
20932
- if ("index" in item2 && item2.index) {
20933
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20934
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
20950
+ const clearItems = items.filter((item) => {
20951
+ if ("index" in item && item.index) {
20952
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20953
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20935
20954
  return false;
20936
20955
  }
20937
20956
  }
@@ -20943,26 +20962,26 @@ class SpatialIndex {
20943
20962
  return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
20944
20963
  }
20945
20964
  getComments() {
20946
- return this.itemsArray.filter((item2) => item2 instanceof Comment);
20965
+ return this.itemsArray.filter((item) => item instanceof Comment);
20947
20966
  }
20948
20967
  getMbr() {
20949
20968
  return this.Mbr;
20950
20969
  }
20951
20970
  getNearestTo(point3, maxItems, filter, maxDistance) {
20952
20971
  const allItems = this.getItemsWithIncludedChildren(this.itemsArray);
20953
- const filtered = allItems.filter((item2) => filter(item2));
20954
- const withDistance = filtered.map((item2) => ({
20955
- item: item2,
20956
- distance: point3.getDistance(item2.getMbr().getCenter())
20972
+ const filtered = allItems.filter((item) => filter(item));
20973
+ const withDistance = filtered.map((item) => ({
20974
+ item,
20975
+ distance: point3.getDistance(item.getMbr().getCenter())
20957
20976
  })).filter(({ distance }) => distance <= maxDistance);
20958
20977
  withDistance.sort((a, b) => a.distance - b.distance);
20959
- return withDistance.slice(0, maxItems).map(({ item: item2 }) => item2);
20978
+ return withDistance.slice(0, maxItems).map(({ item }) => item);
20960
20979
  }
20961
20980
  list() {
20962
20981
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
20963
20982
  }
20964
- getZIndex(item2) {
20965
- const index2 = this.itemsArray.indexOf(item2);
20983
+ getZIndex(item) {
20984
+ const index2 = this.itemsArray.indexOf(item);
20966
20985
  if (index2 === -1) {
20967
20986
  return this.getLastZIndex();
20968
20987
  }
@@ -20992,14 +21011,14 @@ class Items {
20992
21011
  this.pointer = pointer;
20993
21012
  this.subject = subject;
20994
21013
  }
20995
- update(item2) {
20996
- this.index.change(item2);
21014
+ update(item) {
21015
+ this.index.change(item);
20997
21016
  }
20998
21017
  listAll() {
20999
21018
  return this.index.list();
21000
21019
  }
21001
21020
  listGroupItems() {
21002
- return this.index.list().filter((item2) => ("index" in item2) && item2.index);
21021
+ return this.index.list().filter((item) => ("index" in item) && item.index);
21003
21022
  }
21004
21023
  getById(id) {
21005
21024
  return this.index.getById(id);
@@ -21014,7 +21033,7 @@ class Items {
21014
21033
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
21015
21034
  }
21016
21035
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
21017
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => item2 instanceof BaseItem && item2.index);
21036
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
21018
21037
  }
21019
21038
  getUnderPoint(point3, tolerance = 5) {
21020
21039
  return this.index.getUnderPoint(point3, tolerance);
@@ -21042,28 +21061,28 @@ class Items {
21042
21061
  const unmodifiedSize = size;
21043
21062
  size = 16;
21044
21063
  const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
21045
- const groups = tolerated.filter((item2) => item2.itemType === "Group");
21064
+ const groups = tolerated.filter((item) => item.itemType === "Group");
21046
21065
  if (groups.length > 0) {
21047
21066
  return groups;
21048
21067
  }
21049
- let enclosed = tolerated.some((item2) => item2 instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
21068
+ let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
21050
21069
  const underPointer = this.getUnderPoint(new Point(x, y), size);
21051
21070
  if (enclosed.length === 0) {
21052
21071
  enclosed = underPointer;
21053
21072
  }
21054
- if (underPointer.some((item2) => item2.itemType === "Drawing")) {
21073
+ if (underPointer.some((item) => item.itemType === "Drawing")) {
21055
21074
  enclosed = [...underPointer, ...enclosed];
21056
21075
  }
21057
- const { nearest } = enclosed.reduce((acc, item2) => {
21058
- const area = item2.getMbr().getHeight() * item2.getMbr().getWidth();
21059
- if (item2.itemType === "Drawing" && !item2.isPointNearLine(this.pointer.point)) {
21076
+ const { nearest } = enclosed.reduce((acc, item) => {
21077
+ const area = item.getMbr().getHeight() * item.getMbr().getWidth();
21078
+ if (item.itemType === "Drawing" && !item.isPointNearLine(this.pointer.point)) {
21060
21079
  return acc;
21061
21080
  }
21062
- const isItemTransparent = item2 instanceof Shape && item2?.getBackgroundColor() === "none";
21063
- const itemZIndex = this.getZIndex(item2);
21081
+ const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
21082
+ const itemZIndex = this.getZIndex(item);
21064
21083
  const accZIndex = this.getZIndex(acc.nearest);
21065
21084
  if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
21066
- return { nearest: item2, area };
21085
+ return { nearest: item, area };
21067
21086
  }
21068
21087
  return acc;
21069
21088
  }, { nearest: undefined, area: Infinity });
@@ -21075,8 +21094,8 @@ class Items {
21075
21094
  getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
21076
21095
  return this.index.getNearestTo(this.pointer.point, maxItems, filter, maxDistance);
21077
21096
  }
21078
- getZIndex(item2) {
21079
- return this.index.getZIndex(item2);
21097
+ getZIndex(item) {
21098
+ return this.index.getZIndex(item);
21080
21099
  }
21081
21100
  getByZIndex(index2) {
21082
21101
  return this.index.getByZIndex(index2);
@@ -21085,11 +21104,11 @@ class Items {
21085
21104
  return this.index.getLastZIndex();
21086
21105
  }
21087
21106
  getLinkedConnectorsById(id) {
21088
- return this.listAll().filter((item2) => {
21089
- if (!(item2 instanceof Connector2)) {
21107
+ return this.listAll().filter((item) => {
21108
+ if (!(item instanceof Connector2)) {
21090
21109
  return false;
21091
21110
  }
21092
- const { startItem, endItem } = item2.getConnectedItems();
21111
+ const { startItem, endItem } = item.getConnectedItems();
21093
21112
  if (startItem?.getId() === id || endItem?.getId() === id) {
21094
21113
  return true;
21095
21114
  }
@@ -21100,11 +21119,11 @@ class Items {
21100
21119
  if (!startPointerItemId && !endPointerItemId) {
21101
21120
  return [];
21102
21121
  }
21103
- return this.listAll().filter((item2) => {
21104
- if (!(item2 instanceof Connector2) || !item2.isConnected()) {
21122
+ return this.listAll().filter((item) => {
21123
+ if (!(item instanceof Connector2) || !item.isConnected()) {
21105
21124
  return false;
21106
21125
  }
21107
- const { startItem, endItem } = item2.getConnectedItems();
21126
+ const { startItem, endItem } = item.getConnectedItems();
21108
21127
  if (startPointerItemId && endPointerItemId) {
21109
21128
  if (startPointerItemId && startItem && startItem.getId() === startPointerItemId && endPointerItemId && endItem && endItem.getId() === endPointerItemId) {
21110
21129
  return true;
@@ -21122,9 +21141,9 @@ class Items {
21122
21141
  }
21123
21142
  render(context) {
21124
21143
  const items = this.getItemsInView();
21125
- items.forEach((item2) => {
21126
- if (item2.parent === "Board") {
21127
- item2.render(context);
21144
+ items.forEach((item) => {
21145
+ if (item.parent === "Board") {
21146
+ item.render(context);
21128
21147
  }
21129
21148
  });
21130
21149
  }
@@ -21137,17 +21156,17 @@ class Items {
21137
21156
  return this.getHTML(documentFactory, items);
21138
21157
  }
21139
21158
  getHTML(documentFactory, items) {
21140
- const lowestCoordinates = items.map((item2) => item2.getMbr()).reduce((acc, mbr) => ({
21159
+ const lowestCoordinates = items.map((item) => item.getMbr()).reduce((acc, mbr) => ({
21141
21160
  left: Math.min(acc.left, mbr.left),
21142
21161
  top: Math.min(acc.top, mbr.top)
21143
21162
  }), { left: 0, top: 0 });
21144
21163
  const groups = [];
21145
21164
  const rest = [];
21146
- items.forEach((item2) => {
21147
- if ("index" in item2 && item2.index) {
21148
- groups.push(item2);
21165
+ items.forEach((item) => {
21166
+ if ("index" in item && item.index) {
21167
+ groups.push(item);
21149
21168
  } else {
21150
- rest.push(item2);
21169
+ rest.push(item);
21151
21170
  }
21152
21171
  });
21153
21172
  const childrenMap = new Map;
@@ -21157,34 +21176,34 @@ class Items {
21157
21176
  translateElementBy(html, -lowestCoordinates.left, -lowestCoordinates.top);
21158
21177
  return html;
21159
21178
  });
21160
- const restHTML = rest.map((item2) => ("renderHTML" in item2) && item2.renderHTML(documentFactory)).filter((item2) => !!item2).map((item2) => {
21161
- if (item2.tagName.toLowerCase() === "connector-item") {
21162
- const startX = parseFloat(item2.getAttribute("data-start-point-x") || "0");
21163
- const startY = parseFloat(item2.getAttribute("data-start-point-y") || "0");
21164
- const endX = parseFloat(item2.getAttribute("data-end-point-x") || "0");
21165
- const endY = parseFloat(item2.getAttribute("data-end-point-y") || "0");
21166
- item2.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
21167
- item2.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
21168
- item2.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
21169
- item2.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
21170
- }
21171
- return translateElementBy(item2, -lowestCoordinates.left, -lowestCoordinates.top);
21172
- });
21173
- for (const item2 of restHTML) {
21174
- const parentFrameId = childrenMap.get(item2.id);
21179
+ const restHTML = rest.map((item) => ("renderHTML" in item) && item.renderHTML(documentFactory)).filter((item) => !!item).map((item) => {
21180
+ if (item.tagName.toLowerCase() === "connector-item") {
21181
+ const startX = parseFloat(item.getAttribute("data-start-point-x") || "0");
21182
+ const startY = parseFloat(item.getAttribute("data-start-point-y") || "0");
21183
+ const endX = parseFloat(item.getAttribute("data-end-point-x") || "0");
21184
+ const endY = parseFloat(item.getAttribute("data-end-point-y") || "0");
21185
+ item.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
21186
+ item.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
21187
+ item.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
21188
+ item.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
21189
+ }
21190
+ return translateElementBy(item, -lowestCoordinates.left, -lowestCoordinates.top);
21191
+ });
21192
+ for (const item of restHTML) {
21193
+ const parentFrameId = childrenMap.get(item.id);
21175
21194
  const group = GroupsHTML.find((el) => parentFrameId !== undefined && el.id === parentFrameId);
21176
21195
  if (group) {
21177
- positionRelatively(item2, group);
21178
- group.appendChild(item2);
21196
+ positionRelatively(item, group);
21197
+ group.appendChild(item);
21179
21198
  }
21180
21199
  }
21181
21200
  let result = "";
21182
21201
  for (const group of GroupsHTML) {
21183
21202
  result += group.outerHTML;
21184
21203
  }
21185
- for (const item2 of restHTML) {
21186
- if (!childrenMap.get(item2.id)) {
21187
- result += item2.outerHTML;
21204
+ for (const item of restHTML) {
21205
+ if (!childrenMap.get(item.id)) {
21206
+ result += item.outerHTML;
21188
21207
  }
21189
21208
  }
21190
21209
  return result;
@@ -21204,52 +21223,52 @@ class SimpleSpatialIndex {
21204
21223
  this.itemsArray = [];
21205
21224
  this.Mbr = new Mbr;
21206
21225
  }
21207
- insert(item2) {
21208
- this.itemsArray.push(item2);
21226
+ insert(item) {
21227
+ this.itemsArray.push(item);
21209
21228
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21210
- this.Mbr = item2.getMbr().copy();
21229
+ this.Mbr = item.getMbr().copy();
21211
21230
  } else {
21212
- this.Mbr.combine([item2.getMbr()]);
21231
+ this.Mbr.combine([item.getMbr()]);
21213
21232
  }
21214
- item2.subject.subscribe(this.change);
21233
+ item.subject.subscribe(this.change);
21215
21234
  this.subject.publish(this.items);
21216
21235
  }
21217
- change = (item2) => {
21236
+ change = (item) => {
21218
21237
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21219
- this.Mbr = item2.getMbr().copy();
21238
+ this.Mbr = item.getMbr().copy();
21220
21239
  } else {
21221
- this.Mbr.combine([item2.getMbr()]);
21240
+ this.Mbr.combine([item.getMbr()]);
21222
21241
  }
21223
21242
  this.subject.publish(this.items);
21224
21243
  };
21225
- remove(item2) {
21226
- if ("index" in item2 && item2.index) {
21227
- item2.removeChildItems(item2.index.list());
21244
+ remove(item) {
21245
+ if ("index" in item && item.index) {
21246
+ item.removeChildItems(item.index.list());
21228
21247
  }
21229
- if (item2.parent !== "Board") {
21230
- const parentFrame = this.items.getById(item2.parent);
21231
- parentFrame?.removeChildItems(item2);
21248
+ if (item.parent !== "Board") {
21249
+ const parentFrame = this.items.getById(item.parent);
21250
+ parentFrame?.removeChildItems(item);
21232
21251
  }
21233
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
21252
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
21234
21253
  this.Mbr = new Mbr;
21235
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbr()]));
21254
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
21236
21255
  this.subject.publish(this.items);
21237
21256
  }
21238
21257
  copy() {
21239
- return this.itemsArray.map((item2) => ({
21240
- ...item2.serialize(true),
21241
- id: item2.getId()
21258
+ return this.itemsArray.map((item) => ({
21259
+ ...item.serialize(true),
21260
+ id: item.getId()
21242
21261
  }));
21243
21262
  }
21244
- moveToZIndex(item2, zIndex) {
21245
- const index2 = this.itemsArray.indexOf(item2);
21263
+ moveToZIndex(item, zIndex) {
21264
+ const index2 = this.itemsArray.indexOf(item);
21246
21265
  this.itemsArray.splice(index2, 1);
21247
- this.itemsArray.splice(zIndex, 0, item2);
21248
- this.change(item2);
21266
+ this.itemsArray.splice(zIndex, 0, item);
21267
+ this.change(item);
21249
21268
  this.subject.publish(this.items);
21250
21269
  }
21251
21270
  moveManyToZIndex(itemsRecord) {
21252
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
21271
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
21253
21272
  const zIndex = Object.values(itemsRecord);
21254
21273
  for (let i = 0;i < zIndex.length; i++) {
21255
21274
  const index2 = zIndex[i];
@@ -21257,37 +21276,37 @@ class SimpleSpatialIndex {
21257
21276
  }
21258
21277
  this.itemsArray.forEach(this.change.bind(this));
21259
21278
  }
21260
- sendToBack(item2, shouldPublish = true) {
21261
- const index2 = this.itemsArray.indexOf(item2);
21279
+ sendToBack(item, shouldPublish = true) {
21280
+ const index2 = this.itemsArray.indexOf(item);
21262
21281
  this.itemsArray.splice(index2, 1);
21263
- this.itemsArray.unshift(item2);
21282
+ this.itemsArray.unshift(item);
21264
21283
  if (shouldPublish) {
21265
21284
  this.subject.publish(this.items);
21266
21285
  }
21267
21286
  }
21268
21287
  sendManyToBack(items) {
21269
21288
  const newItems = [...items];
21270
- this.itemsArray.forEach((item2) => {
21271
- if (!items.includes(item2)) {
21272
- newItems.push(item2);
21289
+ this.itemsArray.forEach((item) => {
21290
+ if (!items.includes(item)) {
21291
+ newItems.push(item);
21273
21292
  }
21274
21293
  });
21275
21294
  this.itemsArray = newItems;
21276
21295
  this.itemsArray.forEach(this.change.bind(this));
21277
21296
  }
21278
- bringToFront(item2, shouldPublish = true) {
21279
- const index2 = this.itemsArray.indexOf(item2);
21297
+ bringToFront(item, shouldPublish = true) {
21298
+ const index2 = this.itemsArray.indexOf(item);
21280
21299
  this.itemsArray.splice(index2, 1);
21281
- this.itemsArray.push(item2);
21300
+ this.itemsArray.push(item);
21282
21301
  if (shouldPublish) {
21283
21302
  this.subject.publish(this.items);
21284
21303
  }
21285
21304
  }
21286
21305
  bringManyToFront(items) {
21287
21306
  const newItems = [];
21288
- this.itemsArray.forEach((item2) => {
21289
- if (!items.includes(item2)) {
21290
- newItems.push(item2);
21307
+ this.itemsArray.forEach((item) => {
21308
+ if (!items.includes(item)) {
21309
+ newItems.push(item);
21291
21310
  }
21292
21311
  });
21293
21312
  newItems.push(...items);
@@ -21313,9 +21332,9 @@ class SimpleSpatialIndex {
21313
21332
  this.subject.publish(this.items);
21314
21333
  }
21315
21334
  getById(id) {
21316
- const item2 = this.itemsArray.find((item3) => item3.getId() === id);
21317
- if (item2) {
21318
- return item2;
21335
+ const item = this.itemsArray.find((item2) => item2.getId() === id);
21336
+ if (item) {
21337
+ return item;
21319
21338
  }
21320
21339
  }
21321
21340
  findById(id) {
@@ -21324,9 +21343,9 @@ class SimpleSpatialIndex {
21324
21343
  getEnclosed(left, top, right, bottom) {
21325
21344
  const mbr = new Mbr(left, top, right, bottom);
21326
21345
  const items = [];
21327
- this.itemsArray.forEach((item2) => {
21328
- if (item2.isEnclosedBy(mbr)) {
21329
- items.push(item2);
21346
+ this.itemsArray.forEach((item) => {
21347
+ if (item.isEnclosedBy(mbr)) {
21348
+ items.push(item);
21330
21349
  }
21331
21350
  });
21332
21351
  return items;
@@ -21334,18 +21353,18 @@ class SimpleSpatialIndex {
21334
21353
  getEnclosedOrCrossed(left, top, right, bottom) {
21335
21354
  const mbr = new Mbr(left, top, right, bottom);
21336
21355
  const items = [];
21337
- this.itemsArray.forEach((item2) => {
21338
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21339
- items.push(item2);
21356
+ this.itemsArray.forEach((item) => {
21357
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21358
+ items.push(item);
21340
21359
  }
21341
21360
  });
21342
21361
  return items;
21343
21362
  }
21344
21363
  getUnderPoint(point3, tolerace = 5) {
21345
21364
  const items = [];
21346
- this.itemsArray.forEach((item2) => {
21347
- if (item2.isUnderPoint(point3, tolerace)) {
21348
- items.push(item2);
21365
+ this.itemsArray.forEach((item) => {
21366
+ if (item.isUnderPoint(point3, tolerace)) {
21367
+ items.push(item);
21349
21368
  }
21350
21369
  });
21351
21370
  return items;
@@ -21356,8 +21375,8 @@ class SimpleSpatialIndex {
21356
21375
  list() {
21357
21376
  return this.itemsArray.concat();
21358
21377
  }
21359
- getZIndex(item2) {
21360
- return this.itemsArray.indexOf(item2);
21378
+ getZIndex(item) {
21379
+ return this.itemsArray.indexOf(item);
21361
21380
  }
21362
21381
  getLastZIndex() {
21363
21382
  return this.itemsArray.length - 1;
@@ -21371,8 +21390,8 @@ class SimpleSpatialIndex {
21371
21390
  }
21372
21391
  }
21373
21392
  render(context) {
21374
- this.itemsArray.forEach((item2) => {
21375
- item2.render(context);
21393
+ this.itemsArray.forEach((item) => {
21394
+ item.render(context);
21376
21395
  });
21377
21396
  }
21378
21397
  }
@@ -21423,7 +21442,7 @@ class BaseItem extends Mbr {
21423
21442
  if (!this.index) {
21424
21443
  return null;
21425
21444
  }
21426
- return this.index.items.listAll().map((item2) => item2.getId());
21445
+ return this.index.items.listAll().map((item) => item.getId());
21427
21446
  }
21428
21447
  addChildItems(children) {
21429
21448
  if (!this.index) {
@@ -21461,17 +21480,17 @@ class BaseItem extends Mbr {
21461
21480
  this.addChildItems(itemsToAdd);
21462
21481
  this.removeChildItems(itemsToRemove);
21463
21482
  }
21464
- handleNesting(item2, options) {
21465
- const isItem = "itemType" in item2;
21466
- const itemMbr = isItem ? item2.getMbr() : item2;
21467
- if (item2 instanceof BaseItem && !item2.canBeNested) {
21483
+ handleNesting(item, options) {
21484
+ const isItem = "itemType" in item;
21485
+ const itemMbr = isItem ? item.getMbr() : item;
21486
+ if (item instanceof BaseItem && !item.canBeNested) {
21468
21487
  return false;
21469
21488
  }
21470
- if (options?.cancelIfChild && isItem && item2.parent !== "Board") {
21489
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
21471
21490
  return false;
21472
21491
  }
21473
21492
  const mbr = this.getMbr().copy();
21474
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21493
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21475
21494
  if (mbr.isInside(itemMbr.getCenter())) {
21476
21495
  if (!options || !options.onlyForOut) {
21477
21496
  return true;
@@ -23768,8 +23787,8 @@ function isChild(value) {
23768
23787
  if (!Array.isArray(value2))
23769
23788
  return true;
23770
23789
  const list2 = value2;
23771
- for (const item2 of list2) {
23772
- if (typeof item2 !== "number" && typeof item2 !== "string") {
23790
+ for (const item of list2) {
23791
+ if (typeof item !== "number" && typeof item !== "string") {
23773
23792
  return true;
23774
23793
  }
23775
23794
  }
@@ -23808,8 +23827,8 @@ function addProperty(schema, properties, key, value) {
23808
23827
  }
23809
23828
  if (Array.isArray(result)) {
23810
23829
  const finalResult = [];
23811
- for (const item2 of result) {
23812
- finalResult.push(parsePrimitive(info, info.property, item2));
23830
+ for (const item of result) {
23831
+ finalResult.push(parsePrimitive(info, info.property, item));
23813
23832
  }
23814
23833
  result = finalResult;
23815
23834
  }
@@ -34876,8 +34895,8 @@ function list5(node2, parent, state, info) {
34876
34895
  if (checkRule(state) === bullet && firstListItem) {
34877
34896
  let index2 = -1;
34878
34897
  while (++index2 < node2.children.length) {
34879
- const item2 = node2.children[index2];
34880
- if (item2 && item2.type === "listItem" && item2.children && item2.children[0] && item2.children[0].type === "thematicBreak") {
34898
+ const item = node2.children[index2];
34899
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
34881
34900
  useDifferentMarker = true;
34882
34901
  break;
34883
34902
  }
@@ -35537,12 +35556,12 @@ async function convertMarkdownToSlate(text5) {
35537
35556
  ...nodes.filter((node2) => node2.type !== "list_item")
35538
35557
  ];
35539
35558
  }
35540
- return nodes.map((item2) => {
35559
+ return nodes.map((item) => {
35541
35560
  setNodeStyles({
35542
- node: item2,
35543
- isPaddingTopNeeded: item2.type !== "code_block"
35561
+ node: item,
35562
+ isPaddingTopNeeded: item.type !== "code_block"
35544
35563
  });
35545
- return item2;
35564
+ return item;
35546
35565
  });
35547
35566
  }
35548
35567
  function detectListType(text5) {
@@ -35955,17 +35974,17 @@ class FloatingPoint extends Point {
35955
35974
  relativePoint;
35956
35975
  pointType = "Floating";
35957
35976
  edge;
35958
- constructor(item2, relativePoint) {
35977
+ constructor(item, relativePoint) {
35959
35978
  super();
35960
- this.item = item2;
35979
+ this.item = item;
35961
35980
  this.relativePoint = relativePoint;
35962
35981
  if (relativePoint.y <= 0) {
35963
35982
  this.edge = "top";
35964
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
35983
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
35965
35984
  this.edge = "bottom";
35966
35985
  } else if (relativePoint.x <= 0) {
35967
35986
  this.edge = "left";
35968
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
35987
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
35969
35988
  this.edge = "right";
35970
35989
  }
35971
35990
  this.recalculatePoint();
@@ -35996,17 +36015,17 @@ class FixedPoint extends Point {
35996
36015
  relativePoint;
35997
36016
  pointType = "Fixed";
35998
36017
  edge;
35999
- constructor(item2, relativePoint) {
36018
+ constructor(item, relativePoint) {
36000
36019
  super();
36001
- this.item = item2;
36020
+ this.item = item;
36002
36021
  this.relativePoint = relativePoint;
36003
36022
  if (relativePoint.y <= 0) {
36004
36023
  this.edge = "top";
36005
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
36024
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
36006
36025
  this.edge = "bottom";
36007
36026
  } else if (relativePoint.x <= 0) {
36008
36027
  this.edge = "left";
36009
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
36028
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
36010
36029
  this.edge = "right";
36011
36030
  }
36012
36031
  this.recalculatePoint();
@@ -36037,16 +36056,16 @@ class FixedConnectorPoint extends Point {
36037
36056
  tangent;
36038
36057
  segmentIndex;
36039
36058
  pointType = "FixedConnector";
36040
- constructor(item2, tangent, segmentIndex) {
36059
+ constructor(item, tangent, segmentIndex) {
36041
36060
  super();
36042
- this.item = item2;
36061
+ this.item = item;
36043
36062
  this.tangent = tangent;
36044
36063
  this.segmentIndex = segmentIndex;
36045
36064
  this.recalculatePoint();
36046
36065
  }
36047
36066
  recalculatePoint() {
36048
- const item2 = this.item;
36049
- const segments = item2.getPaths().getSegments();
36067
+ const item = this.item;
36068
+ const segments = item.getPaths().getSegments();
36050
36069
  const segment = segments.length > this.segmentIndex ? segments[this.segmentIndex] : segments[segments.length - 1];
36051
36070
  const point5 = segment.getPoint(this.tangent);
36052
36071
  this.x = point5.x;
@@ -36071,38 +36090,38 @@ function getControlPoint(data, findItem2) {
36071
36090
  if (data.pointType === "Board") {
36072
36091
  return new BoardPoint(Math.round(data.x), Math.round(data.y));
36073
36092
  } else {
36074
- const item2 = findItem2(data.itemId);
36075
- if (!item2) {
36093
+ const item = findItem2(data.itemId);
36094
+ if (!item) {
36076
36095
  console.warn(`getControlPoint(): item not found for ${data.itemId}`);
36077
36096
  return new BoardPoint(0, 0);
36078
36097
  }
36079
36098
  switch (data.pointType) {
36080
36099
  case "FixedConnector":
36081
- if (item2 instanceof Connector2) {
36082
- return new FixedConnectorPoint(item2, data.tangent, data.segment);
36100
+ if (item instanceof Connector2) {
36101
+ return new FixedConnectorPoint(item, data.tangent, data.segment);
36083
36102
  } else {
36084
36103
  throw new Error(`getControlPoint(): item must be a connector`);
36085
36104
  }
36086
36105
  case "Floating":
36087
- return new FloatingPoint(item2, new Point(data.relativeX, data.relativeY));
36106
+ return new FloatingPoint(item, new Point(data.relativeX, data.relativeY));
36088
36107
  case "Fixed":
36089
- return new FixedPoint(item2, new Point(data.relativeX, data.relativeY));
36108
+ return new FixedPoint(item, new Point(data.relativeX, data.relativeY));
36090
36109
  }
36091
36110
  }
36092
36111
  }
36093
- function toRelativePoint(point5, item2) {
36094
- const matrix = item2.transformation?.matrix || new Matrix2;
36112
+ function toRelativePoint(point5, item) {
36113
+ const matrix = item.transformation?.matrix || new Matrix2;
36095
36114
  const inverse = matrix.getInverse();
36096
36115
  point5 = point5.copy();
36097
36116
  point5.transform(inverse);
36098
36117
  return point5;
36099
36118
  }
36100
- function fromRelativePoint(relativePoint, item2, edge) {
36101
- const matrix = item2.transformation?.matrix.copy() || new Matrix2;
36119
+ function fromRelativePoint(relativePoint, item, edge) {
36120
+ const matrix = item.transformation?.matrix.copy() || new Matrix2;
36102
36121
  const point5 = relativePoint.copy();
36103
36122
  point5.transform(matrix);
36104
- if (item2 instanceof RichText || item2 instanceof AINode) {
36105
- const itemMbr = item2.getMbr();
36123
+ if (item instanceof RichText || item instanceof AINode) {
36124
+ const itemMbr = item.getMbr();
36106
36125
  const { x: centerX, y: centerY } = itemMbr.getCenter();
36107
36126
  switch (edge) {
36108
36127
  case "left":
@@ -36114,7 +36133,7 @@ function fromRelativePoint(relativePoint, item2, edge) {
36114
36133
  case "bottom":
36115
36134
  return new Point(centerX, itemMbr.bottom);
36116
36135
  default:
36117
- return item2.getMbr().getClosestEdgeCenterPoint(point5);
36136
+ return item.getMbr().getClosestEdgeCenterPoint(point5);
36118
36137
  }
36119
36138
  }
36120
36139
  return point5;
@@ -37463,7 +37482,7 @@ class Connector2 extends BaseItem {
37463
37482
  return this;
37464
37483
  }
37465
37484
  getConnectorById(items, connectorId) {
37466
- return items.find((item2) => item2 instanceof Connector2 && item2.getId() === connectorId);
37485
+ return items.find((item) => item instanceof Connector2 && item.getId() === connectorId);
37467
37486
  }
37468
37487
  updateTitle() {
37469
37488
  const selection = this.board.selection;
@@ -40100,8 +40119,8 @@ async function exportBoardSnapshot({
40100
40119
  context.matrix.applyToContext(context.ctx);
40101
40120
  const { left, top, right, bottom } = selection;
40102
40121
  const inView = board.items.index.getRectsEnclosedOrCrossed(left, top, right, bottom);
40103
- for (const item2 of inView) {
40104
- item2.render(context);
40122
+ for (const item of inView) {
40123
+ item.render(context);
40105
40124
  }
40106
40125
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
40107
40126
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -40299,7 +40318,7 @@ class Frame2 extends BaseItem {
40299
40318
  return this.id;
40300
40319
  }
40301
40320
  getChildrenIds() {
40302
- return this.index?.list().map((item2) => item2.getId()) || [];
40321
+ return this.index?.list().map((item) => item.getId()) || [];
40303
40322
  }
40304
40323
  updateMbr() {
40305
40324
  const rect = this.path.getMbr().copy();
@@ -40534,11 +40553,11 @@ class Frame2 extends BaseItem {
40534
40553
  }
40535
40554
  });
40536
40555
  const currMbr = this.getMbr();
40537
- this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item2) => {
40538
- if (item2.parent === "Board") {
40539
- if (this.handleNesting(item2)) {
40540
- this.applyAddChildren([item2.getId()]);
40541
- item2.parent = this.getId();
40556
+ this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
40557
+ if (item.parent === "Board") {
40558
+ if (this.handleNesting(item)) {
40559
+ this.applyAddChildren([item.getId()]);
40560
+ item.parent = this.getId();
40542
40561
  }
40543
40562
  }
40544
40563
  });
@@ -42736,9 +42755,9 @@ class Group extends BaseItem {
42736
42755
  if (data.children) {
42737
42756
  data.children.forEach((childId) => {
42738
42757
  this.applyAddChild(childId);
42739
- const item2 = this.board.items.getById(childId);
42740
- if (item2) {
42741
- item2.parent = this.getId();
42758
+ const item = this.board.items.getById(childId);
42759
+ if (item) {
42760
+ item.parent = this.getId();
42742
42761
  }
42743
42762
  });
42744
42763
  }
@@ -42768,11 +42787,11 @@ class Group extends BaseItem {
42768
42787
  let right = Number.MIN_SAFE_INTEGER;
42769
42788
  let bottom = Number.MIN_SAFE_INTEGER;
42770
42789
  const mbrs = this.children.flatMap((childId) => {
42771
- const item2 = this.board.items.getById(childId);
42772
- if (!item2) {
42790
+ const item = this.board.items.getById(childId);
42791
+ if (!item) {
42773
42792
  return [];
42774
42793
  }
42775
- const mbr2 = item2.getMbr();
42794
+ const mbr2 = item.getMbr();
42776
42795
  if (!mbr2) {
42777
42796
  return [];
42778
42797
  }
@@ -42807,7 +42826,7 @@ class Group extends BaseItem {
42807
42826
  return this.children;
42808
42827
  }
42809
42828
  getChildren() {
42810
- return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item2) => item2 !== undefined);
42829
+ return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item) => item !== undefined);
42811
42830
  }
42812
42831
  updateMbr() {
42813
42832
  const rect = this.getMbr();
@@ -42820,9 +42839,9 @@ class Group extends BaseItem {
42820
42839
  setChildren(items) {
42821
42840
  items.forEach((itemId) => {
42822
42841
  this.addChild(itemId);
42823
- const item2 = this.board.items.getById(itemId);
42824
- if (item2) {
42825
- item2.parent = this.getId();
42842
+ const item = this.board.items.getById(itemId);
42843
+ if (item) {
42844
+ item.parent = this.getId();
42826
42845
  }
42827
42846
  });
42828
42847
  this.updateMbr();
@@ -42830,9 +42849,9 @@ class Group extends BaseItem {
42830
42849
  removeChildren() {
42831
42850
  this.children.forEach((itemId) => {
42832
42851
  this.removeChild(itemId);
42833
- const item2 = this.board.items.getById(itemId);
42834
- if (item2) {
42835
- item2.parent = this.parent;
42852
+ const item = this.board.items.getById(itemId);
42853
+ if (item) {
42854
+ item.parent = this.parent;
42836
42855
  }
42837
42856
  });
42838
42857
  this.updateMbr();
@@ -43165,16 +43184,16 @@ class Anchor extends Mbr {
43165
43184
  }
43166
43185
  }
43167
43186
  // src/Items/Connector/ConnectorSnap.ts
43168
- function getFixedPoint(item2, point5) {
43169
- if (item2 instanceof Connector2) {
43170
- const nearestSegmentData = item2.getPaths().getNearestEdgeAndPointTo(point5);
43187
+ function getFixedPoint(item, point5) {
43188
+ if (item instanceof Connector2) {
43189
+ const nearestSegmentData = item.getPaths().getNearestEdgeAndPointTo(point5);
43171
43190
  const segment = nearestSegmentData.segment;
43172
43191
  const index2 = nearestSegmentData.index;
43173
43192
  const tangent = segment.getParameter(point5);
43174
- return new FixedConnectorPoint(item2, tangent, index2);
43193
+ return new FixedConnectorPoint(item, tangent, index2);
43175
43194
  } else {
43176
- const relativePoint = toRelativePoint(point5, item2);
43177
- return new FixedPoint(item2, relativePoint);
43195
+ const relativePoint = toRelativePoint(point5, item);
43196
+ return new FixedPoint(item, relativePoint);
43178
43197
  }
43179
43198
  }
43180
43199
 
@@ -43227,20 +43246,20 @@ class ConnectorSnap {
43227
43246
  }
43228
43247
  this.setSnap();
43229
43248
  const pointer = this.board.pointer.point;
43230
- const { anchor, item: item2, point: point5 } = this.snap;
43231
- if (!item2) {
43249
+ const { anchor, item, point: point5 } = this.snap;
43250
+ if (!item) {
43232
43251
  const pointer2 = this.board.pointer.point;
43233
43252
  this.controlPoint = new BoardPoint(pointer2.x, pointer2.y);
43234
43253
  } else if (anchor) {
43235
- this.controlPoint = getFixedPoint(item2, anchor.getCenter());
43254
+ this.controlPoint = getFixedPoint(item, anchor.getCenter());
43236
43255
  } else if (point5) {
43237
- const nearest2 = item2.getNearestEdgePointTo(pointer);
43238
- this.controlPoint = getFixedPoint(item2, nearest2);
43256
+ const nearest2 = item.getNearestEdgePointTo(pointer);
43257
+ this.controlPoint = getFixedPoint(item, nearest2);
43239
43258
  } else {
43240
43259
  if (this.hover.isTimeoutElapsed) {
43241
- this.controlPoint = getFixedPoint(item2, pointer);
43260
+ this.controlPoint = getFixedPoint(item, pointer);
43242
43261
  } else {
43243
- this.controlPoint = getFixedPoint(item2, pointer);
43262
+ this.controlPoint = getFixedPoint(item, pointer);
43244
43263
  }
43245
43264
  }
43246
43265
  }
@@ -43301,23 +43320,23 @@ class ConnectorSnap {
43301
43320
  }
43302
43321
  return nearest;
43303
43322
  }
43304
- getClosestPointOnItem(item2, position4) {
43305
- const nearestEdgePoint = item2.getNearestEdgePointTo(position4);
43306
- return getFixedPoint(item2, nearestEdgePoint);
43323
+ getClosestPointOnItem(item, position4) {
43324
+ const nearestEdgePoint = item.getNearestEdgePointTo(position4);
43325
+ return getFixedPoint(item, nearestEdgePoint);
43307
43326
  }
43308
- isNearBorder(item2) {
43309
- if (!item2) {
43327
+ isNearBorder(item) {
43328
+ if (!item) {
43310
43329
  return false;
43311
43330
  }
43312
43331
  const pointer = this.board.pointer.point;
43313
- const point5 = item2.getNearestEdgePointTo(pointer);
43332
+ const point5 = item.getNearestEdgePointTo(pointer);
43314
43333
  const distance = pointer.getDistance(point5);
43315
43334
  return distance < this.distance.border / this.board.camera.getScale();
43316
43335
  }
43317
43336
  setSnap() {
43318
- const item2 = this.snap.item;
43319
- const path2 = item2 && "getPath" in item2 ? item2?.getPath() : null;
43320
- if (!item2 || !path2) {
43337
+ const item = this.snap.item;
43338
+ const path2 = item && "getPath" in item ? item?.getPath() : null;
43339
+ if (!item || !path2) {
43321
43340
  this.snap.path = null;
43322
43341
  this.snap.anchors = [];
43323
43342
  this.snap.anchor = null;
@@ -43328,11 +43347,11 @@ class ConnectorSnap {
43328
43347
  if (this.snap.item === this.hover.item && !this.hover.isTimeoutElapsed) {
43329
43348
  path2.setBackgroundColor(this.color.snapBackgroundHighlight);
43330
43349
  }
43331
- this.setAnchors(item2);
43350
+ this.setAnchors(item);
43332
43351
  }
43333
43352
  }
43334
- setAnchors(item2) {
43335
- const points = item2.getSnapAnchorPoints();
43353
+ setAnchors(item) {
43354
+ const points = item.getSnapAnchorPoints();
43336
43355
  if (!points) {
43337
43356
  return;
43338
43357
  }
@@ -43366,10 +43385,10 @@ class ConnectorSnap {
43366
43385
  }
43367
43386
  setPoint() {
43368
43387
  const pointer = this.board.pointer.point;
43369
- const { item: item2, anchor } = this.snap;
43370
- if (item2) {
43388
+ const { item, anchor } = this.snap;
43389
+ if (item) {
43371
43390
  if (!anchor) {
43372
- const point5 = item2.getNearestEdgePointTo(pointer);
43391
+ const point5 = item.getNearestEdgePointTo(pointer);
43373
43392
  if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
43374
43393
  this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
43375
43394
  } else {
@@ -43742,12 +43761,12 @@ class NestingHighlighter extends Tool {
43742
43761
  this.toHighlight.push({ groupItem, children: array });
43743
43762
  }
43744
43763
  }
43745
- addSingleItem(item2) {
43746
- this.toHighlight.push({ children: [item2] });
43764
+ addSingleItem(item) {
43765
+ this.toHighlight.push({ children: [item] });
43747
43766
  }
43748
- remove(item2) {
43767
+ remove(item) {
43749
43768
  this.toHighlight.forEach((group) => {
43750
- group.children = group.children.filter((child) => child !== item2);
43769
+ group.children = group.children.filter((child) => child !== item);
43751
43770
  });
43752
43771
  this.toHighlight = this.toHighlight.filter((group) => group.children.length > 0);
43753
43772
  }
@@ -43814,7 +43833,7 @@ class AddFrame extends BoardTool {
43814
43833
  this.mbr.borderColor = "blue";
43815
43834
  this.nestingHighlighter.clear();
43816
43835
  const enclosedOrCrossed = this.board.items.getEnclosedOrCrossed(this.mbr.left, this.mbr.top, this.mbr.right, this.mbr.bottom);
43817
- const inside = enclosedOrCrossed.filter((item2) => !(item2 instanceof Frame2) && item2.parent === "Board" && this.mbr.isInside(item2.getMbr().getCenter()));
43836
+ const inside = enclosedOrCrossed.filter((item) => !(item instanceof Frame2) && item.parent === "Board" && this.mbr.isInside(item.getMbr().getCenter()));
43818
43837
  this.nestingHighlighter.add(this.frame, inside);
43819
43838
  this.initTransformation();
43820
43839
  this.board.tools.publish();
@@ -43835,7 +43854,7 @@ class AddFrame extends BoardTool {
43835
43854
  localStorage.setItem("lastFrameScale", JSON.stringify(this.frame.transformation.getScale()));
43836
43855
  }
43837
43856
  const currMbr = this.frame.getMbr();
43838
- const frameChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board").filter((item2) => this.frame.handleNesting(item2));
43857
+ const frameChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.frame.handleNesting(item));
43839
43858
  this.applyAddChildren(frameChildren);
43840
43859
  if (this.shape !== "Custom") {
43841
43860
  this.applyCanChangeRatio(false);
@@ -43851,7 +43870,7 @@ class AddFrame extends BoardTool {
43851
43870
  return true;
43852
43871
  }
43853
43872
  addNextTo() {
43854
- const framesInView = this.board.items.getItemsInView().filter((item2) => item2 instanceof Frame2);
43873
+ const framesInView = this.board.items.getItemsInView().filter((item) => item instanceof Frame2);
43855
43874
  if (framesInView.length === 0) {
43856
43875
  if (this.shape === "Custom") {
43857
43876
  const { x, y } = this.frame.getLastFrameScale();
@@ -43889,7 +43908,7 @@ class AddFrame extends BoardTool {
43889
43908
  this.board.camera.viewRectangle(this.frame.getMbr());
43890
43909
  }
43891
43910
  const frameMbr = this.frame.getMbr();
43892
- this.board.items.getEnclosedOrCrossed(frameMbr.left, frameMbr.top, frameMbr.right, frameMbr.bottom).filter((item2) => item2.parent === "Board").filter((item2) => this.frame.handleNesting(item2)).forEach((item2) => this.applyAddChildren([item2]));
43911
+ this.board.items.getEnclosedOrCrossed(frameMbr.left, frameMbr.top, frameMbr.right, frameMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.frame.handleNesting(item)).forEach((item) => this.applyAddChildren([item]));
43893
43912
  const frame = this.board.add(this.frame);
43894
43913
  frame.text.editor.moveCursorToEndOfTheText();
43895
43914
  this.nestingHighlighter.clear();
@@ -44394,13 +44413,13 @@ class Eraser extends BoardTool {
44394
44413
  }
44395
44414
  removeUnderPointOrLine() {
44396
44415
  const segments = this.drawing.getLines();
44397
- const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item2) => {
44398
- return item2.itemType === "Drawing" && item2.getLines().find((line) => {
44399
- return line.getDistance(this.board.pointer.point) <= item2.strokeWidth / 2 + this.strokeWidth / 2;
44416
+ const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item) => {
44417
+ return item.itemType === "Drawing" && item.getLines().find((line) => {
44418
+ return line.getDistance(this.board.pointer.point) <= item.strokeWidth / 2 + this.strokeWidth / 2;
44400
44419
  });
44401
44420
  });
44402
- items.push(...this.board.items.getEnclosedOrCrossed(this.drawing.points[0].x, this.drawing.points[0].y, this.board.pointer.point.x, this.board.pointer.point.y).filter((item2) => {
44403
- return item2.itemType === "Drawing" && item2.getLines().some((line) => {
44421
+ items.push(...this.board.items.getEnclosedOrCrossed(this.drawing.points[0].x, this.drawing.points[0].y, this.board.pointer.point.x, this.board.pointer.point.y).filter((item) => {
44422
+ return item.itemType === "Drawing" && item.getLines().some((line) => {
44404
44423
  return segments.some((segment) => segment.hasIntersectionPoint(line));
44405
44424
  });
44406
44425
  }));
@@ -44852,20 +44871,20 @@ function createCanvasDrawer(board) {
44852
44871
  context.ctx.setTransform(board2.camera.getMatrix().scaleX, 0, 0, board2.camera.getMatrix().scaleY, 0, 0);
44853
44872
  context.matrix.applyToContext(context.ctx);
44854
44873
  const items = Object.keys(translation).map((id) => {
44855
- const item2 = board2.items.getById(id);
44856
- if (item2) {
44857
- if (item2.itemType !== "Frame") {
44858
- return item2;
44874
+ const item = board2.items.getById(id);
44875
+ if (item) {
44876
+ if (item.itemType !== "Frame") {
44877
+ return item;
44859
44878
  }
44860
- item2.render(context);
44861
- return item2;
44879
+ item.render(context);
44880
+ return item;
44862
44881
  }
44863
44882
  return;
44864
- }).filter((item2) => !!item2);
44865
- items.forEach((item2) => {
44866
- if (item2.itemType !== "Frame") {
44867
- item2.render(context);
44868
- board2.selection.renderItemMbr(context, item2, board2.camera.getMatrix().scaleX);
44883
+ }).filter((item) => !!item);
44884
+ items.forEach((item) => {
44885
+ if (item.itemType !== "Frame") {
44886
+ item.render(context);
44887
+ board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
44869
44888
  }
44870
44889
  });
44871
44890
  return { canvas: container, items };
@@ -44926,10 +44945,10 @@ function createCanvasDrawer(board) {
44926
44945
  if (lastTranslationKeys) {
44927
44946
  board.selection.shouldPublish = false;
44928
44947
  lastTranslationKeys.forEach((id) => {
44929
- const item2 = board.items.getById(id);
44930
- if (item2) {
44931
- item2.transformationRenderBlock = undefined;
44932
- item2.subject.publish(item2);
44948
+ const item = board.items.getById(id);
44949
+ if (item) {
44950
+ item.transformationRenderBlock = undefined;
44951
+ item.subject.publish(item);
44933
44952
  }
44934
44953
  });
44935
44954
  lastTranslationKeys = undefined;
@@ -44961,9 +44980,9 @@ function createCanvasDrawer(board) {
44961
44980
  lastCreatedCanvas = cnvs;
44962
44981
  lastTranslationKeys = Object.keys(translation);
44963
44982
  lastTranslationKeys.forEach((id) => {
44964
- const item2 = board.items.getById(id);
44965
- if (item2) {
44966
- item2.transformationRenderBlock = true;
44983
+ const item = board.items.getById(id);
44984
+ if (item) {
44985
+ item.transformationRenderBlock = true;
44967
44986
  }
44968
44987
  });
44969
44988
  board.selection.transformationRenderBlock = true;
@@ -44973,14 +44992,14 @@ function createCanvasDrawer(board) {
44973
44992
  }
44974
44993
  function countSumMbr(translation) {
44975
44994
  return Object.keys(translation).reduce((mbr, id) => {
44976
- const item2 = board.items.getById(id);
44977
- if (item2) {
44995
+ const item = board.items.getById(id);
44996
+ if (item) {
44978
44997
  if (!mbr) {
44979
- mbr = item2.getMbr();
44998
+ mbr = item.getMbr();
44980
44999
  } else {
44981
- mbr.combine(item2.getMbr());
44982
- if (item2.itemType === "Frame") {
44983
- mbr.combine(item2.getRichText().getMbr());
45000
+ mbr.combine(item.getMbr());
45001
+ if (item.itemType === "Frame") {
45002
+ mbr.combine(item.getRichText().getMbr());
44984
45003
  }
44985
45004
  }
44986
45005
  }
@@ -45011,8 +45030,8 @@ function createCanvasDrawer(board) {
45011
45030
  }
45012
45031
  function highlightNesting() {
45013
45032
  const container = getLastCreatedCanvas();
45014
- const drawnItemsMap = drawnItems?.reduce((acc, item2) => {
45015
- acc.set(item2.getId(), { item: item2, mbr: item2.getMbr() });
45033
+ const drawnItemsMap = drawnItems?.reduce((acc, item) => {
45034
+ acc.set(item.getId(), { item, mbr: item.getMbr() });
45016
45035
  return acc;
45017
45036
  }, new Map);
45018
45037
  if (!container || !drawnItems) {
@@ -45047,11 +45066,11 @@ function createCanvasDrawer(board) {
45047
45066
  mbr.transform(currMatrix);
45048
45067
  });
45049
45068
  groups.forEach((group) => {
45050
- drawnItemsMap?.forEach(({ mbr, item: item2 }, key) => {
45051
- if ("canBeNested" in item2 && !item2.canBeNested) {
45069
+ drawnItemsMap?.forEach(({ mbr, item }, key) => {
45070
+ if ("canBeNested" in item && !item.canBeNested) {
45052
45071
  return;
45053
45072
  }
45054
- if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item2.parent !== group.getId()) && group.handleNesting(mbr)) {
45073
+ if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item.parent !== group.getId()) && group.handleNesting(mbr)) {
45055
45074
  const div = createBorderDivForItem(mbr, lastCreatedCanvas);
45056
45075
  removeHighlighted(key);
45057
45076
  highlightedDivs.set(key, div);
@@ -45112,10 +45131,10 @@ function createCanvasDrawer(board) {
45112
45131
  }
45113
45132
 
45114
45133
  // src/Selection/QuickAddButtons/quickAddHelpers.ts
45115
- function getControlPointData(item2, index2, isRichText = false) {
45116
- const itemScale = isRichText ? { x: 1, y: 1 } : item2.transformation.getScale();
45117
- const width2 = item2.getPathMbr().getWidth();
45118
- let height3 = item2.getPathMbr().getHeight();
45134
+ function getControlPointData(item, index2, isRichText = false) {
45135
+ const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
45136
+ const width2 = item.getPathMbr().getWidth();
45137
+ let height3 = item.getPathMbr().getHeight();
45119
45138
  const adjMapScaled = {
45120
45139
  0: { x: 0, y: height3 / 2 / itemScale.y },
45121
45140
  1: {
@@ -45130,7 +45149,7 @@ function getControlPointData(item2, index2, isRichText = false) {
45130
45149
  };
45131
45150
  return {
45132
45151
  pointType: "Fixed",
45133
- itemId: item2.getId(),
45152
+ itemId: item.getId(),
45134
45153
  relativeX: adjMapScaled[index2].x,
45135
45154
  relativeY: adjMapScaled[index2].y
45136
45155
  };
@@ -45265,10 +45284,10 @@ function getQuickAddButtons(selection, board) {
45265
45284
  let newHeight = height3;
45266
45285
  let itemData;
45267
45286
  if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
45268
- const item2 = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
45269
- newWidth = item2.getMbr().getWidth();
45270
- newHeight = item2.getMbr().getHeight();
45271
- itemData = item2.serialize();
45287
+ const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
45288
+ newWidth = item.getMbr().getWidth();
45289
+ newHeight = item.getMbr().getHeight();
45290
+ itemData = item.serialize();
45272
45291
  const { minX, minY, maxY, maxX } = offsets;
45273
45292
  offsetX = Math.min(offsetX, maxX);
45274
45293
  offsetX = Math.max(offsetX, minX);
@@ -45301,7 +45320,7 @@ function getQuickAddButtons(selection, board) {
45301
45320
  }
45302
45321
  const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
45303
45322
  let step = 1;
45304
- while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item2) => item2.itemType !== "Connector").length > 0) {
45323
+ while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
45305
45324
  const xDirection = step % 2 === 0 ? -1 : 1;
45306
45325
  const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
45307
45326
  newMbr.transform(new Matrix2(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
@@ -45434,7 +45453,7 @@ function getQuickAddButtons(selection, board) {
45434
45453
  clear();
45435
45454
  return;
45436
45455
  }
45437
- const { positions, item: item2 } = position4;
45456
+ const { positions, item } = position4;
45438
45457
  const cameraMatrix = board.camera.getMatrix();
45439
45458
  const cameraMbr = board.camera.getMbr();
45440
45459
  const positionAdjustments = {
@@ -45462,7 +45481,7 @@ function getQuickAddButtons(selection, board) {
45462
45481
  };
45463
45482
  const button = document.createElement("button");
45464
45483
  button.classList.add("microboard-quickAddButton");
45465
- if (item2.itemType === "AINode" && index2 === 2) {
45484
+ if (item.itemType === "AINode" && index2 === 2) {
45466
45485
  button.classList.add("microboard-invisible");
45467
45486
  }
45468
45487
  button.classList.add(`microboard-${adjustment.rotate}`);
@@ -45478,7 +45497,7 @@ function getQuickAddButtons(selection, board) {
45478
45497
  clearTimeout(timeoutId);
45479
45498
  }
45480
45499
  if (button.isMouseDown) {
45481
- board.tools.addConnector(true, item2, pos);
45500
+ board.tools.addConnector(true, item, pos);
45482
45501
  } else {
45483
45502
  quickAddItems = undefined;
45484
45503
  selection.subject.publish(selection);
@@ -45585,11 +45604,11 @@ class AlignmentHelper {
45585
45604
  return baseThickness / (zoom / 100);
45586
45605
  }
45587
45606
  combineMBRs(items) {
45588
- return items.reduce((acc, item2, i) => {
45607
+ return items.reduce((acc, item, i) => {
45589
45608
  if (i === 0) {
45590
45609
  return acc;
45591
45610
  }
45592
- const itemMbr = item2.getPathMbr();
45611
+ const itemMbr = item.getPathMbr();
45593
45612
  return acc.combine(itemMbr);
45594
45613
  }, items[0].getMbr());
45595
45614
  }
@@ -45603,7 +45622,7 @@ class AlignmentHelper {
45603
45622
  const scale = this.board.camera.getScale();
45604
45623
  const dynamicAlignThreshold = Math.min(this.alignThreshold / scale, 8);
45605
45624
  const childrenIds = "index" in movingItem && movingItem.index ? movingItem.getChildrenIds() : [];
45606
- const nearbyItems = this.canvasDrawer.getLastCreatedCanvas() ? this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (item2) => !excludeItems.includes(item2), Math.ceil(cameraWidth)) : this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (otherItem) => otherItem !== movingMBR && otherItem.itemType !== "Connector" && otherItem.itemType !== "Drawing" && otherItem.isInView(camera) && !childrenIds.includes(otherItem.getId()), Math.ceil(cameraWidth)).filter((item2) => Array.isArray(movingItem) ? !movingItem.includes(item2) : true);
45625
+ const nearbyItems = this.canvasDrawer.getLastCreatedCanvas() ? this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (item) => !excludeItems.includes(item), Math.ceil(cameraWidth)) : this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (otherItem) => otherItem !== movingMBR && otherItem.itemType !== "Connector" && otherItem.itemType !== "Drawing" && otherItem.isInView(camera) && !childrenIds.includes(otherItem.getId()), Math.ceil(cameraWidth)).filter((item) => Array.isArray(movingItem) ? !movingItem.includes(item) : true);
45607
45626
  const verticalAlignments = new Map;
45608
45627
  const horizontalAlignments = new Map;
45609
45628
  const addVerticalAlignment = (x, minY, maxY) => {
@@ -45624,11 +45643,11 @@ class AlignmentHelper {
45624
45643
  horizontalAlignments.set(y, { minX, maxX });
45625
45644
  }
45626
45645
  };
45627
- nearbyItems.forEach((item2) => {
45628
- if (item2 === movingItem || item2.itemType === "Comment") {
45646
+ nearbyItems.forEach((item) => {
45647
+ if (item === movingItem || item.itemType === "Comment") {
45629
45648
  return;
45630
45649
  }
45631
- const itemMbr = item2.itemType === "Shape" ? item2.getPath().getMbr() : item2.getMbr();
45650
+ const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
45632
45651
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
45633
45652
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
45634
45653
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -45895,20 +45914,20 @@ class AlignmentHelper {
45895
45914
  }
45896
45915
  return false;
45897
45916
  }
45898
- translateItems(item2, x, y, timeStamp) {
45917
+ translateItems(item, x, y, timeStamp) {
45899
45918
  if (this.canvasDrawer.getLastCreatedCanvas()) {
45900
45919
  return;
45901
45920
  }
45902
- if (Array.isArray(item2)) {
45921
+ if (Array.isArray(item)) {
45903
45922
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45904
45923
  this.board.selection.transformMany(translation, timeStamp);
45905
45924
  return;
45906
45925
  }
45907
- if (item2.itemType === "Frame") {
45926
+ if (item.itemType === "Frame") {
45908
45927
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45909
45928
  this.board.selection.transformMany(translation, timeStamp);
45910
45929
  } else {
45911
- const id = item2.getId();
45930
+ const id = item.getId();
45912
45931
  const transformMap = {};
45913
45932
  transformMap[id] = {
45914
45933
  class: "Transformation",
@@ -46036,12 +46055,12 @@ class Select extends Tool {
46036
46055
  this.debounceUpd.setFalse();
46037
46056
  this.snapLines = { verticalLines: [], horizontalLines: [] };
46038
46057
  }
46039
- handleSnapping(item2) {
46058
+ handleSnapping(item) {
46040
46059
  if (this.board.keyboard.isShift) {
46041
46060
  return false;
46042
46061
  }
46043
- const increasedSnapThreshold = Array.isArray(item2) ? 40 : 35;
46044
- this.isSnapped = this.alignmentHelper.snapToClosestLine(item2, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
46062
+ const increasedSnapThreshold = Array.isArray(item) ? 40 : 35;
46063
+ this.isSnapped = this.alignmentHelper.snapToClosestLine(item, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
46045
46064
  if (this.isSnapped) {
46046
46065
  if (!this.snapCursorPos) {
46047
46066
  this.snapCursorPos = new Point(this.board.pointer.point.x, this.board.pointer.point.y);
@@ -46051,10 +46070,10 @@ class Select extends Tool {
46051
46070
  if ((cursorDiffX > increasedSnapThreshold || cursorDiffY > increasedSnapThreshold) && this.initialCursorPos) {
46052
46071
  this.isSnapped = false;
46053
46072
  this.snapCursorPos = null;
46054
- const itemCenter = Array.isArray(item2) ? this.alignmentHelper.combineMBRs(item2).getCenter() : item2.getMbr().getCenter();
46073
+ const itemCenter = Array.isArray(item) ? this.alignmentHelper.combineMBRs(item).getCenter() : item.getMbr().getCenter();
46055
46074
  const translateX = this.board.pointer.point.x - this.initialCursorPos.x - itemCenter.x;
46056
46075
  const translateY = this.board.pointer.point.y - this.initialCursorPos.y - itemCenter.y;
46057
- this.alignmentHelper.translateItems(item2, translateX, translateY, this.beginTimeStamp);
46076
+ this.alignmentHelper.translateItems(item, translateX, translateY, this.beginTimeStamp);
46058
46077
  }
46059
46078
  }
46060
46079
  return false;
@@ -46104,10 +46123,10 @@ class Select extends Tool {
46104
46123
  angleDiff = angleDiff < 0 ? angleDiff + 360 : angleDiff;
46105
46124
  return Math.min(angleDiff, 360 - angleDiff);
46106
46125
  }
46107
- handleShiftGuidelines(item2, mousePosition) {
46108
- if (item2) {
46126
+ handleShiftGuidelines(item, mousePosition) {
46127
+ if (item) {
46109
46128
  if (!this.originalCenter) {
46110
- this.originalCenter = Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().copy() : item2.getMbr().getCenter().copy();
46129
+ this.originalCenter = Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().copy() : item.getMbr().getCenter().copy();
46111
46130
  this.guidelines = this.alignmentHelper.generateGuidelines(this.originalCenter).lines;
46112
46131
  }
46113
46132
  this.mainLine = new Line(this.originalCenter, mousePosition);
@@ -46128,13 +46147,13 @@ class Select extends Tool {
46128
46147
  const newEndX = this.originalCenter.x + snapDirectionX * mainLineLength;
46129
46148
  const newEndY = this.originalCenter.y + snapDirectionY * mainLineLength;
46130
46149
  const threshold = Infinity;
46131
- const translateX = newEndX - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().x : item2.getMbr().getCenter().x);
46132
- const translateY = newEndY - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().y : item2.getMbr().getCenter().y);
46133
- if (Array.isArray(item2)) {
46150
+ const translateX = newEndX - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().x : item.getMbr().getCenter().x);
46151
+ const translateY = newEndY - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().y : item.getMbr().getCenter().y);
46152
+ if (Array.isArray(item)) {
46134
46153
  const translation = this.board.selection.getManyItemsTranslation(translateX, translateY);
46135
46154
  this.board.selection.transformMany(translation, this.beginTimeStamp);
46136
46155
  } else {
46137
- item2.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
46156
+ item.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
46138
46157
  }
46139
46158
  }
46140
46159
  }
@@ -46177,7 +46196,7 @@ class Select extends Tool {
46177
46196
  return false;
46178
46197
  }
46179
46198
  this.isDownOnBoard = hover.length === 0;
46180
- this.isDrawingRectangle = hover.filter((item2) => !(item2 instanceof Frame2)).length === 0 && hover.filter((item2) => item2 instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
46199
+ this.isDrawingRectangle = hover.filter((item) => !(item instanceof Frame2)).length === 0 && hover.filter((item) => item instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
46181
46200
  if (this.isDrawingRectangle) {
46182
46201
  const { x, y } = pointer.point;
46183
46202
  this.line = new Line(new Point(x, y), new Point(x, y));
@@ -46197,7 +46216,7 @@ class Select extends Tool {
46197
46216
  });
46198
46217
  return false;
46199
46218
  }
46200
- const isHoverLocked = hover.every((item2) => item2.transformation.isLocked);
46219
+ const isHoverLocked = hover.every((item) => item.transformation.isLocked);
46201
46220
  if (isHoverLocked) {
46202
46221
  return false;
46203
46222
  }
@@ -46331,7 +46350,7 @@ class Select extends Tool {
46331
46350
  const translation = selection.getManyItemsTranslation(x, y);
46332
46351
  const translationKeys = Object.keys(translation);
46333
46352
  const commentsSet = new Set(this.board.items.getComments().map((comment2) => comment2.getId()));
46334
- if (translationKeys.filter((item2) => !commentsSet.has(item2)).length > 10) {
46353
+ if (translationKeys.filter((item) => !commentsSet.has(item)).length > 10) {
46335
46354
  const selectedMbr = this.board.selection.getMbr()?.copy();
46336
46355
  const sumMbr = this.canvasDrawer.countSumMbr(translation);
46337
46356
  if (sumMbr) {
@@ -46358,7 +46377,7 @@ class Select extends Tool {
46358
46377
  return false;
46359
46378
  }
46360
46379
  const draggingMbr = draggingItem.getMbr();
46361
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item2) => item2 instanceof Frame2);
46380
+ const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
46362
46381
  frames.forEach((frame) => {
46363
46382
  if (frame.handleNesting(draggingItem)) {
46364
46383
  this.nestingHighlighter.add(frame, draggingItem);
@@ -46368,7 +46387,7 @@ class Select extends Tool {
46368
46387
  });
46369
46388
  }
46370
46389
  const hover = items.getUnderPointer();
46371
- this.isHoverUnselectedItem = hover.filter((item2) => item2.itemType === "Placeholder").length === 1;
46390
+ this.isHoverUnselectedItem = hover.filter((item) => item.itemType === "Placeholder").length === 1;
46372
46391
  if (this.isHoverUnselectedItem && !this.isDraggingUnselectedItem && selection.getContext() === "None") {
46373
46392
  selection.setContext("HoverUnderPointer");
46374
46393
  return false;
@@ -46412,15 +46431,15 @@ class Select extends Tool {
46412
46431
  }
46413
46432
  }
46414
46433
  updateFramesNesting(selectionMbr, selection) {
46415
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item2) => item2 instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
46416
- const draggingFramesIds = selection.list().filter((item2) => item2 instanceof Frame2).map((frame) => frame.getId());
46417
- selection.list().forEach((item2) => {
46418
- if (!(item2 instanceof Frame2) && !draggingFramesIds.includes(item2.parent)) {
46434
+ const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
46435
+ const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
46436
+ selection.list().forEach((item) => {
46437
+ if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
46419
46438
  frames.forEach((frame) => {
46420
- if (frame.handleNesting(item2)) {
46421
- this.nestingHighlighter.add(frame, item2);
46439
+ if (frame.handleNesting(item)) {
46440
+ this.nestingHighlighter.add(frame, item);
46422
46441
  } else {
46423
- this.nestingHighlighter.remove(item2);
46442
+ this.nestingHighlighter.remove(item);
46424
46443
  }
46425
46444
  });
46426
46445
  }
@@ -46512,7 +46531,7 @@ class Select extends Tool {
46512
46531
  const childrenIds = underPointer.getChildrenIds();
46513
46532
  console.log("UNDERPOINTER", underPointer);
46514
46533
  console.log("CHILDREN", childrenIds);
46515
- const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => childrenIds && childrenIds.includes(item2.getId()));
46534
+ const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
46516
46535
  this.board.selection.add(itemsInFrame);
46517
46536
  }
46518
46537
  this.board.selection.setContext("EditUnderPointer");
@@ -46752,8 +46771,8 @@ class ShapeTool extends CustomTool {
46752
46771
  resizeType = "leftBottom";
46753
46772
  bounds = new Mbr;
46754
46773
  isDown = false;
46755
- constructor(board, name, item2, settings) {
46756
- super(board, name, item2);
46774
+ constructor(board, name, item, settings) {
46775
+ super(board, name, item);
46757
46776
  this.settings = settings;
46758
46777
  this.setCursor();
46759
46778
  }
@@ -46836,8 +46855,8 @@ class ShapeTool extends CustomTool {
46836
46855
 
46837
46856
  class StickerTool extends CustomTool {
46838
46857
  settings;
46839
- constructor(board, name, item2, settings) {
46840
- super(board, name, item2);
46858
+ constructor(board, name, item, settings) {
46859
+ super(board, name, item);
46841
46860
  this.settings = settings;
46842
46861
  this.setCursor();
46843
46862
  }
@@ -47143,7 +47162,7 @@ class Tools extends ToolContext {
47143
47162
  this.subject.publish(this);
47144
47163
  }
47145
47164
  sortFrames() {
47146
- const frames = this.board.items.listAll().filter((item2) => item2 instanceof Frame2);
47165
+ const frames = this.board.items.listAll().filter((item) => item instanceof Frame2);
47147
47166
  const sortedFrames = frames.sort((fr1, fr2) => {
47148
47167
  const mbr1 = fr1.getMbr();
47149
47168
  const mbr2 = fr2.getMbr();
@@ -47369,24 +47388,24 @@ function validateGroupData(groupData) {
47369
47388
  }
47370
47389
  // src/Items/RegisterItem.ts
47371
47390
  function registerItem({
47372
- item: item2,
47391
+ item,
47373
47392
  defaultData: defaultData2,
47374
47393
  toolData
47375
47394
  }) {
47376
47395
  const { itemType } = defaultData2;
47377
- itemFactories[itemType] = createItemFactory(item2, defaultData2);
47396
+ itemFactories[itemType] = createItemFactory(item, defaultData2);
47378
47397
  itemValidators[itemType] = createItemValidator(defaultData2);
47379
47398
  if (toolData) {
47380
47399
  registeredTools[toolData.name] = toolData.tool;
47381
47400
  }
47382
47401
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
47383
47402
  }
47384
- function createItemFactory(item2, defaultData2) {
47403
+ function createItemFactory(item, defaultData2) {
47385
47404
  return function itemFactory(id, data, board) {
47386
47405
  if (data.itemType !== defaultData2.itemType) {
47387
47406
  throw new Error(`Invalid data for ${defaultData2.itemType}`);
47388
47407
  }
47389
- return new item2(board, id, defaultData2).setId(id).deserialize(data);
47408
+ return new item(board, id, defaultData2).setId(id).deserialize(data);
47390
47409
  };
47391
47410
  }
47392
47411
  function createItemValidator(defaultData2) {
@@ -47401,7 +47420,7 @@ function createItemValidator(defaultData2) {
47401
47420
  }
47402
47421
  function createItemCommandFactory(itemType) {
47403
47422
  return function itemCommandFactory(items, operation) {
47404
- return new BaseCommand(items.filter((item2) => item2.itemType === itemType), operation);
47423
+ return new BaseCommand(items.filter((item) => item.itemType === itemType), operation);
47405
47424
  };
47406
47425
  }
47407
47426
  // src/Items/Examples/Star/AddStar.ts
@@ -48426,8 +48445,8 @@ class Camera {
48426
48445
  this.observableItem = null;
48427
48446
  }
48428
48447
  }
48429
- subscribeToItem(item2) {
48430
- this.observableItem = item2;
48448
+ subscribeToItem(item) {
48449
+ this.observableItem = item;
48431
48450
  this.observableItem.subject.subscribe(this.observeItem);
48432
48451
  }
48433
48452
  observeItem = () => {
@@ -48653,7 +48672,7 @@ class Camera {
48653
48672
  }
48654
48673
  addToView(mbr, inView) {
48655
48674
  if (!mbr.isEnclosedBy(this.getMbr())) {
48656
- this.viewRectangle(inView.reduce((acc, item2) => acc.combine(item2.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48675
+ this.viewRectangle(inView.reduce((acc, item) => acc.combine(item.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48657
48676
  }
48658
48677
  }
48659
48678
  viewRectangle(mbr, offsetInPercent = 10, duration = 500) {
@@ -50262,8 +50281,8 @@ class Presence {
50262
50281
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.28421 4.30174C3.55182 4.02741 3.95268 3.93015 4.31625 4.05135L20.3163 9.38468C20.7064 9.51472 20.9771 9.8703 20.9987 10.2809C21.0202 10.6916 20.7882 11.0736 20.4138 11.2437L20.36 11.2682L20.2042 11.3396C20.069 11.4015 19.8742 11.4912 19.636 11.6017C19.1595 11.8227 18.5109 12.1262 17.8216 12.4571C16.4106 13.1344 14.9278 13.8797 14.3325 14.2765C14.3325 14.2765 14.3258 14.2809 14.308 14.2965C14.2906 14.3118 14.2673 14.3339 14.2382 14.3646C14.1791 14.4267 14.1072 14.5123 14.0231 14.6243C13.8542 14.8496 13.6622 15.1471 13.4541 15.5039C13.0384 16.2164 12.5946 17.1024 12.1833 17.98C11.7735 18.8541 11.4038 19.7031 11.136 20.3348C11.0023 20.6502 10.8944 20.9105 10.8201 21.0915C10.783 21.182 10.7543 21.2525 10.735 21.3002L10.7132 21.3542L10.7066 21.3707C10.5524 21.7561 10.1759 22.0069 9.76082 21.9999C9.34577 21.9928 8.97824 21.7301 8.83725 21.3397L3.05947 5.33967C2.92931 4.97922 3.0166 4.57607 3.28421 4.30174Z" fill="${color2}"/>
50263
50282
  </svg>`;
50264
50283
  }
50265
- renderItemMbr(context, item2, color2, customScale) {
50266
- const mbr = item2.getMbr();
50284
+ renderItemMbr(context, item, color2, customScale) {
50285
+ const mbr = item.getMbr();
50267
50286
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
50268
50287
  mbr.borderColor = color2;
50269
50288
  mbr.render(context);
@@ -50403,8 +50422,8 @@ class Presence {
50403
50422
  selectionMbr.strokeWidth = 1 / context.matrix.scaleX;
50404
50423
  selectionMbr.borderColor = selection.color;
50405
50424
  selectionMbr.render(context);
50406
- for (const item2 of selection.selection) {
50407
- this.renderItemMbr(context, item2, selection.color);
50425
+ for (const item of selection.selection) {
50426
+ this.renderItemMbr(context, item, selection.color);
50408
50427
  }
50409
50428
  }
50410
50429
  }
@@ -50437,14 +50456,14 @@ class SelectionItems {
50437
50456
  items = new Map;
50438
50457
  add(value) {
50439
50458
  if (Array.isArray(value)) {
50440
- value.forEach((item2) => this.items.set(item2.getId(), item2));
50459
+ value.forEach((item) => this.items.set(item.getId(), item));
50441
50460
  } else {
50442
50461
  this.items.set(value.getId(), value);
50443
50462
  }
50444
50463
  }
50445
50464
  remove(value) {
50446
50465
  if (Array.isArray(value)) {
50447
- value.forEach((item2) => this.items.delete(item2.getId()));
50466
+ value.forEach((item) => this.items.delete(item.getId()));
50448
50467
  } else {
50449
50468
  this.items.delete(value.getId());
50450
50469
  }
@@ -50474,8 +50493,8 @@ class SelectionItems {
50474
50493
  if (this.isEmpty()) {
50475
50494
  return false;
50476
50495
  }
50477
- for (const item2 of this.items.values()) {
50478
- if (item2.itemType !== "RichText") {
50496
+ for (const item of this.items.values()) {
50497
+ if (item.itemType !== "RichText") {
50479
50498
  return false;
50480
50499
  }
50481
50500
  }
@@ -50485,14 +50504,14 @@ class SelectionItems {
50485
50504
  if (this.isEmpty()) {
50486
50505
  return false;
50487
50506
  }
50488
- return Array.from(this.items).every(([, item2]) => item2.itemType === itemType);
50507
+ return Array.from(this.items).every(([, item]) => item.itemType === itemType);
50489
50508
  }
50490
50509
  isItemTypes(itemTypes) {
50491
50510
  if (this.isEmpty()) {
50492
50511
  return false;
50493
50512
  }
50494
- for (const item2 of this.items.values()) {
50495
- if (!itemTypes.includes(item2.itemType)) {
50513
+ for (const item of this.items.values()) {
50514
+ if (!itemTypes.includes(item.itemType)) {
50496
50515
  return false;
50497
50516
  }
50498
50517
  }
@@ -50500,16 +50519,16 @@ class SelectionItems {
50500
50519
  }
50501
50520
  getItemTypes() {
50502
50521
  const itemTypes = new Set;
50503
- this.items.forEach((item2) => itemTypes.add(item2.itemType));
50522
+ this.items.forEach((item) => itemTypes.add(item.itemType));
50504
50523
  return Array.from(itemTypes);
50505
50524
  }
50506
50525
  getItemsByItemTypes(itemTypes) {
50507
- return Array.from(this.items.values()).filter((item2) => itemTypes.includes(item2.itemType));
50526
+ return Array.from(this.items.values()).filter((item) => itemTypes.includes(item.itemType));
50508
50527
  }
50509
50528
  getIdsByItemTypes(itemTypes) {
50510
50529
  const ids = [];
50511
- this.items.forEach((item2, id) => {
50512
- if (itemTypes.includes(item2.itemType)) {
50530
+ this.items.forEach((item, id) => {
50531
+ if (itemTypes.includes(item.itemType)) {
50513
50532
  ids.push(id);
50514
50533
  }
50515
50534
  });
@@ -50519,7 +50538,7 @@ class SelectionItems {
50519
50538
  return this.isSingle() ? this.items.values().next().value || null : null;
50520
50539
  }
50521
50540
  listByIds(itemIdList) {
50522
- return itemIdList.map((id) => this.items.get(id)).filter((item2) => item2 !== undefined);
50541
+ return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
50523
50542
  }
50524
50543
  ids() {
50525
50544
  return Array.from(this.items.keys());
@@ -50530,7 +50549,7 @@ class SelectionItems {
50530
50549
  return;
50531
50550
  }
50532
50551
  const mbr = items[0].getMbr();
50533
- items.slice(1).forEach((item2) => mbr.combine(item2.getMbr()));
50552
+ items.slice(1).forEach((item) => mbr.combine(item.getMbr()));
50534
50553
  return mbr;
50535
50554
  }
50536
50555
  }
@@ -50735,33 +50754,33 @@ function handleMultipleItemsResize({
50735
50754
  const translation = {};
50736
50755
  const items = itemsToResize ? itemsToResize : board.selection.items.list();
50737
50756
  board.items.getComments().forEach((comment2) => {
50738
- if (items.some((item2) => item2.getId() === comment2.getItemToFollow())) {
50757
+ if (items.some((item) => item.getId() === comment2.getItemToFollow())) {
50739
50758
  items.push(comment2);
50740
50759
  }
50741
50760
  });
50742
- for (const item2 of items) {
50743
- let itemX = item2.getMbr().left;
50744
- let itemY = item2.getMbr().top;
50745
- if (item2.itemType === "Drawing") {
50746
- itemX = item2.transformation.matrix.translateX;
50747
- itemY = item2.transformation.matrix.translateY;
50761
+ for (const item of items) {
50762
+ let itemX = item.getMbr().left;
50763
+ let itemY = item.getMbr().top;
50764
+ if (item.itemType === "Drawing") {
50765
+ itemX = item.transformation.matrix.translateX;
50766
+ itemY = item.transformation.matrix.translateY;
50748
50767
  }
50749
50768
  const deltaX = itemX - initMbr.left;
50750
50769
  const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
50751
50770
  const deltaY = itemY - initMbr.top;
50752
50771
  const translateY = deltaY * matrix.scaleY - deltaY + matrix.translateY;
50753
- if (item2 instanceof RichText) {
50754
- translation[item2.getId()] = getRichTextTranslation({
50755
- item: item2,
50772
+ if (item instanceof RichText) {
50773
+ translation[item.getId()] = getRichTextTranslation({
50774
+ item,
50756
50775
  isWidth,
50757
50776
  isHeight,
50758
50777
  matrix,
50759
50778
  translateX,
50760
50779
  translateY
50761
50780
  });
50762
- } else if (item2 instanceof AINode) {
50763
- translation[item2.getId()] = getAINodeTranslation({
50764
- item: item2,
50781
+ } else if (item instanceof AINode) {
50782
+ translation[item.getId()] = getAINodeTranslation({
50783
+ item,
50765
50784
  isWidth,
50766
50785
  isHeight,
50767
50786
  matrix,
@@ -50769,8 +50788,8 @@ function handleMultipleItemsResize({
50769
50788
  translateY
50770
50789
  });
50771
50790
  } else {
50772
- translation[item2.getId()] = getItemTranslation({
50773
- item: item2,
50791
+ translation[item.getId()] = getItemTranslation({
50792
+ item,
50774
50793
  isWidth,
50775
50794
  isHeight,
50776
50795
  matrix,
@@ -50783,7 +50802,7 @@ function handleMultipleItemsResize({
50783
50802
  return translation;
50784
50803
  }
50785
50804
  function getRichTextTranslation({
50786
- item: item2,
50805
+ item,
50787
50806
  isWidth,
50788
50807
  isHeight,
50789
50808
  matrix,
@@ -50791,11 +50810,11 @@ function getRichTextTranslation({
50791
50810
  translateY
50792
50811
  }) {
50793
50812
  if (isWidth) {
50794
- item2.editor.setMaxWidth(item2.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50813
+ item.editor.setMaxWidth(item.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50795
50814
  return {
50796
50815
  class: "Transformation",
50797
50816
  method: "scaleByTranslateBy",
50798
- item: [item2.getId()],
50817
+ item: [item.getId()],
50799
50818
  translate: { x: matrix.translateX, y: 0 },
50800
50819
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50801
50820
  };
@@ -50803,7 +50822,7 @@ function getRichTextTranslation({
50803
50822
  return {
50804
50823
  class: "Transformation",
50805
50824
  method: "scaleByTranslateBy",
50806
- item: [item2.getId()],
50825
+ item: [item.getId()],
50807
50826
  translate: { x: translateX, y: translateY },
50808
50827
  scale: { x: 1, y: 1 }
50809
50828
  };
@@ -50811,14 +50830,14 @@ function getRichTextTranslation({
50811
50830
  return {
50812
50831
  class: "Transformation",
50813
50832
  method: "scaleByTranslateBy",
50814
- item: [item2.getId()],
50833
+ item: [item.getId()],
50815
50834
  translate: { x: translateX, y: translateY },
50816
50835
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50817
50836
  };
50818
50837
  }
50819
50838
  }
50820
50839
  function getAINodeTranslation({
50821
- item: item2,
50840
+ item,
50822
50841
  isWidth,
50823
50842
  isHeight,
50824
50843
  matrix,
@@ -50826,11 +50845,11 @@ function getAINodeTranslation({
50826
50845
  translateY
50827
50846
  }) {
50828
50847
  if (isWidth) {
50829
- item2.text.editor.setMaxWidth(item2.text.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50848
+ item.text.editor.setMaxWidth(item.text.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50830
50849
  return {
50831
50850
  class: "Transformation",
50832
50851
  method: "scaleByTranslateBy",
50833
- item: [item2.getId()],
50852
+ item: [item.getId()],
50834
50853
  translate: { x: matrix.translateX, y: 0 },
50835
50854
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50836
50855
  };
@@ -50838,7 +50857,7 @@ function getAINodeTranslation({
50838
50857
  return {
50839
50858
  class: "Transformation",
50840
50859
  method: "scaleByTranslateBy",
50841
- item: [item2.getId()],
50860
+ item: [item.getId()],
50842
50861
  translate: { x: translateX, y: translateY },
50843
50862
  scale: { x: 1, y: 1 }
50844
50863
  };
@@ -50846,14 +50865,14 @@ function getAINodeTranslation({
50846
50865
  return {
50847
50866
  class: "Transformation",
50848
50867
  method: "scaleByTranslateBy",
50849
- item: [item2.getId()],
50868
+ item: [item.getId()],
50850
50869
  translate: { x: translateX, y: translateY },
50851
50870
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50852
50871
  };
50853
50872
  }
50854
50873
  }
50855
50874
  function getItemTranslation({
50856
- item: item2,
50875
+ item,
50857
50876
  isWidth,
50858
50877
  isHeight,
50859
50878
  matrix,
@@ -50861,22 +50880,22 @@ function getItemTranslation({
50861
50880
  translateY,
50862
50881
  isShiftPressed
50863
50882
  }) {
50864
- if (item2 instanceof Sticker && (isWidth || isHeight)) {
50883
+ if (item instanceof Sticker && (isWidth || isHeight)) {
50865
50884
  return {
50866
50885
  class: "Transformation",
50867
50886
  method: "scaleByTranslateBy",
50868
- item: [item2.getId()],
50887
+ item: [item.getId()],
50869
50888
  translate: { x: translateX, y: translateY },
50870
50889
  scale: { x: 1, y: 1 }
50871
50890
  };
50872
50891
  } else {
50873
- if (item2 instanceof Frame2 && item2.getCanChangeRatio() && isShiftPressed && item2.getFrameType() !== "Custom") {
50874
- item2.setFrameType("Custom");
50892
+ if (item instanceof Frame2 && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
50893
+ item.setFrameType("Custom");
50875
50894
  }
50876
50895
  return {
50877
50896
  class: "Transformation",
50878
50897
  method: "scaleByTranslateBy",
50879
- item: [item2.getId()],
50898
+ item: [item.getId()],
50880
50899
  translate: { x: translateX, y: translateY },
50881
50900
  scale: { x: matrix.scaleX, y: matrix.scaleY }
50882
50901
  };
@@ -51149,11 +51168,11 @@ function transformItems({
51149
51168
  setSnapCursorPos
51150
51169
  }) {
51151
51170
  const items = selection.items.list();
51152
- const includesProportionalItem = items.some((item2) => item2.itemType === "Sticker" || item2.itemType === "RichText" || item2.itemType === "AINode" || item2.itemType === "Video" || item2.itemType === "Audio");
51171
+ const includesProportionalItem = items.some((item) => item.itemType === "Sticker" || item.itemType === "RichText" || item.itemType === "AINode" || item.itemType === "Video" || item.itemType === "Audio");
51153
51172
  if (includesProportionalItem && (isWidth || isHeight)) {
51154
51173
  return null;
51155
51174
  }
51156
- const isIncludesFixedFrame = items.some((item2) => item2 instanceof Frame2 && !item2.getCanChangeRatio());
51175
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame2 && !item.getCanChangeRatio());
51157
51176
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
51158
51177
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
51159
51178
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -51231,23 +51250,23 @@ function updateFrameChildren({
51231
51250
  nestingHighlighter
51232
51251
  }) {
51233
51252
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
51234
- board.selection.items.list().forEach((item2) => {
51235
- if ("getChildrenIds" in item2 && item2.getChildrenIds()) {
51236
- const currMbr = item2.getMbr();
51253
+ board.selection.items.list().forEach((item) => {
51254
+ if ("getChildrenIds" in item && item.getChildrenIds()) {
51255
+ const currMbr = item.getMbr();
51237
51256
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
51238
51257
  itemsToCheck.forEach((currItem) => {
51239
- if (item2.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item2.getId())) {
51240
- nestingHighlighter.add(item2, currItem);
51258
+ if (item.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item.getId())) {
51259
+ nestingHighlighter.add(item, currItem);
51241
51260
  } else {
51242
51261
  nestingHighlighter.remove(currItem);
51243
51262
  }
51244
51263
  });
51245
51264
  } else {
51246
51265
  groups.forEach((group) => {
51247
- if (group.handleNesting(item2)) {
51248
- nestingHighlighter.add(group, item2);
51266
+ if (group.handleNesting(item)) {
51267
+ nestingHighlighter.add(group, item);
51249
51268
  } else {
51250
- nestingHighlighter.remove(item2);
51269
+ nestingHighlighter.remove(item);
51251
51270
  }
51252
51271
  });
51253
51272
  }
@@ -51315,9 +51334,9 @@ class Transformer extends Tool {
51315
51334
  const pointer = this.board.pointer;
51316
51335
  const camera = this.board.camera;
51317
51336
  const items = this.selection.items;
51318
- const item2 = items.getSingle();
51337
+ const item = items.getSingle();
51319
51338
  let resizeType;
51320
- if (item2 && (item2.itemType === "RichText" || item2.itemType === "Sticker")) {
51339
+ if (item && (item.itemType === "RichText" || item.itemType === "Sticker")) {
51321
51340
  resizeType = getTextResizeType(pointer.point, camera.getScale(), mbr);
51322
51341
  } else {
51323
51342
  resizeType = getResizeType(pointer.point, camera.getScale(), mbr);
@@ -51571,8 +51590,8 @@ class SelectionTransformer extends Tool {
51571
51590
  return;
51572
51591
  }
51573
51592
  if (this.selection.items.isSingle()) {
51574
- const item2 = this.selection.items.getSingle();
51575
- if (item2?.itemType === "Connector") {
51593
+ const item = this.selection.items.getSingle();
51594
+ if (item?.itemType === "Connector") {
51576
51595
  this.tool = this.connectorTransformerTool;
51577
51596
  return;
51578
51597
  } else {
@@ -51655,16 +51674,16 @@ class BoardSelection {
51655
51674
  this.quickAddButtons = getQuickAddButtons(this, board);
51656
51675
  }
51657
51676
  serialize() {
51658
- const selectedItems = this.items.list().map((item2) => item2.getId());
51677
+ const selectedItems = this.items.list().map((item) => item.getId());
51659
51678
  return JSON.stringify(selectedItems);
51660
51679
  }
51661
51680
  deserialize(serializedData) {
51662
51681
  const selectedItems = JSON.parse(serializedData);
51663
51682
  this.removeAll();
51664
51683
  selectedItems.forEach((itemId) => {
51665
- const item2 = this.board.items.getById(itemId);
51666
- if (item2) {
51667
- this.items.add(item2);
51684
+ const item = this.board.items.getById(itemId);
51685
+ if (item) {
51686
+ this.items.add(item);
51668
51687
  }
51669
51688
  });
51670
51689
  }
@@ -51742,19 +51761,19 @@ class BoardSelection {
51742
51761
  this.updateQueue.clear();
51743
51762
  safeRequestAnimationFrame(this.updateScheduledObservers);
51744
51763
  };
51745
- itemObserver = (item2) => {
51764
+ itemObserver = (item) => {
51746
51765
  if (!this.shouldPublish) {
51747
51766
  return;
51748
51767
  }
51749
51768
  this.subject.publish(this);
51750
- this.itemSubject.publish(item2);
51769
+ this.itemSubject.publish(item);
51751
51770
  };
51752
51771
  decoratedItemObserver = this.decorateObserverToScheduleUpdate(this.itemObserver);
51753
51772
  add(value) {
51754
51773
  this.items.add(value);
51755
51774
  if (Array.isArray(value)) {
51756
- for (const item2 of value) {
51757
- item2.subject.subscribe(this.itemObserver);
51775
+ for (const item of value) {
51776
+ item.subject.subscribe(this.itemObserver);
51758
51777
  }
51759
51778
  } else {
51760
51779
  value.subject.subscribe(this.itemObserver);
@@ -51763,15 +51782,15 @@ class BoardSelection {
51763
51782
  this.itemsSubject.publish([]);
51764
51783
  }
51765
51784
  addAll() {
51766
- const items = this.board.items.listAll().filter((item2) => !item2.transformation.isLocked);
51785
+ const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked);
51767
51786
  this.add(items);
51768
51787
  this.setContext("SelectByRect");
51769
51788
  }
51770
51789
  remove(value) {
51771
51790
  this.items.remove(value);
51772
51791
  if (Array.isArray(value)) {
51773
- for (const item2 of value) {
51774
- item2.subject.unsubscribe(this.itemObserver);
51792
+ for (const item of value) {
51793
+ item.subject.unsubscribe(this.itemObserver);
51775
51794
  }
51776
51795
  } else {
51777
51796
  value.subject.unsubscribe(this.itemObserver);
@@ -51865,11 +51884,11 @@ class BoardSelection {
51865
51884
  if (!this.items.isSingle()) {
51866
51885
  return;
51867
51886
  }
51868
- const item2 = this.items.getSingle();
51869
- if (!item2) {
51887
+ const item = this.items.getSingle();
51888
+ if (!item) {
51870
51889
  return;
51871
51890
  }
51872
- const text5 = item2.getRichText();
51891
+ const text5 = item.getRichText();
51873
51892
  if (!text5) {
51874
51893
  return;
51875
51894
  }
@@ -51880,7 +51899,7 @@ class BoardSelection {
51880
51899
  if (shouldReplace || moveCursorToEnd) {
51881
51900
  text5.editor.moveCursorToEndOfTheText();
51882
51901
  }
51883
- this.setTextToEdit(item2);
51902
+ this.setTextToEdit(item);
51884
51903
  this.setContext("EditTextUnderPointer");
51885
51904
  if (shouldSelect) {
51886
51905
  text5.editor.selectWholeText();
@@ -51890,13 +51909,13 @@ class BoardSelection {
51890
51909
  editUnderPointer() {
51891
51910
  this.removeAll();
51892
51911
  const stack = this.board.items.getUnderPointer();
51893
- const item2 = stack.pop();
51894
- if (item2) {
51895
- this.add(item2);
51912
+ const item = stack.pop();
51913
+ if (item) {
51914
+ this.add(item);
51896
51915
  this.setTextToEdit(undefined);
51897
- const text5 = item2.getRichText();
51916
+ const text5 = item.getRichText();
51898
51917
  if (text5) {
51899
- this.setTextToEdit(item2);
51918
+ this.setTextToEdit(item);
51900
51919
  text5.editor.selectWholeText();
51901
51920
  this.board.items.subject.publish(this.board.items);
51902
51921
  }
@@ -51905,26 +51924,26 @@ class BoardSelection {
51905
51924
  this.setContext("None");
51906
51925
  }
51907
51926
  }
51908
- setTextToEdit(item2) {
51927
+ setTextToEdit(item) {
51909
51928
  if (this.textToEdit) {
51910
51929
  this.textToEdit.updateElement();
51911
51930
  this.textToEdit.enableRender();
51912
51931
  }
51913
- if (!(item2 && item2.getRichText())) {
51932
+ if (!(item && item.getRichText())) {
51914
51933
  this.textToEdit = undefined;
51915
51934
  return;
51916
51935
  }
51917
- const text5 = item2.getRichText();
51936
+ const text5 = item.getRichText();
51918
51937
  if (!text5) {
51919
51938
  return;
51920
51939
  }
51921
51940
  if (text5.isEmpty()) {
51922
- const textColor = tempStorage.getFontColor(item2.itemType);
51923
- const textSize = tempStorage.getFontSize(item2.itemType);
51924
- const highlightColor = tempStorage.getFontHighlight(item2.itemType);
51925
- const styles = tempStorage.getFontStyles(item2.itemType);
51926
- const horizontalAlignment = tempStorage.getHorizontalAlignment(item2.itemType);
51927
- const verticalAlignment = tempStorage.getVerticalAlignment(item2.itemType);
51941
+ const textColor = tempStorage.getFontColor(item.itemType);
51942
+ const textSize = tempStorage.getFontSize(item.itemType);
51943
+ const highlightColor = tempStorage.getFontHighlight(item.itemType);
51944
+ const styles = tempStorage.getFontStyles(item.itemType);
51945
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
51946
+ const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
51928
51947
  if (textColor) {
51929
51948
  text5.setSelectionFontColor(textColor, "None");
51930
51949
  }
@@ -51932,7 +51951,7 @@ class BoardSelection {
51932
51951
  this.emit({
51933
51952
  class: "RichText",
51934
51953
  method: "setFontSize",
51935
- item: [item2.getId()],
51954
+ item: [item.getId()],
51936
51955
  fontSize: textSize,
51937
51956
  context: this.getContext()
51938
51957
  });
@@ -51944,10 +51963,10 @@ class BoardSelection {
51944
51963
  const stylesArr = styles;
51945
51964
  text5.setSelectionFontStyle(stylesArr, "None");
51946
51965
  }
51947
- if (horizontalAlignment && !(item2 instanceof Sticker)) {
51966
+ if (horizontalAlignment && !(item instanceof Sticker)) {
51948
51967
  text5.setSelectionHorisontalAlignment(horizontalAlignment);
51949
51968
  }
51950
- if (verticalAlignment && !(item2 instanceof Sticker)) {
51969
+ if (verticalAlignment && !(item instanceof Sticker)) {
51951
51970
  this.setVerticalAlignment(verticalAlignment);
51952
51971
  }
51953
51972
  }
@@ -51980,8 +51999,8 @@ class BoardSelection {
51980
51999
  }
51981
52000
  selectEnclosedOrCrossedBy(rect) {
51982
52001
  this.removeAll();
51983
- const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => !item2.transformation.isLocked);
51984
- const list6 = this.board.items.getEnclosedOrCrossed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => (!(item2 instanceof Frame2) || enclosedFrames.includes(item2)) && !item2.transformation.isLocked);
52002
+ const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => !item.transformation.isLocked);
52003
+ const list6 = this.board.items.getEnclosedOrCrossed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => (!(item instanceof Frame2) || enclosedFrames.includes(item)) && !item.transformation.isLocked);
51985
52004
  if (list6.length !== 0) {
51986
52005
  this.add(list6);
51987
52006
  this.setContext("SelectByRect");
@@ -51995,14 +52014,14 @@ class BoardSelection {
51995
52014
  canChangeText() {
51996
52015
  return Boolean(this.items.isSingle() && this.items.getSingle()?.getRichText());
51997
52016
  }
51998
- handleItemCopy(item2, copiedItemsMap) {
51999
- const serializedData = item2.serialize(true);
52000
- const zIndex = this.board.items.index.getZIndex(item2);
52001
- if (item2.itemType === "Comment") {
52017
+ handleItemCopy(item, copiedItemsMap) {
52018
+ const serializedData = item.serialize(true);
52019
+ const zIndex = this.board.items.index.getZIndex(item);
52020
+ if (item.itemType === "Comment") {
52002
52021
  return;
52003
52022
  }
52004
- if (item2.itemType === "Connector" && serializedData.itemType === "Connector") {
52005
- const connector = item2;
52023
+ if (item.itemType === "Connector" && serializedData.itemType === "Connector") {
52024
+ const connector = item;
52006
52025
  const startPoint = connector.getStartPoint();
52007
52026
  const endPoint = connector.getEndPoint();
52008
52027
  const startItemId = startPoint.pointType !== "Board" ? startPoint.item.getId() : null;
@@ -52018,19 +52037,19 @@ class BoardSelection {
52018
52037
  serializedData.endPoint = new BoardPoint(endPoint.x, endPoint.y).serialize();
52019
52038
  }
52020
52039
  }
52021
- const textItem = item2.getRichText()?.getTextString();
52040
+ const textItem = item.getRichText()?.getTextString();
52022
52041
  const copyText = conf.i18n.t("frame.copy");
52023
52042
  const isCopyTextExist = textItem?.includes(copyText);
52024
- const isChangeCopiedFrameText = item2.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
52043
+ const isChangeCopiedFrameText = item.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
52025
52044
  if (isChangeCopiedFrameText) {
52026
52045
  const copiedFrameText = copyText + (textItem || serializedData.text?.placeholderText);
52027
- item2.getRichText()?.editor.clearText();
52028
- item2.getRichText()?.editor.addText(copiedFrameText);
52029
- serializedData.text = item2.getRichText()?.serialize();
52030
- item2.getRichText()?.editor.clearText();
52031
- item2.getRichText()?.editor.addText(textItem || "");
52046
+ item.getRichText()?.editor.clearText();
52047
+ item.getRichText()?.editor.addText(copiedFrameText);
52048
+ serializedData.text = item.getRichText()?.serialize();
52049
+ item.getRichText()?.editor.clearText();
52050
+ item.getRichText()?.editor.addText(textItem || "");
52032
52051
  }
52033
- copiedItemsMap[item2.getId()] = { ...serializedData, zIndex };
52052
+ copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
52034
52053
  }
52035
52054
  copy(skipImageBlobCopy) {
52036
52055
  const copiedItemsMap = {};
@@ -52039,12 +52058,12 @@ class BoardSelection {
52039
52058
  this.handleItemCopy(single, copiedItemsMap);
52040
52059
  return { imageElement: single.image, imageData: copiedItemsMap };
52041
52060
  }
52042
- this.list().forEach((item2) => {
52043
- this.handleItemCopy(item2, copiedItemsMap);
52061
+ this.list().forEach((item) => {
52062
+ this.handleItemCopy(item, copiedItemsMap);
52044
52063
  });
52045
- this.list().flatMap((item2) => {
52046
- if (item2 instanceof Frame2) {
52047
- return item2.getChildrenIds();
52064
+ this.list().flatMap((item) => {
52065
+ if (item instanceof Frame2) {
52066
+ return item.getChildrenIds();
52048
52067
  }
52049
52068
  return [];
52050
52069
  }).forEach((id) => {
@@ -52072,11 +52091,11 @@ class BoardSelection {
52072
52091
  let maxRichText = null;
52073
52092
  let minRichText = null;
52074
52093
  const itemType = items[0].itemType;
52075
- for (const item2 of items) {
52076
- if (item2.itemType !== itemType) {
52094
+ for (const item of items) {
52095
+ if (item.itemType !== itemType) {
52077
52096
  return null;
52078
52097
  }
52079
- const richText = item2.getRichText();
52098
+ const richText = item.getRichText();
52080
52099
  if (richText) {
52081
52100
  if (!maxRichText || richText.getFontSize() > maxRichText.getFontSize()) {
52082
52101
  maxRichText = richText;
@@ -52182,22 +52201,22 @@ class BoardSelection {
52182
52201
  }
52183
52202
  nestSelectedItems(unselectedItem, checkFrames = true) {
52184
52203
  const selected = this.board.selection.items.list();
52185
- if (unselectedItem && !selected.find((item2) => item2.getId() === unselectedItem.getId())) {
52204
+ if (unselectedItem && !selected.find((item) => item.getId() === unselectedItem.getId())) {
52186
52205
  selected.push(unselectedItem);
52187
52206
  }
52188
- const selectedMbr = selected.reduce((acc, item2) => {
52207
+ const selectedMbr = selected.reduce((acc, item) => {
52189
52208
  if (!acc) {
52190
- return item2.getMbr();
52209
+ return item.getMbr();
52191
52210
  }
52192
- return acc.combine(item2.getMbr());
52211
+ return acc.combine(item.getMbr());
52193
52212
  }, undefined);
52194
52213
  if (selectedMbr) {
52195
- const selectedMap = Object.fromEntries(selected.map((item2) => [item2.getId(), { item: item2, nested: false }]));
52214
+ const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
52196
52215
  const enclosedGroups = this.board.items.getGroupItemsEnclosedOrCrossed(selectedMbr?.left, selectedMbr?.top, selectedMbr?.right, selectedMbr?.bottom);
52197
52216
  enclosedGroups.forEach((group) => {
52198
- selected.forEach((item2) => {
52199
- if (group.handleNesting(item2)) {
52200
- selectedMap[item2.getId()].nested = group;
52217
+ selected.forEach((item) => {
52218
+ if (group.handleNesting(item)) {
52219
+ selectedMap[item.getId()].nested = group;
52201
52220
  }
52202
52221
  });
52203
52222
  });
@@ -52221,11 +52240,11 @@ class BoardSelection {
52221
52240
  if (childrenIds && checkFrames) {
52222
52241
  const currGroup = val.item;
52223
52242
  const currMbr = currGroup.getMbr();
52224
- const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item2) => !!item2);
52225
- const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board" || item2.parent === currGroup.getId());
52243
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
52244
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
52226
52245
  const uniqueItems = new Set;
52227
- const toCheck = [...children, ...underGroup].filter((item2) => {
52228
- const id = item2.getId();
52246
+ const toCheck = [...children, ...underGroup].filter((item) => {
52247
+ const id = item.getId();
52229
52248
  if (uniqueItems.has(id)) {
52230
52249
  return false;
52231
52250
  }
@@ -52266,8 +52285,8 @@ class BoardSelection {
52266
52285
  addItemToTranslation(childId);
52267
52286
  }
52268
52287
  }
52269
- const createTranslationWithComments = (item2) => {
52270
- const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item2.getId());
52288
+ const createTranslationWithComments = (item) => {
52289
+ const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item.getId());
52271
52290
  for (const comment2 of followedComments) {
52272
52291
  translation[comment2.getId()] = {
52273
52292
  class: "Transformation",
@@ -52328,21 +52347,21 @@ class BoardSelection {
52328
52347
  newData: { borderColor }
52329
52348
  };
52330
52349
  const operations2 = {};
52331
- this.items.list().forEach((item2) => {
52332
- if (!operations2[item2.itemType]) {
52350
+ this.items.list().forEach((item) => {
52351
+ if (!operations2[item.itemType]) {
52333
52352
  const operationCopy = { ...operation };
52334
- if (item2.itemType === "Connector") {
52353
+ if (item.itemType === "Connector") {
52335
52354
  operationCopy.method = "setLineColor";
52336
52355
  operationCopy.lineColor = borderColor;
52337
- } else if (item2.itemType === "Drawing") {
52356
+ } else if (item.itemType === "Drawing") {
52338
52357
  operationCopy.method = "setStrokeColor";
52339
52358
  operationCopy.color = borderColor;
52340
52359
  } else {
52341
52360
  operationCopy.borderColor = borderColor;
52342
52361
  }
52343
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52362
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52344
52363
  } else {
52345
- operations2[item2.itemType].item.push(item2.getId());
52364
+ operations2[item.itemType].item.push(item.getId());
52346
52365
  }
52347
52366
  });
52348
52367
  Object.values(operations2).forEach((op) => {
@@ -52357,13 +52376,13 @@ class BoardSelection {
52357
52376
  newData: { borderWidth: width2 }
52358
52377
  };
52359
52378
  const operations2 = {};
52360
- this.items.list().forEach((item2) => {
52361
- if (!operations2[item2.itemType]) {
52379
+ this.items.list().forEach((item) => {
52380
+ if (!operations2[item.itemType]) {
52362
52381
  const operationCopy = { ...operation };
52363
- if (item2.itemType === "Connector") {
52382
+ if (item.itemType === "Connector") {
52364
52383
  operationCopy.method = "setLineWidth";
52365
52384
  operationCopy.lineWidth = width2;
52366
- } else if (item2.itemType === "Drawing") {
52385
+ } else if (item.itemType === "Drawing") {
52367
52386
  operationCopy.method = "setStrokeWidth";
52368
52387
  operationCopy.width = width2;
52369
52388
  operationCopy.prevWidth = this.getStrokeWidth();
@@ -52371,9 +52390,9 @@ class BoardSelection {
52371
52390
  operationCopy.borderWidth = width2;
52372
52391
  operationCopy.prevBorderWidth = this.getStrokeWidth();
52373
52392
  }
52374
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52393
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52375
52394
  } else {
52376
- operations2[item2.itemType].item.push(item2.getId());
52395
+ operations2[item.itemType].item.push(item.getId());
52377
52396
  }
52378
52397
  });
52379
52398
  Object.values(operations2).forEach((op) => {
@@ -52389,11 +52408,11 @@ class BoardSelection {
52389
52408
  newData: { backgroundColor }
52390
52409
  };
52391
52410
  const operations2 = {};
52392
- this.items.list().forEach((item2) => {
52393
- if (!operations2[item2.itemType]) {
52394
- operations2[item2.itemType] = { ...operation, class: item2.itemType, item: [item2.getId()] };
52411
+ this.items.list().forEach((item) => {
52412
+ if (!operations2[item.itemType]) {
52413
+ operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
52395
52414
  } else {
52396
- operations2[item2.itemType].item.push(item2.getId());
52415
+ operations2[item.itemType].item.push(item.getId());
52397
52416
  }
52398
52417
  });
52399
52418
  Object.values(operations2).forEach((op) => {
@@ -52417,9 +52436,9 @@ class BoardSelection {
52417
52436
  }
52418
52437
  setFrameType(frameType) {
52419
52438
  const items = this.items.list();
52420
- items.forEach((item2) => {
52421
- if (item2 instanceof Frame2) {
52422
- item2.setFrameType(frameType);
52439
+ items.forEach((item) => {
52440
+ if (item instanceof Frame2) {
52441
+ item.setFrameType(frameType);
52423
52442
  }
52424
52443
  });
52425
52444
  }
@@ -52438,21 +52457,21 @@ class BoardSelection {
52438
52457
  setFontSize(size) {
52439
52458
  const fontSize = size === "auto" ? size : toFiniteNumber(size);
52440
52459
  const itemsOps = [];
52441
- for (const item2 of this.items.list()) {
52442
- const text5 = item2.getRichText();
52460
+ for (const item of this.items.list()) {
52461
+ const text5 = item.getRichText();
52443
52462
  if (!text5) {
52444
52463
  continue;
52445
52464
  }
52446
52465
  const ops = text5.setSelectionFontSize(fontSize, this.context);
52447
52466
  itemsOps.push({
52448
- item: item2.getId(),
52467
+ item: item.getId(),
52449
52468
  selection: text5.editor.getSelection(),
52450
52469
  ops
52451
52470
  });
52452
- if (item2.itemType === "Sticker" && fontSize === "auto") {
52453
- tempStorage.remove(`fontSize_${item2.itemType}`);
52454
- } else if (item2.itemType !== "AINode") {
52455
- tempStorage.setFontSize(item2.itemType, fontSize);
52471
+ if (item.itemType === "Sticker" && fontSize === "auto") {
52472
+ tempStorage.remove(`fontSize_${item.itemType}`);
52473
+ } else if (item.itemType !== "AINode") {
52474
+ tempStorage.setFontSize(item.itemType, fontSize);
52456
52475
  }
52457
52476
  }
52458
52477
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -52475,8 +52494,8 @@ class BoardSelection {
52475
52494
  setFontStyle(fontStyle) {
52476
52495
  const isMultiple = !this.items.isSingle();
52477
52496
  const itemsOps = [];
52478
- for (const item2 of this.items.list()) {
52479
- const text5 = item2.getRichText();
52497
+ for (const item of this.items.list()) {
52498
+ const text5 = item.getRichText();
52480
52499
  if (!text5) {
52481
52500
  continue;
52482
52501
  }
@@ -52485,12 +52504,12 @@ class BoardSelection {
52485
52504
  }
52486
52505
  const ops = text5.setSelectionFontStyle(fontStyle, this.context);
52487
52506
  itemsOps.push({
52488
- item: item2.getId(),
52507
+ item: item.getId(),
52489
52508
  selection: text5.editor.getSelection(),
52490
52509
  ops
52491
52510
  });
52492
- if (item2.itemType !== "AINode") {
52493
- tempStorage.setFontStyles(item2.itemType, text5.getFontStyles());
52511
+ if (item.itemType !== "AINode") {
52512
+ tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
52494
52513
  }
52495
52514
  }
52496
52515
  this.emitApplied({
@@ -52502,8 +52521,8 @@ class BoardSelection {
52502
52521
  setFontColor(fontColor) {
52503
52522
  const isMultiple = !this.items.isSingle();
52504
52523
  const itemsOps = [];
52505
- for (const item2 of this.items.list()) {
52506
- const text5 = item2.getRichText();
52524
+ for (const item of this.items.list()) {
52525
+ const text5 = item.getRichText();
52507
52526
  if (!text5) {
52508
52527
  continue;
52509
52528
  }
@@ -52512,11 +52531,11 @@ class BoardSelection {
52512
52531
  }
52513
52532
  const ops = text5.setSelectionFontColor(fontColor, this.context);
52514
52533
  itemsOps.push({
52515
- item: item2.getId(),
52534
+ item: item.getId(),
52516
52535
  selection: text5.editor.getSelection(),
52517
52536
  ops
52518
52537
  });
52519
- tempStorage.setFontColor(item2.itemType, fontColor);
52538
+ tempStorage.setFontColor(item.itemType, fontColor);
52520
52539
  }
52521
52540
  this.emitApplied({
52522
52541
  class: "RichText",
@@ -52545,8 +52564,8 @@ class BoardSelection {
52545
52564
  setFontHighlight(fontHighlight) {
52546
52565
  const isMultiple = !this.items.isSingle();
52547
52566
  const itemsOps = [];
52548
- for (const item2 of this.items.list()) {
52549
- const text5 = item2.getRichText();
52567
+ for (const item of this.items.list()) {
52568
+ const text5 = item.getRichText();
52550
52569
  if (!text5) {
52551
52570
  continue;
52552
52571
  }
@@ -52555,12 +52574,12 @@ class BoardSelection {
52555
52574
  }
52556
52575
  const ops = text5.setSelectionFontHighlight(fontHighlight, this.context);
52557
52576
  itemsOps.push({
52558
- item: item2.getId(),
52577
+ item: item.getId(),
52559
52578
  selection: text5.editor.getSelection(),
52560
52579
  ops
52561
52580
  });
52562
- if (item2.itemType !== "AINode") {
52563
- tempStorage.setFontHighlight(item2.itemType, fontHighlight);
52581
+ if (item.itemType !== "AINode") {
52582
+ tempStorage.setFontHighlight(item.itemType, fontHighlight);
52564
52583
  }
52565
52584
  }
52566
52585
  this.emitApplied({
@@ -52572,8 +52591,8 @@ class BoardSelection {
52572
52591
  setHorisontalAlignment(horisontalAlignment) {
52573
52592
  const isMultiple = !this.items.isSingle();
52574
52593
  const itemsOps = [];
52575
- for (const item2 of this.items.list()) {
52576
- const text5 = item2.getRichText();
52594
+ for (const item of this.items.list()) {
52595
+ const text5 = item.getRichText();
52577
52596
  if (!text5) {
52578
52597
  continue;
52579
52598
  }
@@ -52582,11 +52601,11 @@ class BoardSelection {
52582
52601
  }
52583
52602
  const ops = text5.setSelectionHorisontalAlignment(horisontalAlignment, this.context);
52584
52603
  itemsOps.push({
52585
- item: item2.getId(),
52604
+ item: item.getId(),
52586
52605
  selection: text5.editor.getSelection(),
52587
52606
  ops
52588
52607
  });
52589
- tempStorage.setHorizontalAlignment(item2.itemType, horisontalAlignment);
52608
+ tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
52590
52609
  }
52591
52610
  this.emitApplied({
52592
52611
  class: "RichText",
@@ -52602,23 +52621,23 @@ class BoardSelection {
52602
52621
  verticalAlignment
52603
52622
  });
52604
52623
  if (this.items.isSingle()) {
52605
- const item2 = this.items.getSingle();
52606
- if (!item2) {
52624
+ const item = this.items.getSingle();
52625
+ if (!item) {
52607
52626
  return;
52608
52627
  }
52609
- const text5 = item2.getRichText();
52628
+ const text5 = item.getRichText();
52610
52629
  if (!text5) {
52611
52630
  return;
52612
52631
  }
52613
- tempStorage.setVerticalAlignment(item2.itemType, verticalAlignment);
52614
- if (item2 instanceof RichText) {
52615
- item2.setEditorFocus(this.context);
52632
+ tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
52633
+ if (item instanceof RichText) {
52634
+ item.setEditorFocus(this.context);
52616
52635
  }
52617
52636
  text5.setEditorFocus(this.context);
52618
52637
  }
52619
52638
  }
52620
52639
  removeFromBoard() {
52621
- const isLocked = this.items.list().some((item2) => item2.transformation.isLocked);
52640
+ const isLocked = this.items.list().some((item) => item.transformation.isLocked);
52622
52641
  if (isLocked) {
52623
52642
  return;
52624
52643
  }
@@ -52641,7 +52660,7 @@ class BoardSelection {
52641
52660
  }
52642
52661
  getIsLockedSelection() {
52643
52662
  const items = this.list();
52644
- return items.some((item2) => item2.transformation.isLocked);
52663
+ return items.some((item) => item.transformation.isLocked);
52645
52664
  }
52646
52665
  isLocked() {
52647
52666
  return false;
@@ -52668,9 +52687,9 @@ class BoardSelection {
52668
52687
  }
52669
52688
  async duplicate() {
52670
52689
  const mediaIds = [];
52671
- this.items.list().forEach((item2) => {
52672
- if ("getStorageId" in item2) {
52673
- const storageId = item2.getStorageId();
52690
+ this.items.list().forEach((item) => {
52691
+ if ("getStorageId" in item) {
52692
+ const storageId = item.getStorageId();
52674
52693
  if (storageId) {
52675
52694
  mediaIds.push(storageId);
52676
52695
  }
@@ -52680,7 +52699,7 @@ class BoardSelection {
52680
52699
  if (!canDuplicate) {
52681
52700
  return;
52682
52701
  }
52683
- const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item2]) => item2.itemType !== "Group"));
52702
+ const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item]) => item.itemType !== "Group"));
52684
52703
  this.board.duplicate(filteredItemMap);
52685
52704
  this.setContext("EditUnderPointer");
52686
52705
  }
@@ -52714,10 +52733,10 @@ class BoardSelection {
52714
52733
  lastAssistantMessageId
52715
52734
  };
52716
52735
  }
52717
- renderItemMbr(context, item2, customScale) {
52718
- const mbr = item2.getMbr();
52736
+ renderItemMbr(context, item, customScale) {
52737
+ const mbr = item.getMbr();
52719
52738
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
52720
- const selectionColor = item2.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52739
+ const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52721
52740
  mbr.borderColor = selectionColor;
52722
52741
  mbr.render(context);
52723
52742
  }
@@ -52733,8 +52752,8 @@ class BoardSelection {
52733
52752
  }
52734
52753
  if (!this.transformationRenderBlock) {
52735
52754
  if (this.shouldRenderItemsMbr) {
52736
- for (const item2 of this.items.list()) {
52737
- this.renderItemMbr(context, item2);
52755
+ for (const item of this.items.list()) {
52756
+ this.renderItemMbr(context, item);
52738
52757
  }
52739
52758
  }
52740
52759
  this.tool.render(context);
@@ -52746,7 +52765,7 @@ class BoardSelection {
52746
52765
  if (single && single instanceof AINode) {
52747
52766
  const contextItemsIds = single.getContextItems();
52748
52767
  if (contextItemsIds.length) {
52749
- const newContextItems = this.board.items.listAll().filter((item2) => contextItemsIds.includes(item2.getId()));
52768
+ const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
52750
52769
  contextItems.push(...newContextItems);
52751
52770
  }
52752
52771
  }
@@ -52764,15 +52783,15 @@ class BoardSelection {
52764
52783
  }
52765
52784
  }
52766
52785
  }
52767
- contextItems.forEach((item2) => {
52768
- if (item2 instanceof AINode) {
52769
- const path2 = item2.getPath();
52786
+ contextItems.forEach((item) => {
52787
+ if (item instanceof AINode) {
52788
+ const path2 = item.getPath();
52770
52789
  path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
52771
52790
  path2.setBorderWidth(2);
52772
52791
  path2.setBackgroundColor("none");
52773
52792
  path2.render(context);
52774
52793
  } else {
52775
- const itemRect = item2.getMbr();
52794
+ const itemRect = item.getMbr();
52776
52795
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
52777
52796
  itemRect.strokeWidth = 2;
52778
52797
  itemRect.render(context);
@@ -53273,16 +53292,16 @@ class Board {
53273
53292
  applyBoardOperation(op) {
53274
53293
  switch (op.method) {
53275
53294
  case "moveToZIndex": {
53276
- const item2 = this.index.getById(op.item);
53277
- if (!item2) {
53295
+ const item = this.index.getById(op.item);
53296
+ if (!item) {
53278
53297
  return;
53279
53298
  }
53280
- return this.index.moveToZIndex(item2, op.zIndex);
53299
+ return this.index.moveToZIndex(item, op.zIndex);
53281
53300
  }
53282
53301
  case "moveManyToZIndex": {
53283
53302
  for (const id in op.item) {
53284
- const item2 = this.items.getById(id);
53285
- if (!item2) {
53303
+ const item = this.items.getById(id);
53304
+ if (!item) {
53286
53305
  delete op.item.id;
53287
53306
  }
53288
53307
  }
@@ -53304,11 +53323,11 @@ class Board {
53304
53323
  }
53305
53324
  return this.index.moveSecondAfterFirst(first, second);
53306
53325
  case "bringToFront": {
53307
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53326
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53308
53327
  return this.index.bringManyToFront(items);
53309
53328
  }
53310
53329
  case "sendToBack": {
53311
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53330
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53312
53331
  return this.index.sendManyToBack(items);
53313
53332
  }
53314
53333
  case "add":
@@ -53332,82 +53351,82 @@ class Board {
53332
53351
  applyAddItems(op) {
53333
53352
  if (Array.isArray(op.item)) {
53334
53353
  const data = op.data;
53335
- const items = op.item.map((item3) => {
53336
- const created = this.createItem(item3, data[item3]);
53354
+ const items = op.item.map((item2) => {
53355
+ const created = this.createItem(item2, data[item2]);
53337
53356
  this.index.insert(created);
53338
53357
  return created;
53339
53358
  });
53340
- items.forEach((item3) => {
53341
- if (item3 instanceof Connector2 && data[item3.getId()]) {
53342
- const connectorData = data[item3.getId()];
53343
- item3.applyStartPoint(connectorData.startPoint);
53344
- item3.applyEndPoint(connectorData.endPoint);
53359
+ items.forEach((item2) => {
53360
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
53361
+ const connectorData = data[item2.getId()];
53362
+ item2.applyStartPoint(connectorData.startPoint);
53363
+ item2.applyEndPoint(connectorData.endPoint);
53345
53364
  }
53346
53365
  });
53347
53366
  return;
53348
53367
  }
53349
- const item2 = this.createItem(op.item, op.data);
53350
- return this.index.insert(item2);
53368
+ const item = this.createItem(op.item, op.data);
53369
+ return this.index.insert(item);
53351
53370
  }
53352
53371
  applyAddLockedGroupOperation(op) {
53353
- const item2 = this.createItem(op.item, op.data);
53354
- const groupChildrenIds = item2.getChildrenIds();
53355
- this.index.insert(item2);
53372
+ const item = this.createItem(op.item, op.data);
53373
+ const groupChildrenIds = item.getChildrenIds();
53374
+ this.index.insert(item);
53356
53375
  const lastChildrenId = this.index.getById(groupChildrenIds[groupChildrenIds.length - 1]);
53357
53376
  if (lastChildrenId) {
53358
53377
  const zIndex = this.index.getZIndex(lastChildrenId) + 1;
53359
- this.index.moveToZIndex(item2, zIndex);
53378
+ this.index.moveToZIndex(item, zIndex);
53360
53379
  }
53361
- item2.getChildren().forEach((item3) => {
53362
- item3.transformation.isLocked = true;
53380
+ item.getChildren().forEach((item2) => {
53381
+ item2.transformation.isLocked = true;
53363
53382
  });
53364
- item2.transformation.isLocked = true;
53383
+ item.transformation.isLocked = true;
53365
53384
  }
53366
53385
  applyRemoveOperation(op) {
53367
53386
  const removedItems = [];
53368
- this.findItemAndApply(op.item, (item2) => {
53369
- this.index.remove(item2);
53370
- this.selection.remove(item2);
53371
- if (item2 instanceof Connector2) {
53372
- item2.clearObservedItems();
53387
+ this.findItemAndApply(op.item, (item) => {
53388
+ this.index.remove(item);
53389
+ this.selection.remove(item);
53390
+ if (item instanceof Connector2) {
53391
+ item.clearObservedItems();
53373
53392
  }
53374
- removedItems.push(item2);
53393
+ removedItems.push(item);
53375
53394
  });
53376
53395
  }
53377
53396
  applyRemoveLockedGroupOperation(op) {
53378
- const item2 = this.index.getById(op.item[0]);
53379
- if (!item2 || !(item2 instanceof Group)) {
53397
+ const item = this.index.getById(op.item[0]);
53398
+ if (!item || !(item instanceof Group)) {
53380
53399
  return;
53381
53400
  }
53382
- item2.getChildren().forEach((item3) => {
53383
- item3.transformation.isLocked = false;
53384
- item3.parent = "Board";
53401
+ item.getChildren().forEach((item2) => {
53402
+ item2.transformation.isLocked = false;
53403
+ item2.parent = "Board";
53385
53404
  });
53386
- item2.transformation.isLocked = false;
53405
+ item.transformation.isLocked = false;
53387
53406
  const removedItems = [];
53388
- this.findItemAndApply(op.item, (item3) => {
53389
- this.index.remove(item3);
53390
- this.selection.remove(item3);
53391
- removedItems.push(item3);
53407
+ this.findItemAndApply(op.item, (item2) => {
53408
+ this.index.remove(item2);
53409
+ this.selection.remove(item2);
53410
+ removedItems.push(item2);
53392
53411
  });
53393
53412
  }
53394
53413
  applyItemOperation(op) {
53395
53414
  if ("item" in op) {
53396
- this.findItemAndApply(op.item, (item2) => {
53397
- item2.apply(op);
53415
+ this.findItemAndApply(op.item, (item) => {
53416
+ item.apply(op);
53398
53417
  });
53399
53418
  }
53400
53419
  }
53401
- findItemAndApply(item2, apply) {
53402
- if (Array.isArray(item2)) {
53403
- for (const itemId of item2) {
53420
+ findItemAndApply(item, apply) {
53421
+ if (Array.isArray(item)) {
53422
+ for (const itemId of item) {
53404
53423
  const found = this.items.findById(itemId);
53405
53424
  if (found) {
53406
53425
  apply(found);
53407
53426
  }
53408
53427
  }
53409
53428
  } else {
53410
- const found = this.items.findById(item2);
53429
+ const found = this.items.findById(item);
53411
53430
  if (found) {
53412
53431
  apply(found);
53413
53432
  }
@@ -53416,9 +53435,9 @@ class Board {
53416
53435
  handleNesting(items) {
53417
53436
  const arrayed = Array.isArray(items) ? items : [items];
53418
53437
  const groupsMap = new Map;
53419
- arrayed.forEach((item2) => {
53420
- const itemCenter = item2.getMbr().getCenter();
53421
- const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item2)).reduce((acc, groupItem2) => {
53438
+ arrayed.forEach((item) => {
53439
+ const itemCenter = item.getMbr().getCenter();
53440
+ const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item)).reduce((acc, groupItem2) => {
53422
53441
  if (!acc || groupItem2.getDistanceToPoint(itemCenter) > acc.getDistanceToPoint(itemCenter)) {
53423
53442
  acc = groupItem2;
53424
53443
  }
@@ -53428,7 +53447,7 @@ class Board {
53428
53447
  if (!groupsMap.has(groupItem)) {
53429
53448
  groupsMap.set(groupItem, []);
53430
53449
  }
53431
- groupsMap.get(groupItem)?.push(item2);
53450
+ groupsMap.get(groupItem)?.push(item);
53432
53451
  }
53433
53452
  });
53434
53453
  groupsMap.forEach((items2, group) => {
@@ -53449,13 +53468,13 @@ class Board {
53449
53468
  }
53450
53469
  return parser(el);
53451
53470
  }
53452
- add(item2, timeStamp) {
53471
+ add(item, timeStamp) {
53453
53472
  const id = this.getNewItemId();
53454
53473
  this.emit({
53455
53474
  class: "Board",
53456
53475
  method: "add",
53457
53476
  item: id,
53458
- data: item2.serialize(),
53477
+ data: item.serialize(),
53459
53478
  timeStamp
53460
53479
  });
53461
53480
  const newItem = this.items.getById(id);
@@ -53465,13 +53484,13 @@ class Board {
53465
53484
  this.handleNesting(newItem);
53466
53485
  return newItem;
53467
53486
  }
53468
- addLockedGroup(item2) {
53487
+ addLockedGroup(item) {
53469
53488
  const id = this.getNewItemId();
53470
53489
  this.emit({
53471
53490
  class: "Board",
53472
53491
  method: "addLockedGroup",
53473
53492
  item: id,
53474
- data: item2.serialize()
53493
+ data: item.serialize()
53475
53494
  });
53476
53495
  const newItem = this.items.getById(id);
53477
53496
  if (!newItem) {
@@ -53480,32 +53499,32 @@ class Board {
53480
53499
  this.handleNesting(newItem);
53481
53500
  return newItem;
53482
53501
  }
53483
- remove(item2, withConnectors = true) {
53502
+ remove(item, withConnectors = true) {
53484
53503
  let connectors = [];
53485
53504
  if (withConnectors) {
53486
- connectors = this.items.getLinkedConnectorsById(item2.getId()).map((connector) => connector.getId());
53505
+ connectors = this.items.getLinkedConnectorsById(item.getId()).map((connector) => connector.getId());
53487
53506
  }
53488
- if ("onRemove" in item2) {
53489
- item2.onRemove();
53507
+ if ("onRemove" in item) {
53508
+ item.onRemove();
53490
53509
  }
53491
53510
  this.emit({
53492
53511
  class: "Board",
53493
53512
  method: "remove",
53494
- item: [item2.getId(), ...connectors]
53513
+ item: [item.getId(), ...connectors]
53495
53514
  });
53496
53515
  }
53497
- removeLockedGroup(item2) {
53516
+ removeLockedGroup(item) {
53498
53517
  this.emit({
53499
53518
  class: "Board",
53500
53519
  method: "removeLockedGroup",
53501
- item: [item2.getId()]
53520
+ item: [item.getId()]
53502
53521
  });
53503
53522
  }
53504
53523
  getByZIndex(index2) {
53505
53524
  return this.index.getByZIndex(index2);
53506
53525
  }
53507
- getZIndex(item2) {
53508
- return this.index.getZIndex(item2);
53526
+ getZIndex(item) {
53527
+ return this.index.getZIndex(item);
53509
53528
  }
53510
53529
  getLastZIndex() {
53511
53530
  return this.index.getLastZIndex();
@@ -53517,11 +53536,11 @@ class Board {
53517
53536
  item: items
53518
53537
  });
53519
53538
  }
53520
- moveToZIndex(item2, zIndex) {
53539
+ moveToZIndex(item, zIndex) {
53521
53540
  this.emit({
53522
53541
  class: "Board",
53523
53542
  method: "moveToZIndex",
53524
- item: item2.getId(),
53543
+ item: item.getId(),
53525
53544
  zIndex
53526
53545
  });
53527
53546
  }
@@ -53549,8 +53568,8 @@ class Board {
53549
53568
  this.emit({
53550
53569
  class: "Board",
53551
53570
  method: "bringToFront",
53552
- item: items.map((item2) => item2.getId()),
53553
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53571
+ item: items.map((item) => item.getId()),
53572
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53554
53573
  });
53555
53574
  }
53556
53575
  sendToBack(items) {
@@ -53561,8 +53580,8 @@ class Board {
53561
53580
  this.emit({
53562
53581
  class: "Board",
53563
53582
  method: "sendToBack",
53564
- item: items.map((item2) => item2.getId()),
53565
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53583
+ item: items.map((item) => item.getId()),
53584
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53566
53585
  });
53567
53586
  }
53568
53587
  copy() {
@@ -53639,7 +53658,7 @@ class Board {
53639
53658
  return added;
53640
53659
  });
53641
53660
  addedFrame.addChildItems(addedChildren);
53642
- parsedData.data.children = addedChildren.map((item2) => item2.getId());
53661
+ parsedData.data.children = addedChildren.map((item) => item.getId());
53643
53662
  idsMap[parsedData.data.id] = addedFrame.getId();
53644
53663
  } else {
53645
53664
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -53680,15 +53699,15 @@ class Board {
53680
53699
  const createdConnectors = {};
53681
53700
  const createdFrames = {};
53682
53701
  const addItem = (itemData) => {
53683
- const item2 = this.createItem(itemData.id, itemData);
53684
- if (item2 instanceof Connector2) {
53685
- createdConnectors[itemData.id] = { item: item2, itemData };
53702
+ const item = this.createItem(itemData.id, itemData);
53703
+ if (item instanceof Connector2) {
53704
+ createdConnectors[itemData.id] = { item, itemData };
53686
53705
  }
53687
- if (item2 instanceof Frame2) {
53688
- createdFrames[item2.getId()] = { item: item2, itemData };
53706
+ if (item instanceof Frame2) {
53707
+ createdFrames[item.getId()] = { item, itemData };
53689
53708
  }
53690
- this.index.insert(item2);
53691
- return item2;
53709
+ this.index.insert(item);
53710
+ return item;
53692
53711
  };
53693
53712
  for (const itemData of items) {
53694
53713
  if ("childrenMap" in itemData) {
@@ -53699,13 +53718,13 @@ class Board {
53699
53718
  }
53700
53719
  }
53701
53720
  for (const key in createdConnectors) {
53702
- const { item: item2, itemData } = createdConnectors[key];
53703
- item2.applyStartPoint(itemData.startPoint);
53704
- item2.applyEndPoint(itemData.endPoint);
53721
+ const { item, itemData } = createdConnectors[key];
53722
+ item.applyStartPoint(itemData.startPoint);
53723
+ item.applyEndPoint(itemData.endPoint);
53705
53724
  }
53706
53725
  for (const key in createdFrames) {
53707
- const { item: item2, itemData } = createdFrames[key];
53708
- item2.applyAddChildren(itemData.children);
53726
+ const { item, itemData } = createdFrames[key];
53727
+ item.applyAddChildren(itemData.children);
53709
53728
  }
53710
53729
  }
53711
53730
  deserialize(snapshot) {
@@ -53715,33 +53734,33 @@ class Board {
53715
53734
  const createdFrames = {};
53716
53735
  if (Array.isArray(items)) {
53717
53736
  for (const itemData of items) {
53718
- const item2 = this.createItem(itemData.id, itemData);
53719
- if (item2 instanceof Connector2) {
53720
- createdConnectors[itemData.id] = { item: item2, itemData };
53737
+ const item = this.createItem(itemData.id, itemData);
53738
+ if (item instanceof Connector2) {
53739
+ createdConnectors[itemData.id] = { item, itemData };
53721
53740
  }
53722
- if (item2 instanceof Frame2) {
53723
- createdFrames[item2.getId()] = { item: item2, itemData };
53741
+ if (item instanceof Frame2) {
53742
+ createdFrames[item.getId()] = { item, itemData };
53724
53743
  }
53725
- this.index.insert(item2);
53744
+ this.index.insert(item);
53726
53745
  }
53727
53746
  } else {
53728
53747
  for (const key in items) {
53729
53748
  const itemData = items[key];
53730
- const item2 = this.createItem(key, itemData);
53731
- if (item2 instanceof Connector2) {
53732
- createdConnectors[key] = { item: item2, itemData };
53749
+ const item = this.createItem(key, itemData);
53750
+ if (item instanceof Connector2) {
53751
+ createdConnectors[key] = { item, itemData };
53733
53752
  }
53734
- this.index.insert(item2);
53753
+ this.index.insert(item);
53735
53754
  }
53736
53755
  }
53737
53756
  for (const key in createdConnectors) {
53738
- const { item: item2, itemData } = createdConnectors[key];
53739
- item2.applyStartPoint(itemData.startPoint);
53740
- item2.applyEndPoint(itemData.endPoint);
53757
+ const { item, itemData } = createdConnectors[key];
53758
+ item.applyStartPoint(itemData.startPoint);
53759
+ item.applyEndPoint(itemData.endPoint);
53741
53760
  }
53742
53761
  for (const key in createdFrames) {
53743
- const { item: item2, itemData } = createdFrames[key];
53744
- item2.applyAddChildren(itemData.children);
53762
+ const { item, itemData } = createdFrames[key];
53763
+ item.applyAddChildren(itemData.children);
53745
53764
  }
53746
53765
  this.events?.log.deserialize(events);
53747
53766
  }
@@ -53979,7 +53998,7 @@ class Board {
53979
53998
  itemsMap: newMap,
53980
53999
  select: select2
53981
54000
  });
53982
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
54001
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
53983
54002
  this.handleNesting(items);
53984
54003
  this.selection.removeAll();
53985
54004
  this.selection.add(items);
@@ -53987,8 +54006,8 @@ class Board {
53987
54006
  return;
53988
54007
  }
53989
54008
  removeVoidComments() {
53990
- const voidComments = this.items.listAll().filter((item2) => {
53991
- return item2 instanceof Comment && !item2.getThread().length;
54009
+ const voidComments = this.items.listAll().filter((item) => {
54010
+ return item instanceof Comment && !item.getThread().length;
53992
54011
  });
53993
54012
  if (voidComments) {
53994
54013
  for (const comment2 of voidComments) {
@@ -54062,7 +54081,7 @@ class Board {
54062
54081
  }
54063
54082
  const mbr = this.selection.getMbr();
54064
54083
  const selectedItems = this.selection.items.list();
54065
- const isSelectedItemsMinWidth = selectedItems.some((item2) => item2.getMbr().getWidth() === 0);
54084
+ const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
54066
54085
  const right = mbr ? mbr.right : 0;
54067
54086
  const top = mbr ? mbr.top : 0;
54068
54087
  const width2 = mbr ? mbr.getWidth() / 10 : 10;
@@ -54104,7 +54123,7 @@ class Board {
54104
54123
  method: "duplicate",
54105
54124
  itemsMap: newMap
54106
54125
  });
54107
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
54126
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
54108
54127
  this.handleNesting(items);
54109
54128
  this.selection.removeAll();
54110
54129
  this.selection.add(items);
@@ -54125,9 +54144,9 @@ class Board {
54125
54144
  if (data.itemType === "Frame") {
54126
54145
  data.text.placeholderText = `Frame ${this.getMaxFrameSerial() + 1}`;
54127
54146
  }
54128
- const item2 = this.createItem(itemId, data);
54129
- this.index.insert(item2);
54130
- items.push(item2);
54147
+ const item = this.createItem(itemId, data);
54148
+ this.index.insert(item);
54149
+ items.push(item);
54131
54150
  };
54132
54151
  sortedItemsMap.map(([id, data]) => {
54133
54152
  if (data.itemType === "Connector") {
@@ -54142,8 +54161,8 @@ class Board {
54142
54161
  return;
54143
54162
  });
54144
54163
  }
54145
- isOnBoard(item2) {
54146
- return this.items.findById(item2.getId()) !== undefined;
54164
+ isOnBoard(item) {
54165
+ return this.items.findById(item.getId()) !== undefined;
54147
54166
  }
54148
54167
  getMaxFrameSerial() {
54149
54168
  const existingNames = this.items.listGroupItems().map((frame) => frame.getRichText()?.getTextString().length === 0 ? frame.getRichText()?.placeholderText || "" : frame.getRichText()?.getTextString() || "");
@@ -54189,7 +54208,7 @@ function areItemsTheSame(opA, opB) {
54189
54208
  const itemsB = Object.keys(opB.items);
54190
54209
  const setA = new Set(itemsA);
54191
54210
  const setB = new Set(itemsB);
54192
- const areArraysEqual = setA.size === setB.size && [...setA].every((item2) => setB.has(item2));
54211
+ const areArraysEqual = setA.size === setB.size && [...setA].every((item) => setB.has(item));
54193
54212
  return areArraysEqual;
54194
54213
  }
54195
54214
  if (!(Array.isArray(opA.item) && Array.isArray(opB.item))) {
@@ -55848,9 +55867,9 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
55848
55867
  list6.applyUnconfirmed(filter);
55849
55868
  const hasAnyOverlap = (arr1, arr2) => {
55850
55869
  const lookup9 = new Set(arr1);
55851
- return arr2.some((item2) => lookup9.has(item2));
55870
+ return arr2.some((item) => lookup9.has(item));
55852
55871
  };
55853
- const currSelection = board.selection.list().map((item2) => item2.getId());
55872
+ const currSelection = board.selection.list().map((item) => item.getId());
55854
55873
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
55855
55874
  board.selection.applyMemoizedCaretOrRange();
55856
55875
  }
@@ -56172,27 +56191,27 @@ function handleAiChatMassage(message, board) {
56172
56191
  }
56173
56192
  }
56174
56193
  function handleChatChunk(chunk, board) {
56175
- const item2 = board.items.getById(chunk.itemId);
56194
+ const item = board.items.getById(chunk.itemId);
56176
56195
  switch (chunk.type) {
56177
56196
  case "chunk":
56178
- if (!item2 || item2.itemType !== "AINode") {
56197
+ if (!item || item.itemType !== "AINode") {
56179
56198
  return;
56180
56199
  }
56181
- item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56200
+ item.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56182
56201
  break;
56183
56202
  case "done":
56184
- if (!item2 || item2.itemType !== "AINode") {
56203
+ if (!item || item.itemType !== "AINode") {
56185
56204
  board.aiGeneratingOnItem = undefined;
56186
56205
  return;
56187
56206
  }
56188
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56207
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56189
56208
  break;
56190
56209
  case "end":
56191
- if (!item2 || item2.itemType !== "AINode") {
56210
+ if (!item || item.itemType !== "AINode") {
56192
56211
  board.aiGeneratingOnItem = undefined;
56193
56212
  return;
56194
56213
  }
56195
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56214
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56196
56215
  break;
56197
56216
  case "error":
56198
56217
  default:
@@ -56209,7 +56228,7 @@ function handleChatChunk(chunk, board) {
56209
56228
  if (board.aiGeneratingOnItem && generatingItem) {
56210
56229
  board.selection.removeAll();
56211
56230
  board.selection.add(generatingItem);
56212
- const rt = item2?.getRichText();
56231
+ const rt = item?.getRichText();
56213
56232
  if (generatingItem.itemType === "AINode" && rt) {
56214
56233
  const editor = rt.editor;
56215
56234
  editor.markdownProcessor.setStopProcessingMarkDownCb(null);
@@ -56342,14 +56361,14 @@ function handleImageGenerate(response, board) {
56342
56361
  console.error("Image generation error:", response.message);
56343
56362
  if (response.isExternalApiError) {
56344
56363
  if (board.aiGeneratingOnItem) {
56345
- const item2 = board.items.getById(board.aiGeneratingOnItem);
56346
- if (item2) {
56364
+ const item = board.items.getById(board.aiGeneratingOnItem);
56365
+ if (item) {
56347
56366
  board.selection.removeAll();
56348
- board.selection.add(item2);
56349
- const editor = item2.getRichText()?.editor;
56367
+ board.selection.add(item);
56368
+ const editor = item.getRichText()?.editor;
56350
56369
  editor?.clearText();
56351
56370
  editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
56352
- board.camera.zoomToFit(item2.getMbr(), 20);
56371
+ board.camera.zoomToFit(item.getMbr(), 20);
56353
56372
  }
56354
56373
  }
56355
56374
  } else {