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.
package/dist/esm/node.js CHANGED
@@ -1271,8 +1271,8 @@ var require_tinyqueue = __commonJS((exports, module) => {
1271
1271
  }
1272
1272
  }
1273
1273
  };
1274
- TinyQueue.prototype.push = function push(item2) {
1275
- this.data.push(item2);
1274
+ TinyQueue.prototype.push = function push(item) {
1275
+ this.data.push(item);
1276
1276
  this.length++;
1277
1277
  this._up(this.length - 1);
1278
1278
  };
@@ -1296,24 +1296,24 @@ var require_tinyqueue = __commonJS((exports, module) => {
1296
1296
  var ref = this;
1297
1297
  var data = ref.data;
1298
1298
  var compare = ref.compare;
1299
- var item2 = data[pos];
1299
+ var item = data[pos];
1300
1300
  while (pos > 0) {
1301
1301
  var parent = pos - 1 >> 1;
1302
1302
  var current = data[parent];
1303
- if (compare(item2, current) >= 0) {
1303
+ if (compare(item, current) >= 0) {
1304
1304
  break;
1305
1305
  }
1306
1306
  data[pos] = current;
1307
1307
  pos = parent;
1308
1308
  }
1309
- data[pos] = item2;
1309
+ data[pos] = item;
1310
1310
  };
1311
1311
  TinyQueue.prototype._down = function _down(pos) {
1312
1312
  var ref = this;
1313
1313
  var data = ref.data;
1314
1314
  var compare = ref.compare;
1315
1315
  var halfLength = this.length >> 1;
1316
- var item2 = data[pos];
1316
+ var item = data[pos];
1317
1317
  while (pos < halfLength) {
1318
1318
  var left = (pos << 1) + 1;
1319
1319
  var best = data[left];
@@ -1322,13 +1322,13 @@ var require_tinyqueue = __commonJS((exports, module) => {
1322
1322
  left = right;
1323
1323
  best = data[right];
1324
1324
  }
1325
- if (compare(best, item2) >= 0) {
1325
+ if (compare(best, item) >= 0) {
1326
1326
  break;
1327
1327
  }
1328
1328
  data[pos] = best;
1329
1329
  pos = left;
1330
1330
  }
1331
- data[pos] = item2;
1331
+ data[pos] = item;
1332
1332
  };
1333
1333
  function defaultCompare2(a, b) {
1334
1334
  return a < b ? -1 : a > b ? 1 : 0;
@@ -1419,8 +1419,8 @@ class BoardCommand {
1419
1419
  switch (operation.method) {
1420
1420
  case "bringToFront": {
1421
1421
  for (const id in operation.prevZIndex) {
1422
- const item2 = this.board.items.getById(id);
1423
- if (!item2) {
1422
+ const item = this.board.items.getById(id);
1423
+ if (!item) {
1424
1424
  delete operation.prevZIndex.id;
1425
1425
  }
1426
1426
  }
@@ -1432,8 +1432,8 @@ class BoardCommand {
1432
1432
  }
1433
1433
  case "sendToBack": {
1434
1434
  for (const id in operation.prevZIndex) {
1435
- const item2 = this.board.items.getById(id);
1436
- if (!item2) {
1435
+ const item = this.board.items.getById(id);
1436
+ if (!item) {
1437
1437
  delete operation.prevZIndex.id;
1438
1438
  }
1439
1439
  }
@@ -1447,11 +1447,11 @@ class BoardCommand {
1447
1447
  case "moveSecondBeforeFirst":
1448
1448
  case "moveToZIndex": {
1449
1449
  const items = this.board.items;
1450
- const item2 = items.getById(operation.item);
1451
- if (!item2) {
1450
+ const item = items.getById(operation.item);
1451
+ if (!item) {
1452
1452
  throw new Error("Get reverse board operation. Item not found");
1453
1453
  }
1454
- const zIndex = this.board.getZIndex(item2);
1454
+ const zIndex = this.board.getZIndex(item);
1455
1455
  return {
1456
1456
  class: "Board",
1457
1457
  method: "moveToZIndex",
@@ -1461,8 +1461,8 @@ class BoardCommand {
1461
1461
  }
1462
1462
  case "moveManyToZIndex": {
1463
1463
  for (const id in operation.item) {
1464
- const item2 = this.board.items.getById(id);
1465
- if (!item2) {
1464
+ const item = this.board.items.getById(id);
1465
+ if (!item) {
1466
1466
  delete operation.item.id;
1467
1467
  }
1468
1468
  }
@@ -1479,15 +1479,15 @@ class BoardCommand {
1479
1479
  const items = this.board.items;
1480
1480
  const reverse = [];
1481
1481
  for (const itemId of operation.item) {
1482
- const item2 = items.getById(itemId);
1483
- if (!item2) {
1482
+ const item = items.getById(itemId);
1483
+ if (!item) {
1484
1484
  throw new Error("Get reverse board operation. Item not found");
1485
1485
  }
1486
1486
  reverse.push({
1487
1487
  class: "Board",
1488
1488
  method: "add",
1489
1489
  item: itemId,
1490
- data: item2.serialize()
1490
+ data: item.serialize()
1491
1491
  });
1492
1492
  }
1493
1493
  return reverse;
@@ -1510,32 +1510,32 @@ class BoardCommand {
1510
1510
  const items = this.board.items;
1511
1511
  const reverse = [];
1512
1512
  for (const itemId of operation.item) {
1513
- const item2 = items.getById(itemId);
1514
- if (!item2 || item2.itemType !== "Group") {
1513
+ const item = items.getById(itemId);
1514
+ if (!item || item.itemType !== "Group") {
1515
1515
  throw new Error("Get reverse board operation. Item not found");
1516
1516
  }
1517
1517
  reverse.push({
1518
1518
  class: "Board",
1519
1519
  method: "addLockedGroup",
1520
1520
  item: itemId,
1521
- data: item2.serialize()
1521
+ data: item.serialize()
1522
1522
  });
1523
1523
  }
1524
1524
  return reverse;
1525
1525
  }
1526
1526
  case "duplicate":
1527
1527
  case "paste": {
1528
- const item2 = [];
1528
+ const item = [];
1529
1529
  const map = operation.itemsMap;
1530
1530
  for (const key in map) {
1531
1531
  if (map.hasOwnProperty(key)) {
1532
- item2.push(key);
1532
+ item.push(key);
1533
1533
  }
1534
1534
  }
1535
1535
  return {
1536
1536
  class: "Board",
1537
1537
  method: "remove",
1538
- item: item2
1538
+ item
1539
1539
  };
1540
1540
  }
1541
1541
  }
@@ -7853,11 +7853,11 @@ class SubjectOperation {
7853
7853
  }
7854
7854
 
7855
7855
  // src/Items/ItemsCommandUtils.ts
7856
- function mapItemsByOperation(item2, getCallback) {
7857
- const items = Array.isArray(item2) ? item2 : [item2];
7858
- return items.map((item3) => {
7859
- const operation = getCallback(item3);
7860
- return { item: item3, operation };
7856
+ function mapItemsByOperation(item, getCallback) {
7857
+ const items = Array.isArray(item) ? item : [item];
7858
+ return items.map((item2) => {
7859
+ const operation = getCallback(item2);
7860
+ return { item: item2, operation };
7861
7861
  });
7862
7862
  }
7863
7863
 
@@ -7882,8 +7882,8 @@ class TransformationCommand {
7882
7882
  }
7883
7883
  }
7884
7884
  revert() {
7885
- this.reverse.forEach(({ item: item2, operation }) => {
7886
- item2.apply(operation);
7885
+ this.reverse.forEach(({ item, operation }) => {
7886
+ item.apply(operation);
7887
7887
  });
7888
7888
  }
7889
7889
  getReverse() {
@@ -8625,8 +8625,8 @@ class Path {
8625
8625
  }
8626
8626
  getIntersectionPoints(segment) {
8627
8627
  let intersections = [];
8628
- for (const item2 of this.segments) {
8629
- intersections = intersections.concat(item2.getIntersectionPoints(segment));
8628
+ for (const item of this.segments) {
8629
+ intersections = intersections.concat(item.getIntersectionPoints(segment));
8630
8630
  }
8631
8631
  return intersections;
8632
8632
  }
@@ -8691,8 +8691,8 @@ class Path {
8691
8691
  }
8692
8692
  isOpenEnclosedOrCrossedBy(rectangle) {
8693
8693
  let is = false;
8694
- for (const item2 of this.segments) {
8695
- is = is || item2.isEnclosedOrCrossedBy(rectangle);
8694
+ for (const item of this.segments) {
8695
+ is = is || item.isEnclosedOrCrossedBy(rectangle);
8696
8696
  }
8697
8697
  return is;
8698
8698
  }
@@ -9105,8 +9105,8 @@ class ConnectorCommand {
9105
9105
  }
9106
9106
  }
9107
9107
  revert() {
9108
- for (const { item: item2, operation } of this.reverse) {
9109
- item2.apply(operation);
9108
+ for (const { item, operation } of this.reverse) {
9109
+ item.apply(operation);
9110
9110
  }
9111
9111
  }
9112
9112
  getReverse() {
@@ -9263,11 +9263,11 @@ class SessionStorage {
9263
9263
  }
9264
9264
  get(key) {
9265
9265
  const boardId = this.getBoardId() || "";
9266
- const item2 = _sessionStorage.getItem(boardId + "_" + key);
9267
- if (!item2) {
9266
+ const item = _sessionStorage.getItem(boardId + "_" + key);
9267
+ if (!item) {
9268
9268
  return;
9269
9269
  }
9270
- return JSON.parse(item2);
9270
+ return JSON.parse(item);
9271
9271
  }
9272
9272
  remove(key) {
9273
9273
  const boardId = this.getBoardId() || "";
@@ -10052,8 +10052,8 @@ class LinkToCommand {
10052
10052
  }
10053
10053
  }
10054
10054
  revert() {
10055
- this.reverse.forEach(({ item: item2, operation }) => {
10056
- item2.apply(operation);
10055
+ this.reverse.forEach(({ item, operation }) => {
10056
+ item.apply(operation);
10057
10057
  });
10058
10058
  }
10059
10059
  getReverse() {
@@ -11390,9 +11390,9 @@ function handleSplitListItem(editor) {
11390
11390
  Transforms2.insertNodes(editor, {
11391
11391
  type: listType,
11392
11392
  listLevel: listNode.listLevel || 0,
11393
- children: itemsAfter.map((item2) => ({
11393
+ children: itemsAfter.map((item) => ({
11394
11394
  type: "list_item",
11395
- children: item2.children
11395
+ children: item.children
11396
11396
  }))
11397
11397
  }, { at: newListPath });
11398
11398
  }
@@ -15250,10 +15250,10 @@ function initializeDocument(effects) {
15250
15250
  return start;
15251
15251
  function start(code) {
15252
15252
  if (continued < stack.length) {
15253
- const item2 = stack[continued];
15254
- self2.containerState = item2[1];
15255
- ok(item2[0].continuation, "expected `continuation` to be defined on container construct");
15256
- return effects.attempt(item2[0].continuation, documentContinue, checkNewContainers)(code);
15253
+ const item = stack[continued];
15254
+ self2.containerState = item[1];
15255
+ ok(item[0].continuation, "expected `continuation` to be defined on container construct");
15256
+ return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
15257
15257
  }
15258
15258
  return checkNewContainers(code);
15259
15259
  }
@@ -16229,17 +16229,17 @@ class SpliceBuffer {
16229
16229
  this.setCursor(Number.POSITIVE_INFINITY);
16230
16230
  return this.left.pop();
16231
16231
  }
16232
- push(item2) {
16232
+ push(item) {
16233
16233
  this.setCursor(Number.POSITIVE_INFINITY);
16234
- this.left.push(item2);
16234
+ this.left.push(item);
16235
16235
  }
16236
16236
  pushMany(items) {
16237
16237
  this.setCursor(Number.POSITIVE_INFINITY);
16238
16238
  chunkedPush(this.left, items);
16239
16239
  }
16240
- unshift(item2) {
16240
+ unshift(item) {
16241
16241
  this.setCursor(0);
16242
- this.right.push(item2);
16242
+ this.right.push(item);
16243
16243
  }
16244
16244
  unshiftMany(items) {
16245
16245
  this.setCursor(0);
@@ -18270,8 +18270,8 @@ function initializeFactory(field) {
18270
18270
  if (list2) {
18271
18271
  ok(Array.isArray(list2), "expected `disable.null` to be populated");
18272
18272
  while (++index2 < list2.length) {
18273
- const item2 = list2[index2];
18274
- if (!item2.previous || item2.previous.call(self2, self2.previous)) {
18273
+ const item = list2[index2];
18274
+ if (!item.previous || item.previous.call(self2, self2.previous)) {
18275
18275
  return true;
18276
18276
  }
18277
18277
  }
@@ -19102,14 +19102,14 @@ function compiler(options) {
19102
19102
  length++;
19103
19103
  }
19104
19104
  if (event[1].type === types.listItemPrefix) {
19105
- const item2 = {
19105
+ const item = {
19106
19106
  type: "listItem",
19107
19107
  _spread: false,
19108
19108
  start: Object.assign({}, event[1].start),
19109
19109
  end: undefined
19110
19110
  };
19111
- listItem2 = item2;
19112
- events.splice(index2, 0, ["enter", item2, event[2]]);
19111
+ listItem2 = item;
19112
+ events.splice(index2, 0, ["enter", item, event[2]]);
19113
19113
  index2++;
19114
19114
  length++;
19115
19115
  firstBlankLineIndex = undefined;
@@ -19741,14 +19741,14 @@ class MarkdownProcessor {
19741
19741
  if (err || !file) {
19742
19742
  throw err;
19743
19743
  }
19744
- const nodes = file.result.map((item2) => {
19744
+ const nodes = file.result.map((item) => {
19745
19745
  setNodeStyles({
19746
- node: item2,
19746
+ node: item,
19747
19747
  editor: this.editor,
19748
19748
  horisontalAlignment: "left",
19749
- isPaddingTopNeeded: item2.type !== "code_block"
19749
+ isPaddingTopNeeded: item.type !== "code_block"
19750
19750
  });
19751
- return item2;
19751
+ return item;
19752
19752
  });
19753
19753
  if (isNewParagraphNeeded) {
19754
19754
  nodes.push(createParagraphNode("", this.editor));
@@ -20726,8 +20726,8 @@ class ShapeCommand {
20726
20726
  }
20727
20727
  }
20728
20728
  revert() {
20729
- for (const { item: item2, operation } of this.reverse) {
20730
- item2.apply(operation);
20729
+ for (const { item, operation } of this.reverse) {
20730
+ item.apply(operation);
20731
20731
  }
20732
20732
  }
20733
20733
  getReverse() {
@@ -20809,8 +20809,8 @@ class RichTextCommand {
20809
20809
  }
20810
20810
  }
20811
20811
  revert() {
20812
- for (const { item: item2, operation } of this.reverse) {
20813
- const richText = this.board.items.getById(item2);
20812
+ for (const { item, operation } of this.reverse) {
20813
+ const richText = this.board.items.getById(item);
20814
20814
  if (!richText) {
20815
20815
  continue;
20816
20816
  }
@@ -20829,12 +20829,12 @@ class RichTextCommand {
20829
20829
  case "setSelectionFontColor":
20830
20830
  case "setSelectionBlockType":
20831
20831
  const inverseOps = this.operation.ops.map((op) => Operation2.inverse(op)).reverse();
20832
- return items.map((item2) => {
20832
+ return items.map((item) => {
20833
20833
  const operation = {
20834
20834
  ...this.operation,
20835
20835
  ops: inverseOps
20836
20836
  };
20837
- return { item: item2, operation };
20837
+ return { item, operation };
20838
20838
  });
20839
20839
  case "setFontColor":
20840
20840
  return items.map((id) => ({
@@ -20926,13 +20926,13 @@ class RichTextGroupCommand {
20926
20926
  this.reverseOps = this.getReverse();
20927
20927
  }
20928
20928
  apply() {
20929
- for (const { item: item2, operation } of this.forwardOps) {
20930
- item2.applyCommand(operation);
20929
+ for (const { item, operation } of this.forwardOps) {
20930
+ item.applyCommand(operation);
20931
20931
  }
20932
20932
  }
20933
20933
  revert() {
20934
- for (const { item: item2, operation } of this.reverseOps) {
20935
- item2.applyCommand(operation);
20934
+ for (const { item, operation } of this.reverseOps) {
20935
+ item.applyCommand(operation);
20936
20936
  }
20937
20937
  }
20938
20938
  getForward() {
@@ -21047,8 +21047,8 @@ class DrawingCommand {
21047
21047
  item;
21048
21048
  operation;
21049
21049
  reverse;
21050
- constructor(item2, operation) {
21051
- this.item = item2;
21050
+ constructor(item, operation) {
21051
+ this.item = item;
21052
21052
  this.operation = operation;
21053
21053
  this.reverse = this.getReverse();
21054
21054
  }
@@ -21057,52 +21057,52 @@ class DrawingCommand {
21057
21057
  return this;
21058
21058
  }
21059
21059
  apply() {
21060
- for (const item2 of this.item) {
21061
- item2.apply(this.operation);
21060
+ for (const item of this.item) {
21061
+ item.apply(this.operation);
21062
21062
  }
21063
21063
  }
21064
21064
  revert() {
21065
- for (const { item: item2, operation } of this.reverse) {
21066
- item2.apply(operation);
21065
+ for (const { item, operation } of this.reverse) {
21066
+ item.apply(operation);
21067
21067
  }
21068
21068
  }
21069
21069
  getReverse() {
21070
21070
  const reverse = [];
21071
- for (const item2 of this.item) {
21072
- reverse.push({ item: item2, operation: this.getReverseOperation(item2) });
21071
+ for (const item of this.item) {
21072
+ reverse.push({ item, operation: this.getReverseOperation(item) });
21073
21073
  }
21074
21074
  return reverse;
21075
21075
  }
21076
- getReverseOperation(item2) {
21076
+ getReverseOperation(item) {
21077
21077
  switch (this.operation.method) {
21078
21078
  case "setStrokeColor":
21079
21079
  return {
21080
21080
  class: "Drawing",
21081
21081
  method: "setStrokeColor",
21082
- item: [item2.getId()],
21083
- color: item2.getStrokeColor()
21082
+ item: [item.getId()],
21083
+ color: item.getStrokeColor()
21084
21084
  };
21085
21085
  case "setStrokeWidth":
21086
21086
  return {
21087
21087
  class: "Drawing",
21088
21088
  method: "setStrokeWidth",
21089
- item: [item2.getId()],
21089
+ item: [item.getId()],
21090
21090
  width: this.operation.prevWidth,
21091
- prevWidth: item2.getStrokeWidth()
21091
+ prevWidth: item.getStrokeWidth()
21092
21092
  };
21093
21093
  case "setStrokeOpacity":
21094
21094
  return {
21095
21095
  class: "Drawing",
21096
21096
  method: "setStrokeOpacity",
21097
- item: [item2.getId()],
21098
- opacity: item2.getStrokeOpacity()
21097
+ item: [item.getId()],
21098
+ opacity: item.getStrokeOpacity()
21099
21099
  };
21100
21100
  case "setStrokeStyle":
21101
21101
  return {
21102
21102
  class: "Drawing",
21103
21103
  method: "setStrokeStyle",
21104
- item: [item2.getId()],
21105
- style: item2.getBorderStyle()
21104
+ item: [item.getId()],
21105
+ style: item.getBorderStyle()
21106
21106
  };
21107
21107
  }
21108
21108
  }
@@ -21124,8 +21124,8 @@ class StickerCommand {
21124
21124
  }
21125
21125
  }
21126
21126
  revert() {
21127
- for (const { item: item2, operation } of this.reverse) {
21128
- item2.apply(operation);
21127
+ for (const { item, operation } of this.reverse) {
21128
+ item.apply(operation);
21129
21129
  }
21130
21130
  }
21131
21131
  getReverse() {
@@ -21157,8 +21157,8 @@ class FrameCommand {
21157
21157
  }
21158
21158
  }
21159
21159
  revert() {
21160
- for (const { item: item2, operation } of this.reverse) {
21161
- item2.apply(operation);
21160
+ for (const { item, operation } of this.reverse) {
21161
+ item.apply(operation);
21162
21162
  }
21163
21163
  }
21164
21164
  getReverse() {
@@ -21200,21 +21200,23 @@ class FrameCommand {
21200
21200
  };
21201
21201
  });
21202
21202
  default:
21203
- const op = this.operation;
21204
- let newData = {};
21205
- if (op.prevData) {
21206
- newData = { ...op.prevData };
21207
- } else {
21208
- Object.keys(op.newData).forEach((key) => {
21209
- if (item[key]) {
21210
- newData[key] = item[key];
21211
- }
21212
- });
21213
- }
21214
- return {
21215
- ...op,
21216
- newData
21217
- };
21203
+ return mapItemsByOperation(frame, (item) => {
21204
+ const op = this.operation;
21205
+ let newData = {};
21206
+ if (op.prevData) {
21207
+ newData = { ...op.prevData };
21208
+ } else {
21209
+ Object.keys(op.newData).forEach((key) => {
21210
+ if (item[key]) {
21211
+ newData[key] = item[key];
21212
+ }
21213
+ });
21214
+ }
21215
+ return {
21216
+ ...op,
21217
+ newData
21218
+ };
21219
+ });
21218
21220
  }
21219
21221
  }
21220
21222
  }
@@ -21235,8 +21237,8 @@ class CommentCommand {
21235
21237
  }
21236
21238
  }
21237
21239
  revert() {
21238
- this.reverse.forEach(({ item: item2, operation }) => {
21239
- item2.apply(operation);
21240
+ this.reverse.forEach(({ item, operation }) => {
21241
+ item.apply(operation);
21240
21242
  });
21241
21243
  }
21242
21244
  getReverse() {
@@ -21697,8 +21699,8 @@ class GroupCommand {
21697
21699
  }
21698
21700
  }
21699
21701
  revert() {
21700
- for (const { item: item2, operation } of this.reverse) {
21701
- item2.apply(operation);
21702
+ for (const { item, operation } of this.reverse) {
21703
+ item.apply(operation);
21702
21704
  }
21703
21705
  }
21704
21706
  getReverse() {
@@ -21751,8 +21753,8 @@ class PlaceholderCommand {
21751
21753
  }
21752
21754
  }
21753
21755
  revert() {
21754
- for (const { item: item2, operation } of this.reverse) {
21755
- item2.apply(operation);
21756
+ for (const { item, operation } of this.reverse) {
21757
+ item.apply(operation);
21756
21758
  }
21757
21759
  }
21758
21760
  getReverse() {
@@ -21846,34 +21848,51 @@ class BaseCommand {
21846
21848
  return this;
21847
21849
  }
21848
21850
  apply() {
21849
- for (const item2 of this.items) {
21850
- item2.apply(this.operation);
21851
+ for (const item of this.items) {
21852
+ item.apply(this.operation);
21851
21853
  }
21852
21854
  }
21853
21855
  revert() {
21854
- for (const { item: item2, operation } of this.reverse) {
21855
- item2.apply(operation);
21856
+ for (const { item, operation } of this.reverse) {
21857
+ item.apply(operation);
21856
21858
  }
21857
21859
  }
21858
21860
  getReverse() {
21859
21861
  const items = this.items;
21860
- return mapItemsByOperation(items, (item2) => {
21861
- const op = this.operation;
21862
- let newData = {};
21863
- if (op.prevData) {
21864
- newData = { ...op.prevData };
21865
- } else {
21866
- Object.keys(op.newData).forEach((key) => {
21867
- if (item2[key]) {
21868
- newData[key] = item2[key];
21862
+ switch (this.operation.method) {
21863
+ case "addChildren":
21864
+ return mapItemsByOperation(items, (item) => {
21865
+ return {
21866
+ ...this.operation,
21867
+ newData: { childIds: item.getChildrenIds() }
21868
+ };
21869
+ });
21870
+ case "removeChildren":
21871
+ return mapItemsByOperation(items, (item) => {
21872
+ return {
21873
+ ...this.operation,
21874
+ newData: { childIds: item.getChildrenIds() }
21875
+ };
21876
+ });
21877
+ default:
21878
+ return mapItemsByOperation(items, (item) => {
21879
+ const op = this.operation;
21880
+ let newData = {};
21881
+ if (op.prevData) {
21882
+ newData = { ...op.prevData };
21883
+ } else {
21884
+ Object.keys(op.newData).forEach((key) => {
21885
+ if (item[key]) {
21886
+ newData[key] = item[key];
21887
+ }
21888
+ });
21869
21889
  }
21890
+ return {
21891
+ ...op,
21892
+ newData
21893
+ };
21870
21894
  });
21871
- }
21872
- return {
21873
- ...op,
21874
- newData
21875
- };
21876
- });
21895
+ }
21877
21896
  }
21878
21897
  }
21879
21898
  var itemCommandFactories = {
@@ -21893,37 +21912,37 @@ var itemCommandFactories = {
21893
21912
  LinkTo: createLinkToCommand
21894
21913
  };
21895
21914
  function createConnectorCommand(items, operation) {
21896
- return new ConnectorCommand(items.filter((item2) => item2.itemType === "Connector"), operation);
21915
+ return new ConnectorCommand(items.filter((item) => item.itemType === "Connector"), operation);
21897
21916
  }
21898
21917
  function createShapeCommand(items, operation) {
21899
- return new ShapeCommand(items.filter((item2) => item2.itemType === "Shape"), operation);
21918
+ return new ShapeCommand(items.filter((item) => item.itemType === "Shape"), operation);
21900
21919
  }
21901
21920
  function createDrawingCommand(items, operation) {
21902
- return new DrawingCommand(items.filter((item2) => item2.itemType === "Drawing"), operation);
21921
+ return new DrawingCommand(items.filter((item) => item.itemType === "Drawing"), operation);
21903
21922
  }
21904
21923
  function createCommentCommand(items, operation) {
21905
- return new CommentCommand(items.filter((item2) => item2.itemType === "Comment"), operation);
21924
+ return new CommentCommand(items.filter((item) => item.itemType === "Comment"), operation);
21906
21925
  }
21907
21926
  function createStickerCommand(items, operation) {
21908
- return new StickerCommand(items.filter((item2) => item2.itemType === "Sticker"), operation);
21927
+ return new StickerCommand(items.filter((item) => item.itemType === "Sticker"), operation);
21909
21928
  }
21910
21929
  function createFrameCommand(items, operation) {
21911
- return new FrameCommand(items.filter((item2) => item2.itemType === "Frame"), operation);
21930
+ return new FrameCommand(items.filter((item) => item.itemType === "Frame"), operation);
21912
21931
  }
21913
21932
  function createPlaceholderCommand(items, operation) {
21914
- return new PlaceholderCommand(items.filter((item2) => item2.itemType === "Placeholder"), operation);
21933
+ return new PlaceholderCommand(items.filter((item) => item.itemType === "Placeholder"), operation);
21915
21934
  }
21916
21935
  function createGroupCommand(items, operation) {
21917
- return new GroupCommand(items.filter((item2) => item2.itemType === "Group"), operation);
21936
+ return new GroupCommand(items.filter((item) => item.itemType === "Group"), operation);
21918
21937
  }
21919
21938
  function createImageCommand(items, operation) {
21920
- return new ImageCommand(items.filter((item2) => item2.itemType === "Image"), operation);
21939
+ return new ImageCommand(items.filter((item) => item.itemType === "Image"), operation);
21921
21940
  }
21922
21941
  function createVideoCommand(items, operation) {
21923
- return new VideoCommand(items.filter((item2) => item2.itemType === "Video"), operation);
21942
+ return new VideoCommand(items.filter((item) => item.itemType === "Video"), operation);
21924
21943
  }
21925
21944
  function createAudioCommand(items, operation) {
21926
- return new AudioCommand(items.filter((item2) => item2.itemType === "Audio"), operation);
21945
+ return new AudioCommand(items.filter((item) => item.itemType === "Audio"), operation);
21927
21946
  }
21928
21947
  function createRichTextCommand(items, operation, board) {
21929
21948
  if (!board) {
@@ -21931,8 +21950,8 @@ function createRichTextCommand(items, operation, board) {
21931
21950
  }
21932
21951
  if (operation.method === "groupEdit") {
21933
21952
  const texts = [];
21934
- for (const { item: item2 } of operation.itemsOps) {
21935
- const found = board.items.findById(item2);
21953
+ for (const { item } of operation.itemsOps) {
21954
+ const found = board.items.findById(item);
21936
21955
  const text3 = found?.getRichText();
21937
21956
  if (text3) {
21938
21957
  texts.push(text3);
@@ -21940,14 +21959,14 @@ function createRichTextCommand(items, operation, board) {
21940
21959
  }
21941
21960
  return new RichTextGroupCommand(texts, operation);
21942
21961
  } else {
21943
- return new RichTextCommand(board, items.map((item2) => item2.getId()), operation);
21962
+ return new RichTextCommand(board, items.map((item) => item.getId()), operation);
21944
21963
  }
21945
21964
  }
21946
21965
  function createTransformationCommand(items, operation) {
21947
- return new TransformationCommand(items.map((item2) => item2.transformation), operation);
21966
+ return new TransformationCommand(items.map((item) => item.transformation), operation);
21948
21967
  }
21949
21968
  function createLinkToCommand(items, operation) {
21950
- return new LinkToCommand(items.map((item2) => item2.linkTo), operation);
21969
+ return new LinkToCommand(items.map((item) => item.linkTo), operation);
21951
21970
  }
21952
21971
  function createCommand(board, operation) {
21953
21972
  try {
@@ -21965,13 +21984,13 @@ function createCommand(board, operation) {
21965
21984
  default: {
21966
21985
  const itemType = operation.class;
21967
21986
  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);
21968
- const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item2) => {
21969
- if (typeof item2 === "string") {
21970
- console.warn(`Item with ID ${item2} not found for operation ${operation.class}.${operation.method}`);
21987
+ const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item) => {
21988
+ if (typeof item === "string") {
21989
+ console.warn(`Item with ID ${item} not found for operation ${operation.class}.${operation.method}`);
21971
21990
  return false;
21972
21991
  }
21973
- if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item2.itemType !== operation.class) {
21974
- console.warn(`Item with ID ${item2} is not of operation type: ${itemType}.`);
21992
+ if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item.itemType !== operation.class) {
21993
+ console.warn(`Item with ID ${item} is not of operation type: ${itemType}.`);
21975
21994
  return false;
21976
21995
  }
21977
21996
  return true;
@@ -22272,20 +22291,20 @@ class RBush {
22272
22291
  }
22273
22292
  return this;
22274
22293
  }
22275
- insert(item2) {
22276
- if (item2)
22277
- this._insert(item2, this.data.height - 1);
22294
+ insert(item) {
22295
+ if (item)
22296
+ this._insert(item, this.data.height - 1);
22278
22297
  return this;
22279
22298
  }
22280
22299
  clear() {
22281
22300
  this.data = createNode([]);
22282
22301
  return this;
22283
22302
  }
22284
- remove(item2, equalsFn) {
22285
- if (!item2)
22303
+ remove(item, equalsFn) {
22304
+ if (!item)
22286
22305
  return this;
22287
22306
  let node2 = this.data;
22288
- const bbox = this.toBBox(item2);
22307
+ const bbox = this.toBBox(item);
22289
22308
  const path2 = [];
22290
22309
  const indexes = [];
22291
22310
  let i, parent, goingUp;
@@ -22297,7 +22316,7 @@ class RBush {
22297
22316
  goingUp = true;
22298
22317
  }
22299
22318
  if (node2.leaf) {
22300
- const index2 = findItem(item2, node2.children, equalsFn);
22319
+ const index2 = findItem(item, node2.children, equalsFn);
22301
22320
  if (index2 !== -1) {
22302
22321
  node2.children.splice(index2, 1);
22303
22322
  path2.push(node2);
@@ -22320,8 +22339,8 @@ class RBush {
22320
22339
  }
22321
22340
  return this;
22322
22341
  }
22323
- toBBox(item2) {
22324
- return item2;
22342
+ toBBox(item) {
22343
+ return item;
22325
22344
  }
22326
22345
  compareMinX(a, b) {
22327
22346
  return a.minX - b.minX;
@@ -22404,11 +22423,11 @@ class RBush {
22404
22423
  }
22405
22424
  return node2;
22406
22425
  }
22407
- _insert(item2, level, isNode) {
22408
- const bbox = isNode ? item2 : this.toBBox(item2);
22426
+ _insert(item, level, isNode) {
22427
+ const bbox = isNode ? item : this.toBBox(item);
22409
22428
  const insertPath = [];
22410
22429
  const node2 = this._chooseSubtree(bbox, this.data, level, insertPath);
22411
- node2.children.push(item2);
22430
+ node2.children.push(item);
22412
22431
  extend2(node2, bbox);
22413
22432
  while (level >= 0) {
22414
22433
  if (insertPath[level].children.length > this._maxEntries) {
@@ -22507,11 +22526,11 @@ class RBush {
22507
22526
  }
22508
22527
  }
22509
22528
  }
22510
- function findItem(item2, items, equalsFn) {
22529
+ function findItem(item, items, equalsFn) {
22511
22530
  if (!equalsFn)
22512
- return items.indexOf(item2);
22531
+ return items.indexOf(item);
22513
22532
  for (let i = 0;i < items.length; i++) {
22514
- if (equalsFn(item2, items[i]))
22533
+ if (equalsFn(item, items[i]))
22515
22534
  return i;
22516
22535
  }
22517
22536
  return -1;
@@ -22673,10 +22692,10 @@ class RTreeIndex {
22673
22692
  return container ? container.item : undefined;
22674
22693
  }
22675
22694
  remove(id) {
22676
- const item2 = this.map.get(id);
22677
- if (item2) {
22695
+ const item = this.map.get(id);
22696
+ if (item) {
22678
22697
  this.map.delete(id);
22679
- this.tree.remove(item2);
22698
+ this.tree.remove(item);
22680
22699
  }
22681
22700
  }
22682
22701
  list() {
@@ -22748,11 +22767,11 @@ class Container extends Mbr {
22748
22767
  item;
22749
22768
  layer;
22750
22769
  zIndex;
22751
- constructor(id, item2, layer, zIndex) {
22752
- const rect = item2.getMbrWithChildren();
22770
+ constructor(id, item, layer, zIndex) {
22771
+ const rect = item.getMbrWithChildren();
22753
22772
  super(rect.left, rect.top, rect.right, rect.bottom);
22754
22773
  this.id = id;
22755
- this.item = item2;
22774
+ this.item = item;
22756
22775
  this.layer = layer;
22757
22776
  this.zIndex = zIndex;
22758
22777
  }
@@ -22769,7 +22788,7 @@ class LayeredIndex {
22769
22788
  this.getZIndex = this.getZIndex.bind(this);
22770
22789
  this.layers.newOnTop();
22771
22790
  }
22772
- isT(item2) {
22791
+ isT(item) {
22773
22792
  return true;
22774
22793
  }
22775
22794
  findById(id) {
@@ -22833,8 +22852,8 @@ class LayeredIndex {
22833
22852
  }
22834
22853
  getContainersFromItems(items) {
22835
22854
  const containers = [];
22836
- for (const item2 of items) {
22837
- const container = this.map.get(item2.getId());
22855
+ for (const item of items) {
22856
+ const container = this.map.get(item.getId());
22838
22857
  if (container) {
22839
22858
  containers.push(container);
22840
22859
  }
@@ -22911,9 +22930,9 @@ class LayeredIndex {
22911
22930
  }
22912
22931
  }
22913
22932
  }
22914
- insert(item2) {
22915
- const toInsert = new Container(item2.getId(), item2, 0, this.getZIndex(item2));
22916
- const bounds = item2.getMbrWithChildren();
22933
+ insert(item) {
22934
+ const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
22935
+ const bounds = item.getMbrWithChildren();
22917
22936
  const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
22918
22937
  if (inBounds.length === 0) {
22919
22938
  return this.insertContainer(toInsert);
@@ -22980,20 +22999,20 @@ class LayeredIndex {
22980
22999
  }
22981
23000
  }
22982
23001
  }
22983
- change(item2) {
22984
- const id = item2.getId();
23002
+ change(item) {
23003
+ const id = item.getId();
22985
23004
  const container = this.map.get(id);
22986
23005
  if (container) {
22987
23006
  const layer = this.layers.get(container.layer);
22988
23007
  if (layer) {
22989
23008
  layer.remove(id);
22990
23009
  this.map.delete(id);
22991
- this.insert(item2);
23010
+ this.insert(item);
22992
23011
  }
22993
23012
  }
22994
23013
  }
22995
- remove(item2) {
22996
- const id = item2.getId();
23014
+ remove(item) {
23015
+ const id = item.getId();
22997
23016
  const container = this.map.get(id);
22998
23017
  if (container) {
22999
23018
  const layer = this.layers.get(container.layer);
@@ -23019,13 +23038,13 @@ class LayeredIndex {
23019
23038
  return items;
23020
23039
  }
23021
23040
  batchInsert(items) {
23022
- for (const item2 of items) {
23023
- this.insert(item2);
23041
+ for (const item of items) {
23042
+ this.insert(item);
23024
23043
  }
23025
23044
  }
23026
23045
  batchChange(items) {
23027
- for (const item2 of items) {
23028
- this.change(item2);
23046
+ for (const item of items) {
23047
+ this.change(item);
23029
23048
  }
23030
23049
  }
23031
23050
  }
@@ -23034,8 +23053,8 @@ class LayeredIndex {
23034
23053
  class SpatialIndex {
23035
23054
  subject = new Subject;
23036
23055
  itemsArray = [];
23037
- itemsIndex = new LayeredIndex((item2) => {
23038
- return this.itemsArray.indexOf(item2);
23056
+ itemsIndex = new LayeredIndex((item) => {
23057
+ return this.itemsArray.indexOf(item);
23039
23058
  });
23040
23059
  Mbr = new Mbr;
23041
23060
  items;
@@ -23044,79 +23063,79 @@ class SpatialIndex {
23044
23063
  }
23045
23064
  clear() {
23046
23065
  this.itemsArray = [];
23047
- this.itemsIndex = new LayeredIndex((item2) => {
23048
- return this.itemsArray.indexOf(item2);
23066
+ this.itemsIndex = new LayeredIndex((item) => {
23067
+ return this.itemsArray.indexOf(item);
23049
23068
  });
23050
23069
  this.Mbr = new Mbr;
23051
23070
  }
23052
- insert(item2) {
23053
- this.itemsArray.push(item2);
23054
- this.itemsIndex.insert(item2);
23071
+ insert(item) {
23072
+ this.itemsArray.push(item);
23073
+ this.itemsIndex.insert(item);
23055
23074
  if (conf.isNode()) {
23056
23075
  return;
23057
23076
  }
23058
23077
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23059
- this.Mbr = item2.getMbr().copy();
23078
+ this.Mbr = item.getMbr().copy();
23060
23079
  } else {
23061
- this.Mbr.combine([item2.getMbr()]);
23080
+ this.Mbr.combine([item.getMbr()]);
23062
23081
  }
23063
- item2.subject.subscribe(this.change);
23082
+ item.subject.subscribe(this.change);
23064
23083
  this.subject.publish(this.items);
23065
23084
  }
23066
- change = (item2) => {
23067
- this.itemsIndex.change(item2);
23085
+ change = (item) => {
23086
+ this.itemsIndex.change(item);
23068
23087
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23069
- this.Mbr = item2.getMbrWithChildren().copy();
23088
+ this.Mbr = item.getMbrWithChildren().copy();
23070
23089
  } else {
23071
- this.Mbr.combine([item2.getMbrWithChildren()]);
23090
+ this.Mbr.combine([item.getMbrWithChildren()]);
23072
23091
  }
23073
23092
  this.subject.publish(this.items);
23074
23093
  };
23075
- remove(item2) {
23076
- if ("index" in item2 && item2.index) {
23077
- item2.removeChildItems(item2.index.list());
23094
+ remove(item) {
23095
+ if ("index" in item && item.index) {
23096
+ item.removeChildItems(item.index.list());
23078
23097
  }
23079
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
23080
- this.itemsIndex.remove(item2);
23098
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
23099
+ this.itemsIndex.remove(item);
23081
23100
  this.Mbr = new Mbr;
23082
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbrWithChildren()]));
23101
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbrWithChildren()]));
23083
23102
  this.subject.publish(this.items);
23084
23103
  }
23085
23104
  copy() {
23086
- return this.getItemsWithIncludedChildren(this.itemsArray).map((item2) => ({
23087
- ...item2.serialize(true),
23088
- id: item2.getId()
23105
+ return this.getItemsWithIncludedChildren(this.itemsArray).map((item) => ({
23106
+ ...item.serialize(true),
23107
+ id: item.getId()
23089
23108
  }));
23090
23109
  }
23091
23110
  getItemsWithIncludedChildren(items) {
23092
- return items.flatMap((item2) => {
23093
- if ("index" in item2 && item2.index) {
23094
- return [item2, ...item2.index.list()];
23111
+ return items.flatMap((item) => {
23112
+ if ("index" in item && item.index) {
23113
+ return [item, ...item.index.list()];
23095
23114
  }
23096
- return item2;
23115
+ return item;
23097
23116
  });
23098
23117
  }
23099
- getItemChildren(item2) {
23100
- if ("index" in item2 && item2.index) {
23101
- return item2.index.list();
23118
+ getItemChildren(item) {
23119
+ if ("index" in item && item.index) {
23120
+ return item.index.list();
23102
23121
  }
23103
23122
  return [];
23104
23123
  }
23105
- getItemParent(item2) {
23106
- if (item2.parent === "Board") {
23124
+ getItemParent(item) {
23125
+ if (item.parent === "Board") {
23107
23126
  return;
23108
23127
  }
23109
- return this.getById(item2.parent);
23128
+ return this.getById(item.parent);
23110
23129
  }
23111
- moveToZIndex(item2, zIndex) {
23112
- const index2 = this.itemsArray.indexOf(item2);
23130
+ moveToZIndex(item, zIndex) {
23131
+ const index2 = this.itemsArray.indexOf(item);
23113
23132
  this.itemsArray.splice(index2, 1);
23114
- this.itemsArray.splice(zIndex, 0, item2);
23115
- this.change(item2);
23133
+ this.itemsArray.splice(zIndex, 0, item);
23134
+ this.change(item);
23116
23135
  this.subject.publish(this.items);
23117
23136
  }
23118
23137
  moveManyToZIndex(itemsRecord) {
23119
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
23138
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
23120
23139
  const zIndex = Object.values(itemsRecord);
23121
23140
  for (let i = 0;i < zIndex.length; i++) {
23122
23141
  const index2 = zIndex[i];
@@ -23124,39 +23143,39 @@ class SpatialIndex {
23124
23143
  }
23125
23144
  this.itemsArray.forEach(this.change.bind(this));
23126
23145
  }
23127
- sendToBack(item2, shouldPublish = true) {
23128
- const index2 = this.itemsArray.indexOf(item2);
23146
+ sendToBack(item, shouldPublish = true) {
23147
+ const index2 = this.itemsArray.indexOf(item);
23129
23148
  this.itemsArray.splice(index2, 1);
23130
- this.itemsArray.unshift(item2);
23131
- this.itemsIndex.change(item2);
23149
+ this.itemsArray.unshift(item);
23150
+ this.itemsIndex.change(item);
23132
23151
  if (shouldPublish) {
23133
23152
  this.subject.publish(this.items);
23134
23153
  }
23135
23154
  }
23136
23155
  sendManyToBack(items) {
23137
23156
  const newItems = [...items];
23138
- this.itemsArray.forEach((item2) => {
23139
- if (!items.includes(item2)) {
23140
- newItems.push(item2);
23157
+ this.itemsArray.forEach((item) => {
23158
+ if (!items.includes(item)) {
23159
+ newItems.push(item);
23141
23160
  }
23142
23161
  });
23143
23162
  this.itemsArray = newItems;
23144
23163
  this.itemsArray.forEach(this.change.bind(this));
23145
23164
  }
23146
- bringToFront(item2, shouldPublish = true) {
23147
- const index2 = this.itemsArray.indexOf(item2);
23165
+ bringToFront(item, shouldPublish = true) {
23166
+ const index2 = this.itemsArray.indexOf(item);
23148
23167
  this.itemsArray.splice(index2, 1);
23149
- this.itemsArray.push(item2);
23150
- this.itemsIndex.change(item2);
23168
+ this.itemsArray.push(item);
23169
+ this.itemsIndex.change(item);
23151
23170
  if (shouldPublish) {
23152
23171
  this.subject.publish(this.items);
23153
23172
  }
23154
23173
  }
23155
23174
  bringManyToFront(items) {
23156
23175
  const newItems = [];
23157
- this.itemsArray.forEach((item2) => {
23158
- if (!items.includes(item2)) {
23159
- newItems.push(item2);
23176
+ this.itemsArray.forEach((item) => {
23177
+ if (!items.includes(item)) {
23178
+ newItems.push(item);
23160
23179
  }
23161
23180
  });
23162
23181
  newItems.push(...items);
@@ -23182,9 +23201,9 @@ class SpatialIndex {
23182
23201
  this.subject.publish(this.items);
23183
23202
  }
23184
23203
  getById(id) {
23185
- const item2 = this.getItemsWithIncludedChildren(this.itemsArray).find((item3) => item3.getId() === id);
23186
- if (item2) {
23187
- return item2;
23204
+ const item = this.getItemsWithIncludedChildren(this.itemsArray).find((item2) => item2.getId() === id);
23205
+ if (item) {
23206
+ return item;
23188
23207
  }
23189
23208
  }
23190
23209
  findById(id) {
@@ -23194,10 +23213,10 @@ class SpatialIndex {
23194
23213
  const mbr = new Mbr(left, top, right, bottom);
23195
23214
  const items = this.itemsIndex.getEnclosed(mbr);
23196
23215
  const children = [];
23197
- const clearItems = items.filter((item2) => {
23198
- if ("index" in item2 && item2.index) {
23199
- children.push(...item2.index.getEnclosed(left, top, right, bottom));
23200
- if (!item2.getMbr().isEnclosedBy(mbr)) {
23216
+ const clearItems = items.filter((item) => {
23217
+ if ("index" in item && item.index) {
23218
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
23219
+ if (!item.getMbr().isEnclosedBy(mbr)) {
23201
23220
  return false;
23202
23221
  }
23203
23222
  }
@@ -23209,10 +23228,10 @@ class SpatialIndex {
23209
23228
  const mbr = new Mbr(left, top, right, bottom);
23210
23229
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
23211
23230
  const children = [];
23212
- const clearItems = items.filter((item2) => {
23213
- if ("index" in item2 && item2.index) {
23214
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
23215
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
23231
+ const clearItems = items.filter((item) => {
23232
+ if ("index" in item && item.index) {
23233
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
23234
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
23216
23235
  return false;
23217
23236
  }
23218
23237
  }
@@ -23223,10 +23242,10 @@ class SpatialIndex {
23223
23242
  getUnderPoint(point3, tolerance = 5) {
23224
23243
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
23225
23244
  const children = [];
23226
- const clearItems = items.filter((item2) => {
23227
- if ("index" in item2 && item2.index) {
23228
- children.push(...item2.index.getUnderPoint(point3, tolerance));
23229
- if (!item2.getMbr().isUnderPoint(point3)) {
23245
+ const clearItems = items.filter((item) => {
23246
+ if ("index" in item && item.index) {
23247
+ children.push(...item.index.getUnderPoint(point3, tolerance));
23248
+ if (!item.getMbr().isUnderPoint(point3)) {
23230
23249
  return false;
23231
23250
  }
23232
23251
  }
@@ -23238,10 +23257,10 @@ class SpatialIndex {
23238
23257
  const mbr = new Mbr(left, top, right, bottom);
23239
23258
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
23240
23259
  const children = [];
23241
- const clearItems = items.filter((item2) => {
23242
- if ("index" in item2 && item2.index) {
23243
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
23244
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
23260
+ const clearItems = items.filter((item) => {
23261
+ if ("index" in item && item.index) {
23262
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
23263
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
23245
23264
  return false;
23246
23265
  }
23247
23266
  }
@@ -23253,26 +23272,26 @@ class SpatialIndex {
23253
23272
  return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
23254
23273
  }
23255
23274
  getComments() {
23256
- return this.itemsArray.filter((item2) => item2 instanceof Comment);
23275
+ return this.itemsArray.filter((item) => item instanceof Comment);
23257
23276
  }
23258
23277
  getMbr() {
23259
23278
  return this.Mbr;
23260
23279
  }
23261
23280
  getNearestTo(point3, maxItems, filter, maxDistance) {
23262
23281
  const allItems = this.getItemsWithIncludedChildren(this.itemsArray);
23263
- const filtered = allItems.filter((item2) => filter(item2));
23264
- const withDistance = filtered.map((item2) => ({
23265
- item: item2,
23266
- distance: point3.getDistance(item2.getMbr().getCenter())
23282
+ const filtered = allItems.filter((item) => filter(item));
23283
+ const withDistance = filtered.map((item) => ({
23284
+ item,
23285
+ distance: point3.getDistance(item.getMbr().getCenter())
23267
23286
  })).filter(({ distance }) => distance <= maxDistance);
23268
23287
  withDistance.sort((a, b) => a.distance - b.distance);
23269
- return withDistance.slice(0, maxItems).map(({ item: item2 }) => item2);
23288
+ return withDistance.slice(0, maxItems).map(({ item }) => item);
23270
23289
  }
23271
23290
  list() {
23272
23291
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
23273
23292
  }
23274
- getZIndex(item2) {
23275
- const index2 = this.itemsArray.indexOf(item2);
23293
+ getZIndex(item) {
23294
+ const index2 = this.itemsArray.indexOf(item);
23276
23295
  if (index2 === -1) {
23277
23296
  return this.getLastZIndex();
23278
23297
  }
@@ -23302,14 +23321,14 @@ class Items {
23302
23321
  this.pointer = pointer;
23303
23322
  this.subject = subject;
23304
23323
  }
23305
- update(item2) {
23306
- this.index.change(item2);
23324
+ update(item) {
23325
+ this.index.change(item);
23307
23326
  }
23308
23327
  listAll() {
23309
23328
  return this.index.list();
23310
23329
  }
23311
23330
  listGroupItems() {
23312
- return this.index.list().filter((item2) => ("index" in item2) && item2.index);
23331
+ return this.index.list().filter((item) => ("index" in item) && item.index);
23313
23332
  }
23314
23333
  getById(id) {
23315
23334
  return this.index.getById(id);
@@ -23324,7 +23343,7 @@ class Items {
23324
23343
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
23325
23344
  }
23326
23345
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
23327
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => item2 instanceof BaseItem && item2.index);
23346
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
23328
23347
  }
23329
23348
  getUnderPoint(point3, tolerance = 5) {
23330
23349
  return this.index.getUnderPoint(point3, tolerance);
@@ -23352,28 +23371,28 @@ class Items {
23352
23371
  const unmodifiedSize = size;
23353
23372
  size = 16;
23354
23373
  const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
23355
- const groups = tolerated.filter((item2) => item2.itemType === "Group");
23374
+ const groups = tolerated.filter((item) => item.itemType === "Group");
23356
23375
  if (groups.length > 0) {
23357
23376
  return groups;
23358
23377
  }
23359
- let enclosed = tolerated.some((item2) => item2 instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
23378
+ let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
23360
23379
  const underPointer = this.getUnderPoint(new Point(x, y), size);
23361
23380
  if (enclosed.length === 0) {
23362
23381
  enclosed = underPointer;
23363
23382
  }
23364
- if (underPointer.some((item2) => item2.itemType === "Drawing")) {
23383
+ if (underPointer.some((item) => item.itemType === "Drawing")) {
23365
23384
  enclosed = [...underPointer, ...enclosed];
23366
23385
  }
23367
- const { nearest } = enclosed.reduce((acc, item2) => {
23368
- const area = item2.getMbr().getHeight() * item2.getMbr().getWidth();
23369
- if (item2.itemType === "Drawing" && !item2.isPointNearLine(this.pointer.point)) {
23386
+ const { nearest } = enclosed.reduce((acc, item) => {
23387
+ const area = item.getMbr().getHeight() * item.getMbr().getWidth();
23388
+ if (item.itemType === "Drawing" && !item.isPointNearLine(this.pointer.point)) {
23370
23389
  return acc;
23371
23390
  }
23372
- const isItemTransparent = item2 instanceof Shape && item2?.getBackgroundColor() === "none";
23373
- const itemZIndex = this.getZIndex(item2);
23391
+ const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
23392
+ const itemZIndex = this.getZIndex(item);
23374
23393
  const accZIndex = this.getZIndex(acc.nearest);
23375
23394
  if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
23376
- return { nearest: item2, area };
23395
+ return { nearest: item, area };
23377
23396
  }
23378
23397
  return acc;
23379
23398
  }, { nearest: undefined, area: Infinity });
@@ -23385,8 +23404,8 @@ class Items {
23385
23404
  getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
23386
23405
  return this.index.getNearestTo(this.pointer.point, maxItems, filter, maxDistance);
23387
23406
  }
23388
- getZIndex(item2) {
23389
- return this.index.getZIndex(item2);
23407
+ getZIndex(item) {
23408
+ return this.index.getZIndex(item);
23390
23409
  }
23391
23410
  getByZIndex(index2) {
23392
23411
  return this.index.getByZIndex(index2);
@@ -23395,11 +23414,11 @@ class Items {
23395
23414
  return this.index.getLastZIndex();
23396
23415
  }
23397
23416
  getLinkedConnectorsById(id) {
23398
- return this.listAll().filter((item2) => {
23399
- if (!(item2 instanceof Connector2)) {
23417
+ return this.listAll().filter((item) => {
23418
+ if (!(item instanceof Connector2)) {
23400
23419
  return false;
23401
23420
  }
23402
- const { startItem, endItem } = item2.getConnectedItems();
23421
+ const { startItem, endItem } = item.getConnectedItems();
23403
23422
  if (startItem?.getId() === id || endItem?.getId() === id) {
23404
23423
  return true;
23405
23424
  }
@@ -23410,11 +23429,11 @@ class Items {
23410
23429
  if (!startPointerItemId && !endPointerItemId) {
23411
23430
  return [];
23412
23431
  }
23413
- return this.listAll().filter((item2) => {
23414
- if (!(item2 instanceof Connector2) || !item2.isConnected()) {
23432
+ return this.listAll().filter((item) => {
23433
+ if (!(item instanceof Connector2) || !item.isConnected()) {
23415
23434
  return false;
23416
23435
  }
23417
- const { startItem, endItem } = item2.getConnectedItems();
23436
+ const { startItem, endItem } = item.getConnectedItems();
23418
23437
  if (startPointerItemId && endPointerItemId) {
23419
23438
  if (startPointerItemId && startItem && startItem.getId() === startPointerItemId && endPointerItemId && endItem && endItem.getId() === endPointerItemId) {
23420
23439
  return true;
@@ -23432,9 +23451,9 @@ class Items {
23432
23451
  }
23433
23452
  render(context) {
23434
23453
  const items = this.getItemsInView();
23435
- items.forEach((item2) => {
23436
- if (item2.parent === "Board") {
23437
- item2.render(context);
23454
+ items.forEach((item) => {
23455
+ if (item.parent === "Board") {
23456
+ item.render(context);
23438
23457
  }
23439
23458
  });
23440
23459
  }
@@ -23447,17 +23466,17 @@ class Items {
23447
23466
  return this.getHTML(documentFactory, items);
23448
23467
  }
23449
23468
  getHTML(documentFactory, items) {
23450
- const lowestCoordinates = items.map((item2) => item2.getMbr()).reduce((acc, mbr) => ({
23469
+ const lowestCoordinates = items.map((item) => item.getMbr()).reduce((acc, mbr) => ({
23451
23470
  left: Math.min(acc.left, mbr.left),
23452
23471
  top: Math.min(acc.top, mbr.top)
23453
23472
  }), { left: 0, top: 0 });
23454
23473
  const groups = [];
23455
23474
  const rest = [];
23456
- items.forEach((item2) => {
23457
- if ("index" in item2 && item2.index) {
23458
- groups.push(item2);
23475
+ items.forEach((item) => {
23476
+ if ("index" in item && item.index) {
23477
+ groups.push(item);
23459
23478
  } else {
23460
- rest.push(item2);
23479
+ rest.push(item);
23461
23480
  }
23462
23481
  });
23463
23482
  const childrenMap = new Map;
@@ -23467,34 +23486,34 @@ class Items {
23467
23486
  translateElementBy(html, -lowestCoordinates.left, -lowestCoordinates.top);
23468
23487
  return html;
23469
23488
  });
23470
- const restHTML = rest.map((item2) => ("renderHTML" in item2) && item2.renderHTML(documentFactory)).filter((item2) => !!item2).map((item2) => {
23471
- if (item2.tagName.toLowerCase() === "connector-item") {
23472
- const startX = parseFloat(item2.getAttribute("data-start-point-x") || "0");
23473
- const startY = parseFloat(item2.getAttribute("data-start-point-y") || "0");
23474
- const endX = parseFloat(item2.getAttribute("data-end-point-x") || "0");
23475
- const endY = parseFloat(item2.getAttribute("data-end-point-y") || "0");
23476
- item2.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
23477
- item2.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
23478
- item2.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
23479
- item2.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
23480
- }
23481
- return translateElementBy(item2, -lowestCoordinates.left, -lowestCoordinates.top);
23482
- });
23483
- for (const item2 of restHTML) {
23484
- const parentFrameId = childrenMap.get(item2.id);
23489
+ const restHTML = rest.map((item) => ("renderHTML" in item) && item.renderHTML(documentFactory)).filter((item) => !!item).map((item) => {
23490
+ if (item.tagName.toLowerCase() === "connector-item") {
23491
+ const startX = parseFloat(item.getAttribute("data-start-point-x") || "0");
23492
+ const startY = parseFloat(item.getAttribute("data-start-point-y") || "0");
23493
+ const endX = parseFloat(item.getAttribute("data-end-point-x") || "0");
23494
+ const endY = parseFloat(item.getAttribute("data-end-point-y") || "0");
23495
+ item.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
23496
+ item.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
23497
+ item.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
23498
+ item.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
23499
+ }
23500
+ return translateElementBy(item, -lowestCoordinates.left, -lowestCoordinates.top);
23501
+ });
23502
+ for (const item of restHTML) {
23503
+ const parentFrameId = childrenMap.get(item.id);
23485
23504
  const group = GroupsHTML.find((el) => parentFrameId !== undefined && el.id === parentFrameId);
23486
23505
  if (group) {
23487
- positionRelatively(item2, group);
23488
- group.appendChild(item2);
23506
+ positionRelatively(item, group);
23507
+ group.appendChild(item);
23489
23508
  }
23490
23509
  }
23491
23510
  let result = "";
23492
23511
  for (const group of GroupsHTML) {
23493
23512
  result += group.outerHTML;
23494
23513
  }
23495
- for (const item2 of restHTML) {
23496
- if (!childrenMap.get(item2.id)) {
23497
- result += item2.outerHTML;
23514
+ for (const item of restHTML) {
23515
+ if (!childrenMap.get(item.id)) {
23516
+ result += item.outerHTML;
23498
23517
  }
23499
23518
  }
23500
23519
  return result;
@@ -23514,52 +23533,52 @@ class SimpleSpatialIndex {
23514
23533
  this.itemsArray = [];
23515
23534
  this.Mbr = new Mbr;
23516
23535
  }
23517
- insert(item2) {
23518
- this.itemsArray.push(item2);
23536
+ insert(item) {
23537
+ this.itemsArray.push(item);
23519
23538
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23520
- this.Mbr = item2.getMbr().copy();
23539
+ this.Mbr = item.getMbr().copy();
23521
23540
  } else {
23522
- this.Mbr.combine([item2.getMbr()]);
23541
+ this.Mbr.combine([item.getMbr()]);
23523
23542
  }
23524
- item2.subject.subscribe(this.change);
23543
+ item.subject.subscribe(this.change);
23525
23544
  this.subject.publish(this.items);
23526
23545
  }
23527
- change = (item2) => {
23546
+ change = (item) => {
23528
23547
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23529
- this.Mbr = item2.getMbr().copy();
23548
+ this.Mbr = item.getMbr().copy();
23530
23549
  } else {
23531
- this.Mbr.combine([item2.getMbr()]);
23550
+ this.Mbr.combine([item.getMbr()]);
23532
23551
  }
23533
23552
  this.subject.publish(this.items);
23534
23553
  };
23535
- remove(item2) {
23536
- if ("index" in item2 && item2.index) {
23537
- item2.removeChildItems(item2.index.list());
23554
+ remove(item) {
23555
+ if ("index" in item && item.index) {
23556
+ item.removeChildItems(item.index.list());
23538
23557
  }
23539
- if (item2.parent !== "Board") {
23540
- const parentFrame = this.items.getById(item2.parent);
23541
- parentFrame?.removeChildItems(item2);
23558
+ if (item.parent !== "Board") {
23559
+ const parentFrame = this.items.getById(item.parent);
23560
+ parentFrame?.removeChildItems(item);
23542
23561
  }
23543
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
23562
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
23544
23563
  this.Mbr = new Mbr;
23545
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbr()]));
23564
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
23546
23565
  this.subject.publish(this.items);
23547
23566
  }
23548
23567
  copy() {
23549
- return this.itemsArray.map((item2) => ({
23550
- ...item2.serialize(true),
23551
- id: item2.getId()
23568
+ return this.itemsArray.map((item) => ({
23569
+ ...item.serialize(true),
23570
+ id: item.getId()
23552
23571
  }));
23553
23572
  }
23554
- moveToZIndex(item2, zIndex) {
23555
- const index2 = this.itemsArray.indexOf(item2);
23573
+ moveToZIndex(item, zIndex) {
23574
+ const index2 = this.itemsArray.indexOf(item);
23556
23575
  this.itemsArray.splice(index2, 1);
23557
- this.itemsArray.splice(zIndex, 0, item2);
23558
- this.change(item2);
23576
+ this.itemsArray.splice(zIndex, 0, item);
23577
+ this.change(item);
23559
23578
  this.subject.publish(this.items);
23560
23579
  }
23561
23580
  moveManyToZIndex(itemsRecord) {
23562
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
23581
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
23563
23582
  const zIndex = Object.values(itemsRecord);
23564
23583
  for (let i = 0;i < zIndex.length; i++) {
23565
23584
  const index2 = zIndex[i];
@@ -23567,37 +23586,37 @@ class SimpleSpatialIndex {
23567
23586
  }
23568
23587
  this.itemsArray.forEach(this.change.bind(this));
23569
23588
  }
23570
- sendToBack(item2, shouldPublish = true) {
23571
- const index2 = this.itemsArray.indexOf(item2);
23589
+ sendToBack(item, shouldPublish = true) {
23590
+ const index2 = this.itemsArray.indexOf(item);
23572
23591
  this.itemsArray.splice(index2, 1);
23573
- this.itemsArray.unshift(item2);
23592
+ this.itemsArray.unshift(item);
23574
23593
  if (shouldPublish) {
23575
23594
  this.subject.publish(this.items);
23576
23595
  }
23577
23596
  }
23578
23597
  sendManyToBack(items) {
23579
23598
  const newItems = [...items];
23580
- this.itemsArray.forEach((item2) => {
23581
- if (!items.includes(item2)) {
23582
- newItems.push(item2);
23599
+ this.itemsArray.forEach((item) => {
23600
+ if (!items.includes(item)) {
23601
+ newItems.push(item);
23583
23602
  }
23584
23603
  });
23585
23604
  this.itemsArray = newItems;
23586
23605
  this.itemsArray.forEach(this.change.bind(this));
23587
23606
  }
23588
- bringToFront(item2, shouldPublish = true) {
23589
- const index2 = this.itemsArray.indexOf(item2);
23607
+ bringToFront(item, shouldPublish = true) {
23608
+ const index2 = this.itemsArray.indexOf(item);
23590
23609
  this.itemsArray.splice(index2, 1);
23591
- this.itemsArray.push(item2);
23610
+ this.itemsArray.push(item);
23592
23611
  if (shouldPublish) {
23593
23612
  this.subject.publish(this.items);
23594
23613
  }
23595
23614
  }
23596
23615
  bringManyToFront(items) {
23597
23616
  const newItems = [];
23598
- this.itemsArray.forEach((item2) => {
23599
- if (!items.includes(item2)) {
23600
- newItems.push(item2);
23617
+ this.itemsArray.forEach((item) => {
23618
+ if (!items.includes(item)) {
23619
+ newItems.push(item);
23601
23620
  }
23602
23621
  });
23603
23622
  newItems.push(...items);
@@ -23623,9 +23642,9 @@ class SimpleSpatialIndex {
23623
23642
  this.subject.publish(this.items);
23624
23643
  }
23625
23644
  getById(id) {
23626
- const item2 = this.itemsArray.find((item3) => item3.getId() === id);
23627
- if (item2) {
23628
- return item2;
23645
+ const item = this.itemsArray.find((item2) => item2.getId() === id);
23646
+ if (item) {
23647
+ return item;
23629
23648
  }
23630
23649
  }
23631
23650
  findById(id) {
@@ -23634,9 +23653,9 @@ class SimpleSpatialIndex {
23634
23653
  getEnclosed(left, top, right, bottom) {
23635
23654
  const mbr = new Mbr(left, top, right, bottom);
23636
23655
  const items = [];
23637
- this.itemsArray.forEach((item2) => {
23638
- if (item2.isEnclosedBy(mbr)) {
23639
- items.push(item2);
23656
+ this.itemsArray.forEach((item) => {
23657
+ if (item.isEnclosedBy(mbr)) {
23658
+ items.push(item);
23640
23659
  }
23641
23660
  });
23642
23661
  return items;
@@ -23644,18 +23663,18 @@ class SimpleSpatialIndex {
23644
23663
  getEnclosedOrCrossed(left, top, right, bottom) {
23645
23664
  const mbr = new Mbr(left, top, right, bottom);
23646
23665
  const items = [];
23647
- this.itemsArray.forEach((item2) => {
23648
- if (item2.isEnclosedOrCrossedBy(mbr)) {
23649
- items.push(item2);
23666
+ this.itemsArray.forEach((item) => {
23667
+ if (item.isEnclosedOrCrossedBy(mbr)) {
23668
+ items.push(item);
23650
23669
  }
23651
23670
  });
23652
23671
  return items;
23653
23672
  }
23654
23673
  getUnderPoint(point3, tolerace = 5) {
23655
23674
  const items = [];
23656
- this.itemsArray.forEach((item2) => {
23657
- if (item2.isUnderPoint(point3, tolerace)) {
23658
- items.push(item2);
23675
+ this.itemsArray.forEach((item) => {
23676
+ if (item.isUnderPoint(point3, tolerace)) {
23677
+ items.push(item);
23659
23678
  }
23660
23679
  });
23661
23680
  return items;
@@ -23666,8 +23685,8 @@ class SimpleSpatialIndex {
23666
23685
  list() {
23667
23686
  return this.itemsArray.concat();
23668
23687
  }
23669
- getZIndex(item2) {
23670
- return this.itemsArray.indexOf(item2);
23688
+ getZIndex(item) {
23689
+ return this.itemsArray.indexOf(item);
23671
23690
  }
23672
23691
  getLastZIndex() {
23673
23692
  return this.itemsArray.length - 1;
@@ -23681,8 +23700,8 @@ class SimpleSpatialIndex {
23681
23700
  }
23682
23701
  }
23683
23702
  render(context) {
23684
- this.itemsArray.forEach((item2) => {
23685
- item2.render(context);
23703
+ this.itemsArray.forEach((item) => {
23704
+ item.render(context);
23686
23705
  });
23687
23706
  }
23688
23707
  }
@@ -23733,7 +23752,7 @@ class BaseItem extends Mbr {
23733
23752
  if (!this.index) {
23734
23753
  return null;
23735
23754
  }
23736
- return this.index.items.listAll().map((item2) => item2.getId());
23755
+ return this.index.items.listAll().map((item) => item.getId());
23737
23756
  }
23738
23757
  addChildItems(children) {
23739
23758
  if (!this.index) {
@@ -23771,17 +23790,17 @@ class BaseItem extends Mbr {
23771
23790
  this.addChildItems(itemsToAdd);
23772
23791
  this.removeChildItems(itemsToRemove);
23773
23792
  }
23774
- handleNesting(item2, options) {
23775
- const isItem = "itemType" in item2;
23776
- const itemMbr = isItem ? item2.getMbr() : item2;
23777
- if (item2 instanceof BaseItem && !item2.canBeNested) {
23793
+ handleNesting(item, options) {
23794
+ const isItem = "itemType" in item;
23795
+ const itemMbr = isItem ? item.getMbr() : item;
23796
+ if (item instanceof BaseItem && !item.canBeNested) {
23778
23797
  return false;
23779
23798
  }
23780
- if (options?.cancelIfChild && isItem && item2.parent !== "Board") {
23799
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
23781
23800
  return false;
23782
23801
  }
23783
23802
  const mbr = this.getMbr().copy();
23784
- if (item2.isEnclosedOrCrossedBy(mbr)) {
23803
+ if (item.isEnclosedOrCrossedBy(mbr)) {
23785
23804
  if (mbr.isInside(itemMbr.getCenter())) {
23786
23805
  if (!options || !options.onlyForOut) {
23787
23806
  return true;
@@ -26078,8 +26097,8 @@ function isChild(value) {
26078
26097
  if (!Array.isArray(value2))
26079
26098
  return true;
26080
26099
  const list2 = value2;
26081
- for (const item2 of list2) {
26082
- if (typeof item2 !== "number" && typeof item2 !== "string") {
26100
+ for (const item of list2) {
26101
+ if (typeof item !== "number" && typeof item !== "string") {
26083
26102
  return true;
26084
26103
  }
26085
26104
  }
@@ -26118,8 +26137,8 @@ function addProperty(schema, properties, key, value) {
26118
26137
  }
26119
26138
  if (Array.isArray(result)) {
26120
26139
  const finalResult = [];
26121
- for (const item2 of result) {
26122
- finalResult.push(parsePrimitive(info, info.property, item2));
26140
+ for (const item of result) {
26141
+ finalResult.push(parsePrimitive(info, info.property, item));
26123
26142
  }
26124
26143
  result = finalResult;
26125
26144
  }
@@ -37186,8 +37205,8 @@ function list5(node2, parent, state, info) {
37186
37205
  if (checkRule(state) === bullet && firstListItem) {
37187
37206
  let index2 = -1;
37188
37207
  while (++index2 < node2.children.length) {
37189
- const item2 = node2.children[index2];
37190
- if (item2 && item2.type === "listItem" && item2.children && item2.children[0] && item2.children[0].type === "thematicBreak") {
37208
+ const item = node2.children[index2];
37209
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
37191
37210
  useDifferentMarker = true;
37192
37211
  break;
37193
37212
  }
@@ -37848,12 +37867,12 @@ async function convertMarkdownToSlate(text5) {
37848
37867
  ...nodes.filter((node2) => node2.type !== "list_item")
37849
37868
  ];
37850
37869
  }
37851
- return nodes.map((item2) => {
37870
+ return nodes.map((item) => {
37852
37871
  setNodeStyles({
37853
- node: item2,
37854
- isPaddingTopNeeded: item2.type !== "code_block"
37872
+ node: item,
37873
+ isPaddingTopNeeded: item.type !== "code_block"
37855
37874
  });
37856
- return item2;
37875
+ return item;
37857
37876
  });
37858
37877
  }
37859
37878
  function detectListType(text5) {
@@ -38266,17 +38285,17 @@ class FloatingPoint extends Point {
38266
38285
  relativePoint;
38267
38286
  pointType = "Floating";
38268
38287
  edge;
38269
- constructor(item2, relativePoint) {
38288
+ constructor(item, relativePoint) {
38270
38289
  super();
38271
- this.item = item2;
38290
+ this.item = item;
38272
38291
  this.relativePoint = relativePoint;
38273
38292
  if (relativePoint.y <= 0) {
38274
38293
  this.edge = "top";
38275
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
38294
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
38276
38295
  this.edge = "bottom";
38277
38296
  } else if (relativePoint.x <= 0) {
38278
38297
  this.edge = "left";
38279
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
38298
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
38280
38299
  this.edge = "right";
38281
38300
  }
38282
38301
  this.recalculatePoint();
@@ -38307,17 +38326,17 @@ class FixedPoint extends Point {
38307
38326
  relativePoint;
38308
38327
  pointType = "Fixed";
38309
38328
  edge;
38310
- constructor(item2, relativePoint) {
38329
+ constructor(item, relativePoint) {
38311
38330
  super();
38312
- this.item = item2;
38331
+ this.item = item;
38313
38332
  this.relativePoint = relativePoint;
38314
38333
  if (relativePoint.y <= 0) {
38315
38334
  this.edge = "top";
38316
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
38335
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
38317
38336
  this.edge = "bottom";
38318
38337
  } else if (relativePoint.x <= 0) {
38319
38338
  this.edge = "left";
38320
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
38339
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
38321
38340
  this.edge = "right";
38322
38341
  }
38323
38342
  this.recalculatePoint();
@@ -38348,16 +38367,16 @@ class FixedConnectorPoint extends Point {
38348
38367
  tangent;
38349
38368
  segmentIndex;
38350
38369
  pointType = "FixedConnector";
38351
- constructor(item2, tangent, segmentIndex) {
38370
+ constructor(item, tangent, segmentIndex) {
38352
38371
  super();
38353
- this.item = item2;
38372
+ this.item = item;
38354
38373
  this.tangent = tangent;
38355
38374
  this.segmentIndex = segmentIndex;
38356
38375
  this.recalculatePoint();
38357
38376
  }
38358
38377
  recalculatePoint() {
38359
- const item2 = this.item;
38360
- const segments = item2.getPaths().getSegments();
38378
+ const item = this.item;
38379
+ const segments = item.getPaths().getSegments();
38361
38380
  const segment = segments.length > this.segmentIndex ? segments[this.segmentIndex] : segments[segments.length - 1];
38362
38381
  const point5 = segment.getPoint(this.tangent);
38363
38382
  this.x = point5.x;
@@ -38382,38 +38401,38 @@ function getControlPoint(data, findItem2) {
38382
38401
  if (data.pointType === "Board") {
38383
38402
  return new BoardPoint(Math.round(data.x), Math.round(data.y));
38384
38403
  } else {
38385
- const item2 = findItem2(data.itemId);
38386
- if (!item2) {
38404
+ const item = findItem2(data.itemId);
38405
+ if (!item) {
38387
38406
  console.warn(`getControlPoint(): item not found for ${data.itemId}`);
38388
38407
  return new BoardPoint(0, 0);
38389
38408
  }
38390
38409
  switch (data.pointType) {
38391
38410
  case "FixedConnector":
38392
- if (item2 instanceof Connector2) {
38393
- return new FixedConnectorPoint(item2, data.tangent, data.segment);
38411
+ if (item instanceof Connector2) {
38412
+ return new FixedConnectorPoint(item, data.tangent, data.segment);
38394
38413
  } else {
38395
38414
  throw new Error(`getControlPoint(): item must be a connector`);
38396
38415
  }
38397
38416
  case "Floating":
38398
- return new FloatingPoint(item2, new Point(data.relativeX, data.relativeY));
38417
+ return new FloatingPoint(item, new Point(data.relativeX, data.relativeY));
38399
38418
  case "Fixed":
38400
- return new FixedPoint(item2, new Point(data.relativeX, data.relativeY));
38419
+ return new FixedPoint(item, new Point(data.relativeX, data.relativeY));
38401
38420
  }
38402
38421
  }
38403
38422
  }
38404
- function toRelativePoint(point5, item2) {
38405
- const matrix = item2.transformation?.matrix || new Matrix2;
38423
+ function toRelativePoint(point5, item) {
38424
+ const matrix = item.transformation?.matrix || new Matrix2;
38406
38425
  const inverse = matrix.getInverse();
38407
38426
  point5 = point5.copy();
38408
38427
  point5.transform(inverse);
38409
38428
  return point5;
38410
38429
  }
38411
- function fromRelativePoint(relativePoint, item2, edge) {
38412
- const matrix = item2.transformation?.matrix.copy() || new Matrix2;
38430
+ function fromRelativePoint(relativePoint, item, edge) {
38431
+ const matrix = item.transformation?.matrix.copy() || new Matrix2;
38413
38432
  const point5 = relativePoint.copy();
38414
38433
  point5.transform(matrix);
38415
- if (item2 instanceof RichText || item2 instanceof AINode) {
38416
- const itemMbr = item2.getMbr();
38434
+ if (item instanceof RichText || item instanceof AINode) {
38435
+ const itemMbr = item.getMbr();
38417
38436
  const { x: centerX, y: centerY } = itemMbr.getCenter();
38418
38437
  switch (edge) {
38419
38438
  case "left":
@@ -38425,7 +38444,7 @@ function fromRelativePoint(relativePoint, item2, edge) {
38425
38444
  case "bottom":
38426
38445
  return new Point(centerX, itemMbr.bottom);
38427
38446
  default:
38428
- return item2.getMbr().getClosestEdgeCenterPoint(point5);
38447
+ return item.getMbr().getClosestEdgeCenterPoint(point5);
38429
38448
  }
38430
38449
  }
38431
38450
  return point5;
@@ -39774,7 +39793,7 @@ class Connector2 extends BaseItem {
39774
39793
  return this;
39775
39794
  }
39776
39795
  getConnectorById(items, connectorId) {
39777
- return items.find((item2) => item2 instanceof Connector2 && item2.getId() === connectorId);
39796
+ return items.find((item) => item instanceof Connector2 && item.getId() === connectorId);
39778
39797
  }
39779
39798
  updateTitle() {
39780
39799
  const selection = this.board.selection;
@@ -42411,8 +42430,8 @@ async function exportBoardSnapshot({
42411
42430
  context.matrix.applyToContext(context.ctx);
42412
42431
  const { left, top, right, bottom } = selection;
42413
42432
  const inView = board.items.index.getRectsEnclosedOrCrossed(left, top, right, bottom);
42414
- for (const item2 of inView) {
42415
- item2.render(context);
42433
+ for (const item of inView) {
42434
+ item.render(context);
42416
42435
  }
42417
42436
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
42418
42437
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -42610,7 +42629,7 @@ class Frame2 extends BaseItem {
42610
42629
  return this.id;
42611
42630
  }
42612
42631
  getChildrenIds() {
42613
- return this.index?.list().map((item2) => item2.getId()) || [];
42632
+ return this.index?.list().map((item) => item.getId()) || [];
42614
42633
  }
42615
42634
  updateMbr() {
42616
42635
  const rect = this.path.getMbr().copy();
@@ -42845,11 +42864,11 @@ class Frame2 extends BaseItem {
42845
42864
  }
42846
42865
  });
42847
42866
  const currMbr = this.getMbr();
42848
- this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item2) => {
42849
- if (item2.parent === "Board") {
42850
- if (this.handleNesting(item2)) {
42851
- this.applyAddChildren([item2.getId()]);
42852
- item2.parent = this.getId();
42867
+ this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
42868
+ if (item.parent === "Board") {
42869
+ if (this.handleNesting(item)) {
42870
+ this.applyAddChildren([item.getId()]);
42871
+ item.parent = this.getId();
42853
42872
  }
42854
42873
  }
42855
42874
  });
@@ -45047,9 +45066,9 @@ class Group extends BaseItem {
45047
45066
  if (data.children) {
45048
45067
  data.children.forEach((childId) => {
45049
45068
  this.applyAddChild(childId);
45050
- const item2 = this.board.items.getById(childId);
45051
- if (item2) {
45052
- item2.parent = this.getId();
45069
+ const item = this.board.items.getById(childId);
45070
+ if (item) {
45071
+ item.parent = this.getId();
45053
45072
  }
45054
45073
  });
45055
45074
  }
@@ -45079,11 +45098,11 @@ class Group extends BaseItem {
45079
45098
  let right = Number.MIN_SAFE_INTEGER;
45080
45099
  let bottom = Number.MIN_SAFE_INTEGER;
45081
45100
  const mbrs = this.children.flatMap((childId) => {
45082
- const item2 = this.board.items.getById(childId);
45083
- if (!item2) {
45101
+ const item = this.board.items.getById(childId);
45102
+ if (!item) {
45084
45103
  return [];
45085
45104
  }
45086
- const mbr2 = item2.getMbr();
45105
+ const mbr2 = item.getMbr();
45087
45106
  if (!mbr2) {
45088
45107
  return [];
45089
45108
  }
@@ -45118,7 +45137,7 @@ class Group extends BaseItem {
45118
45137
  return this.children;
45119
45138
  }
45120
45139
  getChildren() {
45121
- return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item2) => item2 !== undefined);
45140
+ return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item) => item !== undefined);
45122
45141
  }
45123
45142
  updateMbr() {
45124
45143
  const rect = this.getMbr();
@@ -45131,9 +45150,9 @@ class Group extends BaseItem {
45131
45150
  setChildren(items) {
45132
45151
  items.forEach((itemId) => {
45133
45152
  this.addChild(itemId);
45134
- const item2 = this.board.items.getById(itemId);
45135
- if (item2) {
45136
- item2.parent = this.getId();
45153
+ const item = this.board.items.getById(itemId);
45154
+ if (item) {
45155
+ item.parent = this.getId();
45137
45156
  }
45138
45157
  });
45139
45158
  this.updateMbr();
@@ -45141,9 +45160,9 @@ class Group extends BaseItem {
45141
45160
  removeChildren() {
45142
45161
  this.children.forEach((itemId) => {
45143
45162
  this.removeChild(itemId);
45144
- const item2 = this.board.items.getById(itemId);
45145
- if (item2) {
45146
- item2.parent = this.parent;
45163
+ const item = this.board.items.getById(itemId);
45164
+ if (item) {
45165
+ item.parent = this.parent;
45147
45166
  }
45148
45167
  });
45149
45168
  this.updateMbr();
@@ -45476,16 +45495,16 @@ class Anchor extends Mbr {
45476
45495
  }
45477
45496
  }
45478
45497
  // src/Items/Connector/ConnectorSnap.ts
45479
- function getFixedPoint(item2, point5) {
45480
- if (item2 instanceof Connector2) {
45481
- const nearestSegmentData = item2.getPaths().getNearestEdgeAndPointTo(point5);
45498
+ function getFixedPoint(item, point5) {
45499
+ if (item instanceof Connector2) {
45500
+ const nearestSegmentData = item.getPaths().getNearestEdgeAndPointTo(point5);
45482
45501
  const segment = nearestSegmentData.segment;
45483
45502
  const index2 = nearestSegmentData.index;
45484
45503
  const tangent = segment.getParameter(point5);
45485
- return new FixedConnectorPoint(item2, tangent, index2);
45504
+ return new FixedConnectorPoint(item, tangent, index2);
45486
45505
  } else {
45487
- const relativePoint = toRelativePoint(point5, item2);
45488
- return new FixedPoint(item2, relativePoint);
45506
+ const relativePoint = toRelativePoint(point5, item);
45507
+ return new FixedPoint(item, relativePoint);
45489
45508
  }
45490
45509
  }
45491
45510
 
@@ -45538,20 +45557,20 @@ class ConnectorSnap {
45538
45557
  }
45539
45558
  this.setSnap();
45540
45559
  const pointer = this.board.pointer.point;
45541
- const { anchor, item: item2, point: point5 } = this.snap;
45542
- if (!item2) {
45560
+ const { anchor, item, point: point5 } = this.snap;
45561
+ if (!item) {
45543
45562
  const pointer2 = this.board.pointer.point;
45544
45563
  this.controlPoint = new BoardPoint(pointer2.x, pointer2.y);
45545
45564
  } else if (anchor) {
45546
- this.controlPoint = getFixedPoint(item2, anchor.getCenter());
45565
+ this.controlPoint = getFixedPoint(item, anchor.getCenter());
45547
45566
  } else if (point5) {
45548
- const nearest2 = item2.getNearestEdgePointTo(pointer);
45549
- this.controlPoint = getFixedPoint(item2, nearest2);
45567
+ const nearest2 = item.getNearestEdgePointTo(pointer);
45568
+ this.controlPoint = getFixedPoint(item, nearest2);
45550
45569
  } else {
45551
45570
  if (this.hover.isTimeoutElapsed) {
45552
- this.controlPoint = getFixedPoint(item2, pointer);
45571
+ this.controlPoint = getFixedPoint(item, pointer);
45553
45572
  } else {
45554
- this.controlPoint = getFixedPoint(item2, pointer);
45573
+ this.controlPoint = getFixedPoint(item, pointer);
45555
45574
  }
45556
45575
  }
45557
45576
  }
@@ -45612,23 +45631,23 @@ class ConnectorSnap {
45612
45631
  }
45613
45632
  return nearest;
45614
45633
  }
45615
- getClosestPointOnItem(item2, position4) {
45616
- const nearestEdgePoint = item2.getNearestEdgePointTo(position4);
45617
- return getFixedPoint(item2, nearestEdgePoint);
45634
+ getClosestPointOnItem(item, position4) {
45635
+ const nearestEdgePoint = item.getNearestEdgePointTo(position4);
45636
+ return getFixedPoint(item, nearestEdgePoint);
45618
45637
  }
45619
- isNearBorder(item2) {
45620
- if (!item2) {
45638
+ isNearBorder(item) {
45639
+ if (!item) {
45621
45640
  return false;
45622
45641
  }
45623
45642
  const pointer = this.board.pointer.point;
45624
- const point5 = item2.getNearestEdgePointTo(pointer);
45643
+ const point5 = item.getNearestEdgePointTo(pointer);
45625
45644
  const distance = pointer.getDistance(point5);
45626
45645
  return distance < this.distance.border / this.board.camera.getScale();
45627
45646
  }
45628
45647
  setSnap() {
45629
- const item2 = this.snap.item;
45630
- const path2 = item2 && "getPath" in item2 ? item2?.getPath() : null;
45631
- if (!item2 || !path2) {
45648
+ const item = this.snap.item;
45649
+ const path2 = item && "getPath" in item ? item?.getPath() : null;
45650
+ if (!item || !path2) {
45632
45651
  this.snap.path = null;
45633
45652
  this.snap.anchors = [];
45634
45653
  this.snap.anchor = null;
@@ -45639,11 +45658,11 @@ class ConnectorSnap {
45639
45658
  if (this.snap.item === this.hover.item && !this.hover.isTimeoutElapsed) {
45640
45659
  path2.setBackgroundColor(this.color.snapBackgroundHighlight);
45641
45660
  }
45642
- this.setAnchors(item2);
45661
+ this.setAnchors(item);
45643
45662
  }
45644
45663
  }
45645
- setAnchors(item2) {
45646
- const points = item2.getSnapAnchorPoints();
45664
+ setAnchors(item) {
45665
+ const points = item.getSnapAnchorPoints();
45647
45666
  if (!points) {
45648
45667
  return;
45649
45668
  }
@@ -45677,10 +45696,10 @@ class ConnectorSnap {
45677
45696
  }
45678
45697
  setPoint() {
45679
45698
  const pointer = this.board.pointer.point;
45680
- const { item: item2, anchor } = this.snap;
45681
- if (item2) {
45699
+ const { item, anchor } = this.snap;
45700
+ if (item) {
45682
45701
  if (!anchor) {
45683
- const point5 = item2.getNearestEdgePointTo(pointer);
45702
+ const point5 = item.getNearestEdgePointTo(pointer);
45684
45703
  if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
45685
45704
  this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
45686
45705
  } else {
@@ -46053,12 +46072,12 @@ class NestingHighlighter extends Tool {
46053
46072
  this.toHighlight.push({ groupItem, children: array });
46054
46073
  }
46055
46074
  }
46056
- addSingleItem(item2) {
46057
- this.toHighlight.push({ children: [item2] });
46075
+ addSingleItem(item) {
46076
+ this.toHighlight.push({ children: [item] });
46058
46077
  }
46059
- remove(item2) {
46078
+ remove(item) {
46060
46079
  this.toHighlight.forEach((group) => {
46061
- group.children = group.children.filter((child) => child !== item2);
46080
+ group.children = group.children.filter((child) => child !== item);
46062
46081
  });
46063
46082
  this.toHighlight = this.toHighlight.filter((group) => group.children.length > 0);
46064
46083
  }
@@ -46125,7 +46144,7 @@ class AddFrame extends BoardTool {
46125
46144
  this.mbr.borderColor = "blue";
46126
46145
  this.nestingHighlighter.clear();
46127
46146
  const enclosedOrCrossed = this.board.items.getEnclosedOrCrossed(this.mbr.left, this.mbr.top, this.mbr.right, this.mbr.bottom);
46128
- const inside = enclosedOrCrossed.filter((item2) => !(item2 instanceof Frame2) && item2.parent === "Board" && this.mbr.isInside(item2.getMbr().getCenter()));
46147
+ const inside = enclosedOrCrossed.filter((item) => !(item instanceof Frame2) && item.parent === "Board" && this.mbr.isInside(item.getMbr().getCenter()));
46129
46148
  this.nestingHighlighter.add(this.frame, inside);
46130
46149
  this.initTransformation();
46131
46150
  this.board.tools.publish();
@@ -46146,7 +46165,7 @@ class AddFrame extends BoardTool {
46146
46165
  localStorage.setItem("lastFrameScale", JSON.stringify(this.frame.transformation.getScale()));
46147
46166
  }
46148
46167
  const currMbr = this.frame.getMbr();
46149
- 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));
46168
+ 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));
46150
46169
  this.applyAddChildren(frameChildren);
46151
46170
  if (this.shape !== "Custom") {
46152
46171
  this.applyCanChangeRatio(false);
@@ -46162,7 +46181,7 @@ class AddFrame extends BoardTool {
46162
46181
  return true;
46163
46182
  }
46164
46183
  addNextTo() {
46165
- const framesInView = this.board.items.getItemsInView().filter((item2) => item2 instanceof Frame2);
46184
+ const framesInView = this.board.items.getItemsInView().filter((item) => item instanceof Frame2);
46166
46185
  if (framesInView.length === 0) {
46167
46186
  if (this.shape === "Custom") {
46168
46187
  const { x, y } = this.frame.getLastFrameScale();
@@ -46200,7 +46219,7 @@ class AddFrame extends BoardTool {
46200
46219
  this.board.camera.viewRectangle(this.frame.getMbr());
46201
46220
  }
46202
46221
  const frameMbr = this.frame.getMbr();
46203
- 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]));
46222
+ 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]));
46204
46223
  const frame = this.board.add(this.frame);
46205
46224
  frame.text.editor.moveCursorToEndOfTheText();
46206
46225
  this.nestingHighlighter.clear();
@@ -46705,13 +46724,13 @@ class Eraser extends BoardTool {
46705
46724
  }
46706
46725
  removeUnderPointOrLine() {
46707
46726
  const segments = this.drawing.getLines();
46708
- const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item2) => {
46709
- return item2.itemType === "Drawing" && item2.getLines().find((line) => {
46710
- return line.getDistance(this.board.pointer.point) <= item2.strokeWidth / 2 + this.strokeWidth / 2;
46727
+ const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item) => {
46728
+ return item.itemType === "Drawing" && item.getLines().find((line) => {
46729
+ return line.getDistance(this.board.pointer.point) <= item.strokeWidth / 2 + this.strokeWidth / 2;
46711
46730
  });
46712
46731
  });
46713
- 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) => {
46714
- return item2.itemType === "Drawing" && item2.getLines().some((line) => {
46732
+ 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) => {
46733
+ return item.itemType === "Drawing" && item.getLines().some((line) => {
46715
46734
  return segments.some((segment) => segment.hasIntersectionPoint(line));
46716
46735
  });
46717
46736
  }));
@@ -47163,20 +47182,20 @@ function createCanvasDrawer(board) {
47163
47182
  context.ctx.setTransform(board2.camera.getMatrix().scaleX, 0, 0, board2.camera.getMatrix().scaleY, 0, 0);
47164
47183
  context.matrix.applyToContext(context.ctx);
47165
47184
  const items = Object.keys(translation).map((id) => {
47166
- const item2 = board2.items.getById(id);
47167
- if (item2) {
47168
- if (item2.itemType !== "Frame") {
47169
- return item2;
47185
+ const item = board2.items.getById(id);
47186
+ if (item) {
47187
+ if (item.itemType !== "Frame") {
47188
+ return item;
47170
47189
  }
47171
- item2.render(context);
47172
- return item2;
47190
+ item.render(context);
47191
+ return item;
47173
47192
  }
47174
47193
  return;
47175
- }).filter((item2) => !!item2);
47176
- items.forEach((item2) => {
47177
- if (item2.itemType !== "Frame") {
47178
- item2.render(context);
47179
- board2.selection.renderItemMbr(context, item2, board2.camera.getMatrix().scaleX);
47194
+ }).filter((item) => !!item);
47195
+ items.forEach((item) => {
47196
+ if (item.itemType !== "Frame") {
47197
+ item.render(context);
47198
+ board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
47180
47199
  }
47181
47200
  });
47182
47201
  return { canvas: container, items };
@@ -47237,10 +47256,10 @@ function createCanvasDrawer(board) {
47237
47256
  if (lastTranslationKeys) {
47238
47257
  board.selection.shouldPublish = false;
47239
47258
  lastTranslationKeys.forEach((id) => {
47240
- const item2 = board.items.getById(id);
47241
- if (item2) {
47242
- item2.transformationRenderBlock = undefined;
47243
- item2.subject.publish(item2);
47259
+ const item = board.items.getById(id);
47260
+ if (item) {
47261
+ item.transformationRenderBlock = undefined;
47262
+ item.subject.publish(item);
47244
47263
  }
47245
47264
  });
47246
47265
  lastTranslationKeys = undefined;
@@ -47272,9 +47291,9 @@ function createCanvasDrawer(board) {
47272
47291
  lastCreatedCanvas = cnvs;
47273
47292
  lastTranslationKeys = Object.keys(translation);
47274
47293
  lastTranslationKeys.forEach((id) => {
47275
- const item2 = board.items.getById(id);
47276
- if (item2) {
47277
- item2.transformationRenderBlock = true;
47294
+ const item = board.items.getById(id);
47295
+ if (item) {
47296
+ item.transformationRenderBlock = true;
47278
47297
  }
47279
47298
  });
47280
47299
  board.selection.transformationRenderBlock = true;
@@ -47284,14 +47303,14 @@ function createCanvasDrawer(board) {
47284
47303
  }
47285
47304
  function countSumMbr(translation) {
47286
47305
  return Object.keys(translation).reduce((mbr, id) => {
47287
- const item2 = board.items.getById(id);
47288
- if (item2) {
47306
+ const item = board.items.getById(id);
47307
+ if (item) {
47289
47308
  if (!mbr) {
47290
- mbr = item2.getMbr();
47309
+ mbr = item.getMbr();
47291
47310
  } else {
47292
- mbr.combine(item2.getMbr());
47293
- if (item2.itemType === "Frame") {
47294
- mbr.combine(item2.getRichText().getMbr());
47311
+ mbr.combine(item.getMbr());
47312
+ if (item.itemType === "Frame") {
47313
+ mbr.combine(item.getRichText().getMbr());
47295
47314
  }
47296
47315
  }
47297
47316
  }
@@ -47322,8 +47341,8 @@ function createCanvasDrawer(board) {
47322
47341
  }
47323
47342
  function highlightNesting() {
47324
47343
  const container = getLastCreatedCanvas();
47325
- const drawnItemsMap = drawnItems?.reduce((acc, item2) => {
47326
- acc.set(item2.getId(), { item: item2, mbr: item2.getMbr() });
47344
+ const drawnItemsMap = drawnItems?.reduce((acc, item) => {
47345
+ acc.set(item.getId(), { item, mbr: item.getMbr() });
47327
47346
  return acc;
47328
47347
  }, new Map);
47329
47348
  if (!container || !drawnItems) {
@@ -47358,11 +47377,11 @@ function createCanvasDrawer(board) {
47358
47377
  mbr.transform(currMatrix);
47359
47378
  });
47360
47379
  groups.forEach((group) => {
47361
- drawnItemsMap?.forEach(({ mbr, item: item2 }, key) => {
47362
- if ("canBeNested" in item2 && !item2.canBeNested) {
47380
+ drawnItemsMap?.forEach(({ mbr, item }, key) => {
47381
+ if ("canBeNested" in item && !item.canBeNested) {
47363
47382
  return;
47364
47383
  }
47365
- if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item2.parent !== group.getId()) && group.handleNesting(mbr)) {
47384
+ if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item.parent !== group.getId()) && group.handleNesting(mbr)) {
47366
47385
  const div = createBorderDivForItem(mbr, lastCreatedCanvas);
47367
47386
  removeHighlighted(key);
47368
47387
  highlightedDivs.set(key, div);
@@ -47423,10 +47442,10 @@ function createCanvasDrawer(board) {
47423
47442
  }
47424
47443
 
47425
47444
  // src/Selection/QuickAddButtons/quickAddHelpers.ts
47426
- function getControlPointData(item2, index2, isRichText = false) {
47427
- const itemScale = isRichText ? { x: 1, y: 1 } : item2.transformation.getScale();
47428
- const width2 = item2.getPathMbr().getWidth();
47429
- let height3 = item2.getPathMbr().getHeight();
47445
+ function getControlPointData(item, index2, isRichText = false) {
47446
+ const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
47447
+ const width2 = item.getPathMbr().getWidth();
47448
+ let height3 = item.getPathMbr().getHeight();
47430
47449
  const adjMapScaled = {
47431
47450
  0: { x: 0, y: height3 / 2 / itemScale.y },
47432
47451
  1: {
@@ -47441,7 +47460,7 @@ function getControlPointData(item2, index2, isRichText = false) {
47441
47460
  };
47442
47461
  return {
47443
47462
  pointType: "Fixed",
47444
- itemId: item2.getId(),
47463
+ itemId: item.getId(),
47445
47464
  relativeX: adjMapScaled[index2].x,
47446
47465
  relativeY: adjMapScaled[index2].y
47447
47466
  };
@@ -47576,10 +47595,10 @@ function getQuickAddButtons(selection, board) {
47576
47595
  let newHeight = height3;
47577
47596
  let itemData;
47578
47597
  if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
47579
- const item2 = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
47580
- newWidth = item2.getMbr().getWidth();
47581
- newHeight = item2.getMbr().getHeight();
47582
- itemData = item2.serialize();
47598
+ const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
47599
+ newWidth = item.getMbr().getWidth();
47600
+ newHeight = item.getMbr().getHeight();
47601
+ itemData = item.serialize();
47583
47602
  const { minX, minY, maxY, maxX } = offsets;
47584
47603
  offsetX = Math.min(offsetX, maxX);
47585
47604
  offsetX = Math.max(offsetX, minX);
@@ -47612,7 +47631,7 @@ function getQuickAddButtons(selection, board) {
47612
47631
  }
47613
47632
  const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
47614
47633
  let step = 1;
47615
- while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item2) => item2.itemType !== "Connector").length > 0) {
47634
+ while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
47616
47635
  const xDirection = step % 2 === 0 ? -1 : 1;
47617
47636
  const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
47618
47637
  newMbr.transform(new Matrix2(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
@@ -47745,7 +47764,7 @@ function getQuickAddButtons(selection, board) {
47745
47764
  clear();
47746
47765
  return;
47747
47766
  }
47748
- const { positions, item: item2 } = position4;
47767
+ const { positions, item } = position4;
47749
47768
  const cameraMatrix = board.camera.getMatrix();
47750
47769
  const cameraMbr = board.camera.getMbr();
47751
47770
  const positionAdjustments = {
@@ -47773,7 +47792,7 @@ function getQuickAddButtons(selection, board) {
47773
47792
  };
47774
47793
  const button = document.createElement("button");
47775
47794
  button.classList.add("microboard-quickAddButton");
47776
- if (item2.itemType === "AINode" && index2 === 2) {
47795
+ if (item.itemType === "AINode" && index2 === 2) {
47777
47796
  button.classList.add("microboard-invisible");
47778
47797
  }
47779
47798
  button.classList.add(`microboard-${adjustment.rotate}`);
@@ -47789,7 +47808,7 @@ function getQuickAddButtons(selection, board) {
47789
47808
  clearTimeout(timeoutId);
47790
47809
  }
47791
47810
  if (button.isMouseDown) {
47792
- board.tools.addConnector(true, item2, pos);
47811
+ board.tools.addConnector(true, item, pos);
47793
47812
  } else {
47794
47813
  quickAddItems = undefined;
47795
47814
  selection.subject.publish(selection);
@@ -47896,11 +47915,11 @@ class AlignmentHelper {
47896
47915
  return baseThickness / (zoom / 100);
47897
47916
  }
47898
47917
  combineMBRs(items) {
47899
- return items.reduce((acc, item2, i) => {
47918
+ return items.reduce((acc, item, i) => {
47900
47919
  if (i === 0) {
47901
47920
  return acc;
47902
47921
  }
47903
- const itemMbr = item2.getPathMbr();
47922
+ const itemMbr = item.getPathMbr();
47904
47923
  return acc.combine(itemMbr);
47905
47924
  }, items[0].getMbr());
47906
47925
  }
@@ -47914,7 +47933,7 @@ class AlignmentHelper {
47914
47933
  const scale = this.board.camera.getScale();
47915
47934
  const dynamicAlignThreshold = Math.min(this.alignThreshold / scale, 8);
47916
47935
  const childrenIds = "index" in movingItem && movingItem.index ? movingItem.getChildrenIds() : [];
47917
- 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);
47936
+ 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);
47918
47937
  const verticalAlignments = new Map;
47919
47938
  const horizontalAlignments = new Map;
47920
47939
  const addVerticalAlignment = (x, minY, maxY) => {
@@ -47935,11 +47954,11 @@ class AlignmentHelper {
47935
47954
  horizontalAlignments.set(y, { minX, maxX });
47936
47955
  }
47937
47956
  };
47938
- nearbyItems.forEach((item2) => {
47939
- if (item2 === movingItem || item2.itemType === "Comment") {
47957
+ nearbyItems.forEach((item) => {
47958
+ if (item === movingItem || item.itemType === "Comment") {
47940
47959
  return;
47941
47960
  }
47942
- const itemMbr = item2.itemType === "Shape" ? item2.getPath().getMbr() : item2.getMbr();
47961
+ const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
47943
47962
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
47944
47963
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
47945
47964
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -48206,20 +48225,20 @@ class AlignmentHelper {
48206
48225
  }
48207
48226
  return false;
48208
48227
  }
48209
- translateItems(item2, x, y, timeStamp) {
48228
+ translateItems(item, x, y, timeStamp) {
48210
48229
  if (this.canvasDrawer.getLastCreatedCanvas()) {
48211
48230
  return;
48212
48231
  }
48213
- if (Array.isArray(item2)) {
48232
+ if (Array.isArray(item)) {
48214
48233
  const translation = this.board.selection.getManyItemsTranslation(x, y);
48215
48234
  this.board.selection.transformMany(translation, timeStamp);
48216
48235
  return;
48217
48236
  }
48218
- if (item2.itemType === "Frame") {
48237
+ if (item.itemType === "Frame") {
48219
48238
  const translation = this.board.selection.getManyItemsTranslation(x, y);
48220
48239
  this.board.selection.transformMany(translation, timeStamp);
48221
48240
  } else {
48222
- const id = item2.getId();
48241
+ const id = item.getId();
48223
48242
  const transformMap = {};
48224
48243
  transformMap[id] = {
48225
48244
  class: "Transformation",
@@ -48347,12 +48366,12 @@ class Select extends Tool {
48347
48366
  this.debounceUpd.setFalse();
48348
48367
  this.snapLines = { verticalLines: [], horizontalLines: [] };
48349
48368
  }
48350
- handleSnapping(item2) {
48369
+ handleSnapping(item) {
48351
48370
  if (this.board.keyboard.isShift) {
48352
48371
  return false;
48353
48372
  }
48354
- const increasedSnapThreshold = Array.isArray(item2) ? 40 : 35;
48355
- this.isSnapped = this.alignmentHelper.snapToClosestLine(item2, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
48373
+ const increasedSnapThreshold = Array.isArray(item) ? 40 : 35;
48374
+ this.isSnapped = this.alignmentHelper.snapToClosestLine(item, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
48356
48375
  if (this.isSnapped) {
48357
48376
  if (!this.snapCursorPos) {
48358
48377
  this.snapCursorPos = new Point(this.board.pointer.point.x, this.board.pointer.point.y);
@@ -48362,10 +48381,10 @@ class Select extends Tool {
48362
48381
  if ((cursorDiffX > increasedSnapThreshold || cursorDiffY > increasedSnapThreshold) && this.initialCursorPos) {
48363
48382
  this.isSnapped = false;
48364
48383
  this.snapCursorPos = null;
48365
- const itemCenter = Array.isArray(item2) ? this.alignmentHelper.combineMBRs(item2).getCenter() : item2.getMbr().getCenter();
48384
+ const itemCenter = Array.isArray(item) ? this.alignmentHelper.combineMBRs(item).getCenter() : item.getMbr().getCenter();
48366
48385
  const translateX = this.board.pointer.point.x - this.initialCursorPos.x - itemCenter.x;
48367
48386
  const translateY = this.board.pointer.point.y - this.initialCursorPos.y - itemCenter.y;
48368
- this.alignmentHelper.translateItems(item2, translateX, translateY, this.beginTimeStamp);
48387
+ this.alignmentHelper.translateItems(item, translateX, translateY, this.beginTimeStamp);
48369
48388
  }
48370
48389
  }
48371
48390
  return false;
@@ -48415,10 +48434,10 @@ class Select extends Tool {
48415
48434
  angleDiff = angleDiff < 0 ? angleDiff + 360 : angleDiff;
48416
48435
  return Math.min(angleDiff, 360 - angleDiff);
48417
48436
  }
48418
- handleShiftGuidelines(item2, mousePosition) {
48419
- if (item2) {
48437
+ handleShiftGuidelines(item, mousePosition) {
48438
+ if (item) {
48420
48439
  if (!this.originalCenter) {
48421
- this.originalCenter = Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().copy() : item2.getMbr().getCenter().copy();
48440
+ this.originalCenter = Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().copy() : item.getMbr().getCenter().copy();
48422
48441
  this.guidelines = this.alignmentHelper.generateGuidelines(this.originalCenter).lines;
48423
48442
  }
48424
48443
  this.mainLine = new Line(this.originalCenter, mousePosition);
@@ -48439,13 +48458,13 @@ class Select extends Tool {
48439
48458
  const newEndX = this.originalCenter.x + snapDirectionX * mainLineLength;
48440
48459
  const newEndY = this.originalCenter.y + snapDirectionY * mainLineLength;
48441
48460
  const threshold = Infinity;
48442
- const translateX = newEndX - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().x : item2.getMbr().getCenter().x);
48443
- const translateY = newEndY - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().y : item2.getMbr().getCenter().y);
48444
- if (Array.isArray(item2)) {
48461
+ const translateX = newEndX - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().x : item.getMbr().getCenter().x);
48462
+ const translateY = newEndY - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().y : item.getMbr().getCenter().y);
48463
+ if (Array.isArray(item)) {
48445
48464
  const translation = this.board.selection.getManyItemsTranslation(translateX, translateY);
48446
48465
  this.board.selection.transformMany(translation, this.beginTimeStamp);
48447
48466
  } else {
48448
- item2.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
48467
+ item.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
48449
48468
  }
48450
48469
  }
48451
48470
  }
@@ -48488,7 +48507,7 @@ class Select extends Tool {
48488
48507
  return false;
48489
48508
  }
48490
48509
  this.isDownOnBoard = hover.length === 0;
48491
- this.isDrawingRectangle = hover.filter((item2) => !(item2 instanceof Frame2)).length === 0 && hover.filter((item2) => item2 instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
48510
+ this.isDrawingRectangle = hover.filter((item) => !(item instanceof Frame2)).length === 0 && hover.filter((item) => item instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
48492
48511
  if (this.isDrawingRectangle) {
48493
48512
  const { x, y } = pointer.point;
48494
48513
  this.line = new Line(new Point(x, y), new Point(x, y));
@@ -48508,7 +48527,7 @@ class Select extends Tool {
48508
48527
  });
48509
48528
  return false;
48510
48529
  }
48511
- const isHoverLocked = hover.every((item2) => item2.transformation.isLocked);
48530
+ const isHoverLocked = hover.every((item) => item.transformation.isLocked);
48512
48531
  if (isHoverLocked) {
48513
48532
  return false;
48514
48533
  }
@@ -48642,7 +48661,7 @@ class Select extends Tool {
48642
48661
  const translation = selection.getManyItemsTranslation(x, y);
48643
48662
  const translationKeys = Object.keys(translation);
48644
48663
  const commentsSet = new Set(this.board.items.getComments().map((comment2) => comment2.getId()));
48645
- if (translationKeys.filter((item2) => !commentsSet.has(item2)).length > 10) {
48664
+ if (translationKeys.filter((item) => !commentsSet.has(item)).length > 10) {
48646
48665
  const selectedMbr = this.board.selection.getMbr()?.copy();
48647
48666
  const sumMbr = this.canvasDrawer.countSumMbr(translation);
48648
48667
  if (sumMbr) {
@@ -48669,7 +48688,7 @@ class Select extends Tool {
48669
48688
  return false;
48670
48689
  }
48671
48690
  const draggingMbr = draggingItem.getMbr();
48672
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item2) => item2 instanceof Frame2);
48691
+ const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
48673
48692
  frames.forEach((frame) => {
48674
48693
  if (frame.handleNesting(draggingItem)) {
48675
48694
  this.nestingHighlighter.add(frame, draggingItem);
@@ -48679,7 +48698,7 @@ class Select extends Tool {
48679
48698
  });
48680
48699
  }
48681
48700
  const hover = items.getUnderPointer();
48682
- this.isHoverUnselectedItem = hover.filter((item2) => item2.itemType === "Placeholder").length === 1;
48701
+ this.isHoverUnselectedItem = hover.filter((item) => item.itemType === "Placeholder").length === 1;
48683
48702
  if (this.isHoverUnselectedItem && !this.isDraggingUnselectedItem && selection.getContext() === "None") {
48684
48703
  selection.setContext("HoverUnderPointer");
48685
48704
  return false;
@@ -48723,15 +48742,15 @@ class Select extends Tool {
48723
48742
  }
48724
48743
  }
48725
48744
  updateFramesNesting(selectionMbr, selection) {
48726
- 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));
48727
- const draggingFramesIds = selection.list().filter((item2) => item2 instanceof Frame2).map((frame) => frame.getId());
48728
- selection.list().forEach((item2) => {
48729
- if (!(item2 instanceof Frame2) && !draggingFramesIds.includes(item2.parent)) {
48745
+ 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));
48746
+ const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
48747
+ selection.list().forEach((item) => {
48748
+ if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
48730
48749
  frames.forEach((frame) => {
48731
- if (frame.handleNesting(item2)) {
48732
- this.nestingHighlighter.add(frame, item2);
48750
+ if (frame.handleNesting(item)) {
48751
+ this.nestingHighlighter.add(frame, item);
48733
48752
  } else {
48734
- this.nestingHighlighter.remove(item2);
48753
+ this.nestingHighlighter.remove(item);
48735
48754
  }
48736
48755
  });
48737
48756
  }
@@ -48823,7 +48842,7 @@ class Select extends Tool {
48823
48842
  const childrenIds = underPointer.getChildrenIds();
48824
48843
  console.log("UNDERPOINTER", underPointer);
48825
48844
  console.log("CHILDREN", childrenIds);
48826
- const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => childrenIds && childrenIds.includes(item2.getId()));
48845
+ const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
48827
48846
  this.board.selection.add(itemsInFrame);
48828
48847
  }
48829
48848
  this.board.selection.setContext("EditUnderPointer");
@@ -49063,8 +49082,8 @@ class ShapeTool extends CustomTool {
49063
49082
  resizeType = "leftBottom";
49064
49083
  bounds = new Mbr;
49065
49084
  isDown = false;
49066
- constructor(board, name, item2, settings) {
49067
- super(board, name, item2);
49085
+ constructor(board, name, item, settings) {
49086
+ super(board, name, item);
49068
49087
  this.settings = settings;
49069
49088
  this.setCursor();
49070
49089
  }
@@ -49147,8 +49166,8 @@ class ShapeTool extends CustomTool {
49147
49166
 
49148
49167
  class StickerTool extends CustomTool {
49149
49168
  settings;
49150
- constructor(board, name, item2, settings) {
49151
- super(board, name, item2);
49169
+ constructor(board, name, item, settings) {
49170
+ super(board, name, item);
49152
49171
  this.settings = settings;
49153
49172
  this.setCursor();
49154
49173
  }
@@ -49454,7 +49473,7 @@ class Tools extends ToolContext {
49454
49473
  this.subject.publish(this);
49455
49474
  }
49456
49475
  sortFrames() {
49457
- const frames = this.board.items.listAll().filter((item2) => item2 instanceof Frame2);
49476
+ const frames = this.board.items.listAll().filter((item) => item instanceof Frame2);
49458
49477
  const sortedFrames = frames.sort((fr1, fr2) => {
49459
49478
  const mbr1 = fr1.getMbr();
49460
49479
  const mbr2 = fr2.getMbr();
@@ -49680,24 +49699,24 @@ function validateGroupData(groupData) {
49680
49699
  }
49681
49700
  // src/Items/RegisterItem.ts
49682
49701
  function registerItem({
49683
- item: item2,
49702
+ item,
49684
49703
  defaultData: defaultData2,
49685
49704
  toolData
49686
49705
  }) {
49687
49706
  const { itemType } = defaultData2;
49688
- itemFactories[itemType] = createItemFactory(item2, defaultData2);
49707
+ itemFactories[itemType] = createItemFactory(item, defaultData2);
49689
49708
  itemValidators[itemType] = createItemValidator(defaultData2);
49690
49709
  if (toolData) {
49691
49710
  registeredTools[toolData.name] = toolData.tool;
49692
49711
  }
49693
49712
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
49694
49713
  }
49695
- function createItemFactory(item2, defaultData2) {
49714
+ function createItemFactory(item, defaultData2) {
49696
49715
  return function itemFactory(id, data, board) {
49697
49716
  if (data.itemType !== defaultData2.itemType) {
49698
49717
  throw new Error(`Invalid data for ${defaultData2.itemType}`);
49699
49718
  }
49700
- return new item2(board, id, defaultData2).setId(id).deserialize(data);
49719
+ return new item(board, id, defaultData2).setId(id).deserialize(data);
49701
49720
  };
49702
49721
  }
49703
49722
  function createItemValidator(defaultData2) {
@@ -49712,7 +49731,7 @@ function createItemValidator(defaultData2) {
49712
49731
  }
49713
49732
  function createItemCommandFactory(itemType) {
49714
49733
  return function itemCommandFactory(items, operation) {
49715
- return new BaseCommand(items.filter((item2) => item2.itemType === itemType), operation);
49734
+ return new BaseCommand(items.filter((item) => item.itemType === itemType), operation);
49716
49735
  };
49717
49736
  }
49718
49737
  // src/Items/Examples/Star/AddStar.ts
@@ -50737,8 +50756,8 @@ class Camera {
50737
50756
  this.observableItem = null;
50738
50757
  }
50739
50758
  }
50740
- subscribeToItem(item2) {
50741
- this.observableItem = item2;
50759
+ subscribeToItem(item) {
50760
+ this.observableItem = item;
50742
50761
  this.observableItem.subject.subscribe(this.observeItem);
50743
50762
  }
50744
50763
  observeItem = () => {
@@ -50964,7 +50983,7 @@ class Camera {
50964
50983
  }
50965
50984
  addToView(mbr, inView) {
50966
50985
  if (!mbr.isEnclosedBy(this.getMbr())) {
50967
- this.viewRectangle(inView.reduce((acc, item2) => acc.combine(item2.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
50986
+ this.viewRectangle(inView.reduce((acc, item) => acc.combine(item.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
50968
50987
  }
50969
50988
  }
50970
50989
  viewRectangle(mbr, offsetInPercent = 10, duration = 500) {
@@ -52573,8 +52592,8 @@ class Presence {
52573
52592
  <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}"/>
52574
52593
  </svg>`;
52575
52594
  }
52576
- renderItemMbr(context, item2, color2, customScale) {
52577
- const mbr = item2.getMbr();
52595
+ renderItemMbr(context, item, color2, customScale) {
52596
+ const mbr = item.getMbr();
52578
52597
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
52579
52598
  mbr.borderColor = color2;
52580
52599
  mbr.render(context);
@@ -52714,8 +52733,8 @@ class Presence {
52714
52733
  selectionMbr.strokeWidth = 1 / context.matrix.scaleX;
52715
52734
  selectionMbr.borderColor = selection.color;
52716
52735
  selectionMbr.render(context);
52717
- for (const item2 of selection.selection) {
52718
- this.renderItemMbr(context, item2, selection.color);
52736
+ for (const item of selection.selection) {
52737
+ this.renderItemMbr(context, item, selection.color);
52719
52738
  }
52720
52739
  }
52721
52740
  }
@@ -52748,14 +52767,14 @@ class SelectionItems {
52748
52767
  items = new Map;
52749
52768
  add(value) {
52750
52769
  if (Array.isArray(value)) {
52751
- value.forEach((item2) => this.items.set(item2.getId(), item2));
52770
+ value.forEach((item) => this.items.set(item.getId(), item));
52752
52771
  } else {
52753
52772
  this.items.set(value.getId(), value);
52754
52773
  }
52755
52774
  }
52756
52775
  remove(value) {
52757
52776
  if (Array.isArray(value)) {
52758
- value.forEach((item2) => this.items.delete(item2.getId()));
52777
+ value.forEach((item) => this.items.delete(item.getId()));
52759
52778
  } else {
52760
52779
  this.items.delete(value.getId());
52761
52780
  }
@@ -52785,8 +52804,8 @@ class SelectionItems {
52785
52804
  if (this.isEmpty()) {
52786
52805
  return false;
52787
52806
  }
52788
- for (const item2 of this.items.values()) {
52789
- if (item2.itemType !== "RichText") {
52807
+ for (const item of this.items.values()) {
52808
+ if (item.itemType !== "RichText") {
52790
52809
  return false;
52791
52810
  }
52792
52811
  }
@@ -52796,14 +52815,14 @@ class SelectionItems {
52796
52815
  if (this.isEmpty()) {
52797
52816
  return false;
52798
52817
  }
52799
- return Array.from(this.items).every(([, item2]) => item2.itemType === itemType);
52818
+ return Array.from(this.items).every(([, item]) => item.itemType === itemType);
52800
52819
  }
52801
52820
  isItemTypes(itemTypes) {
52802
52821
  if (this.isEmpty()) {
52803
52822
  return false;
52804
52823
  }
52805
- for (const item2 of this.items.values()) {
52806
- if (!itemTypes.includes(item2.itemType)) {
52824
+ for (const item of this.items.values()) {
52825
+ if (!itemTypes.includes(item.itemType)) {
52807
52826
  return false;
52808
52827
  }
52809
52828
  }
@@ -52811,16 +52830,16 @@ class SelectionItems {
52811
52830
  }
52812
52831
  getItemTypes() {
52813
52832
  const itemTypes = new Set;
52814
- this.items.forEach((item2) => itemTypes.add(item2.itemType));
52833
+ this.items.forEach((item) => itemTypes.add(item.itemType));
52815
52834
  return Array.from(itemTypes);
52816
52835
  }
52817
52836
  getItemsByItemTypes(itemTypes) {
52818
- return Array.from(this.items.values()).filter((item2) => itemTypes.includes(item2.itemType));
52837
+ return Array.from(this.items.values()).filter((item) => itemTypes.includes(item.itemType));
52819
52838
  }
52820
52839
  getIdsByItemTypes(itemTypes) {
52821
52840
  const ids = [];
52822
- this.items.forEach((item2, id) => {
52823
- if (itemTypes.includes(item2.itemType)) {
52841
+ this.items.forEach((item, id) => {
52842
+ if (itemTypes.includes(item.itemType)) {
52824
52843
  ids.push(id);
52825
52844
  }
52826
52845
  });
@@ -52830,7 +52849,7 @@ class SelectionItems {
52830
52849
  return this.isSingle() ? this.items.values().next().value || null : null;
52831
52850
  }
52832
52851
  listByIds(itemIdList) {
52833
- return itemIdList.map((id) => this.items.get(id)).filter((item2) => item2 !== undefined);
52852
+ return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
52834
52853
  }
52835
52854
  ids() {
52836
52855
  return Array.from(this.items.keys());
@@ -52841,7 +52860,7 @@ class SelectionItems {
52841
52860
  return;
52842
52861
  }
52843
52862
  const mbr = items[0].getMbr();
52844
- items.slice(1).forEach((item2) => mbr.combine(item2.getMbr()));
52863
+ items.slice(1).forEach((item) => mbr.combine(item.getMbr()));
52845
52864
  return mbr;
52846
52865
  }
52847
52866
  }
@@ -53046,33 +53065,33 @@ function handleMultipleItemsResize({
53046
53065
  const translation = {};
53047
53066
  const items = itemsToResize ? itemsToResize : board.selection.items.list();
53048
53067
  board.items.getComments().forEach((comment2) => {
53049
- if (items.some((item2) => item2.getId() === comment2.getItemToFollow())) {
53068
+ if (items.some((item) => item.getId() === comment2.getItemToFollow())) {
53050
53069
  items.push(comment2);
53051
53070
  }
53052
53071
  });
53053
- for (const item2 of items) {
53054
- let itemX = item2.getMbr().left;
53055
- let itemY = item2.getMbr().top;
53056
- if (item2.itemType === "Drawing") {
53057
- itemX = item2.transformation.matrix.translateX;
53058
- itemY = item2.transformation.matrix.translateY;
53072
+ for (const item of items) {
53073
+ let itemX = item.getMbr().left;
53074
+ let itemY = item.getMbr().top;
53075
+ if (item.itemType === "Drawing") {
53076
+ itemX = item.transformation.matrix.translateX;
53077
+ itemY = item.transformation.matrix.translateY;
53059
53078
  }
53060
53079
  const deltaX = itemX - initMbr.left;
53061
53080
  const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
53062
53081
  const deltaY = itemY - initMbr.top;
53063
53082
  const translateY = deltaY * matrix.scaleY - deltaY + matrix.translateY;
53064
- if (item2 instanceof RichText) {
53065
- translation[item2.getId()] = getRichTextTranslation({
53066
- item: item2,
53083
+ if (item instanceof RichText) {
53084
+ translation[item.getId()] = getRichTextTranslation({
53085
+ item,
53067
53086
  isWidth,
53068
53087
  isHeight,
53069
53088
  matrix,
53070
53089
  translateX,
53071
53090
  translateY
53072
53091
  });
53073
- } else if (item2 instanceof AINode) {
53074
- translation[item2.getId()] = getAINodeTranslation({
53075
- item: item2,
53092
+ } else if (item instanceof AINode) {
53093
+ translation[item.getId()] = getAINodeTranslation({
53094
+ item,
53076
53095
  isWidth,
53077
53096
  isHeight,
53078
53097
  matrix,
@@ -53080,8 +53099,8 @@ function handleMultipleItemsResize({
53080
53099
  translateY
53081
53100
  });
53082
53101
  } else {
53083
- translation[item2.getId()] = getItemTranslation({
53084
- item: item2,
53102
+ translation[item.getId()] = getItemTranslation({
53103
+ item,
53085
53104
  isWidth,
53086
53105
  isHeight,
53087
53106
  matrix,
@@ -53094,7 +53113,7 @@ function handleMultipleItemsResize({
53094
53113
  return translation;
53095
53114
  }
53096
53115
  function getRichTextTranslation({
53097
- item: item2,
53116
+ item,
53098
53117
  isWidth,
53099
53118
  isHeight,
53100
53119
  matrix,
@@ -53102,11 +53121,11 @@ function getRichTextTranslation({
53102
53121
  translateY
53103
53122
  }) {
53104
53123
  if (isWidth) {
53105
- item2.editor.setMaxWidth(item2.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
53124
+ item.editor.setMaxWidth(item.getWidth() / item.transformation.getScale().x * matrix.scaleX);
53106
53125
  return {
53107
53126
  class: "Transformation",
53108
53127
  method: "scaleByTranslateBy",
53109
- item: [item2.getId()],
53128
+ item: [item.getId()],
53110
53129
  translate: { x: matrix.translateX, y: 0 },
53111
53130
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53112
53131
  };
@@ -53114,7 +53133,7 @@ function getRichTextTranslation({
53114
53133
  return {
53115
53134
  class: "Transformation",
53116
53135
  method: "scaleByTranslateBy",
53117
- item: [item2.getId()],
53136
+ item: [item.getId()],
53118
53137
  translate: { x: translateX, y: translateY },
53119
53138
  scale: { x: 1, y: 1 }
53120
53139
  };
@@ -53122,14 +53141,14 @@ function getRichTextTranslation({
53122
53141
  return {
53123
53142
  class: "Transformation",
53124
53143
  method: "scaleByTranslateBy",
53125
- item: [item2.getId()],
53144
+ item: [item.getId()],
53126
53145
  translate: { x: translateX, y: translateY },
53127
53146
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53128
53147
  };
53129
53148
  }
53130
53149
  }
53131
53150
  function getAINodeTranslation({
53132
- item: item2,
53151
+ item,
53133
53152
  isWidth,
53134
53153
  isHeight,
53135
53154
  matrix,
@@ -53137,11 +53156,11 @@ function getAINodeTranslation({
53137
53156
  translateY
53138
53157
  }) {
53139
53158
  if (isWidth) {
53140
- item2.text.editor.setMaxWidth(item2.text.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
53159
+ item.text.editor.setMaxWidth(item.text.getWidth() / item.transformation.getScale().x * matrix.scaleX);
53141
53160
  return {
53142
53161
  class: "Transformation",
53143
53162
  method: "scaleByTranslateBy",
53144
- item: [item2.getId()],
53163
+ item: [item.getId()],
53145
53164
  translate: { x: matrix.translateX, y: 0 },
53146
53165
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53147
53166
  };
@@ -53149,7 +53168,7 @@ function getAINodeTranslation({
53149
53168
  return {
53150
53169
  class: "Transformation",
53151
53170
  method: "scaleByTranslateBy",
53152
- item: [item2.getId()],
53171
+ item: [item.getId()],
53153
53172
  translate: { x: translateX, y: translateY },
53154
53173
  scale: { x: 1, y: 1 }
53155
53174
  };
@@ -53157,14 +53176,14 @@ function getAINodeTranslation({
53157
53176
  return {
53158
53177
  class: "Transformation",
53159
53178
  method: "scaleByTranslateBy",
53160
- item: [item2.getId()],
53179
+ item: [item.getId()],
53161
53180
  translate: { x: translateX, y: translateY },
53162
53181
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53163
53182
  };
53164
53183
  }
53165
53184
  }
53166
53185
  function getItemTranslation({
53167
- item: item2,
53186
+ item,
53168
53187
  isWidth,
53169
53188
  isHeight,
53170
53189
  matrix,
@@ -53172,22 +53191,22 @@ function getItemTranslation({
53172
53191
  translateY,
53173
53192
  isShiftPressed
53174
53193
  }) {
53175
- if (item2 instanceof Sticker && (isWidth || isHeight)) {
53194
+ if (item instanceof Sticker && (isWidth || isHeight)) {
53176
53195
  return {
53177
53196
  class: "Transformation",
53178
53197
  method: "scaleByTranslateBy",
53179
- item: [item2.getId()],
53198
+ item: [item.getId()],
53180
53199
  translate: { x: translateX, y: translateY },
53181
53200
  scale: { x: 1, y: 1 }
53182
53201
  };
53183
53202
  } else {
53184
- if (item2 instanceof Frame2 && item2.getCanChangeRatio() && isShiftPressed && item2.getFrameType() !== "Custom") {
53185
- item2.setFrameType("Custom");
53203
+ if (item instanceof Frame2 && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
53204
+ item.setFrameType("Custom");
53186
53205
  }
53187
53206
  return {
53188
53207
  class: "Transformation",
53189
53208
  method: "scaleByTranslateBy",
53190
- item: [item2.getId()],
53209
+ item: [item.getId()],
53191
53210
  translate: { x: translateX, y: translateY },
53192
53211
  scale: { x: matrix.scaleX, y: matrix.scaleY }
53193
53212
  };
@@ -53460,11 +53479,11 @@ function transformItems({
53460
53479
  setSnapCursorPos
53461
53480
  }) {
53462
53481
  const items = selection.items.list();
53463
- const includesProportionalItem = items.some((item2) => item2.itemType === "Sticker" || item2.itemType === "RichText" || item2.itemType === "AINode" || item2.itemType === "Video" || item2.itemType === "Audio");
53482
+ const includesProportionalItem = items.some((item) => item.itemType === "Sticker" || item.itemType === "RichText" || item.itemType === "AINode" || item.itemType === "Video" || item.itemType === "Audio");
53464
53483
  if (includesProportionalItem && (isWidth || isHeight)) {
53465
53484
  return null;
53466
53485
  }
53467
- const isIncludesFixedFrame = items.some((item2) => item2 instanceof Frame2 && !item2.getCanChangeRatio());
53486
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame2 && !item.getCanChangeRatio());
53468
53487
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
53469
53488
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
53470
53489
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -53542,23 +53561,23 @@ function updateFrameChildren({
53542
53561
  nestingHighlighter
53543
53562
  }) {
53544
53563
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
53545
- board.selection.items.list().forEach((item2) => {
53546
- if ("getChildrenIds" in item2 && item2.getChildrenIds()) {
53547
- const currMbr = item2.getMbr();
53564
+ board.selection.items.list().forEach((item) => {
53565
+ if ("getChildrenIds" in item && item.getChildrenIds()) {
53566
+ const currMbr = item.getMbr();
53548
53567
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
53549
53568
  itemsToCheck.forEach((currItem) => {
53550
- if (item2.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item2.getId())) {
53551
- nestingHighlighter.add(item2, currItem);
53569
+ if (item.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item.getId())) {
53570
+ nestingHighlighter.add(item, currItem);
53552
53571
  } else {
53553
53572
  nestingHighlighter.remove(currItem);
53554
53573
  }
53555
53574
  });
53556
53575
  } else {
53557
53576
  groups.forEach((group) => {
53558
- if (group.handleNesting(item2)) {
53559
- nestingHighlighter.add(group, item2);
53577
+ if (group.handleNesting(item)) {
53578
+ nestingHighlighter.add(group, item);
53560
53579
  } else {
53561
- nestingHighlighter.remove(item2);
53580
+ nestingHighlighter.remove(item);
53562
53581
  }
53563
53582
  });
53564
53583
  }
@@ -53626,9 +53645,9 @@ class Transformer extends Tool {
53626
53645
  const pointer = this.board.pointer;
53627
53646
  const camera = this.board.camera;
53628
53647
  const items = this.selection.items;
53629
- const item2 = items.getSingle();
53648
+ const item = items.getSingle();
53630
53649
  let resizeType;
53631
- if (item2 && (item2.itemType === "RichText" || item2.itemType === "Sticker")) {
53650
+ if (item && (item.itemType === "RichText" || item.itemType === "Sticker")) {
53632
53651
  resizeType = getTextResizeType(pointer.point, camera.getScale(), mbr);
53633
53652
  } else {
53634
53653
  resizeType = getResizeType(pointer.point, camera.getScale(), mbr);
@@ -53882,8 +53901,8 @@ class SelectionTransformer extends Tool {
53882
53901
  return;
53883
53902
  }
53884
53903
  if (this.selection.items.isSingle()) {
53885
- const item2 = this.selection.items.getSingle();
53886
- if (item2?.itemType === "Connector") {
53904
+ const item = this.selection.items.getSingle();
53905
+ if (item?.itemType === "Connector") {
53887
53906
  this.tool = this.connectorTransformerTool;
53888
53907
  return;
53889
53908
  } else {
@@ -53966,16 +53985,16 @@ class BoardSelection {
53966
53985
  this.quickAddButtons = getQuickAddButtons(this, board);
53967
53986
  }
53968
53987
  serialize() {
53969
- const selectedItems = this.items.list().map((item2) => item2.getId());
53988
+ const selectedItems = this.items.list().map((item) => item.getId());
53970
53989
  return JSON.stringify(selectedItems);
53971
53990
  }
53972
53991
  deserialize(serializedData) {
53973
53992
  const selectedItems = JSON.parse(serializedData);
53974
53993
  this.removeAll();
53975
53994
  selectedItems.forEach((itemId) => {
53976
- const item2 = this.board.items.getById(itemId);
53977
- if (item2) {
53978
- this.items.add(item2);
53995
+ const item = this.board.items.getById(itemId);
53996
+ if (item) {
53997
+ this.items.add(item);
53979
53998
  }
53980
53999
  });
53981
54000
  }
@@ -54053,19 +54072,19 @@ class BoardSelection {
54053
54072
  this.updateQueue.clear();
54054
54073
  safeRequestAnimationFrame(this.updateScheduledObservers);
54055
54074
  };
54056
- itemObserver = (item2) => {
54075
+ itemObserver = (item) => {
54057
54076
  if (!this.shouldPublish) {
54058
54077
  return;
54059
54078
  }
54060
54079
  this.subject.publish(this);
54061
- this.itemSubject.publish(item2);
54080
+ this.itemSubject.publish(item);
54062
54081
  };
54063
54082
  decoratedItemObserver = this.decorateObserverToScheduleUpdate(this.itemObserver);
54064
54083
  add(value) {
54065
54084
  this.items.add(value);
54066
54085
  if (Array.isArray(value)) {
54067
- for (const item2 of value) {
54068
- item2.subject.subscribe(this.itemObserver);
54086
+ for (const item of value) {
54087
+ item.subject.subscribe(this.itemObserver);
54069
54088
  }
54070
54089
  } else {
54071
54090
  value.subject.subscribe(this.itemObserver);
@@ -54074,15 +54093,15 @@ class BoardSelection {
54074
54093
  this.itemsSubject.publish([]);
54075
54094
  }
54076
54095
  addAll() {
54077
- const items = this.board.items.listAll().filter((item2) => !item2.transformation.isLocked);
54096
+ const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked);
54078
54097
  this.add(items);
54079
54098
  this.setContext("SelectByRect");
54080
54099
  }
54081
54100
  remove(value) {
54082
54101
  this.items.remove(value);
54083
54102
  if (Array.isArray(value)) {
54084
- for (const item2 of value) {
54085
- item2.subject.unsubscribe(this.itemObserver);
54103
+ for (const item of value) {
54104
+ item.subject.unsubscribe(this.itemObserver);
54086
54105
  }
54087
54106
  } else {
54088
54107
  value.subject.unsubscribe(this.itemObserver);
@@ -54176,11 +54195,11 @@ class BoardSelection {
54176
54195
  if (!this.items.isSingle()) {
54177
54196
  return;
54178
54197
  }
54179
- const item2 = this.items.getSingle();
54180
- if (!item2) {
54198
+ const item = this.items.getSingle();
54199
+ if (!item) {
54181
54200
  return;
54182
54201
  }
54183
- const text5 = item2.getRichText();
54202
+ const text5 = item.getRichText();
54184
54203
  if (!text5) {
54185
54204
  return;
54186
54205
  }
@@ -54191,7 +54210,7 @@ class BoardSelection {
54191
54210
  if (shouldReplace || moveCursorToEnd) {
54192
54211
  text5.editor.moveCursorToEndOfTheText();
54193
54212
  }
54194
- this.setTextToEdit(item2);
54213
+ this.setTextToEdit(item);
54195
54214
  this.setContext("EditTextUnderPointer");
54196
54215
  if (shouldSelect) {
54197
54216
  text5.editor.selectWholeText();
@@ -54201,13 +54220,13 @@ class BoardSelection {
54201
54220
  editUnderPointer() {
54202
54221
  this.removeAll();
54203
54222
  const stack = this.board.items.getUnderPointer();
54204
- const item2 = stack.pop();
54205
- if (item2) {
54206
- this.add(item2);
54223
+ const item = stack.pop();
54224
+ if (item) {
54225
+ this.add(item);
54207
54226
  this.setTextToEdit(undefined);
54208
- const text5 = item2.getRichText();
54227
+ const text5 = item.getRichText();
54209
54228
  if (text5) {
54210
- this.setTextToEdit(item2);
54229
+ this.setTextToEdit(item);
54211
54230
  text5.editor.selectWholeText();
54212
54231
  this.board.items.subject.publish(this.board.items);
54213
54232
  }
@@ -54216,26 +54235,26 @@ class BoardSelection {
54216
54235
  this.setContext("None");
54217
54236
  }
54218
54237
  }
54219
- setTextToEdit(item2) {
54238
+ setTextToEdit(item) {
54220
54239
  if (this.textToEdit) {
54221
54240
  this.textToEdit.updateElement();
54222
54241
  this.textToEdit.enableRender();
54223
54242
  }
54224
- if (!(item2 && item2.getRichText())) {
54243
+ if (!(item && item.getRichText())) {
54225
54244
  this.textToEdit = undefined;
54226
54245
  return;
54227
54246
  }
54228
- const text5 = item2.getRichText();
54247
+ const text5 = item.getRichText();
54229
54248
  if (!text5) {
54230
54249
  return;
54231
54250
  }
54232
54251
  if (text5.isEmpty()) {
54233
- const textColor = tempStorage.getFontColor(item2.itemType);
54234
- const textSize = tempStorage.getFontSize(item2.itemType);
54235
- const highlightColor = tempStorage.getFontHighlight(item2.itemType);
54236
- const styles = tempStorage.getFontStyles(item2.itemType);
54237
- const horizontalAlignment = tempStorage.getHorizontalAlignment(item2.itemType);
54238
- const verticalAlignment = tempStorage.getVerticalAlignment(item2.itemType);
54252
+ const textColor = tempStorage.getFontColor(item.itemType);
54253
+ const textSize = tempStorage.getFontSize(item.itemType);
54254
+ const highlightColor = tempStorage.getFontHighlight(item.itemType);
54255
+ const styles = tempStorage.getFontStyles(item.itemType);
54256
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
54257
+ const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
54239
54258
  if (textColor) {
54240
54259
  text5.setSelectionFontColor(textColor, "None");
54241
54260
  }
@@ -54243,7 +54262,7 @@ class BoardSelection {
54243
54262
  this.emit({
54244
54263
  class: "RichText",
54245
54264
  method: "setFontSize",
54246
- item: [item2.getId()],
54265
+ item: [item.getId()],
54247
54266
  fontSize: textSize,
54248
54267
  context: this.getContext()
54249
54268
  });
@@ -54255,10 +54274,10 @@ class BoardSelection {
54255
54274
  const stylesArr = styles;
54256
54275
  text5.setSelectionFontStyle(stylesArr, "None");
54257
54276
  }
54258
- if (horizontalAlignment && !(item2 instanceof Sticker)) {
54277
+ if (horizontalAlignment && !(item instanceof Sticker)) {
54259
54278
  text5.setSelectionHorisontalAlignment(horizontalAlignment);
54260
54279
  }
54261
- if (verticalAlignment && !(item2 instanceof Sticker)) {
54280
+ if (verticalAlignment && !(item instanceof Sticker)) {
54262
54281
  this.setVerticalAlignment(verticalAlignment);
54263
54282
  }
54264
54283
  }
@@ -54291,8 +54310,8 @@ class BoardSelection {
54291
54310
  }
54292
54311
  selectEnclosedOrCrossedBy(rect) {
54293
54312
  this.removeAll();
54294
- const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => !item2.transformation.isLocked);
54295
- 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);
54313
+ const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => !item.transformation.isLocked);
54314
+ 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);
54296
54315
  if (list6.length !== 0) {
54297
54316
  this.add(list6);
54298
54317
  this.setContext("SelectByRect");
@@ -54306,14 +54325,14 @@ class BoardSelection {
54306
54325
  canChangeText() {
54307
54326
  return Boolean(this.items.isSingle() && this.items.getSingle()?.getRichText());
54308
54327
  }
54309
- handleItemCopy(item2, copiedItemsMap) {
54310
- const serializedData = item2.serialize(true);
54311
- const zIndex = this.board.items.index.getZIndex(item2);
54312
- if (item2.itemType === "Comment") {
54328
+ handleItemCopy(item, copiedItemsMap) {
54329
+ const serializedData = item.serialize(true);
54330
+ const zIndex = this.board.items.index.getZIndex(item);
54331
+ if (item.itemType === "Comment") {
54313
54332
  return;
54314
54333
  }
54315
- if (item2.itemType === "Connector" && serializedData.itemType === "Connector") {
54316
- const connector = item2;
54334
+ if (item.itemType === "Connector" && serializedData.itemType === "Connector") {
54335
+ const connector = item;
54317
54336
  const startPoint = connector.getStartPoint();
54318
54337
  const endPoint = connector.getEndPoint();
54319
54338
  const startItemId = startPoint.pointType !== "Board" ? startPoint.item.getId() : null;
@@ -54329,19 +54348,19 @@ class BoardSelection {
54329
54348
  serializedData.endPoint = new BoardPoint(endPoint.x, endPoint.y).serialize();
54330
54349
  }
54331
54350
  }
54332
- const textItem = item2.getRichText()?.getTextString();
54351
+ const textItem = item.getRichText()?.getTextString();
54333
54352
  const copyText = conf.i18n.t("frame.copy");
54334
54353
  const isCopyTextExist = textItem?.includes(copyText);
54335
- const isChangeCopiedFrameText = item2.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
54354
+ const isChangeCopiedFrameText = item.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
54336
54355
  if (isChangeCopiedFrameText) {
54337
54356
  const copiedFrameText = copyText + (textItem || serializedData.text?.placeholderText);
54338
- item2.getRichText()?.editor.clearText();
54339
- item2.getRichText()?.editor.addText(copiedFrameText);
54340
- serializedData.text = item2.getRichText()?.serialize();
54341
- item2.getRichText()?.editor.clearText();
54342
- item2.getRichText()?.editor.addText(textItem || "");
54357
+ item.getRichText()?.editor.clearText();
54358
+ item.getRichText()?.editor.addText(copiedFrameText);
54359
+ serializedData.text = item.getRichText()?.serialize();
54360
+ item.getRichText()?.editor.clearText();
54361
+ item.getRichText()?.editor.addText(textItem || "");
54343
54362
  }
54344
- copiedItemsMap[item2.getId()] = { ...serializedData, zIndex };
54363
+ copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
54345
54364
  }
54346
54365
  copy(skipImageBlobCopy) {
54347
54366
  const copiedItemsMap = {};
@@ -54350,12 +54369,12 @@ class BoardSelection {
54350
54369
  this.handleItemCopy(single, copiedItemsMap);
54351
54370
  return { imageElement: single.image, imageData: copiedItemsMap };
54352
54371
  }
54353
- this.list().forEach((item2) => {
54354
- this.handleItemCopy(item2, copiedItemsMap);
54372
+ this.list().forEach((item) => {
54373
+ this.handleItemCopy(item, copiedItemsMap);
54355
54374
  });
54356
- this.list().flatMap((item2) => {
54357
- if (item2 instanceof Frame2) {
54358
- return item2.getChildrenIds();
54375
+ this.list().flatMap((item) => {
54376
+ if (item instanceof Frame2) {
54377
+ return item.getChildrenIds();
54359
54378
  }
54360
54379
  return [];
54361
54380
  }).forEach((id) => {
@@ -54383,11 +54402,11 @@ class BoardSelection {
54383
54402
  let maxRichText = null;
54384
54403
  let minRichText = null;
54385
54404
  const itemType = items[0].itemType;
54386
- for (const item2 of items) {
54387
- if (item2.itemType !== itemType) {
54405
+ for (const item of items) {
54406
+ if (item.itemType !== itemType) {
54388
54407
  return null;
54389
54408
  }
54390
- const richText = item2.getRichText();
54409
+ const richText = item.getRichText();
54391
54410
  if (richText) {
54392
54411
  if (!maxRichText || richText.getFontSize() > maxRichText.getFontSize()) {
54393
54412
  maxRichText = richText;
@@ -54493,22 +54512,22 @@ class BoardSelection {
54493
54512
  }
54494
54513
  nestSelectedItems(unselectedItem, checkFrames = true) {
54495
54514
  const selected = this.board.selection.items.list();
54496
- if (unselectedItem && !selected.find((item2) => item2.getId() === unselectedItem.getId())) {
54515
+ if (unselectedItem && !selected.find((item) => item.getId() === unselectedItem.getId())) {
54497
54516
  selected.push(unselectedItem);
54498
54517
  }
54499
- const selectedMbr = selected.reduce((acc, item2) => {
54518
+ const selectedMbr = selected.reduce((acc, item) => {
54500
54519
  if (!acc) {
54501
- return item2.getMbr();
54520
+ return item.getMbr();
54502
54521
  }
54503
- return acc.combine(item2.getMbr());
54522
+ return acc.combine(item.getMbr());
54504
54523
  }, undefined);
54505
54524
  if (selectedMbr) {
54506
- const selectedMap = Object.fromEntries(selected.map((item2) => [item2.getId(), { item: item2, nested: false }]));
54525
+ const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
54507
54526
  const enclosedGroups = this.board.items.getGroupItemsEnclosedOrCrossed(selectedMbr?.left, selectedMbr?.top, selectedMbr?.right, selectedMbr?.bottom);
54508
54527
  enclosedGroups.forEach((group) => {
54509
- selected.forEach((item2) => {
54510
- if (group.handleNesting(item2)) {
54511
- selectedMap[item2.getId()].nested = group;
54528
+ selected.forEach((item) => {
54529
+ if (group.handleNesting(item)) {
54530
+ selectedMap[item.getId()].nested = group;
54512
54531
  }
54513
54532
  });
54514
54533
  });
@@ -54532,11 +54551,11 @@ class BoardSelection {
54532
54551
  if (childrenIds && checkFrames) {
54533
54552
  const currGroup = val.item;
54534
54553
  const currMbr = currGroup.getMbr();
54535
- const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item2) => !!item2);
54536
- const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board" || item2.parent === currGroup.getId());
54554
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
54555
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
54537
54556
  const uniqueItems = new Set;
54538
- const toCheck = [...children, ...underGroup].filter((item2) => {
54539
- const id = item2.getId();
54557
+ const toCheck = [...children, ...underGroup].filter((item) => {
54558
+ const id = item.getId();
54540
54559
  if (uniqueItems.has(id)) {
54541
54560
  return false;
54542
54561
  }
@@ -54577,8 +54596,8 @@ class BoardSelection {
54577
54596
  addItemToTranslation(childId);
54578
54597
  }
54579
54598
  }
54580
- const createTranslationWithComments = (item2) => {
54581
- const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item2.getId());
54599
+ const createTranslationWithComments = (item) => {
54600
+ const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item.getId());
54582
54601
  for (const comment2 of followedComments) {
54583
54602
  translation[comment2.getId()] = {
54584
54603
  class: "Transformation",
@@ -54639,21 +54658,21 @@ class BoardSelection {
54639
54658
  newData: { borderColor }
54640
54659
  };
54641
54660
  const operations2 = {};
54642
- this.items.list().forEach((item2) => {
54643
- if (!operations2[item2.itemType]) {
54661
+ this.items.list().forEach((item) => {
54662
+ if (!operations2[item.itemType]) {
54644
54663
  const operationCopy = { ...operation };
54645
- if (item2.itemType === "Connector") {
54664
+ if (item.itemType === "Connector") {
54646
54665
  operationCopy.method = "setLineColor";
54647
54666
  operationCopy.lineColor = borderColor;
54648
- } else if (item2.itemType === "Drawing") {
54667
+ } else if (item.itemType === "Drawing") {
54649
54668
  operationCopy.method = "setStrokeColor";
54650
54669
  operationCopy.color = borderColor;
54651
54670
  } else {
54652
54671
  operationCopy.borderColor = borderColor;
54653
54672
  }
54654
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
54673
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
54655
54674
  } else {
54656
- operations2[item2.itemType].item.push(item2.getId());
54675
+ operations2[item.itemType].item.push(item.getId());
54657
54676
  }
54658
54677
  });
54659
54678
  Object.values(operations2).forEach((op) => {
@@ -54668,13 +54687,13 @@ class BoardSelection {
54668
54687
  newData: { borderWidth: width2 }
54669
54688
  };
54670
54689
  const operations2 = {};
54671
- this.items.list().forEach((item2) => {
54672
- if (!operations2[item2.itemType]) {
54690
+ this.items.list().forEach((item) => {
54691
+ if (!operations2[item.itemType]) {
54673
54692
  const operationCopy = { ...operation };
54674
- if (item2.itemType === "Connector") {
54693
+ if (item.itemType === "Connector") {
54675
54694
  operationCopy.method = "setLineWidth";
54676
54695
  operationCopy.lineWidth = width2;
54677
- } else if (item2.itemType === "Drawing") {
54696
+ } else if (item.itemType === "Drawing") {
54678
54697
  operationCopy.method = "setStrokeWidth";
54679
54698
  operationCopy.width = width2;
54680
54699
  operationCopy.prevWidth = this.getStrokeWidth();
@@ -54682,9 +54701,9 @@ class BoardSelection {
54682
54701
  operationCopy.borderWidth = width2;
54683
54702
  operationCopy.prevBorderWidth = this.getStrokeWidth();
54684
54703
  }
54685
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
54704
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
54686
54705
  } else {
54687
- operations2[item2.itemType].item.push(item2.getId());
54706
+ operations2[item.itemType].item.push(item.getId());
54688
54707
  }
54689
54708
  });
54690
54709
  Object.values(operations2).forEach((op) => {
@@ -54700,11 +54719,11 @@ class BoardSelection {
54700
54719
  newData: { backgroundColor }
54701
54720
  };
54702
54721
  const operations2 = {};
54703
- this.items.list().forEach((item2) => {
54704
- if (!operations2[item2.itemType]) {
54705
- operations2[item2.itemType] = { ...operation, class: item2.itemType, item: [item2.getId()] };
54722
+ this.items.list().forEach((item) => {
54723
+ if (!operations2[item.itemType]) {
54724
+ operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
54706
54725
  } else {
54707
- operations2[item2.itemType].item.push(item2.getId());
54726
+ operations2[item.itemType].item.push(item.getId());
54708
54727
  }
54709
54728
  });
54710
54729
  Object.values(operations2).forEach((op) => {
@@ -54728,9 +54747,9 @@ class BoardSelection {
54728
54747
  }
54729
54748
  setFrameType(frameType) {
54730
54749
  const items = this.items.list();
54731
- items.forEach((item2) => {
54732
- if (item2 instanceof Frame2) {
54733
- item2.setFrameType(frameType);
54750
+ items.forEach((item) => {
54751
+ if (item instanceof Frame2) {
54752
+ item.setFrameType(frameType);
54734
54753
  }
54735
54754
  });
54736
54755
  }
@@ -54749,21 +54768,21 @@ class BoardSelection {
54749
54768
  setFontSize(size) {
54750
54769
  const fontSize = size === "auto" ? size : toFiniteNumber(size);
54751
54770
  const itemsOps = [];
54752
- for (const item2 of this.items.list()) {
54753
- const text5 = item2.getRichText();
54771
+ for (const item of this.items.list()) {
54772
+ const text5 = item.getRichText();
54754
54773
  if (!text5) {
54755
54774
  continue;
54756
54775
  }
54757
54776
  const ops = text5.setSelectionFontSize(fontSize, this.context);
54758
54777
  itemsOps.push({
54759
- item: item2.getId(),
54778
+ item: item.getId(),
54760
54779
  selection: text5.editor.getSelection(),
54761
54780
  ops
54762
54781
  });
54763
- if (item2.itemType === "Sticker" && fontSize === "auto") {
54764
- tempStorage.remove(`fontSize_${item2.itemType}`);
54765
- } else if (item2.itemType !== "AINode") {
54766
- tempStorage.setFontSize(item2.itemType, fontSize);
54782
+ if (item.itemType === "Sticker" && fontSize === "auto") {
54783
+ tempStorage.remove(`fontSize_${item.itemType}`);
54784
+ } else if (item.itemType !== "AINode") {
54785
+ tempStorage.setFontSize(item.itemType, fontSize);
54767
54786
  }
54768
54787
  }
54769
54788
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -54786,8 +54805,8 @@ class BoardSelection {
54786
54805
  setFontStyle(fontStyle) {
54787
54806
  const isMultiple = !this.items.isSingle();
54788
54807
  const itemsOps = [];
54789
- for (const item2 of this.items.list()) {
54790
- const text5 = item2.getRichText();
54808
+ for (const item of this.items.list()) {
54809
+ const text5 = item.getRichText();
54791
54810
  if (!text5) {
54792
54811
  continue;
54793
54812
  }
@@ -54796,12 +54815,12 @@ class BoardSelection {
54796
54815
  }
54797
54816
  const ops = text5.setSelectionFontStyle(fontStyle, this.context);
54798
54817
  itemsOps.push({
54799
- item: item2.getId(),
54818
+ item: item.getId(),
54800
54819
  selection: text5.editor.getSelection(),
54801
54820
  ops
54802
54821
  });
54803
- if (item2.itemType !== "AINode") {
54804
- tempStorage.setFontStyles(item2.itemType, text5.getFontStyles());
54822
+ if (item.itemType !== "AINode") {
54823
+ tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
54805
54824
  }
54806
54825
  }
54807
54826
  this.emitApplied({
@@ -54813,8 +54832,8 @@ class BoardSelection {
54813
54832
  setFontColor(fontColor) {
54814
54833
  const isMultiple = !this.items.isSingle();
54815
54834
  const itemsOps = [];
54816
- for (const item2 of this.items.list()) {
54817
- const text5 = item2.getRichText();
54835
+ for (const item of this.items.list()) {
54836
+ const text5 = item.getRichText();
54818
54837
  if (!text5) {
54819
54838
  continue;
54820
54839
  }
@@ -54823,11 +54842,11 @@ class BoardSelection {
54823
54842
  }
54824
54843
  const ops = text5.setSelectionFontColor(fontColor, this.context);
54825
54844
  itemsOps.push({
54826
- item: item2.getId(),
54845
+ item: item.getId(),
54827
54846
  selection: text5.editor.getSelection(),
54828
54847
  ops
54829
54848
  });
54830
- tempStorage.setFontColor(item2.itemType, fontColor);
54849
+ tempStorage.setFontColor(item.itemType, fontColor);
54831
54850
  }
54832
54851
  this.emitApplied({
54833
54852
  class: "RichText",
@@ -54856,8 +54875,8 @@ class BoardSelection {
54856
54875
  setFontHighlight(fontHighlight) {
54857
54876
  const isMultiple = !this.items.isSingle();
54858
54877
  const itemsOps = [];
54859
- for (const item2 of this.items.list()) {
54860
- const text5 = item2.getRichText();
54878
+ for (const item of this.items.list()) {
54879
+ const text5 = item.getRichText();
54861
54880
  if (!text5) {
54862
54881
  continue;
54863
54882
  }
@@ -54866,12 +54885,12 @@ class BoardSelection {
54866
54885
  }
54867
54886
  const ops = text5.setSelectionFontHighlight(fontHighlight, this.context);
54868
54887
  itemsOps.push({
54869
- item: item2.getId(),
54888
+ item: item.getId(),
54870
54889
  selection: text5.editor.getSelection(),
54871
54890
  ops
54872
54891
  });
54873
- if (item2.itemType !== "AINode") {
54874
- tempStorage.setFontHighlight(item2.itemType, fontHighlight);
54892
+ if (item.itemType !== "AINode") {
54893
+ tempStorage.setFontHighlight(item.itemType, fontHighlight);
54875
54894
  }
54876
54895
  }
54877
54896
  this.emitApplied({
@@ -54883,8 +54902,8 @@ class BoardSelection {
54883
54902
  setHorisontalAlignment(horisontalAlignment) {
54884
54903
  const isMultiple = !this.items.isSingle();
54885
54904
  const itemsOps = [];
54886
- for (const item2 of this.items.list()) {
54887
- const text5 = item2.getRichText();
54905
+ for (const item of this.items.list()) {
54906
+ const text5 = item.getRichText();
54888
54907
  if (!text5) {
54889
54908
  continue;
54890
54909
  }
@@ -54893,11 +54912,11 @@ class BoardSelection {
54893
54912
  }
54894
54913
  const ops = text5.setSelectionHorisontalAlignment(horisontalAlignment, this.context);
54895
54914
  itemsOps.push({
54896
- item: item2.getId(),
54915
+ item: item.getId(),
54897
54916
  selection: text5.editor.getSelection(),
54898
54917
  ops
54899
54918
  });
54900
- tempStorage.setHorizontalAlignment(item2.itemType, horisontalAlignment);
54919
+ tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
54901
54920
  }
54902
54921
  this.emitApplied({
54903
54922
  class: "RichText",
@@ -54913,23 +54932,23 @@ class BoardSelection {
54913
54932
  verticalAlignment
54914
54933
  });
54915
54934
  if (this.items.isSingle()) {
54916
- const item2 = this.items.getSingle();
54917
- if (!item2) {
54935
+ const item = this.items.getSingle();
54936
+ if (!item) {
54918
54937
  return;
54919
54938
  }
54920
- const text5 = item2.getRichText();
54939
+ const text5 = item.getRichText();
54921
54940
  if (!text5) {
54922
54941
  return;
54923
54942
  }
54924
- tempStorage.setVerticalAlignment(item2.itemType, verticalAlignment);
54925
- if (item2 instanceof RichText) {
54926
- item2.setEditorFocus(this.context);
54943
+ tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
54944
+ if (item instanceof RichText) {
54945
+ item.setEditorFocus(this.context);
54927
54946
  }
54928
54947
  text5.setEditorFocus(this.context);
54929
54948
  }
54930
54949
  }
54931
54950
  removeFromBoard() {
54932
- const isLocked = this.items.list().some((item2) => item2.transformation.isLocked);
54951
+ const isLocked = this.items.list().some((item) => item.transformation.isLocked);
54933
54952
  if (isLocked) {
54934
54953
  return;
54935
54954
  }
@@ -54952,7 +54971,7 @@ class BoardSelection {
54952
54971
  }
54953
54972
  getIsLockedSelection() {
54954
54973
  const items = this.list();
54955
- return items.some((item2) => item2.transformation.isLocked);
54974
+ return items.some((item) => item.transformation.isLocked);
54956
54975
  }
54957
54976
  isLocked() {
54958
54977
  return false;
@@ -54979,9 +54998,9 @@ class BoardSelection {
54979
54998
  }
54980
54999
  async duplicate() {
54981
55000
  const mediaIds = [];
54982
- this.items.list().forEach((item2) => {
54983
- if ("getStorageId" in item2) {
54984
- const storageId = item2.getStorageId();
55001
+ this.items.list().forEach((item) => {
55002
+ if ("getStorageId" in item) {
55003
+ const storageId = item.getStorageId();
54985
55004
  if (storageId) {
54986
55005
  mediaIds.push(storageId);
54987
55006
  }
@@ -54991,7 +55010,7 @@ class BoardSelection {
54991
55010
  if (!canDuplicate) {
54992
55011
  return;
54993
55012
  }
54994
- const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item2]) => item2.itemType !== "Group"));
55013
+ const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item]) => item.itemType !== "Group"));
54995
55014
  this.board.duplicate(filteredItemMap);
54996
55015
  this.setContext("EditUnderPointer");
54997
55016
  }
@@ -55025,10 +55044,10 @@ class BoardSelection {
55025
55044
  lastAssistantMessageId
55026
55045
  };
55027
55046
  }
55028
- renderItemMbr(context, item2, customScale) {
55029
- const mbr = item2.getMbr();
55047
+ renderItemMbr(context, item, customScale) {
55048
+ const mbr = item.getMbr();
55030
55049
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
55031
- const selectionColor = item2.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
55050
+ const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
55032
55051
  mbr.borderColor = selectionColor;
55033
55052
  mbr.render(context);
55034
55053
  }
@@ -55044,8 +55063,8 @@ class BoardSelection {
55044
55063
  }
55045
55064
  if (!this.transformationRenderBlock) {
55046
55065
  if (this.shouldRenderItemsMbr) {
55047
- for (const item2 of this.items.list()) {
55048
- this.renderItemMbr(context, item2);
55066
+ for (const item of this.items.list()) {
55067
+ this.renderItemMbr(context, item);
55049
55068
  }
55050
55069
  }
55051
55070
  this.tool.render(context);
@@ -55057,7 +55076,7 @@ class BoardSelection {
55057
55076
  if (single && single instanceof AINode) {
55058
55077
  const contextItemsIds = single.getContextItems();
55059
55078
  if (contextItemsIds.length) {
55060
- const newContextItems = this.board.items.listAll().filter((item2) => contextItemsIds.includes(item2.getId()));
55079
+ const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
55061
55080
  contextItems.push(...newContextItems);
55062
55081
  }
55063
55082
  }
@@ -55075,15 +55094,15 @@ class BoardSelection {
55075
55094
  }
55076
55095
  }
55077
55096
  }
55078
- contextItems.forEach((item2) => {
55079
- if (item2 instanceof AINode) {
55080
- const path2 = item2.getPath();
55097
+ contextItems.forEach((item) => {
55098
+ if (item instanceof AINode) {
55099
+ const path2 = item.getPath();
55081
55100
  path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
55082
55101
  path2.setBorderWidth(2);
55083
55102
  path2.setBackgroundColor("none");
55084
55103
  path2.render(context);
55085
55104
  } else {
55086
- const itemRect = item2.getMbr();
55105
+ const itemRect = item.getMbr();
55087
55106
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
55088
55107
  itemRect.strokeWidth = 2;
55089
55108
  itemRect.render(context);
@@ -55584,16 +55603,16 @@ class Board {
55584
55603
  applyBoardOperation(op) {
55585
55604
  switch (op.method) {
55586
55605
  case "moveToZIndex": {
55587
- const item2 = this.index.getById(op.item);
55588
- if (!item2) {
55606
+ const item = this.index.getById(op.item);
55607
+ if (!item) {
55589
55608
  return;
55590
55609
  }
55591
- return this.index.moveToZIndex(item2, op.zIndex);
55610
+ return this.index.moveToZIndex(item, op.zIndex);
55592
55611
  }
55593
55612
  case "moveManyToZIndex": {
55594
55613
  for (const id in op.item) {
55595
- const item2 = this.items.getById(id);
55596
- if (!item2) {
55614
+ const item = this.items.getById(id);
55615
+ if (!item) {
55597
55616
  delete op.item.id;
55598
55617
  }
55599
55618
  }
@@ -55615,11 +55634,11 @@ class Board {
55615
55634
  }
55616
55635
  return this.index.moveSecondAfterFirst(first, second);
55617
55636
  case "bringToFront": {
55618
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
55637
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
55619
55638
  return this.index.bringManyToFront(items);
55620
55639
  }
55621
55640
  case "sendToBack": {
55622
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
55641
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
55623
55642
  return this.index.sendManyToBack(items);
55624
55643
  }
55625
55644
  case "add":
@@ -55643,82 +55662,82 @@ class Board {
55643
55662
  applyAddItems(op) {
55644
55663
  if (Array.isArray(op.item)) {
55645
55664
  const data = op.data;
55646
- const items = op.item.map((item3) => {
55647
- const created = this.createItem(item3, data[item3]);
55665
+ const items = op.item.map((item2) => {
55666
+ const created = this.createItem(item2, data[item2]);
55648
55667
  this.index.insert(created);
55649
55668
  return created;
55650
55669
  });
55651
- items.forEach((item3) => {
55652
- if (item3 instanceof Connector2 && data[item3.getId()]) {
55653
- const connectorData = data[item3.getId()];
55654
- item3.applyStartPoint(connectorData.startPoint);
55655
- item3.applyEndPoint(connectorData.endPoint);
55670
+ items.forEach((item2) => {
55671
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
55672
+ const connectorData = data[item2.getId()];
55673
+ item2.applyStartPoint(connectorData.startPoint);
55674
+ item2.applyEndPoint(connectorData.endPoint);
55656
55675
  }
55657
55676
  });
55658
55677
  return;
55659
55678
  }
55660
- const item2 = this.createItem(op.item, op.data);
55661
- return this.index.insert(item2);
55679
+ const item = this.createItem(op.item, op.data);
55680
+ return this.index.insert(item);
55662
55681
  }
55663
55682
  applyAddLockedGroupOperation(op) {
55664
- const item2 = this.createItem(op.item, op.data);
55665
- const groupChildrenIds = item2.getChildrenIds();
55666
- this.index.insert(item2);
55683
+ const item = this.createItem(op.item, op.data);
55684
+ const groupChildrenIds = item.getChildrenIds();
55685
+ this.index.insert(item);
55667
55686
  const lastChildrenId = this.index.getById(groupChildrenIds[groupChildrenIds.length - 1]);
55668
55687
  if (lastChildrenId) {
55669
55688
  const zIndex = this.index.getZIndex(lastChildrenId) + 1;
55670
- this.index.moveToZIndex(item2, zIndex);
55689
+ this.index.moveToZIndex(item, zIndex);
55671
55690
  }
55672
- item2.getChildren().forEach((item3) => {
55673
- item3.transformation.isLocked = true;
55691
+ item.getChildren().forEach((item2) => {
55692
+ item2.transformation.isLocked = true;
55674
55693
  });
55675
- item2.transformation.isLocked = true;
55694
+ item.transformation.isLocked = true;
55676
55695
  }
55677
55696
  applyRemoveOperation(op) {
55678
55697
  const removedItems = [];
55679
- this.findItemAndApply(op.item, (item2) => {
55680
- this.index.remove(item2);
55681
- this.selection.remove(item2);
55682
- if (item2 instanceof Connector2) {
55683
- item2.clearObservedItems();
55698
+ this.findItemAndApply(op.item, (item) => {
55699
+ this.index.remove(item);
55700
+ this.selection.remove(item);
55701
+ if (item instanceof Connector2) {
55702
+ item.clearObservedItems();
55684
55703
  }
55685
- removedItems.push(item2);
55704
+ removedItems.push(item);
55686
55705
  });
55687
55706
  }
55688
55707
  applyRemoveLockedGroupOperation(op) {
55689
- const item2 = this.index.getById(op.item[0]);
55690
- if (!item2 || !(item2 instanceof Group)) {
55708
+ const item = this.index.getById(op.item[0]);
55709
+ if (!item || !(item instanceof Group)) {
55691
55710
  return;
55692
55711
  }
55693
- item2.getChildren().forEach((item3) => {
55694
- item3.transformation.isLocked = false;
55695
- item3.parent = "Board";
55712
+ item.getChildren().forEach((item2) => {
55713
+ item2.transformation.isLocked = false;
55714
+ item2.parent = "Board";
55696
55715
  });
55697
- item2.transformation.isLocked = false;
55716
+ item.transformation.isLocked = false;
55698
55717
  const removedItems = [];
55699
- this.findItemAndApply(op.item, (item3) => {
55700
- this.index.remove(item3);
55701
- this.selection.remove(item3);
55702
- removedItems.push(item3);
55718
+ this.findItemAndApply(op.item, (item2) => {
55719
+ this.index.remove(item2);
55720
+ this.selection.remove(item2);
55721
+ removedItems.push(item2);
55703
55722
  });
55704
55723
  }
55705
55724
  applyItemOperation(op) {
55706
55725
  if ("item" in op) {
55707
- this.findItemAndApply(op.item, (item2) => {
55708
- item2.apply(op);
55726
+ this.findItemAndApply(op.item, (item) => {
55727
+ item.apply(op);
55709
55728
  });
55710
55729
  }
55711
55730
  }
55712
- findItemAndApply(item2, apply) {
55713
- if (Array.isArray(item2)) {
55714
- for (const itemId of item2) {
55731
+ findItemAndApply(item, apply) {
55732
+ if (Array.isArray(item)) {
55733
+ for (const itemId of item) {
55715
55734
  const found = this.items.findById(itemId);
55716
55735
  if (found) {
55717
55736
  apply(found);
55718
55737
  }
55719
55738
  }
55720
55739
  } else {
55721
- const found = this.items.findById(item2);
55740
+ const found = this.items.findById(item);
55722
55741
  if (found) {
55723
55742
  apply(found);
55724
55743
  }
@@ -55727,9 +55746,9 @@ class Board {
55727
55746
  handleNesting(items) {
55728
55747
  const arrayed = Array.isArray(items) ? items : [items];
55729
55748
  const groupsMap = new Map;
55730
- arrayed.forEach((item2) => {
55731
- const itemCenter = item2.getMbr().getCenter();
55732
- const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item2)).reduce((acc, groupItem2) => {
55749
+ arrayed.forEach((item) => {
55750
+ const itemCenter = item.getMbr().getCenter();
55751
+ const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item)).reduce((acc, groupItem2) => {
55733
55752
  if (!acc || groupItem2.getDistanceToPoint(itemCenter) > acc.getDistanceToPoint(itemCenter)) {
55734
55753
  acc = groupItem2;
55735
55754
  }
@@ -55739,7 +55758,7 @@ class Board {
55739
55758
  if (!groupsMap.has(groupItem)) {
55740
55759
  groupsMap.set(groupItem, []);
55741
55760
  }
55742
- groupsMap.get(groupItem)?.push(item2);
55761
+ groupsMap.get(groupItem)?.push(item);
55743
55762
  }
55744
55763
  });
55745
55764
  groupsMap.forEach((items2, group) => {
@@ -55760,13 +55779,13 @@ class Board {
55760
55779
  }
55761
55780
  return parser(el);
55762
55781
  }
55763
- add(item2, timeStamp) {
55782
+ add(item, timeStamp) {
55764
55783
  const id = this.getNewItemId();
55765
55784
  this.emit({
55766
55785
  class: "Board",
55767
55786
  method: "add",
55768
55787
  item: id,
55769
- data: item2.serialize(),
55788
+ data: item.serialize(),
55770
55789
  timeStamp
55771
55790
  });
55772
55791
  const newItem = this.items.getById(id);
@@ -55776,13 +55795,13 @@ class Board {
55776
55795
  this.handleNesting(newItem);
55777
55796
  return newItem;
55778
55797
  }
55779
- addLockedGroup(item2) {
55798
+ addLockedGroup(item) {
55780
55799
  const id = this.getNewItemId();
55781
55800
  this.emit({
55782
55801
  class: "Board",
55783
55802
  method: "addLockedGroup",
55784
55803
  item: id,
55785
- data: item2.serialize()
55804
+ data: item.serialize()
55786
55805
  });
55787
55806
  const newItem = this.items.getById(id);
55788
55807
  if (!newItem) {
@@ -55791,32 +55810,32 @@ class Board {
55791
55810
  this.handleNesting(newItem);
55792
55811
  return newItem;
55793
55812
  }
55794
- remove(item2, withConnectors = true) {
55813
+ remove(item, withConnectors = true) {
55795
55814
  let connectors = [];
55796
55815
  if (withConnectors) {
55797
- connectors = this.items.getLinkedConnectorsById(item2.getId()).map((connector) => connector.getId());
55816
+ connectors = this.items.getLinkedConnectorsById(item.getId()).map((connector) => connector.getId());
55798
55817
  }
55799
- if ("onRemove" in item2) {
55800
- item2.onRemove();
55818
+ if ("onRemove" in item) {
55819
+ item.onRemove();
55801
55820
  }
55802
55821
  this.emit({
55803
55822
  class: "Board",
55804
55823
  method: "remove",
55805
- item: [item2.getId(), ...connectors]
55824
+ item: [item.getId(), ...connectors]
55806
55825
  });
55807
55826
  }
55808
- removeLockedGroup(item2) {
55827
+ removeLockedGroup(item) {
55809
55828
  this.emit({
55810
55829
  class: "Board",
55811
55830
  method: "removeLockedGroup",
55812
- item: [item2.getId()]
55831
+ item: [item.getId()]
55813
55832
  });
55814
55833
  }
55815
55834
  getByZIndex(index2) {
55816
55835
  return this.index.getByZIndex(index2);
55817
55836
  }
55818
- getZIndex(item2) {
55819
- return this.index.getZIndex(item2);
55837
+ getZIndex(item) {
55838
+ return this.index.getZIndex(item);
55820
55839
  }
55821
55840
  getLastZIndex() {
55822
55841
  return this.index.getLastZIndex();
@@ -55828,11 +55847,11 @@ class Board {
55828
55847
  item: items
55829
55848
  });
55830
55849
  }
55831
- moveToZIndex(item2, zIndex) {
55850
+ moveToZIndex(item, zIndex) {
55832
55851
  this.emit({
55833
55852
  class: "Board",
55834
55853
  method: "moveToZIndex",
55835
- item: item2.getId(),
55854
+ item: item.getId(),
55836
55855
  zIndex
55837
55856
  });
55838
55857
  }
@@ -55860,8 +55879,8 @@ class Board {
55860
55879
  this.emit({
55861
55880
  class: "Board",
55862
55881
  method: "bringToFront",
55863
- item: items.map((item2) => item2.getId()),
55864
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
55882
+ item: items.map((item) => item.getId()),
55883
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
55865
55884
  });
55866
55885
  }
55867
55886
  sendToBack(items) {
@@ -55872,8 +55891,8 @@ class Board {
55872
55891
  this.emit({
55873
55892
  class: "Board",
55874
55893
  method: "sendToBack",
55875
- item: items.map((item2) => item2.getId()),
55876
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
55894
+ item: items.map((item) => item.getId()),
55895
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
55877
55896
  });
55878
55897
  }
55879
55898
  copy() {
@@ -55950,7 +55969,7 @@ class Board {
55950
55969
  return added;
55951
55970
  });
55952
55971
  addedFrame.addChildItems(addedChildren);
55953
- parsedData.data.children = addedChildren.map((item2) => item2.getId());
55972
+ parsedData.data.children = addedChildren.map((item) => item.getId());
55954
55973
  idsMap[parsedData.data.id] = addedFrame.getId();
55955
55974
  } else {
55956
55975
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -55991,15 +56010,15 @@ class Board {
55991
56010
  const createdConnectors = {};
55992
56011
  const createdFrames = {};
55993
56012
  const addItem = (itemData) => {
55994
- const item2 = this.createItem(itemData.id, itemData);
55995
- if (item2 instanceof Connector2) {
55996
- createdConnectors[itemData.id] = { item: item2, itemData };
56013
+ const item = this.createItem(itemData.id, itemData);
56014
+ if (item instanceof Connector2) {
56015
+ createdConnectors[itemData.id] = { item, itemData };
55997
56016
  }
55998
- if (item2 instanceof Frame2) {
55999
- createdFrames[item2.getId()] = { item: item2, itemData };
56017
+ if (item instanceof Frame2) {
56018
+ createdFrames[item.getId()] = { item, itemData };
56000
56019
  }
56001
- this.index.insert(item2);
56002
- return item2;
56020
+ this.index.insert(item);
56021
+ return item;
56003
56022
  };
56004
56023
  for (const itemData of items) {
56005
56024
  if ("childrenMap" in itemData) {
@@ -56010,13 +56029,13 @@ class Board {
56010
56029
  }
56011
56030
  }
56012
56031
  for (const key in createdConnectors) {
56013
- const { item: item2, itemData } = createdConnectors[key];
56014
- item2.applyStartPoint(itemData.startPoint);
56015
- item2.applyEndPoint(itemData.endPoint);
56032
+ const { item, itemData } = createdConnectors[key];
56033
+ item.applyStartPoint(itemData.startPoint);
56034
+ item.applyEndPoint(itemData.endPoint);
56016
56035
  }
56017
56036
  for (const key in createdFrames) {
56018
- const { item: item2, itemData } = createdFrames[key];
56019
- item2.applyAddChildren(itemData.children);
56037
+ const { item, itemData } = createdFrames[key];
56038
+ item.applyAddChildren(itemData.children);
56020
56039
  }
56021
56040
  }
56022
56041
  deserialize(snapshot) {
@@ -56026,33 +56045,33 @@ class Board {
56026
56045
  const createdFrames = {};
56027
56046
  if (Array.isArray(items)) {
56028
56047
  for (const itemData of items) {
56029
- const item2 = this.createItem(itemData.id, itemData);
56030
- if (item2 instanceof Connector2) {
56031
- createdConnectors[itemData.id] = { item: item2, itemData };
56048
+ const item = this.createItem(itemData.id, itemData);
56049
+ if (item instanceof Connector2) {
56050
+ createdConnectors[itemData.id] = { item, itemData };
56032
56051
  }
56033
- if (item2 instanceof Frame2) {
56034
- createdFrames[item2.getId()] = { item: item2, itemData };
56052
+ if (item instanceof Frame2) {
56053
+ createdFrames[item.getId()] = { item, itemData };
56035
56054
  }
56036
- this.index.insert(item2);
56055
+ this.index.insert(item);
56037
56056
  }
56038
56057
  } else {
56039
56058
  for (const key in items) {
56040
56059
  const itemData = items[key];
56041
- const item2 = this.createItem(key, itemData);
56042
- if (item2 instanceof Connector2) {
56043
- createdConnectors[key] = { item: item2, itemData };
56060
+ const item = this.createItem(key, itemData);
56061
+ if (item instanceof Connector2) {
56062
+ createdConnectors[key] = { item, itemData };
56044
56063
  }
56045
- this.index.insert(item2);
56064
+ this.index.insert(item);
56046
56065
  }
56047
56066
  }
56048
56067
  for (const key in createdConnectors) {
56049
- const { item: item2, itemData } = createdConnectors[key];
56050
- item2.applyStartPoint(itemData.startPoint);
56051
- item2.applyEndPoint(itemData.endPoint);
56068
+ const { item, itemData } = createdConnectors[key];
56069
+ item.applyStartPoint(itemData.startPoint);
56070
+ item.applyEndPoint(itemData.endPoint);
56052
56071
  }
56053
56072
  for (const key in createdFrames) {
56054
- const { item: item2, itemData } = createdFrames[key];
56055
- item2.applyAddChildren(itemData.children);
56073
+ const { item, itemData } = createdFrames[key];
56074
+ item.applyAddChildren(itemData.children);
56056
56075
  }
56057
56076
  this.events?.log.deserialize(events);
56058
56077
  }
@@ -56290,7 +56309,7 @@ class Board {
56290
56309
  itemsMap: newMap,
56291
56310
  select: select2
56292
56311
  });
56293
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
56312
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
56294
56313
  this.handleNesting(items);
56295
56314
  this.selection.removeAll();
56296
56315
  this.selection.add(items);
@@ -56298,8 +56317,8 @@ class Board {
56298
56317
  return;
56299
56318
  }
56300
56319
  removeVoidComments() {
56301
- const voidComments = this.items.listAll().filter((item2) => {
56302
- return item2 instanceof Comment && !item2.getThread().length;
56320
+ const voidComments = this.items.listAll().filter((item) => {
56321
+ return item instanceof Comment && !item.getThread().length;
56303
56322
  });
56304
56323
  if (voidComments) {
56305
56324
  for (const comment2 of voidComments) {
@@ -56373,7 +56392,7 @@ class Board {
56373
56392
  }
56374
56393
  const mbr = this.selection.getMbr();
56375
56394
  const selectedItems = this.selection.items.list();
56376
- const isSelectedItemsMinWidth = selectedItems.some((item2) => item2.getMbr().getWidth() === 0);
56395
+ const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
56377
56396
  const right = mbr ? mbr.right : 0;
56378
56397
  const top = mbr ? mbr.top : 0;
56379
56398
  const width2 = mbr ? mbr.getWidth() / 10 : 10;
@@ -56415,7 +56434,7 @@ class Board {
56415
56434
  method: "duplicate",
56416
56435
  itemsMap: newMap
56417
56436
  });
56418
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
56437
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
56419
56438
  this.handleNesting(items);
56420
56439
  this.selection.removeAll();
56421
56440
  this.selection.add(items);
@@ -56436,9 +56455,9 @@ class Board {
56436
56455
  if (data.itemType === "Frame") {
56437
56456
  data.text.placeholderText = `Frame ${this.getMaxFrameSerial() + 1}`;
56438
56457
  }
56439
- const item2 = this.createItem(itemId, data);
56440
- this.index.insert(item2);
56441
- items.push(item2);
56458
+ const item = this.createItem(itemId, data);
56459
+ this.index.insert(item);
56460
+ items.push(item);
56442
56461
  };
56443
56462
  sortedItemsMap.map(([id, data]) => {
56444
56463
  if (data.itemType === "Connector") {
@@ -56453,8 +56472,8 @@ class Board {
56453
56472
  return;
56454
56473
  });
56455
56474
  }
56456
- isOnBoard(item2) {
56457
- return this.items.findById(item2.getId()) !== undefined;
56475
+ isOnBoard(item) {
56476
+ return this.items.findById(item.getId()) !== undefined;
56458
56477
  }
56459
56478
  getMaxFrameSerial() {
56460
56479
  const existingNames = this.items.listGroupItems().map((frame) => frame.getRichText()?.getTextString().length === 0 ? frame.getRichText()?.placeholderText || "" : frame.getRichText()?.getTextString() || "");
@@ -56500,7 +56519,7 @@ function areItemsTheSame(opA, opB) {
56500
56519
  const itemsB = Object.keys(opB.items);
56501
56520
  const setA = new Set(itemsA);
56502
56521
  const setB = new Set(itemsB);
56503
- const areArraysEqual = setA.size === setB.size && [...setA].every((item2) => setB.has(item2));
56522
+ const areArraysEqual = setA.size === setB.size && [...setA].every((item) => setB.has(item));
56504
56523
  return areArraysEqual;
56505
56524
  }
56506
56525
  if (!(Array.isArray(opA.item) && Array.isArray(opB.item))) {
@@ -58159,9 +58178,9 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
58159
58178
  list6.applyUnconfirmed(filter);
58160
58179
  const hasAnyOverlap = (arr1, arr2) => {
58161
58180
  const lookup9 = new Set(arr1);
58162
- return arr2.some((item2) => lookup9.has(item2));
58181
+ return arr2.some((item) => lookup9.has(item));
58163
58182
  };
58164
- const currSelection = board.selection.list().map((item2) => item2.getId());
58183
+ const currSelection = board.selection.list().map((item) => item.getId());
58165
58184
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
58166
58185
  board.selection.applyMemoizedCaretOrRange();
58167
58186
  }
@@ -58483,27 +58502,27 @@ function handleAiChatMassage(message, board) {
58483
58502
  }
58484
58503
  }
58485
58504
  function handleChatChunk(chunk, board) {
58486
- const item2 = board.items.getById(chunk.itemId);
58505
+ const item = board.items.getById(chunk.itemId);
58487
58506
  switch (chunk.type) {
58488
58507
  case "chunk":
58489
- if (!item2 || item2.itemType !== "AINode") {
58508
+ if (!item || item.itemType !== "AINode") {
58490
58509
  return;
58491
58510
  }
58492
- item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
58511
+ item.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
58493
58512
  break;
58494
58513
  case "done":
58495
- if (!item2 || item2.itemType !== "AINode") {
58514
+ if (!item || item.itemType !== "AINode") {
58496
58515
  board.aiGeneratingOnItem = undefined;
58497
58516
  return;
58498
58517
  }
58499
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58518
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58500
58519
  break;
58501
58520
  case "end":
58502
- if (!item2 || item2.itemType !== "AINode") {
58521
+ if (!item || item.itemType !== "AINode") {
58503
58522
  board.aiGeneratingOnItem = undefined;
58504
58523
  return;
58505
58524
  }
58506
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58525
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58507
58526
  break;
58508
58527
  case "error":
58509
58528
  default:
@@ -58520,7 +58539,7 @@ function handleChatChunk(chunk, board) {
58520
58539
  if (board.aiGeneratingOnItem && generatingItem) {
58521
58540
  board.selection.removeAll();
58522
58541
  board.selection.add(generatingItem);
58523
- const rt = item2?.getRichText();
58542
+ const rt = item?.getRichText();
58524
58543
  if (generatingItem.itemType === "AINode" && rt) {
58525
58544
  const editor = rt.editor;
58526
58545
  editor.markdownProcessor.setStopProcessingMarkDownCb(null);
@@ -58653,14 +58672,14 @@ function handleImageGenerate(response, board) {
58653
58672
  console.error("Image generation error:", response.message);
58654
58673
  if (response.isExternalApiError) {
58655
58674
  if (board.aiGeneratingOnItem) {
58656
- const item2 = board.items.getById(board.aiGeneratingOnItem);
58657
- if (item2) {
58675
+ const item = board.items.getById(board.aiGeneratingOnItem);
58676
+ if (item) {
58658
58677
  board.selection.removeAll();
58659
- board.selection.add(item2);
58660
- const editor = item2.getRichText()?.editor;
58678
+ board.selection.add(item);
58679
+ const editor = item.getRichText()?.editor;
58661
58680
  editor?.clearText();
58662
58681
  editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
58663
- board.camera.zoomToFit(item2.getMbr(), 20);
58682
+ board.camera.zoomToFit(item.getMbr(), 20);
58664
58683
  }
58665
58684
  }
58666
58685
  } else {