microboard-temp 0.4.57 → 0.4.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/node.js CHANGED
@@ -1539,8 +1539,8 @@ var require_tinyqueue = __commonJS((exports2, module2) => {
1539
1539
  }
1540
1540
  }
1541
1541
  };
1542
- TinyQueue.prototype.push = function push(item) {
1543
- this.data.push(item);
1542
+ TinyQueue.prototype.push = function push(item2) {
1543
+ this.data.push(item2);
1544
1544
  this.length++;
1545
1545
  this._up(this.length - 1);
1546
1546
  };
@@ -1564,24 +1564,24 @@ var require_tinyqueue = __commonJS((exports2, module2) => {
1564
1564
  var ref = this;
1565
1565
  var data = ref.data;
1566
1566
  var compare = ref.compare;
1567
- var item = data[pos];
1567
+ var item2 = data[pos];
1568
1568
  while (pos > 0) {
1569
1569
  var parent = pos - 1 >> 1;
1570
1570
  var current = data[parent];
1571
- if (compare(item, current) >= 0) {
1571
+ if (compare(item2, current) >= 0) {
1572
1572
  break;
1573
1573
  }
1574
1574
  data[pos] = current;
1575
1575
  pos = parent;
1576
1576
  }
1577
- data[pos] = item;
1577
+ data[pos] = item2;
1578
1578
  };
1579
1579
  TinyQueue.prototype._down = function _down(pos) {
1580
1580
  var ref = this;
1581
1581
  var data = ref.data;
1582
1582
  var compare = ref.compare;
1583
1583
  var halfLength = this.length >> 1;
1584
- var item = data[pos];
1584
+ var item2 = data[pos];
1585
1585
  while (pos < halfLength) {
1586
1586
  var left = (pos << 1) + 1;
1587
1587
  var best = data[left];
@@ -1590,13 +1590,13 @@ var require_tinyqueue = __commonJS((exports2, module2) => {
1590
1590
  left = right;
1591
1591
  best = data[right];
1592
1592
  }
1593
- if (compare(best, item) >= 0) {
1593
+ if (compare(best, item2) >= 0) {
1594
1594
  break;
1595
1595
  }
1596
1596
  data[pos] = best;
1597
1597
  pos = left;
1598
1598
  }
1599
- data[pos] = item;
1599
+ data[pos] = item2;
1600
1600
  };
1601
1601
  function defaultCompare2(a, b) {
1602
1602
  return a < b ? -1 : a > b ? 1 : 0;
@@ -1838,8 +1838,8 @@ class BoardCommand {
1838
1838
  switch (operation.method) {
1839
1839
  case "bringToFront": {
1840
1840
  for (const id in operation.prevZIndex) {
1841
- const item = this.board.items.getById(id);
1842
- if (!item) {
1841
+ const item2 = this.board.items.getById(id);
1842
+ if (!item2) {
1843
1843
  delete operation.prevZIndex.id;
1844
1844
  }
1845
1845
  }
@@ -1851,8 +1851,8 @@ class BoardCommand {
1851
1851
  }
1852
1852
  case "sendToBack": {
1853
1853
  for (const id in operation.prevZIndex) {
1854
- const item = this.board.items.getById(id);
1855
- if (!item) {
1854
+ const item2 = this.board.items.getById(id);
1855
+ if (!item2) {
1856
1856
  delete operation.prevZIndex.id;
1857
1857
  }
1858
1858
  }
@@ -1866,11 +1866,11 @@ class BoardCommand {
1866
1866
  case "moveSecondBeforeFirst":
1867
1867
  case "moveToZIndex": {
1868
1868
  const items = this.board.items;
1869
- const item = items.getById(operation.item);
1870
- if (!item) {
1869
+ const item2 = items.getById(operation.item);
1870
+ if (!item2) {
1871
1871
  throw new Error("Get reverse board operation. Item not found");
1872
1872
  }
1873
- const zIndex = this.board.getZIndex(item);
1873
+ const zIndex = this.board.getZIndex(item2);
1874
1874
  return {
1875
1875
  class: "Board",
1876
1876
  method: "moveToZIndex",
@@ -1880,8 +1880,8 @@ class BoardCommand {
1880
1880
  }
1881
1881
  case "moveManyToZIndex": {
1882
1882
  for (const id in operation.item) {
1883
- const item = this.board.items.getById(id);
1884
- if (!item) {
1883
+ const item2 = this.board.items.getById(id);
1884
+ if (!item2) {
1885
1885
  delete operation.item.id;
1886
1886
  }
1887
1887
  }
@@ -1898,15 +1898,15 @@ class BoardCommand {
1898
1898
  const items = this.board.items;
1899
1899
  const reverse = [];
1900
1900
  for (const itemId of operation.item) {
1901
- const item = items.getById(itemId);
1902
- if (!item) {
1901
+ const item2 = items.getById(itemId);
1902
+ if (!item2) {
1903
1903
  throw new Error("Get reverse board operation. Item not found");
1904
1904
  }
1905
1905
  reverse.push({
1906
1906
  class: "Board",
1907
1907
  method: "add",
1908
1908
  item: itemId,
1909
- data: item.serialize()
1909
+ data: item2.serialize()
1910
1910
  });
1911
1911
  }
1912
1912
  return reverse;
@@ -1929,32 +1929,32 @@ class BoardCommand {
1929
1929
  const items = this.board.items;
1930
1930
  const reverse = [];
1931
1931
  for (const itemId of operation.item) {
1932
- const item = items.getById(itemId);
1933
- if (!item || item.itemType !== "Group") {
1932
+ const item2 = items.getById(itemId);
1933
+ if (!item2 || item2.itemType !== "Group") {
1934
1934
  throw new Error("Get reverse board operation. Item not found");
1935
1935
  }
1936
1936
  reverse.push({
1937
1937
  class: "Board",
1938
1938
  method: "addLockedGroup",
1939
1939
  item: itemId,
1940
- data: item.serialize()
1940
+ data: item2.serialize()
1941
1941
  });
1942
1942
  }
1943
1943
  return reverse;
1944
1944
  }
1945
1945
  case "duplicate":
1946
1946
  case "paste": {
1947
- const item = [];
1947
+ const item2 = [];
1948
1948
  const map = operation.itemsMap;
1949
1949
  for (const key in map) {
1950
1950
  if (map.hasOwnProperty(key)) {
1951
- item.push(key);
1951
+ item2.push(key);
1952
1952
  }
1953
1953
  }
1954
1954
  return {
1955
1955
  class: "Board",
1956
1956
  method: "remove",
1957
- item
1957
+ item: item2
1958
1958
  };
1959
1959
  }
1960
1960
  }
@@ -8272,11 +8272,11 @@ class SubjectOperation {
8272
8272
  }
8273
8273
 
8274
8274
  // src/Items/ItemsCommandUtils.ts
8275
- function mapItemsByOperation(item, getCallback) {
8276
- const items = Array.isArray(item) ? item : [item];
8277
- return items.map((item2) => {
8278
- const operation = getCallback(item2);
8279
- return { item: item2, operation };
8275
+ function mapItemsByOperation(item2, getCallback) {
8276
+ const items = Array.isArray(item2) ? item2 : [item2];
8277
+ return items.map((item3) => {
8278
+ const operation = getCallback(item3);
8279
+ return { item: item3, operation };
8280
8280
  });
8281
8281
  }
8282
8282
 
@@ -8301,8 +8301,8 @@ class TransformationCommand {
8301
8301
  }
8302
8302
  }
8303
8303
  revert() {
8304
- this.reverse.forEach(({ item, operation }) => {
8305
- item.apply(operation);
8304
+ this.reverse.forEach(({ item: item2, operation }) => {
8305
+ item2.apply(operation);
8306
8306
  });
8307
8307
  }
8308
8308
  getReverse() {
@@ -9044,8 +9044,8 @@ class Path {
9044
9044
  }
9045
9045
  getIntersectionPoints(segment) {
9046
9046
  let intersections = [];
9047
- for (const item of this.segments) {
9048
- intersections = intersections.concat(item.getIntersectionPoints(segment));
9047
+ for (const item2 of this.segments) {
9048
+ intersections = intersections.concat(item2.getIntersectionPoints(segment));
9049
9049
  }
9050
9050
  return intersections;
9051
9051
  }
@@ -9110,8 +9110,8 @@ class Path {
9110
9110
  }
9111
9111
  isOpenEnclosedOrCrossedBy(rectangle) {
9112
9112
  let is = false;
9113
- for (const item of this.segments) {
9114
- is = is || item.isEnclosedOrCrossedBy(rectangle);
9113
+ for (const item2 of this.segments) {
9114
+ is = is || item2.isEnclosedOrCrossedBy(rectangle);
9115
9115
  }
9116
9116
  return is;
9117
9117
  }
@@ -9524,8 +9524,8 @@ class ConnectorCommand {
9524
9524
  }
9525
9525
  }
9526
9526
  revert() {
9527
- for (const { item, operation } of this.reverse) {
9528
- item.apply(operation);
9527
+ for (const { item: item2, operation } of this.reverse) {
9528
+ item2.apply(operation);
9529
9529
  }
9530
9530
  }
9531
9531
  getReverse() {
@@ -9682,11 +9682,11 @@ class SessionStorage {
9682
9682
  }
9683
9683
  get(key) {
9684
9684
  const boardId = this.getBoardId() || "";
9685
- const item = _sessionStorage.getItem(boardId + "_" + key);
9686
- if (!item) {
9685
+ const item2 = _sessionStorage.getItem(boardId + "_" + key);
9686
+ if (!item2) {
9687
9687
  return;
9688
9688
  }
9689
- return JSON.parse(item);
9689
+ return JSON.parse(item2);
9690
9690
  }
9691
9691
  remove(key) {
9692
9692
  const boardId = this.getBoardId() || "";
@@ -10466,8 +10466,8 @@ class LinkToCommand {
10466
10466
  }
10467
10467
  }
10468
10468
  revert() {
10469
- this.reverse.forEach(({ item, operation }) => {
10470
- item.apply(operation);
10469
+ this.reverse.forEach(({ item: item2, operation }) => {
10470
+ item2.apply(operation);
10471
10471
  });
10472
10472
  }
10473
10473
  getReverse() {
@@ -11552,9 +11552,9 @@ function handleSplitListItem(editor) {
11552
11552
  import_slate4.Transforms.insertNodes(editor, {
11553
11553
  type: listType,
11554
11554
  listLevel: listNode.listLevel || 0,
11555
- children: itemsAfter.map((item) => ({
11555
+ children: itemsAfter.map((item2) => ({
11556
11556
  type: "list_item",
11557
- children: item.children
11557
+ children: item2.children
11558
11558
  }))
11559
11559
  }, { at: newListPath });
11560
11560
  }
@@ -15412,10 +15412,10 @@ function initializeDocument(effects) {
15412
15412
  return start;
15413
15413
  function start(code) {
15414
15414
  if (continued < stack.length) {
15415
- const item = stack[continued];
15416
- self2.containerState = item[1];
15417
- ok(item[0].continuation, "expected `continuation` to be defined on container construct");
15418
- return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
15415
+ const item2 = stack[continued];
15416
+ self2.containerState = item2[1];
15417
+ ok(item2[0].continuation, "expected `continuation` to be defined on container construct");
15418
+ return effects.attempt(item2[0].continuation, documentContinue, checkNewContainers)(code);
15419
15419
  }
15420
15420
  return checkNewContainers(code);
15421
15421
  }
@@ -16391,17 +16391,17 @@ class SpliceBuffer {
16391
16391
  this.setCursor(Number.POSITIVE_INFINITY);
16392
16392
  return this.left.pop();
16393
16393
  }
16394
- push(item) {
16394
+ push(item2) {
16395
16395
  this.setCursor(Number.POSITIVE_INFINITY);
16396
- this.left.push(item);
16396
+ this.left.push(item2);
16397
16397
  }
16398
16398
  pushMany(items) {
16399
16399
  this.setCursor(Number.POSITIVE_INFINITY);
16400
16400
  chunkedPush(this.left, items);
16401
16401
  }
16402
- unshift(item) {
16402
+ unshift(item2) {
16403
16403
  this.setCursor(0);
16404
- this.right.push(item);
16404
+ this.right.push(item2);
16405
16405
  }
16406
16406
  unshiftMany(items) {
16407
16407
  this.setCursor(0);
@@ -18432,8 +18432,8 @@ function initializeFactory(field) {
18432
18432
  if (list2) {
18433
18433
  ok(Array.isArray(list2), "expected `disable.null` to be populated");
18434
18434
  while (++index2 < list2.length) {
18435
- const item = list2[index2];
18436
- if (!item.previous || item.previous.call(self2, self2.previous)) {
18435
+ const item2 = list2[index2];
18436
+ if (!item2.previous || item2.previous.call(self2, self2.previous)) {
18437
18437
  return true;
18438
18438
  }
18439
18439
  }
@@ -19264,14 +19264,14 @@ function compiler(options) {
19264
19264
  length++;
19265
19265
  }
19266
19266
  if (event[1].type === types.listItemPrefix) {
19267
- const item = {
19267
+ const item2 = {
19268
19268
  type: "listItem",
19269
19269
  _spread: false,
19270
19270
  start: Object.assign({}, event[1].start),
19271
19271
  end: undefined
19272
19272
  };
19273
- listItem2 = item;
19274
- events.splice(index2, 0, ["enter", item, event[2]]);
19273
+ listItem2 = item2;
19274
+ events.splice(index2, 0, ["enter", item2, event[2]]);
19275
19275
  index2++;
19276
19276
  length++;
19277
19277
  firstBlankLineIndex = undefined;
@@ -19903,14 +19903,14 @@ class MarkdownProcessor {
19903
19903
  if (err || !file) {
19904
19904
  throw err;
19905
19905
  }
19906
- const nodes = file.result.map((item) => {
19906
+ const nodes = file.result.map((item2) => {
19907
19907
  setNodeStyles({
19908
- node: item,
19908
+ node: item2,
19909
19909
  editor: this.editor,
19910
19910
  horisontalAlignment: "left",
19911
- isPaddingTopNeeded: item.type !== "code_block"
19911
+ isPaddingTopNeeded: item2.type !== "code_block"
19912
19912
  });
19913
- return item;
19913
+ return item2;
19914
19914
  });
19915
19915
  if (isNewParagraphNeeded) {
19916
19916
  nodes.push(createParagraphNode("", this.editor));
@@ -20888,8 +20888,8 @@ class ShapeCommand {
20888
20888
  }
20889
20889
  }
20890
20890
  revert() {
20891
- for (const { item, operation } of this.reverse) {
20892
- item.apply(operation);
20891
+ for (const { item: item2, operation } of this.reverse) {
20892
+ item2.apply(operation);
20893
20893
  }
20894
20894
  }
20895
20895
  getReverse() {
@@ -20971,8 +20971,8 @@ class RichTextCommand {
20971
20971
  }
20972
20972
  }
20973
20973
  revert() {
20974
- for (const { item, operation } of this.reverse) {
20975
- const richText = this.board.items.getById(item);
20974
+ for (const { item: item2, operation } of this.reverse) {
20975
+ const richText = this.board.items.getById(item2);
20976
20976
  if (!richText) {
20977
20977
  continue;
20978
20978
  }
@@ -20991,12 +20991,12 @@ class RichTextCommand {
20991
20991
  case "setSelectionFontColor":
20992
20992
  case "setSelectionBlockType":
20993
20993
  const inverseOps = this.operation.ops.map((op) => import_slate33.Operation.inverse(op)).reverse();
20994
- return items.map((item) => {
20994
+ return items.map((item2) => {
20995
20995
  const operation = {
20996
20996
  ...this.operation,
20997
20997
  ops: inverseOps
20998
20998
  };
20999
- return { item, operation };
20999
+ return { item: item2, operation };
21000
21000
  });
21001
21001
  case "setFontColor":
21002
21002
  return items.map((id) => ({
@@ -21088,13 +21088,13 @@ class RichTextGroupCommand {
21088
21088
  this.reverseOps = this.getReverse();
21089
21089
  }
21090
21090
  apply() {
21091
- for (const { item, operation } of this.forwardOps) {
21092
- item.applyCommand(operation);
21091
+ for (const { item: item2, operation } of this.forwardOps) {
21092
+ item2.applyCommand(operation);
21093
21093
  }
21094
21094
  }
21095
21095
  revert() {
21096
- for (const { item, operation } of this.reverseOps) {
21097
- item.applyCommand(operation);
21096
+ for (const { item: item2, operation } of this.reverseOps) {
21097
+ item2.applyCommand(operation);
21098
21098
  }
21099
21099
  }
21100
21100
  getForward() {
@@ -21209,8 +21209,8 @@ class DrawingCommand {
21209
21209
  item;
21210
21210
  operation;
21211
21211
  reverse;
21212
- constructor(item, operation) {
21213
- this.item = item;
21212
+ constructor(item2, operation) {
21213
+ this.item = item2;
21214
21214
  this.operation = operation;
21215
21215
  this.reverse = this.getReverse();
21216
21216
  }
@@ -21219,52 +21219,52 @@ class DrawingCommand {
21219
21219
  return this;
21220
21220
  }
21221
21221
  apply() {
21222
- for (const item of this.item) {
21223
- item.apply(this.operation);
21222
+ for (const item2 of this.item) {
21223
+ item2.apply(this.operation);
21224
21224
  }
21225
21225
  }
21226
21226
  revert() {
21227
- for (const { item, operation } of this.reverse) {
21228
- item.apply(operation);
21227
+ for (const { item: item2, operation } of this.reverse) {
21228
+ item2.apply(operation);
21229
21229
  }
21230
21230
  }
21231
21231
  getReverse() {
21232
21232
  const reverse = [];
21233
- for (const item of this.item) {
21234
- reverse.push({ item, operation: this.getReverseOperation(item) });
21233
+ for (const item2 of this.item) {
21234
+ reverse.push({ item: item2, operation: this.getReverseOperation(item2) });
21235
21235
  }
21236
21236
  return reverse;
21237
21237
  }
21238
- getReverseOperation(item) {
21238
+ getReverseOperation(item2) {
21239
21239
  switch (this.operation.method) {
21240
21240
  case "setStrokeColor":
21241
21241
  return {
21242
21242
  class: "Drawing",
21243
21243
  method: "setStrokeColor",
21244
- item: [item.getId()],
21245
- color: item.getStrokeColor()
21244
+ item: [item2.getId()],
21245
+ color: item2.getStrokeColor()
21246
21246
  };
21247
21247
  case "setStrokeWidth":
21248
21248
  return {
21249
21249
  class: "Drawing",
21250
21250
  method: "setStrokeWidth",
21251
- item: [item.getId()],
21251
+ item: [item2.getId()],
21252
21252
  width: this.operation.prevWidth,
21253
- prevWidth: item.getStrokeWidth()
21253
+ prevWidth: item2.getStrokeWidth()
21254
21254
  };
21255
21255
  case "setStrokeOpacity":
21256
21256
  return {
21257
21257
  class: "Drawing",
21258
21258
  method: "setStrokeOpacity",
21259
- item: [item.getId()],
21260
- opacity: item.getStrokeOpacity()
21259
+ item: [item2.getId()],
21260
+ opacity: item2.getStrokeOpacity()
21261
21261
  };
21262
21262
  case "setStrokeStyle":
21263
21263
  return {
21264
21264
  class: "Drawing",
21265
21265
  method: "setStrokeStyle",
21266
- item: [item.getId()],
21267
- style: item.getBorderStyle()
21266
+ item: [item2.getId()],
21267
+ style: item2.getBorderStyle()
21268
21268
  };
21269
21269
  }
21270
21270
  }
@@ -21286,8 +21286,8 @@ class StickerCommand {
21286
21286
  }
21287
21287
  }
21288
21288
  revert() {
21289
- for (const { item, operation } of this.reverse) {
21290
- item.apply(operation);
21289
+ for (const { item: item2, operation } of this.reverse) {
21290
+ item2.apply(operation);
21291
21291
  }
21292
21292
  }
21293
21293
  getReverse() {
@@ -21319,8 +21319,8 @@ class FrameCommand {
21319
21319
  }
21320
21320
  }
21321
21321
  revert() {
21322
- for (const { item, operation } of this.reverse) {
21323
- item.apply(operation);
21322
+ for (const { item: item2, operation } of this.reverse) {
21323
+ item2.apply(operation);
21324
21324
  }
21325
21325
  }
21326
21326
  getReverse() {
@@ -21361,6 +21361,22 @@ class FrameCommand {
21361
21361
  children: frame2.getChildrenIds()
21362
21362
  };
21363
21363
  });
21364
+ default:
21365
+ const op = this.operation;
21366
+ let newData = {};
21367
+ if (op.prevData) {
21368
+ newData = { ...op.prevData };
21369
+ } else {
21370
+ Object.keys(op.newData).forEach((key) => {
21371
+ if (item[key]) {
21372
+ newData[key] = item[key];
21373
+ }
21374
+ });
21375
+ }
21376
+ return {
21377
+ ...op,
21378
+ newData
21379
+ };
21364
21380
  }
21365
21381
  }
21366
21382
  }
@@ -21381,8 +21397,8 @@ class CommentCommand {
21381
21397
  }
21382
21398
  }
21383
21399
  revert() {
21384
- this.reverse.forEach(({ item, operation }) => {
21385
- item.apply(operation);
21400
+ this.reverse.forEach(({ item: item2, operation }) => {
21401
+ item2.apply(operation);
21386
21402
  });
21387
21403
  }
21388
21404
  getReverse() {
@@ -21843,8 +21859,8 @@ class GroupCommand {
21843
21859
  }
21844
21860
  }
21845
21861
  revert() {
21846
- for (const { item, operation } of this.reverse) {
21847
- item.apply(operation);
21862
+ for (const { item: item2, operation } of this.reverse) {
21863
+ item2.apply(operation);
21848
21864
  }
21849
21865
  }
21850
21866
  getReverse() {
@@ -21897,8 +21913,8 @@ class PlaceholderCommand {
21897
21913
  }
21898
21914
  }
21899
21915
  revert() {
21900
- for (const { item, operation } of this.reverse) {
21901
- item.apply(operation);
21916
+ for (const { item: item2, operation } of this.reverse) {
21917
+ item2.apply(operation);
21902
21918
  }
21903
21919
  }
21904
21920
  getReverse() {
@@ -21992,26 +22008,26 @@ class BaseCommand {
21992
22008
  return this;
21993
22009
  }
21994
22010
  apply() {
21995
- for (const item of this.items) {
21996
- item.apply(this.operation);
22011
+ for (const item2 of this.items) {
22012
+ item2.apply(this.operation);
21997
22013
  }
21998
22014
  }
21999
22015
  revert() {
22000
- for (const { item, operation } of this.reverse) {
22001
- item.apply(operation);
22016
+ for (const { item: item2, operation } of this.reverse) {
22017
+ item2.apply(operation);
22002
22018
  }
22003
22019
  }
22004
22020
  getReverse() {
22005
22021
  const items = this.items;
22006
- return mapItemsByOperation(items, (item) => {
22022
+ return mapItemsByOperation(items, (item2) => {
22007
22023
  const op = this.operation;
22008
22024
  let newData = {};
22009
22025
  if (op.prevData) {
22010
22026
  newData = { ...op.prevData };
22011
22027
  } else {
22012
22028
  Object.keys(op.newData).forEach((key) => {
22013
- if (item[key]) {
22014
- newData[key] = item[key];
22029
+ if (item2[key]) {
22030
+ newData[key] = item2[key];
22015
22031
  }
22016
22032
  });
22017
22033
  }
@@ -22039,37 +22055,37 @@ var itemCommandFactories = {
22039
22055
  LinkTo: createLinkToCommand
22040
22056
  };
22041
22057
  function createConnectorCommand(items, operation) {
22042
- return new ConnectorCommand(items.filter((item) => item.itemType === "Connector"), operation);
22058
+ return new ConnectorCommand(items.filter((item2) => item2.itemType === "Connector"), operation);
22043
22059
  }
22044
22060
  function createShapeCommand(items, operation) {
22045
- return new ShapeCommand(items.filter((item) => item.itemType === "Shape"), operation);
22061
+ return new ShapeCommand(items.filter((item2) => item2.itemType === "Shape"), operation);
22046
22062
  }
22047
22063
  function createDrawingCommand(items, operation) {
22048
- return new DrawingCommand(items.filter((item) => item.itemType === "Drawing"), operation);
22064
+ return new DrawingCommand(items.filter((item2) => item2.itemType === "Drawing"), operation);
22049
22065
  }
22050
22066
  function createCommentCommand(items, operation) {
22051
- return new CommentCommand(items.filter((item) => item.itemType === "Comment"), operation);
22067
+ return new CommentCommand(items.filter((item2) => item2.itemType === "Comment"), operation);
22052
22068
  }
22053
22069
  function createStickerCommand(items, operation) {
22054
- return new StickerCommand(items.filter((item) => item.itemType === "Sticker"), operation);
22070
+ return new StickerCommand(items.filter((item2) => item2.itemType === "Sticker"), operation);
22055
22071
  }
22056
22072
  function createFrameCommand(items, operation) {
22057
- return new FrameCommand(items.filter((item) => item.itemType === "Frame"), operation);
22073
+ return new FrameCommand(items.filter((item2) => item2.itemType === "Frame"), operation);
22058
22074
  }
22059
22075
  function createPlaceholderCommand(items, operation) {
22060
- return new PlaceholderCommand(items.filter((item) => item.itemType === "Placeholder"), operation);
22076
+ return new PlaceholderCommand(items.filter((item2) => item2.itemType === "Placeholder"), operation);
22061
22077
  }
22062
22078
  function createGroupCommand(items, operation) {
22063
- return new GroupCommand(items.filter((item) => item.itemType === "Group"), operation);
22079
+ return new GroupCommand(items.filter((item2) => item2.itemType === "Group"), operation);
22064
22080
  }
22065
22081
  function createImageCommand(items, operation) {
22066
- return new ImageCommand(items.filter((item) => item.itemType === "Image"), operation);
22082
+ return new ImageCommand(items.filter((item2) => item2.itemType === "Image"), operation);
22067
22083
  }
22068
22084
  function createVideoCommand(items, operation) {
22069
- return new VideoCommand(items.filter((item) => item.itemType === "Video"), operation);
22085
+ return new VideoCommand(items.filter((item2) => item2.itemType === "Video"), operation);
22070
22086
  }
22071
22087
  function createAudioCommand(items, operation) {
22072
- return new AudioCommand(items.filter((item) => item.itemType === "Audio"), operation);
22088
+ return new AudioCommand(items.filter((item2) => item2.itemType === "Audio"), operation);
22073
22089
  }
22074
22090
  function createRichTextCommand(items, operation, board) {
22075
22091
  if (!board) {
@@ -22077,8 +22093,8 @@ function createRichTextCommand(items, operation, board) {
22077
22093
  }
22078
22094
  if (operation.method === "groupEdit") {
22079
22095
  const texts = [];
22080
- for (const { item } of operation.itemsOps) {
22081
- const found = board.items.findById(item);
22096
+ for (const { item: item2 } of operation.itemsOps) {
22097
+ const found = board.items.findById(item2);
22082
22098
  const text3 = found?.getRichText();
22083
22099
  if (text3) {
22084
22100
  texts.push(text3);
@@ -22086,14 +22102,14 @@ function createRichTextCommand(items, operation, board) {
22086
22102
  }
22087
22103
  return new RichTextGroupCommand(texts, operation);
22088
22104
  } else {
22089
- return new RichTextCommand(board, items.map((item) => item.getId()), operation);
22105
+ return new RichTextCommand(board, items.map((item2) => item2.getId()), operation);
22090
22106
  }
22091
22107
  }
22092
22108
  function createTransformationCommand(items, operation) {
22093
- return new TransformationCommand(items.map((item) => item.transformation), operation);
22109
+ return new TransformationCommand(items.map((item2) => item2.transformation), operation);
22094
22110
  }
22095
22111
  function createLinkToCommand(items, operation) {
22096
- return new LinkToCommand(items.map((item) => item.linkTo), operation);
22112
+ return new LinkToCommand(items.map((item2) => item2.linkTo), operation);
22097
22113
  }
22098
22114
  function createCommand(board, operation) {
22099
22115
  try {
@@ -22111,13 +22127,13 @@ function createCommand(board, operation) {
22111
22127
  default: {
22112
22128
  const itemType = operation.class;
22113
22129
  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);
22114
- const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item) => {
22115
- if (typeof item === "string") {
22116
- console.warn(`Item with ID ${item} not found for operation ${operation.class}.${operation.method}`);
22130
+ const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item2) => {
22131
+ if (typeof item2 === "string") {
22132
+ console.warn(`Item with ID ${item2} not found for operation ${operation.class}.${operation.method}`);
22117
22133
  return false;
22118
22134
  }
22119
- if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item.itemType !== operation.class) {
22120
- console.warn(`Item with ID ${item} is not of operation type: ${itemType}.`);
22135
+ if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item2.itemType !== operation.class) {
22136
+ console.warn(`Item with ID ${item2} is not of operation type: ${itemType}.`);
22121
22137
  return false;
22122
22138
  }
22123
22139
  return true;
@@ -22418,20 +22434,20 @@ class RBush {
22418
22434
  }
22419
22435
  return this;
22420
22436
  }
22421
- insert(item) {
22422
- if (item)
22423
- this._insert(item, this.data.height - 1);
22437
+ insert(item2) {
22438
+ if (item2)
22439
+ this._insert(item2, this.data.height - 1);
22424
22440
  return this;
22425
22441
  }
22426
22442
  clear() {
22427
22443
  this.data = createNode([]);
22428
22444
  return this;
22429
22445
  }
22430
- remove(item, equalsFn) {
22431
- if (!item)
22446
+ remove(item2, equalsFn) {
22447
+ if (!item2)
22432
22448
  return this;
22433
22449
  let node2 = this.data;
22434
- const bbox = this.toBBox(item);
22450
+ const bbox = this.toBBox(item2);
22435
22451
  const path2 = [];
22436
22452
  const indexes = [];
22437
22453
  let i, parent, goingUp;
@@ -22443,7 +22459,7 @@ class RBush {
22443
22459
  goingUp = true;
22444
22460
  }
22445
22461
  if (node2.leaf) {
22446
- const index2 = findItem(item, node2.children, equalsFn);
22462
+ const index2 = findItem(item2, node2.children, equalsFn);
22447
22463
  if (index2 !== -1) {
22448
22464
  node2.children.splice(index2, 1);
22449
22465
  path2.push(node2);
@@ -22466,8 +22482,8 @@ class RBush {
22466
22482
  }
22467
22483
  return this;
22468
22484
  }
22469
- toBBox(item) {
22470
- return item;
22485
+ toBBox(item2) {
22486
+ return item2;
22471
22487
  }
22472
22488
  compareMinX(a, b) {
22473
22489
  return a.minX - b.minX;
@@ -22550,11 +22566,11 @@ class RBush {
22550
22566
  }
22551
22567
  return node2;
22552
22568
  }
22553
- _insert(item, level, isNode) {
22554
- const bbox = isNode ? item : this.toBBox(item);
22569
+ _insert(item2, level, isNode) {
22570
+ const bbox = isNode ? item2 : this.toBBox(item2);
22555
22571
  const insertPath = [];
22556
22572
  const node2 = this._chooseSubtree(bbox, this.data, level, insertPath);
22557
- node2.children.push(item);
22573
+ node2.children.push(item2);
22558
22574
  extend2(node2, bbox);
22559
22575
  while (level >= 0) {
22560
22576
  if (insertPath[level].children.length > this._maxEntries) {
@@ -22653,11 +22669,11 @@ class RBush {
22653
22669
  }
22654
22670
  }
22655
22671
  }
22656
- function findItem(item, items, equalsFn) {
22672
+ function findItem(item2, items, equalsFn) {
22657
22673
  if (!equalsFn)
22658
- return items.indexOf(item);
22674
+ return items.indexOf(item2);
22659
22675
  for (let i = 0;i < items.length; i++) {
22660
- if (equalsFn(item, items[i]))
22676
+ if (equalsFn(item2, items[i]))
22661
22677
  return i;
22662
22678
  }
22663
22679
  return -1;
@@ -22819,10 +22835,10 @@ class RTreeIndex {
22819
22835
  return container ? container.item : undefined;
22820
22836
  }
22821
22837
  remove(id) {
22822
- const item = this.map.get(id);
22823
- if (item) {
22838
+ const item2 = this.map.get(id);
22839
+ if (item2) {
22824
22840
  this.map.delete(id);
22825
- this.tree.remove(item);
22841
+ this.tree.remove(item2);
22826
22842
  }
22827
22843
  }
22828
22844
  list() {
@@ -22894,11 +22910,11 @@ class Container extends Mbr {
22894
22910
  item;
22895
22911
  layer;
22896
22912
  zIndex;
22897
- constructor(id, item, layer, zIndex) {
22898
- const rect = item.getMbrWithChildren();
22913
+ constructor(id, item2, layer, zIndex) {
22914
+ const rect = item2.getMbrWithChildren();
22899
22915
  super(rect.left, rect.top, rect.right, rect.bottom);
22900
22916
  this.id = id;
22901
- this.item = item;
22917
+ this.item = item2;
22902
22918
  this.layer = layer;
22903
22919
  this.zIndex = zIndex;
22904
22920
  }
@@ -22915,7 +22931,7 @@ class LayeredIndex {
22915
22931
  this.getZIndex = this.getZIndex.bind(this);
22916
22932
  this.layers.newOnTop();
22917
22933
  }
22918
- isT(item) {
22934
+ isT(item2) {
22919
22935
  return true;
22920
22936
  }
22921
22937
  findById(id) {
@@ -22979,8 +22995,8 @@ class LayeredIndex {
22979
22995
  }
22980
22996
  getContainersFromItems(items) {
22981
22997
  const containers = [];
22982
- for (const item of items) {
22983
- const container = this.map.get(item.getId());
22998
+ for (const item2 of items) {
22999
+ const container = this.map.get(item2.getId());
22984
23000
  if (container) {
22985
23001
  containers.push(container);
22986
23002
  }
@@ -23057,9 +23073,9 @@ class LayeredIndex {
23057
23073
  }
23058
23074
  }
23059
23075
  }
23060
- insert(item) {
23061
- const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
23062
- const bounds = item.getMbrWithChildren();
23076
+ insert(item2) {
23077
+ const toInsert = new Container(item2.getId(), item2, 0, this.getZIndex(item2));
23078
+ const bounds = item2.getMbrWithChildren();
23063
23079
  const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
23064
23080
  if (inBounds.length === 0) {
23065
23081
  return this.insertContainer(toInsert);
@@ -23126,20 +23142,20 @@ class LayeredIndex {
23126
23142
  }
23127
23143
  }
23128
23144
  }
23129
- change(item) {
23130
- const id = item.getId();
23145
+ change(item2) {
23146
+ const id = item2.getId();
23131
23147
  const container = this.map.get(id);
23132
23148
  if (container) {
23133
23149
  const layer = this.layers.get(container.layer);
23134
23150
  if (layer) {
23135
23151
  layer.remove(id);
23136
23152
  this.map.delete(id);
23137
- this.insert(item);
23153
+ this.insert(item2);
23138
23154
  }
23139
23155
  }
23140
23156
  }
23141
- remove(item) {
23142
- const id = item.getId();
23157
+ remove(item2) {
23158
+ const id = item2.getId();
23143
23159
  const container = this.map.get(id);
23144
23160
  if (container) {
23145
23161
  const layer = this.layers.get(container.layer);
@@ -23165,13 +23181,13 @@ class LayeredIndex {
23165
23181
  return items;
23166
23182
  }
23167
23183
  batchInsert(items) {
23168
- for (const item of items) {
23169
- this.insert(item);
23184
+ for (const item2 of items) {
23185
+ this.insert(item2);
23170
23186
  }
23171
23187
  }
23172
23188
  batchChange(items) {
23173
- for (const item of items) {
23174
- this.change(item);
23189
+ for (const item2 of items) {
23190
+ this.change(item2);
23175
23191
  }
23176
23192
  }
23177
23193
  }
@@ -23180,8 +23196,8 @@ class LayeredIndex {
23180
23196
  class SpatialIndex {
23181
23197
  subject = new Subject;
23182
23198
  itemsArray = [];
23183
- itemsIndex = new LayeredIndex((item) => {
23184
- return this.itemsArray.indexOf(item);
23199
+ itemsIndex = new LayeredIndex((item2) => {
23200
+ return this.itemsArray.indexOf(item2);
23185
23201
  });
23186
23202
  Mbr = new Mbr;
23187
23203
  items;
@@ -23190,79 +23206,79 @@ class SpatialIndex {
23190
23206
  }
23191
23207
  clear() {
23192
23208
  this.itemsArray = [];
23193
- this.itemsIndex = new LayeredIndex((item) => {
23194
- return this.itemsArray.indexOf(item);
23209
+ this.itemsIndex = new LayeredIndex((item2) => {
23210
+ return this.itemsArray.indexOf(item2);
23195
23211
  });
23196
23212
  this.Mbr = new Mbr;
23197
23213
  }
23198
- insert(item) {
23199
- this.itemsArray.push(item);
23200
- this.itemsIndex.insert(item);
23214
+ insert(item2) {
23215
+ this.itemsArray.push(item2);
23216
+ this.itemsIndex.insert(item2);
23201
23217
  if (conf.isNode()) {
23202
23218
  return;
23203
23219
  }
23204
23220
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23205
- this.Mbr = item.getMbr().copy();
23221
+ this.Mbr = item2.getMbr().copy();
23206
23222
  } else {
23207
- this.Mbr.combine([item.getMbr()]);
23223
+ this.Mbr.combine([item2.getMbr()]);
23208
23224
  }
23209
- item.subject.subscribe(this.change);
23225
+ item2.subject.subscribe(this.change);
23210
23226
  this.subject.publish(this.items);
23211
23227
  }
23212
- change = (item) => {
23213
- this.itemsIndex.change(item);
23228
+ change = (item2) => {
23229
+ this.itemsIndex.change(item2);
23214
23230
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23215
- this.Mbr = item.getMbrWithChildren().copy();
23231
+ this.Mbr = item2.getMbrWithChildren().copy();
23216
23232
  } else {
23217
- this.Mbr.combine([item.getMbrWithChildren()]);
23233
+ this.Mbr.combine([item2.getMbrWithChildren()]);
23218
23234
  }
23219
23235
  this.subject.publish(this.items);
23220
23236
  };
23221
- remove(item) {
23222
- if ("index" in item && item.index) {
23223
- item.removeChildItems(item.index.list());
23237
+ remove(item2) {
23238
+ if ("index" in item2 && item2.index) {
23239
+ item2.removeChildItems(item2.index.list());
23224
23240
  }
23225
- this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
23226
- this.itemsIndex.remove(item);
23241
+ this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
23242
+ this.itemsIndex.remove(item2);
23227
23243
  this.Mbr = new Mbr;
23228
- this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbrWithChildren()]));
23244
+ this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbrWithChildren()]));
23229
23245
  this.subject.publish(this.items);
23230
23246
  }
23231
23247
  copy() {
23232
- return this.getItemsWithIncludedChildren(this.itemsArray).map((item) => ({
23233
- ...item.serialize(true),
23234
- id: item.getId()
23248
+ return this.getItemsWithIncludedChildren(this.itemsArray).map((item2) => ({
23249
+ ...item2.serialize(true),
23250
+ id: item2.getId()
23235
23251
  }));
23236
23252
  }
23237
23253
  getItemsWithIncludedChildren(items) {
23238
- return items.flatMap((item) => {
23239
- if ("index" in item && item.index) {
23240
- return [item, ...item.index.list()];
23254
+ return items.flatMap((item2) => {
23255
+ if ("index" in item2 && item2.index) {
23256
+ return [item2, ...item2.index.list()];
23241
23257
  }
23242
- return item;
23258
+ return item2;
23243
23259
  });
23244
23260
  }
23245
- getItemChildren(item) {
23246
- if ("index" in item && item.index) {
23247
- return item.index.list();
23261
+ getItemChildren(item2) {
23262
+ if ("index" in item2 && item2.index) {
23263
+ return item2.index.list();
23248
23264
  }
23249
23265
  return [];
23250
23266
  }
23251
- getItemParent(item) {
23252
- if (item.parent === "Board") {
23267
+ getItemParent(item2) {
23268
+ if (item2.parent === "Board") {
23253
23269
  return;
23254
23270
  }
23255
- return this.getById(item.parent);
23271
+ return this.getById(item2.parent);
23256
23272
  }
23257
- moveToZIndex(item, zIndex) {
23258
- const index2 = this.itemsArray.indexOf(item);
23273
+ moveToZIndex(item2, zIndex) {
23274
+ const index2 = this.itemsArray.indexOf(item2);
23259
23275
  this.itemsArray.splice(index2, 1);
23260
- this.itemsArray.splice(zIndex, 0, item);
23261
- this.change(item);
23276
+ this.itemsArray.splice(zIndex, 0, item2);
23277
+ this.change(item2);
23262
23278
  this.subject.publish(this.items);
23263
23279
  }
23264
23280
  moveManyToZIndex(itemsRecord) {
23265
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
23281
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
23266
23282
  const zIndex = Object.values(itemsRecord);
23267
23283
  for (let i = 0;i < zIndex.length; i++) {
23268
23284
  const index2 = zIndex[i];
@@ -23270,39 +23286,39 @@ class SpatialIndex {
23270
23286
  }
23271
23287
  this.itemsArray.forEach(this.change.bind(this));
23272
23288
  }
23273
- sendToBack(item, shouldPublish = true) {
23274
- const index2 = this.itemsArray.indexOf(item);
23289
+ sendToBack(item2, shouldPublish = true) {
23290
+ const index2 = this.itemsArray.indexOf(item2);
23275
23291
  this.itemsArray.splice(index2, 1);
23276
- this.itemsArray.unshift(item);
23277
- this.itemsIndex.change(item);
23292
+ this.itemsArray.unshift(item2);
23293
+ this.itemsIndex.change(item2);
23278
23294
  if (shouldPublish) {
23279
23295
  this.subject.publish(this.items);
23280
23296
  }
23281
23297
  }
23282
23298
  sendManyToBack(items) {
23283
23299
  const newItems = [...items];
23284
- this.itemsArray.forEach((item) => {
23285
- if (!items.includes(item)) {
23286
- newItems.push(item);
23300
+ this.itemsArray.forEach((item2) => {
23301
+ if (!items.includes(item2)) {
23302
+ newItems.push(item2);
23287
23303
  }
23288
23304
  });
23289
23305
  this.itemsArray = newItems;
23290
23306
  this.itemsArray.forEach(this.change.bind(this));
23291
23307
  }
23292
- bringToFront(item, shouldPublish = true) {
23293
- const index2 = this.itemsArray.indexOf(item);
23308
+ bringToFront(item2, shouldPublish = true) {
23309
+ const index2 = this.itemsArray.indexOf(item2);
23294
23310
  this.itemsArray.splice(index2, 1);
23295
- this.itemsArray.push(item);
23296
- this.itemsIndex.change(item);
23311
+ this.itemsArray.push(item2);
23312
+ this.itemsIndex.change(item2);
23297
23313
  if (shouldPublish) {
23298
23314
  this.subject.publish(this.items);
23299
23315
  }
23300
23316
  }
23301
23317
  bringManyToFront(items) {
23302
23318
  const newItems = [];
23303
- this.itemsArray.forEach((item) => {
23304
- if (!items.includes(item)) {
23305
- newItems.push(item);
23319
+ this.itemsArray.forEach((item2) => {
23320
+ if (!items.includes(item2)) {
23321
+ newItems.push(item2);
23306
23322
  }
23307
23323
  });
23308
23324
  newItems.push(...items);
@@ -23328,9 +23344,9 @@ class SpatialIndex {
23328
23344
  this.subject.publish(this.items);
23329
23345
  }
23330
23346
  getById(id) {
23331
- const item = this.getItemsWithIncludedChildren(this.itemsArray).find((item2) => item2.getId() === id);
23332
- if (item) {
23333
- return item;
23347
+ const item2 = this.getItemsWithIncludedChildren(this.itemsArray).find((item3) => item3.getId() === id);
23348
+ if (item2) {
23349
+ return item2;
23334
23350
  }
23335
23351
  }
23336
23352
  findById(id) {
@@ -23340,10 +23356,10 @@ class SpatialIndex {
23340
23356
  const mbr = new Mbr(left, top, right, bottom);
23341
23357
  const items = this.itemsIndex.getEnclosed(mbr);
23342
23358
  const children = [];
23343
- const clearItems = items.filter((item) => {
23344
- if ("index" in item && item.index) {
23345
- children.push(...item.index.getEnclosed(left, top, right, bottom));
23346
- if (!item.getMbr().isEnclosedBy(mbr)) {
23359
+ const clearItems = items.filter((item2) => {
23360
+ if ("index" in item2 && item2.index) {
23361
+ children.push(...item2.index.getEnclosed(left, top, right, bottom));
23362
+ if (!item2.getMbr().isEnclosedBy(mbr)) {
23347
23363
  return false;
23348
23364
  }
23349
23365
  }
@@ -23355,10 +23371,10 @@ class SpatialIndex {
23355
23371
  const mbr = new Mbr(left, top, right, bottom);
23356
23372
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
23357
23373
  const children = [];
23358
- const clearItems = items.filter((item) => {
23359
- if ("index" in item && item.index) {
23360
- children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
23361
- if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
23374
+ const clearItems = items.filter((item2) => {
23375
+ if ("index" in item2 && item2.index) {
23376
+ children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
23377
+ if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
23362
23378
  return false;
23363
23379
  }
23364
23380
  }
@@ -23369,10 +23385,10 @@ class SpatialIndex {
23369
23385
  getUnderPoint(point3, tolerance = 5) {
23370
23386
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
23371
23387
  const children = [];
23372
- const clearItems = items.filter((item) => {
23373
- if ("index" in item && item.index) {
23374
- children.push(...item.index.getUnderPoint(point3, tolerance));
23375
- if (!item.getMbr().isUnderPoint(point3)) {
23388
+ const clearItems = items.filter((item2) => {
23389
+ if ("index" in item2 && item2.index) {
23390
+ children.push(...item2.index.getUnderPoint(point3, tolerance));
23391
+ if (!item2.getMbr().isUnderPoint(point3)) {
23376
23392
  return false;
23377
23393
  }
23378
23394
  }
@@ -23384,10 +23400,10 @@ class SpatialIndex {
23384
23400
  const mbr = new Mbr(left, top, right, bottom);
23385
23401
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
23386
23402
  const children = [];
23387
- const clearItems = items.filter((item) => {
23388
- if ("index" in item && item.index) {
23389
- children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
23390
- if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
23403
+ const clearItems = items.filter((item2) => {
23404
+ if ("index" in item2 && item2.index) {
23405
+ children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
23406
+ if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
23391
23407
  return false;
23392
23408
  }
23393
23409
  }
@@ -23399,26 +23415,26 @@ class SpatialIndex {
23399
23415
  return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
23400
23416
  }
23401
23417
  getComments() {
23402
- return this.itemsArray.filter((item) => item instanceof Comment);
23418
+ return this.itemsArray.filter((item2) => item2 instanceof Comment);
23403
23419
  }
23404
23420
  getMbr() {
23405
23421
  return this.Mbr;
23406
23422
  }
23407
23423
  getNearestTo(point3, maxItems, filter, maxDistance) {
23408
23424
  const allItems = this.getItemsWithIncludedChildren(this.itemsArray);
23409
- const filtered = allItems.filter((item) => filter(item));
23410
- const withDistance = filtered.map((item) => ({
23411
- item,
23412
- distance: point3.getDistance(item.getMbr().getCenter())
23425
+ const filtered = allItems.filter((item2) => filter(item2));
23426
+ const withDistance = filtered.map((item2) => ({
23427
+ item: item2,
23428
+ distance: point3.getDistance(item2.getMbr().getCenter())
23413
23429
  })).filter(({ distance }) => distance <= maxDistance);
23414
23430
  withDistance.sort((a, b) => a.distance - b.distance);
23415
- return withDistance.slice(0, maxItems).map(({ item }) => item);
23431
+ return withDistance.slice(0, maxItems).map(({ item: item2 }) => item2);
23416
23432
  }
23417
23433
  list() {
23418
23434
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
23419
23435
  }
23420
- getZIndex(item) {
23421
- const index2 = this.itemsArray.indexOf(item);
23436
+ getZIndex(item2) {
23437
+ const index2 = this.itemsArray.indexOf(item2);
23422
23438
  if (index2 === -1) {
23423
23439
  return this.getLastZIndex();
23424
23440
  }
@@ -23448,14 +23464,14 @@ class Items {
23448
23464
  this.pointer = pointer;
23449
23465
  this.subject = subject;
23450
23466
  }
23451
- update(item) {
23452
- this.index.change(item);
23467
+ update(item2) {
23468
+ this.index.change(item2);
23453
23469
  }
23454
23470
  listAll() {
23455
23471
  return this.index.list();
23456
23472
  }
23457
23473
  listGroupItems() {
23458
- return this.index.list().filter((item) => ("index" in item) && item.index);
23474
+ return this.index.list().filter((item2) => ("index" in item2) && item2.index);
23459
23475
  }
23460
23476
  getById(id) {
23461
23477
  return this.index.getById(id);
@@ -23470,7 +23486,7 @@ class Items {
23470
23486
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
23471
23487
  }
23472
23488
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
23473
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
23489
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => item2 instanceof BaseItem && item2.index);
23474
23490
  }
23475
23491
  getUnderPoint(point3, tolerance = 5) {
23476
23492
  return this.index.getUnderPoint(point3, tolerance);
@@ -23498,28 +23514,28 @@ class Items {
23498
23514
  const unmodifiedSize = size;
23499
23515
  size = 16;
23500
23516
  const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
23501
- const groups = tolerated.filter((item) => item.itemType === "Group");
23517
+ const groups = tolerated.filter((item2) => item2.itemType === "Group");
23502
23518
  if (groups.length > 0) {
23503
23519
  return groups;
23504
23520
  }
23505
- let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
23521
+ let enclosed = tolerated.some((item2) => item2 instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
23506
23522
  const underPointer = this.getUnderPoint(new Point(x, y), size);
23507
23523
  if (enclosed.length === 0) {
23508
23524
  enclosed = underPointer;
23509
23525
  }
23510
- if (underPointer.some((item) => item.itemType === "Drawing")) {
23526
+ if (underPointer.some((item2) => item2.itemType === "Drawing")) {
23511
23527
  enclosed = [...underPointer, ...enclosed];
23512
23528
  }
23513
- const { nearest } = enclosed.reduce((acc, item) => {
23514
- const area = item.getMbr().getHeight() * item.getMbr().getWidth();
23515
- if (item.itemType === "Drawing" && !item.isPointNearLine(this.pointer.point)) {
23529
+ const { nearest } = enclosed.reduce((acc, item2) => {
23530
+ const area = item2.getMbr().getHeight() * item2.getMbr().getWidth();
23531
+ if (item2.itemType === "Drawing" && !item2.isPointNearLine(this.pointer.point)) {
23516
23532
  return acc;
23517
23533
  }
23518
- const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
23519
- const itemZIndex = this.getZIndex(item);
23534
+ const isItemTransparent = item2 instanceof Shape && item2?.getBackgroundColor() === "none";
23535
+ const itemZIndex = this.getZIndex(item2);
23520
23536
  const accZIndex = this.getZIndex(acc.nearest);
23521
23537
  if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
23522
- return { nearest: item, area };
23538
+ return { nearest: item2, area };
23523
23539
  }
23524
23540
  return acc;
23525
23541
  }, { nearest: undefined, area: Infinity });
@@ -23531,8 +23547,8 @@ class Items {
23531
23547
  getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
23532
23548
  return this.index.getNearestTo(this.pointer.point, maxItems, filter, maxDistance);
23533
23549
  }
23534
- getZIndex(item) {
23535
- return this.index.getZIndex(item);
23550
+ getZIndex(item2) {
23551
+ return this.index.getZIndex(item2);
23536
23552
  }
23537
23553
  getByZIndex(index2) {
23538
23554
  return this.index.getByZIndex(index2);
@@ -23541,11 +23557,11 @@ class Items {
23541
23557
  return this.index.getLastZIndex();
23542
23558
  }
23543
23559
  getLinkedConnectorsById(id) {
23544
- return this.listAll().filter((item) => {
23545
- if (!(item instanceof Connector2)) {
23560
+ return this.listAll().filter((item2) => {
23561
+ if (!(item2 instanceof Connector2)) {
23546
23562
  return false;
23547
23563
  }
23548
- const { startItem, endItem } = item.getConnectedItems();
23564
+ const { startItem, endItem } = item2.getConnectedItems();
23549
23565
  if (startItem?.getId() === id || endItem?.getId() === id) {
23550
23566
  return true;
23551
23567
  }
@@ -23556,11 +23572,11 @@ class Items {
23556
23572
  if (!startPointerItemId && !endPointerItemId) {
23557
23573
  return [];
23558
23574
  }
23559
- return this.listAll().filter((item) => {
23560
- if (!(item instanceof Connector2) || !item.isConnected()) {
23575
+ return this.listAll().filter((item2) => {
23576
+ if (!(item2 instanceof Connector2) || !item2.isConnected()) {
23561
23577
  return false;
23562
23578
  }
23563
- const { startItem, endItem } = item.getConnectedItems();
23579
+ const { startItem, endItem } = item2.getConnectedItems();
23564
23580
  if (startPointerItemId && endPointerItemId) {
23565
23581
  if (startPointerItemId && startItem && startItem.getId() === startPointerItemId && endPointerItemId && endItem && endItem.getId() === endPointerItemId) {
23566
23582
  return true;
@@ -23578,9 +23594,9 @@ class Items {
23578
23594
  }
23579
23595
  render(context) {
23580
23596
  const items = this.getItemsInView();
23581
- items.forEach((item) => {
23582
- if (item.parent === "Board") {
23583
- item.render(context);
23597
+ items.forEach((item2) => {
23598
+ if (item2.parent === "Board") {
23599
+ item2.render(context);
23584
23600
  }
23585
23601
  });
23586
23602
  }
@@ -23593,17 +23609,17 @@ class Items {
23593
23609
  return this.getHTML(documentFactory, items);
23594
23610
  }
23595
23611
  getHTML(documentFactory, items) {
23596
- const lowestCoordinates = items.map((item) => item.getMbr()).reduce((acc, mbr) => ({
23612
+ const lowestCoordinates = items.map((item2) => item2.getMbr()).reduce((acc, mbr) => ({
23597
23613
  left: Math.min(acc.left, mbr.left),
23598
23614
  top: Math.min(acc.top, mbr.top)
23599
23615
  }), { left: 0, top: 0 });
23600
23616
  const groups = [];
23601
23617
  const rest = [];
23602
- items.forEach((item) => {
23603
- if ("index" in item && item.index) {
23604
- groups.push(item);
23618
+ items.forEach((item2) => {
23619
+ if ("index" in item2 && item2.index) {
23620
+ groups.push(item2);
23605
23621
  } else {
23606
- rest.push(item);
23622
+ rest.push(item2);
23607
23623
  }
23608
23624
  });
23609
23625
  const childrenMap = new Map;
@@ -23613,34 +23629,34 @@ class Items {
23613
23629
  translateElementBy(html, -lowestCoordinates.left, -lowestCoordinates.top);
23614
23630
  return html;
23615
23631
  });
23616
- const restHTML = rest.map((item) => ("renderHTML" in item) && item.renderHTML(documentFactory)).filter((item) => !!item).map((item) => {
23617
- if (item.tagName.toLowerCase() === "connector-item") {
23618
- const startX = parseFloat(item.getAttribute("data-start-point-x") || "0");
23619
- const startY = parseFloat(item.getAttribute("data-start-point-y") || "0");
23620
- const endX = parseFloat(item.getAttribute("data-end-point-x") || "0");
23621
- const endY = parseFloat(item.getAttribute("data-end-point-y") || "0");
23622
- item.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
23623
- item.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
23624
- item.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
23625
- item.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
23626
- }
23627
- return translateElementBy(item, -lowestCoordinates.left, -lowestCoordinates.top);
23628
- });
23629
- for (const item of restHTML) {
23630
- const parentFrameId = childrenMap.get(item.id);
23632
+ const restHTML = rest.map((item2) => ("renderHTML" in item2) && item2.renderHTML(documentFactory)).filter((item2) => !!item2).map((item2) => {
23633
+ if (item2.tagName.toLowerCase() === "connector-item") {
23634
+ const startX = parseFloat(item2.getAttribute("data-start-point-x") || "0");
23635
+ const startY = parseFloat(item2.getAttribute("data-start-point-y") || "0");
23636
+ const endX = parseFloat(item2.getAttribute("data-end-point-x") || "0");
23637
+ const endY = parseFloat(item2.getAttribute("data-end-point-y") || "0");
23638
+ item2.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
23639
+ item2.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
23640
+ item2.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
23641
+ item2.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
23642
+ }
23643
+ return translateElementBy(item2, -lowestCoordinates.left, -lowestCoordinates.top);
23644
+ });
23645
+ for (const item2 of restHTML) {
23646
+ const parentFrameId = childrenMap.get(item2.id);
23631
23647
  const group = GroupsHTML.find((el) => parentFrameId !== undefined && el.id === parentFrameId);
23632
23648
  if (group) {
23633
- positionRelatively(item, group);
23634
- group.appendChild(item);
23649
+ positionRelatively(item2, group);
23650
+ group.appendChild(item2);
23635
23651
  }
23636
23652
  }
23637
23653
  let result = "";
23638
23654
  for (const group of GroupsHTML) {
23639
23655
  result += group.outerHTML;
23640
23656
  }
23641
- for (const item of restHTML) {
23642
- if (!childrenMap.get(item.id)) {
23643
- result += item.outerHTML;
23657
+ for (const item2 of restHTML) {
23658
+ if (!childrenMap.get(item2.id)) {
23659
+ result += item2.outerHTML;
23644
23660
  }
23645
23661
  }
23646
23662
  return result;
@@ -23660,52 +23676,52 @@ class SimpleSpatialIndex {
23660
23676
  this.itemsArray = [];
23661
23677
  this.Mbr = new Mbr;
23662
23678
  }
23663
- insert(item) {
23664
- this.itemsArray.push(item);
23679
+ insert(item2) {
23680
+ this.itemsArray.push(item2);
23665
23681
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23666
- this.Mbr = item.getMbr().copy();
23682
+ this.Mbr = item2.getMbr().copy();
23667
23683
  } else {
23668
- this.Mbr.combine([item.getMbr()]);
23684
+ this.Mbr.combine([item2.getMbr()]);
23669
23685
  }
23670
- item.subject.subscribe(this.change);
23686
+ item2.subject.subscribe(this.change);
23671
23687
  this.subject.publish(this.items);
23672
23688
  }
23673
- change = (item) => {
23689
+ change = (item2) => {
23674
23690
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23675
- this.Mbr = item.getMbr().copy();
23691
+ this.Mbr = item2.getMbr().copy();
23676
23692
  } else {
23677
- this.Mbr.combine([item.getMbr()]);
23693
+ this.Mbr.combine([item2.getMbr()]);
23678
23694
  }
23679
23695
  this.subject.publish(this.items);
23680
23696
  };
23681
- remove(item) {
23682
- if ("index" in item && item.index) {
23683
- item.removeChildItems(item.index.list());
23697
+ remove(item2) {
23698
+ if ("index" in item2 && item2.index) {
23699
+ item2.removeChildItems(item2.index.list());
23684
23700
  }
23685
- if (item.parent !== "Board") {
23686
- const parentFrame = this.items.getById(item.parent);
23687
- parentFrame?.removeChildItems(item);
23701
+ if (item2.parent !== "Board") {
23702
+ const parentFrame = this.items.getById(item2.parent);
23703
+ parentFrame?.removeChildItems(item2);
23688
23704
  }
23689
- this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
23705
+ this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
23690
23706
  this.Mbr = new Mbr;
23691
- this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
23707
+ this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbr()]));
23692
23708
  this.subject.publish(this.items);
23693
23709
  }
23694
23710
  copy() {
23695
- return this.itemsArray.map((item) => ({
23696
- ...item.serialize(true),
23697
- id: item.getId()
23711
+ return this.itemsArray.map((item2) => ({
23712
+ ...item2.serialize(true),
23713
+ id: item2.getId()
23698
23714
  }));
23699
23715
  }
23700
- moveToZIndex(item, zIndex) {
23701
- const index2 = this.itemsArray.indexOf(item);
23716
+ moveToZIndex(item2, zIndex) {
23717
+ const index2 = this.itemsArray.indexOf(item2);
23702
23718
  this.itemsArray.splice(index2, 1);
23703
- this.itemsArray.splice(zIndex, 0, item);
23704
- this.change(item);
23719
+ this.itemsArray.splice(zIndex, 0, item2);
23720
+ this.change(item2);
23705
23721
  this.subject.publish(this.items);
23706
23722
  }
23707
23723
  moveManyToZIndex(itemsRecord) {
23708
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
23724
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
23709
23725
  const zIndex = Object.values(itemsRecord);
23710
23726
  for (let i = 0;i < zIndex.length; i++) {
23711
23727
  const index2 = zIndex[i];
@@ -23713,37 +23729,37 @@ class SimpleSpatialIndex {
23713
23729
  }
23714
23730
  this.itemsArray.forEach(this.change.bind(this));
23715
23731
  }
23716
- sendToBack(item, shouldPublish = true) {
23717
- const index2 = this.itemsArray.indexOf(item);
23732
+ sendToBack(item2, shouldPublish = true) {
23733
+ const index2 = this.itemsArray.indexOf(item2);
23718
23734
  this.itemsArray.splice(index2, 1);
23719
- this.itemsArray.unshift(item);
23735
+ this.itemsArray.unshift(item2);
23720
23736
  if (shouldPublish) {
23721
23737
  this.subject.publish(this.items);
23722
23738
  }
23723
23739
  }
23724
23740
  sendManyToBack(items) {
23725
23741
  const newItems = [...items];
23726
- this.itemsArray.forEach((item) => {
23727
- if (!items.includes(item)) {
23728
- newItems.push(item);
23742
+ this.itemsArray.forEach((item2) => {
23743
+ if (!items.includes(item2)) {
23744
+ newItems.push(item2);
23729
23745
  }
23730
23746
  });
23731
23747
  this.itemsArray = newItems;
23732
23748
  this.itemsArray.forEach(this.change.bind(this));
23733
23749
  }
23734
- bringToFront(item, shouldPublish = true) {
23735
- const index2 = this.itemsArray.indexOf(item);
23750
+ bringToFront(item2, shouldPublish = true) {
23751
+ const index2 = this.itemsArray.indexOf(item2);
23736
23752
  this.itemsArray.splice(index2, 1);
23737
- this.itemsArray.push(item);
23753
+ this.itemsArray.push(item2);
23738
23754
  if (shouldPublish) {
23739
23755
  this.subject.publish(this.items);
23740
23756
  }
23741
23757
  }
23742
23758
  bringManyToFront(items) {
23743
23759
  const newItems = [];
23744
- this.itemsArray.forEach((item) => {
23745
- if (!items.includes(item)) {
23746
- newItems.push(item);
23760
+ this.itemsArray.forEach((item2) => {
23761
+ if (!items.includes(item2)) {
23762
+ newItems.push(item2);
23747
23763
  }
23748
23764
  });
23749
23765
  newItems.push(...items);
@@ -23769,9 +23785,9 @@ class SimpleSpatialIndex {
23769
23785
  this.subject.publish(this.items);
23770
23786
  }
23771
23787
  getById(id) {
23772
- const item = this.itemsArray.find((item2) => item2.getId() === id);
23773
- if (item) {
23774
- return item;
23788
+ const item2 = this.itemsArray.find((item3) => item3.getId() === id);
23789
+ if (item2) {
23790
+ return item2;
23775
23791
  }
23776
23792
  }
23777
23793
  findById(id) {
@@ -23780,9 +23796,9 @@ class SimpleSpatialIndex {
23780
23796
  getEnclosed(left, top, right, bottom) {
23781
23797
  const mbr = new Mbr(left, top, right, bottom);
23782
23798
  const items = [];
23783
- this.itemsArray.forEach((item) => {
23784
- if (item.isEnclosedBy(mbr)) {
23785
- items.push(item);
23799
+ this.itemsArray.forEach((item2) => {
23800
+ if (item2.isEnclosedBy(mbr)) {
23801
+ items.push(item2);
23786
23802
  }
23787
23803
  });
23788
23804
  return items;
@@ -23790,18 +23806,18 @@ class SimpleSpatialIndex {
23790
23806
  getEnclosedOrCrossed(left, top, right, bottom) {
23791
23807
  const mbr = new Mbr(left, top, right, bottom);
23792
23808
  const items = [];
23793
- this.itemsArray.forEach((item) => {
23794
- if (item.isEnclosedOrCrossedBy(mbr)) {
23795
- items.push(item);
23809
+ this.itemsArray.forEach((item2) => {
23810
+ if (item2.isEnclosedOrCrossedBy(mbr)) {
23811
+ items.push(item2);
23796
23812
  }
23797
23813
  });
23798
23814
  return items;
23799
23815
  }
23800
23816
  getUnderPoint(point3, tolerace = 5) {
23801
23817
  const items = [];
23802
- this.itemsArray.forEach((item) => {
23803
- if (item.isUnderPoint(point3, tolerace)) {
23804
- items.push(item);
23818
+ this.itemsArray.forEach((item2) => {
23819
+ if (item2.isUnderPoint(point3, tolerace)) {
23820
+ items.push(item2);
23805
23821
  }
23806
23822
  });
23807
23823
  return items;
@@ -23812,8 +23828,8 @@ class SimpleSpatialIndex {
23812
23828
  list() {
23813
23829
  return this.itemsArray.concat();
23814
23830
  }
23815
- getZIndex(item) {
23816
- return this.itemsArray.indexOf(item);
23831
+ getZIndex(item2) {
23832
+ return this.itemsArray.indexOf(item2);
23817
23833
  }
23818
23834
  getLastZIndex() {
23819
23835
  return this.itemsArray.length - 1;
@@ -23827,8 +23843,8 @@ class SimpleSpatialIndex {
23827
23843
  }
23828
23844
  }
23829
23845
  render(context) {
23830
- this.itemsArray.forEach((item) => {
23831
- item.render(context);
23846
+ this.itemsArray.forEach((item2) => {
23847
+ item2.render(context);
23832
23848
  });
23833
23849
  }
23834
23850
  }
@@ -23879,7 +23895,7 @@ class BaseItem extends Mbr {
23879
23895
  if (!this.index) {
23880
23896
  return null;
23881
23897
  }
23882
- return this.index.items.listAll().map((item) => item.getId());
23898
+ return this.index.items.listAll().map((item2) => item2.getId());
23883
23899
  }
23884
23900
  addChildItems(children) {
23885
23901
  if (!this.index) {
@@ -23917,17 +23933,17 @@ class BaseItem extends Mbr {
23917
23933
  this.addChildItems(itemsToAdd);
23918
23934
  this.removeChildItems(itemsToRemove);
23919
23935
  }
23920
- handleNesting(item, options) {
23921
- const isItem = "itemType" in item;
23922
- const itemMbr = isItem ? item.getMbr() : item;
23923
- if (item instanceof BaseItem && !item.canBeNested) {
23936
+ handleNesting(item2, options) {
23937
+ const isItem = "itemType" in item2;
23938
+ const itemMbr = isItem ? item2.getMbr() : item2;
23939
+ if (item2 instanceof BaseItem && !item2.canBeNested) {
23924
23940
  return false;
23925
23941
  }
23926
- if (options?.cancelIfChild && isItem && item.parent !== "Board") {
23942
+ if (options?.cancelIfChild && isItem && item2.parent !== "Board") {
23927
23943
  return false;
23928
23944
  }
23929
23945
  const mbr = this.getMbr().copy();
23930
- if (item.isEnclosedOrCrossedBy(mbr)) {
23946
+ if (item2.isEnclosedOrCrossedBy(mbr)) {
23931
23947
  if (mbr.isInside(itemMbr.getCenter())) {
23932
23948
  if (!options || !options.onlyForOut) {
23933
23949
  return true;
@@ -26224,8 +26240,8 @@ function isChild(value) {
26224
26240
  if (!Array.isArray(value2))
26225
26241
  return true;
26226
26242
  const list2 = value2;
26227
- for (const item of list2) {
26228
- if (typeof item !== "number" && typeof item !== "string") {
26243
+ for (const item2 of list2) {
26244
+ if (typeof item2 !== "number" && typeof item2 !== "string") {
26229
26245
  return true;
26230
26246
  }
26231
26247
  }
@@ -26264,8 +26280,8 @@ function addProperty(schema, properties, key, value) {
26264
26280
  }
26265
26281
  if (Array.isArray(result)) {
26266
26282
  const finalResult = [];
26267
- for (const item of result) {
26268
- finalResult.push(parsePrimitive(info, info.property, item));
26283
+ for (const item2 of result) {
26284
+ finalResult.push(parsePrimitive(info, info.property, item2));
26269
26285
  }
26270
26286
  result = finalResult;
26271
26287
  }
@@ -37332,8 +37348,8 @@ function list5(node2, parent, state, info) {
37332
37348
  if (checkRule(state) === bullet && firstListItem) {
37333
37349
  let index2 = -1;
37334
37350
  while (++index2 < node2.children.length) {
37335
- const item = node2.children[index2];
37336
- if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
37351
+ const item2 = node2.children[index2];
37352
+ if (item2 && item2.type === "listItem" && item2.children && item2.children[0] && item2.children[0].type === "thematicBreak") {
37337
37353
  useDifferentMarker = true;
37338
37354
  break;
37339
37355
  }
@@ -37994,12 +38010,12 @@ async function convertMarkdownToSlate(text5) {
37994
38010
  ...nodes.filter((node2) => node2.type !== "list_item")
37995
38011
  ];
37996
38012
  }
37997
- return nodes.map((item) => {
38013
+ return nodes.map((item2) => {
37998
38014
  setNodeStyles({
37999
- node: item,
38000
- isPaddingTopNeeded: item.type !== "code_block"
38015
+ node: item2,
38016
+ isPaddingTopNeeded: item2.type !== "code_block"
38001
38017
  });
38002
- return item;
38018
+ return item2;
38003
38019
  });
38004
38020
  }
38005
38021
  function detectListType(text5) {
@@ -38412,17 +38428,17 @@ class FloatingPoint extends Point {
38412
38428
  relativePoint;
38413
38429
  pointType = "Floating";
38414
38430
  edge;
38415
- constructor(item, relativePoint) {
38431
+ constructor(item2, relativePoint) {
38416
38432
  super();
38417
- this.item = item;
38433
+ this.item = item2;
38418
38434
  this.relativePoint = relativePoint;
38419
38435
  if (relativePoint.y <= 0) {
38420
38436
  this.edge = "top";
38421
- } else if (relativePoint.y >= item.getMbr().getHeight()) {
38437
+ } else if (relativePoint.y >= item2.getMbr().getHeight()) {
38422
38438
  this.edge = "bottom";
38423
38439
  } else if (relativePoint.x <= 0) {
38424
38440
  this.edge = "left";
38425
- } else if (relativePoint.x >= item.getMbr().getWidth()) {
38441
+ } else if (relativePoint.x >= item2.getMbr().getWidth()) {
38426
38442
  this.edge = "right";
38427
38443
  }
38428
38444
  this.recalculatePoint();
@@ -38453,17 +38469,17 @@ class FixedPoint extends Point {
38453
38469
  relativePoint;
38454
38470
  pointType = "Fixed";
38455
38471
  edge;
38456
- constructor(item, relativePoint) {
38472
+ constructor(item2, relativePoint) {
38457
38473
  super();
38458
- this.item = item;
38474
+ this.item = item2;
38459
38475
  this.relativePoint = relativePoint;
38460
38476
  if (relativePoint.y <= 0) {
38461
38477
  this.edge = "top";
38462
- } else if (relativePoint.y >= item.getMbr().getHeight()) {
38478
+ } else if (relativePoint.y >= item2.getMbr().getHeight()) {
38463
38479
  this.edge = "bottom";
38464
38480
  } else if (relativePoint.x <= 0) {
38465
38481
  this.edge = "left";
38466
- } else if (relativePoint.x >= item.getMbr().getWidth()) {
38482
+ } else if (relativePoint.x >= item2.getMbr().getWidth()) {
38467
38483
  this.edge = "right";
38468
38484
  }
38469
38485
  this.recalculatePoint();
@@ -38494,16 +38510,16 @@ class FixedConnectorPoint extends Point {
38494
38510
  tangent;
38495
38511
  segmentIndex;
38496
38512
  pointType = "FixedConnector";
38497
- constructor(item, tangent, segmentIndex) {
38513
+ constructor(item2, tangent, segmentIndex) {
38498
38514
  super();
38499
- this.item = item;
38515
+ this.item = item2;
38500
38516
  this.tangent = tangent;
38501
38517
  this.segmentIndex = segmentIndex;
38502
38518
  this.recalculatePoint();
38503
38519
  }
38504
38520
  recalculatePoint() {
38505
- const item = this.item;
38506
- const segments = item.getPaths().getSegments();
38521
+ const item2 = this.item;
38522
+ const segments = item2.getPaths().getSegments();
38507
38523
  const segment = segments.length > this.segmentIndex ? segments[this.segmentIndex] : segments[segments.length - 1];
38508
38524
  const point5 = segment.getPoint(this.tangent);
38509
38525
  this.x = point5.x;
@@ -38528,38 +38544,38 @@ function getControlPoint(data, findItem2) {
38528
38544
  if (data.pointType === "Board") {
38529
38545
  return new BoardPoint(Math.round(data.x), Math.round(data.y));
38530
38546
  } else {
38531
- const item = findItem2(data.itemId);
38532
- if (!item) {
38547
+ const item2 = findItem2(data.itemId);
38548
+ if (!item2) {
38533
38549
  console.warn(`getControlPoint(): item not found for ${data.itemId}`);
38534
38550
  return new BoardPoint(0, 0);
38535
38551
  }
38536
38552
  switch (data.pointType) {
38537
38553
  case "FixedConnector":
38538
- if (item instanceof Connector2) {
38539
- return new FixedConnectorPoint(item, data.tangent, data.segment);
38554
+ if (item2 instanceof Connector2) {
38555
+ return new FixedConnectorPoint(item2, data.tangent, data.segment);
38540
38556
  } else {
38541
38557
  throw new Error(`getControlPoint(): item must be a connector`);
38542
38558
  }
38543
38559
  case "Floating":
38544
- return new FloatingPoint(item, new Point(data.relativeX, data.relativeY));
38560
+ return new FloatingPoint(item2, new Point(data.relativeX, data.relativeY));
38545
38561
  case "Fixed":
38546
- return new FixedPoint(item, new Point(data.relativeX, data.relativeY));
38562
+ return new FixedPoint(item2, new Point(data.relativeX, data.relativeY));
38547
38563
  }
38548
38564
  }
38549
38565
  }
38550
- function toRelativePoint(point5, item) {
38551
- const matrix = item.transformation?.matrix || new Matrix2;
38566
+ function toRelativePoint(point5, item2) {
38567
+ const matrix = item2.transformation?.matrix || new Matrix2;
38552
38568
  const inverse = matrix.getInverse();
38553
38569
  point5 = point5.copy();
38554
38570
  point5.transform(inverse);
38555
38571
  return point5;
38556
38572
  }
38557
- function fromRelativePoint(relativePoint, item, edge) {
38558
- const matrix = item.transformation?.matrix.copy() || new Matrix2;
38573
+ function fromRelativePoint(relativePoint, item2, edge) {
38574
+ const matrix = item2.transformation?.matrix.copy() || new Matrix2;
38559
38575
  const point5 = relativePoint.copy();
38560
38576
  point5.transform(matrix);
38561
- if (item instanceof RichText || item instanceof AINode) {
38562
- const itemMbr = item.getMbr();
38577
+ if (item2 instanceof RichText || item2 instanceof AINode) {
38578
+ const itemMbr = item2.getMbr();
38563
38579
  const { x: centerX, y: centerY } = itemMbr.getCenter();
38564
38580
  switch (edge) {
38565
38581
  case "left":
@@ -38571,7 +38587,7 @@ function fromRelativePoint(relativePoint, item, edge) {
38571
38587
  case "bottom":
38572
38588
  return new Point(centerX, itemMbr.bottom);
38573
38589
  default:
38574
- return item.getMbr().getClosestEdgeCenterPoint(point5);
38590
+ return item2.getMbr().getClosestEdgeCenterPoint(point5);
38575
38591
  }
38576
38592
  }
38577
38593
  return point5;
@@ -39920,7 +39936,7 @@ class Connector2 extends BaseItem {
39920
39936
  return this;
39921
39937
  }
39922
39938
  getConnectorById(items, connectorId) {
39923
- return items.find((item) => item instanceof Connector2 && item.getId() === connectorId);
39939
+ return items.find((item2) => item2 instanceof Connector2 && item2.getId() === connectorId);
39924
39940
  }
39925
39941
  updateTitle() {
39926
39942
  const selection = this.board.selection;
@@ -42557,8 +42573,8 @@ async function exportBoardSnapshot({
42557
42573
  context.matrix.applyToContext(context.ctx);
42558
42574
  const { left, top, right, bottom } = selection;
42559
42575
  const inView = board.items.index.getRectsEnclosedOrCrossed(left, top, right, bottom);
42560
- for (const item of inView) {
42561
- item.render(context);
42576
+ for (const item2 of inView) {
42577
+ item2.render(context);
42562
42578
  }
42563
42579
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
42564
42580
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -42756,7 +42772,7 @@ class Frame2 extends BaseItem {
42756
42772
  return this.id;
42757
42773
  }
42758
42774
  getChildrenIds() {
42759
- return this.index?.list().map((item) => item.getId()) || [];
42775
+ return this.index?.list().map((item2) => item2.getId()) || [];
42760
42776
  }
42761
42777
  updateMbr() {
42762
42778
  const rect = this.path.getMbr().copy();
@@ -42991,11 +43007,11 @@ class Frame2 extends BaseItem {
42991
43007
  }
42992
43008
  });
42993
43009
  const currMbr = this.getMbr();
42994
- this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
42995
- if (item.parent === "Board") {
42996
- if (this.handleNesting(item)) {
42997
- this.applyAddChildren([item.getId()]);
42998
- item.parent = this.getId();
43010
+ this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item2) => {
43011
+ if (item2.parent === "Board") {
43012
+ if (this.handleNesting(item2)) {
43013
+ this.applyAddChildren([item2.getId()]);
43014
+ item2.parent = this.getId();
42999
43015
  }
43000
43016
  }
43001
43017
  });
@@ -45193,9 +45209,9 @@ class Group extends BaseItem {
45193
45209
  if (data.children) {
45194
45210
  data.children.forEach((childId) => {
45195
45211
  this.applyAddChild(childId);
45196
- const item = this.board.items.getById(childId);
45197
- if (item) {
45198
- item.parent = this.getId();
45212
+ const item2 = this.board.items.getById(childId);
45213
+ if (item2) {
45214
+ item2.parent = this.getId();
45199
45215
  }
45200
45216
  });
45201
45217
  }
@@ -45225,11 +45241,11 @@ class Group extends BaseItem {
45225
45241
  let right = Number.MIN_SAFE_INTEGER;
45226
45242
  let bottom = Number.MIN_SAFE_INTEGER;
45227
45243
  const mbrs = this.children.flatMap((childId) => {
45228
- const item = this.board.items.getById(childId);
45229
- if (!item) {
45244
+ const item2 = this.board.items.getById(childId);
45245
+ if (!item2) {
45230
45246
  return [];
45231
45247
  }
45232
- const mbr2 = item.getMbr();
45248
+ const mbr2 = item2.getMbr();
45233
45249
  if (!mbr2) {
45234
45250
  return [];
45235
45251
  }
@@ -45264,7 +45280,7 @@ class Group extends BaseItem {
45264
45280
  return this.children;
45265
45281
  }
45266
45282
  getChildren() {
45267
- return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item) => item !== undefined);
45283
+ return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item2) => item2 !== undefined);
45268
45284
  }
45269
45285
  updateMbr() {
45270
45286
  const rect = this.getMbr();
@@ -45277,9 +45293,9 @@ class Group extends BaseItem {
45277
45293
  setChildren(items) {
45278
45294
  items.forEach((itemId) => {
45279
45295
  this.addChild(itemId);
45280
- const item = this.board.items.getById(itemId);
45281
- if (item) {
45282
- item.parent = this.getId();
45296
+ const item2 = this.board.items.getById(itemId);
45297
+ if (item2) {
45298
+ item2.parent = this.getId();
45283
45299
  }
45284
45300
  });
45285
45301
  this.updateMbr();
@@ -45287,9 +45303,9 @@ class Group extends BaseItem {
45287
45303
  removeChildren() {
45288
45304
  this.children.forEach((itemId) => {
45289
45305
  this.removeChild(itemId);
45290
- const item = this.board.items.getById(itemId);
45291
- if (item) {
45292
- item.parent = this.parent;
45306
+ const item2 = this.board.items.getById(itemId);
45307
+ if (item2) {
45308
+ item2.parent = this.parent;
45293
45309
  }
45294
45310
  });
45295
45311
  this.updateMbr();
@@ -45622,16 +45638,16 @@ class Anchor extends Mbr {
45622
45638
  }
45623
45639
  }
45624
45640
  // src/Items/Connector/ConnectorSnap.ts
45625
- function getFixedPoint(item, point5) {
45626
- if (item instanceof Connector2) {
45627
- const nearestSegmentData = item.getPaths().getNearestEdgeAndPointTo(point5);
45641
+ function getFixedPoint(item2, point5) {
45642
+ if (item2 instanceof Connector2) {
45643
+ const nearestSegmentData = item2.getPaths().getNearestEdgeAndPointTo(point5);
45628
45644
  const segment = nearestSegmentData.segment;
45629
45645
  const index2 = nearestSegmentData.index;
45630
45646
  const tangent = segment.getParameter(point5);
45631
- return new FixedConnectorPoint(item, tangent, index2);
45647
+ return new FixedConnectorPoint(item2, tangent, index2);
45632
45648
  } else {
45633
- const relativePoint = toRelativePoint(point5, item);
45634
- return new FixedPoint(item, relativePoint);
45649
+ const relativePoint = toRelativePoint(point5, item2);
45650
+ return new FixedPoint(item2, relativePoint);
45635
45651
  }
45636
45652
  }
45637
45653
 
@@ -45684,20 +45700,20 @@ class ConnectorSnap {
45684
45700
  }
45685
45701
  this.setSnap();
45686
45702
  const pointer = this.board.pointer.point;
45687
- const { anchor, item, point: point5 } = this.snap;
45688
- if (!item) {
45703
+ const { anchor, item: item2, point: point5 } = this.snap;
45704
+ if (!item2) {
45689
45705
  const pointer2 = this.board.pointer.point;
45690
45706
  this.controlPoint = new BoardPoint(pointer2.x, pointer2.y);
45691
45707
  } else if (anchor) {
45692
- this.controlPoint = getFixedPoint(item, anchor.getCenter());
45708
+ this.controlPoint = getFixedPoint(item2, anchor.getCenter());
45693
45709
  } else if (point5) {
45694
- const nearest2 = item.getNearestEdgePointTo(pointer);
45695
- this.controlPoint = getFixedPoint(item, nearest2);
45710
+ const nearest2 = item2.getNearestEdgePointTo(pointer);
45711
+ this.controlPoint = getFixedPoint(item2, nearest2);
45696
45712
  } else {
45697
45713
  if (this.hover.isTimeoutElapsed) {
45698
- this.controlPoint = getFixedPoint(item, pointer);
45714
+ this.controlPoint = getFixedPoint(item2, pointer);
45699
45715
  } else {
45700
- this.controlPoint = getFixedPoint(item, pointer);
45716
+ this.controlPoint = getFixedPoint(item2, pointer);
45701
45717
  }
45702
45718
  }
45703
45719
  }
@@ -45758,23 +45774,23 @@ class ConnectorSnap {
45758
45774
  }
45759
45775
  return nearest;
45760
45776
  }
45761
- getClosestPointOnItem(item, position4) {
45762
- const nearestEdgePoint = item.getNearestEdgePointTo(position4);
45763
- return getFixedPoint(item, nearestEdgePoint);
45777
+ getClosestPointOnItem(item2, position4) {
45778
+ const nearestEdgePoint = item2.getNearestEdgePointTo(position4);
45779
+ return getFixedPoint(item2, nearestEdgePoint);
45764
45780
  }
45765
- isNearBorder(item) {
45766
- if (!item) {
45781
+ isNearBorder(item2) {
45782
+ if (!item2) {
45767
45783
  return false;
45768
45784
  }
45769
45785
  const pointer = this.board.pointer.point;
45770
- const point5 = item.getNearestEdgePointTo(pointer);
45786
+ const point5 = item2.getNearestEdgePointTo(pointer);
45771
45787
  const distance = pointer.getDistance(point5);
45772
45788
  return distance < this.distance.border / this.board.camera.getScale();
45773
45789
  }
45774
45790
  setSnap() {
45775
- const item = this.snap.item;
45776
- const path2 = item && "getPath" in item ? item?.getPath() : null;
45777
- if (!item || !path2) {
45791
+ const item2 = this.snap.item;
45792
+ const path2 = item2 && "getPath" in item2 ? item2?.getPath() : null;
45793
+ if (!item2 || !path2) {
45778
45794
  this.snap.path = null;
45779
45795
  this.snap.anchors = [];
45780
45796
  this.snap.anchor = null;
@@ -45785,11 +45801,11 @@ class ConnectorSnap {
45785
45801
  if (this.snap.item === this.hover.item && !this.hover.isTimeoutElapsed) {
45786
45802
  path2.setBackgroundColor(this.color.snapBackgroundHighlight);
45787
45803
  }
45788
- this.setAnchors(item);
45804
+ this.setAnchors(item2);
45789
45805
  }
45790
45806
  }
45791
- setAnchors(item) {
45792
- const points = item.getSnapAnchorPoints();
45807
+ setAnchors(item2) {
45808
+ const points = item2.getSnapAnchorPoints();
45793
45809
  if (!points) {
45794
45810
  return;
45795
45811
  }
@@ -45823,10 +45839,10 @@ class ConnectorSnap {
45823
45839
  }
45824
45840
  setPoint() {
45825
45841
  const pointer = this.board.pointer.point;
45826
- const { item, anchor } = this.snap;
45827
- if (item) {
45842
+ const { item: item2, anchor } = this.snap;
45843
+ if (item2) {
45828
45844
  if (!anchor) {
45829
- const point5 = item.getNearestEdgePointTo(pointer);
45845
+ const point5 = item2.getNearestEdgePointTo(pointer);
45830
45846
  if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
45831
45847
  this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
45832
45848
  } else {
@@ -46199,12 +46215,12 @@ class NestingHighlighter extends Tool {
46199
46215
  this.toHighlight.push({ groupItem, children: array });
46200
46216
  }
46201
46217
  }
46202
- addSingleItem(item) {
46203
- this.toHighlight.push({ children: [item] });
46218
+ addSingleItem(item2) {
46219
+ this.toHighlight.push({ children: [item2] });
46204
46220
  }
46205
- remove(item) {
46221
+ remove(item2) {
46206
46222
  this.toHighlight.forEach((group) => {
46207
- group.children = group.children.filter((child) => child !== item);
46223
+ group.children = group.children.filter((child) => child !== item2);
46208
46224
  });
46209
46225
  this.toHighlight = this.toHighlight.filter((group) => group.children.length > 0);
46210
46226
  }
@@ -46271,7 +46287,7 @@ class AddFrame extends BoardTool {
46271
46287
  this.mbr.borderColor = "blue";
46272
46288
  this.nestingHighlighter.clear();
46273
46289
  const enclosedOrCrossed = this.board.items.getEnclosedOrCrossed(this.mbr.left, this.mbr.top, this.mbr.right, this.mbr.bottom);
46274
- const inside = enclosedOrCrossed.filter((item) => !(item instanceof Frame2) && item.parent === "Board" && this.mbr.isInside(item.getMbr().getCenter()));
46290
+ const inside = enclosedOrCrossed.filter((item2) => !(item2 instanceof Frame2) && item2.parent === "Board" && this.mbr.isInside(item2.getMbr().getCenter()));
46275
46291
  this.nestingHighlighter.add(this.frame, inside);
46276
46292
  this.initTransformation();
46277
46293
  this.board.tools.publish();
@@ -46292,7 +46308,7 @@ class AddFrame extends BoardTool {
46292
46308
  localStorage.setItem("lastFrameScale", JSON.stringify(this.frame.transformation.getScale()));
46293
46309
  }
46294
46310
  const currMbr = this.frame.getMbr();
46295
- 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));
46311
+ 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));
46296
46312
  this.applyAddChildren(frameChildren);
46297
46313
  if (this.shape !== "Custom") {
46298
46314
  this.applyCanChangeRatio(false);
@@ -46308,7 +46324,7 @@ class AddFrame extends BoardTool {
46308
46324
  return true;
46309
46325
  }
46310
46326
  addNextTo() {
46311
- const framesInView = this.board.items.getItemsInView().filter((item) => item instanceof Frame2);
46327
+ const framesInView = this.board.items.getItemsInView().filter((item2) => item2 instanceof Frame2);
46312
46328
  if (framesInView.length === 0) {
46313
46329
  if (this.shape === "Custom") {
46314
46330
  const { x, y } = this.frame.getLastFrameScale();
@@ -46346,7 +46362,7 @@ class AddFrame extends BoardTool {
46346
46362
  this.board.camera.viewRectangle(this.frame.getMbr());
46347
46363
  }
46348
46364
  const frameMbr = this.frame.getMbr();
46349
- 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]));
46365
+ 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]));
46350
46366
  const frame = this.board.add(this.frame);
46351
46367
  frame.text.editor.moveCursorToEndOfTheText();
46352
46368
  this.nestingHighlighter.clear();
@@ -46851,13 +46867,13 @@ class Eraser extends BoardTool {
46851
46867
  }
46852
46868
  removeUnderPointOrLine() {
46853
46869
  const segments = this.drawing.getLines();
46854
- const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item) => {
46855
- return item.itemType === "Drawing" && item.getLines().find((line) => {
46856
- return line.getDistance(this.board.pointer.point) <= item.strokeWidth / 2 + this.strokeWidth / 2;
46870
+ const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item2) => {
46871
+ return item2.itemType === "Drawing" && item2.getLines().find((line) => {
46872
+ return line.getDistance(this.board.pointer.point) <= item2.strokeWidth / 2 + this.strokeWidth / 2;
46857
46873
  });
46858
46874
  });
46859
- 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) => {
46860
- return item.itemType === "Drawing" && item.getLines().some((line) => {
46875
+ 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) => {
46876
+ return item2.itemType === "Drawing" && item2.getLines().some((line) => {
46861
46877
  return segments.some((segment) => segment.hasIntersectionPoint(line));
46862
46878
  });
46863
46879
  }));
@@ -47309,20 +47325,20 @@ function createCanvasDrawer(board) {
47309
47325
  context.ctx.setTransform(board2.camera.getMatrix().scaleX, 0, 0, board2.camera.getMatrix().scaleY, 0, 0);
47310
47326
  context.matrix.applyToContext(context.ctx);
47311
47327
  const items = Object.keys(translation).map((id) => {
47312
- const item = board2.items.getById(id);
47313
- if (item) {
47314
- if (item.itemType !== "Frame") {
47315
- return item;
47328
+ const item2 = board2.items.getById(id);
47329
+ if (item2) {
47330
+ if (item2.itemType !== "Frame") {
47331
+ return item2;
47316
47332
  }
47317
- item.render(context);
47318
- return item;
47333
+ item2.render(context);
47334
+ return item2;
47319
47335
  }
47320
47336
  return;
47321
- }).filter((item) => !!item);
47322
- items.forEach((item) => {
47323
- if (item.itemType !== "Frame") {
47324
- item.render(context);
47325
- board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
47337
+ }).filter((item2) => !!item2);
47338
+ items.forEach((item2) => {
47339
+ if (item2.itemType !== "Frame") {
47340
+ item2.render(context);
47341
+ board2.selection.renderItemMbr(context, item2, board2.camera.getMatrix().scaleX);
47326
47342
  }
47327
47343
  });
47328
47344
  return { canvas: container, items };
@@ -47383,10 +47399,10 @@ function createCanvasDrawer(board) {
47383
47399
  if (lastTranslationKeys) {
47384
47400
  board.selection.shouldPublish = false;
47385
47401
  lastTranslationKeys.forEach((id) => {
47386
- const item = board.items.getById(id);
47387
- if (item) {
47388
- item.transformationRenderBlock = undefined;
47389
- item.subject.publish(item);
47402
+ const item2 = board.items.getById(id);
47403
+ if (item2) {
47404
+ item2.transformationRenderBlock = undefined;
47405
+ item2.subject.publish(item2);
47390
47406
  }
47391
47407
  });
47392
47408
  lastTranslationKeys = undefined;
@@ -47418,9 +47434,9 @@ function createCanvasDrawer(board) {
47418
47434
  lastCreatedCanvas = cnvs;
47419
47435
  lastTranslationKeys = Object.keys(translation);
47420
47436
  lastTranslationKeys.forEach((id) => {
47421
- const item = board.items.getById(id);
47422
- if (item) {
47423
- item.transformationRenderBlock = true;
47437
+ const item2 = board.items.getById(id);
47438
+ if (item2) {
47439
+ item2.transformationRenderBlock = true;
47424
47440
  }
47425
47441
  });
47426
47442
  board.selection.transformationRenderBlock = true;
@@ -47430,14 +47446,14 @@ function createCanvasDrawer(board) {
47430
47446
  }
47431
47447
  function countSumMbr(translation) {
47432
47448
  return Object.keys(translation).reduce((mbr, id) => {
47433
- const item = board.items.getById(id);
47434
- if (item) {
47449
+ const item2 = board.items.getById(id);
47450
+ if (item2) {
47435
47451
  if (!mbr) {
47436
- mbr = item.getMbr();
47452
+ mbr = item2.getMbr();
47437
47453
  } else {
47438
- mbr.combine(item.getMbr());
47439
- if (item.itemType === "Frame") {
47440
- mbr.combine(item.getRichText().getMbr());
47454
+ mbr.combine(item2.getMbr());
47455
+ if (item2.itemType === "Frame") {
47456
+ mbr.combine(item2.getRichText().getMbr());
47441
47457
  }
47442
47458
  }
47443
47459
  }
@@ -47468,8 +47484,8 @@ function createCanvasDrawer(board) {
47468
47484
  }
47469
47485
  function highlightNesting() {
47470
47486
  const container = getLastCreatedCanvas();
47471
- const drawnItemsMap = drawnItems?.reduce((acc, item) => {
47472
- acc.set(item.getId(), { item, mbr: item.getMbr() });
47487
+ const drawnItemsMap = drawnItems?.reduce((acc, item2) => {
47488
+ acc.set(item2.getId(), { item: item2, mbr: item2.getMbr() });
47473
47489
  return acc;
47474
47490
  }, new Map);
47475
47491
  if (!container || !drawnItems) {
@@ -47504,11 +47520,11 @@ function createCanvasDrawer(board) {
47504
47520
  mbr.transform(currMatrix);
47505
47521
  });
47506
47522
  groups.forEach((group) => {
47507
- drawnItemsMap?.forEach(({ mbr, item }, key) => {
47508
- if ("canBeNested" in item && !item.canBeNested) {
47523
+ drawnItemsMap?.forEach(({ mbr, item: item2 }, key) => {
47524
+ if ("canBeNested" in item2 && !item2.canBeNested) {
47509
47525
  return;
47510
47526
  }
47511
- if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item.parent !== group.getId()) && group.handleNesting(mbr)) {
47527
+ if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item2.parent !== group.getId()) && group.handleNesting(mbr)) {
47512
47528
  const div = createBorderDivForItem(mbr, lastCreatedCanvas);
47513
47529
  removeHighlighted(key);
47514
47530
  highlightedDivs.set(key, div);
@@ -47569,10 +47585,10 @@ function createCanvasDrawer(board) {
47569
47585
  }
47570
47586
 
47571
47587
  // src/Selection/QuickAddButtons/quickAddHelpers.ts
47572
- function getControlPointData(item, index2, isRichText = false) {
47573
- const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
47574
- const width2 = item.getPathMbr().getWidth();
47575
- let height3 = item.getPathMbr().getHeight();
47588
+ function getControlPointData(item2, index2, isRichText = false) {
47589
+ const itemScale = isRichText ? { x: 1, y: 1 } : item2.transformation.getScale();
47590
+ const width2 = item2.getPathMbr().getWidth();
47591
+ let height3 = item2.getPathMbr().getHeight();
47576
47592
  const adjMapScaled = {
47577
47593
  0: { x: 0, y: height3 / 2 / itemScale.y },
47578
47594
  1: {
@@ -47587,7 +47603,7 @@ function getControlPointData(item, index2, isRichText = false) {
47587
47603
  };
47588
47604
  return {
47589
47605
  pointType: "Fixed",
47590
- itemId: item.getId(),
47606
+ itemId: item2.getId(),
47591
47607
  relativeX: adjMapScaled[index2].x,
47592
47608
  relativeY: adjMapScaled[index2].y
47593
47609
  };
@@ -47722,10 +47738,10 @@ function getQuickAddButtons(selection, board) {
47722
47738
  let newHeight = height3;
47723
47739
  let itemData;
47724
47740
  if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
47725
- const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
47726
- newWidth = item.getMbr().getWidth();
47727
- newHeight = item.getMbr().getHeight();
47728
- itemData = item.serialize();
47741
+ const item2 = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
47742
+ newWidth = item2.getMbr().getWidth();
47743
+ newHeight = item2.getMbr().getHeight();
47744
+ itemData = item2.serialize();
47729
47745
  const { minX, minY, maxY, maxX } = offsets;
47730
47746
  offsetX = Math.min(offsetX, maxX);
47731
47747
  offsetX = Math.max(offsetX, minX);
@@ -47758,7 +47774,7 @@ function getQuickAddButtons(selection, board) {
47758
47774
  }
47759
47775
  const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
47760
47776
  let step = 1;
47761
- while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
47777
+ while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item2) => item2.itemType !== "Connector").length > 0) {
47762
47778
  const xDirection = step % 2 === 0 ? -1 : 1;
47763
47779
  const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
47764
47780
  newMbr.transform(new Matrix2(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
@@ -47891,7 +47907,7 @@ function getQuickAddButtons(selection, board) {
47891
47907
  clear();
47892
47908
  return;
47893
47909
  }
47894
- const { positions, item } = position4;
47910
+ const { positions, item: item2 } = position4;
47895
47911
  const cameraMatrix = board.camera.getMatrix();
47896
47912
  const cameraMbr = board.camera.getMbr();
47897
47913
  const positionAdjustments = {
@@ -47919,7 +47935,7 @@ function getQuickAddButtons(selection, board) {
47919
47935
  };
47920
47936
  const button = document.createElement("button");
47921
47937
  button.classList.add("microboard-quickAddButton");
47922
- if (item.itemType === "AINode" && index2 === 2) {
47938
+ if (item2.itemType === "AINode" && index2 === 2) {
47923
47939
  button.classList.add("microboard-invisible");
47924
47940
  }
47925
47941
  button.classList.add(`microboard-${adjustment.rotate}`);
@@ -47935,7 +47951,7 @@ function getQuickAddButtons(selection, board) {
47935
47951
  clearTimeout(timeoutId);
47936
47952
  }
47937
47953
  if (button.isMouseDown) {
47938
- board.tools.addConnector(true, item, pos);
47954
+ board.tools.addConnector(true, item2, pos);
47939
47955
  } else {
47940
47956
  quickAddItems = undefined;
47941
47957
  selection.subject.publish(selection);
@@ -48042,11 +48058,11 @@ class AlignmentHelper {
48042
48058
  return baseThickness / (zoom / 100);
48043
48059
  }
48044
48060
  combineMBRs(items) {
48045
- return items.reduce((acc, item, i) => {
48061
+ return items.reduce((acc, item2, i) => {
48046
48062
  if (i === 0) {
48047
48063
  return acc;
48048
48064
  }
48049
- const itemMbr = item.getPathMbr();
48065
+ const itemMbr = item2.getPathMbr();
48050
48066
  return acc.combine(itemMbr);
48051
48067
  }, items[0].getMbr());
48052
48068
  }
@@ -48060,7 +48076,7 @@ class AlignmentHelper {
48060
48076
  const scale = this.board.camera.getScale();
48061
48077
  const dynamicAlignThreshold = Math.min(this.alignThreshold / scale, 8);
48062
48078
  const childrenIds = "index" in movingItem && movingItem.index ? movingItem.getChildrenIds() : [];
48063
- 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);
48079
+ 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);
48064
48080
  const verticalAlignments = new Map;
48065
48081
  const horizontalAlignments = new Map;
48066
48082
  const addVerticalAlignment = (x, minY, maxY) => {
@@ -48081,11 +48097,11 @@ class AlignmentHelper {
48081
48097
  horizontalAlignments.set(y, { minX, maxX });
48082
48098
  }
48083
48099
  };
48084
- nearbyItems.forEach((item) => {
48085
- if (item === movingItem || item.itemType === "Comment") {
48100
+ nearbyItems.forEach((item2) => {
48101
+ if (item2 === movingItem || item2.itemType === "Comment") {
48086
48102
  return;
48087
48103
  }
48088
- const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
48104
+ const itemMbr = item2.itemType === "Shape" ? item2.getPath().getMbr() : item2.getMbr();
48089
48105
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
48090
48106
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
48091
48107
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -48352,20 +48368,20 @@ class AlignmentHelper {
48352
48368
  }
48353
48369
  return false;
48354
48370
  }
48355
- translateItems(item, x, y, timeStamp) {
48371
+ translateItems(item2, x, y, timeStamp) {
48356
48372
  if (this.canvasDrawer.getLastCreatedCanvas()) {
48357
48373
  return;
48358
48374
  }
48359
- if (Array.isArray(item)) {
48375
+ if (Array.isArray(item2)) {
48360
48376
  const translation = this.board.selection.getManyItemsTranslation(x, y);
48361
48377
  this.board.selection.transformMany(translation, timeStamp);
48362
48378
  return;
48363
48379
  }
48364
- if (item.itemType === "Frame") {
48380
+ if (item2.itemType === "Frame") {
48365
48381
  const translation = this.board.selection.getManyItemsTranslation(x, y);
48366
48382
  this.board.selection.transformMany(translation, timeStamp);
48367
48383
  } else {
48368
- const id = item.getId();
48384
+ const id = item2.getId();
48369
48385
  const transformMap = {};
48370
48386
  transformMap[id] = {
48371
48387
  class: "Transformation",
@@ -48493,12 +48509,12 @@ class Select extends Tool {
48493
48509
  this.debounceUpd.setFalse();
48494
48510
  this.snapLines = { verticalLines: [], horizontalLines: [] };
48495
48511
  }
48496
- handleSnapping(item) {
48512
+ handleSnapping(item2) {
48497
48513
  if (this.board.keyboard.isShift) {
48498
48514
  return false;
48499
48515
  }
48500
- const increasedSnapThreshold = Array.isArray(item) ? 40 : 35;
48501
- this.isSnapped = this.alignmentHelper.snapToClosestLine(item, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
48516
+ const increasedSnapThreshold = Array.isArray(item2) ? 40 : 35;
48517
+ this.isSnapped = this.alignmentHelper.snapToClosestLine(item2, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
48502
48518
  if (this.isSnapped) {
48503
48519
  if (!this.snapCursorPos) {
48504
48520
  this.snapCursorPos = new Point(this.board.pointer.point.x, this.board.pointer.point.y);
@@ -48508,10 +48524,10 @@ class Select extends Tool {
48508
48524
  if ((cursorDiffX > increasedSnapThreshold || cursorDiffY > increasedSnapThreshold) && this.initialCursorPos) {
48509
48525
  this.isSnapped = false;
48510
48526
  this.snapCursorPos = null;
48511
- const itemCenter = Array.isArray(item) ? this.alignmentHelper.combineMBRs(item).getCenter() : item.getMbr().getCenter();
48527
+ const itemCenter = Array.isArray(item2) ? this.alignmentHelper.combineMBRs(item2).getCenter() : item2.getMbr().getCenter();
48512
48528
  const translateX = this.board.pointer.point.x - this.initialCursorPos.x - itemCenter.x;
48513
48529
  const translateY = this.board.pointer.point.y - this.initialCursorPos.y - itemCenter.y;
48514
- this.alignmentHelper.translateItems(item, translateX, translateY, this.beginTimeStamp);
48530
+ this.alignmentHelper.translateItems(item2, translateX, translateY, this.beginTimeStamp);
48515
48531
  }
48516
48532
  }
48517
48533
  return false;
@@ -48561,10 +48577,10 @@ class Select extends Tool {
48561
48577
  angleDiff = angleDiff < 0 ? angleDiff + 360 : angleDiff;
48562
48578
  return Math.min(angleDiff, 360 - angleDiff);
48563
48579
  }
48564
- handleShiftGuidelines(item, mousePosition) {
48565
- if (item) {
48580
+ handleShiftGuidelines(item2, mousePosition) {
48581
+ if (item2) {
48566
48582
  if (!this.originalCenter) {
48567
- this.originalCenter = Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().copy() : item.getMbr().getCenter().copy();
48583
+ this.originalCenter = Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().copy() : item2.getMbr().getCenter().copy();
48568
48584
  this.guidelines = this.alignmentHelper.generateGuidelines(this.originalCenter).lines;
48569
48585
  }
48570
48586
  this.mainLine = new Line(this.originalCenter, mousePosition);
@@ -48585,13 +48601,13 @@ class Select extends Tool {
48585
48601
  const newEndX = this.originalCenter.x + snapDirectionX * mainLineLength;
48586
48602
  const newEndY = this.originalCenter.y + snapDirectionY * mainLineLength;
48587
48603
  const threshold = Infinity;
48588
- const translateX = newEndX - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().x : item.getMbr().getCenter().x);
48589
- const translateY = newEndY - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().y : item.getMbr().getCenter().y);
48590
- if (Array.isArray(item)) {
48604
+ const translateX = newEndX - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().x : item2.getMbr().getCenter().x);
48605
+ const translateY = newEndY - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().y : item2.getMbr().getCenter().y);
48606
+ if (Array.isArray(item2)) {
48591
48607
  const translation = this.board.selection.getManyItemsTranslation(translateX, translateY);
48592
48608
  this.board.selection.transformMany(translation, this.beginTimeStamp);
48593
48609
  } else {
48594
- item.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
48610
+ item2.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
48595
48611
  }
48596
48612
  }
48597
48613
  }
@@ -48634,7 +48650,7 @@ class Select extends Tool {
48634
48650
  return false;
48635
48651
  }
48636
48652
  this.isDownOnBoard = hover.length === 0;
48637
- this.isDrawingRectangle = hover.filter((item) => !(item instanceof Frame2)).length === 0 && hover.filter((item) => item instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
48653
+ this.isDrawingRectangle = hover.filter((item2) => !(item2 instanceof Frame2)).length === 0 && hover.filter((item2) => item2 instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
48638
48654
  if (this.isDrawingRectangle) {
48639
48655
  const { x, y } = pointer.point;
48640
48656
  this.line = new Line(new Point(x, y), new Point(x, y));
@@ -48654,7 +48670,7 @@ class Select extends Tool {
48654
48670
  });
48655
48671
  return false;
48656
48672
  }
48657
- const isHoverLocked = hover.every((item) => item.transformation.isLocked);
48673
+ const isHoverLocked = hover.every((item2) => item2.transformation.isLocked);
48658
48674
  if (isHoverLocked) {
48659
48675
  return false;
48660
48676
  }
@@ -48788,7 +48804,7 @@ class Select extends Tool {
48788
48804
  const translation = selection.getManyItemsTranslation(x, y);
48789
48805
  const translationKeys = Object.keys(translation);
48790
48806
  const commentsSet = new Set(this.board.items.getComments().map((comment2) => comment2.getId()));
48791
- if (translationKeys.filter((item) => !commentsSet.has(item)).length > 10) {
48807
+ if (translationKeys.filter((item2) => !commentsSet.has(item2)).length > 10) {
48792
48808
  const selectedMbr = this.board.selection.getMbr()?.copy();
48793
48809
  const sumMbr = this.canvasDrawer.countSumMbr(translation);
48794
48810
  if (sumMbr) {
@@ -48815,7 +48831,7 @@ class Select extends Tool {
48815
48831
  return false;
48816
48832
  }
48817
48833
  const draggingMbr = draggingItem.getMbr();
48818
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
48834
+ const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item2) => item2 instanceof Frame2);
48819
48835
  frames.forEach((frame) => {
48820
48836
  if (frame.handleNesting(draggingItem)) {
48821
48837
  this.nestingHighlighter.add(frame, draggingItem);
@@ -48825,7 +48841,7 @@ class Select extends Tool {
48825
48841
  });
48826
48842
  }
48827
48843
  const hover = items.getUnderPointer();
48828
- this.isHoverUnselectedItem = hover.filter((item) => item.itemType === "Placeholder").length === 1;
48844
+ this.isHoverUnselectedItem = hover.filter((item2) => item2.itemType === "Placeholder").length === 1;
48829
48845
  if (this.isHoverUnselectedItem && !this.isDraggingUnselectedItem && selection.getContext() === "None") {
48830
48846
  selection.setContext("HoverUnderPointer");
48831
48847
  return false;
@@ -48869,15 +48885,15 @@ class Select extends Tool {
48869
48885
  }
48870
48886
  }
48871
48887
  updateFramesNesting(selectionMbr, selection) {
48872
- 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));
48873
- const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
48874
- selection.list().forEach((item) => {
48875
- if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
48888
+ 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));
48889
+ const draggingFramesIds = selection.list().filter((item2) => item2 instanceof Frame2).map((frame) => frame.getId());
48890
+ selection.list().forEach((item2) => {
48891
+ if (!(item2 instanceof Frame2) && !draggingFramesIds.includes(item2.parent)) {
48876
48892
  frames.forEach((frame) => {
48877
- if (frame.handleNesting(item)) {
48878
- this.nestingHighlighter.add(frame, item);
48893
+ if (frame.handleNesting(item2)) {
48894
+ this.nestingHighlighter.add(frame, item2);
48879
48895
  } else {
48880
- this.nestingHighlighter.remove(item);
48896
+ this.nestingHighlighter.remove(item2);
48881
48897
  }
48882
48898
  });
48883
48899
  }
@@ -48969,7 +48985,7 @@ class Select extends Tool {
48969
48985
  const childrenIds = underPointer.getChildrenIds();
48970
48986
  console.log("UNDERPOINTER", underPointer);
48971
48987
  console.log("CHILDREN", childrenIds);
48972
- const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
48988
+ const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => childrenIds && childrenIds.includes(item2.getId()));
48973
48989
  this.board.selection.add(itemsInFrame);
48974
48990
  }
48975
48991
  this.board.selection.setContext("EditUnderPointer");
@@ -49209,8 +49225,8 @@ class ShapeTool extends CustomTool {
49209
49225
  resizeType = "leftBottom";
49210
49226
  bounds = new Mbr;
49211
49227
  isDown = false;
49212
- constructor(board, name, item, settings) {
49213
- super(board, name, item);
49228
+ constructor(board, name, item2, settings) {
49229
+ super(board, name, item2);
49214
49230
  this.settings = settings;
49215
49231
  this.setCursor();
49216
49232
  }
@@ -49293,8 +49309,8 @@ class ShapeTool extends CustomTool {
49293
49309
 
49294
49310
  class StickerTool extends CustomTool {
49295
49311
  settings;
49296
- constructor(board, name, item, settings) {
49297
- super(board, name, item);
49312
+ constructor(board, name, item2, settings) {
49313
+ super(board, name, item2);
49298
49314
  this.settings = settings;
49299
49315
  this.setCursor();
49300
49316
  }
@@ -49600,7 +49616,7 @@ class Tools extends ToolContext {
49600
49616
  this.subject.publish(this);
49601
49617
  }
49602
49618
  sortFrames() {
49603
- const frames = this.board.items.listAll().filter((item) => item instanceof Frame2);
49619
+ const frames = this.board.items.listAll().filter((item2) => item2 instanceof Frame2);
49604
49620
  const sortedFrames = frames.sort((fr1, fr2) => {
49605
49621
  const mbr1 = fr1.getMbr();
49606
49622
  const mbr2 = fr2.getMbr();
@@ -49826,24 +49842,24 @@ function validateGroupData(groupData) {
49826
49842
  }
49827
49843
  // src/Items/RegisterItem.ts
49828
49844
  function registerItem({
49829
- item,
49845
+ item: item2,
49830
49846
  defaultData: defaultData2,
49831
49847
  toolData
49832
49848
  }) {
49833
49849
  const { itemType } = defaultData2;
49834
- itemFactories[itemType] = createItemFactory(item, defaultData2);
49850
+ itemFactories[itemType] = createItemFactory(item2, defaultData2);
49835
49851
  itemValidators[itemType] = createItemValidator(defaultData2);
49836
49852
  if (toolData) {
49837
49853
  registeredTools[toolData.name] = toolData.tool;
49838
49854
  }
49839
49855
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
49840
49856
  }
49841
- function createItemFactory(item, defaultData2) {
49857
+ function createItemFactory(item2, defaultData2) {
49842
49858
  return function itemFactory(id, data, board) {
49843
49859
  if (data.itemType !== defaultData2.itemType) {
49844
49860
  throw new Error(`Invalid data for ${defaultData2.itemType}`);
49845
49861
  }
49846
- return new item(board, id, defaultData2).setId(id).deserialize(data);
49862
+ return new item2(board, id, defaultData2).setId(id).deserialize(data);
49847
49863
  };
49848
49864
  }
49849
49865
  function createItemValidator(defaultData2) {
@@ -49858,7 +49874,7 @@ function createItemValidator(defaultData2) {
49858
49874
  }
49859
49875
  function createItemCommandFactory(itemType) {
49860
49876
  return function itemCommandFactory(items, operation) {
49861
- return new BaseCommand(items.filter((item) => item.itemType === itemType), operation);
49877
+ return new BaseCommand(items.filter((item2) => item2.itemType === itemType), operation);
49862
49878
  };
49863
49879
  }
49864
49880
  // src/Items/Examples/Star/AddStar.ts
@@ -50883,8 +50899,8 @@ class Camera {
50883
50899
  this.observableItem = null;
50884
50900
  }
50885
50901
  }
50886
- subscribeToItem(item) {
50887
- this.observableItem = item;
50902
+ subscribeToItem(item2) {
50903
+ this.observableItem = item2;
50888
50904
  this.observableItem.subject.subscribe(this.observeItem);
50889
50905
  }
50890
50906
  observeItem = () => {
@@ -51110,7 +51126,7 @@ class Camera {
51110
51126
  }
51111
51127
  addToView(mbr, inView) {
51112
51128
  if (!mbr.isEnclosedBy(this.getMbr())) {
51113
- this.viewRectangle(inView.reduce((acc, item) => acc.combine(item.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
51129
+ this.viewRectangle(inView.reduce((acc, item2) => acc.combine(item2.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
51114
51130
  }
51115
51131
  }
51116
51132
  viewRectangle(mbr, offsetInPercent = 10, duration = 500) {
@@ -52719,8 +52735,8 @@ class Presence {
52719
52735
  <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}"/>
52720
52736
  </svg>`;
52721
52737
  }
52722
- renderItemMbr(context, item, color2, customScale) {
52723
- const mbr = item.getMbr();
52738
+ renderItemMbr(context, item2, color2, customScale) {
52739
+ const mbr = item2.getMbr();
52724
52740
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
52725
52741
  mbr.borderColor = color2;
52726
52742
  mbr.render(context);
@@ -52860,8 +52876,8 @@ class Presence {
52860
52876
  selectionMbr.strokeWidth = 1 / context.matrix.scaleX;
52861
52877
  selectionMbr.borderColor = selection.color;
52862
52878
  selectionMbr.render(context);
52863
- for (const item of selection.selection) {
52864
- this.renderItemMbr(context, item, selection.color);
52879
+ for (const item2 of selection.selection) {
52880
+ this.renderItemMbr(context, item2, selection.color);
52865
52881
  }
52866
52882
  }
52867
52883
  }
@@ -52894,14 +52910,14 @@ class SelectionItems {
52894
52910
  items = new Map;
52895
52911
  add(value) {
52896
52912
  if (Array.isArray(value)) {
52897
- value.forEach((item) => this.items.set(item.getId(), item));
52913
+ value.forEach((item2) => this.items.set(item2.getId(), item2));
52898
52914
  } else {
52899
52915
  this.items.set(value.getId(), value);
52900
52916
  }
52901
52917
  }
52902
52918
  remove(value) {
52903
52919
  if (Array.isArray(value)) {
52904
- value.forEach((item) => this.items.delete(item.getId()));
52920
+ value.forEach((item2) => this.items.delete(item2.getId()));
52905
52921
  } else {
52906
52922
  this.items.delete(value.getId());
52907
52923
  }
@@ -52931,8 +52947,8 @@ class SelectionItems {
52931
52947
  if (this.isEmpty()) {
52932
52948
  return false;
52933
52949
  }
52934
- for (const item of this.items.values()) {
52935
- if (item.itemType !== "RichText") {
52950
+ for (const item2 of this.items.values()) {
52951
+ if (item2.itemType !== "RichText") {
52936
52952
  return false;
52937
52953
  }
52938
52954
  }
@@ -52942,14 +52958,14 @@ class SelectionItems {
52942
52958
  if (this.isEmpty()) {
52943
52959
  return false;
52944
52960
  }
52945
- return Array.from(this.items).every(([, item]) => item.itemType === itemType);
52961
+ return Array.from(this.items).every(([, item2]) => item2.itemType === itemType);
52946
52962
  }
52947
52963
  isItemTypes(itemTypes) {
52948
52964
  if (this.isEmpty()) {
52949
52965
  return false;
52950
52966
  }
52951
- for (const item of this.items.values()) {
52952
- if (!itemTypes.includes(item.itemType)) {
52967
+ for (const item2 of this.items.values()) {
52968
+ if (!itemTypes.includes(item2.itemType)) {
52953
52969
  return false;
52954
52970
  }
52955
52971
  }
@@ -52957,16 +52973,16 @@ class SelectionItems {
52957
52973
  }
52958
52974
  getItemTypes() {
52959
52975
  const itemTypes = new Set;
52960
- this.items.forEach((item) => itemTypes.add(item.itemType));
52976
+ this.items.forEach((item2) => itemTypes.add(item2.itemType));
52961
52977
  return Array.from(itemTypes);
52962
52978
  }
52963
52979
  getItemsByItemTypes(itemTypes) {
52964
- return Array.from(this.items.values()).filter((item) => itemTypes.includes(item.itemType));
52980
+ return Array.from(this.items.values()).filter((item2) => itemTypes.includes(item2.itemType));
52965
52981
  }
52966
52982
  getIdsByItemTypes(itemTypes) {
52967
52983
  const ids = [];
52968
- this.items.forEach((item, id) => {
52969
- if (itemTypes.includes(item.itemType)) {
52984
+ this.items.forEach((item2, id) => {
52985
+ if (itemTypes.includes(item2.itemType)) {
52970
52986
  ids.push(id);
52971
52987
  }
52972
52988
  });
@@ -52976,7 +52992,7 @@ class SelectionItems {
52976
52992
  return this.isSingle() ? this.items.values().next().value || null : null;
52977
52993
  }
52978
52994
  listByIds(itemIdList) {
52979
- return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
52995
+ return itemIdList.map((id) => this.items.get(id)).filter((item2) => item2 !== undefined);
52980
52996
  }
52981
52997
  ids() {
52982
52998
  return Array.from(this.items.keys());
@@ -52987,7 +53003,7 @@ class SelectionItems {
52987
53003
  return;
52988
53004
  }
52989
53005
  const mbr = items[0].getMbr();
52990
- items.slice(1).forEach((item) => mbr.combine(item.getMbr()));
53006
+ items.slice(1).forEach((item2) => mbr.combine(item2.getMbr()));
52991
53007
  return mbr;
52992
53008
  }
52993
53009
  }
@@ -53192,33 +53208,33 @@ function handleMultipleItemsResize({
53192
53208
  const translation = {};
53193
53209
  const items = itemsToResize ? itemsToResize : board.selection.items.list();
53194
53210
  board.items.getComments().forEach((comment2) => {
53195
- if (items.some((item) => item.getId() === comment2.getItemToFollow())) {
53211
+ if (items.some((item2) => item2.getId() === comment2.getItemToFollow())) {
53196
53212
  items.push(comment2);
53197
53213
  }
53198
53214
  });
53199
- for (const item of items) {
53200
- let itemX = item.getMbr().left;
53201
- let itemY = item.getMbr().top;
53202
- if (item.itemType === "Drawing") {
53203
- itemX = item.transformation.matrix.translateX;
53204
- itemY = item.transformation.matrix.translateY;
53215
+ for (const item2 of items) {
53216
+ let itemX = item2.getMbr().left;
53217
+ let itemY = item2.getMbr().top;
53218
+ if (item2.itemType === "Drawing") {
53219
+ itemX = item2.transformation.matrix.translateX;
53220
+ itemY = item2.transformation.matrix.translateY;
53205
53221
  }
53206
53222
  const deltaX = itemX - initMbr.left;
53207
53223
  const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
53208
53224
  const deltaY = itemY - initMbr.top;
53209
53225
  const translateY = deltaY * matrix.scaleY - deltaY + matrix.translateY;
53210
- if (item instanceof RichText) {
53211
- translation[item.getId()] = getRichTextTranslation({
53212
- item,
53226
+ if (item2 instanceof RichText) {
53227
+ translation[item2.getId()] = getRichTextTranslation({
53228
+ item: item2,
53213
53229
  isWidth,
53214
53230
  isHeight,
53215
53231
  matrix,
53216
53232
  translateX,
53217
53233
  translateY
53218
53234
  });
53219
- } else if (item instanceof AINode) {
53220
- translation[item.getId()] = getAINodeTranslation({
53221
- item,
53235
+ } else if (item2 instanceof AINode) {
53236
+ translation[item2.getId()] = getAINodeTranslation({
53237
+ item: item2,
53222
53238
  isWidth,
53223
53239
  isHeight,
53224
53240
  matrix,
@@ -53226,8 +53242,8 @@ function handleMultipleItemsResize({
53226
53242
  translateY
53227
53243
  });
53228
53244
  } else {
53229
- translation[item.getId()] = getItemTranslation({
53230
- item,
53245
+ translation[item2.getId()] = getItemTranslation({
53246
+ item: item2,
53231
53247
  isWidth,
53232
53248
  isHeight,
53233
53249
  matrix,
@@ -53240,7 +53256,7 @@ function handleMultipleItemsResize({
53240
53256
  return translation;
53241
53257
  }
53242
53258
  function getRichTextTranslation({
53243
- item,
53259
+ item: item2,
53244
53260
  isWidth,
53245
53261
  isHeight,
53246
53262
  matrix,
@@ -53248,11 +53264,11 @@ function getRichTextTranslation({
53248
53264
  translateY
53249
53265
  }) {
53250
53266
  if (isWidth) {
53251
- item.editor.setMaxWidth(item.getWidth() / item.transformation.getScale().x * matrix.scaleX);
53267
+ item2.editor.setMaxWidth(item2.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
53252
53268
  return {
53253
53269
  class: "Transformation",
53254
53270
  method: "scaleByTranslateBy",
53255
- item: [item.getId()],
53271
+ item: [item2.getId()],
53256
53272
  translate: { x: matrix.translateX, y: 0 },
53257
53273
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53258
53274
  };
@@ -53260,7 +53276,7 @@ function getRichTextTranslation({
53260
53276
  return {
53261
53277
  class: "Transformation",
53262
53278
  method: "scaleByTranslateBy",
53263
- item: [item.getId()],
53279
+ item: [item2.getId()],
53264
53280
  translate: { x: translateX, y: translateY },
53265
53281
  scale: { x: 1, y: 1 }
53266
53282
  };
@@ -53268,14 +53284,14 @@ function getRichTextTranslation({
53268
53284
  return {
53269
53285
  class: "Transformation",
53270
53286
  method: "scaleByTranslateBy",
53271
- item: [item.getId()],
53287
+ item: [item2.getId()],
53272
53288
  translate: { x: translateX, y: translateY },
53273
53289
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53274
53290
  };
53275
53291
  }
53276
53292
  }
53277
53293
  function getAINodeTranslation({
53278
- item,
53294
+ item: item2,
53279
53295
  isWidth,
53280
53296
  isHeight,
53281
53297
  matrix,
@@ -53283,11 +53299,11 @@ function getAINodeTranslation({
53283
53299
  translateY
53284
53300
  }) {
53285
53301
  if (isWidth) {
53286
- item.text.editor.setMaxWidth(item.text.getWidth() / item.transformation.getScale().x * matrix.scaleX);
53302
+ item2.text.editor.setMaxWidth(item2.text.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
53287
53303
  return {
53288
53304
  class: "Transformation",
53289
53305
  method: "scaleByTranslateBy",
53290
- item: [item.getId()],
53306
+ item: [item2.getId()],
53291
53307
  translate: { x: matrix.translateX, y: 0 },
53292
53308
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53293
53309
  };
@@ -53295,7 +53311,7 @@ function getAINodeTranslation({
53295
53311
  return {
53296
53312
  class: "Transformation",
53297
53313
  method: "scaleByTranslateBy",
53298
- item: [item.getId()],
53314
+ item: [item2.getId()],
53299
53315
  translate: { x: translateX, y: translateY },
53300
53316
  scale: { x: 1, y: 1 }
53301
53317
  };
@@ -53303,14 +53319,14 @@ function getAINodeTranslation({
53303
53319
  return {
53304
53320
  class: "Transformation",
53305
53321
  method: "scaleByTranslateBy",
53306
- item: [item.getId()],
53322
+ item: [item2.getId()],
53307
53323
  translate: { x: translateX, y: translateY },
53308
53324
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53309
53325
  };
53310
53326
  }
53311
53327
  }
53312
53328
  function getItemTranslation({
53313
- item,
53329
+ item: item2,
53314
53330
  isWidth,
53315
53331
  isHeight,
53316
53332
  matrix,
@@ -53318,22 +53334,22 @@ function getItemTranslation({
53318
53334
  translateY,
53319
53335
  isShiftPressed
53320
53336
  }) {
53321
- if (item instanceof Sticker && (isWidth || isHeight)) {
53337
+ if (item2 instanceof Sticker && (isWidth || isHeight)) {
53322
53338
  return {
53323
53339
  class: "Transformation",
53324
53340
  method: "scaleByTranslateBy",
53325
- item: [item.getId()],
53341
+ item: [item2.getId()],
53326
53342
  translate: { x: translateX, y: translateY },
53327
53343
  scale: { x: 1, y: 1 }
53328
53344
  };
53329
53345
  } else {
53330
- if (item instanceof Frame2 && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
53331
- item.setFrameType("Custom");
53346
+ if (item2 instanceof Frame2 && item2.getCanChangeRatio() && isShiftPressed && item2.getFrameType() !== "Custom") {
53347
+ item2.setFrameType("Custom");
53332
53348
  }
53333
53349
  return {
53334
53350
  class: "Transformation",
53335
53351
  method: "scaleByTranslateBy",
53336
- item: [item.getId()],
53352
+ item: [item2.getId()],
53337
53353
  translate: { x: translateX, y: translateY },
53338
53354
  scale: { x: matrix.scaleX, y: matrix.scaleY }
53339
53355
  };
@@ -53606,11 +53622,11 @@ function transformItems({
53606
53622
  setSnapCursorPos
53607
53623
  }) {
53608
53624
  const items = selection.items.list();
53609
- const includesProportionalItem = items.some((item) => item.itemType === "Sticker" || item.itemType === "RichText" || item.itemType === "AINode" || item.itemType === "Video" || item.itemType === "Audio");
53625
+ const includesProportionalItem = items.some((item2) => item2.itemType === "Sticker" || item2.itemType === "RichText" || item2.itemType === "AINode" || item2.itemType === "Video" || item2.itemType === "Audio");
53610
53626
  if (includesProportionalItem && (isWidth || isHeight)) {
53611
53627
  return null;
53612
53628
  }
53613
- const isIncludesFixedFrame = items.some((item) => item instanceof Frame2 && !item.getCanChangeRatio());
53629
+ const isIncludesFixedFrame = items.some((item2) => item2 instanceof Frame2 && !item2.getCanChangeRatio());
53614
53630
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
53615
53631
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
53616
53632
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -53688,23 +53704,23 @@ function updateFrameChildren({
53688
53704
  nestingHighlighter
53689
53705
  }) {
53690
53706
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
53691
- board.selection.items.list().forEach((item) => {
53692
- if ("getChildrenIds" in item && item.getChildrenIds()) {
53693
- const currMbr = item.getMbr();
53707
+ board.selection.items.list().forEach((item2) => {
53708
+ if ("getChildrenIds" in item2 && item2.getChildrenIds()) {
53709
+ const currMbr = item2.getMbr();
53694
53710
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
53695
53711
  itemsToCheck.forEach((currItem) => {
53696
- if (item.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item.getId())) {
53697
- nestingHighlighter.add(item, currItem);
53712
+ if (item2.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item2.getId())) {
53713
+ nestingHighlighter.add(item2, currItem);
53698
53714
  } else {
53699
53715
  nestingHighlighter.remove(currItem);
53700
53716
  }
53701
53717
  });
53702
53718
  } else {
53703
53719
  groups.forEach((group) => {
53704
- if (group.handleNesting(item)) {
53705
- nestingHighlighter.add(group, item);
53720
+ if (group.handleNesting(item2)) {
53721
+ nestingHighlighter.add(group, item2);
53706
53722
  } else {
53707
- nestingHighlighter.remove(item);
53723
+ nestingHighlighter.remove(item2);
53708
53724
  }
53709
53725
  });
53710
53726
  }
@@ -53772,9 +53788,9 @@ class Transformer extends Tool {
53772
53788
  const pointer = this.board.pointer;
53773
53789
  const camera = this.board.camera;
53774
53790
  const items = this.selection.items;
53775
- const item = items.getSingle();
53791
+ const item2 = items.getSingle();
53776
53792
  let resizeType;
53777
- if (item && (item.itemType === "RichText" || item.itemType === "Sticker")) {
53793
+ if (item2 && (item2.itemType === "RichText" || item2.itemType === "Sticker")) {
53778
53794
  resizeType = getTextResizeType(pointer.point, camera.getScale(), mbr);
53779
53795
  } else {
53780
53796
  resizeType = getResizeType(pointer.point, camera.getScale(), mbr);
@@ -54028,8 +54044,8 @@ class SelectionTransformer extends Tool {
54028
54044
  return;
54029
54045
  }
54030
54046
  if (this.selection.items.isSingle()) {
54031
- const item = this.selection.items.getSingle();
54032
- if (item?.itemType === "Connector") {
54047
+ const item2 = this.selection.items.getSingle();
54048
+ if (item2?.itemType === "Connector") {
54033
54049
  this.tool = this.connectorTransformerTool;
54034
54050
  return;
54035
54051
  } else {
@@ -54112,16 +54128,16 @@ class BoardSelection {
54112
54128
  this.quickAddButtons = getQuickAddButtons(this, board);
54113
54129
  }
54114
54130
  serialize() {
54115
- const selectedItems = this.items.list().map((item) => item.getId());
54131
+ const selectedItems = this.items.list().map((item2) => item2.getId());
54116
54132
  return JSON.stringify(selectedItems);
54117
54133
  }
54118
54134
  deserialize(serializedData) {
54119
54135
  const selectedItems = JSON.parse(serializedData);
54120
54136
  this.removeAll();
54121
54137
  selectedItems.forEach((itemId) => {
54122
- const item = this.board.items.getById(itemId);
54123
- if (item) {
54124
- this.items.add(item);
54138
+ const item2 = this.board.items.getById(itemId);
54139
+ if (item2) {
54140
+ this.items.add(item2);
54125
54141
  }
54126
54142
  });
54127
54143
  }
@@ -54199,19 +54215,19 @@ class BoardSelection {
54199
54215
  this.updateQueue.clear();
54200
54216
  safeRequestAnimationFrame(this.updateScheduledObservers);
54201
54217
  };
54202
- itemObserver = (item) => {
54218
+ itemObserver = (item2) => {
54203
54219
  if (!this.shouldPublish) {
54204
54220
  return;
54205
54221
  }
54206
54222
  this.subject.publish(this);
54207
- this.itemSubject.publish(item);
54223
+ this.itemSubject.publish(item2);
54208
54224
  };
54209
54225
  decoratedItemObserver = this.decorateObserverToScheduleUpdate(this.itemObserver);
54210
54226
  add(value) {
54211
54227
  this.items.add(value);
54212
54228
  if (Array.isArray(value)) {
54213
- for (const item of value) {
54214
- item.subject.subscribe(this.itemObserver);
54229
+ for (const item2 of value) {
54230
+ item2.subject.subscribe(this.itemObserver);
54215
54231
  }
54216
54232
  } else {
54217
54233
  value.subject.subscribe(this.itemObserver);
@@ -54220,15 +54236,15 @@ class BoardSelection {
54220
54236
  this.itemsSubject.publish([]);
54221
54237
  }
54222
54238
  addAll() {
54223
- const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked);
54239
+ const items = this.board.items.listAll().filter((item2) => !item2.transformation.isLocked);
54224
54240
  this.add(items);
54225
54241
  this.setContext("SelectByRect");
54226
54242
  }
54227
54243
  remove(value) {
54228
54244
  this.items.remove(value);
54229
54245
  if (Array.isArray(value)) {
54230
- for (const item of value) {
54231
- item.subject.unsubscribe(this.itemObserver);
54246
+ for (const item2 of value) {
54247
+ item2.subject.unsubscribe(this.itemObserver);
54232
54248
  }
54233
54249
  } else {
54234
54250
  value.subject.unsubscribe(this.itemObserver);
@@ -54322,11 +54338,11 @@ class BoardSelection {
54322
54338
  if (!this.items.isSingle()) {
54323
54339
  return;
54324
54340
  }
54325
- const item = this.items.getSingle();
54326
- if (!item) {
54341
+ const item2 = this.items.getSingle();
54342
+ if (!item2) {
54327
54343
  return;
54328
54344
  }
54329
- const text5 = item.getRichText();
54345
+ const text5 = item2.getRichText();
54330
54346
  if (!text5) {
54331
54347
  return;
54332
54348
  }
@@ -54337,7 +54353,7 @@ class BoardSelection {
54337
54353
  if (shouldReplace || moveCursorToEnd) {
54338
54354
  text5.editor.moveCursorToEndOfTheText();
54339
54355
  }
54340
- this.setTextToEdit(item);
54356
+ this.setTextToEdit(item2);
54341
54357
  this.setContext("EditTextUnderPointer");
54342
54358
  if (shouldSelect) {
54343
54359
  text5.editor.selectWholeText();
@@ -54347,13 +54363,13 @@ class BoardSelection {
54347
54363
  editUnderPointer() {
54348
54364
  this.removeAll();
54349
54365
  const stack = this.board.items.getUnderPointer();
54350
- const item = stack.pop();
54351
- if (item) {
54352
- this.add(item);
54366
+ const item2 = stack.pop();
54367
+ if (item2) {
54368
+ this.add(item2);
54353
54369
  this.setTextToEdit(undefined);
54354
- const text5 = item.getRichText();
54370
+ const text5 = item2.getRichText();
54355
54371
  if (text5) {
54356
- this.setTextToEdit(item);
54372
+ this.setTextToEdit(item2);
54357
54373
  text5.editor.selectWholeText();
54358
54374
  this.board.items.subject.publish(this.board.items);
54359
54375
  }
@@ -54362,26 +54378,26 @@ class BoardSelection {
54362
54378
  this.setContext("None");
54363
54379
  }
54364
54380
  }
54365
- setTextToEdit(item) {
54381
+ setTextToEdit(item2) {
54366
54382
  if (this.textToEdit) {
54367
54383
  this.textToEdit.updateElement();
54368
54384
  this.textToEdit.enableRender();
54369
54385
  }
54370
- if (!(item && item.getRichText())) {
54386
+ if (!(item2 && item2.getRichText())) {
54371
54387
  this.textToEdit = undefined;
54372
54388
  return;
54373
54389
  }
54374
- const text5 = item.getRichText();
54390
+ const text5 = item2.getRichText();
54375
54391
  if (!text5) {
54376
54392
  return;
54377
54393
  }
54378
54394
  if (text5.isEmpty()) {
54379
- const textColor = tempStorage.getFontColor(item.itemType);
54380
- const textSize = tempStorage.getFontSize(item.itemType);
54381
- const highlightColor = tempStorage.getFontHighlight(item.itemType);
54382
- const styles = tempStorage.getFontStyles(item.itemType);
54383
- const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
54384
- const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
54395
+ const textColor = tempStorage.getFontColor(item2.itemType);
54396
+ const textSize = tempStorage.getFontSize(item2.itemType);
54397
+ const highlightColor = tempStorage.getFontHighlight(item2.itemType);
54398
+ const styles = tempStorage.getFontStyles(item2.itemType);
54399
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item2.itemType);
54400
+ const verticalAlignment = tempStorage.getVerticalAlignment(item2.itemType);
54385
54401
  if (textColor) {
54386
54402
  text5.setSelectionFontColor(textColor, "None");
54387
54403
  }
@@ -54389,7 +54405,7 @@ class BoardSelection {
54389
54405
  this.emit({
54390
54406
  class: "RichText",
54391
54407
  method: "setFontSize",
54392
- item: [item.getId()],
54408
+ item: [item2.getId()],
54393
54409
  fontSize: textSize,
54394
54410
  context: this.getContext()
54395
54411
  });
@@ -54401,10 +54417,10 @@ class BoardSelection {
54401
54417
  const stylesArr = styles;
54402
54418
  text5.setSelectionFontStyle(stylesArr, "None");
54403
54419
  }
54404
- if (horizontalAlignment && !(item instanceof Sticker)) {
54420
+ if (horizontalAlignment && !(item2 instanceof Sticker)) {
54405
54421
  text5.setSelectionHorisontalAlignment(horizontalAlignment);
54406
54422
  }
54407
- if (verticalAlignment && !(item instanceof Sticker)) {
54423
+ if (verticalAlignment && !(item2 instanceof Sticker)) {
54408
54424
  this.setVerticalAlignment(verticalAlignment);
54409
54425
  }
54410
54426
  }
@@ -54437,8 +54453,8 @@ class BoardSelection {
54437
54453
  }
54438
54454
  selectEnclosedOrCrossedBy(rect) {
54439
54455
  this.removeAll();
54440
- const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => !item.transformation.isLocked);
54441
- 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);
54456
+ const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => !item2.transformation.isLocked);
54457
+ 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);
54442
54458
  if (list6.length !== 0) {
54443
54459
  this.add(list6);
54444
54460
  this.setContext("SelectByRect");
@@ -54452,14 +54468,14 @@ class BoardSelection {
54452
54468
  canChangeText() {
54453
54469
  return Boolean(this.items.isSingle() && this.items.getSingle()?.getRichText());
54454
54470
  }
54455
- handleItemCopy(item, copiedItemsMap) {
54456
- const serializedData = item.serialize(true);
54457
- const zIndex = this.board.items.index.getZIndex(item);
54458
- if (item.itemType === "Comment") {
54471
+ handleItemCopy(item2, copiedItemsMap) {
54472
+ const serializedData = item2.serialize(true);
54473
+ const zIndex = this.board.items.index.getZIndex(item2);
54474
+ if (item2.itemType === "Comment") {
54459
54475
  return;
54460
54476
  }
54461
- if (item.itemType === "Connector" && serializedData.itemType === "Connector") {
54462
- const connector = item;
54477
+ if (item2.itemType === "Connector" && serializedData.itemType === "Connector") {
54478
+ const connector = item2;
54463
54479
  const startPoint = connector.getStartPoint();
54464
54480
  const endPoint = connector.getEndPoint();
54465
54481
  const startItemId = startPoint.pointType !== "Board" ? startPoint.item.getId() : null;
@@ -54475,19 +54491,19 @@ class BoardSelection {
54475
54491
  serializedData.endPoint = new BoardPoint(endPoint.x, endPoint.y).serialize();
54476
54492
  }
54477
54493
  }
54478
- const textItem = item.getRichText()?.getTextString();
54494
+ const textItem = item2.getRichText()?.getTextString();
54479
54495
  const copyText = conf.i18n.t("frame.copy");
54480
54496
  const isCopyTextExist = textItem?.includes(copyText);
54481
- const isChangeCopiedFrameText = item.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
54497
+ const isChangeCopiedFrameText = item2.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
54482
54498
  if (isChangeCopiedFrameText) {
54483
54499
  const copiedFrameText = copyText + (textItem || serializedData.text?.placeholderText);
54484
- item.getRichText()?.editor.clearText();
54485
- item.getRichText()?.editor.addText(copiedFrameText);
54486
- serializedData.text = item.getRichText()?.serialize();
54487
- item.getRichText()?.editor.clearText();
54488
- item.getRichText()?.editor.addText(textItem || "");
54500
+ item2.getRichText()?.editor.clearText();
54501
+ item2.getRichText()?.editor.addText(copiedFrameText);
54502
+ serializedData.text = item2.getRichText()?.serialize();
54503
+ item2.getRichText()?.editor.clearText();
54504
+ item2.getRichText()?.editor.addText(textItem || "");
54489
54505
  }
54490
- copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
54506
+ copiedItemsMap[item2.getId()] = { ...serializedData, zIndex };
54491
54507
  }
54492
54508
  copy(skipImageBlobCopy) {
54493
54509
  const copiedItemsMap = {};
@@ -54496,12 +54512,12 @@ class BoardSelection {
54496
54512
  this.handleItemCopy(single, copiedItemsMap);
54497
54513
  return { imageElement: single.image, imageData: copiedItemsMap };
54498
54514
  }
54499
- this.list().forEach((item) => {
54500
- this.handleItemCopy(item, copiedItemsMap);
54515
+ this.list().forEach((item2) => {
54516
+ this.handleItemCopy(item2, copiedItemsMap);
54501
54517
  });
54502
- this.list().flatMap((item) => {
54503
- if (item instanceof Frame2) {
54504
- return item.getChildrenIds();
54518
+ this.list().flatMap((item2) => {
54519
+ if (item2 instanceof Frame2) {
54520
+ return item2.getChildrenIds();
54505
54521
  }
54506
54522
  return [];
54507
54523
  }).forEach((id) => {
@@ -54529,11 +54545,11 @@ class BoardSelection {
54529
54545
  let maxRichText = null;
54530
54546
  let minRichText = null;
54531
54547
  const itemType = items[0].itemType;
54532
- for (const item of items) {
54533
- if (item.itemType !== itemType) {
54548
+ for (const item2 of items) {
54549
+ if (item2.itemType !== itemType) {
54534
54550
  return null;
54535
54551
  }
54536
- const richText = item.getRichText();
54552
+ const richText = item2.getRichText();
54537
54553
  if (richText) {
54538
54554
  if (!maxRichText || richText.getFontSize() > maxRichText.getFontSize()) {
54539
54555
  maxRichText = richText;
@@ -54639,22 +54655,22 @@ class BoardSelection {
54639
54655
  }
54640
54656
  nestSelectedItems(unselectedItem, checkFrames = true) {
54641
54657
  const selected = this.board.selection.items.list();
54642
- if (unselectedItem && !selected.find((item) => item.getId() === unselectedItem.getId())) {
54658
+ if (unselectedItem && !selected.find((item2) => item2.getId() === unselectedItem.getId())) {
54643
54659
  selected.push(unselectedItem);
54644
54660
  }
54645
- const selectedMbr = selected.reduce((acc, item) => {
54661
+ const selectedMbr = selected.reduce((acc, item2) => {
54646
54662
  if (!acc) {
54647
- return item.getMbr();
54663
+ return item2.getMbr();
54648
54664
  }
54649
- return acc.combine(item.getMbr());
54665
+ return acc.combine(item2.getMbr());
54650
54666
  }, undefined);
54651
54667
  if (selectedMbr) {
54652
- const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
54668
+ const selectedMap = Object.fromEntries(selected.map((item2) => [item2.getId(), { item: item2, nested: false }]));
54653
54669
  const enclosedGroups = this.board.items.getGroupItemsEnclosedOrCrossed(selectedMbr?.left, selectedMbr?.top, selectedMbr?.right, selectedMbr?.bottom);
54654
54670
  enclosedGroups.forEach((group) => {
54655
- selected.forEach((item) => {
54656
- if (group.handleNesting(item)) {
54657
- selectedMap[item.getId()].nested = group;
54671
+ selected.forEach((item2) => {
54672
+ if (group.handleNesting(item2)) {
54673
+ selectedMap[item2.getId()].nested = group;
54658
54674
  }
54659
54675
  });
54660
54676
  });
@@ -54678,11 +54694,11 @@ class BoardSelection {
54678
54694
  if (childrenIds && checkFrames) {
54679
54695
  const currGroup = val.item;
54680
54696
  const currMbr = currGroup.getMbr();
54681
- const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
54682
- const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
54697
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item2) => !!item2);
54698
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board" || item2.parent === currGroup.getId());
54683
54699
  const uniqueItems = new Set;
54684
- const toCheck = [...children, ...underGroup].filter((item) => {
54685
- const id = item.getId();
54700
+ const toCheck = [...children, ...underGroup].filter((item2) => {
54701
+ const id = item2.getId();
54686
54702
  if (uniqueItems.has(id)) {
54687
54703
  return false;
54688
54704
  }
@@ -54723,8 +54739,8 @@ class BoardSelection {
54723
54739
  addItemToTranslation(childId);
54724
54740
  }
54725
54741
  }
54726
- const createTranslationWithComments = (item) => {
54727
- const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item.getId());
54742
+ const createTranslationWithComments = (item2) => {
54743
+ const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item2.getId());
54728
54744
  for (const comment2 of followedComments) {
54729
54745
  translation[comment2.getId()] = {
54730
54746
  class: "Transformation",
@@ -54785,21 +54801,21 @@ class BoardSelection {
54785
54801
  newData: { borderColor }
54786
54802
  };
54787
54803
  const operations2 = {};
54788
- this.items.list().forEach((item) => {
54789
- if (!operations2[item.itemType]) {
54804
+ this.items.list().forEach((item2) => {
54805
+ if (!operations2[item2.itemType]) {
54790
54806
  const operationCopy = { ...operation };
54791
- if (item.itemType === "Connector") {
54807
+ if (item2.itemType === "Connector") {
54792
54808
  operationCopy.method = "setLineColor";
54793
54809
  operationCopy.lineColor = borderColor;
54794
- } else if (item.itemType === "Drawing") {
54810
+ } else if (item2.itemType === "Drawing") {
54795
54811
  operationCopy.method = "setStrokeColor";
54796
54812
  operationCopy.color = borderColor;
54797
54813
  } else {
54798
54814
  operationCopy.borderColor = borderColor;
54799
54815
  }
54800
- operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
54816
+ operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
54801
54817
  } else {
54802
- operations2[item.itemType].item.push(item.getId());
54818
+ operations2[item2.itemType].item.push(item2.getId());
54803
54819
  }
54804
54820
  });
54805
54821
  Object.values(operations2).forEach((op) => {
@@ -54814,13 +54830,13 @@ class BoardSelection {
54814
54830
  newData: { borderWidth: width2 }
54815
54831
  };
54816
54832
  const operations2 = {};
54817
- this.items.list().forEach((item) => {
54818
- if (!operations2[item.itemType]) {
54833
+ this.items.list().forEach((item2) => {
54834
+ if (!operations2[item2.itemType]) {
54819
54835
  const operationCopy = { ...operation };
54820
- if (item.itemType === "Connector") {
54836
+ if (item2.itemType === "Connector") {
54821
54837
  operationCopy.method = "setLineWidth";
54822
54838
  operationCopy.lineWidth = width2;
54823
- } else if (item.itemType === "Drawing") {
54839
+ } else if (item2.itemType === "Drawing") {
54824
54840
  operationCopy.method = "setStrokeWidth";
54825
54841
  operationCopy.width = width2;
54826
54842
  operationCopy.prevWidth = this.getStrokeWidth();
@@ -54828,9 +54844,9 @@ class BoardSelection {
54828
54844
  operationCopy.borderWidth = width2;
54829
54845
  operationCopy.prevBorderWidth = this.getStrokeWidth();
54830
54846
  }
54831
- operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
54847
+ operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
54832
54848
  } else {
54833
- operations2[item.itemType].item.push(item.getId());
54849
+ operations2[item2.itemType].item.push(item2.getId());
54834
54850
  }
54835
54851
  });
54836
54852
  Object.values(operations2).forEach((op) => {
@@ -54846,11 +54862,11 @@ class BoardSelection {
54846
54862
  newData: { backgroundColor }
54847
54863
  };
54848
54864
  const operations2 = {};
54849
- this.items.list().forEach((item) => {
54850
- if (!operations2[item.itemType]) {
54851
- operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
54865
+ this.items.list().forEach((item2) => {
54866
+ if (!operations2[item2.itemType]) {
54867
+ operations2[item2.itemType] = { ...operation, class: item2.itemType, item: [item2.getId()] };
54852
54868
  } else {
54853
- operations2[item.itemType].item.push(item.getId());
54869
+ operations2[item2.itemType].item.push(item2.getId());
54854
54870
  }
54855
54871
  });
54856
54872
  Object.values(operations2).forEach((op) => {
@@ -54874,9 +54890,9 @@ class BoardSelection {
54874
54890
  }
54875
54891
  setFrameType(frameType) {
54876
54892
  const items = this.items.list();
54877
- items.forEach((item) => {
54878
- if (item instanceof Frame2) {
54879
- item.setFrameType(frameType);
54893
+ items.forEach((item2) => {
54894
+ if (item2 instanceof Frame2) {
54895
+ item2.setFrameType(frameType);
54880
54896
  }
54881
54897
  });
54882
54898
  }
@@ -54895,21 +54911,21 @@ class BoardSelection {
54895
54911
  setFontSize(size) {
54896
54912
  const fontSize = size === "auto" ? size : toFiniteNumber(size);
54897
54913
  const itemsOps = [];
54898
- for (const item of this.items.list()) {
54899
- const text5 = item.getRichText();
54914
+ for (const item2 of this.items.list()) {
54915
+ const text5 = item2.getRichText();
54900
54916
  if (!text5) {
54901
54917
  continue;
54902
54918
  }
54903
54919
  const ops = text5.setSelectionFontSize(fontSize, this.context);
54904
54920
  itemsOps.push({
54905
- item: item.getId(),
54921
+ item: item2.getId(),
54906
54922
  selection: text5.editor.getSelection(),
54907
54923
  ops
54908
54924
  });
54909
- if (item.itemType === "Sticker" && fontSize === "auto") {
54910
- tempStorage.remove(`fontSize_${item.itemType}`);
54911
- } else if (item.itemType !== "AINode") {
54912
- tempStorage.setFontSize(item.itemType, fontSize);
54925
+ if (item2.itemType === "Sticker" && fontSize === "auto") {
54926
+ tempStorage.remove(`fontSize_${item2.itemType}`);
54927
+ } else if (item2.itemType !== "AINode") {
54928
+ tempStorage.setFontSize(item2.itemType, fontSize);
54913
54929
  }
54914
54930
  }
54915
54931
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -54932,8 +54948,8 @@ class BoardSelection {
54932
54948
  setFontStyle(fontStyle) {
54933
54949
  const isMultiple = !this.items.isSingle();
54934
54950
  const itemsOps = [];
54935
- for (const item of this.items.list()) {
54936
- const text5 = item.getRichText();
54951
+ for (const item2 of this.items.list()) {
54952
+ const text5 = item2.getRichText();
54937
54953
  if (!text5) {
54938
54954
  continue;
54939
54955
  }
@@ -54942,12 +54958,12 @@ class BoardSelection {
54942
54958
  }
54943
54959
  const ops = text5.setSelectionFontStyle(fontStyle, this.context);
54944
54960
  itemsOps.push({
54945
- item: item.getId(),
54961
+ item: item2.getId(),
54946
54962
  selection: text5.editor.getSelection(),
54947
54963
  ops
54948
54964
  });
54949
- if (item.itemType !== "AINode") {
54950
- tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
54965
+ if (item2.itemType !== "AINode") {
54966
+ tempStorage.setFontStyles(item2.itemType, text5.getFontStyles());
54951
54967
  }
54952
54968
  }
54953
54969
  this.emitApplied({
@@ -54959,8 +54975,8 @@ class BoardSelection {
54959
54975
  setFontColor(fontColor) {
54960
54976
  const isMultiple = !this.items.isSingle();
54961
54977
  const itemsOps = [];
54962
- for (const item of this.items.list()) {
54963
- const text5 = item.getRichText();
54978
+ for (const item2 of this.items.list()) {
54979
+ const text5 = item2.getRichText();
54964
54980
  if (!text5) {
54965
54981
  continue;
54966
54982
  }
@@ -54969,11 +54985,11 @@ class BoardSelection {
54969
54985
  }
54970
54986
  const ops = text5.setSelectionFontColor(fontColor, this.context);
54971
54987
  itemsOps.push({
54972
- item: item.getId(),
54988
+ item: item2.getId(),
54973
54989
  selection: text5.editor.getSelection(),
54974
54990
  ops
54975
54991
  });
54976
- tempStorage.setFontColor(item.itemType, fontColor);
54992
+ tempStorage.setFontColor(item2.itemType, fontColor);
54977
54993
  }
54978
54994
  this.emitApplied({
54979
54995
  class: "RichText",
@@ -55002,8 +55018,8 @@ class BoardSelection {
55002
55018
  setFontHighlight(fontHighlight) {
55003
55019
  const isMultiple = !this.items.isSingle();
55004
55020
  const itemsOps = [];
55005
- for (const item of this.items.list()) {
55006
- const text5 = item.getRichText();
55021
+ for (const item2 of this.items.list()) {
55022
+ const text5 = item2.getRichText();
55007
55023
  if (!text5) {
55008
55024
  continue;
55009
55025
  }
@@ -55012,12 +55028,12 @@ class BoardSelection {
55012
55028
  }
55013
55029
  const ops = text5.setSelectionFontHighlight(fontHighlight, this.context);
55014
55030
  itemsOps.push({
55015
- item: item.getId(),
55031
+ item: item2.getId(),
55016
55032
  selection: text5.editor.getSelection(),
55017
55033
  ops
55018
55034
  });
55019
- if (item.itemType !== "AINode") {
55020
- tempStorage.setFontHighlight(item.itemType, fontHighlight);
55035
+ if (item2.itemType !== "AINode") {
55036
+ tempStorage.setFontHighlight(item2.itemType, fontHighlight);
55021
55037
  }
55022
55038
  }
55023
55039
  this.emitApplied({
@@ -55029,8 +55045,8 @@ class BoardSelection {
55029
55045
  setHorisontalAlignment(horisontalAlignment) {
55030
55046
  const isMultiple = !this.items.isSingle();
55031
55047
  const itemsOps = [];
55032
- for (const item of this.items.list()) {
55033
- const text5 = item.getRichText();
55048
+ for (const item2 of this.items.list()) {
55049
+ const text5 = item2.getRichText();
55034
55050
  if (!text5) {
55035
55051
  continue;
55036
55052
  }
@@ -55039,11 +55055,11 @@ class BoardSelection {
55039
55055
  }
55040
55056
  const ops = text5.setSelectionHorisontalAlignment(horisontalAlignment, this.context);
55041
55057
  itemsOps.push({
55042
- item: item.getId(),
55058
+ item: item2.getId(),
55043
55059
  selection: text5.editor.getSelection(),
55044
55060
  ops
55045
55061
  });
55046
- tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
55062
+ tempStorage.setHorizontalAlignment(item2.itemType, horisontalAlignment);
55047
55063
  }
55048
55064
  this.emitApplied({
55049
55065
  class: "RichText",
@@ -55059,23 +55075,23 @@ class BoardSelection {
55059
55075
  verticalAlignment
55060
55076
  });
55061
55077
  if (this.items.isSingle()) {
55062
- const item = this.items.getSingle();
55063
- if (!item) {
55078
+ const item2 = this.items.getSingle();
55079
+ if (!item2) {
55064
55080
  return;
55065
55081
  }
55066
- const text5 = item.getRichText();
55082
+ const text5 = item2.getRichText();
55067
55083
  if (!text5) {
55068
55084
  return;
55069
55085
  }
55070
- tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
55071
- if (item instanceof RichText) {
55072
- item.setEditorFocus(this.context);
55086
+ tempStorage.setVerticalAlignment(item2.itemType, verticalAlignment);
55087
+ if (item2 instanceof RichText) {
55088
+ item2.setEditorFocus(this.context);
55073
55089
  }
55074
55090
  text5.setEditorFocus(this.context);
55075
55091
  }
55076
55092
  }
55077
55093
  removeFromBoard() {
55078
- const isLocked = this.items.list().some((item) => item.transformation.isLocked);
55094
+ const isLocked = this.items.list().some((item2) => item2.transformation.isLocked);
55079
55095
  if (isLocked) {
55080
55096
  return;
55081
55097
  }
@@ -55098,7 +55114,7 @@ class BoardSelection {
55098
55114
  }
55099
55115
  getIsLockedSelection() {
55100
55116
  const items = this.list();
55101
- return items.some((item) => item.transformation.isLocked);
55117
+ return items.some((item2) => item2.transformation.isLocked);
55102
55118
  }
55103
55119
  isLocked() {
55104
55120
  return false;
@@ -55125,9 +55141,9 @@ class BoardSelection {
55125
55141
  }
55126
55142
  async duplicate() {
55127
55143
  const mediaIds = [];
55128
- this.items.list().forEach((item) => {
55129
- if ("getStorageId" in item) {
55130
- const storageId = item.getStorageId();
55144
+ this.items.list().forEach((item2) => {
55145
+ if ("getStorageId" in item2) {
55146
+ const storageId = item2.getStorageId();
55131
55147
  if (storageId) {
55132
55148
  mediaIds.push(storageId);
55133
55149
  }
@@ -55137,7 +55153,7 @@ class BoardSelection {
55137
55153
  if (!canDuplicate) {
55138
55154
  return;
55139
55155
  }
55140
- const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item]) => item.itemType !== "Group"));
55156
+ const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item2]) => item2.itemType !== "Group"));
55141
55157
  this.board.duplicate(filteredItemMap);
55142
55158
  this.setContext("EditUnderPointer");
55143
55159
  }
@@ -55171,10 +55187,10 @@ class BoardSelection {
55171
55187
  lastAssistantMessageId
55172
55188
  };
55173
55189
  }
55174
- renderItemMbr(context, item, customScale) {
55175
- const mbr = item.getMbr();
55190
+ renderItemMbr(context, item2, customScale) {
55191
+ const mbr = item2.getMbr();
55176
55192
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
55177
- const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
55193
+ const selectionColor = item2.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
55178
55194
  mbr.borderColor = selectionColor;
55179
55195
  mbr.render(context);
55180
55196
  }
@@ -55190,8 +55206,8 @@ class BoardSelection {
55190
55206
  }
55191
55207
  if (!this.transformationRenderBlock) {
55192
55208
  if (this.shouldRenderItemsMbr) {
55193
- for (const item of this.items.list()) {
55194
- this.renderItemMbr(context, item);
55209
+ for (const item2 of this.items.list()) {
55210
+ this.renderItemMbr(context, item2);
55195
55211
  }
55196
55212
  }
55197
55213
  this.tool.render(context);
@@ -55203,7 +55219,7 @@ class BoardSelection {
55203
55219
  if (single && single instanceof AINode) {
55204
55220
  const contextItemsIds = single.getContextItems();
55205
55221
  if (contextItemsIds.length) {
55206
- const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
55222
+ const newContextItems = this.board.items.listAll().filter((item2) => contextItemsIds.includes(item2.getId()));
55207
55223
  contextItems.push(...newContextItems);
55208
55224
  }
55209
55225
  }
@@ -55221,15 +55237,15 @@ class BoardSelection {
55221
55237
  }
55222
55238
  }
55223
55239
  }
55224
- contextItems.forEach((item) => {
55225
- if (item instanceof AINode) {
55226
- const path2 = item.getPath();
55240
+ contextItems.forEach((item2) => {
55241
+ if (item2 instanceof AINode) {
55242
+ const path2 = item2.getPath();
55227
55243
  path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
55228
55244
  path2.setBorderWidth(2);
55229
55245
  path2.setBackgroundColor("none");
55230
55246
  path2.render(context);
55231
55247
  } else {
55232
- const itemRect = item.getMbr();
55248
+ const itemRect = item2.getMbr();
55233
55249
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
55234
55250
  itemRect.strokeWidth = 2;
55235
55251
  itemRect.render(context);
@@ -55730,16 +55746,16 @@ class Board {
55730
55746
  applyBoardOperation(op) {
55731
55747
  switch (op.method) {
55732
55748
  case "moveToZIndex": {
55733
- const item = this.index.getById(op.item);
55734
- if (!item) {
55749
+ const item2 = this.index.getById(op.item);
55750
+ if (!item2) {
55735
55751
  return;
55736
55752
  }
55737
- return this.index.moveToZIndex(item, op.zIndex);
55753
+ return this.index.moveToZIndex(item2, op.zIndex);
55738
55754
  }
55739
55755
  case "moveManyToZIndex": {
55740
55756
  for (const id in op.item) {
55741
- const item = this.items.getById(id);
55742
- if (!item) {
55757
+ const item2 = this.items.getById(id);
55758
+ if (!item2) {
55743
55759
  delete op.item.id;
55744
55760
  }
55745
55761
  }
@@ -55761,11 +55777,11 @@ class Board {
55761
55777
  }
55762
55778
  return this.index.moveSecondAfterFirst(first, second);
55763
55779
  case "bringToFront": {
55764
- const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
55780
+ const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
55765
55781
  return this.index.bringManyToFront(items);
55766
55782
  }
55767
55783
  case "sendToBack": {
55768
- const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
55784
+ const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
55769
55785
  return this.index.sendManyToBack(items);
55770
55786
  }
55771
55787
  case "add":
@@ -55789,82 +55805,82 @@ class Board {
55789
55805
  applyAddItems(op) {
55790
55806
  if (Array.isArray(op.item)) {
55791
55807
  const data = op.data;
55792
- const items = op.item.map((item2) => {
55793
- const created = this.createItem(item2, data[item2]);
55808
+ const items = op.item.map((item3) => {
55809
+ const created = this.createItem(item3, data[item3]);
55794
55810
  this.index.insert(created);
55795
55811
  return created;
55796
55812
  });
55797
- items.forEach((item2) => {
55798
- if (item2 instanceof Connector2 && data[item2.getId()]) {
55799
- const connectorData = data[item2.getId()];
55800
- item2.applyStartPoint(connectorData.startPoint);
55801
- item2.applyEndPoint(connectorData.endPoint);
55813
+ items.forEach((item3) => {
55814
+ if (item3 instanceof Connector2 && data[item3.getId()]) {
55815
+ const connectorData = data[item3.getId()];
55816
+ item3.applyStartPoint(connectorData.startPoint);
55817
+ item3.applyEndPoint(connectorData.endPoint);
55802
55818
  }
55803
55819
  });
55804
55820
  return;
55805
55821
  }
55806
- const item = this.createItem(op.item, op.data);
55807
- return this.index.insert(item);
55822
+ const item2 = this.createItem(op.item, op.data);
55823
+ return this.index.insert(item2);
55808
55824
  }
55809
55825
  applyAddLockedGroupOperation(op) {
55810
- const item = this.createItem(op.item, op.data);
55811
- const groupChildrenIds = item.getChildrenIds();
55812
- this.index.insert(item);
55826
+ const item2 = this.createItem(op.item, op.data);
55827
+ const groupChildrenIds = item2.getChildrenIds();
55828
+ this.index.insert(item2);
55813
55829
  const lastChildrenId = this.index.getById(groupChildrenIds[groupChildrenIds.length - 1]);
55814
55830
  if (lastChildrenId) {
55815
55831
  const zIndex = this.index.getZIndex(lastChildrenId) + 1;
55816
- this.index.moveToZIndex(item, zIndex);
55832
+ this.index.moveToZIndex(item2, zIndex);
55817
55833
  }
55818
- item.getChildren().forEach((item2) => {
55819
- item2.transformation.isLocked = true;
55834
+ item2.getChildren().forEach((item3) => {
55835
+ item3.transformation.isLocked = true;
55820
55836
  });
55821
- item.transformation.isLocked = true;
55837
+ item2.transformation.isLocked = true;
55822
55838
  }
55823
55839
  applyRemoveOperation(op) {
55824
55840
  const removedItems = [];
55825
- this.findItemAndApply(op.item, (item) => {
55826
- this.index.remove(item);
55827
- this.selection.remove(item);
55828
- if (item instanceof Connector2) {
55829
- item.clearObservedItems();
55841
+ this.findItemAndApply(op.item, (item2) => {
55842
+ this.index.remove(item2);
55843
+ this.selection.remove(item2);
55844
+ if (item2 instanceof Connector2) {
55845
+ item2.clearObservedItems();
55830
55846
  }
55831
- removedItems.push(item);
55847
+ removedItems.push(item2);
55832
55848
  });
55833
55849
  }
55834
55850
  applyRemoveLockedGroupOperation(op) {
55835
- const item = this.index.getById(op.item[0]);
55836
- if (!item || !(item instanceof Group)) {
55851
+ const item2 = this.index.getById(op.item[0]);
55852
+ if (!item2 || !(item2 instanceof Group)) {
55837
55853
  return;
55838
55854
  }
55839
- item.getChildren().forEach((item2) => {
55840
- item2.transformation.isLocked = false;
55841
- item2.parent = "Board";
55855
+ item2.getChildren().forEach((item3) => {
55856
+ item3.transformation.isLocked = false;
55857
+ item3.parent = "Board";
55842
55858
  });
55843
- item.transformation.isLocked = false;
55859
+ item2.transformation.isLocked = false;
55844
55860
  const removedItems = [];
55845
- this.findItemAndApply(op.item, (item2) => {
55846
- this.index.remove(item2);
55847
- this.selection.remove(item2);
55848
- removedItems.push(item2);
55861
+ this.findItemAndApply(op.item, (item3) => {
55862
+ this.index.remove(item3);
55863
+ this.selection.remove(item3);
55864
+ removedItems.push(item3);
55849
55865
  });
55850
55866
  }
55851
55867
  applyItemOperation(op) {
55852
55868
  if ("item" in op) {
55853
- this.findItemAndApply(op.item, (item) => {
55854
- item.apply(op);
55869
+ this.findItemAndApply(op.item, (item2) => {
55870
+ item2.apply(op);
55855
55871
  });
55856
55872
  }
55857
55873
  }
55858
- findItemAndApply(item, apply) {
55859
- if (Array.isArray(item)) {
55860
- for (const itemId of item) {
55874
+ findItemAndApply(item2, apply) {
55875
+ if (Array.isArray(item2)) {
55876
+ for (const itemId of item2) {
55861
55877
  const found = this.items.findById(itemId);
55862
55878
  if (found) {
55863
55879
  apply(found);
55864
55880
  }
55865
55881
  }
55866
55882
  } else {
55867
- const found = this.items.findById(item);
55883
+ const found = this.items.findById(item2);
55868
55884
  if (found) {
55869
55885
  apply(found);
55870
55886
  }
@@ -55873,9 +55889,9 @@ class Board {
55873
55889
  handleNesting(items) {
55874
55890
  const arrayed = Array.isArray(items) ? items : [items];
55875
55891
  const groupsMap = new Map;
55876
- arrayed.forEach((item) => {
55877
- const itemCenter = item.getMbr().getCenter();
55878
- const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item)).reduce((acc, groupItem2) => {
55892
+ arrayed.forEach((item2) => {
55893
+ const itemCenter = item2.getMbr().getCenter();
55894
+ const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item2)).reduce((acc, groupItem2) => {
55879
55895
  if (!acc || groupItem2.getDistanceToPoint(itemCenter) > acc.getDistanceToPoint(itemCenter)) {
55880
55896
  acc = groupItem2;
55881
55897
  }
@@ -55885,7 +55901,7 @@ class Board {
55885
55901
  if (!groupsMap.has(groupItem)) {
55886
55902
  groupsMap.set(groupItem, []);
55887
55903
  }
55888
- groupsMap.get(groupItem)?.push(item);
55904
+ groupsMap.get(groupItem)?.push(item2);
55889
55905
  }
55890
55906
  });
55891
55907
  groupsMap.forEach((items2, group) => {
@@ -55906,13 +55922,13 @@ class Board {
55906
55922
  }
55907
55923
  return parser(el);
55908
55924
  }
55909
- add(item, timeStamp) {
55925
+ add(item2, timeStamp) {
55910
55926
  const id = this.getNewItemId();
55911
55927
  this.emit({
55912
55928
  class: "Board",
55913
55929
  method: "add",
55914
55930
  item: id,
55915
- data: item.serialize(),
55931
+ data: item2.serialize(),
55916
55932
  timeStamp
55917
55933
  });
55918
55934
  const newItem = this.items.getById(id);
@@ -55922,13 +55938,13 @@ class Board {
55922
55938
  this.handleNesting(newItem);
55923
55939
  return newItem;
55924
55940
  }
55925
- addLockedGroup(item) {
55941
+ addLockedGroup(item2) {
55926
55942
  const id = this.getNewItemId();
55927
55943
  this.emit({
55928
55944
  class: "Board",
55929
55945
  method: "addLockedGroup",
55930
55946
  item: id,
55931
- data: item.serialize()
55947
+ data: item2.serialize()
55932
55948
  });
55933
55949
  const newItem = this.items.getById(id);
55934
55950
  if (!newItem) {
@@ -55937,32 +55953,32 @@ class Board {
55937
55953
  this.handleNesting(newItem);
55938
55954
  return newItem;
55939
55955
  }
55940
- remove(item, withConnectors = true) {
55956
+ remove(item2, withConnectors = true) {
55941
55957
  let connectors = [];
55942
55958
  if (withConnectors) {
55943
- connectors = this.items.getLinkedConnectorsById(item.getId()).map((connector) => connector.getId());
55959
+ connectors = this.items.getLinkedConnectorsById(item2.getId()).map((connector) => connector.getId());
55944
55960
  }
55945
- if ("onRemove" in item) {
55946
- item.onRemove();
55961
+ if ("onRemove" in item2) {
55962
+ item2.onRemove();
55947
55963
  }
55948
55964
  this.emit({
55949
55965
  class: "Board",
55950
55966
  method: "remove",
55951
- item: [item.getId(), ...connectors]
55967
+ item: [item2.getId(), ...connectors]
55952
55968
  });
55953
55969
  }
55954
- removeLockedGroup(item) {
55970
+ removeLockedGroup(item2) {
55955
55971
  this.emit({
55956
55972
  class: "Board",
55957
55973
  method: "removeLockedGroup",
55958
- item: [item.getId()]
55974
+ item: [item2.getId()]
55959
55975
  });
55960
55976
  }
55961
55977
  getByZIndex(index2) {
55962
55978
  return this.index.getByZIndex(index2);
55963
55979
  }
55964
- getZIndex(item) {
55965
- return this.index.getZIndex(item);
55980
+ getZIndex(item2) {
55981
+ return this.index.getZIndex(item2);
55966
55982
  }
55967
55983
  getLastZIndex() {
55968
55984
  return this.index.getLastZIndex();
@@ -55974,11 +55990,11 @@ class Board {
55974
55990
  item: items
55975
55991
  });
55976
55992
  }
55977
- moveToZIndex(item, zIndex) {
55993
+ moveToZIndex(item2, zIndex) {
55978
55994
  this.emit({
55979
55995
  class: "Board",
55980
55996
  method: "moveToZIndex",
55981
- item: item.getId(),
55997
+ item: item2.getId(),
55982
55998
  zIndex
55983
55999
  });
55984
56000
  }
@@ -56006,8 +56022,8 @@ class Board {
56006
56022
  this.emit({
56007
56023
  class: "Board",
56008
56024
  method: "bringToFront",
56009
- item: items.map((item) => item.getId()),
56010
- prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
56025
+ item: items.map((item2) => item2.getId()),
56026
+ prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
56011
56027
  });
56012
56028
  }
56013
56029
  sendToBack(items) {
@@ -56018,8 +56034,8 @@ class Board {
56018
56034
  this.emit({
56019
56035
  class: "Board",
56020
56036
  method: "sendToBack",
56021
- item: items.map((item) => item.getId()),
56022
- prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
56037
+ item: items.map((item2) => item2.getId()),
56038
+ prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
56023
56039
  });
56024
56040
  }
56025
56041
  copy() {
@@ -56096,7 +56112,7 @@ class Board {
56096
56112
  return added;
56097
56113
  });
56098
56114
  addedFrame.addChildItems(addedChildren);
56099
- parsedData.data.children = addedChildren.map((item) => item.getId());
56115
+ parsedData.data.children = addedChildren.map((item2) => item2.getId());
56100
56116
  idsMap[parsedData.data.id] = addedFrame.getId();
56101
56117
  } else {
56102
56118
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -56137,15 +56153,15 @@ class Board {
56137
56153
  const createdConnectors = {};
56138
56154
  const createdFrames = {};
56139
56155
  const addItem = (itemData) => {
56140
- const item = this.createItem(itemData.id, itemData);
56141
- if (item instanceof Connector2) {
56142
- createdConnectors[itemData.id] = { item, itemData };
56156
+ const item2 = this.createItem(itemData.id, itemData);
56157
+ if (item2 instanceof Connector2) {
56158
+ createdConnectors[itemData.id] = { item: item2, itemData };
56143
56159
  }
56144
- if (item instanceof Frame2) {
56145
- createdFrames[item.getId()] = { item, itemData };
56160
+ if (item2 instanceof Frame2) {
56161
+ createdFrames[item2.getId()] = { item: item2, itemData };
56146
56162
  }
56147
- this.index.insert(item);
56148
- return item;
56163
+ this.index.insert(item2);
56164
+ return item2;
56149
56165
  };
56150
56166
  for (const itemData of items) {
56151
56167
  if ("childrenMap" in itemData) {
@@ -56156,13 +56172,13 @@ class Board {
56156
56172
  }
56157
56173
  }
56158
56174
  for (const key in createdConnectors) {
56159
- const { item, itemData } = createdConnectors[key];
56160
- item.applyStartPoint(itemData.startPoint);
56161
- item.applyEndPoint(itemData.endPoint);
56175
+ const { item: item2, itemData } = createdConnectors[key];
56176
+ item2.applyStartPoint(itemData.startPoint);
56177
+ item2.applyEndPoint(itemData.endPoint);
56162
56178
  }
56163
56179
  for (const key in createdFrames) {
56164
- const { item, itemData } = createdFrames[key];
56165
- item.applyAddChildren(itemData.children);
56180
+ const { item: item2, itemData } = createdFrames[key];
56181
+ item2.applyAddChildren(itemData.children);
56166
56182
  }
56167
56183
  }
56168
56184
  deserialize(snapshot) {
@@ -56172,33 +56188,33 @@ class Board {
56172
56188
  const createdFrames = {};
56173
56189
  if (Array.isArray(items)) {
56174
56190
  for (const itemData of items) {
56175
- const item = this.createItem(itemData.id, itemData);
56176
- if (item instanceof Connector2) {
56177
- createdConnectors[itemData.id] = { item, itemData };
56191
+ const item2 = this.createItem(itemData.id, itemData);
56192
+ if (item2 instanceof Connector2) {
56193
+ createdConnectors[itemData.id] = { item: item2, itemData };
56178
56194
  }
56179
- if (item instanceof Frame2) {
56180
- createdFrames[item.getId()] = { item, itemData };
56195
+ if (item2 instanceof Frame2) {
56196
+ createdFrames[item2.getId()] = { item: item2, itemData };
56181
56197
  }
56182
- this.index.insert(item);
56198
+ this.index.insert(item2);
56183
56199
  }
56184
56200
  } else {
56185
56201
  for (const key in items) {
56186
56202
  const itemData = items[key];
56187
- const item = this.createItem(key, itemData);
56188
- if (item instanceof Connector2) {
56189
- createdConnectors[key] = { item, itemData };
56203
+ const item2 = this.createItem(key, itemData);
56204
+ if (item2 instanceof Connector2) {
56205
+ createdConnectors[key] = { item: item2, itemData };
56190
56206
  }
56191
- this.index.insert(item);
56207
+ this.index.insert(item2);
56192
56208
  }
56193
56209
  }
56194
56210
  for (const key in createdConnectors) {
56195
- const { item, itemData } = createdConnectors[key];
56196
- item.applyStartPoint(itemData.startPoint);
56197
- item.applyEndPoint(itemData.endPoint);
56211
+ const { item: item2, itemData } = createdConnectors[key];
56212
+ item2.applyStartPoint(itemData.startPoint);
56213
+ item2.applyEndPoint(itemData.endPoint);
56198
56214
  }
56199
56215
  for (const key in createdFrames) {
56200
- const { item, itemData } = createdFrames[key];
56201
- item.applyAddChildren(itemData.children);
56216
+ const { item: item2, itemData } = createdFrames[key];
56217
+ item2.applyAddChildren(itemData.children);
56202
56218
  }
56203
56219
  this.events?.log.deserialize(events);
56204
56220
  }
@@ -56436,7 +56452,7 @@ class Board {
56436
56452
  itemsMap: newMap,
56437
56453
  select: select2
56438
56454
  });
56439
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
56455
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
56440
56456
  this.handleNesting(items);
56441
56457
  this.selection.removeAll();
56442
56458
  this.selection.add(items);
@@ -56444,8 +56460,8 @@ class Board {
56444
56460
  return;
56445
56461
  }
56446
56462
  removeVoidComments() {
56447
- const voidComments = this.items.listAll().filter((item) => {
56448
- return item instanceof Comment && !item.getThread().length;
56463
+ const voidComments = this.items.listAll().filter((item2) => {
56464
+ return item2 instanceof Comment && !item2.getThread().length;
56449
56465
  });
56450
56466
  if (voidComments) {
56451
56467
  for (const comment2 of voidComments) {
@@ -56519,7 +56535,7 @@ class Board {
56519
56535
  }
56520
56536
  const mbr = this.selection.getMbr();
56521
56537
  const selectedItems = this.selection.items.list();
56522
- const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
56538
+ const isSelectedItemsMinWidth = selectedItems.some((item2) => item2.getMbr().getWidth() === 0);
56523
56539
  const right = mbr ? mbr.right : 0;
56524
56540
  const top = mbr ? mbr.top : 0;
56525
56541
  const width2 = mbr ? mbr.getWidth() / 10 : 10;
@@ -56561,7 +56577,7 @@ class Board {
56561
56577
  method: "duplicate",
56562
56578
  itemsMap: newMap
56563
56579
  });
56564
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
56580
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
56565
56581
  this.handleNesting(items);
56566
56582
  this.selection.removeAll();
56567
56583
  this.selection.add(items);
@@ -56582,9 +56598,9 @@ class Board {
56582
56598
  if (data.itemType === "Frame") {
56583
56599
  data.text.placeholderText = `Frame ${this.getMaxFrameSerial() + 1}`;
56584
56600
  }
56585
- const item = this.createItem(itemId, data);
56586
- this.index.insert(item);
56587
- items.push(item);
56601
+ const item2 = this.createItem(itemId, data);
56602
+ this.index.insert(item2);
56603
+ items.push(item2);
56588
56604
  };
56589
56605
  sortedItemsMap.map(([id, data]) => {
56590
56606
  if (data.itemType === "Connector") {
@@ -56599,8 +56615,8 @@ class Board {
56599
56615
  return;
56600
56616
  });
56601
56617
  }
56602
- isOnBoard(item) {
56603
- return this.items.findById(item.getId()) !== undefined;
56618
+ isOnBoard(item2) {
56619
+ return this.items.findById(item2.getId()) !== undefined;
56604
56620
  }
56605
56621
  getMaxFrameSerial() {
56606
56622
  const existingNames = this.items.listGroupItems().map((frame) => frame.getRichText()?.getTextString().length === 0 ? frame.getRichText()?.placeholderText || "" : frame.getRichText()?.getTextString() || "");
@@ -56646,7 +56662,7 @@ function areItemsTheSame(opA, opB) {
56646
56662
  const itemsB = Object.keys(opB.items);
56647
56663
  const setA = new Set(itemsA);
56648
56664
  const setB = new Set(itemsB);
56649
- const areArraysEqual = setA.size === setB.size && [...setA].every((item) => setB.has(item));
56665
+ const areArraysEqual = setA.size === setB.size && [...setA].every((item2) => setB.has(item2));
56650
56666
  return areArraysEqual;
56651
56667
  }
56652
56668
  if (!(Array.isArray(opA.item) && Array.isArray(opB.item))) {
@@ -58305,9 +58321,9 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
58305
58321
  list6.applyUnconfirmed(filter);
58306
58322
  const hasAnyOverlap = (arr1, arr2) => {
58307
58323
  const lookup9 = new Set(arr1);
58308
- return arr2.some((item) => lookup9.has(item));
58324
+ return arr2.some((item2) => lookup9.has(item2));
58309
58325
  };
58310
- const currSelection = board.selection.list().map((item) => item.getId());
58326
+ const currSelection = board.selection.list().map((item2) => item2.getId());
58311
58327
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
58312
58328
  board.selection.applyMemoizedCaretOrRange();
58313
58329
  }
@@ -58629,27 +58645,27 @@ function handleAiChatMassage(message, board) {
58629
58645
  }
58630
58646
  }
58631
58647
  function handleChatChunk(chunk, board) {
58632
- const item = board.items.getById(chunk.itemId);
58648
+ const item2 = board.items.getById(chunk.itemId);
58633
58649
  switch (chunk.type) {
58634
58650
  case "chunk":
58635
- if (!item || item.itemType !== "AINode") {
58651
+ if (!item2 || item2.itemType !== "AINode") {
58636
58652
  return;
58637
58653
  }
58638
- item.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
58654
+ item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
58639
58655
  break;
58640
58656
  case "done":
58641
- if (!item || item.itemType !== "AINode") {
58657
+ if (!item2 || item2.itemType !== "AINode") {
58642
58658
  board.aiGeneratingOnItem = undefined;
58643
58659
  return;
58644
58660
  }
58645
- item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58661
+ item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58646
58662
  break;
58647
58663
  case "end":
58648
- if (!item || item.itemType !== "AINode") {
58664
+ if (!item2 || item2.itemType !== "AINode") {
58649
58665
  board.aiGeneratingOnItem = undefined;
58650
58666
  return;
58651
58667
  }
58652
- item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58668
+ item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58653
58669
  break;
58654
58670
  case "error":
58655
58671
  default:
@@ -58666,7 +58682,7 @@ function handleChatChunk(chunk, board) {
58666
58682
  if (board.aiGeneratingOnItem && generatingItem) {
58667
58683
  board.selection.removeAll();
58668
58684
  board.selection.add(generatingItem);
58669
- const rt = item?.getRichText();
58685
+ const rt = item2?.getRichText();
58670
58686
  if (generatingItem.itemType === "AINode" && rt) {
58671
58687
  const editor = rt.editor;
58672
58688
  editor.markdownProcessor.setStopProcessingMarkDownCb(null);
@@ -58799,14 +58815,14 @@ function handleImageGenerate(response, board) {
58799
58815
  console.error("Image generation error:", response.message);
58800
58816
  if (response.isExternalApiError) {
58801
58817
  if (board.aiGeneratingOnItem) {
58802
- const item = board.items.getById(board.aiGeneratingOnItem);
58803
- if (item) {
58818
+ const item2 = board.items.getById(board.aiGeneratingOnItem);
58819
+ if (item2) {
58804
58820
  board.selection.removeAll();
58805
- board.selection.add(item);
58806
- const editor = item.getRichText()?.editor;
58821
+ board.selection.add(item2);
58822
+ const editor = item2.getRichText()?.editor;
58807
58823
  editor?.clearText();
58808
58824
  editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
58809
- board.camera.zoomToFit(item.getMbr(), 20);
58825
+ board.camera.zoomToFit(item2.getMbr(), 20);
58810
58826
  }
58811
58827
  }
58812
58828
  } else {